github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/machine/board_wioterminal.go (about) 1 //go:build wioterminal 2 3 package machine 4 5 // used to reset into bootloader 6 const resetMagicValue = 0xf01669ef 7 8 const ( 9 ADC0 = A0 10 ADC1 = A1 11 ADC2 = A2 12 ADC3 = A3 13 ADC4 = A4 14 ADC5 = A5 15 ADC6 = A6 16 ADC7 = A7 17 ADC8 = A8 18 19 LED = PIN_LED 20 BUTTON = BUTTON_1 21 ) 22 23 const ( 24 // https://github.com/Seeed-Studio/ArduinoCore-samd/blob/master/variants/wio_terminal/variant.h 25 26 // LEDs 27 PIN_LED_13 = PA15 28 PIN_LED_RXL = PA15 29 PIN_LED_TXL = PA15 30 PIN_LED = PIN_LED_13 31 PIN_LED2 = PIN_LED_RXL 32 PIN_LED3 = PIN_LED_TXL 33 LED_BUILTIN = PIN_LED_13 34 PIN_NEOPIXEL = PA15 35 36 //Digital PINs 37 D0 = PB08 38 D1 = PB09 39 D2 = PA07 40 D3 = PB04 41 D4 = PB05 42 D5 = PB06 43 D6 = PA04 44 D7 = PB07 45 D8 = PA06 46 47 //Analog PINs 48 A0 = PB08 // ADC/AIN[0] 49 A1 = PB09 // ADC/AIN[2] 50 A2 = PA07 // ADC/AIN[3] 51 A3 = PB04 // ADC/AIN[4] 52 A4 = PB05 // ADC/AIN[5] 53 A5 = PB06 // ADC/AIN[10] 54 A6 = PA04 // ADC/AIN[10] 55 A7 = PB07 // ADC/AIN[10] 56 A8 = PA06 // ADC/AIN[10] 57 58 // 3.3V || 5V 59 // BCM2 || 5V 60 // BCM3 || GND 61 // BCM4 || BCM14 62 // GND || BCM15 63 // BCM17 || BCM18 64 // BCM27 || GND 65 // BCM22 || BCM23 66 // GND || BCM24 67 // BCM10 || GND 68 // BCM9 || BCM25 69 // BCM11 || BCM8 70 // GND || BCM7 71 // BCM0 || BCM1 72 // BCM5 || GND 73 // BCM6 || BCM12 74 // BCM13 || GND 75 // BCM19 || BCM16 76 // BCM26 || BCM20 77 // GND || BCM21 78 79 //PIN DEFINE FOR RPI 80 BCM0 = PA13 // I2C Wire1 81 BCM1 = PA12 // I2C Wire1 82 BCM2 = PA17 // I2C Wire2 83 BCM3 = PA16 // I2C Wire2 84 BCM4 = PB14 // GCLK 85 BCM5 = PB12 // GCLK 86 BCM6 = PB13 // GCLK 87 BCM7 = PA05 // DAC1 88 BCM8 = PB01 // SPI SS 89 BCM9 = PB00 // SPI SDI 90 BCM10 = PB02 // SPI SDO 91 BCM11 = PB03 // SPI SCK 92 BCM12 = PB06 93 BCM13 = PA04 94 BCM14 = PB27 // UART Serial1 95 BCM15 = PB26 // UART Serial1 96 BCM16 = PB07 97 BCM17 = PA02 // DAC0 98 BCM18 = PB28 // FPC Digital & AD pins 99 BCM19 = PA20 // WIO_IR 100 BCM20 = PA21 // I2S SDO 101 BCM21 = PA22 // I2S SDI 102 BCM22 = PB09 103 BCM23 = PA07 104 BCM24 = PB04 105 BCM25 = PB05 106 BCM26 = PA06 107 BCM27 = PB08 108 109 // FPC NEW DEFINE 110 FPC1 = PB28 // FPC Digital & AD pins 111 FPC2 = PB17 112 FPC3 = PB29 113 FPC4 = PA14 114 FPC5 = PC01 115 FPC6 = PC02 116 FPC7 = PC03 117 FPC8 = PC04 118 FPC9 = PC31 119 FPC10 = PD00 120 121 // RPI Analog RPIs 122 RPI_A0 = PB08 123 RPI_A1 = PB09 124 RPI_A2 = PA07 125 RPI_A3 = PB04 126 RPI_A4 = PB05 127 RPI_A5 = PB06 128 RPI_A6 = PA04 129 RPI_A7 = PB07 130 RPI_A8 = PA06 131 132 PIN_DAC0 = PA02 133 PIN_DAC1 = PA05 134 135 // FPO Analog RPIs 136 //FPC_A7 = FPC_D7 137 //FPC_A8 = FPC_D8 138 //FPC_A9 = FPC_D9 139 //FPC_A11 = FPC_D11 140 //FPC_A12 = FPC_D12 141 //FPC_A13 = FPC_D13 142 143 // USB 144 PIN_USB_DM = PA24 145 PIN_USB_DP = PA25 146 PIN_USB_HOST_ENABLE = PA27 147 148 // BUTTON 149 BUTTON_1 = PC26 150 BUTTON_2 = PC27 151 BUTTON_3 = PC28 152 WIO_KEY_A = PC26 153 WIO_KEY_B = PC27 154 WIO_KEY_C = PC28 155 156 // SWITCH 157 SWITCH_X = PD20 158 SWITCH_Y = PD12 159 SWITCH_Z = PD09 160 SWITCH_B = PD08 161 SWITCH_U = PD10 162 163 WIO_5S_UP = PD20 164 WIO_5S_LEFT = PD12 165 WIO_5S_RIGHT = PD09 166 WIO_5S_DOWN = PD08 167 WIO_5S_PRESS = PD10 168 169 // IRQ0 : RTL8720D 170 IRQ0 = PC20 171 172 // BUZZER_CTR 173 BUZZER_CTR = PD11 174 WIO_BUZZER = PD11 175 176 // MIC_INPUT 177 MIC_INPUT = PC30 178 WIO_MIC = PC30 179 180 // GCLK 181 GCLK0 = PB14 182 GCLK1 = PB12 183 GCLK2 = PB13 184 185 // Serial interfaces 186 // Serial1 187 PIN_SERIAL1_RX = PB27 188 PIN_SERIAL1_TX = PB26 189 190 // Serial2 : RTL8720D 191 PIN_SERIAL2_RX = PC23 192 PIN_SERIAL2_TX = PC22 193 194 // Wire Interfaces 195 // I2C Wire2 196 // I2C1 197 PIN_WIRE_SDA = PA17 198 PIN_WIRE_SCL = PA16 199 SDA = PIN_WIRE_SDA 200 SCL = PIN_WIRE_SCL 201 202 // I2C Wire1 203 // I2C0 : LIS3DHTR and ATECC608 204 PIN_WIRE1_SDA = PA13 205 PIN_WIRE1_SCL = PA12 206 207 SDA1 = PIN_WIRE1_SDA 208 SCL1 = PIN_WIRE1_SCL 209 210 PIN_GYROSCOPE_WIRE_SDA = PIN_WIRE1_SDA 211 PIN_GYROSCOPE_WIRE_SCL = PIN_WIRE1_SCL 212 GYROSCOPE_INT1 = PC21 213 214 WIO_LIS3DH_SDA = PIN_WIRE1_SDA 215 WIO_LIS3DH_SCL = PIN_WIRE1_SCL 216 WIO_LIS3DH_INT = PC21 217 218 // SPI 219 PIN_SPI_SDI = PB00 220 PIN_SPI_SDO = PB02 221 PIN_SPI_SCK = PB03 222 PIN_SPI_SS = PB01 223 224 SS = PIN_SPI_SS 225 SDO = PIN_SPI_SDO 226 SDI = PIN_SPI_SDI 227 SCK = PIN_SPI_SCK 228 229 // SPI1 RTL8720D_SPI 230 PIN_SPI1_SDI = PC24 231 PIN_SPI1_SDO = PB24 232 PIN_SPI1_SCK = PB25 233 PIN_SPI1_SS = PC25 234 235 SS1 = PIN_SPI1_SS 236 SDO1 = PIN_SPI1_SDO 237 SDI1 = PIN_SPI1_SDI 238 SCK1 = PIN_SPI1_SCK 239 240 // SPI2 SD_SPI 241 PIN_SPI2_SDI = PC18 242 PIN_SPI2_SDO = PC16 243 PIN_SPI2_SCK = PC17 244 PIN_SPI2_SS = PC19 245 246 SS2 = PIN_SPI2_SS 247 SDO2 = PIN_SPI2_SDO 248 SDI2 = PIN_SPI2_SDI 249 SCK2 = PIN_SPI2_SCK 250 251 // SPI3 LCD_SPI 252 PIN_SPI3_SDI = PB18 253 PIN_SPI3_SDO = PB19 254 PIN_SPI3_SCK = PB20 255 PIN_SPI3_SS = PB21 256 257 SS3 = PIN_SPI3_SS 258 SDO3 = PIN_SPI3_SDO 259 SDI3 = PIN_SPI3_SDI 260 SCK3 = PIN_SPI3_SCK 261 262 // Needed for SD library 263 SDCARD_SDI_PIN = PIN_SPI2_SDI 264 SDCARD_SDO_PIN = PIN_SPI2_SDO 265 SDCARD_SCK_PIN = PIN_SPI2_SCK 266 SDCARD_SS_PIN = PIN_SPI2_SS 267 SDCARD_DET_PIN = PD21 268 269 LCD_SDI_PIN = PIN_SPI3_SDI 270 LCD_SDO_PIN = PIN_SPI3_SDO 271 LCD_SCK_PIN = PIN_SPI3_SCK 272 LCD_SS_PIN = PIN_SPI3_SS 273 LCD_DC = PC06 274 LCD_RESET = PC07 275 LCD_BACKLIGHT = PC05 276 277 // 4 WIRE LCD TOUCH 278 LCD_XL = PC10 279 LCD_YU = PC11 280 LCD_XR = PC12 281 LCD_YD = PC13 282 283 // Needed for RTL8720D 284 RTL8720D_SDI_PIN = PIN_SPI1_SDI 285 RTL8720D_SDO_PIN = PIN_SPI1_SDO 286 RTL8720D_SCK_PIN = PIN_SPI1_SCK 287 RTL8720D_SS_PIN = PIN_SPI1_SS 288 289 //QSPI Pins 290 PIN_QSPI_IO0 = PA08 291 PIN_QSPI_IO1 = PA09 292 PIN_QSPI_IO2 = PA10 293 PIN_QSPI_IO3 = PA11 294 PIN_QSPI_SCK = PB10 295 PIN_QSPI_CS = PB11 296 297 // I2S Interfaces 298 PIN_I2S_FS = PA20 299 PIN_I2S_SCK = PB16 300 PIN_I2S_SDO = PA22 301 PIN_I2S_SDI = PA21 302 303 I2S_LRCLK = PA20 304 I2S_BLCK = PB16 305 I2S_SDOUT = PA22 306 I2S_SDIN = PA21 307 308 // RTL8720D Interfaces 309 RTL8720D_CHIP_PU = PA18 310 RTL8720D_GPIO0 = PA19 // SYNC 311 312 // SWD 313 SWDCLK = PA30 314 SWDIO = PA31 315 SWO = PB30 316 317 // light sensor 318 WIO_LIGHT = PD01 319 320 // ir sensor 321 WIO_IR = PB31 322 323 // OUTPUT_CTR 324 OUTPUT_CTR_5V = PC14 325 OUTPUT_CTR_3V3 = PC15 326 ) 327 328 // USBCDC pins 329 const ( 330 USBCDC_DM_PIN = PIN_USB_DM 331 USBCDC_DP_PIN = PIN_USB_DP 332 ) 333 334 // UART1 pins 335 const ( 336 UART_TX_PIN = PIN_SERIAL1_TX 337 UART_RX_PIN = PIN_SERIAL1_RX 338 ) 339 340 // UART2 pins RTL8720D 341 const ( 342 UART2_TX_PIN = PIN_SERIAL2_TX 343 UART2_RX_PIN = PIN_SERIAL2_RX 344 ) 345 346 var ( 347 DefaultUART = UART1 348 349 UART1 = &sercomUSART2 350 351 // RTL8720D (tx: PC22, rx: PC23) 352 UART2 = &sercomUSART1 353 354 // RTL8720D (tx: PB24, rx: PC24) 355 UART3 = &sercomUSART0 356 357 // Right-hand grove port (tx: D0, rx: D1) 358 UART4 = &sercomUSART4 359 ) 360 361 // I2C pins 362 const ( 363 SDA1_PIN = PA17 // SDA: SERCOM3/PAD[0] 364 SCL1_PIN = PA16 // SCL: SERCOM3/PAD[1] 365 366 SDA0_PIN = PA13 // SDA: SERCOM4/PAD[0] 367 SCL0_PIN = PA12 // SCL: SERCOM4/PAD[1] 368 369 SDA_PIN = SDA1_PIN 370 SCL_PIN = SCL1_PIN 371 ) 372 373 // I2C on the Wio Terminal 374 var ( 375 I2C0 = sercomI2CM4 376 I2C1 = sercomI2CM3 377 ) 378 379 // SPI pins 380 const ( 381 SPI0_SCK_PIN = SCK // SCK: SERCOM5/PAD[1] 382 SPI0_SDO_PIN = SDO // SDO: SERCOM5/PAD[0] 383 SPI0_SDI_PIN = SDI // SDI: SERCOM5/PAD[2] 384 385 // RTL8720D 386 SPI1_SCK_PIN = SCK1 // SCK: SERCOM0/PAD[1] 387 SPI1_SDO_PIN = SDO1 // SDO: SERCOM0/PAD[0] 388 SPI1_SDI_PIN = SDI1 // SDI: SERCOM0/PAD[2] 389 390 // SD 391 SPI2_SCK_PIN = SCK2 // SCK: SERCOM6/PAD[1] 392 SPI2_SDO_PIN = SDO2 // SDO: SERCOM6/PAD[0] 393 SPI2_SDI_PIN = SDI2 // SDI: SERCOM6/PAD[2] 394 395 // LCD 396 SPI3_SCK_PIN = SCK3 // SCK: SERCOM7/PAD[1] 397 SPI3_SDO_PIN = SDO3 // SDO: SERCOM7/PAD[3] 398 SPI3_SDI_PIN = SDI3 // SDI: SERCOM7/PAD[2] 399 ) 400 401 // SPI on the Wio Terminal 402 var ( 403 SPI0 = sercomSPIM5 404 405 // RTL8720D 406 SPI1 = sercomSPIM0 407 408 // SD 409 SPI2 = sercomSPIM6 410 411 // LCD 412 SPI3 = sercomSPIM7 413 ) 414 415 // USB CDC identifiers 416 const ( 417 usb_STRING_PRODUCT = "Seeed Wio Terminal" 418 usb_STRING_MANUFACTURER = "Seeed" 419 ) 420 421 var ( 422 usb_VID uint16 = 0x2886 423 usb_PID uint16 = 0x802D 424 )