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

     1  //go:build macropad_rp2040
     2  
     3  package machine
     4  
     5  const (
     6  	NeopixelCount = 12
     7  
     8  	// Onboard crystal oscillator frequency, in MHz.
     9  	xoscFreq = 12 // MHz
    10  )
    11  
    12  const (
    13  	SWITCH = GPIO0
    14  	BUTTON = GPIO0
    15  
    16  	KEY1  = GPIO1
    17  	KEY2  = GPIO2
    18  	KEY3  = GPIO3
    19  	KEY4  = GPIO4
    20  	KEY5  = GPIO5
    21  	KEY6  = GPIO6
    22  	KEY7  = GPIO7
    23  	KEY8  = GPIO8
    24  	KEY9  = GPIO9
    25  	KEY10 = GPIO10
    26  	KEY11 = GPIO11
    27  	KEY12 = GPIO12
    28  
    29  	LED = GPIO13
    30  
    31  	SPEAKER_ENABLE = GPIO14
    32  	SPEAKER        = GPIO16
    33  
    34  	ROT_A = GPIO18
    35  	ROT_B = GPIO17
    36  
    37  	OLED_CS  = GPIO22
    38  	OLED_RST = GPIO23
    39  	OLED_DC  = GPIO24
    40  
    41  	NEOPIXEL = GPIO19
    42  	WS2812   = NEOPIXEL
    43  )
    44  
    45  // I2C Default pins on Raspberry Pico.
    46  const (
    47  	I2C0_SDA_PIN = GPIO20
    48  	I2C0_SCL_PIN = GPIO21
    49  
    50  	I2C1_SDA_PIN = NoPin // not pinned out
    51  	I2C1_SCL_PIN = NoPin // not pinned out
    52  )
    53  
    54  // SPI default pins
    55  const (
    56  	// Default Serial Clock Bus 1 for SPI communications
    57  	SPI1_SCK_PIN = GPIO26
    58  	// Default Serial Out Bus 1 for SPI communications
    59  	SPI1_SDO_PIN = GPIO27 // Tx
    60  	// Default Serial In Bus 1 for SPI communications
    61  	SPI1_SDI_PIN = GPIO28 // Rx
    62  
    63  	SPI0_SCK_PIN = NoPin // not pinned out
    64  	SPI0_SDO_PIN = NoPin // not pinned out
    65  	SPI0_SDI_PIN = NoPin // not pinned out
    66  )
    67  
    68  // UART pins
    69  const (
    70  	UART0_TX_PIN = GPIO0
    71  	UART0_RX_PIN = GPIO1
    72  	UART_TX_PIN  = UART0_TX_PIN
    73  	UART_RX_PIN  = UART0_RX_PIN
    74  )
    75  
    76  var DefaultUART = UART0
    77  
    78  // USB identifiers
    79  const (
    80  	usb_STRING_PRODUCT      = "MacroPad RP2040"
    81  	usb_STRING_MANUFACTURER = "Adafruit"
    82  )
    83  
    84  var (
    85  	usb_VID uint16 = 0x239A
    86  	usb_PID uint16 = 0x8107
    87  )