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

     1  //go:build sam && atsamd21 && gemma_m0
     2  
     3  package machine
     4  
     5  // Used to reset into bootloader.
     6  const resetMagicValue = 0xf01669ef
     7  
     8  // GPIO Pins.
     9  const (
    10  	D0  = PA04 // SERCOM0/PAD[0]
    11  	D1  = PA02
    12  	D2  = PA05 // SERCOM0/PAD[1]
    13  	D3  = PA00 // DotStar LED: SERCOM1/PAD[0]: APA102/MOSI
    14  	D4  = PA01 // DotStar LED: SERCOM1/PAD[1]: APA102/SCK
    15  	D11 = PA30 // Flash Access: SERCOM1/PAD[2]
    16  	D12 = PA31 // Flash Access: SERCOM1/PAD[3]
    17  	D13 = PA23 // LED: SERCOM3/PAD[1] SERCOM5/PAD[1]
    18  )
    19  
    20  // Analog pins.
    21  const (
    22  	A0 = D1
    23  	A1 = D2
    24  	A2 = D0
    25  )
    26  
    27  const (
    28  	LED = PA23
    29  )
    30  
    31  // USBCDC pins.
    32  const (
    33  	USBCDC_DM_PIN = PA24
    34  	USBCDC_DP_PIN = PA25
    35  )
    36  
    37  // UART0 pins.
    38  const (
    39  	UART_TX_PIN = PA04 // TX: SERCOM0/PAD[0]
    40  	UART_RX_PIN = PA05 // RX: SERCOM0/PAD[1]
    41  )
    42  
    43  // UART0s on the Gemma M0.
    44  var UART0 = &sercomUSART0
    45  
    46  // SPI pins.
    47  const (
    48  	SPI0_SCK_PIN = PA05 // SCK: SERCOM0/PAD[1]
    49  	SPI0_SDO_PIN = PA04 // MOSI: SERCOM0/PAD[0]
    50  	SPI0_SDI_PIN = NoPin
    51  	SPI0_CS_PIN  = NoPin
    52  )
    53  
    54  // SPI on the Gemma M0.
    55  var SPI0 = sercomSPIM0
    56  
    57  // SPI pins for DotStar LED (using APA102 software SPI) and Flash.
    58  const (
    59  	SPI1_SCK_PIN = PA01 // SCK: SERCOM1/PAD[0]
    60  	SPI1_SDO_PIN = PA00 // MOSI: SERCOM1/PAD[1]
    61  	SPI1_SDI_PIN = PA31 // MISO: SERCOM1/PAD[3]
    62  	SPI1_CS_PIN  = PA30 // CS: SERCOM1/PAD[2]
    63  )
    64  
    65  // I2C pins.
    66  const (
    67  	SDA_PIN = PA04 // SDA: SERCOM0/PAD[0]
    68  	SCL_PIN = PA05 // SCL: SERCOM0/PAD[1]
    69  )
    70  
    71  // I2C on the Gemma M0.
    72  var (
    73  	I2C0 = sercomI2CM0
    74  )
    75  
    76  // I2S (not connected, needed for atsamd21).
    77  const (
    78  	I2S_SCK_PIN = NoPin
    79  	I2S_SD_PIN  = NoPin
    80  	I2S_WS_PIN  = NoPin
    81  )
    82  
    83  // USB CDC identifiers.
    84  const (
    85  	usb_STRING_PRODUCT      = "Adafruit Gemma M0"
    86  	usb_STRING_MANUFACTURER = "Adafruit"
    87  )
    88  
    89  var (
    90  	usb_VID uint16 = 0x239A
    91  	usb_PID uint16 = 0x801E
    92  )
    93  
    94  var (
    95  	DefaultUART = UART0
    96  )