From 38b9c55ae6799070c157c712759dbc5340200b55 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Sat, 16 Oct 2021 01:36:20 +0200 Subject: [PATCH] sam: move I2S0 to machine file There is no need to put these in the board files as the I2S is the same on all Microchip SAM D21 chips. This simplifies the code and avoids some special *_baremetal.go files. This change does not change the resulting binaries. --- src/machine/board_arduino_mkrwifi1010.go | 9 --------- src/machine/board_arduino_nano33_baremetal.go | 12 ------------ src/machine/board_circuitplay_express_baremetal.go | 12 ------------ src/machine/board_itsybitsy-m0.go | 9 --------- src/machine/board_xiao.go | 9 --------- src/machine/machine_atsamd21.go | 2 ++ 6 files changed, 2 insertions(+), 51 deletions(-) delete mode 100644 src/machine/board_arduino_nano33_baremetal.go delete mode 100644 src/machine/board_circuitplay_express_baremetal.go diff --git a/src/machine/board_arduino_mkrwifi1010.go b/src/machine/board_arduino_mkrwifi1010.go index 5f80df61b..8703e1353 100644 --- a/src/machine/board_arduino_mkrwifi1010.go +++ b/src/machine/board_arduino_mkrwifi1010.go @@ -6,10 +6,6 @@ // package machine -import ( - "device/sam" -) - // used to reset into bootloader const RESET_MAGIC_VALUE = 0x07738135 @@ -112,11 +108,6 @@ var ( NINA_SPI = SPI1 ) -// I2S on the Arduino MKR WiFi 1010. -var ( - I2S0 = I2S{Bus: sam.I2S} -) - // USB CDC identifiers const ( usb_STRING_PRODUCT = "Arduino MKR WiFi 1010" diff --git a/src/machine/board_arduino_nano33_baremetal.go b/src/machine/board_arduino_nano33_baremetal.go deleted file mode 100644 index bfd9b8cf9..000000000 --- a/src/machine/board_arduino_nano33_baremetal.go +++ /dev/null @@ -1,12 +0,0 @@ -// +build sam,atsamd21,arduino_nano33 - -package machine - -import ( - "device/sam" -) - -// I2S on the Arduino Nano 33. -var ( - I2S0 = I2S{Bus: sam.I2S} -) diff --git a/src/machine/board_circuitplay_express_baremetal.go b/src/machine/board_circuitplay_express_baremetal.go deleted file mode 100644 index cbe3e95fa..000000000 --- a/src/machine/board_circuitplay_express_baremetal.go +++ /dev/null @@ -1,12 +0,0 @@ -// +build sam,atsamd21,circuitplay_express - -package machine - -import ( - "device/sam" -) - -// I2S on the Circuit Playground Express. -var ( - I2S0 = I2S{Bus: sam.I2S} -) diff --git a/src/machine/board_itsybitsy-m0.go b/src/machine/board_itsybitsy-m0.go index 7e3c0431d..30bf8f2b0 100644 --- a/src/machine/board_itsybitsy-m0.go +++ b/src/machine/board_itsybitsy-m0.go @@ -2,10 +2,6 @@ package machine -import ( - "device/sam" -) - // used to reset into bootloader const RESET_MAGIC_VALUE = 0xf01669ef @@ -97,11 +93,6 @@ const ( I2S_WS_PIN = NoPin // TODO: figure out what this is on ItsyBitsy M0. ) -// I2S on the ItsyBitsy M0. -var ( - I2S0 = I2S{Bus: sam.I2S} -) - // USB CDC identifiers const ( usb_STRING_PRODUCT = "Adafruit ItsyBitsy M0 Express" diff --git a/src/machine/board_xiao.go b/src/machine/board_xiao.go index b19678ed3..108346ada 100644 --- a/src/machine/board_xiao.go +++ b/src/machine/board_xiao.go @@ -2,10 +2,6 @@ package machine -import ( - "device/sam" -) - // used to reset into bootloader const RESET_MAGIC_VALUE = 0xf01669ef @@ -90,11 +86,6 @@ const ( I2S_WS_PIN = NoPin // TODO: figure out what this is on Xiao ) -// I2S on the Xiao -var ( - I2S0 = I2S{Bus: sam.I2S} -) - // USB CDC identifiers const ( usb_STRING_PRODUCT = "Seeed XIAO M0" diff --git a/src/machine/machine_atsamd21.go b/src/machine/machine_atsamd21.go index ac02740d4..5bcf72556 100644 --- a/src/machine/machine_atsamd21.go +++ b/src/machine/machine_atsamd21.go @@ -897,6 +897,8 @@ type I2S struct { Bus *sam.I2S_Type } +var I2S0 = I2S{Bus: sam.I2S} + // Configure is used to configure the I2S interface. You must call this // before you can use the I2S bus. func (i2s I2S) Configure(config I2SConfig) {