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

     1  //go:build badger2040
     2  
     3  // This contains the pin mappings for the Badger 2040 Connect board.
     4  //
     5  // For more information, see: https://shop.pimoroni.com/products/badger-2040
     6  // Also
     7  // - Badger 2040 schematic: https://cdn.shopify.com/s/files/1/0174/1800/files/badger_2040_schematic.pdf?v=1645702148
     8  package machine
     9  
    10  const (
    11  	LED Pin = GPIO25
    12  
    13  	BUTTON_A    Pin = GPIO12
    14  	BUTTON_B    Pin = GPIO13
    15  	BUTTON_C    Pin = GPIO14
    16  	BUTTON_UP   Pin = GPIO15
    17  	BUTTON_DOWN Pin = GPIO11
    18  	BUTTON_USER Pin = GPIO23
    19  
    20  	EPD_BUSY_PIN  Pin = GPIO26
    21  	EPD_RESET_PIN Pin = GPIO21
    22  	EPD_DC_PIN    Pin = GPIO20
    23  	EPD_CS_PIN    Pin = GPIO17
    24  	EPD_SCK_PIN   Pin = GPIO18
    25  	EPD_SDO_PIN   Pin = GPIO19
    26  
    27  	VBUS_DETECT Pin = GPIO24
    28  	BATTERY     Pin = GPIO29
    29  	ENABLE_3V3  Pin = GPIO10
    30  )
    31  
    32  // I2C pins
    33  const (
    34  	I2C0_SDA_PIN Pin = GPIO4
    35  	I2C0_SCL_PIN Pin = GPIO5
    36  
    37  	I2C1_SDA_PIN Pin = NoPin
    38  	I2C1_SCL_PIN Pin = NoPin
    39  )
    40  
    41  // SPI pins.
    42  const (
    43  	SPI0_SCK_PIN Pin = GPIO18
    44  	SPI0_SDO_PIN Pin = GPIO19
    45  	SPI0_SDI_PIN Pin = GPIO16
    46  
    47  	SPI1_SCK_PIN Pin = NoPin
    48  	SPI1_SDO_PIN Pin = NoPin
    49  	SPI1_SDI_PIN Pin = NoPin
    50  )
    51  
    52  // QSPI pins¿?
    53  const (
    54  /*
    55  	TODO
    56  
    57  SPI0_SD0_PIN Pin = QSPI_SD0
    58  SPI0_SD1_PIN Pin = QSPI_SD1
    59  SPI0_SD2_PIN Pin = QSPI_SD2
    60  SPI0_SD3_PIN Pin = QSPI_SD3
    61  SPI0_SCK_PIN Pin = QSPI_SCLKGPIO6
    62  SPI0_CS_PIN  Pin = QSPI_CS
    63  */
    64  )
    65  
    66  // Onboard crystal oscillator frequency, in MHz.
    67  const (
    68  	xoscFreq = 12 // MHz
    69  )
    70  
    71  // USB CDC identifiers
    72  const (
    73  	usb_STRING_PRODUCT      = "Badger 2040"
    74  	usb_STRING_MANUFACTURER = "Pimoroni"
    75  )
    76  
    77  var (
    78  	usb_VID uint16 = 0x2e8a
    79  	usb_PID uint16 = 0x0003
    80  )
    81  
    82  // UART pins
    83  const (
    84  	UART0_TX_PIN = GPIO0
    85  	UART0_RX_PIN = GPIO1
    86  	UART_TX_PIN  = UART0_TX_PIN
    87  	UART_RX_PIN  = UART0_RX_PIN
    88  )
    89  
    90  var DefaultUART = UART0