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

     1  //go:build metro_m4_airlift
     2  
     3  package machine
     4  
     5  // used to reset into bootloader
     6  const resetMagicValue = 0xf01669ef
     7  
     8  // GPIO Pins
     9  const (
    10  	D0 = PA23 // UART0 RX/PWM available
    11  	D1 = PA22 // UART0 TX/PWM available
    12  	D2 = PB17 // PWM available
    13  	D3 = PB16 // PWM available
    14  	D4 = PB13 // PWM available
    15  	D5 = PB14 // PWM available
    16  	D6 = PB15 // PWM available
    17  	D7 = PB12 // PWM available
    18  
    19  	D8  = PA21 // PWM available
    20  	D9  = PA20 // PWM available
    21  	D10 = PA18 // can be used for PWM or UART1 TX
    22  	D11 = PA19 // can be used for PWM or UART1 RX
    23  	D12 = PA17 // PWM available
    24  	D13 = PA16 // PWM available
    25  
    26  	D40 = PB22 // built-in neopixel
    27  )
    28  
    29  // Analog pins
    30  const (
    31  	A0 = PA02 // ADC/AIN[0]
    32  	A1 = PA05 // ADC/AIN[2]
    33  	A2 = PB06 // ADC/AIN[3]
    34  	A3 = PB00 // ADC/AIN[4] // NOTE: different between "airlift" and non-airlift versions
    35  	A4 = PB08 // ADC/AIN[5]
    36  	A5 = PB09 // ADC/AIN[10]
    37  )
    38  
    39  const (
    40  	LED    = D13
    41  	WS2812 = D40
    42  )
    43  
    44  // USBCDC pins
    45  const (
    46  	USBCDC_DM_PIN = PA24
    47  	USBCDC_DP_PIN = PA25
    48  )
    49  
    50  const (
    51  	UART_TX_PIN = D1
    52  	UART_RX_PIN = D0
    53  )
    54  
    55  const (
    56  	UART2_TX_PIN = PA04
    57  	UART2_RX_PIN = PA07
    58  )
    59  
    60  var (
    61  	UART1 = &sercomUSART3
    62  	UART2 = &sercomUSART0
    63  
    64  	DefaultUART = UART1
    65  
    66  	UART_NINA = UART2
    67  )
    68  
    69  // NINA-W102 settings
    70  const (
    71  	NINA_BAUDRATE         = 115200
    72  	NINA_RESET_INVERTED   = true
    73  	NINA_SOFT_FLOWCONTROL = true
    74  )
    75  
    76  const (
    77  	NINA_CS     = PA15
    78  	NINA_ACK    = PB04
    79  	NINA_GPIO0  = PB01
    80  	NINA_RESETN = PB05
    81  
    82  	// pins used for the ESP32 connection do not allow hardware
    83  	// flow control, which is required. have to emulate with software.
    84  	NINA_TX  = PA04
    85  	NINA_RX  = PA07
    86  	NINA_CTS = NINA_ACK
    87  	NINA_RTS = NINA_GPIO0
    88  )
    89  
    90  // I2C pins
    91  const (
    92  	SDA_PIN = PB02 // SDA: SERCOM5/PAD[0]
    93  	SCL_PIN = PB03 // SCL: SERCOM5/PAD[1]
    94  )
    95  
    96  // I2C on the Metro M4.
    97  var (
    98  	I2C0 = sercomI2CM5
    99  )
   100  
   101  // SPI pins
   102  const (
   103  	SPI0_SCK_PIN = PA13 // SCK:  SERCOM2/PAD[1]
   104  	SPI0_SDO_PIN = PA12 // SDO: SERCOM2/PAD[0]
   105  	SPI0_SDI_PIN = PA14 // SDI: SERCOM2/PAD[2]
   106  
   107  	NINA_SDO = SPI0_SDO_PIN
   108  	NINA_SDI = SPI0_SDI_PIN
   109  	NINA_SCK = SPI0_SCK_PIN
   110  )
   111  
   112  const (
   113  	SPI1_SCK_PIN = D12 // SDI: SERCOM1/PAD[1]
   114  	SPI1_SDO_PIN = D11 // SDO: SERCOM1/PAD[3]
   115  	SPI1_SDI_PIN = D13 // SCK:  SERCOM1/PAD[0]
   116  )
   117  
   118  // SPI on the Metro M4.
   119  var (
   120  	SPI0     = sercomSPIM2
   121  	NINA_SPI = SPI0
   122  )
   123  
   124  // SPI1 on the Metro M4 on pins 11,12,13
   125  var SPI1 = sercomSPIM1
   126  
   127  // USB CDC identifiers
   128  const (
   129  	usb_STRING_PRODUCT      = "Adafruit Metro M4 Airlift Lite"
   130  	usb_STRING_MANUFACTURER = "Adafruit"
   131  )
   132  
   133  var (
   134  	usb_VID uint16 = 0x239A
   135  	usb_PID uint16 = 0x8037
   136  )