github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/machine/board_p1am-100.go (about) 1 //go:build p1am_100 2 3 // This contains the pin mappings for the ProductivityOpen P1AM-100 board. 4 // 5 // For more information, see: https://facts-engineering.github.io/ 6 package machine 7 8 // used to reset into bootloader 9 const resetMagicValue = 0x07738135 10 11 // Note: On the P1AM-100, pins D8, D9, D10, A3, and A4 are used for 12 // communication with the base controller. 13 14 // GPIO Pins 15 const ( 16 D0 Pin = PA22 // PWM available 17 D1 Pin = PA23 // PWM available 18 D2 Pin = PA10 // PWM available 19 D3 Pin = PA11 // PWM available 20 D4 Pin = PB10 // PWM available 21 D5 Pin = PB11 // PWM available 22 D6 Pin = PA20 // PWM available 23 D7 Pin = PA21 // PWM available 24 25 D8 Pin = PA16 // PWM available 26 D9 Pin = PA17 27 D10 Pin = PA19 // PWM available 28 D11 Pin = PA08 29 D12 Pin = PA09 30 D13 Pin = PB23 31 D14 Pin = PB22 32 33 // Remaining pins are shared with analog pins 34 D15 Pin = PA02 35 36 D16 Pin = PB02 37 D17 Pin = PB03 38 D18 Pin = PA04 // PWM available 39 D19 Pin = PA05 // PWM available 40 D20 Pin = PA06 41 D21 Pin = PA07 42 ) 43 44 // Analog pins 45 const ( 46 A0 Pin = PA02 // ADC/AIN[0] 47 A1 Pin = PB02 // ADC/AIN[10] 48 A2 Pin = PB03 // ADC/AIN[11] 49 A3 Pin = PA04 // ADC/AIN[4] 50 A4 Pin = PA05 // ADC/AIN[5] 51 A5 Pin = PA06 // ADC/AIN[6] 52 A6 Pin = PA07 // ADC/AIN[7] 53 ) 54 55 const ( 56 SWITCH Pin = PA28 57 LED Pin = PB08 58 ADC_BATTERY Pin = PB09 // ADC/AIN[3] 59 ) 60 61 // P1AM Base Controller 62 const ( 63 BASE_SLAVE_SELECT_PIN Pin = A3 64 BASE_SLAVE_ACK_PIN Pin = A4 65 BASE_ENABLE_PIN Pin = PB09 66 ) 67 68 // USBCDC pins 69 const ( 70 USBCDC_DM_PIN Pin = PA24 71 USBCDC_DP_PIN Pin = PA25 72 USBCDC_HOST_ENABLE_PIN Pin = PA18 73 ) 74 75 // UART1 pins 76 const ( 77 UART_RX_PIN Pin = PB23 // RX: SERCOM5/PAD[3] 78 UART_TX_PIN Pin = PB22 // TX: SERCOM5/PAD[2] 79 ) 80 81 // UART1 on the P1AM-100 connects to the normal TX/RX pins. 82 var UART1 = &sercomUSART5 83 84 // I2C pins 85 const ( 86 SDA_PIN Pin = PA08 // SDA: SERCOM0/PAD[0] 87 SCL_PIN Pin = PA09 // SCL: SERCOM0/PAD[1] 88 ) 89 90 // I2C on the P1AM-100. 91 var ( 92 I2C0 = sercomI2CM0 93 ) 94 95 // SPI pins 96 const ( 97 SPI0_SCK_PIN Pin = D9 // SCK: SERCOM1/PAD[1] 98 SPI0_SDO_PIN Pin = D8 // SDO: SERCOM1/PAD[0] 99 SPI0_SDI_PIN Pin = D10 // SDI: SERCOM1/PAD[3] 100 ) 101 102 // SD card pins 103 const ( 104 SDCARD_SDI_PIN Pin = PA15 // SDI: SERCOM2/PAD[3] 105 SDCARD_SDO_PIN Pin = PA12 // SDO: SERCOM2/PAD[0] 106 SDCARD_SCK_PIN Pin = PA13 // SCK: SERCOM2/PAD[1] 107 SDCARD_SS_PIN Pin = PA14 // SS: as GPIO 108 SDCARD_CD_PIN Pin = PA27 109 ) 110 111 // SPI on the P1AM-100 is used for Base Controller. 112 var ( 113 SPI0 = sercomSPIM1 114 BASE_CONTROLLER_SPI = SPI0 115 ) 116 117 // SPI1 is connected to the SD card slot on the P1AM-100 118 var ( 119 SPI1 = sercomSPIM2 120 SDCARD_SPI = SPI1 121 ) 122 123 // I2S pins 124 const ( 125 I2S_SCK_PIN Pin = D2 126 I2S_SD_PIN Pin = A6 127 I2S_WS_PIN = D3 128 ) 129 130 // USB CDC identifiers 131 const ( 132 usb_STRING_PRODUCT = "P1AM-100" 133 usb_STRING_MANUFACTURER = "Facts Engineering" 134 ) 135 136 var ( 137 usb_VID uint16 = 0x1354 138 usb_PID uint16 = 0x4000 139 )