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

     1  //go:build sam && atsamd51 && pygamer
     2  
     3  package machine
     4  
     5  // used to reset into bootloader
     6  const resetMagicValue = 0xf01669ef
     7  
     8  // GPIO Pins
     9  const (
    10  	D0  = PB17 // UART0 RX/PWM available
    11  	D1  = PB16 // UART0 TX/PWM available
    12  	D2  = PB03
    13  	D3  = PB02
    14  	D4  = PA14 // PWM available
    15  	D5  = PA16 // PWM available
    16  	D6  = PA18 // PWM available
    17  	D7  = PB14 // CS for microSD card slot
    18  	D8  = PA15 // built-in neopixel
    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 = PA22 // PWM available
    23  	D13 = PA23 // 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[6]
    34  	A6 = PB01 // ADC/AIN[12]/VMEAS
    35  	A7 = PB04 // ADC/AIN[6]/LIGHT
    36  	A8 = D2   // ADC/AIN[14]
    37  	A9 = D3   // ADC/AIN[15]
    38  )
    39  
    40  const (
    41  	LED       = D13
    42  	NEOPIXELS = D8
    43  	WS2812    = D8
    44  
    45  	SD_CS = D7
    46  
    47  	LIGHTSENSOR = A7
    48  
    49  	BUTTON_LATCH = PB00
    50  	BUTTON_OUT   = PB30
    51  	BUTTON_CLK   = PB31
    52  
    53  	JOYY = PB06
    54  	JOYX = PB07
    55  
    56  	TFT_DC   = PB05
    57  	TFT_CS   = PB12
    58  	TFT_RST  = PA00
    59  	TFT_LITE = PA01
    60  
    61  	SPEAKER_ENABLE = PA27
    62  )
    63  
    64  const (
    65  	BUTTON_SELECT_MASK = 16
    66  	BUTTON_START_MASK  = 32
    67  	BUTTON_A_MASK      = 64
    68  	BUTTON_B_MASK      = 128
    69  )
    70  
    71  // USBCDC pins
    72  const (
    73  	USBCDC_DM_PIN = PA24
    74  	USBCDC_DP_PIN = PA25
    75  )
    76  
    77  // UART1 pins
    78  const (
    79  	UART_TX_PIN = D1
    80  	UART_RX_PIN = D0
    81  )
    82  
    83  // UART1 var is on SERCOM3, defined in atsamd51.go
    84  
    85  // UART2 pins
    86  const (
    87  	UART2_TX_PIN = A4
    88  	UART2_RX_PIN = A5
    89  )
    90  
    91  // UART2 var is on SERCOM0, defined in atsamd51.go
    92  
    93  // I2C pins
    94  const (
    95  	SDA_PIN = PA12 // SDA: SERCOM2/PAD[0]
    96  	SCL_PIN = PA13 // SCL: SERCOM2/PAD[1]
    97  )
    98  
    99  // I2C on the PyGamer.
   100  var (
   101  	I2C0 = sercomI2CM2
   102  )
   103  
   104  // SPI pins
   105  const (
   106  	SPI0_SCK_PIN = PA17 // SCK: SERCOM1/PAD[1]
   107  	SPI0_SDO_PIN = PB23 // SDO: SERCOM1/PAD[3]
   108  	SPI0_SDI_PIN = PB22 // SDI: SERCOM1/PAD[2]
   109  )
   110  
   111  // SPI on the PyGamer.
   112  var SPI0 = sercomSPIM1
   113  
   114  // TFT SPI pins
   115  const (
   116  	SPI1_SCK_PIN = PB13 // SCK: SERCOM4/PAD[1]
   117  	SPI1_SDO_PIN = PB15 // SDO: SERCOM4/PAD[3]
   118  	SPI1_SDI_PIN = NoPin
   119  )
   120  
   121  // TFT SPI on the PyGamer.
   122  var SPI1 = sercomSPIM4
   123  
   124  // USB CDC identifiers
   125  const (
   126  	usb_STRING_PRODUCT      = "Adafruit pyGamer M4"
   127  	usb_STRING_MANUFACTURER = "Adafruit"
   128  )
   129  
   130  var (
   131  	usb_VID uint16 = 0x239A
   132  	usb_PID uint16 = 0x8033
   133  )