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

     1  //go:build sam && atsamd21 && itsybitsy_m0
     2  
     3  package machine
     4  
     5  // used to reset into bootloader
     6  const resetMagicValue = 0xf01669ef
     7  
     8  // GPIO Pins
     9  const (
    10  	D0  = PA11 // UART0 RX
    11  	D1  = PA10 // UART0 TX
    12  	D2  = PA14
    13  	D3  = PA09 // PWM available
    14  	D4  = PA08 // PWM available
    15  	D5  = PA15 // PWM available
    16  	D6  = PA20 // PWM available
    17  	D7  = PA21 // PWM available
    18  	D8  = PA06 // PWM available
    19  	D9  = PA07 // PWM available
    20  	D10 = PA18 // can be used for PWM or UART1 TX
    21  	D11 = PA16 // can be used for PWM or UART1 RX
    22  	D12 = PA19 // PWM available
    23  	D13 = PA17 // PWM available
    24  )
    25  
    26  // Analog pins
    27  const (
    28  	A0 = PA02 // ADC/AIN[0]
    29  	A1 = PB08 // ADC/AIN[2]
    30  	A2 = PB09 // ADC/AIN[3]
    31  	A3 = PA04 // ADC/AIN[4]
    32  	A4 = PA05 // ADC/AIN[5]
    33  	A5 = PB02 // ADC/AIN[10]
    34  )
    35  
    36  const (
    37  	LED = D13
    38  )
    39  
    40  // USBCDC pins
    41  const (
    42  	USBCDC_DM_PIN = PA24
    43  	USBCDC_DP_PIN = PA25
    44  )
    45  
    46  // UART1 pins
    47  const (
    48  	UART_TX_PIN = D10
    49  	UART_RX_PIN = D11
    50  )
    51  
    52  // UART1 on the ItsyBitsy M0.
    53  var (
    54  	UART1 = &sercomUSART1
    55  )
    56  
    57  // I2C pins
    58  const (
    59  	SDA_PIN = PA22 // SDA: SERCOM3/PAD[0]
    60  	SCL_PIN = PA23 // SCL: SERCOM3/PAD[1]
    61  )
    62  
    63  // I2C on the ItsyBitsy M0.
    64  var (
    65  	I2C0 = sercomI2CM3
    66  )
    67  
    68  // SPI pins
    69  const (
    70  	SPI0_SCK_PIN = PB11 // SCK: SERCOM4/PAD[3]
    71  	SPI0_SDO_PIN = PB10 // SDO: SERCOM4/PAD[2]
    72  	SPI0_SDI_PIN = PA12 // SDI: SERCOM4/PAD[0]
    73  )
    74  
    75  // SPI on the ItsyBitsy M0.
    76  var SPI0 = sercomSPIM4
    77  
    78  // "Internal" SPI pins; SPI flash is attached to these on ItsyBitsy M0
    79  const (
    80  	SPI1_CS_PIN  = PA27
    81  	SPI1_SCK_PIN = PB23
    82  	SPI1_SDO_PIN = PB22
    83  	SPI1_SDI_PIN = PB03
    84  )
    85  
    86  // "Internal" SPI on Sercom 5
    87  var SPI1 = sercomSPIM5
    88  
    89  // I2S pins
    90  const (
    91  	I2S_SCK_PIN = PA10
    92  	I2S_SD_PIN  = PA08
    93  	I2S_WS_PIN  = NoPin // TODO: figure out what this is on ItsyBitsy M0.
    94  )
    95  
    96  // USB CDC identifiers
    97  const (
    98  	usb_STRING_PRODUCT      = "Adafruit ItsyBitsy M0 Express"
    99  	usb_STRING_MANUFACTURER = "Adafruit"
   100  )
   101  
   102  var (
   103  	usb_VID uint16 = 0x239A
   104  	usb_PID uint16 = 0x800F
   105  )
   106  
   107  var (
   108  	DefaultUART = UART1
   109  )