aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorThomas Richner <[email protected]>2023-01-02 21:07:13 +0100
committerRon Evans <[email protected]>2023-01-11 10:07:11 +0100
commit05ec4e6bd0ec66caf9e54fc60172a41ba4fd55e0 (patch)
treef99e98dbf8bfdab35b682f0c3c93ef8b2ff553b5
parentae65b377621dc6f37beeff36393a959126a5c927 (diff)
downloadtinygo-05ec4e6bd0ec66caf9e54fc60172a41ba4fd55e0.tar.gz
tinygo-05ec4e6bd0ec66caf9e54fc60172a41ba4fd55e0.zip
Support for Adafruit Feather M0 Express board
-rw-r--r--src/machine/board_feather-m0-express.go101
-rw-r--r--targets/feather-m0-express.json10
2 files changed, 111 insertions, 0 deletions
diff --git a/src/machine/board_feather-m0-express.go b/src/machine/board_feather-m0-express.go
new file mode 100644
index 000000000..a0f7c2305
--- /dev/null
+++ b/src/machine/board_feather-m0-express.go
@@ -0,0 +1,101 @@
+//go:build sam && atsamd21 && feather_m0_express
+
+package machine
+
+// used to reset into bootloader
+const resetMagicValue = 0xf01669ef
+
+// GPIO Pins
+const (
+ D0 = PA11 // UART0 RX
+ D1 = PA10 // UART0 TX
+ D2 = NoPin // does not seem to exist
+ D3 = NoPin // does not seem to exist
+ D4 = NoPin // does not seem to exist
+ D5 = PA15
+ D6 = PA20
+ D7 = NoPin // does not seem to exist
+ D8 = PA06 // NEOPIXEL
+ D9 = PA07
+ D10 = PA18
+ D11 = PA16
+ D12 = PA19
+ D13 = PA17
+)
+
+// Analog pins
+const (
+ A0 = PA02 // ADC/AIN[0]
+ A1 = PB08 // ADC/AIN[2]
+ A2 = PB09 // ADC/AIN[3]
+ A3 = PA04 // ADC/AIN[4]
+ A4 = PA05 // ADC/AIN[5]
+ A5 = PB02 // ADC/AIN[10]
+)
+
+const (
+ LED = D13
+ NEOPIXEL = D8
+)
+
+// USBCDC pins
+const (
+ USBCDC_DM_PIN = PA24
+ USBCDC_DP_PIN = PA25
+)
+
+// UART1 pins
+const (
+ UART_TX_PIN = D1
+ UART_RX_PIN = D0
+
+ UART1_TX_PIN = D10
+ UART1_RX_PIN = D12
+)
+
+// UART0 on the Feather M0 Express.
+var UART0 = &sercomUSART0
+var UART1 = &sercomUSART1
+
+// I2C pins
+const (
+ SDA_PIN = PA22 // SDA: SERCOM3/PAD[0]
+ SCL_PIN = PA23 // SCL: SERCOM3/PAD[1]
+)
+
+// I2C on the Feather M0 Express.
+var (
+ I2C0 = sercomI2CM3
+)
+
+// SPI pins
+const (
+ SPI0_SCK_PIN = PB11 // SCK: SERCOM4/PAD[3]
+ SPI0_SDO_PIN = PB10 // SDO: SERCOM4/PAD[2]
+ SPI0_SDI_PIN = PA12 // SDI: SERCOM4/PAD[0]
+)
+
+// SPI on the Feather M0.
+var SPI0 = sercomSPIM4
+
+// I2S pins
+const (
+ I2S_SCK_PIN = PA10
+ I2S_SD_PIN = PA07
+ I2S_WS_PIN = NoPin // TODO: figure out what this is on Feather M0 Express.
+)
+
+// USB CDC identifiers
+const (
+ usb_STRING_PRODUCT = "Adafruit Feather M0 Express"
+ usb_STRING_MANUFACTURER = "Adafruit"
+)
+
+var (
+ usb_VID uint16 = 0x239A
+ usb_PID uint16 = 0x801B
+)
+
+var (
+ DefaultUART = UART0
+)
diff --git a/targets/feather-m0-express.json b/targets/feather-m0-express.json
new file mode 100644
index 000000000..edfd97925
--- /dev/null
+++ b/targets/feather-m0-express.json
@@ -0,0 +1,10 @@
+{
+ "inherits": ["atsamd21g18a"],
+ "build-tags": ["feather_m0_express"],
+ "serial": "usb",
+ "serial-port": ["239a:801b"],
+ "flash-1200-bps-reset": "true",
+ "flash-method": "msd",
+ "msd-volume-name": "FEATHERBOOT",
+ "msd-firmware-name": "firmware.uf2"
+}