diff options
author | Ayke van Laethem <[email protected]> | 2022-06-29 15:30:41 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2022-07-15 14:46:33 +0200 |
commit | 0a93347e1c1611f5c5ebcb138759fd4d0e522c7d (patch) | |
tree | 1483a8bfd95a9d6131754d42754afb500ab9161b | |
parent | 411333327efdb3bc46d1e05fef11bebfc24325a2 (diff) | |
download | tinygo-0a93347e1c1611f5c5ebcb138759fd4d0e522c7d.tar.gz tinygo-0a93347e1c1611f5c5ebcb138759fd4d0e522c7d.zip |
machine: reorder pin definitions to improve pin list on tinygo.org
25 files changed, 172 insertions, 140 deletions
diff --git a/src/machine/board_arduino_mega1280.go b/src/machine/board_arduino_mega1280.go index 961fcec23..a4908847b 100644 --- a/src/machine/board_arduino_mega1280.go +++ b/src/machine/board_arduino_mega1280.go @@ -9,9 +9,6 @@ func CPUFrequency() uint32 { } const ( - AREF Pin = NoPin - LED Pin = PB7 - A0 Pin = PF0 A1 Pin = PF1 A2 Pin = PF2 @@ -102,4 +99,7 @@ const ( D51 Pin = PB2 D52 Pin = PB1 D53 Pin = PB0 + + AREF Pin = NoPin + LED Pin = PB7 ) diff --git a/src/machine/board_arduino_mega2560.go b/src/machine/board_arduino_mega2560.go index ed6530c9e..57af7cb5e 100644 --- a/src/machine/board_arduino_mega2560.go +++ b/src/machine/board_arduino_mega2560.go @@ -14,9 +14,6 @@ func CPUFrequency() uint32 { } const ( - AREF Pin = NoPin - LED Pin = PB7 - A0 Pin = PF0 A1 Pin = PF1 A2 Pin = PF2 @@ -107,6 +104,9 @@ const ( D51 Pin = PB2 D52 Pin = PB1 D53 Pin = PB0 + + AREF Pin = NoPin + LED Pin = PB7 ) // UART pins diff --git a/src/machine/board_arduino_mkr1000.go b/src/machine/board_arduino_mkr1000.go index b7d2b51ab..a494eb7f1 100644 --- a/src/machine/board_arduino_mkr1000.go +++ b/src/machine/board_arduino_mkr1000.go @@ -12,9 +12,6 @@ const RESET_MAGIC_VALUE = 0x07738135 // GPIO Pins const ( - RX0 Pin = PB23 // UART2 RX - TX1 Pin = PB22 // UART2 TX - D0 Pin = PA22 // PWM available D1 Pin = PA23 // PWM available D2 Pin = PA10 // PWM available @@ -31,6 +28,9 @@ const ( D12 Pin = PA09 // PWM available, SCL D13 Pin = PB23 // RX D14 Pin = PB22 // TX + + RX0 Pin = PB23 // UART2 RX + TX1 Pin = PB22 // UART2 TX ) // Analog pins diff --git a/src/machine/board_arduino_mkrwifi1010.go b/src/machine/board_arduino_mkrwifi1010.go index 89eb25d8f..03d4f11b6 100644 --- a/src/machine/board_arduino_mkrwifi1010.go +++ b/src/machine/board_arduino_mkrwifi1010.go @@ -12,9 +12,6 @@ const RESET_MAGIC_VALUE = 0x07738135 // GPIO Pins const ( - RX0 Pin = PB23 // UART1 RX - TX1 Pin = PB22 // UART1 TX - D0 Pin = PA22 // PWM available D1 Pin = PA23 // PWM available D2 Pin = PA10 // PWM available @@ -31,6 +28,9 @@ const ( D12 Pin = PA09 // PWM available, SCL D13 Pin = PB23 // RX D14 Pin = PB22 // TX + + RX0 Pin = PB23 // UART1 RX + TX1 Pin = PB22 // UART1 TX ) // Analog pins diff --git a/src/machine/board_arduino_zero.go b/src/machine/board_arduino_zero.go index 3c04f37a4..709109d7f 100644 --- a/src/machine/board_arduino_zero.go +++ b/src/machine/board_arduino_zero.go @@ -28,14 +28,6 @@ const ( D13 = PA17 // PWM available ) -// LEDs on the Arduino Zero -const ( - LED = LED1 - LED1 Pin = D13 - LED2 Pin = PA27 // TX LED - LED3 Pin = PB03 // RX LED -) - // ADC pins const ( AREF Pin = PA03 @@ -47,6 +39,14 @@ const ( ADC5 Pin = PB02 ) +// LEDs on the Arduino Zero +const ( + LED = LED1 + LED1 Pin = D13 + LED2 Pin = PA27 // TX LED + LED3 Pin = PB03 // RX LED +) + // SPI pins - EDBG connected const ( SPI0_SDO_PIN Pin = PA16 // MOSI: SERCOM1/PAD[0] diff --git a/src/machine/board_bluepill.go b/src/machine/board_bluepill.go index 9f7dca8a4..278bbdc66 100644 --- a/src/machine/board_bluepill.go +++ b/src/machine/board_bluepill.go @@ -8,14 +8,42 @@ import ( "runtime/interrupt" ) +// Pins printed on the silkscreen const ( - LED = PC13 -) - -const ( - // This board does not have a user button, so - // use first GPIO pin by default - BUTTON = PA0 + C13 = PC13 + C14 = PC14 + C15 = PC15 + A0 = PA0 + A1 = PA1 + A2 = PA2 + A3 = PA3 + A4 = PA4 + A5 = PA5 + A6 = PA6 + A7 = PA7 + B0 = PB0 + B1 = PB1 + B10 = PB10 + B11 = PB11 + B12 = PB12 + B13 = PB13 + B14 = PB14 + B15 = PB15 + A8 = PA8 + A9 = PA9 + A10 = PA10 + A11 = PA11 + A12 = PA12 + A13 = PA13 + A14 = PA14 + A15 = PA15 + B3 = PB3 + B4 = PB4 + B5 = PB5 + B6 = PB6 + B7 = PB7 + B8 = PB8 + B9 = PB9 ) // Analog Pins @@ -32,6 +60,14 @@ const ( ADC9 = PB1 ) +const ( + // This board does not have a user button, so + // use first GPIO pin by default + BUTTON = PA0 + + LED = PC13 +) + var DefaultUART = UART1 // UART pins diff --git a/src/machine/board_esp32-coreboard-v2.go b/src/machine/board_esp32-coreboard-v2.go index b61a15e69..10aeafed3 100644 --- a/src/machine/board_esp32-coreboard-v2.go +++ b/src/machine/board_esp32-coreboard-v2.go @@ -3,36 +3,33 @@ package machine -// Built-in LED on some ESP32 boards. -const LED = IO2 - const ( CLK = GPIO6 CMD = GPIO11 IO0 = GPIO0 IO1 = GPIO1 + IO2 = GPIO2 + IO3 = GPIO3 + IO4 = GPIO4 + IO5 = GPIO5 + IO9 = GPIO9 IO10 = GPIO10 IO16 = GPIO16 IO17 = GPIO17 IO18 = GPIO18 IO19 = GPIO19 - IO2 = GPIO2 IO21 = GPIO21 IO22 = GPIO22 IO23 = GPIO23 IO25 = GPIO25 IO26 = GPIO26 IO27 = GPIO27 - IO3 = GPIO3 IO32 = GPIO32 IO33 = GPIO33 IO34 = GPIO34 IO35 = GPIO35 IO36 = GPIO36 IO39 = GPIO39 - IO4 = GPIO4 - IO5 = GPIO5 - IO9 = GPIO9 RXD = GPIO3 SD0 = GPIO7 SD1 = GPIO8 @@ -47,6 +44,9 @@ const ( TXD = GPIO1 ) +// Built-in LED on some ESP32 boards. +const LED = IO2 + // SPI pins const ( SPI0_SCK_PIN = IO18 diff --git a/src/machine/board_feather_rp2040.go b/src/machine/board_feather_rp2040.go index 04991d2e2..088815c67 100644 --- a/src/machine/board_feather_rp2040.go +++ b/src/machine/board_feather_rp2040.go @@ -8,12 +8,8 @@ import ( "runtime/interrupt" ) -const ( - LED = GPIO13 - - // Onboard crystal oscillator frequency, in MHz. - xoscFreq = 12 // MHz -) +// Onboard crystal oscillator frequency, in MHz. +const xoscFreq = 12 // MHz // GPIO Pins const ( @@ -37,6 +33,8 @@ const ( A3 = GPIO29 ) +const LED = GPIO13 + // I2C Pins. const ( I2C0_SDA_PIN = GPIO24 diff --git a/src/machine/board_microbit.go b/src/machine/board_microbit.go index 630b8c345..b6b7823aa 100644 --- a/src/machine/board_microbit.go +++ b/src/machine/board_microbit.go @@ -6,15 +6,36 @@ package machine // The micro:bit does not have a 32kHz crystal on board. const HasLowFrequencyCrystal = false +var DefaultUART = UART0 + +// GPIO/Analog pins +const ( + P0 = P0_03 + P1 = P0_02 + P2 = P0_01 + P3 = P0_04 + P4 = P0_05 + P5 = P0_17 + P6 = P0_12 + P7 = P0_11 + P8 = P0_18 + P9 = P0_10 + P10 = P0_06 + P11 = P0_26 + P12 = P0_20 + P13 = P0_23 + P14 = P0_22 + P15 = P0_21 + P16 = P0_16 +) + // Buttons on the micro:bit (A and B) const ( - BUTTON = BUTTONA BUTTONA = P0_17 BUTTONB = P0_26 + BUTTON = BUTTONA ) -var DefaultUART = UART0 - // UART pins const ( UART_TX_PIN = P0_24 @@ -41,27 +62,6 @@ const ( SPI0_SDI_PIN = P0_22 // P14 on the board ) -// GPIO/Analog pins -const ( - P0 = P0_03 - P1 = P0_02 - P2 = P0_01 - P3 = P0_04 - P4 = P0_05 - P5 = P0_17 - P6 = P0_12 - P7 = P0_11 - P8 = P0_18 - P9 = P0_10 - P10 = P0_06 - P11 = P0_26 - P12 = P0_20 - P13 = P0_23 - P14 = P0_22 - P15 = P0_21 - P16 = P0_16 -) - // LED matrix pins const ( LED_COL_1 = P0_04 diff --git a/src/machine/board_nrf52840-mdk.go b/src/machine/board_nrf52840-mdk.go index 262983c3a..c9e012bc0 100644 --- a/src/machine/board_nrf52840-mdk.go +++ b/src/machine/board_nrf52840-mdk.go @@ -7,10 +7,10 @@ const HasLowFrequencyCrystal = true // LEDs on the nrf52840-mdk (nRF52840 dev board) const ( - LED Pin = LED_GREEN LED_GREEN Pin = 22 LED_RED Pin = 23 LED_BLUE Pin = 24 + LED Pin = LED_GREEN ) // UART pins diff --git a/src/machine/board_nucleol031k6.go b/src/machine/board_nucleol031k6.go index cc0fbe15b..1f6e4d045 100644 --- a/src/machine/board_nucleol031k6.go +++ b/src/machine/board_nucleol031k6.go @@ -9,18 +9,6 @@ import ( ) const ( - LED = LED_BUILTIN - LED_BUILTIN = LED_GREEN - LED_GREEN = PB3 -) - -const ( - // This board does not have a user button, so - // use first GPIO pin by default - BUTTON = PA0 -) - -const ( // Arduino Pins A0 = PA0 // ADC_IN0 A1 = PA1 // ADC_IN1 @@ -46,6 +34,18 @@ const ( ) const ( + LED = LED_BUILTIN + LED_BUILTIN = LED_GREEN + LED_GREEN = PB3 +) + +const ( + // This board does not have a user button, so + // use first GPIO pin by default + BUTTON = PA0 +) + +const ( // UART pins // PA2 and PA15 are connected to the ST-Link Virtual Com Port (VCP) UART_TX_PIN = PA2 diff --git a/src/machine/board_nucleol432kc.go b/src/machine/board_nucleol432kc.go index d8c91d06d..9a5c5d88c 100644 --- a/src/machine/board_nucleol432kc.go +++ b/src/machine/board_nucleol432kc.go @@ -9,18 +9,6 @@ import ( ) const ( - LED = LED_BUILTIN - LED_BUILTIN = LED_GREEN - LED_GREEN = PB3 -) - -const ( - // This board does not have a user button, so - // use first GPIO pin by default - BUTTON = PA0 -) - -const ( // Arduino Pins A0 = PA0 A1 = PA1 @@ -48,6 +36,18 @@ const ( ) const ( + LED = LED_BUILTIN + LED_BUILTIN = LED_GREEN + LED_GREEN = PB3 +) + +const ( + // This board does not have a user button, so + // use first GPIO pin by default + BUTTON = PA0 +) + +const ( // UART pins // PA2 and PA15 are connected to the ST-Link Virtual Com Port (VCP) UART_TX_PIN = PA2 diff --git a/src/machine/board_nucleol552ze.go b/src/machine/board_nucleol552ze.go index d34f40d64..d9102c521 100644 --- a/src/machine/board_nucleol552ze.go +++ b/src/machine/board_nucleol552ze.go @@ -9,11 +9,11 @@ import ( ) const ( - LED = LED_BUILTIN - LED_BUILTIN = LED_GREEN LED_GREEN = PC7 LED_BLUE = PB7 LED_RED = PA9 + LED_BUILTIN = LED_GREEN + LED = LED_BUILTIN ) const ( diff --git a/src/machine/board_particle_argon.go b/src/machine/board_particle_argon.go index 48df2e435..2ba568b43 100644 --- a/src/machine/board_particle_argon.go +++ b/src/machine/board_particle_argon.go @@ -8,14 +8,6 @@ const HasLowFrequencyCrystal = true // More info: https://docs.particle.io/datasheets/wi-fi/argon-datasheet/ // Board diagram: https://docs.particle.io/assets/images/argon/argon-block-diagram.png -// LEDs -const ( - LED Pin = 44 - LED_GREEN Pin = 14 - LED_RED Pin = 13 - LED_BLUE Pin = 15 -) - // GPIOs const ( A0 Pin = 3 @@ -40,6 +32,14 @@ const ( D13 Pin = 47 // Also SCK ) +// LEDs +const ( + LED Pin = 44 + LED_GREEN Pin = 14 + LED_RED Pin = 13 + LED_BLUE Pin = 15 +) + // UART var ( DefaultUART = UART0 diff --git a/src/machine/board_particle_boron.go b/src/machine/board_particle_boron.go index 103cfbb62..fb83eed18 100644 --- a/src/machine/board_particle_boron.go +++ b/src/machine/board_particle_boron.go @@ -8,14 +8,6 @@ const HasLowFrequencyCrystal = true // More info: https://docs.particle.io/datasheets/cellular/boron-datasheet/ // Board diagram: https://docs.particle.io/assets/images/boron/boron-block-diagram.png -// LEDs -const ( - LED Pin = 44 - LED_GREEN Pin = 14 - LED_RED Pin = 13 - LED_BLUE Pin = 15 -) - // GPIOs const ( A0 Pin = 3 @@ -40,6 +32,14 @@ const ( D13 Pin = 47 // Also SCK ) +// LEDs +const ( + LED Pin = 44 + LED_GREEN Pin = 14 + LED_RED Pin = 13 + LED_BLUE Pin = 15 +) + // UART var ( DefaultUART = UART0 diff --git a/src/machine/board_particle_xenon.go b/src/machine/board_particle_xenon.go index 5a902186e..2d86ec9dc 100644 --- a/src/machine/board_particle_xenon.go +++ b/src/machine/board_particle_xenon.go @@ -8,14 +8,6 @@ const HasLowFrequencyCrystal = true // More info: https://docs.particle.io/datasheets/discontinued/xenon-datasheet/ // Board diagram: https://docs.particle.io/assets/images/xenon/xenon-block-diagram.png -// LEDs -const ( - LED Pin = 44 - LED_GREEN Pin = 14 - LED_RED Pin = 13 - LED_BLUE Pin = 15 -) - // GPIOs const ( A0 Pin = 3 @@ -40,6 +32,14 @@ const ( D13 Pin = 47 // Also SCK ) +// LEDs +const ( + LED Pin = 44 + LED_GREEN Pin = 14 + LED_RED Pin = 13 + LED_BLUE Pin = 15 +) + // UART var ( DefaultUART = UART0 diff --git a/src/machine/board_pca10031.go b/src/machine/board_pca10031.go index 94f0784cc..b1cc1f278 100644 --- a/src/machine/board_pca10031.go +++ b/src/machine/board_pca10031.go @@ -11,13 +11,13 @@ const HasLowFrequencyCrystal = true // LED on the pca10031 const ( - LED = LED_RED LED1 = LED_RED LED2 = LED_GREEN LED3 = LED_BLUE LED_RED = P0_21 LED_GREEN = P0_22 LED_BLUE = P0_23 + LED = LED_RED ) var DefaultUART = UART0 diff --git a/src/machine/board_pca10040.go b/src/machine/board_pca10040.go index 03189ad14..d41c791d2 100644 --- a/src/machine/board_pca10040.go +++ b/src/machine/board_pca10040.go @@ -8,20 +8,20 @@ const HasLowFrequencyCrystal = true // LEDs on the PCA10040 (nRF52832 dev board) const ( - LED Pin = LED1 LED1 Pin = 17 LED2 Pin = 18 LED3 Pin = 19 LED4 Pin = 20 + LED Pin = LED1 ) // Buttons on the PCA10040 (nRF52832 dev board) const ( - BUTTON Pin = BUTTON1 BUTTON1 Pin = 13 BUTTON2 Pin = 14 BUTTON3 Pin = 15 BUTTON4 Pin = 16 + BUTTON Pin = BUTTON1 ) var DefaultUART = UART0 diff --git a/src/machine/board_pca10056.go b/src/machine/board_pca10056.go index df6bbb871..16665bcb6 100644 --- a/src/machine/board_pca10056.go +++ b/src/machine/board_pca10056.go @@ -7,20 +7,20 @@ const HasLowFrequencyCrystal = true // LEDs on the pca10056 const ( - LED Pin = LED1 LED1 Pin = 13 LED2 Pin = 14 LED3 Pin = 15 LED4 Pin = 16 + LED Pin = LED1 ) // Buttons on the pca10056 const ( - BUTTON Pin = BUTTON1 BUTTON1 Pin = 11 BUTTON2 Pin = 12 BUTTON3 Pin = 24 BUTTON4 Pin = 25 + BUTTON Pin = BUTTON1 ) var DefaultUART = UART0 diff --git a/src/machine/board_pca10059.go b/src/machine/board_pca10059.go index 42be8f3ab..1ec9610dc 100644 --- a/src/machine/board_pca10059.go +++ b/src/machine/board_pca10059.go @@ -8,17 +8,17 @@ const HasLowFrequencyCrystal = true // LEDs on the PCA10059 (nRF52840 dongle) const ( - LED Pin = LED1 LED1 Pin = 6 LED2 Pin = 8 LED3 Pin = (1 << 5) | 9 LED4 Pin = 12 + LED Pin = LED1 ) // Buttons on the PCA10059 (nRF52840 dongle) const ( - BUTTON Pin = BUTTON1 BUTTON1 Pin = (1 << 5) | 6 + BUTTON Pin = BUTTON1 ) // ADC pins diff --git a/src/machine/board_pinetime-devkit0.go b/src/machine/board_pinetime-devkit0.go index e71f9e97d..781092a23 100644 --- a/src/machine/board_pinetime-devkit0.go +++ b/src/machine/board_pinetime-devkit0.go @@ -12,10 +12,10 @@ const HasLowFrequencyCrystal = true // LEDs simply expose the three brightness level LEDs on the PineTime. They can // be useful for simple "hello world" style programs. const ( - LED = LED1 LED1 = LCD_BACKLIGHT_HIGH LED2 = LCD_BACKLIGHT_MID LED3 = LCD_BACKLIGHT_LOW + LED = LED1 ) var DefaultUART = UART0 diff --git a/src/machine/board_reelboard.go b/src/machine/board_reelboard.go index c8383c1fb..36dbc8d91 100644 --- a/src/machine/board_reelboard.go +++ b/src/machine/board_reelboard.go @@ -7,15 +7,15 @@ const HasLowFrequencyCrystal = true // Pins on the reel board const ( - LED Pin = LED1 - LED1 Pin = LED_YELLOW - LED2 Pin = LED_RED - LED3 Pin = LED_GREEN - LED4 Pin = LED_BLUE LED_RED Pin = 11 LED_GREEN Pin = 12 LED_BLUE Pin = 41 LED_YELLOW Pin = 13 + LED1 Pin = LED_YELLOW + LED2 Pin = LED_RED + LED3 Pin = LED_GREEN + LED4 Pin = LED_BLUE + LED Pin = LED1 EPD_BUSY_PIN Pin = 14 EPD_RESET_PIN Pin = 15 EPD_DC_PIN Pin = 16 diff --git a/src/machine/board_stm32f4disco.go b/src/machine/board_stm32f4disco.go index f396e4ca2..36cfcf07a 100644 --- a/src/machine/board_stm32f4disco.go +++ b/src/machine/board_stm32f4disco.go @@ -9,16 +9,16 @@ import ( ) const ( - LED = LED_BUILTIN LED1 = LED_GREEN LED2 = LED_ORANGE LED3 = LED_RED LED4 = LED_BLUE - LED_BUILTIN = LED_GREEN LED_GREEN = PD12 LED_ORANGE = PD13 LED_RED = PD14 LED_BLUE = PD15 + LED = LED_BUILTIN + LED_BUILTIN = LED_GREEN ) const ( diff --git a/src/machine/board_teensy36.go b/src/machine/board_teensy36.go index 106382be3..5ccb29ef8 100644 --- a/src/machine/board_teensy36.go +++ b/src/machine/board_teensy36.go @@ -9,9 +9,6 @@ func CPUFrequency() uint32 { return 180000000 } // ClockFrequency returns the frequency of the external oscillator (16MHz) func ClockFrequency() uint32 { return 16000000 } -// LED on the Teensy -const LED = PC05 - // digital IO const ( D00 = PB16 @@ -80,6 +77,9 @@ const ( D63 = PE05 ) +// LED on the Teensy +const LED = PC05 + var ( TeensyUART1 = UART0 TeensyUART2 = UART1 diff --git a/src/machine/board_thingplus_rp2040.go b/src/machine/board_thingplus_rp2040.go index 10fa5cc76..d814116f8 100644 --- a/src/machine/board_thingplus_rp2040.go +++ b/src/machine/board_thingplus_rp2040.go @@ -8,12 +8,8 @@ import ( "runtime/interrupt" ) -const ( - LED = GPIO25 - - // Onboard crystal oscillator frequency, in MHz. - xoscFreq = 12 // MHz -) +// Onboard crystal oscillator frequency, in MHz. +const xoscFreq = 12 // MHz // GPIO Pins const ( @@ -56,6 +52,8 @@ const ( A3 = GPIO29 ) +const LED = GPIO25 + // I2C Pins. const ( I2C0_SCL_PIN = GPIO6 // N/A |