aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJohann Freymuth <[email protected]>2024-05-08 13:23:45 +0200
committerRon Evans <[email protected]>2024-05-12 16:09:27 +0200
commit1d9f26cee1f1501b09647186a25ba29aa6a0c58c (patch)
treea9d24d84fd4a05a28ba33c0d8d0efc71039d894d
parent6e58c44390303261af4a721df522affbc99c88ad (diff)
downloadtinygo-1d9f26cee1f1501b09647186a25ba29aa6a0c58c.tar.gz
tinygo-1d9f26cee1f1501b09647186a25ba29aa6a0c58c.zip
targets: add support for m5paper
-rw-r--r--GNUmakefile2
-rw-r--r--src/machine/board_m5paper.go112
-rw-r--r--targets/m5paper.json5
3 files changed, 119 insertions, 0 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 5496cbb0c..cbc18c146 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -766,6 +766,8 @@ ifneq ($(XTENSA), 0)
@$(MD5SUM) test.bin
$(TINYGO) build -size short -o test.bin -target m5stick-c examples/serial
@$(MD5SUM) test.bin
+ $(TINYGO) build -size short -o test.bin -target m5paper examples/serial
+ @$(MD5SUM) test.bin
$(TINYGO) build -size short -o test.bin -target mch2022 examples/serial
@$(MD5SUM) test.bin
endif
diff --git a/src/machine/board_m5paper.go b/src/machine/board_m5paper.go
new file mode 100644
index 000000000..7c20f4dba
--- /dev/null
+++ b/src/machine/board_m5paper.go
@@ -0,0 +1,112 @@
+//go:build m5paper
+
+package machine
+
+const (
+ IO0 = GPIO0
+ IO1 = GPIO1
+ IO2 = GPIO2
+ IO3 = GPIO3
+ IO4 = GPIO4
+ IO5 = GPIO5
+ IO6 = GPIO6
+ IO7 = GPIO7
+ IO8 = GPIO8
+ IO9 = GPIO9
+ IO10 = GPIO10
+ IO11 = GPIO11
+ IO12 = GPIO12
+ IO13 = GPIO13
+ IO14 = GPIO14
+ IO15 = GPIO15
+ IO16 = GPIO16
+ IO17 = GPIO17
+ IO18 = GPIO18
+ IO19 = GPIO19
+ IO21 = GPIO21
+ IO22 = GPIO22
+ IO23 = GPIO23
+ IO25 = GPIO25
+ IO26 = GPIO26
+ IO27 = GPIO27
+ IO32 = GPIO32
+ IO33 = GPIO33
+ IO34 = GPIO34
+ IO35 = GPIO35
+ IO36 = GPIO36
+ IO37 = GPIO37
+ IO38 = GPIO38
+ IO39 = GPIO39
+)
+
+const (
+ POWER_PIN = IO2
+ EXT_POWER_PIN = IO5
+ EPD_POWER_PIN = IO23
+
+ // Buttons
+ BUTTON_RIGHT = IO39
+ BUTTON_PUSH = IO38
+ BUTTON_LEFT = IO37
+ BUTTON = BUTTON_PUSH
+
+ // Touch Screen Interrupt
+ TOUCH_INT = IO36
+)
+
+// SPI pins
+const (
+ SPI0_SCK_PIN = IO14
+ SPI0_SDO_PIN = IO12
+ SPI0_SDI_PIN = IO13
+
+ // EPD (IT8951)
+ EPD_SCK_PIN = SPI0_SCK_PIN
+ EPD_SDO_PIN = SPI0_SDO_PIN
+ EPD_SDI_PIN = SPI0_SDI_PIN
+ EPD_CS_PIN = IO15
+ EPD_BUSY_PIN = IO27
+
+ // SD CARD
+ SDCARD_SCK_PIN = SPI0_SCK_PIN
+ SDCARD_SDO_PIN = SPI0_SDO_PIN
+ SDCARD_SDI_PIN = SPI0_SDI_PIN
+ SDCARD_CS_PIN = IO4
+)
+
+// I2C pins
+const (
+ SDA0_PIN = IO21
+ SCL0_PIN = IO22
+
+ SDA_PIN = SDA0_PIN
+ SCL_PIN = SCL0_PIN
+
+ I2C_TEMP_ADDR = 0x44 // temperature sensor (SHT30)
+ I2C_CLOCK_ADDR = 0x51 // real time clock (BM8563)
+ I2C_TOUCH_ADDR = 0x5D // touch screen controller (GT911)
+)
+
+// ADC pins
+const (
+ ADC1 Pin = IO35
+ ADC2 Pin = IO36
+
+ BATTERY_ADC_PIN = ADC1
+)
+
+// DAC pins
+const (
+ DAC1 Pin = IO25
+ DAC2 Pin = IO26
+)
+
+// UART pins
+const (
+ // UART0 (CP2104)
+ UART0_TX_PIN = IO1
+ UART0_RX_PIN = IO3
+
+ UART_TX_PIN = UART0_TX_PIN
+ UART_RX_PIN = UART0_RX_PIN
+)
diff --git a/targets/m5paper.json b/targets/m5paper.json
new file mode 100644
index 000000000..9ee5d43b4
--- /dev/null
+++ b/targets/m5paper.json
@@ -0,0 +1,5 @@
+{
+ "inherits": ["esp32"],
+ "build-tags": ["m5paper"],
+ "serial-port": ["1a86:55d4"]
+}