github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/machine/board_xiao.go (about) 1 //go:build sam && atsamd21 && xiao 2 3 package machine 4 5 // used to reset into bootloader 6 const resetMagicValue = 0xf01669ef 7 8 // GPIO Pins 9 const ( 10 D0 = PA02 // can be used for PWM or DAC 11 D1 = PA04 // PWM available 12 D2 = PA10 // PWM available 13 D3 = PA11 // PWM available 14 D4 = PA08 // can be used for PWM or I2C SDA 15 D5 = PA09 // can be used for PWM or I2C SCL 16 D6 = PB08 // can be used for PWM or UART1 TX 17 D7 = PB09 // can be used for PWM or UART1 RX 18 D8 = PA07 // can be used for PWM or SPI SCK 19 D9 = PA05 // can be used for PWM or SPI SDI 20 D10 = PA06 // can be used for PWM or SPI SDO 21 ) 22 23 // Analog pins 24 const ( 25 A0 = PA02 // ADC/AIN[0] 26 A1 = PA04 // ADC/AIN[4] 27 A2 = PA10 // ADC/AIN[18] 28 A3 = PA11 // ADC/AIN[19] 29 A4 = PA08 // ADC/AIN[16] 30 A5 = PA09 // ADC/AIN[17] 31 A6 = PB08 // ADC/AIN[2] 32 A7 = PB09 // ADC/AIN[3] 33 A8 = PA07 // ADC/AIN[7] 34 A9 = PA05 // ADC/AIN[6] 35 A10 = PA06 // ADC/AIN[5] 36 ) 37 38 const ( 39 LED = PA17 40 LED_RXL = PA18 41 LED_TXL = PA19 42 LED2 = LED_RXL 43 LED3 = LED_TXL 44 ) 45 46 // USBCDC pins 47 const ( 48 USBCDC_DM_PIN = PA24 49 USBCDC_DP_PIN = PA25 50 ) 51 52 // UART1 pins 53 const ( 54 UART_TX_PIN = D6 55 UART_RX_PIN = D7 56 ) 57 58 // UART1 on the Xiao 59 var UART1 = &sercomUSART4 60 61 // I2C pins 62 const ( 63 SDA_PIN = PA08 // SDA: SERCOM2/PAD[0] 64 SCL_PIN = PA09 // SCL: SERCOM2/PAD[1] 65 ) 66 67 // I2C on the Xiao 68 var ( 69 I2C0 = sercomI2CM2 70 ) 71 72 // SPI pins 73 const ( 74 SPI0_SCK_PIN = PA07 // SCK: SERCOM0/PAD[3] 75 SPI0_SDO_PIN = PA06 // SDO: SERCOM0/PAD[2] 76 SPI0_SDI_PIN = PA05 // SDI: SERCOM0/PAD[1] 77 ) 78 79 // SPI on the Xiao 80 var SPI0 = sercomSPIM0 81 82 // I2S pins 83 const ( 84 I2S_SCK_PIN = PA10 85 I2S_SD_PIN = PA08 86 I2S_WS_PIN = NoPin // TODO: figure out what this is on Xiao 87 ) 88 89 // USB CDC identifiers 90 const ( 91 usb_STRING_PRODUCT = "Seeed XIAO M0" 92 usb_STRING_MANUFACTURER = "Seeed" 93 ) 94 95 var ( 96 usb_VID uint16 = 0x2886 97 usb_PID uint16 = 0x802F 98 ) 99 100 var ( 101 DefaultUART = UART1 102 )