github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/machine/board_lgt92.go (about) 1 //go:build lgt92 2 3 package machine 4 5 import ( 6 "device/stm32" 7 "runtime/interrupt" 8 ) 9 10 const ( 11 LED1 = PA12 12 LED2 = PA8 13 LED3 = PA11 14 15 LED_RED = LED1 16 LED_BLUE = LED2 17 LED_GREEN = LED3 18 19 // Default led 20 LED = LED1 21 22 BUTTON = PB14 23 24 // LG GPS module 25 GPS_STANDBY_PIN = PB3 26 GPS_RESET_PIN = PB4 27 GPS_POWER_PIN = PB5 28 29 MEMS_ACCEL_CS = PE3 30 MEMS_ACCEL_INT1 = PE0 31 MEMS_ACCEL_INT2 = PE1 32 33 // SPI 34 SPI1_SCK_PIN = PA5 35 SPI1_SDI_PIN = PA6 36 SPI1_SDO_PIN = PA7 37 SPI0_SCK_PIN = SPI1_SCK_PIN 38 SPI0_SDI_PIN = SPI1_SDI_PIN 39 SPI0_SDO_PIN = SPI1_SDO_PIN 40 41 // LORA RFM95 Radio 42 RFM95_DIO0_PIN = PC13 43 44 // TinyGo UART is MCU LPUSART1 45 UART_RX_PIN = PA13 46 UART_TX_PIN = PA14 47 48 // TinyGo UART1 is MCU USART1 49 UART1_RX_PIN = PB6 50 UART1_TX_PIN = PB7 51 52 // MPU9250 Nine-Axis (Gyro + Accelerometer + Compass) 53 I2C0_SCL_PIN = PA9 54 I2C0_SDA_PIN = PA10 55 ) 56 57 var DefaultUART = UART0 58 59 var ( 60 61 // Console UART (LPUSART1) 62 UART0 = &_UART0 63 _UART0 = UART{ 64 Buffer: NewRingBuffer(), 65 Bus: stm32.LPUART1, 66 TxAltFuncSelector: 6, 67 RxAltFuncSelector: 6, 68 } 69 70 // Gps UART 71 UART1 = &_UART1 72 _UART1 = UART{ 73 Buffer: NewRingBuffer(), 74 Bus: stm32.USART1, 75 TxAltFuncSelector: 0, 76 RxAltFuncSelector: 0, 77 } 78 79 // MPU9250 Nine-Axis (Gyro + Accelerometer + Compass) 80 I2C1 = &I2C{ 81 Bus: stm32.I2C1, 82 AltFuncSelector: 6, 83 } 84 I2C0 = I2C1 85 86 // SPI 87 SPI0 = SPI{ 88 Bus: stm32.SPI1, 89 } 90 SPI1 = &SPI0 91 ) 92 93 func init() { 94 // Enable UARTs Interrupts 95 UART0.Interrupt = interrupt.New(stm32.IRQ_AES_RNG_LPUART1, _UART0.handleInterrupt) 96 UART1.Interrupt = interrupt.New(stm32.IRQ_USART1, _UART1.handleInterrupt) 97 }