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

     1  //go:build sam && atsamd21 && arduino_zero
     2  
     3  package machine
     4  
     5  // used to reset into bootloader
     6  const resetMagicValue = 0x07738135
     7  
     8  // GPIO Pins - Digital Low
     9  const (
    10  	D0 = PA11 // RX
    11  	D1 = PA10 // 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
    18  )
    19  
    20  // GPIO Pins - Digital High
    21  const (
    22  	D8  = PA06 // PWM available
    23  	D9  = PA07 // PWM available
    24  	D10 = PA18 // PWM available
    25  	D11 = PA16 // PWM available
    26  	D12 = PA19 // PWM available
    27  	D13 = PA17 // PWM available
    28  )
    29  
    30  // ADC pins
    31  const (
    32  	AREF Pin = PA03
    33  	ADC0 Pin = PA02
    34  	ADC1 Pin = PB08
    35  	ADC2 Pin = PB09
    36  	ADC3 Pin = PA04
    37  	ADC4 Pin = PA05
    38  	ADC5 Pin = PB02
    39  )
    40  
    41  // LEDs on the Arduino Zero
    42  const (
    43  	LED      = LED1
    44  	LED1 Pin = D13
    45  	LED2 Pin = PA27 // TX LED
    46  	LED3 Pin = PB03 // RX LED
    47  )
    48  
    49  // SPI pins - EDBG connected
    50  const (
    51  	SPI0_SDO_PIN Pin = PA16 // MOSI: SERCOM1/PAD[0]
    52  	SPI0_SDI_PIN Pin = PA19 // MISO: SERCOM1/PAD[2]
    53  	SPI0_SCK_PIN Pin = PA17 // SCK:  SERCOM1/PAD[3]
    54  )
    55  
    56  // SPI pins (Legacy ICSP)
    57  const (
    58  	SPI1_SDO_PIN Pin = PB10 // MOSI: SERCOM4/PAD[2] - Pin 4
    59  	SPI1_SDI_PIN Pin = PA12 // MISO: SERCOM4/PAD[0] - Pin 1
    60  	SPI1_SCK_PIN Pin = PB11 // SCK:  SERCOM4/PAD[3] - Pin 3
    61  )
    62  
    63  // I2C pins - EDBG connected
    64  const (
    65  	SDA_PIN Pin = PA22 // SDA: SERCOM3/PAD[0] - Pin 20
    66  	SCL_PIN Pin = PA23 // SCL: SERCOM3/PAD[1] - Pin 21
    67  )
    68  
    69  // I2S pins - might not be exposed
    70  const (
    71  	I2S_SCK_PIN Pin = PA10
    72  	I2S_SD_PIN  Pin = PA07
    73  	I2S_WS_PIN  Pin = PA11
    74  )
    75  
    76  // UART0 pins - EDBG connected
    77  const (
    78  	UART_RX_PIN Pin = D0
    79  	UART_TX_PIN Pin = D1
    80  )
    81  
    82  // 'native' USB port pins
    83  const (
    84  	USBCDC_DM_PIN Pin = PA24
    85  	USBCDC_DP_PIN Pin = PA25
    86  )
    87  
    88  // USB CDC identifiers
    89  const (
    90  	usb_STRING_PRODUCT      = "Arduino Zero"
    91  	usb_STRING_MANUFACTURER = "Arduino LLC"
    92  
    93  	usb_VID uint16 = 0x2341
    94  	usb_PID uint16 = 0x804d
    95  )
    96  
    97  // 32.768 KHz Crystal
    98  const (
    99  	XIN32  Pin = PA00
   100  	XOUT32 Pin = PA01
   101  )