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

     1  //go:build sam && atsamd21 && feather_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  = NoPin // does not seem to exist
    13  	D3  = PA09
    14  	D4  = PA08
    15  	D5  = PA15  // PWM available
    16  	D6  = PA20  // PWM available
    17  	D7  = NoPin // does not seem to exist
    18  	D8  = PA06
    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 Feather M0.
    53  var UART1 = &sercomUSART1
    54  
    55  // I2C pins
    56  const (
    57  	SDA_PIN = PA22 // SDA: SERCOM3/PAD[0]
    58  	SCL_PIN = PA23 // SCL: SERCOM3/PAD[1]
    59  )
    60  
    61  // I2C on the Feather M0.
    62  var (
    63  	I2C0 = sercomI2CM3
    64  )
    65  
    66  // SPI pins
    67  const (
    68  	SPI0_SCK_PIN = PB11 // SCK: SERCOM4/PAD[3]
    69  	SPI0_SDO_PIN = PB10 // SDO: SERCOM4/PAD[2]
    70  	SPI0_SDI_PIN = PA12 // SDI: SERCOM4/PAD[0]
    71  )
    72  
    73  // SPI on the Feather M0.
    74  var SPI0 = sercomSPIM4
    75  
    76  // I2S pins
    77  const (
    78  	I2S_SCK_PIN = PA10
    79  	I2S_SD_PIN  = PA08
    80  	I2S_WS_PIN  = NoPin // TODO: figure out what this is on Feather M0.
    81  )
    82  
    83  // USB CDC identifiers
    84  const (
    85  	usb_STRING_PRODUCT      = "Adafruit Feather M0 Express"
    86  	usb_STRING_MANUFACTURER = "Adafruit"
    87  )
    88  
    89  var (
    90  	usb_VID uint16 = 0x239A
    91  	usb_PID uint16 = 0x801B
    92  )
    93  
    94  var (
    95  	DefaultUART = UART1
    96  )