From 4cd151faf537a0b23c0a1d9e9bcb73570b20dd07 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sun, 19 May 2019 16:10:17 +0100 Subject: [PATCH] Add Feather M0 Board (#356) * Add Feather M0 Board --- .circleci/config.yml | 1 + src/machine/board_feather-m0.go | 75 +++++++++++++++++++++++++++++++++ targets/feather-m0.json | 5 +++ 3 files changed, 81 insertions(+) create mode 100644 src/machine/board_feather-m0.go create mode 100644 targets/feather-m0.json diff --git a/.circleci/config.yml b/.circleci/config.yml index 68a43a5e..6bfb4fd4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -79,6 +79,7 @@ commands: - run: tinygo build -size short -o test.elf -target=pca10056 examples/blinky1 - run: tinygo build -size short -o test.elf -target=pca10056 examples/blinky2 - run: tinygo build -size short -o test.elf -target=itsybitsy-m0 examples/blinky1 + - run: tinygo build -size short -o test.elf -target=feather-m0 examples/blinky1 - run: tinygo build -size short -o test.elf -target=trinket-m0 examples/blinky1 - run: tinygo build -size short -o test.elf -target=circuitplay-express examples/blinky1 - run: tinygo build -size short -o test.elf -target=stm32f4disco examples/blinky1 diff --git a/src/machine/board_feather-m0.go b/src/machine/board_feather-m0.go new file mode 100644 index 00000000..3393d86f --- /dev/null +++ b/src/machine/board_feather-m0.go @@ -0,0 +1,75 @@ +// +build sam,atsamd21,itsybitsy_m0 + +package machine + +import "device/sam" + +// GPIO Pins +const ( + D0 = PA11 // UART0 RX + D1 = PA10 // UART0 TX + D2 = 0xff // does not seem to exist + D3 = PA09 + D4 = PA08 + D5 = PA15 // PWM available + D6 = PA20 // PWM available + D7 = 0xff // does not seem to exist + D8 = PA06 + D9 = PA07 // PWM available + D10 = PA18 // can be used for PWM or UART1 TX + D11 = PA16 // can be used for PWM or UART1 RX + D12 = PA19 // PWM available + D13 = PA17 // PWM available +) + +// 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 +) + +// UART0 aka USBCDC pins +const ( + USBCDC_DM_PIN = PA24 + USBCDC_DP_PIN = PA25 +) + +// UART1 pins +const ( + UART_TX_PIN = D10 + UART_RX_PIN = D11 +) + +// I2C pins +const ( + SDA_PIN = PA22 // SDA: SERCOM3/PAD[0] + SCL_PIN = PA23 // SCL: SERCOM3/PAD[1] +) + +// I2C on the Feather M0. +var ( + I2C0 = I2C{Bus: sam.SERCOM3_I2CM, + SDA: SDA_PIN, + SCL: SCL_PIN, + PinMode: GPIO_SERCOM} +) + +// SPI pins +const ( + SPI0_SCK_PIN = PB11 // SCK: SERCOM4/PAD[3] + SPI0_MOSI_PIN = PB10 // MOSI: SERCOM4/PAD[2] + SPI0_MISO_PIN = PA12 // MISO: SERCOM4/PAD[0] +) + +// SPI on the Feather M0. +var ( + SPI0 = SPI{Bus: sam.SERCOM4_SPI} +) diff --git a/targets/feather-m0.json b/targets/feather-m0.json new file mode 100644 index 00000000..3a907b13 --- /dev/null +++ b/targets/feather-m0.json @@ -0,0 +1,5 @@ +{ + "inherits": ["atsamd21g18a"], + "build-tags": ["sam", "atsamd21g18a", "feather_m0"], + "flash": "bossac -d -i -e -w -v -R --offset=0x2000 {hex}" +}