summaryrefslogtreecommitdiff
path: root/ports
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2019-04-16 10:32:38 -0700
committerGitHub <noreply@github.com>2019-04-16 10:32:38 -0700
commitf58446e937ede4735a7ecb0852f2d2739f147cdd (patch)
tree72185232547d424dfe0b61fb7f98ce11378d1e6d /ports
parent2d303213ed4ee058c0fc4c541dd7a7181f59d50f (diff)
parent7822d013cd6d379c777f95c73a803b749d1bebe4 (diff)
Merge branch 'master' into master
Diffstat (limited to 'ports')
-rw-r--r--ports/atmel-samd/Makefile1
-rw-r--r--ports/atmel-samd/background.c15
-rw-r--r--ports/atmel-samd/background.h1
-rw-r--r--ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.h4
-rw-r--r--ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.mk2
-rw-r--r--ports/atmel-samd/boards/arduino_mkr1300/pins.c2
-rw-r--r--ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.h4
-rw-r--r--ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.mk2
-rw-r--r--ports/atmel-samd/boards/arduino_mkrzero/pins.c2
-rw-r--r--ports/atmel-samd/boards/arduino_zero/mpconfigboard.h4
-rw-r--r--ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk2
-rw-r--r--ports/atmel-samd/boards/arduino_zero/pins.c2
-rw-r--r--ports/atmel-samd/boards/bast_pro_mini_m0/board.c38
-rw-r--r--ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.h53
-rw-r--r--ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.mk12
-rw-r--r--ports/atmel-samd/boards/bast_pro_mini_m0/pins.c36
-rw-r--r--ports/atmel-samd/boards/catwan_usbstick/mpconfigboard.h4
-rw-r--r--ports/atmel-samd/boards/catwan_usbstick/pins.c2
-rw-r--r--ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk6
-rw-r--r--ports/atmel-samd/boards/circuitplayground_express/pins.c2
-rw-r--r--ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk5
-rw-r--r--ports/atmel-samd/boards/circuitplayground_express_crickit/pins.c2
-rw-r--r--ports/atmel-samd/boards/cp32-m4/mpconfigboard.h12
-rw-r--r--ports/atmel-samd/boards/cp32-m4/mpconfigboard.mk4
-rw-r--r--ports/atmel-samd/boards/cp32-m4/pins.c62
-rw-r--r--ports/atmel-samd/boards/datalore_ip_m4/pins.c2
-rw-r--r--ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.h4
-rw-r--r--ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.mk2
-rw-r--r--ports/atmel-samd/boards/feather_m0_adalogger/pins.c2
-rw-r--r--ports/atmel-samd/boards/feather_m0_basic/mpconfigboard.h4
-rw-r--r--ports/atmel-samd/boards/feather_m0_basic/mpconfigboard.mk2
-rw-r--r--ports/atmel-samd/boards/feather_m0_basic/pins.c2
-rw-r--r--ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk5
-rw-r--r--ports/atmel-samd/boards/feather_m0_express/pins.c2
-rw-r--r--ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.h8
-rw-r--r--ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk1
-rw-r--r--ports/atmel-samd/boards/feather_m0_express_crickit/pins.c2
-rw-r--r--ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.h4
-rw-r--r--ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk2
-rw-r--r--ports/atmel-samd/boards/feather_m0_rfm69/pins.c2
-rw-r--r--ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.h4
-rw-r--r--ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk2
-rw-r--r--ports/atmel-samd/boards/feather_m0_rfm9x/pins.c2
-rw-r--r--ports/atmel-samd/boards/feather_m0_supersized/pins.c2
-rw-r--r--ports/atmel-samd/boards/feather_m4_express/pins.c2
-rwxr-xr-xports/atmel-samd/boards/feather_radiofruit_zigbee/pins.c2
-rw-r--r--ports/atmel-samd/boards/gemma_m0/mpconfigboard.h4
-rw-r--r--ports/atmel-samd/boards/gemma_m0/mpconfigboard.mk2
-rw-r--r--ports/atmel-samd/boards/gemma_m0/pins.c2
-rw-r--r--ports/atmel-samd/boards/grandcentral_m4_express/pins.c2
-rw-r--r--ports/atmel-samd/boards/hallowing_m0_express/board.c10
-rw-r--r--ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk11
-rw-r--r--ports/atmel-samd/boards/hallowing_m0_express/pins.c1
-rw-r--r--ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.h4
-rw-r--r--ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk7
-rw-r--r--ports/atmel-samd/boards/itsybitsy_m0_express/pins.c2
-rw-r--r--ports/atmel-samd/boards/itsybitsy_m4_express/pins.c2
-rw-r--r--ports/atmel-samd/boards/kicksat-sprite/board.c41
-rw-r--r--ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.h30
-rw-r--r--ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk17
-rw-r--r--ports/atmel-samd/boards/kicksat-sprite/pins.c38
-rw-r--r--ports/atmel-samd/boards/meowmeow/mpconfigboard.h4
-rw-r--r--ports/atmel-samd/boards/meowmeow/mpconfigboard.mk2
-rw-r--r--ports/atmel-samd/boards/meowmeow/pins.c2
-rw-r--r--ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk5
-rw-r--r--ports/atmel-samd/boards/metro_m0_express/pins.c2
-rw-r--r--ports/atmel-samd/boards/metro_m4_airlift_lite/board.c39
-rw-r--r--ports/atmel-samd/boards/metro_m4_airlift_lite/mpconfigboard.h43
-rw-r--r--ports/atmel-samd/boards/metro_m4_airlift_lite/mpconfigboard.mk20
-rw-r--r--ports/atmel-samd/boards/metro_m4_airlift_lite/pins.c55
-rw-r--r--ports/atmel-samd/boards/metro_m4_express/pins.c2
-rw-r--r--ports/atmel-samd/boards/mini_sam_m4/pins.c2
-rw-r--r--ports/atmel-samd/boards/pewpew10/mpconfigboard.h4
-rw-r--r--ports/atmel-samd/boards/pewpew10/mpconfigboard.mk7
-rw-r--r--ports/atmel-samd/boards/pewpew10/pins.c2
-rw-r--r--ports/atmel-samd/boards/pirkey_m0/mpconfigboard.h4
-rw-r--r--ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk7
-rw-r--r--ports/atmel-samd/boards/pirkey_m0/pins.c2
-rw-r--r--ports/atmel-samd/boards/pybadge/board.c14
-rw-r--r--ports/atmel-samd/boards/pybadge/mpconfigboard.mk9
-rw-r--r--ports/atmel-samd/boards/pybadge/pins.c42
-rw-r--r--ports/atmel-samd/boards/pyportal/board.c6
-rw-r--r--ports/atmel-samd/boards/pyportal/pins.c1
-rw-r--r--ports/atmel-samd/boards/sam32/pins.c2
-rw-r--r--ports/atmel-samd/boards/samd21x18-bootloader.ld5
-rwxr-xr-xports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.h28
-rwxr-xr-xports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk4
-rwxr-xr-xports/atmel-samd/boards/sparkfun_lumidrive/pins.c10
-rwxr-xr-xports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk5
-rwxr-xr-xports/atmel-samd/boards/sparkfun_redboard_turbo/pins.c2
-rw-r--r--ports/atmel-samd/boards/sparkfun_samd21_dev/mpconfigboard.h4
-rw-r--r--ports/atmel-samd/boards/sparkfun_samd21_dev/mpconfigboard.mk2
-rw-r--r--ports/atmel-samd/boards/sparkfun_samd21_dev/pins.c2
-rw-r--r--ports/atmel-samd/boards/sparkfun_samd21_mini/mpconfigboard.h4
-rw-r--r--ports/atmel-samd/boards/sparkfun_samd21_mini/mpconfigboard.mk2
-rw-r--r--ports/atmel-samd/boards/sparkfun_samd21_mini/pins.c2
-rw-r--r--ports/atmel-samd/boards/trellis_m4_express/pins.c2
-rw-r--r--ports/atmel-samd/boards/trinket_m0/mpconfigboard.h4
-rw-r--r--ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk2
-rw-r--r--ports/atmel-samd/boards/trinket_m0/pins.c2
-rw-r--r--ports/atmel-samd/boards/trinket_m0_haxpress/mpconfigboard.mk2
-rw-r--r--ports/atmel-samd/boards/trinket_m0_haxpress/pins.c2
-rw-r--r--ports/atmel-samd/boards/uchip/mpconfigboard.mk2
-rw-r--r--ports/atmel-samd/boards/uchip/pins.c2
-rw-r--r--ports/atmel-samd/boards/ugame10/board.c73
-rw-r--r--ports/atmel-samd/boards/ugame10/mpconfigboard.h7
-rw-r--r--ports/atmel-samd/boards/ugame10/mpconfigboard.mk11
-rw-r--r--ports/atmel-samd/boards/ugame10/pins.c7
-rw-r--r--ports/atmel-samd/common-hal/busio/SPI.c10
-rw-r--r--ports/atmel-samd/common-hal/digitalio/DigitalInOut.c5
-rw-r--r--ports/atmel-samd/common-hal/pulseio/PulseIn.c5
-rw-r--r--ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c14
-rw-r--r--ports/atmel-samd/eic_handler.c58
-rw-r--r--ports/atmel-samd/eic_handler.h36
-rw-r--r--ports/atmel-samd/mpconfigport.mk6
m---------ports/atmel-samd/peripherals0
-rw-r--r--ports/atmel-samd/supervisor/internal_flash.c3
-rwxr-xr-xports/nrf/Makefile1
-rw-r--r--ports/nrf/README.md1
-rw-r--r--ports/nrf/background.c14
-rw-r--r--ports/nrf/background.h35
-rw-r--r--ports/nrf/boards/electronut_labs_papyr/README.md58
-rw-r--r--ports/nrf/boards/electronut_labs_papyr/board.c38
-rw-r--r--ports/nrf/boards/electronut_labs_papyr/mpconfigboard.h52
-rw-r--r--ports/nrf/boards/electronut_labs_papyr/mpconfigboard.mk22
-rw-r--r--ports/nrf/boards/electronut_labs_papyr/pins.c44
-rw-r--r--ports/nrf/boards/feather_nrf52840_express/pins.c2
-rw-r--r--ports/nrf/boards/makerdiary_nrf52840_mdk/pins.c2
-rw-r--r--ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/pins.c2
-rw-r--r--ports/nrf/boards/particle_argon/pins.c2
-rw-r--r--ports/nrf/boards/particle_boron/pins.c2
-rw-r--r--ports/nrf/boards/particle_xenon/pins.c2
-rw-r--r--ports/nrf/boards/pca10056/pins.c2
-rw-r--r--ports/nrf/boards/pca10059/pins.c2
-rw-r--r--ports/nrf/boards/sparkfun_nrf52840_mini/pins.c2
-rw-r--r--ports/nrf/common-hal/bleio/Characteristic.c4
-rw-r--r--ports/nrf/common-hal/busio/SPI.c8
-rw-r--r--ports/nrf/common-hal/rtc/RTC.c90
-rw-r--r--ports/nrf/common-hal/rtc/RTC.h33
-rw-r--r--ports/nrf/common-hal/rtc/__init__.c0
-rw-r--r--ports/nrf/mpconfigport.h1
-rw-r--r--ports/nrf/mpconfigport.mk4
-rw-r--r--ports/nrf/nrfx_config.h5
-rw-r--r--ports/nrf/supervisor/internal_flash.c3
-rw-r--r--ports/nrf/supervisor/port.c11
-rw-r--r--ports/nrf/supervisor/qspi_flash.c3
-rw-r--r--ports/nrf/tick.c14
147 files changed, 1317 insertions, 251 deletions
diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile
index 0851b6bbb..9b110c1bb 100644
--- a/ports/atmel-samd/Makefile
+++ b/ports/atmel-samd/Makefile
@@ -212,6 +212,7 @@ SRC_C = \
bindings/samd/__init__.c \
boards/$(BOARD)/board.c \
boards/$(BOARD)/pins.c \
+ eic_handler.c \
fatfs_port.c \
freetouch/adafruit_ptc.c \
lib/libc/string0.c \
diff --git a/ports/atmel-samd/background.c b/ports/atmel-samd/background.c
index 519d0eeec..4e88d34e7 100644
--- a/ports/atmel-samd/background.c
+++ b/ports/atmel-samd/background.c
@@ -27,6 +27,7 @@
#include "audio_dma.h"
#include "tick.h"
+#include "supervisor/filesystem.h"
#include "supervisor/usb.h"
#include "py/runtime.h"
@@ -41,8 +42,20 @@ volatile uint64_t last_finished_tick = 0;
bool stack_ok_so_far = true;
+static bool running_background_tasks = false;
+
+void background_tasks_reset(void) {
+ running_background_tasks = false;
+}
+
void run_background_tasks(void) {
+ // Don't call ourselves recursively.
+ if (running_background_tasks) {
+ return;
+ }
assert_heap_ok();
+ running_background_tasks = true;
+
#if (defined(SAMD21) && defined(PIN_PA02)) || defined(SAMD51)
audio_dma_background();
#endif
@@ -53,7 +66,9 @@ void run_background_tasks(void) {
#if CIRCUITPY_NETWORK
network_module_background();
#endif
+ filesystem_background();
usb_background();
+ running_background_tasks = false;
assert_heap_ok();
last_finished_tick = ticks_ms;
diff --git a/ports/atmel-samd/background.h b/ports/atmel-samd/background.h
index 8d1316e73..d9866a6ab 100644
--- a/ports/atmel-samd/background.h
+++ b/ports/atmel-samd/background.h
@@ -29,6 +29,7 @@
#include <stdbool.h>
+void background_tasks_reset(void);
void run_background_tasks(void);
void run_background_vm_tasks(void);
bool background_tasks_ok(void);
diff --git a/ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.h b/ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.h
index 1deda871a..a508d9191 100644
--- a/ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.h
+++ b/ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.h
@@ -7,9 +7,9 @@
#define MICROPY_HW_LED_STATUS (&pin_PB23)
-#define CIRCUITPY_INTERNAL_NVM_SIZE 0
+#define CIRCUITPY_INTERNAL_NVM_SIZE 256
-#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
+#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#define DEFAULT_I2C_BUS_SCL (&pin_PA09)
#define DEFAULT_I2C_BUS_SDA (&pin_PA08)
diff --git a/ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.mk b/ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.mk
index b1b127ced..bafb8a96c 100644
--- a/ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.mk
@@ -10,5 +10,3 @@ CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
-
-CIRCUITPY_FREQUENCYIO = 0
diff --git a/ports/atmel-samd/boards/arduino_mkr1300/pins.c b/ports/atmel-samd/boards/arduino_mkr1300/pins.c
index a5a058ace..7a73e89bf 100644
--- a/ports/atmel-samd/boards/arduino_mkr1300/pins.c
+++ b/ports/atmel-samd/boards/arduino_mkr1300/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB02) },
diff --git a/ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.h b/ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.h
index d98da4d14..02750e646 100644
--- a/ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.h
+++ b/ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.h
@@ -5,9 +5,9 @@
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
-#define CIRCUITPY_INTERNAL_NVM_SIZE 0
+#define CIRCUITPY_INTERNAL_NVM_SIZE 256
-#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
+#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#define DEFAULT_I2C_BUS_SCL (&pin_PA09)
#define DEFAULT_I2C_BUS_SDA (&pin_PA08)
diff --git a/ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.mk b/ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.mk
index 0e6fb612e..b6df8d6e2 100644
--- a/ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.mk
@@ -10,5 +10,3 @@ CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
-
-CIRCUITPY_FREQUENCYIO = 0
diff --git a/ports/atmel-samd/boards/arduino_mkrzero/pins.c b/ports/atmel-samd/boards/arduino_mkrzero/pins.c
index 654c0d6da..2494076ab 100644
--- a/ports/atmel-samd/boards/arduino_mkrzero/pins.c
+++ b/ports/atmel-samd/boards/arduino_mkrzero/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB02) },
diff --git a/ports/atmel-samd/boards/arduino_zero/mpconfigboard.h b/ports/atmel-samd/boards/arduino_zero/mpconfigboard.h
index 7ab09d447..ec201e6ef 100644
--- a/ports/atmel-samd/boards/arduino_zero/mpconfigboard.h
+++ b/ports/atmel-samd/boards/arduino_zero/mpconfigboard.h
@@ -10,9 +10,9 @@
#define MICROPY_PORT_B (PORT_PB03)
#define MICROPY_PORT_C (0)
-#define CIRCUITPY_INTERNAL_NVM_SIZE 0
+#define CIRCUITPY_INTERNAL_NVM_SIZE 256
-#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
+#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)
#define DEFAULT_I2C_BUS_SDA (&pin_PA22)
diff --git a/ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk b/ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk
index 26f771b50..af953e8c2 100644
--- a/ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk
@@ -10,5 +10,3 @@ CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
-
-CIRCUITPY_FREQUENCYIO = 0
diff --git a/ports/atmel-samd/boards/arduino_zero/pins.c b/ports/atmel-samd/boards/arduino_zero/pins.c
index f9403bb9a..7ebcc9a6e 100644
--- a/ports/atmel-samd/boards/arduino_zero/pins.c
+++ b/ports/atmel-samd/boards/arduino_zero/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
diff --git a/ports/atmel-samd/boards/bast_pro_mini_m0/board.c b/ports/atmel-samd/boards/bast_pro_mini_m0/board.c
new file mode 100644
index 000000000..c8e20206a
--- /dev/null
+++ b/ports/atmel-samd/boards/bast_pro_mini_m0/board.c
@@ -0,0 +1,38 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "boards/board.h"
+
+void board_init(void)
+{
+}
+
+bool board_requests_safe_mode(void) {
+ return false;
+}
+
+void reset_board(void) {
+}
diff --git a/ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.h b/ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.h
new file mode 100644
index 000000000..561240c69
--- /dev/null
+++ b/ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.h
@@ -0,0 +1,53 @@
+#define MICROPY_HW_BOARD_NAME "Electronic Cats Bast Pro Mini M0"
+#define MICROPY_HW_MCU_NAME "samd21e18"
+
+#define MICROPY_PORT_A (0)
+#define MICROPY_PORT_B (0)
+#define MICROPY_PORT_C (0)
+
+#define CIRCUITPY_INTERNAL_NVM_SIZE 0
+
+#define DEFAULT_I2C_BUS_SCL (&pin_PA08)
+#define DEFAULT_I2C_BUS_SDA (&pin_PA09)
+
+#define DEFAULT_SPI_BUS_SCK (&pin_PA17)
+#define DEFAULT_SPI_BUS_MOSI (&pin_PA16)
+#define DEFAULT_SPI_BUS_MISO (&pin_PA19)
+
+#define DEFAULT_UART_BUS_RX (&pin_PA01)
+#define DEFAULT_UART_BUS_TX (&pin_PA00)
+
+#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
+
+#define IGNORE_PIN_PA03 1
+#define IGNORE_PIN_PA12 1
+#define IGNORE_PIN_PA13 1
+#define IGNORE_PIN_PA20 1
+#define IGNORE_PIN_PA21 1
+// USB is always used.
+#define IGNORE_PIN_PA24 1
+#define IGNORE_PIN_PA25 1
+#define IGNORE_PIN_PA30 1
+#define IGNORE_PIN_PA31 1
+#define IGNORE_PIN_PB01 1
+#define IGNORE_PIN_PB02 1
+#define IGNORE_PIN_PB03 1
+#define IGNORE_PIN_PB04 1
+#define IGNORE_PIN_PB05 1
+#define IGNORE_PIN_PB06 1
+#define IGNORE_PIN_PB07 1
+#define IGNORE_PIN_PB08 1
+#define IGNORE_PIN_PB09 1
+#define IGNORE_PIN_PB10 1
+#define IGNORE_PIN_PB11 1
+#define IGNORE_PIN_PB12 1
+#define IGNORE_PIN_PB13 1
+#define IGNORE_PIN_PB14 1
+#define IGNORE_PIN_PB15 1
+#define IGNORE_PIN_PB16 1
+#define IGNORE_PIN_PB17 1
+#define IGNORE_PIN_PB22 1
+#define IGNORE_PIN_PB23 1
+#define IGNORE_PIN_PB30 1
+#define IGNORE_PIN_PB31 1
+#define IGNORE_PIN_PB00 1
diff --git a/ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.mk b/ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.mk
new file mode 100644
index 000000000..38a6afd17
--- /dev/null
+++ b/ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.mk
@@ -0,0 +1,12 @@
+LD_FILE = boards/samd21x18-bootloader.ld
+USB_VID = 0xBAB3
+USB_PID = 0x1209
+USB_PRODUCT = "Bast Pro Mini M0"
+USB_MANUFACTURER = "Electronic Cats"
+
+INTERNAL_FLASH_FILESYSTEM = 1
+LONGINT_IMPL = NONE
+CIRCUITPY_SMALL_BUILD = 1
+
+CHIP_VARIANT = SAMD21E18A
+CHIP_FAMILY = samd21
diff --git a/ports/atmel-samd/boards/bast_pro_mini_m0/pins.c b/ports/atmel-samd/boards/bast_pro_mini_m0/pins.c
new file mode 100644
index 000000000..3ed940e36
--- /dev/null
+++ b/ports/atmel-samd/boards/bast_pro_mini_m0/pins.c
@@ -0,0 +1,36 @@
+#include "shared-bindings/board/__init__.h"
+
+STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
+ { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA04) },
+ { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA05) },
+ { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA10) },
+ { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA08) },
+ { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA09) },
+ { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA00) },
+ { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA01) },
+ { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA01) },
+ { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA00) },
+ { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA14) },
+ { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA23) },
+ { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA22) },
+ { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) },
+ { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA27) },
+ { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA28) },
+ { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) },
+ { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) },
+ { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
+ { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) },
+ { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },
+ { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) },
+ { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA11) },
+ { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA08) },
+ { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA09) },
+ { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA17) },
+ { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA16) },
+ { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA19) },
+ { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
+ { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
+ { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
+};
+MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
diff --git a/ports/atmel-samd/boards/catwan_usbstick/mpconfigboard.h b/ports/atmel-samd/boards/catwan_usbstick/mpconfigboard.h
index 341dcc27e..7a32bf023 100644
--- a/ports/atmel-samd/boards/catwan_usbstick/mpconfigboard.h
+++ b/ports/atmel-samd/boards/catwan_usbstick/mpconfigboard.h
@@ -7,13 +7,13 @@
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
-#define CIRCUITPY_INTERNAL_NVM_SIZE 0
+#define CIRCUITPY_INTERNAL_NVM_SIZE 256
#define DEFAULT_SPI_BUS_SCK (&pin_PA19)
#define DEFAULT_SPI_BUS_MOSI (&pin_PA18)
#define DEFAULT_SPI_BUS_MISO (&pin_PA22)
-#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
+#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#define IGNORE_PIN_PA00 1
#define IGNORE_PIN_PA01 1
diff --git a/ports/atmel-samd/boards/catwan_usbstick/pins.c b/ports/atmel-samd/boards/catwan_usbstick/pins.c
index 87ee84c0b..346bd9c10 100644
--- a/ports/atmel-samd/boards/catwan_usbstick/pins.c
+++ b/ports/atmel-samd/boards/catwan_usbstick/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA30) },
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA31) },
diff --git a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk
index 868ca9443..652d20137 100644
--- a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk
@@ -25,5 +25,9 @@ FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Thermistor
-#Adding per @danh to reduce memory usage and get the latest changes in
+# Tweak inlining depending on language.
+ifeq ($(TRANSLATION), zh_Latn_pinyin)
+CFLAGS_INLINE_LIMIT = 35
+else
CFLAGS_INLINE_LIMIT = 55
+endif
diff --git a/ports/atmel-samd/boards/circuitplayground_express/pins.c b/ports/atmel-samd/boards/circuitplayground_express/pins.c
index 70743366e..6fc46bd21 100644
--- a/ports/atmel-samd/boards/circuitplayground_express/pins.c
+++ b/ports/atmel-samd/boards/circuitplayground_express/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA02) },
diff --git a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk
index 1dbd1a739..bdcb4d350 100644
--- a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk
@@ -18,7 +18,12 @@ CIRCUITPY_I2CSLAVE = 0
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
+# Tweak inlining depending on language.
+ifeq ($(TRANSLATION), zh_Latn_pinyin)
+CFLAGS_INLINE_LIMIT = 35
+else
CFLAGS_INLINE_LIMIT = 55
+endif
# Include these Python libraries in firmware.
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice
diff --git a/ports/atmel-samd/boards/circuitplayground_express_crickit/pins.c b/ports/atmel-samd/boards/circuitplayground_express_crickit/pins.c
index 70743366e..6fc46bd21 100644
--- a/ports/atmel-samd/boards/circuitplayground_express_crickit/pins.c
+++ b/ports/atmel-samd/boards/circuitplayground_express_crickit/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA02) },
diff --git a/ports/atmel-samd/boards/cp32-m4/mpconfigboard.h b/ports/atmel-samd/boards/cp32-m4/mpconfigboard.h
index 5587d165a..9e329b3ed 100644
--- a/ports/atmel-samd/boards/cp32-m4/mpconfigboard.h
+++ b/ports/atmel-samd/boards/cp32-m4/mpconfigboard.h
@@ -1,13 +1,13 @@
#define MICROPY_HW_BOARD_NAME "CP32-M4"
-#define MICROPY_HW_MCU_NAME "samd51g19"
+#define MICROPY_HW_MCU_NAME "samd51j20"
-#define MICROPY_HW_APA102_MOSI (&pin_PA17)
-#define MICROPY_HW_APA102_SCK (&pin_PA16)
+#define MICROPY_HW_APA102_MOSI (&pin_PA12)
+#define MICROPY_HW_APA102_SCK (&pin_PA13)
#define CIRCUITPY_MCU_FAMILY samd51
-#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11| PORT_PA16| PORT_PA17)
+#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11| PORT_PA12| PORT_PA13)
#define MICROPY_PORT_B ( PORT_PB10 | PORT_PB11)
#define MICROPY_PORT_C (0)
#define MICROPY_PORT_D (0)
@@ -27,5 +27,5 @@
#define DEFAULT_SPI_BUS_MOSI (&pin_PA23)
#define DEFAULT_SPI_BUS_MISO (&pin_PA21)
-#define DEFAULT_UART_BUS_RX (&pin_PA12)
-#define DEFAULT_UART_BUS_TX (&pin_PA13)
+#define DEFAULT_UART_BUS_RX (&pin_PB17)
+#define DEFAULT_UART_BUS_TX (&pin_PB16)
diff --git a/ports/atmel-samd/boards/cp32-m4/mpconfigboard.mk b/ports/atmel-samd/boards/cp32-m4/mpconfigboard.mk
index 0fba81ac0..0444a37b9 100644
--- a/ports/atmel-samd/boards/cp32-m4/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/cp32-m4/mpconfigboard.mk
@@ -1,4 +1,4 @@
-LD_FILE = boards/samd51x19-bootloader-external-flash.ld
+LD_FILE = boards/samd51x20-bootloader-external-flash.ld
USB_VID = 0x239A
USB_PID = 0x8021
USB_PRODUCT = "CP32-M4"
@@ -13,5 +13,5 @@ CIRCUITPY_AUDIOBUSIO = 0
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0
-CHIP_VARIANT = SAMD51G19A
+CHIP_VARIANT = SAMD51J20A
CHIP_FAMILY = samd51
diff --git a/ports/atmel-samd/boards/cp32-m4/pins.c b/ports/atmel-samd/boards/cp32-m4/pins.c
index 9da67dfb4..1946c9d3a 100644
--- a/ports/atmel-samd/boards/cp32-m4/pins.c
+++ b/ports/atmel-samd/boards/cp32-m4/pins.c
@@ -1,38 +1,48 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
// This mapping only includes functional names because pins broken
// out on connectors are labeled with their MCU name available from
// microcontroller.pin.
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_SPEAKER_P), MP_ROM_PTR(&pin_PA02) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PB08) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_SW3_4), MP_ROM_PTR(&pin_PB09) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_SW1_2), MP_ROM_PTR(&pin_PA04) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_SPEAKER_N), MP_ROM_PTR(&pin_PA05) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PA04) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_STATUS_LED), MP_ROM_PTR(&pin_PA15) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_BACKLIGHT_PWM), MP_ROM_PTR(&pin_PB09) },
+
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SW1_2), MP_ROM_PTR(&pin_PA06) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SW3_4), MP_ROM_PTR(&pin_PB08) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SW5), MP_ROM_PTR(&pin_PB12) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SW7), MP_ROM_PTR(&pin_PB06) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SW8), MP_ROM_PTR(&pin_PB03) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SW9), MP_ROM_PTR(&pin_PB05) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SW10), MP_ROM_PTR(&pin_PB04) },
+
+ { MP_OBJ_NEW_QSTR(MP_QSTR_EXT_HDR3), MP_ROM_PTR(&pin_PB07) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_EXT_HDR4), MP_ROM_PTR(&pin_PA20) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_EXT_HDR5), MP_ROM_PTR(&pin_PA22) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_EXT_SW6), MP_ROM_PTR(&pin_PA21) },
+
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SD0), MP_ROM_PTR(&pin_PA16) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SD1), MP_ROM_PTR(&pin_PA18) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SD2), MP_ROM_PTR(&pin_PB13) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SD3), MP_ROM_PTR(&pin_PB14) },
+
+ { MP_OBJ_NEW_QSTR(MP_QSTR_CMD), MP_ROM_PTR(&pin_PB15) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_CLK), MP_ROM_PTR(&pin_PA14) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB16) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB17) },
+
+ { MP_OBJ_NEW_QSTR(MP_QSTR_VSPI_SCK), MP_ROM_PTR(&pin_PA17) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_VSPI_MOSI), MP_ROM_PTR(&pin_PB23) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_VSPI_MISO), MP_ROM_PTR(&pin_PB22) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_VSPI_CS0), MP_ROM_PTR(&pin_PA19) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_VSPI_CS1), MP_ROM_PTR(&pin_PA27) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_PA23) },
+
+ { MP_OBJ_NEW_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_PA17) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_PA12) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_SW9), MP_ROM_PTR(&pin_PA06) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_SW7), MP_ROM_PTR(&pin_PA07) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_BACKLIGHT_PWM), MP_ROM_PTR(&pin_PA12) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_EXT_HDR3), MP_ROM_PTR(&pin_PA13) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_SW5), MP_ROM_PTR(&pin_PA14) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_EXT_HDR4), MP_ROM_PTR(&pin_PA15) },
-
- { MP_OBJ_NEW_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_PA16) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_PA17) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_STATUS_LED), MP_ROM_PTR(&pin_PA18) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_SW6), MP_ROM_PTR(&pin_PA19) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_VSPI_CS0), MP_ROM_PTR(&pin_PA20) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_VSPI_MISO), MP_ROM_PTR(&pin_PA21) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_VSPI_SCK), MP_ROM_PTR(&pin_PA22) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_VSPI_MOSI), MP_ROM_PTR(&pin_PA23) },
-
- { MP_OBJ_NEW_QSTR(MP_QSTR_VSPI_CS1), MP_ROM_PTR(&pin_PB22) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_EXT_HDR5), MP_ROM_PTR(&pin_PB23) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_PA27) },
- { MP_ROM_QSTR(MP_QSTR_SW8), MP_ROM_PTR(&pin_PB02) },
- { MP_ROM_QSTR(MP_QSTR_SW10), MP_ROM_PTR(&pin_PB03) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
diff --git a/ports/atmel-samd/boards/datalore_ip_m4/pins.c b/ports/atmel-samd/boards/datalore_ip_m4/pins.c
index 63ae319a2..4eb26dd21 100644
--- a/ports/atmel-samd/boards/datalore_ip_m4/pins.c
+++ b/ports/atmel-samd/boards/datalore_ip_m4/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
// This mapping only includes functional names because pins broken
// out on connectors are labeled with their MCU name available from
// microcontroller.pin.
diff --git a/ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.h b/ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.h
index 787a3ee55..eb1b90585 100644
--- a/ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.h
+++ b/ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.h
@@ -8,9 +8,9 @@
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
-#define CIRCUITPY_INTERNAL_NVM_SIZE 0
+#define CIRCUITPY_INTERNAL_NVM_SIZE 256
-#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
+#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#define DEFAULT_I2C_BUS_SCL (&pin_PA22)
#define DEFAULT_I2C_BUS_SDA (&pin_PA23)
diff --git a/ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.mk
index 0b9995583..26e3b7d4d 100644
--- a/ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.mk
@@ -10,5 +10,3 @@ CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
-
-CIRCUITPY_FREQUENCYIO = 0
diff --git a/ports/atmel-samd/boards/feather_m0_adalogger/pins.c b/ports/atmel-samd/boards/feather_m0_adalogger/pins.c
index d99e62c95..63d134952 100644
--- a/ports/atmel-samd/boards/feather_m0_adalogger/pins.c
+++ b/ports/atmel-samd/boards/feather_m0_adalogger/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
diff --git a/ports/atmel-samd/boards/feather_m0_basic/mpconfigboard.h b/ports/atmel-samd/boards/feather_m0_basic/mpconfigboard.h
index 2a21b8f02..a16cee0b4 100644
--- a/ports/atmel-samd/boards/feather_m0_basic/mpconfigboard.h
+++ b/ports/atmel-samd/boards/feather_m0_basic/mpconfigboard.h
@@ -8,9 +8,9 @@
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
-#define CIRCUITPY_INTERNAL_NVM_SIZE 0
+#define CIRCUITPY_INTERNAL_NVM_SIZE 256
-#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
+#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)
#define DEFAULT_I2C_BUS_SDA (&pin_PA22)
diff --git a/ports/atmel-samd/boards/feather_m0_basic/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_basic/mpconfigboard.mk
index a469dcf1d..102cb656f 100644
--- a/ports/atmel-samd/boards/feather_m0_basic/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/feather_m0_basic/mpconfigboard.mk
@@ -10,5 +10,3 @@ CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
-
-CIRCUITPY_FREQUENCYIO = 0
diff --git a/ports/atmel-samd/boards/feather_m0_basic/pins.c b/ports/atmel-samd/boards/feather_m0_basic/pins.c
index f9b6db63b..f15ec2e9d 100644
--- a/ports/atmel-samd/boards/feather_m0_basic/pins.c
+++ b/ports/atmel-samd/boards/feather_m0_basic/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
diff --git a/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk
index 03a89f5f5..a6190267d 100644
--- a/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk
@@ -12,4 +12,7 @@ LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
-CIRCUITPY_FREQUENCYIO = 0
+# Tweak inlining depending on language.
+ifeq ($(TRANSLATION), zh_Latn_pinyin)
+CFLAGS_INLINE_LIMIT = 60
+endif
diff --git a/ports/atmel-samd/boards/feather_m0_express/pins.c b/ports/atmel-samd/boards/feather_m0_express/pins.c
index 1eaa98a58..3c4effbe3 100644
--- a/ports/atmel-samd/boards/feather_m0_express/pins.c
+++ b/ports/atmel-samd/boards/feather_m0_express/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
diff --git a/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.h b/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.h
index abbf0b08c..77146889e 100644
--- a/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.h
+++ b/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.h
@@ -32,3 +32,11 @@
#define DEFAULT_UART_BUS_RX (&pin_PA11)
#define DEFAULT_UART_BUS_TX (&pin_PA10)
+
+// USB is always used internally so skip the pin objects for it.
+#define IGNORE_PIN_PA24 1
+#define IGNORE_PIN_PA25 1
+
+// Not connected
+#define IGNORE_PIN_PB22 1
+#define IGNORE_PIN_PB23 1
diff --git a/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk
index fa39de33f..2c1d9c717 100644
--- a/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk
@@ -10,6 +10,7 @@ EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C"
LONGINT_IMPL = MPZ
# Make space for frozen libs
+CIRCUITPY_BITBANGIO = 0
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CSLAVE = 0
diff --git a/ports/atmel-samd/boards/feather_m0_express_crickit/pins.c b/ports/atmel-samd/boards/feather_m0_express_crickit/pins.c
index 1eaa98a58..3c4effbe3 100644
--- a/ports/atmel-samd/boards/feather_m0_express_crickit/pins.c
+++ b/ports/atmel-samd/boards/feather_m0_express_crickit/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
diff --git a/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.h b/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.h
index a0f79ed72..19a514758 100644
--- a/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.h
+++ b/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.h
@@ -8,9 +8,9 @@
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
-#define CIRCUITPY_INTERNAL_NVM_SIZE 0
+#define CIRCUITPY_INTERNAL_NVM_SIZE 256
-#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
+#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)
#define DEFAULT_I2C_BUS_SDA (&pin_PA22)
diff --git a/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk
index 16696297d..ce3f8668c 100644
--- a/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk
@@ -10,5 +10,3 @@ CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
-
-CIRCUITPY_FREQUENCYIO = 0
diff --git a/ports/atmel-samd/boards/feather_m0_rfm69/pins.c b/ports/atmel-samd/boards/feather_m0_rfm69/pins.c
index ba59cb69b..178f945ad 100644
--- a/ports/atmel-samd/boards/feather_m0_rfm69/pins.c
+++ b/ports/atmel-samd/boards/feather_m0_rfm69/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
diff --git a/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.h b/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.h
index 85c24bfd0..d3db098e5 100644
--- a/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.h
+++ b/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.h
@@ -8,9 +8,9 @@
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
-#define CIRCUITPY_INTERNAL_NVM_SIZE 0
+#define CIRCUITPY_INTERNAL_NVM_SIZE 256
-#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
+#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)
#define DEFAULT_I2C_BUS_SDA (&pin_PA22)
diff --git a/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk
index 39fdc591d..282977338 100644
--- a/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk
@@ -10,5 +10,3 @@ CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
-
-CIRCUITPY_FREQUENCYIO = 0
diff --git a/ports/atmel-samd/boards/feather_m0_rfm9x/pins.c b/ports/atmel-samd/boards/feather_m0_rfm9x/pins.c
index 29a01d405..977cb9fdf 100644
--- a/ports/atmel-samd/boards/feather_m0_rfm9x/pins.c
+++ b/ports/atmel-samd/boards/feather_m0_rfm9x/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
diff --git a/ports/atmel-samd/boards/feather_m0_supersized/pins.c b/ports/atmel-samd/boards/feather_m0_supersized/pins.c
index 1eaa98a58..3c4effbe3 100644
--- a/ports/atmel-samd/boards/feather_m0_supersized/pins.c
+++ b/ports/atmel-samd/boards/feather_m0_supersized/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
diff --git a/ports/atmel-samd/boards/feather_m4_express/pins.c b/ports/atmel-samd/boards/feather_m4_express/pins.c
index cec9fe37f..d9496ecfc 100644
--- a/ports/atmel-samd/boards/feather_m4_express/pins.c
+++ b/ports/atmel-samd/boards/feather_m4_express/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA05) },
diff --git a/ports/atmel-samd/boards/feather_radiofruit_zigbee/pins.c b/ports/atmel-samd/boards/feather_radiofruit_zigbee/pins.c
index 211596f78..713397878 100755
--- a/ports/atmel-samd/boards/feather_radiofruit_zigbee/pins.c
+++ b/ports/atmel-samd/boards/feather_radiofruit_zigbee/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PB02) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB03) },
diff --git a/ports/atmel-samd/boards/gemma_m0/mpconfigboard.h b/ports/atmel-samd/boards/gemma_m0/mpconfigboard.h
index 59e0b3c61..bc60ba49b 100644
--- a/ports/atmel-samd/boards/gemma_m0/mpconfigboard.h
+++ b/ports/atmel-samd/boards/gemma_m0/mpconfigboard.h
@@ -12,7 +12,7 @@
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
-#define CIRCUITPY_INTERNAL_NVM_SIZE 0
+#define CIRCUITPY_INTERNAL_NVM_SIZE 256
#define DEFAULT_I2C_BUS_SCL (&pin_PA05)
#define DEFAULT_I2C_BUS_SDA (&pin_PA04)
@@ -20,7 +20,7 @@
#define DEFAULT_UART_BUS_RX (&pin_PA05)
#define DEFAULT_UART_BUS_TX (&pin_PA04)
-#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
+#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#define IGNORE_PIN_PA03 1
#define IGNORE_PIN_PA06 1
diff --git a/ports/atmel-samd/boards/gemma_m0/mpconfigboard.mk b/ports/atmel-samd/boards/gemma_m0/mpconfigboard.mk
index d44f2feb9..9f4a9fe83 100644
--- a/ports/atmel-samd/boards/gemma_m0/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/gemma_m0/mpconfigboard.mk
@@ -10,5 +10,3 @@ CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21E18A
CHIP_FAMILY = samd21
-
-CIRCUITPY_FREQUENCYIO = 0
diff --git a/ports/atmel-samd/boards/gemma_m0/pins.c b/ports/atmel-samd/boards/gemma_m0/pins.c
index b24b45838..9aecd5d84 100644
--- a/ports/atmel-samd/boards/gemma_m0/pins.c
+++ b/ports/atmel-samd/boards/gemma_m0/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA05) }, // pad 1
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA05) },
diff --git a/ports/atmel-samd/boards/grandcentral_m4_express/pins.c b/ports/atmel-samd/boards/grandcentral_m4_express/pins.c
index 26d0e71a0..6b09c62bf 100644
--- a/ports/atmel-samd/boards/grandcentral_m4_express/pins.c
+++ b/ports/atmel-samd/boards/grandcentral_m4_express/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
// This mapping only includes functional names because pins broken
// out on connectors are labeled with their MCU name available from
// microcontroller.pin.
diff --git a/ports/atmel-samd/boards/hallowing_m0_express/board.c b/ports/atmel-samd/boards/hallowing_m0_express/board.c
index 23b119413..94775cd94 100644
--- a/ports/atmel-samd/boards/hallowing_m0_express/board.c
+++ b/ports/atmel-samd/boards/hallowing_m0_express/board.c
@@ -26,9 +26,11 @@
#include "boards/board.h"
+#include "shared-bindings/board/__init__.h"
#include "shared-bindings/displayio/FourWire.h"
#include "shared-module/displayio/__init__.h"
#include "shared-module/displayio/mipi_constants.h"
+#include "shared-bindings/busio/SPI.h"
#include "tick.h"
@@ -71,8 +73,10 @@ uint8_t display_init_sequence[] = {
void board_init(void) {
displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus;
bus->base.type = &displayio_fourwire_type;
+ busio_spi_obj_t *spi = common_hal_board_create_spi();
+ common_hal_busio_spi_configure(spi, 12000000, 0, 0, 8);
common_hal_displayio_fourwire_construct(bus,
- board_spi(),
+ spi,
&pin_PA28, // Command or data
&pin_PA01, // Chip select
&pin_PA27); // Reset
@@ -93,7 +97,9 @@ void board_init(void) {
0x37, // set vertical scroll command
display_init_sequence,
sizeof(display_init_sequence),
- &pin_PA00);
+ &pin_PA00,
+ false, // single_byte_bounds
+ false); // data_as_commands
common_hal_displayio_display_set_auto_brightness(display, true);
}
diff --git a/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk
index 36cb67ea5..1df82ff44 100644
--- a/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk
@@ -9,6 +9,13 @@ EXTERNAL_FLASH_DEVICE_COUNT = 2
EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, GD25Q64C"
LONGINT_IMPL = MPZ
+# To keep the build small
+CIRCUITPY_I2CSLAVE = 0
+CIRCUITPY_FREQUENCYIO = 0
+CIRCUITPY_AUDIOBUSIO = 0
+
+CFLAGS_INLINE_LIMIT = 50
+
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
@@ -16,7 +23,3 @@ CHIP_FAMILY = samd21
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
-
-# To keep the build small
-CIRCUITPY_I2CSLAVE = 0
-CIRCUITPY_FREQUENCYIO = 0
diff --git a/ports/atmel-samd/boards/hallowing_m0_express/pins.c b/ports/atmel-samd/boards/hallowing_m0_express/pins.c
index 3db1b1752..3e670a676 100644
--- a/ports/atmel-samd/boards/hallowing_m0_express/pins.c
+++ b/ports/atmel-samd/boards/hallowing_m0_express/pins.c
@@ -1,7 +1,6 @@
#include "shared-bindings/board/__init__.h"
#include "boards/board.h"
-#include "supervisor/shared/board_busses.h"
#include "shared-module/displayio/__init__.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
diff --git a/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.h b/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.h
index 530e7e4c3..79d0cd269 100644
--- a/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.h
+++ b/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.h
@@ -36,3 +36,7 @@
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1
+
+// Not connected
+#define IGNORE_PIN_PA13 1
+#define IGNORE_PIN_PA28 1
diff --git a/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk
index 8fcf5208f..4f3e1ca66 100644
--- a/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk
@@ -11,3 +11,10 @@ LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
+
+# Tweak inlining depending on language.
+ifeq ($(TRANSLATION), zh_Latn_pinyin)
+CFLAGS_INLINE_LIMIT = 45
+else
+CFLAGS_INLINE_LIMIT = 70
+endif
diff --git a/ports/atmel-samd/boards/itsybitsy_m0_express/pins.c b/ports/atmel-samd/boards/itsybitsy_m0_express/pins.c
index 912fba4ed..1b0e5d09e 100644
--- a/ports/atmel-samd/boards/itsybitsy_m0_express/pins.c
+++ b/ports/atmel-samd/boards/itsybitsy_m0_express/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) },
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) },
diff --git a/ports/atmel-samd/boards/itsybitsy_m4_express/pins.c b/ports/atmel-samd/boards/itsybitsy_m4_express/pins.c
index ed91c88ee..8cd2f44f8 100644
--- a/ports/atmel-samd/boards/itsybitsy_m4_express/pins.c
+++ b/ports/atmel-samd/boards/itsybitsy_m4_express/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
// This mapping only includes functional names because pins broken
// out on connectors are labeled with their MCU name available from
// microcontroller.pin.
diff --git a/ports/atmel-samd/boards/kicksat-sprite/board.c b/ports/atmel-samd/boards/kicksat-sprite/board.c
new file mode 100644
index 000000000..fc53f3967
--- /dev/null
+++ b/ports/atmel-samd/boards/kicksat-sprite/board.c
@@ -0,0 +1,41 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+
+#include <string.h>
+
+#include "boards/board.h"
+#include "py/mpconfig.h"
+
+void board_init(void) {
+}
+
+bool board_requests_safe_mode(void) {
+ return false;
+}
+
+void reset_board(void) {
+} \ No newline at end of file
diff --git a/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.h b/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.h
new file mode 100644
index 000000000..194542b05
--- /dev/null
+++ b/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.h
@@ -0,0 +1,30 @@
+
+#define MICROPY_HW_BOARD_NAME "Sprite_v2b"
+#define MICROPY_HW_MCU_NAME "samd51G19"
+#define CIRCUITPY_MCU_FAMILY samd51
+
+#define MICROPY_HW_LED_STATUS (&pin_PB03)
+
+#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25)
+#define MICROPY_PORT_B (0)
+#define MICROPY_PORT_C (0)
+#define MICROPY_PORT_D (0)
+
+#define CALIBRATE_CRYSTALLESS 1
+
+#define CIRCUITPY_INTERNAL_NVM_SIZE 0
+
+#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - 0x010000)
+
+#define DEFAULT_I2C_BUS_SCL (&pin_PA17)
+#define DEFAULT_I2C_BUS_SDA (&pin_PA16)
+
+#define DEFAULT_SPI_BUS_SCK (&pin_PA05)
+#define DEFAULT_SPI_BUS_MOSI (&pin_PA07)
+#define DEFAULT_SPI_BUS_MISO (&pin_PA04)
+
+#define DEFAULT_UART_BUS_TX (&pin_PB09)
+#define DEFAULT_UART_BUS_RX (&pin_PB08)
+
+#define IGNORE_PIN_PA24 1
+#define IGNORE_PIN_PA25 1
diff --git a/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk b/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk
new file mode 100644
index 000000000..e97a70105
--- /dev/null
+++ b/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk
@@ -0,0 +1,17 @@
+LD_FILE = boards/samd51x19-bootloader.ld
+USB_VID = 0x04D8
+USB_PID = 0xED94
+USB_PRODUCT = "kicksat-sprite"
+USB_MANUFACTURER = "maholli"
+
+QSPI_FLASH_FILESYSTEM = 0
+INTERNAL_FLASH_FILESYSTEM = 1
+LONGINT_IMPL = MPZ
+
+# No touch on SAMD51 yet
+CIRCUITPY_TOUCHIO = 0
+CIRCUITPY_AUDIOBUSIO = 0
+CIRCUITPY_DISPLAYIO = 0
+
+CHIP_VARIANT = SAMD51G19A
+CHIP_FAMILY = samd51 \ No newline at end of file
diff --git a/ports/atmel-samd/boards/kicksat-sprite/pins.c b/ports/atmel-samd/boards/kicksat-sprite/pins.c
new file mode 100644
index 000000000..03af22ff2
--- /dev/null
+++ b/ports/atmel-samd/boards/kicksat-sprite/pins.c
@@ -0,0 +1,38 @@
+#include "shared-bindings/board/__init__.h"
+#include "boards/board.h"
+
+STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA05) },
+ { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA07) },
+ { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA04) },
+
+ { MP_ROM_QSTR(MP_QSTR_radioCS), MP_ROM_PTR(&pin_PA00) },
+ { MP_ROM_QSTR(MP_QSTR_WAKE), MP_ROM_PTR(&pin_PA01) },
+ { MP_ROM_QSTR(MP_QSTR_SHDWN), MP_ROM_PTR(&pin_PB10) },
+ { MP_ROM_QSTR(MP_QSTR_PWDWN), MP_ROM_PTR(&pin_PB11) },
+ { MP_ROM_QSTR(MP_QSTR_TST), MP_ROM_PTR(&pin_PA11) },
+ { MP_ROM_QSTR(MP_QSTR_FSYNC), MP_ROM_PTR(&pin_PA13) },
+ { MP_ROM_QSTR(MP_QSTR_VCLK), MP_ROM_PTR(&pin_PA14) },
+ { MP_ROM_QSTR(MP_QSTR_FSYNC), MP_ROM_PTR(&pin_PA15) },
+ { MP_ROM_QSTR(MP_QSTR_MD), MP_ROM_PTR(&pin_PA18) },
+ { MP_ROM_QSTR(MP_QSTR_MC), MP_ROM_PTR(&pin_PA19) },
+
+ { MP_ROM_QSTR(MP_QSTR_PA08), MP_ROM_PTR(&pin_PA08) },
+ { MP_ROM_QSTR(MP_QSTR_PA10), MP_ROM_PTR(&pin_PA10) },
+ { MP_ROM_QSTR(MP_QSTR_PA09), MP_ROM_PTR(&pin_PA09) },
+ { MP_ROM_QSTR(MP_QSTR_PA06), MP_ROM_PTR(&pin_PA06) },
+ { MP_ROM_QSTR(MP_QSTR_DAC0), MP_ROM_PTR(&pin_PA02) },
+
+ { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB09) },
+ { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB08) },
+ { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA16) },
+ { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA17) },
+
+
+ { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PB03) },
+
+ { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
+ { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
+ { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
+};
+MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); \ No newline at end of file
diff --git a/ports/atmel-samd/boards/meowmeow/mpconfigboard.h b/ports/atmel-samd/boards/meowmeow/mpconfigboard.h
index fe741a0f7..1304b6dfb 100644
--- a/ports/atmel-samd/boards/meowmeow/mpconfigboard.h
+++ b/ports/atmel-samd/boards/meowmeow/mpconfigboard.h
@@ -10,9 +10,9 @@
// If you change this, then make sure to update the linker scripts as well to
// make sure you don't overwrite code.
-#define CIRCUITPY_INTERNAL_NVM_SIZE 0
+#define CIRCUITPY_INTERNAL_NVM_SIZE 256
-#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
+#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#define CALIBRATE_CRYSTALLESS 1
diff --git a/ports/atmel-samd/boards/meowmeow/mpconfigboard.mk b/ports/atmel-samd/boards/meowmeow/mpconfigboard.mk
index 3547235dd..a620f2919 100644
--- a/ports/atmel-samd/boards/meowmeow/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/meowmeow/mpconfigboard.mk
@@ -10,5 +10,3 @@ CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
-
-CIRCUITPY_FREQUENCYIO = 0
diff --git a/ports/atmel-samd/boards/meowmeow/pins.c b/ports/atmel-samd/boards/meowmeow/pins.c
index 089baad32..41d122d87 100644
--- a/ports/atmel-samd/boards/meowmeow/pins.c
+++ b/ports/atmel-samd/boards/meowmeow/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA03) },
diff --git a/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk
index 5104b601b..ce9c4baba 100644
--- a/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk
@@ -13,4 +13,7 @@ LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
-CIRCUITPY_FREQUENCYIO = 0
+# Tweak inlining depending on language.
+ifeq ($(TRANSLATION), zh_Latn_pinyin)
+CFLAGS_INLINE_LIMIT = 50
+endif
diff --git a/ports/atmel-samd/boards/metro_m0_express/pins.c b/ports/atmel-samd/boards/metro_m0_express/pins.c
index 0707a3581..c11fac5ce 100644
--- a/ports/atmel-samd/boards/metro_m0_express/pins.c
+++ b/ports/atmel-samd/boards/metro_m0_express/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
diff --git a/ports/atmel-samd/boards/metro_m4_airlift_lite/board.c b/ports/atmel-samd/boards/metro_m4_airlift_lite/board.c
new file mode 100644
index 000000000..0f60736a2
--- /dev/null
+++ b/ports/atmel-samd/boards/metro_m4_airlift_lite/board.c
@@ -0,0 +1,39 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "boards/board.h"
+#include "mpconfigboard.h"
+#include "hal/include/hal_gpio.h"
+
+void board_init(void) {
+}
+
+bool board_requests_safe_mode(void) {
+ return false;
+}
+
+void reset_board(void) {
+}
diff --git a/ports/atmel-samd/boards/metro_m4_airlift_lite/mpconfigboard.h b/ports/atmel-samd/boards/metro_m4_airlift_lite/mpconfigboard.h
new file mode 100644
index 000000000..e89b0322a
--- /dev/null
+++ b/ports/atmel-samd/boards/metro_m4_airlift_lite/mpconfigboard.h
@@ -0,0 +1,43 @@
+#define MICROPY_HW_BOARD_NAME "Adafruit Metro M4 Airlift Lite"
+#define MICROPY_HW_MCU_NAME "samd51j19"
+
+#define CIRCUITPY_MCU_FAMILY samd51
+
+#define MICROPY_HW_LED_TX (&pin_PB07)
+#define MICROPY_HW_LED_RX (&pin_PB06)
+
+#define MICROPY_HW_LED_STATUS (&pin_PA16)
+
+#define MICROPY_HW_NEOPIXEL (&pin_PB22)
+
+// These are pins not to reset.
+// QSPI Data pins
+#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11)
+// QSPI CS, QSPI SCK and NeoPixel pin
+#define MICROPY_PORT_B (PORT_PB10 | PORT_PB11 | PORT_PB22)
+#define MICROPY_PORT_C (0)
+#define MICROPY_PORT_D (0)
+
+#define AUTORESET_DELAY_MS 500
+
+// If you change this, then make sure to update the linker scripts as well to
+// make sure you don't overwrite code
+#define CIRCUITPY_INTERNAL_NVM_SIZE 8192
+
+#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
+
+#define BOARD_HAS_CRYSTAL 1
+
+#define DEFAULT_I2C_BUS_SCL (&pin_PB03)
+#define DEFAULT_I2C_BUS_SDA (&pin_PB02)
+
+#define DEFAULT_SPI_BUS_SCK (&pin_PA13)
+#define DEFAULT_SPI_BUS_MOSI (&pin_PA12)
+#define DEFAULT_SPI_BUS_MISO (&pin_PA14)
+
+#define DEFAULT_UART_BUS_RX (&pin_PA23)
+#define DEFAULT_UART_BUS_TX (&pin_PA22)
+
+// USB is always used internally so skip the pin objects for it.
+#define IGNORE_PIN_PA24 1
+#define IGNORE_PIN_PA25 1
diff --git a/ports/atmel-samd/boards/metro_m4_airlift_lite/mpconfigboard.mk b/ports/atmel-samd/boards/metro_m4_airlift_lite/mpconfigboard.mk
new file mode 100644
index 000000000..654a84eb8
--- /dev/null
+++ b/ports/atmel-samd/boards/metro_m4_airlift_lite/mpconfigboard.mk
@@ -0,0 +1,20 @@
+LD_FILE = boards/samd51x19-bootloader-external-flash.ld
+USB_VID = 0x239A
+USB_PID = 0x8038
+USB_PRODUCT = "Metro M4 Airlift Lite"
+USB_MANUFACTURER = "Adafruit Industries LLC"
+
+QSPI_FLASH_FILESYSTEM = 1
+EXTERNAL_FLASH_DEVICE_COUNT = 3
+EXTERNAL_FLASH_DEVICES = "S25FL116K, S25FL216K, GD25Q16C"
+
+LONGINT_IMPL = MPZ
+
+# No touch on SAMD51 yet
+CIRCUITPY_TOUCHIO = 0
+
+CHIP_VARIANT = SAMD51J19A
+CHIP_FAMILY = samd51
+
+CIRCUITPY_NETWORK = 1
+MICROPY_PY_WIZNET5K = 5500
diff --git a/ports/atmel-samd/boards/metro_m4_airlift_lite/pins.c b/ports/atmel-samd/boards/metro_m4_airlift_lite/pins.c
new file mode 100644
index 000000000..4e90870c4
--- /dev/null
+++ b/ports/atmel-samd/boards/metro_m4_airlift_lite/pins.c
@@ -0,0 +1,55 @@
+#include "shared-bindings/board/__init__.h"
+
+// This mapping only includes functional names because pins broken
+// out on connectors are labeled with their MCU name available from
+// microcontroller.pin.
+STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA05) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA06) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PB00) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PB08) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB09) },
+
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA23) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA23) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA22) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA22) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PB17) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PB16) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PB13) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PB14) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PB15) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PB12) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA21) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA20) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA19) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA17) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D13),MP_ROM_PTR(&pin_PA16) },
+
+ // ESP control
+ { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_CS), MP_ROM_PTR(&pin_PA15) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_GPIO0), MP_ROM_PTR(&pin_PB01) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_BUSY), MP_ROM_PTR(&pin_PB04) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RESET), MP_ROM_PTR(&pin_PB05) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RTS), MP_ROM_PTR(&pin_PB23) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_TX), MP_ROM_PTR(&pin_PA04) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_PA07) },
+
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_PB02) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_PB03) },
+
+ { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL),MP_ROM_PTR(&pin_PB22) },
+
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SCK),MP_ROM_PTR(&pin_PA13) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_PA12) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_PA14) },
+
+ { MP_OBJ_NEW_QSTR(MP_QSTR_LED_RX),MP_ROM_PTR(&pin_PB06) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_LED_TX),MP_ROM_PTR(&pin_PB07) },
+ { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
+ { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
+ { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
+};
+MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
diff --git a/ports/atmel-samd/boards/metro_m4_express/pins.c b/ports/atmel-samd/boards/metro_m4_express/pins.c
index 63ae319a2..4eb26dd21 100644
--- a/ports/atmel-samd/boards/metro_m4_express/pins.c
+++ b/ports/atmel-samd/boards/metro_m4_express/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
// This mapping only includes functional names because pins broken
// out on connectors are labeled with their MCU name available from
// microcontroller.pin.
diff --git a/ports/atmel-samd/boards/mini_sam_m4/pins.c b/ports/atmel-samd/boards/mini_sam_m4/pins.c
index f78fe1bc8..b1d8d5325 100644
--- a/ports/atmel-samd/boards/mini_sam_m4/pins.c
+++ b/ports/atmel-samd/boards/mini_sam_m4/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
// This mapping only includes functional names because pins broken
// out on connectors are labeled with their MCU name available from
// microcontroller.pin.
diff --git a/ports/atmel-samd/boards/pewpew10/mpconfigboard.h b/ports/atmel-samd/boards/pewpew10/mpconfigboard.h
index 7dd4a5441..445ccc435 100644
--- a/ports/atmel-samd/boards/pewpew10/mpconfigboard.h
+++ b/ports/atmel-samd/boards/pewpew10/mpconfigboard.h
@@ -5,9 +5,9 @@
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
-#define CIRCUITPY_INTERNAL_NVM_SIZE 0
+#define CIRCUITPY_INTERNAL_NVM_SIZE 256
-#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
+#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#define IGNORE_PIN_PB00 1
diff --git a/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk
index 92f8cff52..b36a21368 100644
--- a/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk
@@ -16,8 +16,13 @@ CIRCUITPY_PEW = 1
CIRCUITPY_ANALOGIO = 1
CIRCUITPY_MATH = 1
CIRCUITPY_NEOPIXEL_WRITE = 1
+CIRCUITPY_ROTARYIO = 0
CIRCUITPY_RTC = 0
CIRCUITPY_SAMD = 0
CIRCUITPY_USB_MIDI = 0
CIRCUITPY_SMALL_BUILD = 1
-CIRCUITPY_FREQUENCYIO = 0
+
+# Tweak inlining depending on language.
+ifeq ($(TRANSLATION), zh_Latn_pinyin)
+CFLAGS_INLINE_LIMIT = 40
+endif
diff --git a/ports/atmel-samd/boards/pewpew10/pins.c b/ports/atmel-samd/boards/pewpew10/pins.c
index e2552dc32..9e5b9d98e 100644
--- a/ports/atmel-samd/boards/pewpew10/pins.c
+++ b/ports/atmel-samd/boards/pewpew10/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
// Pins for internal use.
{ MP_ROM_QSTR(MP_QSTR__R1), MP_ROM_PTR(&pin_PA05) },
diff --git a/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.h b/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.h
index a004336bf..288208f65 100644
--- a/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.h
+++ b/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.h
@@ -10,9 +10,9 @@
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
-#define CIRCUITPY_INTERNAL_NVM_SIZE 0
+#define CIRCUITPY_INTERNAL_NVM_SIZE 256
-#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
+#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#define IGNORE_PIN_PA02 1
#define IGNORE_PIN_PA03 1
diff --git a/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk b/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk
index 418f70d92..60638fd19 100644
--- a/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk
@@ -13,16 +13,17 @@ LONGINT_IMPL = NONE
CIRCUITPY_ANALOGIO = 0
CIRCUITPY_MATH = 0
CIRCUITPY_NEOPIXEL_WRITE = 0
+CIRCUITPY_ROTARYIO = 0
CIRCUITPY_RTC = 0
CIRCUITPY_SAMD = 0
-CIRCUITPY_USB_MIDI = 0
+CIRCUITPY_USB_MIDI = 1
+CIRCUITPY_TOUCHIO = 0
CIRCUITPY_SMALL_BUILD = 1
-CIRCUITPY_FREQUENCYIO = 0
CHIP_VARIANT = SAMD21E18A
CHIP_FAMILY = samd21
-CFLAGS_INLINE_LIMIT = 45
+CFLAGS_INLINE_LIMIT = 35
# Include these Python libraries in firmware.
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar
diff --git a/ports/atmel-samd/boards/pirkey_m0/pins.c b/ports/atmel-samd/boards/pirkey_m0/pins.c
index a6dbcefe3..e1f43c83c 100644
--- a/ports/atmel-samd/boards/pirkey_m0/pins.c
+++ b/ports/atmel-samd/boards/pirkey_m0/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_REMOTEIN), MP_ROM_PTR(&pin_PA28) },
diff --git a/ports/atmel-samd/boards/pybadge/board.c b/ports/atmel-samd/boards/pybadge/board.c
index 0881d8f45..9d16ae12f 100644
--- a/ports/atmel-samd/boards/pybadge/board.c
+++ b/ports/atmel-samd/boards/pybadge/board.c
@@ -69,16 +69,16 @@ uint8_t display_init_sequence[] = {
0x29, 0 | DELAY, 100, // _DISPON
};
-STATIC busio_spi_obj_t display_spi_obj;
-
void board_init(void) {
- common_hal_busio_spi_construct(&display_spi_obj, &pin_PB13, &pin_PB12, NULL);
- common_hal_busio_spi_never_reset(&display_spi_obj);
+ busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus;
+ common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB15, NULL);
+ common_hal_busio_spi_never_reset(spi);
+ common_hal_busio_spi_configure(spi, 24000000, 0, 0, 8);
displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus;
bus->base.type = &displayio_fourwire_type;
common_hal_displayio_fourwire_construct(bus,
- &display_spi_obj,
+ spi,
&pin_PB05, // TFT_DC Command or data
&pin_PB07, // TFT_CS Chip select
&pin_PA01); // TFT_RST Reset
@@ -99,7 +99,9 @@ void board_init(void) {
0x37, // set vertical scroll command
display_init_sequence,
sizeof(display_init_sequence),
- &pin_PA00);
+ &pin_PA00,
+ false, // single_byte_bounds
+ false); // data_as_commands
common_hal_displayio_display_set_auto_brightness(display, true);
}
diff --git a/ports/atmel-samd/boards/pybadge/mpconfigboard.mk b/ports/atmel-samd/boards/pybadge/mpconfigboard.mk
index 8ab759865..837e2e514 100644
--- a/ports/atmel-samd/boards/pybadge/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/pybadge/mpconfigboard.mk
@@ -6,7 +6,7 @@ USB_MANUFACTURER = "Adafruit Industries LLC"
QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
-EXTERNAL_FLASH_DEVICES = GD25Q64C
+EXTERNAL_FLASH_DEVICES = GD25Q16C
LONGINT_IMPL = MPZ
# No I2S on SAMD51G
@@ -16,3 +16,10 @@ CIRCUITPY_TOUCHIO = 0
CHIP_VARIANT = SAMD51J19A
CHIP_FAMILY = samd51
+
+CIRCUITPY_STAGE = 1
+CIRCUITPY_GAMEPAD = 1
+CIRCUITPY_DISPLAYIO = 1
+CIRCUITPY_AUDIOIO = 1
+
+FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pybadge
diff --git a/ports/atmel-samd/boards/pybadge/pins.c b/ports/atmel-samd/boards/pybadge/pins.c
index 41ab634c9..2e7e6d496 100644
--- a/ports/atmel-samd/boards/pybadge/pins.c
+++ b/ports/atmel-samd/boards/pybadge/pins.c
@@ -1,34 +1,62 @@
#include "shared-bindings/board/__init__.h"
#include "boards/board.h"
-#include "supervisor/shared/board_busses.h"
#include "shared-module/displayio/__init__.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA05) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB08) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PB09) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA04) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA06) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PB01) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PB04) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PB03) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_PB02) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PB17) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PB16) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PB03) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PB02) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA14) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA16) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA18) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PB14) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA15) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA19) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA20) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA21) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA22) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA23) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA15) },
+ // UART
+ { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB17) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB16) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_AVCC), MP_ROM_PTR(&pin_PA03) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_LEFT_DAC), MP_ROM_PTR(&pin_PA02) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_RIGHT_DAC), MP_ROM_PTR(&pin_PA05) },
+ // I2C
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA12) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA13) },
+ // SPI
{ MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA17) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB22) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB23) },
+
+ // Special named pins
+ { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA15) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_LIGHT), MP_ROM_PTR(&pin_PB04) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_ACCELEROMETER_INTERRUPT), MP_ROM_PTR(&pin_PB14) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SPEAKER), MP_ROM_PTR(&pin_PA02) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SPEAKER_ENABLE), MP_ROM_PTR(&pin_PA27) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_LATCH), MP_ROM_PTR(&pin_PB00) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_OUT), MP_ROM_PTR(&pin_PB30) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_CLOCK), MP_ROM_PTR(&pin_PB31) },
+ // TFT control pins
{ MP_OBJ_NEW_QSTR(MP_QSTR_TFT_LITE), MP_ROM_PTR(&pin_PA00) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_TFT_MOSI), MP_ROM_PTR(&pin_PA12) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_TFT_SCK), MP_ROM_PTR(&pin_PA13) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_TFT_MOSI), MP_ROM_PTR(&pin_PB15) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_TFT_SCK), MP_ROM_PTR(&pin_PB13) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_TFT_RST), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_PB07) },
{ MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_PB05) },
diff --git a/ports/atmel-samd/boards/pyportal/board.c b/ports/atmel-samd/boards/pyportal/board.c
index d2c328850..222e11144 100644
--- a/ports/atmel-samd/boards/pyportal/board.c
+++ b/ports/atmel-samd/boards/pyportal/board.c
@@ -25,7 +25,6 @@
*/
#include "boards/board.h"
-#include "supervisor/shared/board_busses.h"
#include "mpconfigboard.h"
#include "hal/include/hal_gpio.h"
@@ -90,7 +89,10 @@ void board_init(void) {
0x37, // Set vertical scroll command
display_init_sequence,
sizeof(display_init_sequence),
- &pin_PB31);
+ &pin_PB31,
+ false, // single_byte_bounds
+ false); // data_as_commands
+
common_hal_displayio_display_set_auto_brightness(display, true);
}
diff --git a/ports/atmel-samd/boards/pyportal/pins.c b/ports/atmel-samd/boards/pyportal/pins.c
index 4a41ee913..14699a209 100644
--- a/ports/atmel-samd/boards/pyportal/pins.c
+++ b/ports/atmel-samd/boards/pyportal/pins.c
@@ -2,7 +2,6 @@
#include "boards/board.h"
#include "shared-module/displayio/__init__.h"
-#include "supervisor/shared/board_busses.h"
// This mapping only includes functional names because pins broken
// out on connectors are labeled with their MCU name available from
diff --git a/ports/atmel-samd/boards/sam32/pins.c b/ports/atmel-samd/boards/sam32/pins.c
index b2e0a3f2b..f32057d75 100644
--- a/ports/atmel-samd/boards/sam32/pins.c
+++ b/ports/atmel-samd/boards/sam32/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PB08) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB09) },
diff --git a/ports/atmel-samd/boards/samd21x18-bootloader.ld b/ports/atmel-samd/boards/samd21x18-bootloader.ld
index 3eb97ee02..2ef09ba9a 100644
--- a/ports/atmel-samd/boards/samd21x18-bootloader.ld
+++ b/ports/atmel-samd/boards/samd21x18-bootloader.ld
@@ -5,8 +5,9 @@
/* Specify the memory areas */
MEMORY
{
- /* Leave 8KiB for the bootloader, and 64k for the flash file system. */
- FLASH (rx) : ORIGIN = 0x00000000 + 8K, LENGTH = 256K - 8K - 64K
+ /* Leave 8KiB for the bootloader, 64k for the flash file system, and 256b
+ for user config. */
+ FLASH (rx) : ORIGIN = 0x00000000 + 8K, LENGTH = 256K - 8K - 64K - 256
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
}
diff --git a/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.h b/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.h
index 6b470af2e..80cacfa9b 100755
--- a/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.h
+++ b/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.h
@@ -1,8 +1,6 @@
#define MICROPY_HW_BOARD_NAME "SparkFun LUMIDrive"
#define MICROPY_HW_MCU_NAME "samd21g18"
-//#define MICROPY_HW_NEOPIXEL (&pin_PA06)
-
// Clock rates are off: Salae reads 12MHz which is the limit even though we set it to the safer 8MHz.
#define SPI_FLASH_BAUDRATE (8000000)
@@ -30,10 +28,28 @@
#define DEFAULT_SPI_BUS_MOSI (&pin_PA18)
#define DEFAULT_SPI_BUS_MISO (&pin_PA21)
-//UART
-#define DEFAULT_UART_BUS_RX (&pin_PA11)
-#define DEFAULT_UART_BUS_TX (&pin_PA10)
-
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1
+
+#define IGNORE_PIN_PA02 1
+#define IGNORE_PIN_PA03 1
+#define IGNORE_PIN_PA10 1
+#define IGNORE_PIN_PA11 1
+#define IGNORE_PIN_PA12 1
+#define IGNORE_PIN_PA15 1
+#define IGNORE_PIN_PA16 1
+#define IGNORE_PIN_PA21 1
+#define IGNORE_PIN_PA22 1
+#define IGNORE_PIN_PA23 1
+#define IGNORE_PIN_PA27 1
+#define IGNORE_PIN_PA28 1
+
+#define IGNORE_PIN_PB02 1
+#define IGNORE_PIN_PB03 1
+#define IGNORE_PIN_PB08 1
+#define IGNORE_PIN_PB09 1
+#define IGNORE_PIN_PB10 1
+#define IGNORE_PIN_PB11 1
+#define IGNORE_PIN_PB22 1
+#define IGNORE_PIN_PB23 1
diff --git a/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk b/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk
index bd8fa17e9..4da42c02d 100755
--- a/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk
@@ -10,8 +10,10 @@ LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
+CIRCUITPY_AUDIOIO = 0
+CIRCUITPY_AUDIOBUSIO = 0
+
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = "W25Q32FV"
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar
-
diff --git a/ports/atmel-samd/boards/sparkfun_lumidrive/pins.c b/ports/atmel-samd/boards/sparkfun_lumidrive/pins.c
index 232c89e38..52c0753d4 100755
--- a/ports/atmel-samd/boards/sparkfun_lumidrive/pins.c
+++ b/ports/atmel-samd/boards/sparkfun_lumidrive/pins.c
@@ -1,21 +1,15 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA05) },
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA19) }, //
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA18) }, //
- { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) }, //
- { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) },
- { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) },
- { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA10) },
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) }, //
- { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) }, //
+ { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) }, //
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) }, //
- { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
+ { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
diff --git a/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk b/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk
index 63f61efe1..9e45f8ad9 100755
--- a/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk
@@ -12,3 +12,8 @@ CHIP_FAMILY = samd21
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = "W25Q32FV"
+
+# Tweak inlining depending on language.
+ifeq ($(TRANSLATION), zh_Latn_pinyin)
+CFLAGS_INLINE_LIMIT = 50
+endif
diff --git a/ports/atmel-samd/boards/sparkfun_redboard_turbo/pins.c b/ports/atmel-samd/boards/sparkfun_redboard_turbo/pins.c
index 223e20359..485589fca 100755
--- a/ports/atmel-samd/boards/sparkfun_redboard_turbo/pins.c
+++ b/ports/atmel-samd/boards/sparkfun_redboard_turbo/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
diff --git a/ports/atmel-samd/boards/sparkfun_samd21_dev/mpconfigboard.h b/ports/atmel-samd/boards/sparkfun_samd21_dev/mpconfigboard.h
index 3112d3f2a..a50c61cf2 100644
--- a/ports/atmel-samd/boards/sparkfun_samd21_dev/mpconfigboard.h
+++ b/ports/atmel-samd/boards/sparkfun_samd21_dev/mpconfigboard.h
@@ -5,9 +5,9 @@
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
-#define CIRCUITPY_INTERNAL_NVM_SIZE 0
+#define CIRCUITPY_INTERNAL_NVM_SIZE 256
-#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
+#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)
#define DEFAULT_I2C_BUS_SDA (&pin_PA22)
diff --git a/ports/atmel-samd/boards/sparkfun_samd21_dev/mpconfigboard.mk b/ports/atmel-samd/boards/sparkfun_samd21_dev/mpconfigboard.mk
index ec627b523..c0238ce80 100644
--- a/ports/atmel-samd/boards/sparkfun_samd21_dev/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/sparkfun_samd21_dev/mpconfigboard.mk
@@ -10,5 +10,3 @@ CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
-
-CIRCUITPY_FREQUENCYIO = 0
diff --git a/ports/atmel-samd/boards/sparkfun_samd21_dev/pins.c b/ports/atmel-samd/boards/sparkfun_samd21_dev/pins.c
index 9eab132c3..039100956 100644
--- a/ports/atmel-samd/boards/sparkfun_samd21_dev/pins.c
+++ b/ports/atmel-samd/boards/sparkfun_samd21_dev/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
// Analog pins
diff --git a/ports/atmel-samd/boards/sparkfun_samd21_mini/mpconfigboard.h b/ports/atmel-samd/boards/sparkfun_samd21_mini/mpconfigboard.h
index aec54ddfb..6af7fa191 100644
--- a/ports/atmel-samd/boards/sparkfun_samd21_mini/mpconfigboard.h
+++ b/ports/atmel-samd/boards/sparkfun_samd21_mini/mpconfigboard.h
@@ -5,9 +5,9 @@
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
-#define CIRCUITPY_INTERNAL_NVM_SIZE 0
+#define CIRCUITPY_INTERNAL_NVM_SIZE 256
-#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
+#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)
#define DEFAULT_I2C_BUS_SDA (&pin_PA22)
diff --git a/ports/atmel-samd/boards/sparkfun_samd21_mini/mpconfigboard.mk b/ports/atmel-samd/boards/sparkfun_samd21_mini/mpconfigboard.mk
index 8d2f35a69..462e3e2ca 100644
--- a/ports/atmel-samd/boards/sparkfun_samd21_mini/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/sparkfun_samd21_mini/mpconfigboard.mk
@@ -10,5 +10,3 @@ CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
-
-CIRCUITPY_FREQUENCYIO = 0
diff --git a/ports/atmel-samd/boards/sparkfun_samd21_mini/pins.c b/ports/atmel-samd/boards/sparkfun_samd21_mini/pins.c
index 42cd3736b..a90b0b5a3 100644
--- a/ports/atmel-samd/boards/sparkfun_samd21_mini/pins.c
+++ b/ports/atmel-samd/boards/sparkfun_samd21_mini/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
// Analog pins
diff --git a/ports/atmel-samd/boards/trellis_m4_express/pins.c b/ports/atmel-samd/boards/trellis_m4_express/pins.c
index a9f204318..4a0fa3ca2 100644
--- a/ports/atmel-samd/boards/trellis_m4_express/pins.c
+++ b/ports/atmel-samd/boards/trellis_m4_express/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
// This mapping only includes functional names because pins broken
// out on connectors are labeled with their MCU name available from
// microcontroller.pin.
diff --git a/ports/atmel-samd/boards/trinket_m0/mpconfigboard.h b/ports/atmel-samd/boards/trinket_m0/mpconfigboard.h
index cef35983e..dd8bc03cc 100644
--- a/ports/atmel-samd/boards/trinket_m0/mpconfigboard.h
+++ b/ports/atmel-samd/boards/trinket_m0/mpconfigboard.h
@@ -11,9 +11,9 @@
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
-#define CIRCUITPY_INTERNAL_NVM_SIZE 0
+#define CIRCUITPY_INTERNAL_NVM_SIZE 256
-#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
+#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#define IGNORE_PIN_PA03 1
#define IGNORE_PIN_PA04 1
diff --git a/ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk b/ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk
index b3448cf49..1c6f6db05 100644
--- a/ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk
@@ -10,5 +10,3 @@ CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21E18A
CHIP_FAMILY = samd21
-
-CIRCUITPY_FREQUENCYIO = 0
diff --git a/ports/atmel-samd/boards/trinket_m0/pins.c b/ports/atmel-samd/boards/trinket_m0/pins.c
index b3637bd5b..372601e62 100644
--- a/ports/atmel-samd/boards/trinket_m0/pins.c
+++ b/ports/atmel-samd/boards/trinket_m0/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA08) },
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA08) },
diff --git a/ports/atmel-samd/boards/trinket_m0_haxpress/mpconfigboard.mk b/ports/atmel-samd/boards/trinket_m0_haxpress/mpconfigboard.mk
index 5975ad1ba..c9c196da7 100644
--- a/ports/atmel-samd/boards/trinket_m0_haxpress/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/trinket_m0_haxpress/mpconfigboard.mk
@@ -11,5 +11,3 @@ LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD21E18A
CHIP_FAMILY = samd21
-
-CIRCUITPY_FREQUENCYIO = 0
diff --git a/ports/atmel-samd/boards/trinket_m0_haxpress/pins.c b/ports/atmel-samd/boards/trinket_m0_haxpress/pins.c
index b3637bd5b..372601e62 100644
--- a/ports/atmel-samd/boards/trinket_m0_haxpress/pins.c
+++ b/ports/atmel-samd/boards/trinket_m0_haxpress/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA08) },
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA08) },
diff --git a/ports/atmel-samd/boards/uchip/mpconfigboard.mk b/ports/atmel-samd/boards/uchip/mpconfigboard.mk
index 043bd3e8b..b6710af6d 100644
--- a/ports/atmel-samd/boards/uchip/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/uchip/mpconfigboard.mk
@@ -10,5 +10,3 @@ CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21E18A
CHIP_FAMILY = samd21
-
-CIRCUITPY_FREQUENCYIO = 0 \ No newline at end of file
diff --git a/ports/atmel-samd/boards/uchip/pins.c b/ports/atmel-samd/boards/uchip/pins.c
index acb0a5ec3..856a22074 100644
--- a/ports/atmel-samd/boards/uchip/pins.c
+++ b/ports/atmel-samd/boards/uchip/pins.c
@@ -1,4 +1,4 @@
-#include "supervisor/shared/board_busses.h"
+#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA08) },
diff --git a/ports/atmel-samd/boards/ugame10/board.c b/ports/atmel-samd/boards/ugame10/board.c
index d7e856d61..a4f6bb175 100644
--- a/ports/atmel-samd/boards/ugame10/board.c
+++ b/ports/atmel-samd/boards/ugame10/board.c
@@ -26,7 +26,80 @@
#include "boards/board.h"
+#include "shared-bindings/board/__init__.h"
+#include "shared-bindings/displayio/FourWire.h"
+#include "shared-module/displayio/__init__.h"
+#include "shared-module/displayio/mipi_constants.h"
+#include "shared-bindings/busio/SPI.h"
+
+#include "tick.h"
+
+displayio_fourwire_obj_t board_display_obj;
+
+#define DELAY 0x80
+
+uint8_t display_init_sequence[] = {
+ 0x01, 0 | DELAY, 150, // SWRESET
+ 0x11, 0 | DELAY, 255, // SLPOUT
+ 0xb1, 3, 0x01, 0x2C, 0x2D, // _FRMCTR1
+ 0xb2, 3, 0x01, 0x2C, 0x2D, //
+ 0xb3, 6, 0x01, 0x2C, 0x2D, 0x01, 0x2C, 0x2D,
+ 0xb4, 1, 0x07, // _INVCTR line inversion
+ 0xc0, 3, 0xa2, 0x02, 0x84, // _PWCTR1 GVDD = 4.7V, 1.0uA
+ 0xc1, 1, 0xc5, // _PWCTR2 VGH=14.7V, VGL=-7.35V
+ 0xc2, 2, 0x0a, 0x00, // _PWCTR3 Opamp current small, Boost frequency
+ 0xc3, 2, 0x8a, 0x2a,
+ 0xc4, 2, 0x8a, 0xee,
+ 0xc5, 1, 0x0e, // _VMCTR1 VCOMH = 4V, VOML = -1.1V
+ 0x2a, 0, // _INVOFF
+ 0x36, 1, 0xa0, // _MADCTL bottom to top refresh
+ // 1 clk cycle nonoverlap, 2 cycle gate rise, 3 sycle osc equalie,
+ // fix on VTL
+ 0x3a, 1, 0x05, // COLMOD - 16bit color
+ 0xe0, 16, 0x02, 0x1c, 0x07, 0x12, // _GMCTRP1 Gamma
+ 0x37, 0x32, 0x29, 0x2d,
+ 0x29, 0x25, 0x2B, 0x39,
+ 0x00, 0x01, 0x03, 0x10,
+ 0xe1, 16, 0x03, 0x1d, 0x07, 0x06, // _GMCTRN1
+ 0x2E, 0x2C, 0x29, 0x2D,
+ 0x2E, 0x2E, 0x37, 0x3F,
+ 0x00, 0x00, 0x02, 0x10,
+ 0x2a, 3, 0x02, 0x00, 0x81, // _CASET XSTART = 2, XEND = 129
+ 0x2b, 3, 0x02, 0x00, 0x81, // _RASET XSTART = 2, XEND = 129
+ 0x13, 0 | DELAY, 10, // _NORON
+ 0x29, 0 | DELAY, 100, // _DISPON
+};
+
void board_init(void) {
+ displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus;
+ bus->base.type = &displayio_fourwire_type;
+ busio_spi_obj_t *spi = common_hal_board_create_spi();
+ common_hal_busio_spi_configure(spi, 24000000, 0, 0, 8);
+ common_hal_displayio_fourwire_construct(bus,
+ spi,
+ &pin_PA09, // Command or data
+ &pin_PA08, // Chip select
+ NULL); // Reset
+
+ displayio_display_obj_t* display = &displays[0].display;
+ display->base.type = &displayio_display_type;
+ common_hal_displayio_display_construct(display,
+ bus,
+ 128, // Width
+ 128, // Height
+ 3, // column start
+ 2, // row start
+ 0, // rotation
+ 16, // Color depth
+ MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
+ MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
+ MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
+ 0x37, // set vertical scroll command
+ display_init_sequence,
+ sizeof(display_init_sequence),
+ NULL,
+ false, // single_byte_bounds
+ false); // data as commands
}
bool board_requests_safe_mode(void) {
diff --git a/ports/atmel-samd/boards/ugame10/mpconfigboard.h b/ports/atmel-samd/boards/ugame10/mpconfigboard.h
index caa05bc1a..b5590d986 100644
--- a/ports/atmel-samd/boards/ugame10/mpconfigboard.h
+++ b/ports/atmel-samd/boards/ugame10/mpconfigboard.h
@@ -19,10 +19,9 @@
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
-#define EXTRA_BUILTIN_MODULES \
- { MP_OBJ_NEW_QSTR(MP_QSTR_audioio), (mp_obj_t)&audioio_module }, \
- { MP_OBJ_NEW_QSTR(MP_QSTR_gamepad),(mp_obj_t)&gamepad_module }, \
- { MP_OBJ_NEW_QSTR(MP_QSTR__stage), (mp_obj_t)&stage_module }
+#define DEFAULT_SPI_BUS_SCK (&pin_PA07)
+#define DEFAULT_SPI_BUS_MISO (&pin_PA11)
+#define DEFAULT_SPI_BUS_MOSI (&pin_PA06)
#define IGNORE_PIN_PB00 1
#define IGNORE_PIN_PB01 1
diff --git a/ports/atmel-samd/boards/ugame10/mpconfigboard.mk b/ports/atmel-samd/boards/ugame10/mpconfigboard.mk
index 0a727c8b1..cafd84b21 100644
--- a/ports/atmel-samd/boards/ugame10/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/ugame10/mpconfigboard.mk
@@ -17,13 +17,18 @@ CIRCUITPY_MATH = 1
CIRCUITPY_AUDIOIO = 1
CIRCUITPY_ANALOGIO = 1
CIRCUITPY_GAMEPAD = 1
+CIRCUITPY_DISPLAYIO = 1
+
CIRCUITPY_TOUCHIO = 0
CIRCUITPY_NEOPIXEL_WRITE = 0
CIRCUITPY_RTC = 0
-CIRCUITPY_SAMD = 0
CIRCUITPY_USB_MIDI = 0
CIRCUITPY_USB_HID = 0
+CIRCUITPY_I2CSLAVE = 0
CIRCUITPY_FREQUENCYIO = 0
-CIRCUITPY_SMALL_BUILD = 1
+CIRCUITPY_AUDIOBUSIO = 0
+CIRCUITPY_PIXELBUF = 0
+
+FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/ugame10
-FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage
+CIRCUITPY_DISPLAY_FONT = "../../tools/Tecate-bitmap-fonts/bitmap/phallus/lemon.bdf"
diff --git a/ports/atmel-samd/boards/ugame10/pins.c b/ports/atmel-samd/boards/ugame10/pins.c
index 71db52752..4a03f8bb5 100644
--- a/ports/atmel-samd/boards/ugame10/pins.c
+++ b/ports/atmel-samd/boards/ugame10/pins.c
@@ -1,6 +1,5 @@
#include "shared-bindings/board/__init__.h"
-
-#include "supervisor/shared/board_busses.h"
+#include "shared-module/displayio/__init__.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_X), MP_ROM_PTR(&pin_PA00) },
@@ -25,8 +24,8 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_B), MP_ROM_PTR(&pin_PA14) },
{ MP_ROM_QSTR(MP_QSTR_C), MP_ROM_PTR(&pin_PA15) },
{ MP_ROM_QSTR(MP_QSTR_D), MP_ROM_PTR(&pin_PA28) },
- { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
+
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
- { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
+ { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)}
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
diff --git a/ports/atmel-samd/common-hal/busio/SPI.c b/ports/atmel-samd/common-hal/busio/SPI.c
index ca58e3fd5..644b9a87b 100644
--- a/ports/atmel-samd/common-hal/busio/SPI.c
+++ b/ports/atmel-samd/common-hal/busio/SPI.c
@@ -361,3 +361,13 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, uint8_t *data_out, uin
uint32_t common_hal_busio_spi_get_frequency(busio_spi_obj_t* self) {
return samd_peripherals_spi_baud_reg_value_to_baudrate(hri_sercomspi_read_BAUD_reg(self->spi_desc.dev.prvt));
}
+
+uint8_t common_hal_busio_spi_get_phase(busio_spi_obj_t* self) {
+ void * hw = self->spi_desc.dev.prvt;
+ return hri_sercomspi_get_CTRLA_CPHA_bit(hw);
+}
+
+uint8_t common_hal_busio_spi_get_polarity(busio_spi_obj_t* self) {
+ void * hw = self->spi_desc.dev.prvt;
+ return hri_sercomspi_get_CTRLA_CPOL_bit(hw);
+}
diff --git a/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c b/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c
index 9537d6179..e167cbb69 100644
--- a/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c
+++ b/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c
@@ -49,6 +49,11 @@ digitalinout_result_t common_hal_digitalio_digitalinout_construct(
return DIGITALINOUT_OK;
}
+void common_hal_digitalio_digitalinout_never_reset(
+ digitalio_digitalinout_obj_t *self) {
+ never_reset_pin_number(self->pin->number);
+}
+
bool common_hal_digitalio_digitalinout_deinited(digitalio_digitalinout_obj_t* self) {
return self->pin == mp_const_none;
}
diff --git a/ports/atmel-samd/common-hal/pulseio/PulseIn.c b/ports/atmel-samd/common-hal/pulseio/PulseIn.c
index aaa69a6f8..a2494f102 100644
--- a/ports/atmel-samd/common-hal/pulseio/PulseIn.c
+++ b/ports/atmel-samd/common-hal/pulseio/PulseIn.c
@@ -32,6 +32,7 @@
#include "hal/include/hal_gpio.h"
#include "background.h"
+#include "eic_handler.h"
#include "mpconfigport.h"
#include "py/gc.h"
#include "py/runtime.h"
@@ -54,7 +55,8 @@ static void pulsein_set_config(pulseio_pulsein_obj_t* self, bool first_edge) {
} else {
sense_setting = EIC_CONFIG_SENSE0_RISE_Val;
}
- turn_on_eic_channel(self->channel, sense_setting, EIC_HANDLER_PULSEIN);
+ set_eic_handler(self->channel, EIC_HANDLER_PULSEIN);
+ turn_on_eic_channel(self->channel, sense_setting);
}
void pulsein_interrupt_handler(uint8_t channel) {
@@ -153,6 +155,7 @@ void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t* self) {
if (common_hal_pulseio_pulsein_deinited(self)) {
return;
}
+ set_eic_handler(self->channel, EIC_HANDLER_NO_INTERRUPT);
turn_off_eic_channel(self->channel);
reset_pin_number(self->pin);
self->pin = NO_PIN;
diff --git a/ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c b/ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
index 080cd61b5..e3bcf395b 100644
--- a/ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
+++ b/ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
@@ -28,6 +28,7 @@
#include "atmel_start_pins.h"
+#include "eic_handler.h"
#include "samd/external_interrupts.h"
#include "py/runtime.h"
#include "supervisor/shared/translate.h"
@@ -76,8 +77,11 @@ void common_hal_rotaryio_incrementalencoder_construct(rotaryio_incrementalencode
claim_pin(pin_a);
claim_pin(pin_b);
- turn_on_eic_channel(self->eic_channel_a, EIC_CONFIG_SENSE0_BOTH_Val, EIC_HANDLER_INCREMENTAL_ENCODER);
- turn_on_eic_channel(self->eic_channel_b, EIC_CONFIG_SENSE0_BOTH_Val, EIC_HANDLER_INCREMENTAL_ENCODER);
+ set_eic_handler(self->eic_channel_a, EIC_HANDLER_INCREMENTAL_ENCODER);
+ turn_on_eic_channel(self->eic_channel_a, EIC_CONFIG_SENSE0_BOTH_Val);
+
+ set_eic_handler(self->eic_channel_b, EIC_HANDLER_INCREMENTAL_ENCODER);
+ turn_on_eic_channel(self->eic_channel_b, EIC_CONFIG_SENSE0_BOTH_Val);
}
bool common_hal_rotaryio_incrementalencoder_deinited(rotaryio_incrementalencoder_obj_t* self) {
@@ -88,10 +92,16 @@ void common_hal_rotaryio_incrementalencoder_deinit(rotaryio_incrementalencoder_o
if (common_hal_rotaryio_incrementalencoder_deinited(self)) {
return;
}
+
+ set_eic_handler(self->eic_channel_a, EIC_HANDLER_NO_INTERRUPT);
turn_off_eic_channel(self->eic_channel_a);
+
+ set_eic_handler(self->eic_channel_b, EIC_HANDLER_NO_INTERRUPT);
turn_off_eic_channel(self->eic_channel_b);
+
reset_pin_number(self->pin_a);
self->pin_a = NO_PIN;
+
reset_pin_number(self->pin_b);
self->pin_b = NO_PIN;
}
diff --git a/ports/atmel-samd/eic_handler.c b/ports/atmel-samd/eic_handler.c
new file mode 100644
index 000000000..db5f260e5
--- /dev/null
+++ b/ports/atmel-samd/eic_handler.c
@@ -0,0 +1,58 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Dan Halbert for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "common-hal/pulseio/PulseIn.h"
+#include "common-hal/rotaryio/IncrementalEncoder.h"
+#include "shared-bindings/microcontroller/__init__.h"
+//#include "samd/external_interrupts.h"
+#include "eic_handler.h"
+
+// Which handler should be called for a particular channel?
+static uint8_t eic_channel_handler[EIC_EXTINT_NUM];
+
+void set_eic_handler(uint8_t channel, uint8_t eic_handler) {
+ eic_channel_handler[channel] = eic_handler;
+}
+
+void shared_eic_handler(uint8_t channel) {
+ uint8_t handler = eic_channel_handler[channel];
+ switch (handler) {
+#if CIRCUITPY_PULSEIO
+ case EIC_HANDLER_PULSEIN:
+ pulsein_interrupt_handler(channel);
+ break;
+#endif
+
+#if CIRCUITPY_ROTARYIO
+ case EIC_HANDLER_INCREMENTAL_ENCODER:
+ incrementalencoder_interrupt_handler(channel);
+ break;
+#endif
+
+ default:
+ break;
+ }
+}
diff --git a/ports/atmel-samd/eic_handler.h b/ports/atmel-samd/eic_handler.h
new file mode 100644
index 000000000..2f9ccd67f
--- /dev/null
+++ b/ports/atmel-samd/eic_handler.h
@@ -0,0 +1,36 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Dan Halbert for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef MICROPY_INCLUDED_ATMEL_SAMD_EIC_HANDLER_H
+#define MICROPY_INCLUDED_ATMEL_SAMD_EIC_HANDLER_H
+
+#define EIC_HANDLER_NO_INTERRUPT 0x0
+#define EIC_HANDLER_PULSEIN 0x1
+#define EIC_HANDLER_INCREMENTAL_ENCODER 0x2
+
+void set_eic_handler(uint8_t channel, uint8_t eic_handler);
+void shared_eic_handler(uint8_t channel);
+
+#endif // MICROPY_INCLUDED_ATMEL_SAMD_EIC_HANDLER_H
diff --git a/ports/atmel-samd/mpconfigport.mk b/ports/atmel-samd/mpconfigport.mk
index bb5e222f0..66ee92e6b 100644
--- a/ports/atmel-samd/mpconfigport.mk
+++ b/ports/atmel-samd/mpconfigport.mk
@@ -14,6 +14,12 @@ ifeq ($(LONGINT_IMPL),LONGLONG)
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=longlong
endif
+# Put samd21-only choices here.
+ifeq ($(CHIP_FAMILY),samd21)
+# frequencyio not yet verified as working on SAMD21.
+CIRCUITPY_FRQUENCYIO = 0
+endif
+
# Put samd51-only choices here.
ifeq ($(CHIP_FAMILY),samd51)
CIRCUITPY_SAMD = 1
diff --git a/ports/atmel-samd/peripherals b/ports/atmel-samd/peripherals
-Subproject 6416828bb6821779d4c62fa3c7d41c95634173c
+Subproject 778d4f3736728da7ba7795c5c44176c415c903c
diff --git a/ports/atmel-samd/supervisor/internal_flash.c b/ports/atmel-samd/supervisor/internal_flash.c
index f1ceb5c92..6dd5ac0a7 100644
--- a/ports/atmel-samd/supervisor/internal_flash.c
+++ b/ports/atmel-samd/supervisor/internal_flash.c
@@ -76,6 +76,9 @@ uint32_t supervisor_flash_get_block_count(void) {
void supervisor_flash_flush(void) {
}
+void supervisor_flash_release_cache(void) {
+}
+
void flash_flush(void) {
supervisor_flash_flush();
}
diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile
index 3681ac49e..3cb4b52aa 100755
--- a/ports/nrf/Makefile
+++ b/ports/nrf/Makefile
@@ -140,6 +140,7 @@ SRC_NRFX = $(addprefix nrfx/,\
drivers/src/nrfx_twim.c \
drivers/src/nrfx_uarte.c \
drivers/src/nrfx_gpiote.c \
+ drivers/src/nrfx_rtc.c \
)
ifdef EXTERNAL_FLASH_DEVICES
diff --git a/ports/nrf/README.md b/ports/nrf/README.md
index 49c9fbe29..65a66b7b0 100644
--- a/ports/nrf/README.md
+++ b/ports/nrf/README.md
@@ -78,6 +78,7 @@ pca10056 | s140 | Peripheral and Scanner | [S
feather_nrf52840_express | s140 | Peripheral and Scanner | UF2 bootloader
makerdiary_nrf52840_mdk | s140 | Peripheral and Scanner | pyocd or ARM mbed DAPLink
makerdiary_nrf52840_mdk_usb_dongle | s140 | Peripheral and Scanner | DFU bootloader & nrfutil
+electronut_labs_papyr | s140 | Peripheral and Scanner | UF2 bootloader
## Segger Targets
diff --git a/ports/nrf/background.c b/ports/nrf/background.c
index 69c76fd06..3fb5febd3 100644
--- a/ports/nrf/background.c
+++ b/ports/nrf/background.c
@@ -25,6 +25,7 @@
*/
#include "py/runtime.h"
+#include "supervisor/filesystem.h"
#include "supervisor/usb.h"
#include "supervisor/shared/stack.h"
@@ -32,12 +33,25 @@
#include "shared-module/displayio/__init__.h"
#endif
+static bool running_background_tasks = false;
+
+void background_tasks_reset(void) {
+ running_background_tasks = false;
+}
+
void run_background_tasks(void) {
+ // Don't call ourselves recursively.
+ if (running_background_tasks) {
+ return;
+ }
+ running_background_tasks = true;
+ filesystem_background();
usb_background();
#ifdef CIRCUITPY_DISPLAYIO
displayio_refresh_displays();
#endif
+ running_background_tasks = false;
assert_heap_ok();
}
diff --git a/ports/nrf/background.h b/ports/nrf/background.h
new file mode 100644
index 000000000..d53681c0f
--- /dev/null
+++ b/ports/nrf/background.h
@@ -0,0 +1,35 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Dan Halbert for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef MICROPY_INCLUDED_NRF_BACKGROUND_H
+#define MICROPY_INCLUDED_NRF_BACKGROUND_H
+
+#include <stdbool.h>
+
+void background_tasks_reset(void);
+void run_background_tasks(void);
+
+#endif // MICROPY_INCLUDED_NRF_BACKGROUND_H
diff --git a/ports/nrf/boards/electronut_labs_papyr/README.md b/ports/nrf/boards/electronut_labs_papyr/README.md
new file mode 100644
index 000000000..fda390193
--- /dev/null
+++ b/ports/nrf/boards/electronut_labs_papyr/README.md
@@ -0,0 +1,58 @@
+# Setup
+
+The `Electronut Labs Papyr` board is based on the `nRF52840` SoC from
+Nordic Semiconductors. It has an e-ink display on it, along with a CR2477
+battery holder.
+
+Papyr can be programmed with the [`Adafruit nRF52 bootloader`](https://github.com/adafruit/Adafruit_nRF52_Bootloader) to
+
+Schematic, datasheet default pin mapping etc. can be found over [here](https://docs.electronut.in/papyr/). The default pin mapping can be found in the board directory.
+
+## Installing CircuitPython submodules
+
+Before you can build, you will need to run the following commands once, which
+will install the submodules that are part of the CircuitPython ecosystem, and
+build the `mpy-cross` tool:
+
+```
+$ cd circuitpython
+$ git submodule update --init
+$ make -C mpy-cross
+```
+
+## Installing the Bootloader
+
+If the `Adafruit nRF52 bootloader` is installed on the board, then the
+bootloader allows you to update the core CircuitPython firmware and internal
+file system contents using serial, or USB CDC, or USB mass storage.
+
+On empty devices, the bootloader will need to be flashed once using a
+HW debugger such as a Segger J-Link, or Blackmagicprobe
+(or [Electronut labs Bumpy](https://docs.electronut.in/bumpy/)).
+
+
+## Building and Flashing CircuitPython
+
+No special notes for this, follow `ports/nrf` generic `README.md`.
+
+### Flashing CircuitPython with MSC UF2
+
+`uf2` file is generated last by `all` target.
+
+```
+$ cd ports/nrf
+$ make V=1 SD=s140 SERIAL=/dev/ttyACM0 BOARD=electronut_labs_papyr all
+...
+...
+python3 ../../tools/uf2/utils/uf2conv.py -f 0xADA52840 -c -o "build-electronut_labs_papyr-s140/firmware.uf2" build-electronut_labs_papyr-s140/firmware.hex
+Converting to uf2, output size: 536576, start address: 0x26000
+Wrote 536576 bytes to build-electronut_labs_papyr-s140/firmware.uf2
+```
+
+Simply drag and drop firmware.uf2 to the MSC, the nrf52840 will blink fast and reset after done.
+
+### Other tips
+
+Once circuitpython is running on your board, it will come up as a mass storage
+device named `CIRCUITPY`, where you can drop in your python code. The file names
+it looks for are `main.py`, `main.txt`, `code.py` or `code.txt`.
diff --git a/ports/nrf/boards/electronut_labs_papyr/board.c b/ports/nrf/boards/electronut_labs_papyr/board.c
new file mode 100644
index 000000000..4421970ee
--- /dev/null
+++ b/ports/nrf/boards/electronut_labs_papyr/board.c
@@ -0,0 +1,38 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "boards/board.h"
+
+void board_init(void) {
+}
+
+bool board_requests_safe_mode(void) {
+ return false;
+}
+
+void reset_board(void) {
+
+}
diff --git a/ports/nrf/boards/electronut_labs_papyr/mpconfigboard.h b/ports/nrf/boards/electronut_labs_papyr/mpconfigboard.h
new file mode 100644
index 000000000..7f5021fdc
--- /dev/null
+++ b/ports/nrf/boards/electronut_labs_papyr/mpconfigboard.h
@@ -0,0 +1,52 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 Glenn Ruben Bakke
+ * Copyright (c) 2018 Dan Halbert for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "nrfx/hal/nrf_gpio.h"
+
+#define ELECTRONUT_LABS_PAPYR
+
+#define MICROPY_HW_BOARD_NAME "Electronut Labs Papyr"
+#define MICROPY_HW_MCU_NAME "nRF52840"
+#define MICROPY_PY_SYS_PLATFORM "ElectronutLabsPapyr"
+
+#define CIRCUITPY_AUTORELOAD_DELAY_MS 500
+
+// TODO #define CIRCUITPY_INTERNAL_NVM_SIZE 8192
+
+#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
+
+#define BOARD_HAS_CRYSTAL 1
+
+#define DEFAULT_I2C_BUS_SCL (&pin_P0_06)
+#define DEFAULT_I2C_BUS_SDA (&pin_P0_05)
+
+#define DEFAULT_SPI_BUS_SCK (&pin_P0_31)
+#define DEFAULT_SPI_BUS_MOSI (&pin_P0_29)
+#define DEFAULT_SPI_BUS_MISO (&pin_P1_01)
+
+#define DEFAULT_UART_BUS_RX (&pin_P0_07)
+#define DEFAULT_UART_BUS_TX (&pin_P0_08)
diff --git a/ports/nrf/boards/electronut_labs_papyr/mpconfigboard.mk b/ports/nrf/boards/electronut_labs_papyr/mpconfigboard.mk
new file mode 100644
index 000000000..5aee244f1
--- /dev/null
+++ b/ports/nrf/boards/electronut_labs_papyr/mpconfigboard.mk
@@ -0,0 +1,22 @@
+USB_VID = 0x239A
+USB_PID = 0x803C
+USB_PRODUCT = "Papyr"
+USB_MANUFACTURER = "Electronut Labs"
+
+MCU_SERIES = m4
+MCU_VARIANT = nrf52
+MCU_SUB_VARIANT = nrf52840
+MCU_CHIP = nrf52840
+SD ?= s140
+SOFTDEV_VERSION ?= 6.1.0
+
+BOOT_SETTING_ADDR = 0xFF000
+
+ifeq ($(SD),)
+ LD_FILE = boards/nrf52840_1M_256k.ld
+else
+ LD_FILE = boards/adafruit_$(MCU_SUB_VARIANT)_$(SD_LOWER)_v$(firstword $(subst ., ,$(SOFTDEV_VERSION))).ld
+ CIRCUITPY_BLEIO = 1
+endif
+
+NRF_DEFINES += -DNRF52840_XXAA -DNRF52840 \ No newline at end of file
diff --git a/ports/nrf/boards/electronut_labs_papyr/pins.c b/ports/nrf/boards/electronut_labs_papyr/pins.c
new file mode 100644
index 000000000..ef0178e9b
--- /dev/null
+++ b/ports/nrf/boards/electronut_labs_papyr/pins.c
@@ -0,0 +1,44 @@
+#include "shared-bindings/board/__init__.h"
+
+STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_P0_05) },
+ { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_P0_06) },
+
+ { MP_ROM_QSTR(MP_QSTR_NFC1), MP_ROM_PTR(&pin_P0_09) },
+ { MP_ROM_QSTR(MP_QSTR_NFC2), MP_ROM_PTR(&pin_P0_10) },
+
+ { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P0_05) },
+ { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_P0_06) },
+ { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_P0_07) },
+ { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_P0_08) },
+ { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_P0_13) },
+ { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_P0_14) },
+ { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_P0_15) },
+
+ { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_31) },
+ { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_29) },
+ { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P1_01) },
+ { MP_ROM_QSTR(MP_QSTR_CS), MP_ROM_PTR(&pin_P0_30) },
+ { MP_ROM_QSTR(MP_QSTR_BUSY), MP_ROM_PTR(&pin_P0_03) },
+ { MP_ROM_QSTR(MP_QSTR_DC), MP_ROM_PTR(&pin_P0_28) },
+ { MP_ROM_QSTR(MP_QSTR_RES), MP_ROM_PTR(&pin_P0_02) },
+ { MP_ROM_QSTR(MP_QSTR_EINK_EN), MP_ROM_PTR(&pin_P0_11) },
+
+ { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_08) },
+ { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_07) },
+
+ { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_06) },
+ { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_05) },
+
+ { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_P0_14) },
+ { MP_ROM_QSTR(MP_QSTR_RED_LED), MP_ROM_PTR(&pin_P0_14) },
+
+ { MP_ROM_QSTR(MP_QSTR_BLUE_LED), MP_ROM_PTR(&pin_P0_15) },
+ { MP_ROM_QSTR(MP_QSTR_GREEN_LED), MP_ROM_PTR(&pin_P0_13) },
+
+ { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
+ { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
+ { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
+};
+
+MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
diff --git a/ports/nrf/boards/feather_nrf52840_express/pins.c b/ports/nrf/boards/feather_nrf52840_express/pins.c
index c6f643761..ec2689ab4 100644
--- a/ports/nrf/boards/feather_nrf52840_express/pins.c
+++ b/ports/nrf/boards/feather_nrf52840_express/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_04) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_05) },
diff --git a/ports/nrf/boards/makerdiary_nrf52840_mdk/pins.c b/ports/nrf/boards/makerdiary_nrf52840_mdk/pins.c
index 2d24e8597..5284c2484 100644
--- a/ports/nrf/boards/makerdiary_nrf52840_mdk/pins.c
+++ b/ports/nrf/boards/makerdiary_nrf52840_mdk/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_AIN0), MP_ROM_PTR(&pin_P0_02) },
{ MP_ROM_QSTR(MP_QSTR_AIN1), MP_ROM_PTR(&pin_P0_03) },
diff --git a/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/pins.c b/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/pins.c
index 10490c8cb..006b24768 100644
--- a/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/pins.c
+++ b/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_AIN0), MP_ROM_PTR(&pin_P0_02) },
{ MP_ROM_QSTR(MP_QSTR_AIN1), MP_ROM_PTR(&pin_P0_03) },
diff --git a/ports/nrf/boards/particle_argon/pins.c b/ports/nrf/boards/particle_argon/pins.c
index 10d547f91..9fab9e6b6 100644
--- a/ports/nrf/boards/particle_argon/pins.c
+++ b/ports/nrf/boards/particle_argon/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_03) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_04) },
diff --git a/ports/nrf/boards/particle_boron/pins.c b/ports/nrf/boards/particle_boron/pins.c
index 0b827a85a..4d6f3e7de 100644
--- a/ports/nrf/boards/particle_boron/pins.c
+++ b/ports/nrf/boards/particle_boron/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_03) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_04) },
diff --git a/ports/nrf/boards/particle_xenon/pins.c b/ports/nrf/boards/particle_xenon/pins.c
index 644face61..a50c8b641 100644
--- a/ports/nrf/boards/particle_xenon/pins.c
+++ b/ports/nrf/boards/particle_xenon/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_03) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_04) },
diff --git a/ports/nrf/boards/pca10056/pins.c b/ports/nrf/boards/pca10056/pins.c
index 510b6100e..e00bc8a11 100644
--- a/ports/nrf/boards/pca10056/pins.c
+++ b/ports/nrf/boards/pca10056/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_P0_00), MP_ROM_PTR(&pin_P0_00) },
{ MP_ROM_QSTR(MP_QSTR_P0_01), MP_ROM_PTR(&pin_P0_01) },
diff --git a/ports/nrf/boards/pca10059/pins.c b/ports/nrf/boards/pca10059/pins.c
index c43d3a9eb..932b925d1 100644
--- a/ports/nrf/boards/pca10059/pins.c
+++ b/ports/nrf/boards/pca10059/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_P0_02), MP_ROM_PTR(&pin_P0_02) },
{ MP_ROM_QSTR(MP_QSTR_P0_04), MP_ROM_PTR(&pin_P0_04) },
diff --git a/ports/nrf/boards/sparkfun_nrf52840_mini/pins.c b/ports/nrf/boards/sparkfun_nrf52840_mini/pins.c
index f826ac771..e7b61db58 100644
--- a/ports/nrf/boards/sparkfun_nrf52840_mini/pins.c
+++ b/ports/nrf/boards/sparkfun_nrf52840_mini/pins.c
@@ -1,7 +1,5 @@
#include "shared-bindings/board/__init__.h"
-#include "supervisor/shared/board_busses.h"
-
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_P1_15) }, // D1/TX
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_P0_17) }, // D0/RX
diff --git a/ports/nrf/common-hal/bleio/Characteristic.c b/ports/nrf/common-hal/bleio/Characteristic.c
index 1db564549..c9088c2ab 100644
--- a/ports/nrf/common-hal/bleio/Characteristic.c
+++ b/ports/nrf/common-hal/bleio/Characteristic.c
@@ -129,7 +129,7 @@ STATIC void gatts_notify_indicate(bleio_characteristic_obj_t *characteristic, mp
const uint32_t err_code = sd_ble_gatts_hvx(conn_handle, &hvx_params);
if (err_code != NRF_SUCCESS) {
m_tx_in_progress--;
- mp_raise_OSError_msg_varg(translate("Failed to notify or indicate attribute value, err %0x04x"), err_code);
+ mp_raise_OSError_msg_varg(translate("Failed to notify or indicate attribute value, err 0x%04x"), err_code);
}
}
@@ -141,7 +141,7 @@ STATIC void gattc_read(bleio_characteristic_obj_t *characteristic) {
const uint32_t err_code = sd_ble_gattc_read(conn_handle, characteristic->handle, 0);
if (err_code != NRF_SUCCESS) {
- mp_raise_OSError_msg_varg(translate("Failed to read attribute value, err %0x04x"), err_code);
+ mp_raise_OSError_msg_varg(translate("Failed to read attribute value, err 0x%04x"), err_code);
}
//
diff --git a/ports/nrf/common-hal/busio/SPI.c b/ports/nrf/common-hal/busio/SPI.c
index 19bd4d1ba..8881bdc6b 100644
--- a/ports/nrf/common-hal/busio/SPI.c
+++ b/ports/nrf/common-hal/busio/SPI.c
@@ -327,3 +327,11 @@ uint32_t common_hal_busio_spi_get_frequency(busio_spi_obj_t* self) {
return 0;
}
}
+
+uint8_t common_hal_busio_spi_get_phase(busio_spi_obj_t* self) {
+ return 0;
+}
+
+uint8_t common_hal_busio_spi_get_polarity(busio_spi_obj_t* self) {
+ return 0;
+}
diff --git a/ports/nrf/common-hal/rtc/RTC.c b/ports/nrf/common-hal/rtc/RTC.c
new file mode 100644
index 000000000..57138350c
--- /dev/null
+++ b/ports/nrf/common-hal/rtc/RTC.c
@@ -0,0 +1,90 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Nick Moore for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <stdlib.h>
+
+#include "py/obj.h"
+#include "py/runtime.h"
+#include "lib/timeutils/timeutils.h"
+#include "shared-bindings/rtc/__init__.h"
+#include "supervisor/shared/translate.h"
+
+#include "nrfx_rtc.h"
+#include "nrf_clock.h"
+
+// We clock the RTC very slowly (8Hz) so that it won't overflow often.
+// But the counter is only 24 bits, so overflow is about every 24 days ...
+// For testing, set this to 32768 and it'll overflow every few minutes
+
+#define RTC_CLOCK_HZ (8)
+
+volatile static uint32_t rtc_offset = 0;
+
+const nrfx_rtc_t rtc_instance = NRFX_RTC_INSTANCE(2);
+
+const nrfx_rtc_config_t rtc_config = {
+ .prescaler = RTC_FREQ_TO_PRESCALER(RTC_CLOCK_HZ),
+ .reliable = 0,
+ .tick_latency = 0,
+ .interrupt_priority = 6
+};
+
+void rtc_handler(nrfx_rtc_int_type_t int_type) {
+ if (int_type == NRFX_RTC_INT_OVERFLOW) {
+ rtc_offset += (1L<<24) / RTC_CLOCK_HZ;
+ }
+}
+
+void rtc_init(void) {
+ if (!nrf_clock_lf_is_running()) {
+ nrf_clock_task_trigger(NRF_CLOCK_TASK_LFCLKSTART);
+ }
+ nrfx_rtc_counter_clear(&rtc_instance);
+ nrfx_rtc_init(&rtc_instance, &rtc_config, rtc_handler);
+ nrfx_rtc_enable(&rtc_instance);
+ nrfx_rtc_overflow_enable(&rtc_instance, 1);
+}
+
+void common_hal_rtc_get_time(timeutils_struct_time_t *tm) {
+ uint32_t t = rtc_offset + (nrfx_rtc_counter_get(&rtc_instance) / RTC_CLOCK_HZ );
+ timeutils_seconds_since_2000_to_struct_time(t, tm);
+}
+
+void common_hal_rtc_set_time(timeutils_struct_time_t *tm) {
+ rtc_offset = timeutils_seconds_since_2000(
+ tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec
+ );
+ nrfx_rtc_counter_clear(&rtc_instance);
+}
+
+int common_hal_rtc_get_calibration(void) {
+ return 0;
+}
+
+void common_hal_rtc_set_calibration(int calibration) {
+ mp_raise_NotImplementedError(translate("RTC calibration is not supported on this board"));
+}
+
diff --git a/ports/nrf/common-hal/rtc/RTC.h b/ports/nrf/common-hal/rtc/RTC.h
new file mode 100644
index 000000000..0207c8338
--- /dev/null
+++ b/ports/nrf/common-hal/rtc/RTC.h
@@ -0,0 +1,33 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2018 Noralf Trønnes
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef MICROPY_INCLUDED_NRF_COMMON_HAL_RTC_RTC_H
+#define MICROPY_INCLUDED_NRF_COMMON_HAL_RTC_RTC_H
+
+extern void rtc_init(void);
+extern void rtc_reset(void);
+
+#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_RTC_RTC_H
diff --git a/ports/nrf/common-hal/rtc/__init__.c b/ports/nrf/common-hal/rtc/__init__.c
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ports/nrf/common-hal/rtc/__init__.c
diff --git a/ports/nrf/mpconfigport.h b/ports/nrf/mpconfigport.h
index 1b2d8ea12..5ed521e85 100644
--- a/ports/nrf/mpconfigport.h
+++ b/ports/nrf/mpconfigport.h
@@ -57,5 +57,4 @@
CIRCUITPY_COMMON_ROOT_POINTERS \
ble_drv_evt_handler_entry_t* ble_drv_evt_handler_entries; \
-
#endif // NRF5_MPCONFIGPORT_H__
diff --git a/ports/nrf/mpconfigport.mk b/ports/nrf/mpconfigport.mk
index badfb6735..fdeb1bbbe 100644
--- a/ports/nrf/mpconfigport.mk
+++ b/ports/nrf/mpconfigport.mk
@@ -22,8 +22,8 @@ CIRCUITPY_I2CSLAVE = 0
# nvm not yet implemented
CIRCUITPY_NVM = 0
-# rtc not yet implemented
-CIRCUITPY_RTC = 0
+# enable RTC
+CIRCUITPY_RTC = 1
# frequencyio not yet implemented
CIRCUITPY_FREQUENCYIO = 0
diff --git a/ports/nrf/nrfx_config.h b/ports/nrf/nrfx_config.h
index 57a2727aa..d51739fac 100644
--- a/ports/nrf/nrfx_config.h
+++ b/ports/nrf/nrfx_config.h
@@ -70,6 +70,11 @@
#define NRFX_PWM3_ENABLED 0
#endif
+#define NRFX_RTC_ENABLED 1
+#define NRFX_RTC0_ENABLED 1
+#define NRFX_RTC1_ENABLED 1
+#define NRFX_RTC2_ENABLED 1
+
// TIMERS
#define NRFX_TIMER_ENABLED 1
// Don't enable TIMER0: it's used by the SoftDevice.
diff --git a/ports/nrf/supervisor/internal_flash.c b/ports/nrf/supervisor/internal_flash.c
index 273213244..c18b708a3 100644
--- a/ports/nrf/supervisor/internal_flash.c
+++ b/ports/nrf/supervisor/internal_flash.c
@@ -137,6 +137,9 @@ void supervisor_flash_flush(void) {
_flash_page_addr = NO_CACHE;
}
+void supervisor_flash_release_cache(void) {
+}
+
mp_uint_t supervisor_flash_read_blocks(uint8_t *dest, uint32_t block, uint32_t num_blocks) {
// Must write out anything in cache before trying to read.
supervisor_flash_flush();
diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c
index fd077a46a..85ecd6afe 100644
--- a/ports/nrf/supervisor/port.c
+++ b/ports/nrf/supervisor/port.c
@@ -45,8 +45,11 @@
#include "common-hal/pulseio/PWMOut.h"
#include "common-hal/pulseio/PulseOut.h"
#include "common-hal/pulseio/PulseIn.h"
+#include "common-hal/rtc/RTC.h"
#include "tick.h"
+#include "shared-bindings/rtc/__init__.h"
+
static void power_warning_handler(void) {
reset_into_safe_mode(BROWNOUT);
}
@@ -72,6 +75,10 @@ safe_mode_t port_init(void) {
// Configure millisecond timer initialization.
tick_init();
+ #if CIRCUITPY_RTC
+ rtc_init();
+ #endif
+
// Will do usb_init() if chip supports USB.
board_init();
@@ -91,6 +98,10 @@ void reset_port(void) {
pulsein_reset();
timers_reset();
+ #if CIRCUITPY_RTC
+ rtc_reset();
+ #endif
+
bleio_reset();
reset_all_pins();
diff --git a/ports/nrf/supervisor/qspi_flash.c b/ports/nrf/supervisor/qspi_flash.c
index 51a9ec032..bb449d881 100644
--- a/ports/nrf/supervisor/qspi_flash.c
+++ b/ports/nrf/supervisor/qspi_flash.c
@@ -47,8 +47,7 @@ bool spi_flash_command(uint8_t command) {
.wipwait = false,
.wren = false
};
- nrfx_qspi_cinstr_xfer(&cinstr_cfg, NULL, NULL);
- return true;
+ return nrfx_qspi_cinstr_xfer(&cinstr_cfg, NULL, NULL) == NRFX_SUCCESS;
}
bool spi_flash_read_command(uint8_t command, uint8_t* response, uint32_t length) {
diff --git a/ports/nrf/tick.c b/ports/nrf/tick.c
index cdd329f71..6d8fd13e0 100644
--- a/ports/nrf/tick.c
+++ b/ports/nrf/tick.c
@@ -27,6 +27,7 @@
#include "tick.h"
#include "supervisor/shared/autoreload.h"
+#include "supervisor/filesystem.h"
#include "shared-module/gamepad/__init__.h"
#include "shared-bindings/microcontroller/Processor.h"
#include "nrf.h"
@@ -39,14 +40,17 @@ void SysTick_Handler(void) {
// (every millisecond).
ticks_ms += 1;
- #ifdef CIRCUITPY_AUTORELOAD_DELAY_MS
- autoreload_tick();
- #endif
- #ifdef CIRCUITPY_GAMEPAD_TICKS
+#if CIRCUITPY_FILESYSTEM_FLUSH_INTERVAL_MS > 0
+ filesystem_tick();
+#endif
+#ifdef CIRCUITPY_AUTORELOAD_DELAY_MS
+ autoreload_tick();
+#endif
+#ifdef CIRCUITPY_GAMEPAD_TICKS
if (!(ticks_ms & CIRCUITPY_GAMEPAD_TICKS)) {
gamepad_tick();
}
- #endif
+#endif
}
void tick_init() {