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

     1  //go:build circuitplay_express
     2  
     3  package machine
     4  
     5  // used to reset into bootloader
     6  const resetMagicValue = 0xf01669ef
     7  
     8  // GPIO Pins
     9  const (
    10  	D0  = PB09
    11  	D1  = PB08
    12  	D2  = PB02
    13  	D3  = PB03
    14  	D4  = PA28
    15  	D5  = PA14
    16  	D6  = PA05
    17  	D7  = PA15
    18  	D8  = PB23
    19  	D9  = PA06
    20  	D10 = PA07
    21  	D11 = NoPin // does not seem to exist
    22  	D12 = PA02
    23  	D13 = PA17 // PWM available
    24  )
    25  
    26  // Analog Pins
    27  const (
    28  	A0  = PA02 // ADC/AIN[0]
    29  	A1  = PA05 // PWM available, also ADC/AIN[5]
    30  	A2  = PA06 // PWM available, also ADC/AIN[6]
    31  	A3  = PA07 // PWM available, also ADC/AIN[7]
    32  	A4  = PB03 // PORTB
    33  	A5  = PB02 // PORTB
    34  	A6  = PB09 // PORTB
    35  	A7  = PB08 // PORTB
    36  	A8  = PA11 // ADC/AIN[19]
    37  	A9  = PA09 // ADC/AIN[17]
    38  	A10 = PA04
    39  )
    40  
    41  const (
    42  	LED       = D13
    43  	NEOPIXELS = D8
    44  	WS2812    = D8
    45  
    46  	BUTTONA = D4
    47  	BUTTONB = D5
    48  	SLIDER  = D7 // built-in slide switch
    49  
    50  	BUTTON  = BUTTONA
    51  	BUTTON1 = BUTTONB
    52  
    53  	LIGHTSENSOR = A8
    54  	TEMPSENSOR  = A9
    55  	PROXIMITY   = A10
    56  )
    57  
    58  // USBCDC pins (logical UART0)
    59  const (
    60  	USBCDC_DM_PIN = PA24
    61  	USBCDC_DP_PIN = PA25
    62  )
    63  
    64  // UART0 pins (logical UART1)
    65  const (
    66  	UART_TX_PIN = PB08 // PORTB
    67  	UART_RX_PIN = PB09 // PORTB
    68  )
    69  
    70  // UART1 on the Circuit Playground Express.
    71  var (
    72  	UART1 = &sercomUSART4
    73  
    74  	DefaultUART = UART1
    75  )
    76  
    77  // I2C pins
    78  const (
    79  	SDA_PIN = PB02 // I2C0 external
    80  	SCL_PIN = PB03 // I2C0 external
    81  
    82  	SDA1_PIN = PA00 // I2C1 internal
    83  	SCL1_PIN = PA01 // I2C1 internal
    84  )
    85  
    86  // I2C on the Circuit Playground Express.
    87  var (
    88  	I2C0 = sercomI2CM5 // external device
    89  	I2C1 = sercomI2CM1 // internal device
    90  )
    91  
    92  // SPI pins (internal flash)
    93  const (
    94  	SPI0_SCK_PIN = PA21 // SCK: SERCOM3/PAD[3]
    95  	SPI0_SDO_PIN = PA20 // SDO: SERCOM3/PAD[2]
    96  	SPI0_SDI_PIN = PA16 // SDI: SERCOM3/PAD[0]
    97  )
    98  
    99  // SPI on the Circuit Playground Express.
   100  var SPI0 = sercomSPIM3
   101  
   102  // I2S pins
   103  const (
   104  	I2S_SCK_PIN = PA10
   105  	I2S_SD_PIN  = PA08
   106  	I2S_WS_PIN  = NoPin // no WS, instead uses SCK to sync
   107  )
   108  
   109  // USB CDC identifiers
   110  const (
   111  	usb_STRING_PRODUCT      = "Adafruit Circuit Playground Express"
   112  	usb_STRING_MANUFACTURER = "Adafruit"
   113  )
   114  
   115  var (
   116  	usb_VID uint16 = 0x239A
   117  	usb_PID uint16 = 0x8018
   118  )