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

     1  //go:build kb2040
     2  
     3  package machine
     4  
     5  // Onboard crystal oscillator frequency, in MHz.
     6  const xoscFreq = 12 // MHz
     7  
     8  // GPIO Pins
     9  const (
    10  	D0  = GPIO0
    11  	D1  = GPIO1
    12  	D2  = GPIO2
    13  	D3  = GPIO3
    14  	D4  = GPIO4
    15  	D5  = GPIO5
    16  	D6  = GPIO6
    17  	D7  = GPIO7
    18  	D8  = GPIO8
    19  	D9  = GPIO9
    20  	D10 = GPIO10
    21  )
    22  
    23  // Analog pins
    24  const (
    25  	A0 = GPIO26
    26  	A1 = GPIO27
    27  	A2 = GPIO28
    28  	A3 = GPIO29
    29  )
    30  
    31  // Note: there is no user-controllable LED on the KB2040 board
    32  // const LED = notConnected
    33  
    34  // I2C Pins.
    35  const (
    36  	I2C0_SDA_PIN = GPIO12
    37  	I2C0_SCL_PIN = GPIO13
    38  
    39  	I2C1_SDA_PIN = GPIO2
    40  	I2C1_SCL_PIN = GPIO3
    41  
    42  	SDA_PIN = I2C0_SDA_PIN
    43  	SCL_PIN = I2C0_SCL_PIN
    44  )
    45  
    46  // SPI default pins
    47  const (
    48  	// Default Serial Clock Bus 0 for SPI communications
    49  	SPI0_SCK_PIN = GPIO18
    50  	// Default Serial Out Bus 0 for SPI communications
    51  	SPI0_SDO_PIN = GPIO19 // Tx
    52  	// Default Serial In Bus 0 for SPI communications
    53  	SPI0_SDI_PIN = GPIO20 // Rx
    54  
    55  	// Default Serial Clock Bus 1 for SPI communications
    56  	SPI1_SCK_PIN = GPIO26
    57  	// Default Serial Out Bus 1 for SPI communications
    58  	SPI1_SDO_PIN = GPIO27 // Tx
    59  	// Default Serial In Bus 1 for SPI communications
    60  	SPI1_SDI_PIN = GPIO28 // Rx
    61  )
    62  
    63  // UART pins
    64  const (
    65  	UART0_TX_PIN = GPIO0
    66  	UART0_RX_PIN = GPIO1
    67  	UART1_TX_PIN = GPIO8
    68  	UART1_RX_PIN = GPIO9
    69  	UART_TX_PIN  = UART0_TX_PIN
    70  	UART_RX_PIN  = UART0_RX_PIN
    71  )
    72  
    73  var DefaultUART = UART0
    74  
    75  // USB identifiers
    76  const (
    77  	usb_STRING_PRODUCT      = "KB2040"
    78  	usb_STRING_MANUFACTURER = "Adafruit"
    79  )
    80  
    81  var (
    82  	usb_VID uint16 = 0x239A
    83  	usb_PID uint16 = 0x8106
    84  )