aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/machine/board_stm32.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2019-05-22 17:46:14 +0200
committerRon Evans <[email protected]>2019-06-28 10:00:14 +0200
commit4ecd478d828498840080356a8684cce2d61494dc (patch)
tree16593991bb3a92113dc9bfd8828acd5141e2fce3 /src/machine/board_stm32.go
parent40b193f1faa507e8d6407624c1f00937602b0b89 (diff)
downloadtinygo-4ecd478d828498840080356a8684cce2d61494dc.tar.gz
tinygo-4ecd478d828498840080356a8684cce2d61494dc.zip
machine: add generic board support on non-baremetal hardware
Instead of trying to modify periperhals directly, external functions are called. For example, __tinygo_gpio_set sets a GPIO pin to a specified value (high or low). It is expected that binaries made this way will be linked with some extra libraries that implement support for these functions. One particularly interesting case is this experimental board simulator: https://github.com/aykevl/tinygo-play Compiling code to WebAssembly with the correct build tag for a board will enable this board to be simulated in the browser. Atmel/Microchip based SAMD boards are not currently supported, because their I2C/SPI support is somewhat uncommon and harder to support in the machine API. They may require a modification to the machine API for proper support.
Diffstat (limited to 'src/machine/board_stm32.go')
-rw-r--r--src/machine/board_stm32.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/machine/board_stm32.go b/src/machine/board_stm32.go
new file mode 100644
index 000000000..02ab51a65
--- /dev/null
+++ b/src/machine/board_stm32.go
@@ -0,0 +1,16 @@
+// +build bluepill stm32f4disco
+
+package machine
+
+// Peripheral abstraction layer for the stm32.
+
+const (
+ portA Pin = iota * 16
+ portB
+ portC
+ portD
+ portE
+ portF
+ portG
+ portH
+)