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

     1  //go:build m5stack
     2  
     3  package machine
     4  
     5  const (
     6  	//     GND     | ADC     G35
     7  	//     GND     | ADC     G36
     8  	//     GND     | RST     EN
     9  	// G23 MOSI    | DAC/SPK G25
    10  	// G19 MISO    | DAC     G26
    11  	// G18 SCK     | 3.3V
    12  	// G3  RXD1    | TXD1    G1
    13  	// G16 RXD2    | TXD2    G17
    14  	// G21 SDA     | DCL     G22
    15  	// G2  GPIO    | GPIO    G5
    16  	// G12 IIS_SK  | IIS_WS  G13
    17  	// G15 IIS_OUT | IIS_MK  G0
    18  	//     HPWR    | IIS_IN  G34
    19  	//     HPWR    | 5V
    20  	//     HPWR    | BATTERY
    21  
    22  	IO0  = GPIO0
    23  	IO1  = GPIO1
    24  	IO2  = GPIO2
    25  	IO3  = GPIO3
    26  	IO4  = GPIO4
    27  	IO5  = GPIO5
    28  	IO6  = GPIO6
    29  	IO7  = GPIO7
    30  	IO8  = GPIO8
    31  	IO9  = GPIO9
    32  	IO10 = GPIO10
    33  	IO11 = GPIO11
    34  	IO12 = GPIO12
    35  	IO13 = GPIO13
    36  	IO14 = GPIO14
    37  	IO15 = GPIO15
    38  	IO16 = GPIO16
    39  	IO17 = GPIO17
    40  	IO18 = GPIO18
    41  	IO19 = GPIO19
    42  	IO21 = GPIO21
    43  	IO22 = GPIO22
    44  	IO23 = GPIO23
    45  	IO25 = GPIO25
    46  	IO26 = GPIO26
    47  	IO27 = GPIO27
    48  	IO32 = GPIO32
    49  	IO33 = GPIO33
    50  	IO34 = GPIO34
    51  	IO35 = GPIO35
    52  	IO36 = GPIO36
    53  	IO37 = GPIO37
    54  	IO38 = GPIO38
    55  	IO39 = GPIO39
    56  )
    57  
    58  const (
    59  	// Buttons
    60  	BUTTON_A = IO39
    61  	BUTTON_B = IO38
    62  	BUTTON_C = IO37
    63  	BUTTON   = BUTTON_A
    64  
    65  	// Speaker
    66  	SPEAKER_PIN = IO25
    67  )
    68  
    69  // SPI pins
    70  const (
    71  	SPI0_SCK_PIN = IO18
    72  	SPI0_SDO_PIN = IO23
    73  	SPI0_SDI_PIN = IO19
    74  	SPI0_CS0_PIN = IO14
    75  
    76  	// LCD (ILI9342C)
    77  	LCD_SCK_PIN = SPI0_SCK_PIN
    78  	LCD_SDO_PIN = SPI0_SDO_PIN
    79  	LCD_SDI_PIN = SPI0_SDI_PIN // NoPin ?
    80  	LCD_SS_PIN  = SPI0_CS0_PIN
    81  	LCD_DC_PIN  = IO27
    82  	LCD_RST_PIN = IO33
    83  	LCD_BL_PIN  = IO32
    84  
    85  	// SD CARD
    86  	SDCARD_SCK_PIN = SPI0_SCK_PIN
    87  	SDCARD_SDO_PIN = SPI0_SDO_PIN
    88  	SDCARD_SDI_PIN = SPI0_SDI_PIN
    89  	SDCARD_SS_PIN  = IO4
    90  )
    91  
    92  // I2C pins
    93  const (
    94  	SDA0_PIN = IO21
    95  	SCL0_PIN = IO22
    96  
    97  	SDA_PIN = SDA0_PIN
    98  	SCL_PIN = SCL0_PIN
    99  )
   100  
   101  // ADC pins
   102  const (
   103  	ADC1 Pin = IO35
   104  	ADC2 Pin = IO36
   105  )
   106  
   107  // DAC pins
   108  const (
   109  	DAC1 Pin = IO25
   110  	DAC2 Pin = IO26
   111  )
   112  
   113  // UART pins
   114  const (
   115  	// UART0 (CP2104)
   116  	UART0_TX_PIN = IO1
   117  	UART0_RX_PIN = IO3
   118  
   119  	UART1_TX_PIN = IO17
   120  	UART1_RX_PIN = IO16
   121  
   122  	UART_TX_PIN = UART0_TX_PIN
   123  	UART_RX_PIN = UART0_RX_PIN
   124  )