github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/machine/board_trinket.go (about)

     1  //go:build sam && atsamd21 && trinket_m0
     2  
     3  package machine
     4  
     5  // used to reset into bootloader
     6  const resetMagicValue = 0xf01669ef
     7  
     8  // GPIO Pins
     9  const (
    10  	D0  = PA08 // PWM available
    11  	D1  = PA02
    12  	D2  = PA09 // PWM available
    13  	D3  = PA07 // PWM available / UART0 RX
    14  	D4  = PA06 // PWM available / UART0 TX
    15  	D13 = PA10 // LED
    16  )
    17  
    18  // Analog pins
    19  const (
    20  	A0 = D1
    21  	A1 = D2
    22  	A2 = D0
    23  	A3 = D3
    24  	A4 = D4
    25  )
    26  
    27  const (
    28  	LED = D13
    29  )
    30  
    31  // USBCDC pins
    32  const (
    33  	USBCDC_DM_PIN = PA24
    34  	USBCDC_DP_PIN = PA25
    35  )
    36  
    37  // UART1 pins
    38  const (
    39  	UART_TX_PIN = D4
    40  	UART_RX_PIN = D3
    41  )
    42  
    43  // UART1 on the Trinket M0.
    44  var UART1 = &sercomUSART0
    45  
    46  // SPI pins
    47  const (
    48  	SPI0_SCK_PIN = D3
    49  	SPI0_SDO_PIN = D4
    50  	SPI0_SDI_PIN = D2
    51  )
    52  
    53  // SPI on the Trinket M0.
    54  var SPI0 = sercomSPIM0
    55  
    56  // I2C pins
    57  const (
    58  	SDA_PIN = D0 // SDA
    59  	SCL_PIN = D2 // SCL
    60  )
    61  
    62  // I2C on the Trinket M0.
    63  var (
    64  	I2C0 = sercomI2CM2
    65  )
    66  
    67  // I2S pins
    68  const (
    69  	I2S_SCK_PIN = PA10
    70  	I2S_SD_PIN  = PA08
    71  	I2S_WS_PIN  = NoPin // TODO: figure out what this is on Trinket M0.
    72  )
    73  
    74  // USB CDC identifiers
    75  const (
    76  	usb_STRING_PRODUCT      = "Adafruit Trinket M0"
    77  	usb_STRING_MANUFACTURER = "Adafruit"
    78  )
    79  
    80  var (
    81  	usb_VID uint16 = 0x239A
    82  	usb_PID uint16 = 0x801E
    83  )
    84  
    85  var (
    86  	DefaultUART = UART1
    87  )