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

     1  //go:build itsybitsy_m4
     2  
     3  package machine
     4  
     5  // used to reset into bootloader
     6  const resetMagicValue = 0xf01669ef
     7  
     8  // GPIO Pins
     9  const (
    10  	D0  = PA16 // UART0 RX/PWM available
    11  	D1  = PA17 // UART0 TX/PWM available
    12  	D2  = PA07
    13  	D3  = PB22
    14  	D4  = PA14 // PWM available
    15  	D5  = PA15 // PWM available
    16  	D6  = PB02 // dotStar clock
    17  	D7  = PA18 // PWM available
    18  	D8  = PB03 // dotStar data
    19  	D9  = PA19 // PWM available
    20  	D10 = PA20 // can be used for PWM or UART1 TX
    21  	D11 = PA21 // can be used for PWM or UART1 RX
    22  	D12 = PA23 // PWM available
    23  	D13 = PA22 // PWM available
    24  )
    25  
    26  // Analog pins
    27  const (
    28  	A0 = PA02 // ADC/AIN[0]
    29  	A1 = PA05 // ADC/AIN[2]
    30  	A2 = PB08 // ADC/AIN[3]
    31  	A3 = PB09 // ADC/AIN[4]
    32  	A4 = PA04 // ADC/AIN[5]
    33  	A5 = PA06 // 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 = D1
    49  	UART_RX_PIN = D0
    50  )
    51  
    52  const (
    53  	UART2_TX_PIN = A4
    54  	UART2_RX_PIN = D2
    55  )
    56  
    57  var (
    58  	UART1 = &sercomUSART3
    59  	UART2 = &sercomUSART0
    60  
    61  	DefaultUART = UART1
    62  )
    63  
    64  // I2C pins
    65  const (
    66  	SDA_PIN = PA12 // SDA: SERCOM2/PAD[0]
    67  	SCL_PIN = PA13 // SCL: SERCOM2/PAD[1]
    68  )
    69  
    70  // I2C on the ItsyBitsy M4.
    71  var (
    72  	I2C0 = sercomI2CM2
    73  )
    74  
    75  // SPI pins
    76  const (
    77  	SPI0_SCK_PIN = PA01 // SCK: SERCOM1/PAD[1]
    78  	SPI0_SDO_PIN = PA00 // SDO: SERCOM1/PAD[0]
    79  	SPI0_SDI_PIN = PB23 // SDI: SERCOM1/PAD[3]
    80  )
    81  
    82  // SPI on the ItsyBitsy M4.
    83  var SPI0 = sercomSPIM1
    84  
    85  // USB CDC identifiers
    86  const (
    87  	usb_STRING_PRODUCT      = "Adafruit ItsyBitsy M4"
    88  	usb_STRING_MANUFACTURER = "Adafruit"
    89  )
    90  
    91  var (
    92  	usb_VID uint16 = 0x239A
    93  	usb_PID uint16 = 0x802B
    94  )