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

     1  //go:build qtpy_rp2040
     2  
     3  package machine
     4  
     5  // Onboard crystal oscillator frequency, in MHz.
     6  const xoscFreq = 12 // MHz
     7  
     8  // GPIO Pins
     9  const (
    10  	SDA  = GPIO24
    11  	SCL  = GPIO25
    12  	TX   = GPIO20
    13  	MO   = GPIO3
    14  	MOSI = GPIO3
    15  	MI   = GPIO4
    16  	MISO = GPIO4
    17  	SCK  = GPIO6
    18  	RX   = GPIO5
    19  
    20  	QT_SCL1 = GPIO23
    21  	QT_SDA1 = GPIO22
    22  )
    23  
    24  // Analog pins
    25  const (
    26  	A0 = GPIO29
    27  	A1 = GPIO28
    28  	A2 = GPIO27
    29  	A3 = GPIO26
    30  )
    31  
    32  const (
    33  	NEOPIXEL       = GPIO12
    34  	WS2812         = GPIO12
    35  	NEOPIXEL_POWER = GPIO11
    36  )
    37  
    38  // I2C Pins.
    39  const (
    40  	I2C0_SDA_PIN = GPIO24
    41  	I2C0_SCL_PIN = GPIO25
    42  
    43  	I2C1_SDA_PIN = GPIO26
    44  	I2C1_SCL_PIN = GPIO27
    45  
    46  	I2C1_QT_SDA_PIN = GPIO22
    47  	I2C1_QT_SCL_PIN = GPIO23
    48  
    49  	SDA_PIN = GPIO24
    50  	SCL_PIN = GPIO25
    51  )
    52  
    53  // SPI default pins
    54  const (
    55  	// Default Serial Clock Bus 0 for SPI communications
    56  	SPI0_SCK_PIN = GPIO6
    57  	// Default Serial Out Bus 0 for SPI communications
    58  	SPI0_SDO_PIN = GPIO3 // Tx
    59  	// Default Serial In Bus 0 for SPI communications
    60  	SPI0_SDI_PIN = GPIO4 // Rx
    61  	SPI0_CS      = GPIO5
    62  
    63  	// Default Serial Clock Bus 1 for SPI communications
    64  	SPI1_SCK_PIN = GPIO26
    65  	// Default Serial Out Bus 1 for SPI communications
    66  	SPI1_SDO_PIN = GPIO27 // Tx
    67  	// Default Serial In Bus 1 for SPI communications
    68  	SPI1_SDI_PIN = GPIO24 // Rx
    69  	SPI1_CS      = GPIO25
    70  )
    71  
    72  // UART pins
    73  const (
    74  	UART0_TX_PIN = GPIO28
    75  	UART0_RX_PIN = GPIO29
    76  	UART1_TX_PIN = GPIO20
    77  	UART1_RX_PIN = GPIO5
    78  	UART_TX_PIN  = UART0_TX_PIN
    79  	UART_RX_PIN  = UART0_RX_PIN
    80  )
    81  
    82  var DefaultUART = UART0
    83  
    84  // USB identifiers
    85  const (
    86  	usb_STRING_PRODUCT      = "QT Py RP2040"
    87  	usb_STRING_MANUFACTURER = "Adafruit"
    88  )
    89  
    90  var (
    91  	usb_VID uint16 = 0x239A
    92  	usb_PID uint16 = 0x80F7
    93  )