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

     1  //go:build microbit
     2  
     3  package machine
     4  
     5  // The micro:bit does not have a 32kHz crystal on board.
     6  const HasLowFrequencyCrystal = false
     7  
     8  var DefaultUART = UART0
     9  
    10  // GPIO/Analog pins
    11  const (
    12  	P0  = P0_03
    13  	P1  = P0_02
    14  	P2  = P0_01
    15  	P3  = P0_04
    16  	P4  = P0_05
    17  	P5  = P0_17
    18  	P6  = P0_12
    19  	P7  = P0_11
    20  	P8  = P0_18
    21  	P9  = P0_10
    22  	P10 = P0_06
    23  	P11 = P0_26
    24  	P12 = P0_20
    25  	P13 = P0_23
    26  	P14 = P0_22
    27  	P15 = P0_21
    28  	P16 = P0_16
    29  )
    30  
    31  // Buttons on the micro:bit (A and B)
    32  const (
    33  	BUTTONA = P0_17
    34  	BUTTONB = P0_26
    35  	BUTTON  = BUTTONA
    36  )
    37  
    38  // UART pins
    39  const (
    40  	UART_TX_PIN = P0_24
    41  	UART_RX_PIN = P0_25
    42  )
    43  
    44  // ADC pins
    45  const (
    46  	ADC0 = P0_03 // P0 on the board
    47  	ADC1 = P0_02 // P1 on the board
    48  	ADC2 = P0_01 // P2 on the board
    49  )
    50  
    51  // I2C pins
    52  const (
    53  	SDA_PIN = P0_30 // P20 on the board
    54  	SCL_PIN = P0_00 // P19 on the board
    55  )
    56  
    57  // SPI pins
    58  const (
    59  	SPI0_SCK_PIN = P0_23 // P13 on the board
    60  	SPI0_SDO_PIN = P0_21 // P15 on the board
    61  	SPI0_SDI_PIN = P0_22 // P14 on the board
    62  )
    63  
    64  // LED matrix pins
    65  const (
    66  	LED_COL_1 = P0_04
    67  	LED_COL_2 = P0_05
    68  	LED_COL_3 = P0_06
    69  	LED_COL_4 = P0_07
    70  	LED_COL_5 = P0_08
    71  	LED_COL_6 = P0_09
    72  	LED_COL_7 = P0_10
    73  	LED_COL_8 = P0_11
    74  	LED_COL_9 = P0_12
    75  	LED_ROW_1 = P0_13
    76  	LED_ROW_2 = P0_14
    77  	LED_ROW_3 = P0_15
    78  )