github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/machine/board_xiao-rp2040.go (about) 1 //go:build xiao_rp2040 2 3 // This file contains the pin mappings for the Seeed XIAO RP2040 boards. 4 // 5 // XIAO RP2040 is a microcontroller using the Raspberry Pi RP2040 chip. 6 // 7 // - https://wiki.seeedstudio.com/XIAO-RP2040/ 8 package machine 9 10 // Digital Pins 11 const ( 12 D0 Pin = GPIO26 13 D1 Pin = GPIO27 14 D2 Pin = GPIO28 15 D3 Pin = GPIO29 16 D4 Pin = GPIO6 17 D5 Pin = GPIO7 18 D6 Pin = GPIO0 19 D7 Pin = GPIO1 20 D8 Pin = GPIO2 21 D9 Pin = GPIO4 22 D10 Pin = GPIO3 23 ) 24 25 // Analog pins 26 const ( 27 A0 Pin = D0 28 A1 Pin = D1 29 A2 Pin = D2 30 A3 Pin = D3 31 ) 32 33 // Onboard LEDs 34 const ( 35 NEOPIXEL = GPIO12 36 WS2812 = GPIO12 37 NEO_PWR = GPIO11 38 NEOPIXEL_POWER = GPIO11 39 40 LED = GPIO17 41 LED_RED = GPIO17 42 LED_GREEN = GPIO16 43 LED_BLUE = GPIO25 44 ) 45 46 // I2C pins 47 const ( 48 I2C0_SDA_PIN Pin = D2 49 I2C0_SCL_PIN Pin = D3 50 51 I2C1_SDA_PIN Pin = D4 52 I2C1_SCL_PIN Pin = D5 53 ) 54 55 // SPI pins 56 const ( 57 SPI0_SCK_PIN Pin = D8 58 SPI0_SDO_PIN Pin = D10 59 SPI0_SDI_PIN Pin = D9 60 61 SPI1_SCK_PIN Pin = NoPin 62 SPI1_SDO_PIN Pin = NoPin 63 SPI1_SDI_PIN Pin = NoPin 64 ) 65 66 // Onboard crystal oscillator frequency, in MHz. 67 const ( 68 xoscFreq = 12 // MHz 69 ) 70 71 // UART pins 72 const ( 73 UART0_TX_PIN = GPIO0 74 UART0_RX_PIN = GPIO1 75 UART_TX_PIN = UART0_TX_PIN 76 UART_RX_PIN = UART0_RX_PIN 77 ) 78 79 var DefaultUART = UART0 80 81 // USB CDC identifiers 82 const ( 83 usb_STRING_PRODUCT = "XIAO RP2040" 84 usb_STRING_MANUFACTURER = "Seeed" 85 ) 86 87 var ( 88 usb_VID uint16 = 0x2e8a 89 usb_PID uint16 = 0x000a 90 )