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

     1  //go:build thingplus_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  	GP0 Pin = GPIO0 // TX
    11  	GP1 Pin = GPIO1 // RX
    12  	GP2 Pin = GPIO2 // SCK
    13  	GP3 Pin = GPIO3 // COPI
    14  	GP4 Pin = GPIO4 // CIPO
    15  
    16  	GP6  Pin = GPIO6  // SDA
    17  	GP7  Pin = GPIO7  // SCL (connected to GPIO23 as well)
    18  	GP8  Pin = GPIO8  // WS2812 RGB LED
    19  	GP9  Pin = GPIO9  // muSDcard DATA3 / CS
    20  	GP10 Pin = GPIO10 // muSDcard DATA2
    21  	GP11 Pin = GPIO11 // muSDcard DATA1
    22  	GP12 Pin = GPIO12 // muSDcard DATA0 / CIPO
    23  
    24  	GP14 Pin = GPIO14 // muSDcard CLK /SCLK
    25  	GP15 Pin = GPIO15 // muSDcard CMD / COPI
    26  	GP16 Pin = GPIO16 // 16
    27  	GP17 Pin = GPIO17 // 17
    28  	GP18 Pin = GPIO18 // 18
    29  	GP19 Pin = GPIO19 // 19
    30  	GP20 Pin = GPIO20 // 20
    31  	GP21 Pin = GPIO21 // 21
    32  	GP22 Pin = GPIO22 // 22
    33  	GP23 Pin = GPIO23 // Connected to GPIO7
    34  	GP25 Pin = GPIO25 // Status blue LED
    35  	GP26 Pin = GPIO26 // ADC0
    36  	GP27 Pin = GPIO27 // ADC1
    37  	GP28 Pin = GPIO28 // ADC2
    38  	GP29 Pin = GPIO29 // ADC3
    39  )
    40  
    41  // Analog pins
    42  const (
    43  	A0 = GPIO26
    44  	A1 = GPIO27
    45  	A2 = GPIO28
    46  	A3 = GPIO29
    47  )
    48  
    49  const LED = GPIO25
    50  
    51  // I2C Pins.
    52  const (
    53  	I2C0_SCL_PIN = GPIO6 // N/A
    54  	I2C0_SDA_PIN = GPIO7 // N/A
    55  
    56  	I2C1_SDA_PIN = GPIO6
    57  	I2C1_SCL_PIN = GPIO7
    58  
    59  	SDA_PIN = I2C1_SDA_PIN
    60  	SCL_PIN = I2C1_SCL_PIN
    61  )
    62  
    63  // SPI default pins
    64  const (
    65  	// Default Serial Clock Bus 0 for SPI communications
    66  	SPI0_SCK_PIN = GPIO2
    67  	// Default Serial Out Bus 0 for SPI communications
    68  	SPI0_SDO_PIN = GPIO3 // Tx
    69  	// Default Serial In Bus 0 for SPI communications
    70  	SPI0_SDI_PIN = GPIO4 // Rx
    71  
    72  	// Default Serial Clock Bus 1 for SPI communications to muSDcard
    73  	SPI1_SCK_PIN = GPIO14
    74  	// Default Serial Out Bus 1 for SPI communications to muSDcard
    75  	SPI1_SDO_PIN = GPIO15 // Tx
    76  	// Default Serial In Bus 1 for SPI communications to muSDcard
    77  	SPI1_SDI_PIN = GPIO12 // Rx
    78  )
    79  
    80  // UART pins
    81  const (
    82  	UART0_TX_PIN = GPIO0
    83  	UART0_RX_PIN = GPIO1
    84  	UART_TX_PIN  = UART0_TX_PIN
    85  	UART_RX_PIN  = UART0_RX_PIN
    86  )
    87  
    88  var DefaultUART = UART0
    89  
    90  // USB identifiers
    91  const (
    92  	usb_STRING_PRODUCT      = "Thing Plus RP2040"
    93  	usb_STRING_MANUFACTURER = "SparkFun"
    94  )
    95  
    96  var (
    97  	usb_VID uint16 = 0x1B4F
    98  	usb_PID uint16 = 0x0026
    99  )