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

     1  //go:build waveshare_rp2040_zero
     2  
     3  // This file contains the pin mappings for the Waveshare RP2040-Zero boards.
     4  //
     5  // Waveshare RP2040-Zero is a microcontroller using the Raspberry Pi RP2040 chip.
     6  //
     7  // - https://www.waveshare.com/wiki/RP2040-Zero
     8  package machine
     9  
    10  // Digital Pins
    11  const (
    12  	D0  Pin = GPIO0
    13  	D1  Pin = GPIO1
    14  	D2  Pin = GPIO2
    15  	D3  Pin = GPIO3
    16  	D4  Pin = GPIO4
    17  	D5  Pin = GPIO5
    18  	D6  Pin = GPIO6
    19  	D7  Pin = GPIO7
    20  	D8  Pin = GPIO8
    21  	D9  Pin = GPIO9
    22  	D10 Pin = GPIO10
    23  	D11 Pin = GPIO11
    24  	D12 Pin = GPIO12
    25  	D13 Pin = GPIO13
    26  	D14 Pin = GPIO14
    27  	D15 Pin = GPIO15
    28  	D16 Pin = GPIO16
    29  	D17 Pin = GPIO17
    30  	D18 Pin = GPIO18
    31  	D19 Pin = GPIO19
    32  	D20 Pin = GPIO20
    33  	D21 Pin = GPIO21
    34  	D22 Pin = GPIO22
    35  	D23 Pin = GPIO23
    36  	D24 Pin = GPIO24
    37  	D25 Pin = GPIO25
    38  	D26 Pin = GPIO26
    39  	D27 Pin = GPIO27
    40  	D28 Pin = GPIO28
    41  	D29 Pin = GPIO29
    42  )
    43  
    44  // Analog pins
    45  const (
    46  	A0 Pin = D26
    47  	A1 Pin = D27
    48  	A2 Pin = D28
    49  	A3 Pin = D29
    50  )
    51  
    52  // Onboard LEDs
    53  const (
    54  	NEOPIXEL = GPIO16
    55  )
    56  
    57  // I2C pins
    58  const (
    59  	I2C0_SDA_PIN Pin = D0
    60  	I2C0_SCL_PIN Pin = D1
    61  
    62  	I2C1_SDA_PIN Pin = D2
    63  	I2C1_SCL_PIN Pin = D3
    64  )
    65  
    66  // SPI pins
    67  const (
    68  	SPI0_SCK_PIN Pin = D6
    69  	SPI0_SDO_PIN Pin = D3
    70  	SPI0_SDI_PIN Pin = D4
    71  
    72  	SPI1_SCK_PIN Pin = D10
    73  	SPI1_SDO_PIN Pin = D11
    74  	SPI1_SDI_PIN Pin = D12
    75  )
    76  
    77  // Onboard crystal oscillator frequency, in MHz.
    78  const (
    79  	xoscFreq = 12 // MHz
    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  	UART1_TX_PIN = GPIO8
    89  	UART1_RX_PIN = GPIO9
    90  )
    91  
    92  var DefaultUART = UART0
    93  
    94  // USB CDC identifiers
    95  const (
    96  	usb_STRING_PRODUCT      = "RP2040-Zero"
    97  	usb_STRING_MANUFACTURER = "Waveshare"
    98  )
    99  
   100  var (
   101  	usb_VID uint16 = 0x2e8a
   102  	usb_PID uint16 = 0x0003
   103  )