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

     1  //go:build m5stick_c
     2  
     3  // This file contains the pin mapping for the M5STACK M5Stick-C device.
     4  // doc: https://docs.m5stack.com/en/core/m5stickc
     5  
     6  package machine
     7  
     8  const (
     9  	// HAT     | HY2.0-4P
    10  	//         |
    11  	// GND     | GND
    12  	// 5V OUT  | VOUT
    13  	// G26     | G32   SDA
    14  	// G36     | G33   SCL
    15  	// G0      |
    16  	// BAT     |
    17  	// 3V3     |
    18  	// 5V IN   |
    19  
    20  	IO0  = GPIO0 // CLK
    21  	IO1  = GPIO1 // U0TXD
    22  	IO2  = GPIO2
    23  	IO3  = GPIO3 // U0RXD
    24  	IO4  = GPIO4
    25  	IO5  = GPIO5 // TFT_CS LCD_SS SPI0_SS
    26  	IO6  = GPIO6
    27  	IO7  = GPIO7
    28  	IO8  = GPIO8
    29  	IO9  = GPIO9  // IR
    30  	IO10 = GPIO10 // LED
    31  	IO11 = GPIO11
    32  	IO12 = GPIO12
    33  	IO13 = GPIO13 // TFT_CLK  LCD_SCK  SPI0_SCK
    34  	IO14 = GPIO14
    35  	IO15 = GPIO15 // TFT_MOSI LCD_MOSI SPI0_MOSI
    36  	IO16 = GPIO16
    37  	IO17 = GPIO17
    38  	IO18 = GPIO18 // TFT_RST LCD_RST
    39  	IO19 = GPIO19
    40  	IO21 = GPIO21 // SDA0
    41  	IO22 = GPIO22 // SCL0
    42  	IO23 = GPIO23 // TFT_DC LCD_DC
    43  	IO25 = GPIO25 // -   DAC1
    44  	IO26 = GPIO26 // HAT DAC2
    45  	IO27 = GPIO27
    46  	IO32 = GPIO32 // SDA1 / PIN 32 / RXD2
    47  	IO33 = GPIO33 // SCL1 / PIN 33 / TXD2
    48  	IO34 = GPIO34 // MIC_DATA
    49  	IO35 = GPIO35 // IRQ0   ADC1
    50  	IO36 = GPIO36 // HAT    ADC2  LCD_MISO SPI0_MISO
    51  	IO37 = GPIO37 // BUTTON_A, BUTTON_HOME, BUTTON
    52  	IO38 = GPIO38
    53  	IO39 = GPIO39 // BUTTON_B, BUTTON_RST
    54  )
    55  
    56  const (
    57  	// Buttons
    58  	BUTTON_A    = IO37
    59  	BUTTON_B    = IO39
    60  	BUTTON_HOME = BUTTON_A
    61  	BUTTON_RST  = BUTTON_B
    62  	BUTTON      = BUTTON_A
    63  
    64  	// LED
    65  	IR  = IO9
    66  	LED = IO10
    67  )
    68  
    69  // SPI pins
    70  const (
    71  	SPI0_SCK_PIN = IO13
    72  	SPI0_SDO_PIN = IO15
    73  	SPI0_CS0_PIN = IO5
    74  
    75  	// LCD ()
    76  	LCD_SCK_PIN = SPI0_SCK_PIN
    77  	LCD_SDO_PIN = SPI0_SDO_PIN
    78  	LCD_SS_PIN  = SPI0_CS0_PIN
    79  	LCD_DC_PIN  = IO23
    80  	LCD_RST_PIN = IO18
    81  )
    82  
    83  // I2C pins
    84  const (
    85  	// Internal I2C (AXP192 / BM8563 / MPU6886)
    86  	SDA0_PIN = IO21
    87  	SCL0_PIN = IO22
    88  
    89  	// External I2C (GROOVE PORT)
    90  	SDA1_PIN = IO32
    91  	SCL1_PIN = IO33
    92  
    93  	SDA_PIN = SDA1_PIN
    94  	SCL_PIN = SCL1_PIN
    95  )
    96  
    97  // ADC pins
    98  const (
    99  	ADC1 Pin = IO35
   100  	ADC2 Pin = IO36
   101  )
   102  
   103  // DAC pins
   104  const (
   105  	DAC1 Pin = IO25
   106  	DAC2 Pin = IO26
   107  )
   108  
   109  // UART pins
   110  const (
   111  	// UART0 (CP2104)
   112  	UART0_TX_PIN = IO1
   113  	UART0_RX_PIN = IO3
   114  
   115  	UART_TX_PIN = UART0_TX_PIN
   116  	UART_RX_PIN = UART0_RX_PIN
   117  )