github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/machine/board_stm32f469disco.go (about) 1 //go:build stm32f469disco 2 3 package machine 4 5 import ( 6 "device/stm32" 7 "runtime/interrupt" 8 ) 9 10 const ( 11 LED = LED_BUILTIN 12 LED1 = LED_GREEN 13 LED2 = LED_ORANGE 14 LED3 = LED_RED 15 LED4 = LED_BLUE 16 LED_BUILTIN = LED_GREEN 17 LED_GREEN = PG6 18 LED_ORANGE = PD4 19 LED_RED = PD5 20 LED_BLUE = PK3 21 ) 22 23 const ( 24 BUTTON = PA0 25 ) 26 27 // UART pins 28 const ( 29 UART_TX_PIN = PB10 30 UART_RX_PIN = PB11 31 ) 32 33 var ( 34 UART3 = &_UART3 35 _UART3 = UART{ 36 Buffer: NewRingBuffer(), 37 Bus: stm32.USART3, 38 TxAltFuncSelector: AF7_USART1_2_3, 39 RxAltFuncSelector: AF7_USART1_2_3, 40 } 41 DefaultUART = UART3 42 ) 43 44 // set up RX IRQ handler. Follow similar pattern for other UARTx instances 45 func init() { 46 UART3.Interrupt = interrupt.New(stm32.IRQ_USART3, _UART3.handleInterrupt) 47 } 48 49 // SPI pins 50 const ( 51 SPI1_SCK_PIN = PA5 52 SPI1_SDI_PIN = PA6 53 SPI1_SDO_PIN = PA7 54 SPI0_SCK_PIN = SPI1_SCK_PIN 55 SPI0_SDI_PIN = SPI1_SDI_PIN 56 SPI0_SDO_PIN = SPI1_SDO_PIN 57 ) 58 59 // Since the first interface is named SPI1, both SPI0 and SPI1 refer to SPI1. 60 // TODO: implement SPI2 and SPI3. 61 var ( 62 SPI0 = SPI{ 63 Bus: stm32.SPI1, 64 AltFuncSelector: AF5_SPI1_SPI2, 65 } 66 SPI1 = &SPI0 67 ) 68 69 const ( 70 I2C0_SCL_PIN = PB6 71 I2C0_SDA_PIN = PB9 72 ) 73 74 var ( 75 I2C0 = &I2C{ 76 Bus: stm32.I2C1, 77 AltFuncSelector: AF4_I2C1_2_3, 78 } 79 )