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

     1  //go:build pico
     2  
     3  package machine
     4  
     5  // GPIO pins
     6  const (
     7  	GP0  Pin = GPIO0
     8  	GP1  Pin = GPIO1
     9  	GP2  Pin = GPIO2
    10  	GP3  Pin = GPIO3
    11  	GP4  Pin = GPIO4
    12  	GP5  Pin = GPIO5
    13  	GP6  Pin = GPIO6
    14  	GP7  Pin = GPIO7
    15  	GP8  Pin = GPIO8
    16  	GP9  Pin = GPIO9
    17  	GP10 Pin = GPIO10
    18  	GP11 Pin = GPIO11
    19  	GP12 Pin = GPIO12
    20  	GP13 Pin = GPIO13
    21  	GP14 Pin = GPIO14
    22  	GP15 Pin = GPIO15
    23  	GP16 Pin = GPIO16
    24  	GP17 Pin = GPIO17
    25  	GP18 Pin = GPIO18
    26  	GP19 Pin = GPIO19
    27  	GP20 Pin = GPIO20
    28  	GP21 Pin = GPIO21
    29  	GP22 Pin = GPIO22
    30  	GP26 Pin = GPIO26
    31  	GP27 Pin = GPIO27
    32  	GP28 Pin = GPIO28
    33  
    34  	// Onboard LED
    35  	LED Pin = GPIO25
    36  
    37  	// Onboard crystal oscillator frequency, in MHz.
    38  	xoscFreq = 12 // MHz
    39  )
    40  
    41  // I2C Default pins on Raspberry Pico.
    42  const (
    43  	I2C0_SDA_PIN = GP4
    44  	I2C0_SCL_PIN = GP5
    45  
    46  	I2C1_SDA_PIN = GP2
    47  	I2C1_SCL_PIN = GP3
    48  )
    49  
    50  // SPI default pins
    51  const (
    52  	// Default Serial Clock Bus 0 for SPI communications
    53  	SPI0_SCK_PIN = GPIO18
    54  	// Default Serial Out Bus 0 for SPI communications
    55  	SPI0_SDO_PIN = GPIO19 // Tx
    56  	// Default Serial In Bus 0 for SPI communications
    57  	SPI0_SDI_PIN = GPIO16 // Rx
    58  
    59  	// Default Serial Clock Bus 1 for SPI communications
    60  	SPI1_SCK_PIN = GPIO10
    61  	// Default Serial Out Bus 1 for SPI communications
    62  	SPI1_SDO_PIN = GPIO11 // Tx
    63  	// Default Serial In Bus 1 for SPI communications
    64  	SPI1_SDI_PIN = GPIO12 // Rx
    65  )
    66  
    67  // UART pins
    68  const (
    69  	UART0_TX_PIN = GPIO0
    70  	UART0_RX_PIN = GPIO1
    71  	UART1_TX_PIN = GPIO8
    72  	UART1_RX_PIN = GPIO9
    73  	UART_TX_PIN  = UART0_TX_PIN
    74  	UART_RX_PIN  = UART0_RX_PIN
    75  )
    76  
    77  var DefaultUART = UART0
    78  
    79  // USB identifiers
    80  const (
    81  	usb_STRING_PRODUCT      = "Pico"
    82  	usb_STRING_MANUFACTURER = "Raspberry Pi"
    83  )
    84  
    85  var (
    86  	usb_VID uint16 = 0x2E8A
    87  	usb_PID uint16 = 0x000A
    88  )