github.com/aykevl/tinygo@v0.5.0/src/machine/board_circuitplay_express.go (about)

     1  // +build sam,atsamd21,circuitplay_express
     2  
     3  package machine
     4  
     5  import "device/sam"
     6  
     7  // GPIO Pins
     8  const (
     9  	D0  = PB09
    10  	D1  = PB08
    11  	D2  = PB02
    12  	D3  = PB03
    13  	D4  = PA28
    14  	D5  = PA14
    15  	D6  = PA05
    16  	D7  = PA15
    17  	D8  = PB23
    18  	D9  = PA06
    19  	D10 = PA07
    20  	D11 = 0xff // does not seem to exist
    21  	D12 = PA02
    22  	D13 = PA17 // PWM available
    23  )
    24  
    25  // Analog Pins
    26  const (
    27  	A0  = PA02 // PWM available, also ADC/AIN[0]
    28  	A1  = PA05 // ADC/AIN[5]
    29  	A2  = PA06 // PWM available, also ADC/AIN[6]
    30  	A3  = PA07 // PWM available, also ADC/AIN[7]
    31  	A4  = PB03 // PORTB
    32  	A5  = PB02 // PORTB
    33  	A6  = PB09 // PORTB
    34  	A7  = PB08 // PORTB
    35  	A8  = PA11 // ADC/AIN[19]
    36  	A9  = PA09 // ADC/AIN[17]
    37  	A10 = PA04
    38  )
    39  
    40  const (
    41  	LED       = D13
    42  	NEOPIXELS = D8
    43  
    44  	BUTTONA = D4
    45  	BUTTONB = D5
    46  	SLIDER  = D7 // built-in slide switch
    47  
    48  	BUTTON  = BUTTONA
    49  	BUTTON1 = BUTTONB
    50  
    51  	LIGHTSENSOR = A8
    52  	TEMPSENSOR  = A9
    53  	PROXIMITY   = A10
    54  )
    55  
    56  // USBCDC pins (logical UART0)
    57  const (
    58  	USBCDC_DM_PIN = PA24
    59  	USBCDC_DP_PIN = PA25
    60  )
    61  
    62  // UART0 pins (logical UART1)
    63  const (
    64  	UART_TX_PIN = PB08 // PORTB
    65  	UART_RX_PIN = PB09 // PORTB
    66  )
    67  
    68  // I2C pins
    69  const (
    70  	SDA_PIN = PB02 // I2C0 external
    71  	SCL_PIN = PB03 // I2C0 external
    72  
    73  	SDA1_PIN = PA00 // I2C1 internal
    74  	SCL1_PIN = PA01 // I2C1 internal
    75  )
    76  
    77  // I2C on the Circuit Playground Express.
    78  var (
    79  	// external device
    80  	I2C0 = I2C{Bus: sam.SERCOM5_I2CM,
    81  		SDA:     SDA_PIN,
    82  		SCL:     SCL_PIN,
    83  		PinMode: GPIO_SERCOM}
    84  	// internal device
    85  	I2C1 = I2C{Bus: sam.SERCOM1_I2CM,
    86  		SDA:     SDA1_PIN,
    87  		SCL:     SCL1_PIN,
    88  		PinMode: GPIO_SERCOM_ALT}
    89  )
    90  
    91  // SPI pins (internal flash)
    92  const (
    93  	SPI0_SCK_PIN  = PA21 // SCK: SERCOM3/PAD[3]
    94  	SPI0_MOSI_PIN = PA20 // MOSI: SERCOM3/PAD[2]
    95  	SPI0_MISO_PIN = PA16 // MISO: SERCOM3/PAD[0]
    96  )
    97  
    98  // SPI on the Circuit Playground Express.
    99  var (
   100  	SPI0 = SPI{Bus: sam.SERCOM3_SPI}
   101  )