Skip to content

Commit 1d9f26c

Browse files
jfreymuthdeadprogram
authored andcommitted
targets: add support for m5paper
1 parent 6e58c44 commit 1d9f26c

File tree

3 files changed

+119
-0
lines changed

3 files changed

+119
-0
lines changed

GNUmakefile

+2
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,8 @@ ifneq ($(XTENSA), 0)
766766
@$(MD5SUM) test.bin
767767
$(TINYGO) build -size short -o test.bin -target m5stick-c examples/serial
768768
@$(MD5SUM) test.bin
769+
$(TINYGO) build -size short -o test.bin -target m5paper examples/serial
770+
@$(MD5SUM) test.bin
769771
$(TINYGO) build -size short -o test.bin -target mch2022 examples/serial
770772
@$(MD5SUM) test.bin
771773
endif

src/machine/board_m5paper.go

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
//go:build m5paper
2+
3+
package machine
4+
5+
const (
6+
IO0 = GPIO0
7+
IO1 = GPIO1
8+
IO2 = GPIO2
9+
IO3 = GPIO3
10+
IO4 = GPIO4
11+
IO5 = GPIO5
12+
IO6 = GPIO6
13+
IO7 = GPIO7
14+
IO8 = GPIO8
15+
IO9 = GPIO9
16+
IO10 = GPIO10
17+
IO11 = GPIO11
18+
IO12 = GPIO12
19+
IO13 = GPIO13
20+
IO14 = GPIO14
21+
IO15 = GPIO15
22+
IO16 = GPIO16
23+
IO17 = GPIO17
24+
IO18 = GPIO18
25+
IO19 = GPIO19
26+
IO21 = GPIO21
27+
IO22 = GPIO22
28+
IO23 = GPIO23
29+
IO25 = GPIO25
30+
IO26 = GPIO26
31+
IO27 = GPIO27
32+
IO32 = GPIO32
33+
IO33 = GPIO33
34+
IO34 = GPIO34
35+
IO35 = GPIO35
36+
IO36 = GPIO36
37+
IO37 = GPIO37
38+
IO38 = GPIO38
39+
IO39 = GPIO39
40+
)
41+
42+
const (
43+
POWER_PIN = IO2
44+
EXT_POWER_PIN = IO5
45+
EPD_POWER_PIN = IO23
46+
47+
// Buttons
48+
BUTTON_RIGHT = IO39
49+
BUTTON_PUSH = IO38
50+
BUTTON_LEFT = IO37
51+
BUTTON = BUTTON_PUSH
52+
53+
// Touch Screen Interrupt
54+
TOUCH_INT = IO36
55+
)
56+
57+
// SPI pins
58+
const (
59+
SPI0_SCK_PIN = IO14
60+
SPI0_SDO_PIN = IO12
61+
SPI0_SDI_PIN = IO13
62+
63+
// EPD (IT8951)
64+
EPD_SCK_PIN = SPI0_SCK_PIN
65+
EPD_SDO_PIN = SPI0_SDO_PIN
66+
EPD_SDI_PIN = SPI0_SDI_PIN
67+
EPD_CS_PIN = IO15
68+
EPD_BUSY_PIN = IO27
69+
70+
// SD CARD
71+
SDCARD_SCK_PIN = SPI0_SCK_PIN
72+
SDCARD_SDO_PIN = SPI0_SDO_PIN
73+
SDCARD_SDI_PIN = SPI0_SDI_PIN
74+
SDCARD_CS_PIN = IO4
75+
)
76+
77+
// I2C pins
78+
const (
79+
SDA0_PIN = IO21
80+
SCL0_PIN = IO22
81+
82+
SDA_PIN = SDA0_PIN
83+
SCL_PIN = SCL0_PIN
84+
85+
I2C_TEMP_ADDR = 0x44 // temperature sensor (SHT30)
86+
I2C_CLOCK_ADDR = 0x51 // real time clock (BM8563)
87+
I2C_TOUCH_ADDR = 0x5D // touch screen controller (GT911)
88+
)
89+
90+
// ADC pins
91+
const (
92+
ADC1 Pin = IO35
93+
ADC2 Pin = IO36
94+
95+
BATTERY_ADC_PIN = ADC1
96+
)
97+
98+
// DAC pins
99+
const (
100+
DAC1 Pin = IO25
101+
DAC2 Pin = IO26
102+
)
103+
104+
// UART pins
105+
const (
106+
// UART0 (CP2104)
107+
UART0_TX_PIN = IO1
108+
UART0_RX_PIN = IO3
109+
110+
UART_TX_PIN = UART0_TX_PIN
111+
UART_RX_PIN = UART0_RX_PIN
112+
)

targets/m5paper.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"inherits": ["esp32"],
3+
"build-tags": ["m5paper"],
4+
"serial-port": ["1a86:55d4"]
5+
}

0 commit comments

Comments
 (0)