diff options
author | Ayke van Laethem <[email protected]> | 2022-06-28 16:14:33 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2022-07-15 14:46:33 +0200 |
commit | 153ff09cc5b2d3986127ad0f7f72f2818e3f5f66 (patch) | |
tree | 0d5d95c676b5fc71cb9077c1481a5d7076e00161 | |
parent | 57cddf5657f5b7997657cb8ed1a369e51dd5c87c (diff) | |
download | tinygo-153ff09cc5b2d3986127ad0f7f72f2818e3f5f66.tar.gz tinygo-153ff09cc5b2d3986127ad0f7f72f2818e3f5f66.zip |
esp8266: provide hardware pin constants like GPIO2
-rw-r--r-- | src/machine/board_nodemcu.go | 18 | ||||
-rw-r--r-- | src/machine/machine_esp8266.go | 21 |
2 files changed, 30 insertions, 9 deletions
diff --git a/src/machine/board_nodemcu.go b/src/machine/board_nodemcu.go index b3dbc3358..f204b7770 100644 --- a/src/machine/board_nodemcu.go +++ b/src/machine/board_nodemcu.go @@ -7,15 +7,15 @@ package machine // GPIO pins on the NodeMCU board. const ( - D0 Pin = 16 - D1 Pin = 5 - D2 Pin = 4 - D3 Pin = 0 - D4 Pin = 2 - D5 Pin = 14 - D6 Pin = 12 - D7 Pin = 13 - D8 Pin = 15 + D0 = GPIO16 + D1 = GPIO5 + D2 = GPIO4 + D3 = GPIO0 + D4 = GPIO2 + D5 = GPIO14 + D6 = GPIO12 + D7 = GPIO13 + D8 = GPIO15 ) // Onboard blue LED (on the AI-Thinker module). diff --git a/src/machine/machine_esp8266.go b/src/machine/machine_esp8266.go index 77fb0ba63..3b27a1915 100644 --- a/src/machine/machine_esp8266.go +++ b/src/machine/machine_esp8266.go @@ -19,6 +19,27 @@ const ( PinInput ) +// Hardware pin numbers +const ( + GPIO0 Pin = iota + GPIO1 + GPIO2 + GPIO3 + GPIO4 + GPIO5 + GPIO6 + GPIO7 + GPIO8 + GPIO9 + GPIO10 + GPIO11 + GPIO12 + GPIO13 + GPIO14 + GPIO15 + GPIO16 +) + // Pins that are fixed by the chip. const ( UART_TX_PIN Pin = 1 |