github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/machine/board_nucleof722ze.go (about) 1 //go:build nucleof722ze 2 3 package machine 4 5 import ( 6 "device/stm32" 7 "runtime/interrupt" 8 ) 9 10 const ( 11 LED = LED_BUILTIN 12 LED_BUILTIN = LED_GREEN 13 LED_GREEN = PB0 14 LED_BLUE = PB7 15 LED_RED = PB14 16 ) 17 18 const ( 19 BUTTON = BUTTON_USER 20 BUTTON_USER = PC13 21 ) 22 23 // UART pins 24 const ( 25 // PD8 and PD9 are connected to the ST-Link Virtual Com Port (VCP) 26 UART_TX_PIN = PD8 27 UART_RX_PIN = PD9 28 UART_ALT_FN = 7 // GPIO_AF7_UART3 29 ) 30 31 var ( 32 // USART3 is the hardware serial port connected to the onboard ST-LINK 33 // debugger to be exposed as virtual COM port over USB on Nucleo boards. 34 UART1 = &_UART1 35 _UART1 = UART{ 36 Buffer: NewRingBuffer(), 37 Bus: stm32.USART3, 38 TxAltFuncSelector: UART_ALT_FN, 39 RxAltFuncSelector: UART_ALT_FN, 40 } 41 DefaultUART = UART1 42 ) 43 44 func init() { 45 UART1.Interrupt = interrupt.New(stm32.IRQ_USART3, _UART1.handleInterrupt) 46 } 47 48 // SPI pins 49 const ( 50 SPI0_SCK_PIN = PA5 51 SPI0_SDI_PIN = PA6 52 SPI0_SDO_PIN = PA7 53 ) 54 55 // I2C pins 56 const ( 57 I2C0_SCL_PIN = PB8 58 I2C0_SDA_PIN = PB9 59 ) 60 61 var ( 62 // I2C1 is documented, alias to I2C0 as well 63 I2C1 = &I2C{ 64 Bus: stm32.I2C1, 65 AltFuncSelector: 4, 66 } 67 I2C0 = I2C1 68 )