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

     1  //go:build microbit_v2
     2  
     3  package machine
     4  
     5  // The micro:bit does not have a 32kHz crystal on board.
     6  const HasLowFrequencyCrystal = false
     7  
     8  // Buttons on the micro:bit v2 (A and B)
     9  const (
    10  	BUTTON  Pin = BUTTONA
    11  	BUTTONA Pin = P5
    12  	BUTTONB Pin = P11
    13  )
    14  
    15  var DefaultUART = UART0
    16  
    17  // UART pins
    18  const (
    19  	UART_TX_PIN Pin = P34
    20  	UART_RX_PIN Pin = P33
    21  )
    22  
    23  // ADC pins
    24  const (
    25  	ADC0 Pin = P0
    26  	ADC1 Pin = P1
    27  	ADC2 Pin = P2
    28  )
    29  
    30  // I2C0 (internal) pins
    31  const (
    32  	SDA_PIN  Pin = SDA0_PIN
    33  	SCL_PIN  Pin = SCL0_PIN
    34  	SDA0_PIN Pin = P30
    35  	SCL0_PIN Pin = P31
    36  )
    37  
    38  // I2C1 (external) pins
    39  const (
    40  	SDA1_PIN Pin = P20
    41  	SCL1_PIN Pin = P19
    42  )
    43  
    44  // SPI pins
    45  const (
    46  	SPI0_SCK_PIN Pin = P13
    47  	SPI0_SDO_PIN Pin = P15
    48  	SPI0_SDI_PIN Pin = P14
    49  )
    50  
    51  // GPIO/Analog pins
    52  const (
    53  	P0  Pin = 2
    54  	P1  Pin = 3
    55  	P2  Pin = 4
    56  	P3  Pin = 31
    57  	P4  Pin = 28
    58  	P5  Pin = 14
    59  	P6  Pin = 37
    60  	P7  Pin = 11
    61  	P8  Pin = 10
    62  	P9  Pin = 9
    63  	P10 Pin = 30
    64  	P11 Pin = 23
    65  	P12 Pin = 12
    66  	P13 Pin = 17
    67  	P14 Pin = 1
    68  	P15 Pin = 13
    69  	P16 Pin = 34
    70  	P19 Pin = 26
    71  	P20 Pin = 32
    72  	P21 Pin = 21
    73  	P22 Pin = 22
    74  	P23 Pin = 15
    75  	P24 Pin = 24
    76  	P25 Pin = 19
    77  	P26 Pin = 36
    78  	P27 Pin = 0
    79  	P28 Pin = 20
    80  	P29 Pin = 5
    81  	P30 Pin = 16
    82  	P31 Pin = 8
    83  	P32 Pin = 25
    84  	P33 Pin = 40
    85  	P34 Pin = 6
    86  )
    87  
    88  // LED matrix pins
    89  const (
    90  	LED_COL_1 Pin = P0_28
    91  	LED_COL_2 Pin = P0_11
    92  	LED_COL_3 Pin = P0_31
    93  	LED_COL_4 Pin = P1_05
    94  	LED_COL_5 Pin = P0_30
    95  	LED_ROW_1 Pin = P0_21
    96  	LED_ROW_2 Pin = P0_22
    97  	LED_ROW_3 Pin = P0_15
    98  	LED_ROW_4 Pin = P0_24
    99  	LED_ROW_5 Pin = P0_19
   100  )
   101  
   102  // Peripherals
   103  const (
   104  	BUZZER    = P27
   105  	CAP_TOUCH = P26
   106  	MIC       = P29
   107  	MIC_LED   = P28
   108  )
   109  
   110  // USB CDC identifiers
   111  const (
   112  	usb_STRING_PRODUCT      = "BBC micro:bit V2"
   113  	usb_STRING_MANUFACTURER = "BBC"
   114  )
   115  
   116  var (
   117  	usb_VID uint16 = 0x0d28
   118  	usb_PID uint16 = 0x0204
   119  )