summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew Fustini <drew@pdp7.com>2020-02-10 00:11:35 +0100
committerGitHub <noreply@github.com>2020-02-10 00:11:35 +0100
commit7bdc8b36a697cff816e6e449706bb060f66b3229 (patch)
tree5e7ef62c0a1635febaf90734638d161d9f9228bd
parent3aed0a1fd721550bedd8f2258707f58eb9927404 (diff)
parentb93d6e861b80d34ff3b09f4f84a85a6bfd531f3d (diff)
Merge pull request #1 from adafruit/master
update to adafruit master
-rw-r--r--.github/workflows/build.yml4
-rw-r--r--extmod/vfs_fat_file.c3
-rw-r--r--locale/ID.po8
-rw-r--r--locale/circuitpython.pot8
-rw-r--r--locale/de_DE.po16
-rw-r--r--locale/en_US.po8
-rw-r--r--locale/en_x_pirate.po8
-rw-r--r--locale/es.po18
-rw-r--r--locale/fil.po15
-rw-r--r--locale/fr.po20
-rw-r--r--locale/it_IT.po16
-rw-r--r--locale/ko.po8
-rw-r--r--locale/pl.po18
-rw-r--r--locale/pt_BR.po8
-rw-r--r--locale/zh_Latn_pinyin.po18
-rwxr-xr-xports/atmel-samd/boards/circuitbrains_basic_m0/board.c40
-rwxr-xr-xports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.h35
-rwxr-xr-xports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.mk16
-rwxr-xr-xports/atmel-samd/boards/circuitbrains_basic_m0/pins.c35
-rwxr-xr-xports/atmel-samd/boards/circuitbrains_deluxe_m4/board.c40
-rwxr-xr-xports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.h32
-rwxr-xr-xports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.mk16
-rwxr-xr-xports/atmel-samd/boards/circuitbrains_deluxe_m4/pins.c55
-rw-r--r--ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk3
-rw-r--r--ports/atmel-samd/boards/pybadge/board.c4
-rw-r--r--ports/atmel-samd/boards/pygamer/board.c4
-rw-r--r--ports/atmel-samd/common-hal/time/__init__.c11
-rw-r--r--ports/cxd56/common-hal/time/__init__.c8
-rw-r--r--ports/mimxrt10xx/common-hal/time/__init__.c12
-rw-r--r--ports/nrf/boards/feather_bluefruit_sense/board.c38
-rw-r--r--ports/nrf/boards/feather_bluefruit_sense/mpconfigboard.h70
-rw-r--r--ports/nrf/boards/feather_bluefruit_sense/mpconfigboard.mk10
-rw-r--r--ports/nrf/boards/feather_bluefruit_sense/pins.c58
-rw-r--r--ports/nrf/boards/ohs2020_badge/board.c10
-rw-r--r--ports/nrf/boards/ohs2020_badge/mpconfigboard.h4
-rw-r--r--ports/nrf/boards/ohs2020_badge/mpconfigboard.mk2
-rw-r--r--ports/nrf/boards/ohs2020_badge/pins.c6
-rw-r--r--ports/nrf/common-hal/_bleio/Adapter.c4
-rw-r--r--ports/nrf/common-hal/busio/I2C.c14
-rw-r--r--ports/nrf/common-hal/time/__init__.c8
-rwxr-xr-xports/stm32f4/Makefile49
-rw-r--r--ports/stm32f4/boards/STM32F401xd_fs.ld (renamed from ports/stm32f4/boards/STM32F401.ld)53
-rw-r--r--ports/stm32f4/boards/STM32F401xe_boot.ld (renamed from ports/stm32f4/boards/STM32F401_boot.ld)6
-rw-r--r--ports/stm32f4/boards/STM32F401xe_fs.ld (renamed from ports/stm32f4/boards/STM32F401_fs.ld)0
-rw-r--r--ports/stm32f4/boards/STM32F405_boot.ld107
-rw-r--r--ports/stm32f4/boards/STM32F405_default.ld107
-rw-r--r--ports/stm32f4/boards/STM32F405_fs.ld (renamed from ports/stm32f4/boards/STM32F405.ld)0
-rw-r--r--ports/stm32f4/boards/espruino_pico/README.md15
-rw-r--r--ports/stm32f4/boards/espruino_pico/board.c39
-rw-r--r--ports/stm32f4/boards/espruino_pico/mpconfigboard.h39
-rw-r--r--ports/stm32f4/boards/espruino_pico/mpconfigboard.mk16
-rw-r--r--ports/stm32f4/boards/espruino_pico/pins.c33
-rw-r--r--ports/stm32f4/boards/espruino_pico/stm32f4xx_hal_conf.h440
-rw-r--r--ports/stm32f4/boards/feather_stm32f405_express/mpconfigboard.h5
-rw-r--r--ports/stm32f4/boards/feather_stm32f405_express/mpconfigboard.mk9
-rw-r--r--ports/stm32f4/boards/meowbit_v121/mpconfigboard.mk5
-rw-r--r--ports/stm32f4/boards/pyb_nano_v2/mpconfigboard.mk3
-rw-r--r--ports/stm32f4/boards/pyboard_v11/mpconfigboard.mk5
-rw-r--r--ports/stm32f4/boards/stm32f411ce_blackpill/mpconfigboard.mk3
-rw-r--r--ports/stm32f4/boards/stm32f411ve_discovery/mpconfigboard.mk3
-rw-r--r--ports/stm32f4/boards/stm32f412zg_discovery/mpconfigboard.mk3
-rw-r--r--ports/stm32f4/common-hal/time/__init__.c8
-rw-r--r--ports/stm32f4/peripherals/stm32f4/stm32f401xe/clocks.c3
-rw-r--r--ports/stm32f4/peripherals/stm32f4/stm32f401xe/gpio.c1
-rw-r--r--py/objexcept.c22
-rw-r--r--py/runtime.c10
-rw-r--r--py/runtime.h1
-rw-r--r--shared-bindings/displayio/Palette.c12
-rw-r--r--shared-bindings/time/__init__.c10
-rw-r--r--shared-bindings/time/__init__.h1
-rw-r--r--supervisor/shared/external_flash/devices.h17
71 files changed, 1563 insertions, 173 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 50fafdc7f..fc4aab5be 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -130,6 +130,8 @@ jobs:
- "bast_pro_mini_m0"
- "capablerobot_usbhub"
- "catwan_usbstick"
+ - "circuitbrains_basic_m0"
+ - "circuitbrains_deluxe_m4"
- "circuitplayground_bluefruit"
- "circuitplayground_express"
- "circuitplayground_express_crickit"
@@ -144,6 +146,8 @@ jobs:
- "electronut_labs_blip"
- "electronut_labs_papyr"
- "escornabot_makech"
+ - "espruino_pico"
+ - "feather_bluefruit_sense"
- "feather_m0_adalogger"
- "feather_m0_basic"
- "feather_m0_express"
diff --git a/extmod/vfs_fat_file.c b/extmod/vfs_fat_file.c
index 3ea9cee52..422f057a8 100644
--- a/extmod/vfs_fat_file.c
+++ b/extmod/vfs_fat_file.c
@@ -28,6 +28,7 @@
#if MICROPY_VFS && MICROPY_VFS_FAT
#include <stdio.h>
+#include <string.h>
#include "py/runtime.h"
#include "py/stream.h"
@@ -199,7 +200,7 @@ STATIC mp_obj_t file_open(fs_user_mount_t *vfs, const mp_obj_type_t *type, mp_ar
FRESULT res = f_open(&vfs->fatfs, &o->fp, fname, mode);
if (res != FR_OK) {
m_del_obj(pyb_file_obj_t, o);
- mp_raise_OSError(fresult_to_errno_table[res]);
+ mp_raise_OSError_errno_str(fresult_to_errno_table[res], args[0].u_obj);
}
// If we're reading, turn on fast seek.
if (mode == FA_READ) {
diff --git a/locale/ID.po b/locale/ID.po
index 36bfc4df6..bcdad2994 100644
--- a/locale/ID.po
+++ b/locale/ID.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-01-29 17:27-0800\n"
+"POT-Creation-Date: 2020-02-05 15:55-0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -676,6 +676,10 @@ msgstr ""
msgid "Expected tuple of length %d, got %d"
msgstr ""
+#: ports/nrf/common-hal/_bleio/Adapter.c
+msgid "Extended advertisements with scan response not supported."
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr ""
@@ -1845,7 +1849,7 @@ msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)"
msgstr ""
#: shared-bindings/displayio/Palette.c
-msgid "color buffer must be a buffer or int"
+msgid "color buffer must be a buffer, tuple, list, or int"
msgstr ""
#: shared-bindings/displayio/Palette.c
diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot
index f85bcba83..3e4413068 100644
--- a/locale/circuitpython.pot
+++ b/locale/circuitpython.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-01-29 17:27-0800\n"
+"POT-Creation-Date: 2020-02-07 10:02-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -665,6 +665,10 @@ msgstr ""
msgid "Expected tuple of length %d, got %d"
msgstr ""
+#: ports/nrf/common-hal/_bleio/Adapter.c
+msgid "Extended advertisements with scan response not supported."
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr ""
@@ -1821,7 +1825,7 @@ msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)"
msgstr ""
#: shared-bindings/displayio/Palette.c
-msgid "color buffer must be a buffer or int"
+msgid "color buffer must be a buffer, tuple, list, or int"
msgstr ""
#: shared-bindings/displayio/Palette.c
diff --git a/locale/de_DE.po b/locale/de_DE.po
index ba1915e43..f2d8537f6 100644
--- a/locale/de_DE.po
+++ b/locale/de_DE.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-01-29 17:27-0800\n"
+"POT-Creation-Date: 2020-02-05 15:55-0800\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: Pascal Deneaux\n"
"Language-Team: Sebastian Plamauer, Pascal Deneaux\n"
@@ -669,6 +669,10 @@ msgstr "Erwartet eine Adresse"
msgid "Expected tuple of length %d, got %d"
msgstr "Habe ein Tupel der Länge %d erwartet aber %d erhalten"
+#: ports/nrf/common-hal/_bleio/Adapter.c
+msgid "Extended advertisements with scan response not supported."
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr "Kommando nicht gesendet."
@@ -1849,8 +1853,8 @@ msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)"
msgstr "Farbpuffer muss 3 Bytes (RGB) oder 4 Bytes (RGB + pad byte) sein"
#: shared-bindings/displayio/Palette.c
-msgid "color buffer must be a buffer or int"
-msgstr "Farbpuffer muss ein Puffer oder ein int sein"
+msgid "color buffer must be a buffer, tuple, list, or int"
+msgstr ""
#: shared-bindings/displayio/Palette.c
msgid "color buffer must be a bytearray or array of type 'b' or 'B'"
@@ -2853,7 +2857,6 @@ msgstr ""
#~ msgid "C-level assert"
#~ msgstr "C-Level Assert"
-#, c-format
#~ msgid "Can not use dotstar with %s"
#~ msgstr "Kann dotstar nicht mit %s verwenden"
@@ -3167,17 +3170,18 @@ msgstr ""
#~ "Sie laufen im abgesicherten Modus, was bedeutet, dass etwas Unerwartetes "
#~ "passiert ist.\n"
-#, c-format
#~ msgid "buf is too small. need %d bytes"
#~ msgstr "buf ist zu klein. brauche %d Bytes"
#~ msgid "buffer too long"
#~ msgstr "Buffer zu lang"
-#, c-format
#~ msgid "byteorder is not an instance of ByteOrder (got a %s)"
#~ msgstr "byteorder ist keine Instanz von ByteOrder (%s erhalten)"
+#~ msgid "color buffer must be a buffer or int"
+#~ msgstr "Farbpuffer muss ein Puffer oder ein int sein"
+
#~ msgid "expected a DigitalInOut"
#~ msgstr "erwarte DigitalInOut"
diff --git a/locale/en_US.po b/locale/en_US.po
index c6a78b505..680c535a9 100644
--- a/locale/en_US.po
+++ b/locale/en_US.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-01-29 17:27-0800\n"
+"POT-Creation-Date: 2020-02-05 15:55-0800\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -665,6 +665,10 @@ msgstr ""
msgid "Expected tuple of length %d, got %d"
msgstr ""
+#: ports/nrf/common-hal/_bleio/Adapter.c
+msgid "Extended advertisements with scan response not supported."
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr ""
@@ -1821,7 +1825,7 @@ msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)"
msgstr ""
#: shared-bindings/displayio/Palette.c
-msgid "color buffer must be a buffer or int"
+msgid "color buffer must be a buffer, tuple, list, or int"
msgstr ""
#: shared-bindings/displayio/Palette.c
diff --git a/locale/en_x_pirate.po b/locale/en_x_pirate.po
index 12ca1d608..5ff575cdf 100644
--- a/locale/en_x_pirate.po
+++ b/locale/en_x_pirate.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-01-29 17:27-0800\n"
+"POT-Creation-Date: 2020-02-05 15:55-0800\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: @sommersoft, @MrCertainly\n"
@@ -669,6 +669,10 @@ msgstr ""
msgid "Expected tuple of length %d, got %d"
msgstr ""
+#: ports/nrf/common-hal/_bleio/Adapter.c
+msgid "Extended advertisements with scan response not supported."
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr ""
@@ -1825,7 +1829,7 @@ msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)"
msgstr ""
#: shared-bindings/displayio/Palette.c
-msgid "color buffer must be a buffer or int"
+msgid "color buffer must be a buffer, tuple, list, or int"
msgstr ""
#: shared-bindings/displayio/Palette.c
diff --git a/locale/es.po b/locale/es.po
index b4e098165..873c4d3e7 100644
--- a/locale/es.po
+++ b/locale/es.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-01-29 17:27-0800\n"
+"POT-Creation-Date: 2020-02-05 15:55-0800\n"
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -671,6 +671,10 @@ msgstr ""
msgid "Expected tuple of length %d, got %d"
msgstr "Se esperaba un tuple de %d, se obtuvo %d"
+#: ports/nrf/common-hal/_bleio/Adapter.c
+msgid "Extended advertisements with scan response not supported."
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr "Fallo enviando comando"
@@ -1850,8 +1854,8 @@ msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)"
msgstr "color buffer debe ser 3 bytes (RGB) ó 4 bytes (RGB + pad byte)"
#: shared-bindings/displayio/Palette.c
-msgid "color buffer must be a buffer or int"
-msgstr "color buffer deber ser un buffer o un int"
+msgid "color buffer must be a buffer, tuple, list, or int"
+msgstr ""
#: shared-bindings/displayio/Palette.c
msgid "color buffer must be a bytearray or array of type 'b' or 'B'"
@@ -2853,7 +2857,6 @@ msgstr "paso cero"
#~ "Intento de allocation de heap cuando la VM de MicroPython no estaba "
#~ "corriendo.\n"
-#, c-format
#~ msgid "Can not use dotstar with %s"
#~ msgstr "No se puede usar dotstar con %s"
@@ -3194,14 +3197,12 @@ msgstr "paso cero"
#~ msgid "bad GATT role"
#~ msgstr "mal GATT role"
-#, c-format
#~ msgid "buf is too small. need %d bytes"
#~ msgstr "buf es demasiado pequeño. necesita %d bytes"
#~ msgid "buffer too long"
#~ msgstr "buffer demasiado largo"
-#, c-format
#~ msgid "byteorder is not an instance of ByteOrder (got a %s)"
#~ msgstr "byteorder no es instancia de ByteOrder (encontarmos un %s)"
@@ -3223,6 +3224,9 @@ msgstr "paso cero"
#~ msgid "characteristics includes an object that is not a Characteristic"
#~ msgstr "characteristics incluye un objeto que no es una Characteristica"
+#~ msgid "color buffer must be a buffer or int"
+#~ msgstr "color buffer deber ser un buffer o un int"
+
#~ msgid "either pos or kw args are allowed"
#~ msgstr "ya sea pos o kw args son permitidos"
@@ -3312,11 +3316,9 @@ msgstr "paso cero"
#~ msgid "unknown config param"
#~ msgstr "parámetro config desconocido"
-#, c-format
#~ msgid "unknown format code '%c' for object of type 'float'"
#~ msgstr "codigo format desconocido '%c' para el typo de objeto 'float'"
-#, c-format
#~ msgid "unknown format code '%c' for object of type 'str'"
#~ msgstr "codigo format desconocido '%c' para objeto de tipo 'str'"
diff --git a/locale/fil.po b/locale/fil.po
index 86378ba10..63feb3316 100644
--- a/locale/fil.po
+++ b/locale/fil.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-01-29 17:27-0800\n"
+"POT-Creation-Date: 2020-02-05 15:55-0800\n"
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
"Language-Team: fil\n"
@@ -679,6 +679,10 @@ msgstr ""
msgid "Expected tuple of length %d, got %d"
msgstr ""
+#: ports/nrf/common-hal/_bleio/Adapter.c
+msgid "Extended advertisements with scan response not supported."
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr ""
@@ -1861,8 +1865,8 @@ msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)"
msgstr "color buffer ay dapat na 3 bytes (RGB) o 4 bytes (RGB + pad byte)"
#: shared-bindings/displayio/Palette.c
-msgid "color buffer must be a buffer or int"
-msgstr "color buffer ay dapat buffer or int"
+msgid "color buffer must be a buffer, tuple, list, or int"
+msgstr ""
#: shared-bindings/displayio/Palette.c
msgid "color buffer must be a bytearray or array of type 'b' or 'B'"
@@ -3176,6 +3180,9 @@ msgstr "zero step"
#~ msgid "can't set STA config"
#~ msgstr "hindi makuha ang STA config"
+#~ msgid "color buffer must be a buffer or int"
+#~ msgstr "color buffer ay dapat buffer or int"
+
#~ msgid "either pos or kw args are allowed"
#~ msgstr "pos o kw args ang pinahihintulutan"
@@ -3254,11 +3261,9 @@ msgstr "zero step"
#~ msgid "unknown config param"
#~ msgstr "hindi alam na config param"
-#, c-format
#~ msgid "unknown format code '%c' for object of type 'float'"
#~ msgstr "hindi alam ang format code '%c' sa object na ang type ay 'float'"
-#, c-format
#~ msgid "unknown format code '%c' for object of type 'str'"
#~ msgstr ""
#~ "hindi alam ang format ng code na '%c' para sa object ng type ay 'str'"
diff --git a/locale/fr.po b/locale/fr.po
index b522b253d..ba1d56211 100644
--- a/locale/fr.po
+++ b/locale/fr.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-01-29 17:27-0800\n"
+"POT-Creation-Date: 2020-02-05 15:55-0800\n"
"PO-Revision-Date: 2019-04-14 20:05+0100\n"
"Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n"
"Language-Team: fr\n"
@@ -682,6 +682,10 @@ msgstr ""
msgid "Expected tuple of length %d, got %d"
msgstr "Tuple de longueur %d attendu, obtenu %d"
+#: ports/nrf/common-hal/_bleio/Adapter.c
+msgid "Extended advertisements with scan response not supported."
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr ""
@@ -1884,9 +1888,8 @@ msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)"
msgstr "le tampon de couleur doit faire 3 octets (RVB) ou 4 (RVB + pad byte)"
#: shared-bindings/displayio/Palette.c
-#, fuzzy
-msgid "color buffer must be a buffer or int"
-msgstr "le tampon de couleur doit être un tampon ou un entier 'int'"
+msgid "color buffer must be a buffer, tuple, list, or int"
+msgstr ""
#: shared-bindings/displayio/Palette.c
#, fuzzy
@@ -2903,7 +2906,6 @@ msgstr "'step' nul"
#~ msgstr ""
#~ "Tentative d'allocation de tas alors que la VM MicroPython ne tourne pas.\n"
-#, c-format
#~ msgid "Can not use dotstar with %s"
#~ msgstr "Impossible d'utiliser 'dotstar' avec %s"
@@ -3253,14 +3255,12 @@ msgstr "'step' nul"
#~ msgid "bad GATT role"
#~ msgstr "mauvais rôle GATT"
-#, c-format
#~ msgid "buf is too small. need %d bytes"
#~ msgstr "'buf' est trop petit. Besoin de %d octets"
#~ msgid "buffer too long"
#~ msgstr "tampon trop long"
-#, c-format
#~ msgid "byteorder is not an instance of ByteOrder (got a %s)"
#~ msgstr "'byteorder' n'est pas une instance de ByteOrder (reçu un %s)"
@@ -3283,6 +3283,10 @@ msgstr "'step' nul"
#~ msgstr ""
#~ "'characteristics' inclut un objet qui n'est pas une 'Characteristic'"
+#, fuzzy
+#~ msgid "color buffer must be a buffer or int"
+#~ msgstr "le tampon de couleur doit être un tampon ou un entier 'int'"
+
#~ msgid "either pos or kw args are allowed"
#~ msgstr "soit 'pos', soit 'kw' est permis en argument"
@@ -3368,11 +3372,9 @@ msgstr "'step' nul"
#~ msgid "unknown config param"
#~ msgstr "paramètre de config. inconnu"
-#, c-format
#~ msgid "unknown format code '%c' for object of type 'float'"
#~ msgstr "code de format '%c' inconnu pour un objet de type 'float'"
-#, c-format
#~ msgid "unknown format code '%c' for object of type 'str'"
#~ msgstr "code de format '%c' inconnu pour un objet de type 'str'"
diff --git a/locale/it_IT.po b/locale/it_IT.po
index e4a06b769..6bc116f21 100644
--- a/locale/it_IT.po
+++ b/locale/it_IT.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-01-29 17:27-0800\n"
+"POT-Creation-Date: 2020-02-05 15:55-0800\n"
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
"Language-Team: \n"
@@ -679,6 +679,10 @@ msgstr ""
msgid "Expected tuple of length %d, got %d"
msgstr ""
+#: ports/nrf/common-hal/_bleio/Adapter.c
+msgid "Extended advertisements with scan response not supported."
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr ""
@@ -1862,8 +1866,8 @@ msgstr ""
"il buffer del colore deve esseer di 3 byte (RGB) o 4 byte (RGB + pad byte)"
#: shared-bindings/displayio/Palette.c
-msgid "color buffer must be a buffer or int"
-msgstr "il buffer del colore deve essere un buffer o un int"
+msgid "color buffer must be a buffer, tuple, list, or int"
+msgstr ""
#: shared-bindings/displayio/Palette.c
msgid "color buffer must be a bytearray or array of type 'b' or 'B'"
@@ -2870,7 +2874,6 @@ msgstr "zero step"
#~ msgid "C-level assert"
#~ msgstr "assert a livello C"
-#, c-format
#~ msgid "Can not use dotstar with %s"
#~ msgstr "dotstar non può essere usato con %s"
@@ -3166,6 +3169,9 @@ msgstr "zero step"
#~ msgid "can't set STA config"
#~ msgstr "impossibile impostare le configurazioni della STA"
+#~ msgid "color buffer must be a buffer or int"
+#~ msgstr "il buffer del colore deve essere un buffer o un int"
+
#~ msgid "either pos or kw args are allowed"
#~ msgstr "sono permesse solo gli argomenti pos o kw"
@@ -3241,12 +3247,10 @@ msgstr "zero step"
#~ msgid "unknown config param"
#~ msgstr "parametro di configurazione sconosciuto"
-#, c-format
#~ msgid "unknown format code '%c' for object of type 'float'"
#~ msgstr ""
#~ "codice di formattazione '%c' sconosciuto per oggetto di tipo 'float'"
-#, c-format
#~ msgid "unknown format code '%c' for object of type 'str'"
#~ msgstr "codice di formattazione '%c' sconosciuto per oggetto di tipo 'str'"
diff --git a/locale/ko.po b/locale/ko.po
index fa4936682..64bd2e9dd 100644
--- a/locale/ko.po
+++ b/locale/ko.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-01-29 17:27-0800\n"
+"POT-Creation-Date: 2020-02-05 15:55-0800\n"
"PO-Revision-Date: 2019-05-06 14:22-0700\n"
"Last-Translator: \n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -669,6 +669,10 @@ msgstr ""
msgid "Expected tuple of length %d, got %d"
msgstr ""
+#: ports/nrf/common-hal/_bleio/Adapter.c
+msgid "Extended advertisements with scan response not supported."
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr ""
@@ -1826,7 +1830,7 @@ msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)"
msgstr ""
#: shared-bindings/displayio/Palette.c
-msgid "color buffer must be a buffer or int"
+msgid "color buffer must be a buffer, tuple, list, or int"
msgstr ""
#: shared-bindings/displayio/Palette.c
diff --git a/locale/pl.po b/locale/pl.po
index 70106112e..77357d05d 100644
--- a/locale/pl.po
+++ b/locale/pl.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-01-29 17:27-0800\n"
+"POT-Creation-Date: 2020-02-05 15:55-0800\n"
"PO-Revision-Date: 2019-03-19 18:37-0700\n"
"Last-Translator: Radomir Dopieralski <circuitpython@sheep.art.pl>\n"
"Language-Team: pl\n"
@@ -668,6 +668,10 @@ msgstr ""
msgid "Expected tuple of length %d, got %d"
msgstr "Oczekiwano krotkę długości %d, otrzymano %d"
+#: ports/nrf/common-hal/_bleio/Adapter.c
+msgid "Extended advertisements with scan response not supported."
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr ""
@@ -1829,8 +1833,8 @@ msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)"
msgstr "bufor kolorów musi nieć 3 bajty (RGB) lub 4 bajty (RGB + wypełnienie)"
#: shared-bindings/displayio/Palette.c
-msgid "color buffer must be a buffer or int"
-msgstr "bufor kolorów musi być typu buffer lub int"
+msgid "color buffer must be a buffer, tuple, list, or int"
+msgstr ""
#: shared-bindings/displayio/Palette.c
msgid "color buffer must be a bytearray or array of type 'b' or 'B'"
@@ -2816,7 +2820,6 @@ msgstr "zerowy krok"
#~ msgid "Attempted heap allocation when MicroPython VM not running.\n"
#~ msgstr "Próba alokacji pamięci na stercie gdy VM nie działa.\n"
-#, c-format
#~ msgid "Can not use dotstar with %s"
#~ msgstr "Nie można używać dotstar z %s"
@@ -3035,11 +3038,9 @@ msgstr "zerowy krok"
#~ msgid "bad GATT role"
#~ msgstr "zła rola GATT"
-#, c-format
#~ msgid "buf is too small. need %d bytes"
#~ msgstr "buf zbyt mały. Wymagane %d bajtów"
-#, c-format
#~ msgid "byteorder is not an instance of ByteOrder (got a %s)"
#~ msgstr "byteorder musi być typu ByteOrder (jest %s)"
@@ -3047,6 +3048,9 @@ msgstr "zerowy krok"
#~ msgstr ""
#~ "charakterystyki zawierają obiekt, który nie jest typu Characteristic"
+#~ msgid "color buffer must be a buffer or int"
+#~ msgstr "bufor kolorów musi być typu buffer lub int"
+
#~ msgid "interval not in range 0.0020 to 10.24"
#~ msgstr "przedział poza zakresem 0.0020 do 10.24"
@@ -3068,11 +3072,9 @@ msgstr "zerowy krok"
#~ msgid "timeout >100 (units are now seconds, not msecs)"
#~ msgstr "timeout > 100 (jednostkami są sekundy)"
-#, c-format
#~ msgid "unknown format code '%c' for object of type 'float'"
#~ msgstr "zły kod foratowania '%c' dla obiektu typu 'float'"
-#, c-format
#~ msgid "unknown format code '%c' for object of type 'str'"
#~ msgstr "zły kod formatowania '%c' dla obiektu typu 'str'"
diff --git a/locale/pt_BR.po b/locale/pt_BR.po
index 755dc6d97..e5dde29f4 100644
--- a/locale/pt_BR.po
+++ b/locale/pt_BR.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-01-29 17:27-0800\n"
+"POT-Creation-Date: 2020-02-05 15:55-0800\n"
"PO-Revision-Date: 2018-10-02 21:14-0000\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -674,6 +674,10 @@ msgstr ""
msgid "Expected tuple of length %d, got %d"
msgstr ""
+#: ports/nrf/common-hal/_bleio/Adapter.c
+msgid "Extended advertisements with scan response not supported."
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr "Falha ao enviar comando."
@@ -1842,7 +1846,7 @@ msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)"
msgstr ""
#: shared-bindings/displayio/Palette.c
-msgid "color buffer must be a buffer or int"
+msgid "color buffer must be a buffer, tuple, list, or int"
msgstr ""
#: shared-bindings/displayio/Palette.c
diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po
index 369ce4426..dbe1605b6 100644
--- a/locale/zh_Latn_pinyin.po
+++ b/locale/zh_Latn_pinyin.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: circuitpython-cn\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-01-29 17:27-0800\n"
+"POT-Creation-Date: 2020-02-05 15:55-0800\n"
"PO-Revision-Date: 2019-04-13 10:10-0700\n"
"Last-Translator: hexthat\n"
"Language-Team: Chinese Hanyu Pinyin\n"
@@ -669,6 +669,10 @@ msgstr "Qídài yīgè dìzhǐ"
msgid "Expected tuple of length %d, got %d"
msgstr "Qīwàng de chángdù wèi %d de yuán zǔ, dédào %d"
+#: ports/nrf/common-hal/_bleio/Adapter.c
+msgid "Extended advertisements with scan response not supported."
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr "Fāsòng mìnglìng shībài."
@@ -1839,8 +1843,8 @@ msgstr ""
"yánsè huǎnchōng qū bìxū wèi 3 zì jié (RGB) huò 4 zì jié (RGB + pad zì jié)"
#: shared-bindings/displayio/Palette.c
-msgid "color buffer must be a buffer or int"
-msgstr "yánsè huǎnchōng qū bìxū shì huǎnchōng qū huò zhěngshù"
+msgid "color buffer must be a buffer, tuple, list, or int"
+msgstr ""
#: shared-bindings/displayio/Palette.c
msgid "color buffer must be a bytearray or array of type 'b' or 'B'"
@@ -2829,7 +2833,6 @@ msgstr "líng bù"
#~ msgid "Attempted heap allocation when MicroPython VM not running.\n"
#~ msgstr "MicroPython VM wèi yùnxíng shí chángshì duī fēnpèi.\n"
-#, c-format
#~ msgid "Can not use dotstar with %s"
#~ msgstr "Wúfǎ yǔ dotstar yīqǐ shǐyòng %s"
@@ -3091,17 +3094,18 @@ msgstr "líng bù"
#~ msgid "bad GATT role"
#~ msgstr "zǒng xiédìng de bùliáng juésè"
-#, c-format
#~ msgid "buf is too small. need %d bytes"
#~ msgstr "huǎnchōng tài xiǎo. Xūyào%d zì jié"
-#, c-format
#~ msgid "byteorder is not an instance of ByteOrder (got a %s)"
#~ msgstr "zì jié bùshì zì jié xù shílì (yǒu %s)"
#~ msgid "characteristics includes an object that is not a Characteristic"
#~ msgstr "tèxìng bāokuò bùshì zìfú de wùtǐ"
+#~ msgid "color buffer must be a buffer or int"
+#~ msgstr "yánsè huǎnchōng qū bìxū shì huǎnchōng qū huò zhěngshù"
+
#~ msgid "expected a DigitalInOut"
#~ msgstr "qídài de DigitalInOut"
@@ -3132,11 +3136,9 @@ msgstr "líng bù"
#~ msgid "too many arguments"
#~ msgstr "tài duō cānshù"
-#, c-format
#~ msgid "unknown format code '%c' for object of type 'float'"
#~ msgstr "lèixíng 'float' duìxiàng wèizhī de géshì dàimǎ '%c'"
-#, c-format
#~ msgid "unknown format code '%c' for object of type 'str'"
#~ msgstr "lèixíng 'str' duìxiàng wèizhī de géshì dàimǎ '%c'"
diff --git a/ports/atmel-samd/boards/circuitbrains_basic_m0/board.c b/ports/atmel-samd/boards/circuitbrains_basic_m0/board.c
new file mode 100755
index 000000000..efafd152d
--- /dev/null
+++ b/ports/atmel-samd/boards/circuitbrains_basic_m0/board.c
@@ -0,0 +1,40 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Original work copyright (c) 2017 Scott Shawcroft for Adafruit Industries
+ * Modified work copyright (c) 2019 Kevin Neubauer for Null Byte Labs LLC
+ *
+ * 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/circuitbrains_basic_m0/mpconfigboard.h b/ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.h
new file mode 100755
index 000000000..592160b84
--- /dev/null
+++ b/ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.h
@@ -0,0 +1,35 @@
+#define MICROPY_HW_BOARD_NAME "CircuitBrains Basic"
+#define MICROPY_HW_MCU_NAME "samd21e18"
+
+#define CIRCUITPY_MCU_FAMILY samd21
+
+#define MICROPY_HW_LED_STATUS (&pin_PA14)
+
+// On-board flash
+#define SPI_FLASH_MOSI_PIN &pin_PA16
+#define SPI_FLASH_MISO_PIN &pin_PA18
+#define SPI_FLASH_SCK_PIN &pin_PA17
+#define SPI_FLASH_CS_PIN &pin_PA19
+
+// These are pins not to reset.
+#define MICROPY_PORT_A (0)
+#define MICROPY_PORT_B (0)
+#define MICROPY_PORT_C (0)
+
+#define SPI_FLASH_BAUDRATE (8000000)
+
+#define CALIBRATE_CRYSTALLESS 1
+
+#define DEFAULT_I2C_BUS_SCL (&pin_PA05)
+#define DEFAULT_I2C_BUS_SDA (&pin_PA04)
+
+#define DEFAULT_SPI_BUS_SCK (&pin_PA11)
+#define DEFAULT_SPI_BUS_MOSI (&pin_PA10)
+#define DEFAULT_SPI_BUS_MISO (&pin_PA09)
+
+#define DEFAULT_UART_BUS_RX (&pin_PA07)
+#define DEFAULT_UART_BUS_TX (&pin_PA06)
+
+// USB is always used internally so skip the pin objects for it.
+#define IGNORE_PIN_PA24 1
+#define IGNORE_PIN_PA25 1 \ No newline at end of file
diff --git a/ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.mk b/ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.mk
new file mode 100755
index 000000000..3587f1a33
--- /dev/null
+++ b/ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.mk
@@ -0,0 +1,16 @@
+USB_VID = 0x04D8
+USB_PID = 0xEC63
+USB_PRODUCT = "CircuitBrains Basic"
+USB_MANUFACTURER = "Kevin Neubauer"
+
+CHIP_VARIANT = SAMD21E18A
+CHIP_FAMILY = samd21
+
+SPI_FLASH_FILESYSTEM = 1
+EXTERNAL_FLASH_DEVICE_COUNT = 1
+EXTERNAL_FLASH_DEVICES = "W25Q32JV_IQ"
+LONGINT_IMPL = MPZ
+
+CIRCUITPY_BITBANGIO = 0
+CIRCUITPY_FREQUENCYIO = 0
+CIRCUITPY_I2CSLAVE = 0
diff --git a/ports/atmel-samd/boards/circuitbrains_basic_m0/pins.c b/ports/atmel-samd/boards/circuitbrains_basic_m0/pins.c
new file mode 100755
index 000000000..5acad5e98
--- /dev/null
+++ b/ports/atmel-samd/boards/circuitbrains_basic_m0/pins.c
@@ -0,0 +1,35 @@
+#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_PA06) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA06) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA07) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA07) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA08) },
+
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA00) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA01) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA28) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA27) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA23) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA22) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA15) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA14) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_STATUS_LED),MP_ROM_PTR(&pin_PA14) },
+
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_PA04) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_PA05) },
+
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SCK),MP_ROM_PTR(&pin_PA11) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_PA10) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_PA09) },
+
+ { 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/circuitbrains_deluxe_m4/board.c b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/board.c
new file mode 100755
index 000000000..efafd152d
--- /dev/null
+++ b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/board.c
@@ -0,0 +1,40 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Original work copyright (c) 2017 Scott Shawcroft for Adafruit Industries
+ * Modified work copyright (c) 2019 Kevin Neubauer for Null Byte Labs LLC
+ *
+ * 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/circuitbrains_deluxe_m4/mpconfigboard.h b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.h
new file mode 100755
index 000000000..687e97a5a
--- /dev/null
+++ b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.h
@@ -0,0 +1,32 @@
+#define MICROPY_HW_BOARD_NAME "CircuitBrains Deluxe"
+#define MICROPY_HW_MCU_NAME "samd51j19"
+
+#define CIRCUITPY_MCU_FAMILY samd51
+
+#define MICROPY_HW_LED_STATUS (&pin_PB13)
+
+// 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
+#define MICROPY_PORT_B (PORT_PB10 | PORT_PB11)
+#define MICROPY_PORT_C (0)
+#define MICROPY_PORT_D (0)
+
+#define AUTORESET_DELAY_MS 500
+
+#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/circuitbrains_deluxe_m4/mpconfigboard.mk b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.mk
new file mode 100755
index 000000000..7a9e5a780
--- /dev/null
+++ b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.mk
@@ -0,0 +1,16 @@
+USB_VID = 0x04D8
+USB_PID = 0xEC64
+USB_PRODUCT = "CircuitBrains Deluxe"
+USB_MANUFACTURER = "Kevin Neubauer"
+
+CHIP_VARIANT = SAMD51J19A
+CHIP_FAMILY = samd51
+
+QSPI_FLASH_FILESYSTEM = 1
+EXTERNAL_FLASH_DEVICE_COUNT = 2
+EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, S25FL064L"
+LONGINT_IMPL = MPZ
+
+CIRCUITPY_NETWORK = 1
+MICROPY_PY_WIZNET5K = 5500
+CIRCUITPY_PS2IO = 1
diff --git a/ports/atmel-samd/boards/circuitbrains_deluxe_m4/pins.c b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/pins.c
new file mode 100755
index 000000000..45fcd0464
--- /dev/null
+++ b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/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_PB04) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB05) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PB06) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PB07) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB08) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PB09) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PA04) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PA05) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_PA06) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_PA07) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_PB00) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A12), MP_ROM_PTR(&pin_PB01) },
+
+ { 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_PA21) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA20) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PB17) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PB16) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA19) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA18) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA17) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA16) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA15) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PB15) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PB14) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PB13) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_STATUS_LED),MP_ROM_PTR(&pin_PB13) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PB12) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PB31) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_PA27) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_PB23) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_PB22) },
+
+ { 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_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_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/pewpew_m4/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk
index 1d1891e8e..51b4fc993 100644
--- a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk
@@ -10,6 +10,9 @@ INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_SMALL_BUILD = 1
+# TODO: Turn off analogio for now for space reasons, but restore it
+# when frozen module gets smaller.
+CIRCUITPY_ANALOGIO = 0
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_BITBANGIO = 0
CIRCUITPY_FREQUENCYIO = 0
diff --git a/ports/atmel-samd/boards/pybadge/board.c b/ports/atmel-samd/boards/pybadge/board.c
index 3725f0ec3..28e1aec13 100644
--- a/ports/atmel-samd/boards/pybadge/board.c
+++ b/ports/atmel-samd/boards/pybadge/board.c
@@ -52,7 +52,7 @@ uint8_t display_init_sequence[] = {
0xc4, 2, 0x8a, 0xee,
0xc5, 1, 0x0e, // _VMCTR1 VCOMH = 4V, VOML = -1.1V
0x2a, 0, // _INVOFF
- 0x36, 1, 0x00, // _MADCTL top to bottom refresh in vsync aligned order.
+ 0x36, 1, 0b10100000, // _MADCTL for rotation 0
// 1 clk cycle nonoverlap, 2 cycle gate rise, 3 sycle osc equalie,
// fix on VTL
0x3a, 1, 0x05, // COLMOD - 16bit color
@@ -92,7 +92,7 @@ void board_init(void) {
128, // Height (after rotation)
0, // column start
0, // row start
- 270, // rotation
+ 0, // rotation
16, // Color depth
false, // grayscale
false, // pixels in byte share row. only used for depth < 8
diff --git a/ports/atmel-samd/boards/pygamer/board.c b/ports/atmel-samd/boards/pygamer/board.c
index b364ffccf..c052614db 100644
--- a/ports/atmel-samd/boards/pygamer/board.c
+++ b/ports/atmel-samd/boards/pygamer/board.c
@@ -52,7 +52,7 @@ uint8_t display_init_sequence[] = {
0xc4, 2, 0x8a, 0xee,
0xc5, 1, 0x0e, // _VMCTR1 VCOMH = 4V, VOML = -1.1V
0x2a, 0, // _INVOFF
- 0x36, 1, 0x00, // _MADCTL top to bottom refresh in vsync aligned order.
+ 0x36, 1, 0b10100000, // _MADCTL for rotation 0
// 1 clk cycle nonoverlap, 2 cycle gate rise, 3 sycle osc equalie,
// fix on VTL
0x3a, 1, 0x05, // COLMOD - 16bit color
@@ -92,7 +92,7 @@ void board_init(void) {
128, // Height
0, // column start
0, // row start
- 270, // rotation
+ 0, // rotation
16, // Color depth
false, // Grayscale
false, // pixels in a byte share a row. Only valid for depths < 8
diff --git a/ports/atmel-samd/common-hal/time/__init__.c b/ports/atmel-samd/common-hal/time/__init__.c
index 2d82b3d1a..652e455fc 100644
--- a/ports/atmel-samd/common-hal/time/__init__.c
+++ b/ports/atmel-samd/common-hal/time/__init__.c
@@ -29,11 +29,20 @@
#include "shared-bindings/time/__init__.h"
#include "supervisor/shared/tick.h"
+#include "tick.h"
-inline uint64_t common_hal_time_monotonic() {
+inline uint64_t common_hal_time_monotonic(void) {
return supervisor_ticks_ms64();
}
+uint64_t common_hal_time_monotonic_ns(void) {
+ uint64_t ms;
+ uint32_t us_until_ms;
+ current_tick(&ms, &us_until_ms);
+ // us counts down.
+ return 1000 * (ms * 1000 + (1000 - us_until_ms));
+}
+
void common_hal_time_delay_ms(uint32_t delay) {
mp_hal_delay_ms(delay);
}
diff --git a/ports/cxd56/common-hal/time/__init__.c b/ports/cxd56/common-hal/time/__init__.c
index 6f5eedd41..31c63cbb2 100644
--- a/ports/cxd56/common-hal/time/__init__.c
+++ b/ports/cxd56/common-hal/time/__init__.c
@@ -24,6 +24,8 @@
* THE SOFTWARE.
*/
+#include <sys/time.h>
+
#include "py/mphal.h"
#include "supervisor/shared/tick.h"
@@ -32,6 +34,12 @@ uint64_t common_hal_time_monotonic(void) {
return supervisor_ticks_ms64();
}
+uint64_t common_hal_time_monotonic_ns(void) {
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ return 1000 * ((uint64_t) tv.tv_sec * 1000000 + (uint64_t) tv.tv_usec);
+}
+
void common_hal_time_delay_ms(uint32_t delay) {
mp_hal_delay_ms(delay);
}
diff --git a/ports/mimxrt10xx/common-hal/time/__init__.c b/ports/mimxrt10xx/common-hal/time/__init__.c
index 2d82b3d1a..524e31d1a 100644
--- a/ports/mimxrt10xx/common-hal/time/__init__.c
+++ b/ports/mimxrt10xx/common-hal/time/__init__.c
@@ -30,10 +30,20 @@
#include "supervisor/shared/tick.h"
-inline uint64_t common_hal_time_monotonic() {
+#include "tick.h"
+
+inline uint64_t common_hal_time_monotonic(void) {
return supervisor_ticks_ms64();
}
+uint64_t common_hal_time_monotonic_ns(void) {
+ uint64_t ms;
+ uint32_t us_until_ms;
+ current_tick(&ms, &us_until_ms);
+ // us counts down.
+ return 1000 * (ms * 1000 + (1000 - us_until_ms));
+}
+
void common_hal_time_delay_ms(uint32_t delay) {
mp_hal_delay_ms(delay);
}
diff --git a/ports/nrf/boards/feather_bluefruit_sense/board.c b/ports/nrf/boards/feather_bluefruit_sense/board.c
new file mode 100644
index 000000000..4421970ee
--- /dev/null
+++ b/ports/nrf/boards/feather_bluefruit_sense/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/feather_bluefruit_sense/mpconfigboard.h b/ports/nrf/boards/feather_bluefruit_sense/mpconfigboard.h
new file mode 100644
index 000000000..4b2b69e7e
--- /dev/null
+++ b/ports/nrf/boards/feather_bluefruit_sense/mpconfigboard.h
@@ -0,0 +1,70 @@
+/*
+ * 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 MICROPY_HW_BOARD_NAME "Adafruit Feather Bluefruit Sense"
+#define MICROPY_HW_MCU_NAME "nRF52840"
+
+#define MICROPY_HW_NEOPIXEL (&pin_P0_16)
+
+#define MICROPY_HW_LED_STATUS (&pin_P1_11)
+
+// Board does not have a 32kHz crystal. It does have a 32MHz crystal.
+#define BOARD_HAS_32KHZ_XTAL (0)
+
+#if QSPI_FLASH_FILESYSTEM
+#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 17)
+#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 22)
+#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 23)
+#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 21)
+#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 19)
+#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 20)
+#endif
+
+#if SPI_FLASH_FILESYSTEM
+#define SPI_FLASH_MOSI_PIN &pin_P0_17
+#define SPI_FLASH_MISO_PIN &pin_P0_22
+#define SPI_FLASH_SCK_PIN &pin_P0_19
+#define SPI_FLASH_CS_PIN &pin_P0_20
+#endif
+
+#define CIRCUITPY_AUTORELOAD_DELAY_MS 500
+
+#define CIRCUITPY_INTERNAL_NVM_SIZE (4096)
+
+#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
+
+#define DEFAULT_I2C_BUS_SCL (&pin_P0_11)
+#define DEFAULT_I2C_BUS_SDA (&pin_P0_12)
+
+#define DEFAULT_SPI_BUS_SCK (&pin_P0_14)
+#define DEFAULT_SPI_BUS_MOSI (&pin_P0_13)
+#define DEFAULT_SPI_BUS_MISO (&pin_P0_15)
+
+#define DEFAULT_UART_BUS_RX (&pin_P0_24)
+#define DEFAULT_UART_BUS_TX (&pin_P0_25)
diff --git a/ports/nrf/boards/feather_bluefruit_sense/mpconfigboard.mk b/ports/nrf/boards/feather_bluefruit_sense/mpconfigboard.mk
new file mode 100644
index 000000000..5813e6136
--- /dev/null
+++ b/ports/nrf/boards/feather_bluefruit_sense/mpconfigboard.mk
@@ -0,0 +1,10 @@
+USB_VID = 0x239A
+USB_PID = 0x8088
+USB_PRODUCT = "Feather Bluefruit Sense"
+USB_MANUFACTURER = "Adafruit Industries LLC"
+
+MCU_CHIP = nrf52840
+
+QSPI_FLASH_FILESYSTEM = 1
+EXTERNAL_FLASH_DEVICE_COUNT = 1
+EXTERNAL_FLASH_DEVICES = "GD25Q16C"
diff --git a/ports/nrf/boards/feather_bluefruit_sense/pins.c b/ports/nrf/boards/feather_bluefruit_sense/pins.c
new file mode 100644
index 000000000..55eb76463
--- /dev/null
+++ b/ports/nrf/boards/feather_bluefruit_sense/pins.c
@@ -0,0 +1,58 @@
+#include "shared-bindings/board/__init__.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) },
+ { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P0_30) },
+ { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_P0_28) },
+ { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_P0_02) },
+ { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_P0_03) },
+
+ { MP_ROM_QSTR(MP_QSTR_AREF), MP_ROM_PTR(&pin_P0_31) },
+
+ { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_P0_29) },
+ { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_P0_29) },
+
+ { MP_ROM_QSTR(MP_QSTR_SWITCH), MP_ROM_PTR(&pin_P1_02) },
+
+ { 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_D2), MP_ROM_PTR(&pin_P0_10) },
+ { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P1_08) },
+ { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_P0_07) },
+ { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_P0_26) },
+ { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_P0_27) },
+ { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_P0_06) },
+ { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_P0_08) },
+ { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_P1_09) },
+
+ { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_P0_16) },
+
+ { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_14) },
+ { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_13) },
+ { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_15) },
+
+ { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_25) },
+ { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_24) },
+
+ { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_11) },
+ { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_12) },
+
+ { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_P1_11) },
+ { MP_ROM_QSTR(MP_QSTR_RED_LED), MP_ROM_PTR(&pin_P1_11) },
+ { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_P1_11) },
+
+ { MP_ROM_QSTR(MP_QSTR_BLUE_LED), MP_ROM_PTR(&pin_P1_10) },
+
+ { MP_ROM_QSTR(MP_QSTR_MICROPHONE_CLOCK), MP_ROM_PTR(&pin_P0_01) },
+ { MP_ROM_QSTR(MP_QSTR_MICROPHONE_DATA), MP_ROM_PTR(&pin_P0_00) },
+
+ { MP_ROM_QSTR(MP_QSTR_PROXIMITY_LIGHT_INTERRUPT), MP_ROM_PTR(&pin_P1_00) },
+
+ { 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/ohs2020_badge/board.c b/ports/nrf/boards/ohs2020_badge/board.c
index 457edf44a..7e3e05814 100644
--- a/ports/nrf/boards/ohs2020_badge/board.c
+++ b/ports/nrf/boards/ohs2020_badge/board.c
@@ -40,7 +40,7 @@ displayio_fourwire_obj_t board_display_obj;
uint8_t display_init_sequence[] = {
0x01, 0 | DELAY, 150, // SWRESET
0x11, 0 | DELAY, 255, // SLPOUT
- 0x36, 1, 0x00, // _MADCTL bottom to top refresh in vsync aligned order.
+ 0x36, 1, 0b10100000, // _MADCTL bottom to top refresh in vsync aligned order.
0x3a, 1, 0x55, // COLMOD - 16bit color
0x21, 0 | DELAY, 10, // _INVON
0x13, 0 | DELAY, 10, // _NORON
@@ -49,7 +49,7 @@ uint8_t display_init_sequence[] = {
void board_init(void) {
busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus;
- common_hal_busio_spi_construct(spi, &pin_P0_14, &pin_P0_15, mp_const_none);
+ common_hal_busio_spi_construct(spi, &pin_P0_11, &pin_P0_12, mp_const_none);
common_hal_busio_spi_never_reset(spi);
displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus;
@@ -67,9 +67,9 @@ void board_init(void) {
bus,
240, // Width (after rotation)
240, // Height (after rotation)
- 0, // column start
+ 80, // column start
0, // row start
- 270, // rotation
+ 0, // rotation
16, // Color depth
false, // Grayscale
false, // Pixels in a byte share a row. Only used for depth < 8
@@ -81,7 +81,7 @@ void board_init(void) {
0x37, // set vertical scroll command
display_init_sequence,
sizeof(display_init_sequence),
- &pin_P0_02, // backlight pin
+ NULL, // backlight pin
NO_BRIGHTNESS_COMMAND,
1.0f, // brightness (ignored)
true, // auto_brightness
diff --git a/ports/nrf/boards/ohs2020_badge/mpconfigboard.h b/ports/nrf/boards/ohs2020_badge/mpconfigboard.h
index 8e4e68dea..8edc40423 100644
--- a/ports/nrf/boards/ohs2020_badge/mpconfigboard.h
+++ b/ports/nrf/boards/ohs2020_badge/mpconfigboard.h
@@ -32,8 +32,8 @@
#define MICROPY_HW_MCU_NAME "nRF52840"
#if QSPI_FLASH_FILESYSTEM
-#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 22)
-#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(1, 0)
+#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(1, 0)
+#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 22)
#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 20)
#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(1, 2)
#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(1, 1)
diff --git a/ports/nrf/boards/ohs2020_badge/mpconfigboard.mk b/ports/nrf/boards/ohs2020_badge/mpconfigboard.mk
index 46a4c3be6..7d2c6de98 100644
--- a/ports/nrf/boards/ohs2020_badge/mpconfigboard.mk
+++ b/ports/nrf/boards/ohs2020_badge/mpconfigboard.mk
@@ -7,4 +7,4 @@ MCU_CHIP = nrf52840
QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
-EXTERNAL_FLASH_DEVICES = "W25Q32JV_IQ"
+EXTERNAL_FLASH_DEVICES = "W25Q128JV_SQ"
diff --git a/ports/nrf/boards/ohs2020_badge/pins.c b/ports/nrf/boards/ohs2020_badge/pins.c
index df87deeeb..e984e3070 100644
--- a/ports/nrf/boards/ohs2020_badge/pins.c
+++ b/ports/nrf/boards/ohs2020_badge/pins.c
@@ -1,4 +1,5 @@
#include "shared-bindings/board/__init__.h"
+#include "shared-module/displayio/__init__.h"
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_MICROPHONE_CLOCK), MP_ROM_PTR(&pin_P0_25) },
@@ -11,8 +12,13 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_TFT_SCK), MP_ROM_PTR(&pin_P0_11) },
{ MP_ROM_QSTR(MP_QSTR_TFT_MOSI), MP_ROM_PTR(&pin_P0_12) },
+ { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P1_14) },
+ { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P1_15) },
+
{ 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_DISPLAY), MP_ROM_PTR(&displays[0].display) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
diff --git a/ports/nrf/common-hal/_bleio/Adapter.c b/ports/nrf/common-hal/_bleio/Adapter.c
index 4aa8678a3..09b7c95b9 100644
--- a/ports/nrf/common-hal/_bleio/Adapter.c
+++ b/ports/nrf/common-hal/_bleio/Adapter.c
@@ -646,6 +646,10 @@ void common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self, bool
check_data_fit(advertising_data_bufinfo->len, connectable);
check_data_fit(scan_response_data_bufinfo->len, connectable);
+
+ if (advertising_data_bufinfo->len > 31 && scan_response_data_bufinfo->len > 0) {
+ mp_raise_bleio_BluetoothError(translate("Extended advertisements with scan response not supported."));
+ }
// The advertising data buffers must not move, because the SoftDevice depends on them.
// So make them long-lived and reuse them onwards.
if (self->advertising_data == NULL) {
diff --git a/ports/nrf/common-hal/busio/I2C.c b/ports/nrf/common-hal/busio/I2C.c
index 219fbf447..37cb192df 100644
--- a/ports/nrf/common-hal/busio/I2C.c
+++ b/ports/nrf/common-hal/busio/I2C.c
@@ -137,11 +137,17 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, const mcu_pin_obj_t *
nrfx_twim_config_t config = NRFX_TWIM_DEFAULT_CONFIG(scl->number, sda->number);
- // change freq. only if it's less than the default 400K
- if (frequency < 100000) {
- config.frequency = NRF_TWIM_FREQ_100K;
- } else if (frequency < 250000) {
+#if defined(TWIM_FREQUENCY_FREQUENCY_K1000)
+ if (frequency >= 1000000) {
+ config.frequency = NRF_TWIM_FREQ_1000K;
+ } else
+#endif
+ if (frequency >= 400000) {
+ config.frequency = NRF_TWIM_FREQ_400K;
+ } else if (frequency >= 250000) {
config.frequency = NRF_TWIM_FREQ_250K;
+ } else {
+ config.frequency = NRF_TWIM_FREQ_100K;
}
self->scl_pin_number = scl->number;
diff --git a/ports/nrf/common-hal/time/__init__.c b/ports/nrf/common-hal/time/__init__.c
index 976f519db..c85077868 100644
--- a/ports/nrf/common-hal/time/__init__.c
+++ b/ports/nrf/common-hal/time/__init__.c
@@ -32,6 +32,14 @@ uint64_t common_hal_time_monotonic(void) {
return supervisor_ticks_ms64();
}
+uint64_t common_hal_time_monotonic_ns(void) {
+ uint64_t ms;
+ uint32_t us_until_ms;
+ current_tick(&ms, &us_until_ms);
+ // us counts down.
+ return 1000 * (ms * 1000 + (1000 - us_until_ms));
+}
+
void common_hal_time_delay_ms(uint32_t delay) {
mp_hal_delay_ms(delay);
}
diff --git a/ports/stm32f4/Makefile b/ports/stm32f4/Makefile
index ccadeac8a..3a6191c85 100755
--- a/ports/stm32f4/Makefile
+++ b/ports/stm32f4/Makefile
@@ -26,11 +26,11 @@
# Select the board to build for.
ifeq ($(BOARD),)
- $(error You must provide a BOARD parameter)
+ $(error You must provide a BOARD parameter)
else
- ifeq ($(wildcard boards/$(BOARD)/.),)
- $(error Invalid BOARD specified)
- endif
+ ifeq ($(wildcard boards/$(BOARD)/.),)
+ $(error Invalid BOARD specified)
+ endif
endif
# If the build directory is not given, make it reflect the board name.
@@ -80,19 +80,16 @@ INC += -I../../supervisor/shared/usb
#Debugging/Optimization
ifeq ($(DEBUG), 1)
- CFLAGS += -ggdb
- # You may want to enable these flags to make setting breakpoints easier.
- CFLAGS += -fno-inline -fno-ipa-sra
+ CFLAGS += -ggdb
+ # You may want to enable these flags to make setting breakpoints easier.
+ CFLAGS += -fno-inline -fno-ipa-sra
else
- CFLAGS += -Os -DNDEBUG
- CFLAGS += -ggdb
- # TODO: Test with -flto
- ### CFLAGS += -flto
+ CFLAGS += -Os -DNDEBUG
+ CFLAGS += -ggdb
+ # TODO: Test with -flto
+ ### CFLAGS += -flto
endif
-ifndef BOOTLOADER_OFFSET
- BOOTLOADER_OFFSET := 0x8000000
-endif
C_DEFS = -DMCU_PACKAGE=$(MCU_PACKAGE) -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -D$(CMSIS_MCU)
@@ -115,6 +112,22 @@ CFLAGS += \
# TODO: check this
CFLAGS += -D__START=main
+#need both command and valid file to use uf2 bootloader
+ifndef LD_FILE
+ ifneq ($(and $(UF2_BOOTLOADER),$(LD_BOOT)),)
+ LD_FILE = $(LD_BOOT)
+ BOOTLOADER_OFFSET = $(UF2_OFFSET)
+ CFLAGS += -DUF2_BOOTLOADER_ENABLED
+ else
+ LD_FILE = $(LD_DEFAULT)
+ endif
+endif
+
+# Add bootloader specific items
+ifndef BOOTLOADER_OFFSET
+ BOOTLOADER_OFFSET := 0x8000000
+endif
+
LDFLAGS = $(CFLAGS) -fshort-enums -Wl,-nostdlib -Wl,-T,$(LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs
LIBS := -lgcc -lc
@@ -210,12 +223,12 @@ SRC_S = \
boards/startup_$(MCU_SUB_VARIANT).s
SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
- $(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \
- $(addprefix common-hal/, $(SRC_COMMON_HAL))
+ $(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \
+ $(addprefix common-hal/, $(SRC_COMMON_HAL))
SRC_SHARED_MODULE_EXPANDED = $(addprefix shared-bindings/, $(SRC_SHARED_MODULE)) \
- $(addprefix shared-module/, $(SRC_SHARED_MODULE)) \
- $(addprefix shared-module/, $(SRC_SHARED_MODULE_INTERNAL))
+ $(addprefix shared-module/, $(SRC_SHARED_MODULE)) \
+ $(addprefix shared-module/, $(SRC_SHARED_MODULE_INTERNAL))
ifneq ($(FROZEN_MPY_DIR),)
diff --git a/ports/stm32f4/boards/STM32F401.ld b/ports/stm32f4/boards/STM32F401xd_fs.ld
index bf1f21cf6..c42dfcca8 100644
--- a/ports/stm32f4/boards/STM32F401.ld
+++ b/ports/stm32f4/boards/STM32F401xd_fs.ld
@@ -1,39 +1,29 @@
/*
- GNU linker script for STM32F401 with bootloader (from Meowbit Micropython)
- Doesn't work:
-
- Traceback (most recent call last):
- File "../../tools/build_memory_info.py", line 64, in <module>
- regions[region] = int(eval(space))
- File "<string>", line 1, in <module>
-NameError: name 'FLASH_ISR' is not defined
+ GNU linker script for STM32F401 with bootloader (such as the Meowbit)
*/
/* Specify the memory areas */
-/* FLASH_FS (rx) : ORIGIN = 0x08020000, LENGTH = 128K */
-/* sectors 5 128K */
MEMORY
{
- FLASH (rx) : ORIGIN = 0x08010000, LENGTH = 512K - 64K /* entire flash */
- FLASH_ISR (rx) : ORIGIN = 0x08010000, LENGTH = 64K /* sector 4, sec 0~3 reserved for booloader */
- FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 384K /* sectors 5, 6,7 are 128K */
- RAM (xrw) : ORIGIN = 0x20000194, LENGTH = 96K - 0x194
+ FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 384K /* entire flash */
+ FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */
+ FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 48K /* sectors 1,2,3 are 16K */
+ FLASH_TEXT (rx) : ORIGIN = 0x08010000, LENGTH = 320K /* sector 4 is 64K, sectors 5,6,7 are 128K */
+ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
}
/* produce a link error if there is not this amount of RAM for these sections */
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;
-/* Define the stack. The stack is full descending so begins just above last byte
- of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */
-_estack = ORIGIN(RAM) + LENGTH(RAM) - _estack_reserve;
-_sstack = _estack - 16K; /* tunable */
+/* Define tho top end of the stack. The stack is full descending so begins just
+ above last byte of RAM. Note that EABI requires the stack to be 8-byte
+ aligned for a call. */
+_estack = ORIGIN(RAM) + LENGTH(RAM);
/* RAM extents for the garbage collector */
_ram_start = ORIGIN(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
-_heap_start = _ebss; /* heap starts just after statically allocated memory */
-_heap_end = _sstack;
ENTRY(Reset_Handler)
@@ -47,25 +37,8 @@ SECTIONS
KEEP(*(.isr_vector)) /* Startup code */
/* This first flash block is 16K annd the isr vectors only take up
- about 400 bytes. So we pull in a couple of object files to pad it
- out. */
-
- . = ALIGN(4);
-
- /* NOTE: If you update the list of files contained in .isr_vector,
- then be sure to also update smhal/Makefile where it forcibly
- builds each of these files with -Os */
-
- */ff.o(.text*)
- */vfs_fat_*.o(.text*)
- */py/formatfloat.o(.text*)
- */py/parsenum.o(.text*)
- */py/mpprint.o(.text*)
-
- */py/compile.o(.text*)
- */py/objset.o(.text*)
- */py/mpz.o(.text*)
- */py/vm.o(.text*)
+ about 400 bytes. Micropython pads this with files, but this didn't
+ work with the size of Circuitpython's ff object. */
. = ALIGN(4);
} >FLASH_ISR
@@ -130,3 +103,5 @@ SECTIONS
.ARM.attributes 0 : { *(.ARM.attributes) }
}
+
+
diff --git a/ports/stm32f4/boards/STM32F401_boot.ld b/ports/stm32f4/boards/STM32F401xe_boot.ld
index ffdd7097c..125d785fc 100644
--- a/ports/stm32f4/boards/STM32F401_boot.ld
+++ b/ports/stm32f4/boards/STM32F401xe_boot.ld
@@ -5,9 +5,9 @@
/* Specify the memory areas */
MEMORY
{
- FLASH (rx) : ORIGIN = 0x08010000, LENGTH = 512K - 64K /* entire flash */
- FLASH_ISR (rx) : ORIGIN = 0x08010000, LENGTH = 64K
- FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 384K /* sector 4 is 64K, sectors 5,6,7 are 128K */
+ FLASH (rx) : ORIGIN = 0x08010000, LENGTH = 512K - 64K /* entire flash, sans bootloader region */
+ FLASH_ISR (rx) : ORIGIN = 0x08010000, LENGTH = 64K /* sector 4 */
+ FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 384K /* sectors 5,6,7 are 128K */
RAM (xrw) : ORIGIN = 0x20000194, LENGTH = 96K - 0x194
}
diff --git a/ports/stm32f4/boards/STM32F401_fs.ld b/ports/stm32f4/boards/STM32F401xe_fs.ld
index fd30e1622..fd30e1622 100644
--- a/ports/stm32f4/boards/STM32F401_fs.ld
+++ b/ports/stm32f4/boards/STM32F401xe_fs.ld
diff --git a/ports/stm32f4/boards/STM32F405_boot.ld b/ports/stm32f4/boards/STM32F405_boot.ld
new file mode 100644
index 000000000..64da3b652
--- /dev/null
+++ b/ports/stm32f4/boards/STM32F405_boot.ld
@@ -0,0 +1,107 @@
+/*
+ GNU linker script for STM32F405 with bootloader
+ Based on Micropython
+*/
+
+/* Specify the memory areas */
+MEMORY
+{
+ FLASH (rx) : ORIGIN = 0x08010000, LENGTH = 1024K - 64K /* entire flash, sans bootloader region */
+ FLASH_ISR (rx) : ORIGIN = 0x08010000, LENGTH = 64K /* sector 0 */
+ FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 1024K - 64K - 64K /* sectors 5+ */
+ CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
+ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
+}
+
+/* produce a link error if there is not this amount of RAM for these sections */
+_minimum_stack_size = 2K;
+_minimum_heap_size = 16K;
+
+/* Define the top end of the stack. The stack is full descending so begins just
+ above last byte of RAM. Note that EABI requires the stack to be 8-byte
+ aligned for a call. */
+_estack = ORIGIN(RAM) + LENGTH(RAM);
+
+/* RAM extents for the garbage collector */
+_ram_start = ORIGIN(RAM);
+_ram_end = ORIGIN(RAM) + LENGTH(RAM);
+
+ENTRY(Reset_Handler)
+
+/* define output sections */
+SECTIONS
+{
+ /* The startup code goes first into FLASH */
+ .isr_vector :
+ {
+ . = ALIGN(4);
+ KEEP(*(.isr_vector)) /* Startup code */
+
+ /* This first flash block is 16K annd the isr vectors only take up
+ about 400 bytes. Micropython pads this with files, but this didn't
+ work with the size of Circuitpython's ff object. */
+
+ . = ALIGN(4);
+ } >FLASH_ISR
+
+ /* The program code and other data goes into FLASH */
+ .text :
+ {
+ . = ALIGN(4);
+ *(.text*) /* .text* sections (code) */
+ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
+ /* *(.glue_7) */ /* glue arm to thumb code */
+ /* *(.glue_7t) */ /* glue thumb to arm code */
+
+ . = ALIGN(4);
+ _etext = .; /* define a global symbol at end of code */
+ } >FLASH_TEXT
+
+ /* used by the startup to initialize data */
+ _sidata = LOADADDR(.data);
+
+ /* This is the initialized data section
+ The program executes knowing that the data is in the RAM
+ but the loader puts the initial values in the FLASH (inidata).
+ It is one task of the startup to copy the initial values from FLASH to RAM. */
+ .data :
+ {
+ . = ALIGN(4);
+ _sdata = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */
+ *(.data*) /* .data* sections */
+
+ . = ALIGN(4);
+ _edata = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */
+ } >RAM AT> FLASH_TEXT
+
+ /* Uninitialized data section */
+ .bss :
+ {
+ . = ALIGN(4);
+ _sbss = .; /* define a global symbol at bss start; used by startup code */
+ *(.bss*)
+ *(COMMON)
+
+ . = ALIGN(4);
+ _ebss = .; /* define a global symbol at bss end; used by startup code and GC */
+ } >RAM
+
+ /* this is to define the start of the heap, and make sure we have a minimum size */
+ .heap :
+ {
+ . = ALIGN(4);
+ . = . + _minimum_heap_size;
+ . = ALIGN(4);
+ } >RAM
+
+ /* this just checks there is enough RAM for the stack */
+ .stack :
+ {
+ . = ALIGN(4);
+ . = . + _minimum_stack_size;
+ . = ALIGN(4);
+ } >RAM
+
+ .ARM.attributes 0 : { *(.ARM.attributes) }
+}
+
diff --git a/ports/stm32f4/boards/STM32F405_default.ld b/ports/stm32f4/boards/STM32F405_default.ld
new file mode 100644
index 000000000..c2b8c843e
--- /dev/null
+++ b/ports/stm32f4/boards/STM32F405_default.ld
@@ -0,0 +1,107 @@
+/*
+ GNU linker script for STM32F405 via Micropython
+*/
+
+/* Specify the memory areas */
+MEMORY
+{
+ FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K /* entire flash */
+ FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */
+ FLASH_TEXT (rx) : ORIGIN = 0x08004000, LENGTH = 1008K /* sectors 0-7*/
+ CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
+ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
+}
+
+/* produce a link error if there is not this amount of RAM for these sections */
+_minimum_stack_size = 2K;
+_minimum_heap_size = 16K;
+
+/* Define tho top end of the stack. The stack is full descending so begins just
+ above last byte of RAM. Note that EABI requires the stack to be 8-byte
+ aligned for a call. */
+_estack = ORIGIN(RAM) + LENGTH(RAM);
+
+/* RAM extents for the garbage collector */
+_ram_start = ORIGIN(RAM);
+_ram_end = ORIGIN(RAM) + LENGTH(RAM);
+
+ENTRY(Reset_Handler)
+
+/* define output sections */
+SECTIONS
+{
+ /* The startup code goes first into FLASH */
+ .isr_vector :
+ {
+ . = ALIGN(4);
+ KEEP(*(.isr_vector)) /* Startup code */
+
+ /* This first flash block is 16K annd the isr vectors only take up
+ about 400 bytes. Micropython pads this with files, but this didn't
+ work with the size of Circuitpython's ff object. */
+
+ . = ALIGN(4);
+ } >FLASH_ISR
+
+ /* The program code and other data goes into FLASH */
+ .text :
+ {
+ . = ALIGN(4);
+ *(.text*) /* .text* sections (code) */
+ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
+ /* *(.glue_7) */ /* glue arm to thumb code */
+ /* *(.glue_7t) */ /* glue thumb to arm code */
+
+ . = ALIGN(4);
+ _etext = .; /* define a global symbol at end of code */
+ } >FLASH_TEXT
+
+ /* used by the startup to initialize data */
+ _sidata = LOADADDR(.data);
+
+ /* This is the initialized data section
+ The program executes knowing that the data is in the RAM
+ but the loader puts the initial values in the FLASH (inidata).
+ It is one task of the startup to copy the initial values from FLASH to RAM. */
+ .data :
+ {
+ . = ALIGN(4);
+ _sdata = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */
+ *(.data*) /* .data* sections */
+
+ . = ALIGN(4);
+ _edata = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */
+ } >RAM AT> FLASH_TEXT
+
+ /* Uninitialized data section */
+ .bss :
+ {
+ . = ALIGN(4);
+ _sbss = .; /* define a global symbol at bss start; used by startup code */
+ *(.bss*)
+ *(COMMON)
+
+ . = ALIGN(4);
+ _ebss = .; /* define a global symbol at bss end; used by startup code and GC */
+ } >RAM
+
+ /* this is to define the start of the heap, and make sure we have a minimum size */
+ .heap :
+ {
+ . = ALIGN(4);
+ . = . + _minimum_heap_size;
+ . = ALIGN(4);
+ } >RAM
+
+ /* this just checks there is enough RAM for the stack */
+ .stack :
+ {
+ . = ALIGN(4);
+ . = . + _minimum_stack_size;
+ . = ALIGN(4);
+ } >RAM
+
+ .ARM.attributes 0 : { *(.ARM.attributes) }
+}
+
+
diff --git a/ports/stm32f4/boards/STM32F405.ld b/ports/stm32f4/boards/STM32F405_fs.ld
index 7f7c91784..7f7c91784 100644
--- a/ports/stm32f4/boards/STM32F405.ld
+++ b/ports/stm32f4/boards/STM32F405_fs.ld
diff --git a/ports/stm32f4/boards/espruino_pico/README.md b/ports/stm32f4/boards/espruino_pico/README.md
new file mode 100644
index 000000000..9f0321c47
--- /dev/null
+++ b/ports/stm32f4/boards/espruino_pico/README.md
@@ -0,0 +1,15 @@
+# Flashing the Espruino Pico
+
+The Espruino Pico is normally updated via a bootloader activated by the Espruino web app. This approach is not practical for Circuitpython as it takes too much space from the internal filesystem - thus, you will need to follow the instructions for advanced reflashing using the built-in ROM bootloader on all STM32F4 MCUs (instructions sourced from https://www.espruino.com/Pico#advanced-reflashing)
+
+ - Short out the BOOT0/BTN solder jumper on the back of the board - you can do this by drawing over it with a pencil.
+ - Install ST's DFU utility on Windows, or dfu-util for Mac or Linux
+ - **Mac**: install with Homebrew: `brew install dfu-util`
+ - **Linux**: install with apt-get: `sudo apt-get install dfu-util`
+ - **Windows**: download [ST's application](https://www.st.com/en/development-tools/stsw-stm32080.html) or install the Linux subsystem for Windows 10 and follow the linux instructions.
+ - Hold down the Pico's button while plugging it into USB (when overwriting Espruino's default firmware)
+ - Navigate to the same directory as your firmware.bin file for Circuitpython and run the following command: `sudo dfu-util -a 0 -s 0x08000000 -D firmware.bin` or use the ST utility on Windows.
+ - Restart the board.
+
+
+To reinstall Espruino, follow the same steps with the latest Espruino Pico binary from espruino.com/binaries. This will reinstall the usual Espruino bootloader. You must un-short the BOOT0/BTN jumper to re-use the original Espruino Bootloader again. If you used a Pencil mark then you may need to use cleaning fluid and a small brush to totally clear out the graphite. \ No newline at end of file
diff --git a/ports/stm32f4/boards/espruino_pico/board.c b/ports/stm32f4/boards/espruino_pico/board.c
new file mode 100644
index 000000000..82b0c506e
--- /dev/null
+++ b/ports/stm32f4/boards/espruino_pico/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"
+
+void board_init(void) {
+}
+
+bool board_requests_safe_mode(void) {
+ return false;
+}
+
+void reset_board(void) {
+
+}
diff --git a/ports/stm32f4/boards/espruino_pico/mpconfigboard.h b/ports/stm32f4/boards/espruino_pico/mpconfigboard.h
new file mode 100644
index 000000000..aa179c793
--- /dev/null
+++ b/ports/stm32f4/boards/espruino_pico/mpconfigboard.h
@@ -0,0 +1,39 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Lucian Copeland 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.
+ */
+
+//Micropython setup
+
+#define MICROPY_HW_BOARD_NAME "Espruino Pico"
+#define MICROPY_HW_MCU_NAME "STM32F401xD"
+
+#define FLASH_SIZE (0x60000)
+#define FLASH_PAGE_SIZE (0x4000)
+
+#define AUTORESET_DELAY_MS 500
+#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000)
+
+#define BOARD_OSC_DIV 8
+
diff --git a/ports/stm32f4/boards/espruino_pico/mpconfigboard.mk b/ports/stm32f4/boards/espruino_pico/mpconfigboard.mk
new file mode 100644
index 000000000..151ca1437
--- /dev/null
+++ b/ports/stm32f4/boards/espruino_pico/mpconfigboard.mk
@@ -0,0 +1,16 @@
+USB_VID = 0x239A
+USB_PID = 0x808E
+USB_PRODUCT = "Espruino Pico"
+USB_MANUFACTURER = "Espruino"
+USB_DEVICES = "CDC,MSC"
+
+INTERNAL_FLASH_FILESYSTEM = 1
+LONGINT_IMPL = NONE
+
+MCU_SERIES = m4
+MCU_VARIANT = stm32f4
+MCU_SUB_VARIANT = stm32f401xe
+MCU_PACKAGE = 48
+CMSIS_MCU = STM32F401xE
+LD_FILE = boards/STM32F401xd_fs.ld # use for internal flash
+
diff --git a/ports/stm32f4/boards/espruino_pico/pins.c b/ports/stm32f4/boards/espruino_pico/pins.c
new file mode 100644
index 000000000..55c0336c5
--- /dev/null
+++ b/ports/stm32f4/boards/espruino_pico/pins.c
@@ -0,0 +1,33 @@
+#include "shared-bindings/board/__init__.h"
+
+STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_B15), MP_ROM_PTR(&pin_PB15) },
+ { MP_ROM_QSTR(MP_QSTR_B14), MP_ROM_PTR(&pin_PB14) },
+ { MP_ROM_QSTR(MP_QSTR_B13), MP_ROM_PTR(&pin_PB13) },
+ { MP_ROM_QSTR(MP_QSTR_B10), MP_ROM_PTR(&pin_PB10) },
+ { MP_ROM_QSTR(MP_QSTR_B1), MP_ROM_PTR(&pin_PB01) },
+ { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PA07) },
+ { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PA06) },
+ { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA05) },
+
+ { MP_ROM_QSTR(MP_QSTR_B3), MP_ROM_PTR(&pin_PB03) },
+ { MP_ROM_QSTR(MP_QSTR_B4), MP_ROM_PTR(&pin_PB04) },
+ { MP_ROM_QSTR(MP_QSTR_B5), MP_ROM_PTR(&pin_PB05) },
+ { MP_ROM_QSTR(MP_QSTR_B6), MP_ROM_PTR(&pin_PB06) },
+ { MP_ROM_QSTR(MP_QSTR_B7), MP_ROM_PTR(&pin_PB07) },
+ { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PA08) },
+
+ { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA04) },
+ { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA03) },
+ { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA02) },
+ { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA01) },
+ { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA00) },
+ { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_PA10) },
+ { MP_ROM_QSTR(MP_QSTR_B9), MP_ROM_PTR(&pin_PB09) },
+ { MP_ROM_QSTR(MP_QSTR_B8), MP_ROM_PTR(&pin_PB08) },
+
+ { MP_ROM_QSTR(MP_QSTR_BTN), MP_ROM_PTR(&pin_PC13) },
+ { MP_ROM_QSTR(MP_QSTR_LED1), MP_ROM_PTR(&pin_PB02) },
+ { MP_ROM_QSTR(MP_QSTR_LED2), MP_ROM_PTR(&pin_PB12) },
+};
+MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
diff --git a/ports/stm32f4/boards/espruino_pico/stm32f4xx_hal_conf.h b/ports/stm32f4/boards/espruino_pico/stm32f4xx_hal_conf.h
new file mode 100644
index 000000000..ab04df318
--- /dev/null
+++ b/ports/stm32f4/boards/espruino_pico/stm32f4xx_hal_conf.h
@@ -0,0 +1,440 @@
+/**
+ ******************************************************************************
+ * @file stm32f4xx_hal_conf_template.h
+ * @author MCD Application Team
+ * @brief HAL configuration template file.
+ * This file should be copied to the application folder and renamed
+ * to stm32f4xx_hal_conf.h.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
+ * All rights reserved.</center></h2>
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __STM32F4xx_HAL_CONF_H
+#define __STM32F4xx_HAL_CONF_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Exported types ------------------------------------------------------------*/
+/* Exported constants --------------------------------------------------------*/
+
+/* ########################## Module Selection ############################## */
+/**
+ * @brief This is the list of modules to be used in the HAL driver
+ */
+#define HAL_MODULE_ENABLED
+
+#define HAL_ADC_MODULE_ENABLED
+/* #define HAL_CRYP_MODULE_ENABLED */
+/* #define HAL_CAN_MODULE_ENABLED */
+/* #define HAL_CRC_MODULE_ENABLED */
+/* #define HAL_CRYP_MODULE_ENABLED */
+#define HAL_DAC_MODULE_ENABLED
+/* #define HAL_DCMI_MODULE_ENABLED */
+/* #define HAL_DMA2D_MODULE_ENABLED */
+/* #define HAL_ETH_MODULE_ENABLED */
+/* #define HAL_NAND_MODULE_ENABLED */
+/* #define HAL_NOR_MODULE_ENABLED */
+/* #define HAL_PCCARD_MODULE_ENABLED */
+/* #define HAL_SRAM_MODULE_ENABLED */
+/* #define HAL_SDRAM_MODULE_ENABLED */
+/* #define HAL_HASH_MODULE_ENABLED */
+#define HAL_I2C_MODULE_ENABLED
+#define HAL_I2S_MODULE_ENABLED
+/* #define HAL_IWDG_MODULE_ENABLED */
+/* #define HAL_LTDC_MODULE_ENABLED */
+/* #define HAL_RNG_MODULE_ENABLED */
+/* #define HAL_RTC_MODULE_ENABLED */
+/* #define HAL_SAI_MODULE_ENABLED */
+/* #define HAL_SD_MODULE_ENABLED */
+/* #define HAL_MMC_MODULE_ENABLED */
+#define HAL_SPI_MODULE_ENABLED
+#define HAL_TIM_MODULE_ENABLED
+#define HAL_UART_MODULE_ENABLED
+#define HAL_USART_MODULE_ENABLED
+/* #define HAL_IRDA_MODULE_ENABLED */
+/* #define HAL_SMARTCARD_MODULE_ENABLED */
+/* #define HAL_WWDG_MODULE_ENABLED */
+#define HAL_PCD_MODULE_ENABLED
+/* #define HAL_HCD_MODULE_ENABLED */
+/* #define HAL_DSI_MODULE_ENABLED */
+/* #define HAL_QSPI_MODULE_ENABLED */
+/* #define HAL_QSPI_MODULE_ENABLED */
+/* #define HAL_CEC_MODULE_ENABLED */
+/* #define HAL_FMPI2C_MODULE_ENABLED */
+/* #define HAL_SPDIFRX_MODULE_ENABLED */
+/* #define HAL_DFSDM_MODULE_ENABLED */
+/* #define HAL_LPTIM_MODULE_ENABLED */
+/* #define HAL_EXTI_MODULE_ENABLED */
+#define HAL_GPIO_MODULE_ENABLED
+#define HAL_EXTI_MODULE_ENABLED
+#define HAL_DMA_MODULE_ENABLED
+#define HAL_RCC_MODULE_ENABLED
+#define HAL_FLASH_MODULE_ENABLED
+#define HAL_PWR_MODULE_ENABLED
+#define HAL_CORTEX_MODULE_ENABLED
+
+/* ########################## HSE/HSI Values adaptation ##################### */
+/**
+ * @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
+ * This value is used by the RCC HAL module to compute the system frequency
+ * (when HSE is used as system clock source, directly or through the PLL).
+ */
+#if !defined (HSE_VALUE)
+ #define HSE_VALUE ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */
+#endif /* HSE_VALUE */
+
+#if !defined (HSE_STARTUP_TIMEOUT)
+ #define HSE_STARTUP_TIMEOUT ((uint32_t)100U) /*!< Time out for HSE start up, in ms */
+#endif /* HSE_STARTUP_TIMEOUT */
+
+/**
+ * @brief Internal High Speed oscillator (HSI) value.
+ * This value is used by the RCC HAL module to compute the system frequency
+ * (when HSI is used as system clock source, directly or through the PLL).
+ */
+#if !defined (HSI_VALUE)
+ #define HSI_VALUE ((uint32_t)16000000) /*!< Value of the Internal oscillator in Hz*/
+#endif /* HSI_VALUE */
+
+/**
+ * @brief Internal Low Speed oscillator (LSI) value.
+ */
+#if !defined (LSI_VALUE)
+ #define LSI_VALUE ((uint32_t)40000)
+#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
+ The real value may vary depending on the variations
+ in voltage and temperature. */
+/**
+ * @brief External Low Speed oscillator (LSE) value.
+ */
+#if !defined (LSE_VALUE)
+ #define LSE_VALUE ((uint32_t)32768) /*!< Value of the External Low Speed oscillator in Hz */
+#endif /* LSE_VALUE */
+
+#if !defined (LSE_STARTUP_TIMEOUT)
+ #define LSE_STARTUP_TIMEOUT ((uint32_t)5000U) /*!< Time out for LSE start up, in ms */
+#endif /* LSE_STARTUP_TIMEOUT */
+
+
+/**
+ * @brief External clock source for I2S peripheral
+ * This value is used by the I2S HAL module to compute the I2S clock source
+ * frequency, this source is inserted directly through I2S_CKIN pad.
+ */
+#if !defined (EXTERNAL_CLOCK_VALUE)
+ #define EXTERNAL_CLOCK_VALUE ((uint32_t)12288000U) /*!< Value of the External audio frequency in Hz*/
+#endif /* EXTERNAL_CLOCK_VALUE */
+
+/* Tip: To avoid modifying this file each time you need to use different HSE,
+ === you can define the HSE value in your toolchain compiler preprocessor. */
+
+/* ########################### System Configuration ######################### */
+/**
+ * @brief This is the HAL system configuration section
+ */
+#define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */
+#define TICK_INT_PRIORITY ((uint32_t)0U) /*!< tick interrupt priority */
+#define USE_RTOS 0U
+#define PREFETCH_ENABLE 1U
+#define INSTRUCTION_CACHE_ENABLE 1U
+#define DATA_CACHE_ENABLE 1U
+
+/* ########################## Assert Selection ############################## */
+/**
+ * @brief Uncomment the line below to expanse the "assert_param" macro in the
+ * HAL drivers code
+ */
+/* #define USE_FULL_ASSERT 1U */
+
+/* ################## Ethernet peripheral configuration ##################### */
+
+/* Section 1 : Ethernet peripheral configuration */
+
+/* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */
+#define MAC_ADDR0 2U
+#define MAC_ADDR1 0U
+#define MAC_ADDR2 0U
+#define MAC_ADDR3 0U
+#define MAC_ADDR4 0U
+#define MAC_ADDR5 0U
+
+/* Definition of the Ethernet driver buffers size and count */
+#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */
+#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */
+#define ETH_RXBUFNB ((uint32_t)4U) /* 4 Rx buffers of size ETH_RX_BUF_SIZE */
+#define ETH_TXBUFNB ((uint32_t)4U) /* 4 Tx buffers of size ETH_TX_BUF_SIZE */
+
+/* Section 2: PHY configuration section */
+
+/* DP83848_PHY_ADDRESS Address*/
+#define DP83848_PHY_ADDRESS 0x01U
+/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/
+#define PHY_RESET_DELAY ((uint32_t)0x000000FFU)
+/* PHY Configuration delay */
+#define PHY_CONFIG_DELAY ((uint32_t)0x00000FFFU)
+
+#define PHY_READ_TO ((uint32_t)0x0000FFFFU)
+#define PHY_WRITE_TO ((uint32_t)0x0000FFFFU)
+
+/* Section 3: Common PHY Registers */
+
+#define PHY_BCR ((uint16_t)0x0000U) /*!< Transceiver Basic Control Register */
+#define PHY_BSR ((uint16_t)0x0001U) /*!< Transceiver Basic Status Register */
+
+#define PHY_RESET ((uint16_t)0x8000U) /*!< PHY Reset */
+#define PHY_LOOPBACK ((uint16_t)0x4000U) /*!< Select loop-back mode */
+#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100U) /*!< Set the full-duplex mode at 100 Mb/s */
+#define PHY_HALFDUPLEX_100M ((uint16_t)0x2000U) /*!< Set the half-duplex mode at 100 Mb/s */
+#define PHY_FULLDUPLEX_10M ((uint16_t)0x0100U) /*!< Set the full-duplex mode at 10 Mb/s */
+#define PHY_HALFDUPLEX_10M ((uint16_t)0x0000U) /*!< Set the half-duplex mode at 10 Mb/s */
+#define PHY_AUTONEGOTIATION ((uint16_t)0x1000U) /*!< Enable auto-negotiation function */
+#define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200U) /*!< Restart auto-negotiation function */
+#define PHY_POWERDOWN ((uint16_t)0x0800U) /*!< Select the power down mode */
+#define PHY_ISOLATE ((uint16_t)0x0400U) /*!< Isolate PHY from MII */
+
+#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020U) /*!< Auto-Negotiation process completed */
+#define PHY_LINKED_STATUS ((uint16_t)0x0004U) /*!< Valid link established */
+#define PHY_JABBER_DETECTION ((uint16_t)0x0002U) /*!< Jabber condition detected */
+
+/* Section 4: Extended PHY Registers */
+#define PHY_SR ((uint16_t)0x10U) /*!< PHY status register Offset */
+
+#define PHY_SPEED_STATUS ((uint16_t)0x0002U) /*!< PHY Speed mask */
+#define PHY_DUPLEX_STATUS ((uint16_t)0x0004U) /*!< PHY Duplex mask */
+
+/* ################## SPI peripheral configuration ########################## */
+
+/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver
+* Activated: CRC code is present inside driver
+* Deactivated: CRC code cleaned from driver
+*/
+
+#define USE_SPI_CRC 0U
+
+/* Includes ------------------------------------------------------------------*/
+/**
+ * @brief Include module's header file
+ */
+
+#ifdef HAL_RCC_MODULE_ENABLED
+ #include "stm32f4xx_hal_rcc.h"
+#endif /* HAL_RCC_MODULE_ENABLED */
+
+#ifdef HAL_EXTI_MODULE_ENABLED
+ #include "stm32f4xx_hal_exti.h"
+#endif /* HAL_EXTI_MODULE_ENABLED */
+
+#ifdef HAL_GPIO_MODULE_ENABLED
+ #include "stm32f4xx_hal_gpio.h"
+#endif /* HAL_GPIO_MODULE_ENABLED */
+
+#ifdef HAL_DMA_MODULE_ENABLED
+ #include "stm32f4xx_hal_dma.h"
+#endif /* HAL_DMA_MODULE_ENABLED */
+
+#ifdef HAL_CORTEX_MODULE_ENABLED
+ #include "stm32f4xx_hal_cortex.h"
+#endif /* HAL_CORTEX_MODULE_ENABLED */
+
+#ifdef HAL_ADC_MODULE_ENABLED
+ #include "stm32f4xx_hal_adc.h"
+#endif /* HAL_ADC_MODULE_ENABLED */
+
+#ifdef HAL_CAN_MODULE_ENABLED
+ #include "stm32f4xx_hal_can.h"
+#endif /* HAL_CAN_MODULE_ENABLED */
+
+#ifdef HAL_CRC_MODULE_ENABLED
+ #include "stm32f4xx_hal_crc.h"
+#endif /* HAL_CRC_MODULE_ENABLED */
+
+#ifdef HAL_CRYP_MODULE_ENABLED
+ #include "stm32f4xx_hal_cryp.h"
+#endif /* HAL_CRYP_MODULE_ENABLED */
+
+#ifdef HAL_DMA2D_MODULE_ENABLED
+ #include "stm32f4xx_hal_dma2d.h"
+#endif /* HAL_DMA2D_MODULE_ENABLED */
+
+#ifdef HAL_DAC_MODULE_ENABLED
+ #include "stm32f4xx_hal_dac.h"
+#endif /* HAL_DAC_MODULE_ENABLED */
+
+#ifdef HAL_DCMI_MODULE_ENABLED
+ #include "stm32f4xx_hal_dcmi.h"
+#endif /* HAL_DCMI_MODULE_ENABLED */
+
+#ifdef HAL_ETH_MODULE_ENABLED
+ #include "stm32f4xx_hal_eth.h"
+#endif /* HAL_ETH_MODULE_ENABLED */
+
+#ifdef HAL_FLASH_MODULE_ENABLED
+ #include "stm32f4xx_hal_flash.h"
+#endif /* HAL_FLASH_MODULE_ENABLED */
+
+#ifdef HAL_SRAM_MODULE_ENABLED
+ #include "stm32f4xx_hal_sram.h"
+#endif /* HAL_SRAM_MODULE_ENABLED */
+
+#ifdef HAL_NOR_MODULE_ENABLED
+ #include "stm32f4xx_hal_nor.h"
+#endif /* HAL_NOR_MODULE_ENABLED */
+
+#ifdef HAL_NAND_MODULE_ENABLED
+ #include "stm32f4xx_hal_nand.h"
+#endif /* HAL_NAND_MODULE_ENABLED */
+
+#ifdef HAL_PCCARD_MODULE_ENABLED
+ #include "stm32f4xx_hal_pccard.h"
+#endif /* HAL_PCCARD_MODULE_ENABLED */
+
+#ifdef HAL_SDRAM_MODULE_ENABLED
+ #include "stm32f4xx_hal_sdram.h"
+#endif /* HAL_SDRAM_MODULE_ENABLED */
+
+#ifdef HAL_HASH_MODULE_ENABLED
+ #include "stm32f4xx_hal_hash.h"
+#endif /* HAL_HASH_MODULE_ENABLED */
+
+#ifdef HAL_I2C_MODULE_ENABLED
+ #include "stm32f4xx_hal_i2c.h"
+#endif /* HAL_I2C_MODULE_ENABLED */
+
+#ifdef HAL_I2S_MODULE_ENABLED
+ #include "stm32f4xx_hal_i2s.h"
+#endif /* HAL_I2S_MODULE_ENABLED */
+
+#ifdef HAL_IWDG_MODULE_ENABLED
+ #include "stm32f4xx_hal_iwdg.h"
+#endif /* HAL_IWDG_MODULE_ENABLED */
+
+#ifdef HAL_LTDC_MODULE_ENABLED
+ #include "stm32f4xx_hal_ltdc.h"
+#endif /* HAL_LTDC_MODULE_ENABLED */
+
+#ifdef HAL_PWR_MODULE_ENABLED
+ #include "stm32f4xx_hal_pwr.h"
+#endif /* HAL_PWR_MODULE_ENABLED */
+
+#ifdef HAL_RNG_MODULE_ENABLED
+ #include "stm32f4xx_hal_rng.h"
+#endif /* HAL_RNG_MODULE_ENABLED */
+
+#ifdef HAL_RTC_MODULE_ENABLED
+ #include "stm32f4xx_hal_rtc.h"
+#endif /* HAL_RTC_MODULE_ENABLED */
+
+#ifdef HAL_SAI_MODULE_ENABLED
+ #include "stm32f4xx_hal_sai.h"
+#endif /* HAL_SAI_MODULE_ENABLED */
+
+#ifdef HAL_SD_MODULE_ENABLED
+ #include "stm32f4xx_hal_sd.h"
+#endif /* HAL_SD_MODULE_ENABLED */
+
+#ifdef HAL_MMC_MODULE_ENABLED
+ #include "stm32f4xx_hal_mmc.h"
+#endif /* HAL_MMC_MODULE_ENABLED */
+
+#ifdef HAL_SPI_MODULE_ENABLED
+ #include "stm32f4xx_hal_spi.h"
+#endif /* HAL_SPI_MODULE_ENABLED */
+
+#ifdef HAL_TIM_MODULE_ENABLED
+ #include "stm32f4xx_hal_tim.h"
+#endif /* HAL_TIM_MODULE_ENABLED */
+
+#ifdef HAL_UART_MODULE_ENABLED
+ #include "stm32f4xx_hal_uart.h"
+#endif /* HAL_UART_MODULE_ENABLED */
+
+#ifdef HAL_USART_MODULE_ENABLED
+ #include "stm32f4xx_hal_usart.h"
+#endif /* HAL_USART_MODULE_ENABLED */
+
+#ifdef HAL_IRDA_MODULE_ENABLED
+ #include "stm32f4xx_hal_irda.h"
+#endif /* HAL_IRDA_MODULE_ENABLED */
+
+#ifdef HAL_SMARTCARD_MODULE_ENABLED
+ #include "stm32f4xx_hal_smartcard.h"
+#endif /* HAL_SMARTCARD_MODULE_ENABLED */
+
+#ifdef HAL_WWDG_MODULE_ENABLED
+ #include "stm32f4xx_hal_wwdg.h"
+#endif /* HAL_WWDG_MODULE_ENABLED */
+
+#ifdef HAL_PCD_MODULE_ENABLED
+ #include "stm32f4xx_hal_pcd.h"
+#endif /* HAL_PCD_MODULE_ENABLED */
+
+#ifdef HAL_HCD_MODULE_ENABLED
+ #include "stm32f4xx_hal_hcd.h"
+#endif /* HAL_HCD_MODULE_ENABLED */
+
+#ifdef HAL_DSI_MODULE_ENABLED
+ #include "stm32f4xx_hal_dsi.h"
+#endif /* HAL_DSI_MODULE_ENABLED */
+
+#ifdef HAL_QSPI_MODULE_ENABLED
+ #include "stm32f4xx_hal_qspi.h"
+#endif /* HAL_QSPI_MODULE_ENABLED */
+
+#ifdef HAL_CEC_MODULE_ENABLED
+ #include "stm32f4xx_hal_cec.h"
+#endif /* HAL_CEC_MODULE_ENABLED */
+
+#ifdef HAL_FMPI2C_MODULE_ENABLED
+ #include "stm32f4xx_hal_fmpi2c.h"
+#endif /* HAL_FMPI2C_MODULE_ENABLED */
+
+#ifdef HAL_SPDIFRX_MODULE_ENABLED
+ #include "stm32f4xx_hal_spdifrx.h"
+#endif /* HAL_SPDIFRX_MODULE_ENABLED */
+
+#ifdef HAL_DFSDM_MODULE_ENABLED
+ #include "stm32f4xx_hal_dfsdm.h"
+#endif /* HAL_DFSDM_MODULE_ENABLED */
+
+#ifdef HAL_LPTIM_MODULE_ENABLED
+ #include "stm32f4xx_hal_lptim.h"
+#endif /* HAL_LPTIM_MODULE_ENABLED */
+
+/* Exported macro ------------------------------------------------------------*/
+#ifdef USE_FULL_ASSERT
+/**
+ * @brief The assert_param macro is used for function's parameters check.
+ * @param expr: If expr is false, it calls assert_failed function
+ * which reports the name of the source file and the source
+ * line number of the call that failed.
+ * If expr is true, it returns no value.
+ * @retval None
+ */
+ #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
+/* Exported functions ------------------------------------------------------- */
+ void assert_failed(uint8_t* file, uint32_t line);
+#else
+ #define assert_param(expr) ((void)0U)
+#endif /* USE_FULL_ASSERT */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STM32F4xx_HAL_CONF_H */
+
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/ports/stm32f4/boards/feather_stm32f405_express/mpconfigboard.h b/ports/stm32f4/boards/feather_stm32f405_express/mpconfigboard.h
index a1d83a25a..ad9bba7b0 100644
--- a/ports/stm32f4/boards/feather_stm32f405_express/mpconfigboard.h
+++ b/ports/stm32f4/boards/feather_stm32f405_express/mpconfigboard.h
@@ -40,6 +40,11 @@
#define SPI_FLASH_SCK_PIN (&pin_PB03)
#define SPI_FLASH_CS_PIN (&pin_PA15)
+// Bootloader only
+#ifdef UF2_BOOTLOADER_ENABLED
+ #define BOARD_VTOR_DEFER //Leave VTOR relocation to bootloader
+#endif
+
#define DEFAULT_I2C_BUS_SCL (&pin_PB06)
#define DEFAULT_I2C_BUS_SDA (&pin_PB07)
diff --git a/ports/stm32f4/boards/feather_stm32f405_express/mpconfigboard.mk b/ports/stm32f4/boards/feather_stm32f405_express/mpconfigboard.mk
index 5bad4e81f..312ca6b48 100644
--- a/ports/stm32f4/boards/feather_stm32f405_express/mpconfigboard.mk
+++ b/ports/stm32f4/boards/feather_stm32f405_express/mpconfigboard.mk
@@ -14,6 +14,9 @@ MCU_VARIANT = stm32f4
MCU_SUB_VARIANT = stm32f405xx
MCU_PACKAGE = 64
CMSIS_MCU = STM32F405xx
-LD_FILE = boards/STM32F405.ld
-TEXT0_ADDR = 0x08000000
-TEXT1_ADDR = 0x08010000 \ No newline at end of file
+
+# Default includes filesystem, but uses external flash
+LD_DEFAULT = boards/STM32F405_default.ld
+LD_BOOT = boards/STM32F405_boot.ld # UF2 boot option
+UF2_OFFSET = 0x8010000
+
diff --git a/ports/stm32f4/boards/meowbit_v121/mpconfigboard.mk b/ports/stm32f4/boards/meowbit_v121/mpconfigboard.mk
index 340fd9d3b..16268ba11 100644
--- a/ports/stm32f4/boards/meowbit_v121/mpconfigboard.mk
+++ b/ports/stm32f4/boards/meowbit_v121/mpconfigboard.mk
@@ -19,5 +19,6 @@ MCU_VARIANT = stm32f4
MCU_SUB_VARIANT = stm32f401xe
MCU_PACKAGE = 64
CMSIS_MCU = STM32F401xE
-LD_FILE = boards/STM32F401_boot.ld
-# LD_FILE = boards/STM32F401_fs.ld #use for internal flash \ No newline at end of file
+LD_FILE = boards/STM32F401xe_boot.ld
+# LD_FILE = boards/STM32F401xe_fs.ld # use for internal flash
+
diff --git a/ports/stm32f4/boards/pyb_nano_v2/mpconfigboard.mk b/ports/stm32f4/boards/pyb_nano_v2/mpconfigboard.mk
index d46ee0b08..a8472608b 100644
--- a/ports/stm32f4/boards/pyb_nano_v2/mpconfigboard.mk
+++ b/ports/stm32f4/boards/pyb_nano_v2/mpconfigboard.mk
@@ -15,5 +15,4 @@ MCU_SUB_VARIANT = stm32f411xe
MCU_PACKAGE = 48
CMSIS_MCU = STM32F411xE
LD_FILE = boards/STM32F411VETx_FLASH.ld
-TEXT0_ADDR = 0x08000000
-TEXT1_ADDR = 0x08020000 \ No newline at end of file
+
diff --git a/ports/stm32f4/boards/pyboard_v11/mpconfigboard.mk b/ports/stm32f4/boards/pyboard_v11/mpconfigboard.mk
index a01ff7923..ef1b8f0ca 100644
--- a/ports/stm32f4/boards/pyboard_v11/mpconfigboard.mk
+++ b/ports/stm32f4/boards/pyboard_v11/mpconfigboard.mk
@@ -12,6 +12,5 @@ MCU_VARIANT = stm32f4
MCU_SUB_VARIANT = stm32f405xx
MCU_PACKAGE = 64
CMSIS_MCU = STM32F405xx
-LD_FILE = boards/STM32F405.ld
-TEXT0_ADDR = 0x08000000
-TEXT1_ADDR = 0x08010000
+LD_FILE = boards/STM32F405_fs.ld
+
diff --git a/ports/stm32f4/boards/stm32f411ce_blackpill/mpconfigboard.mk b/ports/stm32f4/boards/stm32f411ce_blackpill/mpconfigboard.mk
index d4f0f9577..68c6a1eea 100644
--- a/ports/stm32f4/boards/stm32f411ce_blackpill/mpconfigboard.mk
+++ b/ports/stm32f4/boards/stm32f411ce_blackpill/mpconfigboard.mk
@@ -18,5 +18,4 @@ MCU_SUB_VARIANT = stm32f411xe
MCU_PACKAGE = 48
CMSIS_MCU = STM32F411xE
LD_FILE = boards/STM32F411VETx_FLASH.ld
-TEXT0_ADDR = 0x08000000
-TEXT1_ADDR = 0x08020000
+
diff --git a/ports/stm32f4/boards/stm32f411ve_discovery/mpconfigboard.mk b/ports/stm32f4/boards/stm32f411ve_discovery/mpconfigboard.mk
index d6f369b6e..64e2b4dc5 100644
--- a/ports/stm32f4/boards/stm32f411ve_discovery/mpconfigboard.mk
+++ b/ports/stm32f4/boards/stm32f411ve_discovery/mpconfigboard.mk
@@ -13,5 +13,4 @@ MCU_SUB_VARIANT = stm32f411xe
MCU_PACKAGE = 100
CMSIS_MCU = STM32F411xE
LD_FILE = boards/STM32F411VETx_FLASH.ld
-TEXT0_ADDR = 0x08000000
-TEXT1_ADDR = 0x08020000 \ No newline at end of file
+
diff --git a/ports/stm32f4/boards/stm32f412zg_discovery/mpconfigboard.mk b/ports/stm32f4/boards/stm32f412zg_discovery/mpconfigboard.mk
index d642f243e..b0205fc73 100644
--- a/ports/stm32f4/boards/stm32f412zg_discovery/mpconfigboard.mk
+++ b/ports/stm32f4/boards/stm32f412zg_discovery/mpconfigboard.mk
@@ -18,6 +18,5 @@ MCU_SUB_VARIANT = stm32f412zx
MCU_PACKAGE = 144
CMSIS_MCU = STM32F412Zx
LD_FILE = boards/STM32F412ZGTx_FLASH.ld
-TEXT0_ADDR = 0x08000000
-TEXT1_ADDR = 0x08020000
+
diff --git a/ports/stm32f4/common-hal/time/__init__.c b/ports/stm32f4/common-hal/time/__init__.c
index 976f519db..c85077868 100644
--- a/ports/stm32f4/common-hal/time/__init__.c
+++ b/ports/stm32f4/common-hal/time/__init__.c
@@ -32,6 +32,14 @@ uint64_t common_hal_time_monotonic(void) {
return supervisor_ticks_ms64();
}
+uint64_t common_hal_time_monotonic_ns(void) {
+ uint64_t ms;
+ uint32_t us_until_ms;
+ current_tick(&ms, &us_until_ms);
+ // us counts down.
+ return 1000 * (ms * 1000 + (1000 - us_until_ms));
+}
+
void common_hal_time_delay_ms(uint32_t delay) {
mp_hal_delay_ms(delay);
}
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/clocks.c b/ports/stm32f4/peripherals/stm32f4/stm32f401xe/clocks.c
index 53af29b3b..53810af26 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/clocks.c
+++ b/ports/stm32f4/peripherals/stm32f4/stm32f401xe/clocks.c
@@ -25,6 +25,7 @@
* THE SOFTWARE.
*/
#include "stm32f4xx_hal.h"
+#include "py/mpconfig.h"
void stm32f4_peripherals_clocks_init(void) {
//System clock init
@@ -44,7 +45,7 @@ void stm32f4_peripherals_clocks_init(void) {
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
- RCC_OscInitStruct.PLL.PLLM = 12;
+ RCC_OscInitStruct.PLL.PLLM = BOARD_OSC_DIV;
RCC_OscInitStruct.PLL.PLLN = 336;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4;
RCC_OscInitStruct.PLL.PLLQ = 7;
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/gpio.c b/ports/stm32f4/peripherals/stm32f4/stm32f401xe/gpio.c
index 28afee5d8..7bd619662 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/gpio.c
+++ b/ports/stm32f4/peripherals/stm32f4/stm32f401xe/gpio.c
@@ -38,7 +38,6 @@ void stm32f4_peripherals_gpio_init(void) {
__HAL_RCC_GPIOH_CLK_ENABLE();
//Never reset pins
- never_reset_pin_number(2,13); //PC13 anti tamp
never_reset_pin_number(2,14); //PC14 OSC32_IN
never_reset_pin_number(2,15); //PC15 OSC32_OUT
never_reset_pin_number(0,13); //PA13 SWDIO
diff --git a/py/objexcept.c b/py/objexcept.c
index c33ada0d6..b7a536c5e 100644
--- a/py/objexcept.c
+++ b/py/objexcept.c
@@ -112,17 +112,23 @@ void mp_obj_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kin
if (o->args == NULL || o->args->len == 0) {
mp_print_str(print, "");
return;
- } else if (o->args->len == 1) {
+ }
+ if (MP_OBJ_IS_SMALL_INT(o->args->items[0]) &&
+ mp_obj_is_subclass_fast(MP_OBJ_FROM_PTR(o->base.type), MP_OBJ_FROM_PTR(&mp_type_OSError)) &&
+ o->args->len <= 2) {
// try to provide a nice OSError error message
- if (MP_OBJ_IS_SMALL_INT(o->args->items[0]) &&
- mp_obj_is_subclass_fast(MP_OBJ_FROM_PTR(o->base.type), MP_OBJ_FROM_PTR(&mp_type_OSError))) {
- char decompressed[50];
- const char *msg = mp_common_errno_to_str(o->args->items[0], decompressed, sizeof(decompressed));
- if (msg != NULL) {
- mp_printf(print, "[Errno " INT_FMT "] %s", MP_OBJ_SMALL_INT_VALUE(o->args->items[0]), msg);
- return;
+ char decompressed[50];
+ const char *msg = mp_common_errno_to_str(o->args->items[0], decompressed, sizeof(decompressed));
+ if (msg != NULL) {
+ mp_printf(print, "[Errno " INT_FMT "] %s", MP_OBJ_SMALL_INT_VALUE(o->args->items[0]), msg);
+ // if second arg exists, it is filename.
+ if (o->args->len == 2) {
+ mp_printf(print, ": '%s'", mp_obj_str_get_str(o->args->items[1]));
}
+ return;
}
+ }
+ if (o->args->len == 1) {
mp_obj_print_helper(print, o->args->items[0], PRINT_STR);
return;
}
diff --git a/py/runtime.c b/py/runtime.c
index 48416bab2..c1c311ae4 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -29,10 +29,12 @@
#include <string.h>
#include <assert.h>
+
#include "extmod/vfs.h"
#include "py/parsenum.h"
#include "py/compile.h"
+#include "py/mperrno.h"
#include "py/objstr.h"
#include "py/objtuple.h"
#include "py/objtype.h"
@@ -1576,6 +1578,14 @@ NORETURN void mp_raise_OSError_msg(const compressed_string_t *msg) {
mp_raise_msg(&mp_type_OSError, msg);
}
+NORETURN void mp_raise_OSError_errno_str(int errno_, mp_obj_t str) {
+ mp_obj_t args[2] = {
+ MP_OBJ_NEW_SMALL_INT(errno_),
+ str,
+ };
+ nlr_raise(mp_obj_new_exception_args(&mp_type_OSError, 2, args));
+}
+
NORETURN void mp_raise_OSError_msg_varg(const compressed_string_t *fmt, ...) {
va_list argptr;
va_start(argptr,fmt);
diff --git a/py/runtime.h b/py/runtime.h
index 4121352df..f81103557 100644
--- a/py/runtime.h
+++ b/py/runtime.h
@@ -161,6 +161,7 @@ NORETURN void mp_raise_RuntimeError(const compressed_string_t *msg);
NORETURN void mp_raise_ImportError(const compressed_string_t *msg);
NORETURN void mp_raise_IndexError(const compressed_string_t *msg);
NORETURN void mp_raise_OSError(int errno_);
+NORETURN void mp_raise_OSError_errno_str(int errno_, mp_obj_t str);
NORETURN void mp_raise_OSError_msg(const compressed_string_t *msg);
NORETURN void mp_raise_OSError_msg_varg(const compressed_string_t *fmt, ...);
NORETURN void mp_raise_NotImplementedError(const compressed_string_t *msg);
diff --git a/shared-bindings/displayio/Palette.c b/shared-bindings/displayio/Palette.c
index dda58e3c5..67a7db85b 100644
--- a/shared-bindings/displayio/Palette.c
+++ b/shared-bindings/displayio/Palette.c
@@ -86,7 +86,8 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
//| Sets the pixel color at the given index. The index should be an integer in the range 0 to color_count-1.
//|
//| The value argument represents a color, and can be from 0x000000 to 0xFFFFFF (to represent an RGB value).
-//| Value can be an int, bytes (3 bytes (RGB) or 4 bytes (RGB + pad byte)), or bytearray.
+//| Value can be an int, bytes (3 bytes (RGB) or 4 bytes (RGB + pad byte)), bytearray,
+//| or a tuple or list of 3 integers.
//|
//| This allows you to::
//|
@@ -94,6 +95,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
//| palette[1] = b'\xff\xff\x00' # set using 3 bytes
//| palette[2] = b'\xff\xff\x00\x00' # set using 4 bytes
//| palette[3] = bytearray(b'\x00\x00\xFF') # set using a bytearay of 3 or 4 bytes
+//| palette[4] = (10, 20, 30) # set using a tuple of 3 integers
//|
STATIC mp_obj_t palette_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value) {
if (value == MP_OBJ_NULL) {
@@ -111,6 +113,12 @@ STATIC mp_obj_t palette_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t val
return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_palette_get_color(self, index));
}
+ // Convert a tuple or list to a bytearray.
+ if (MP_OBJ_IS_TYPE(value, &mp_type_tuple) ||
+ MP_OBJ_IS_TYPE(value, &mp_type_list)) {
+ value = mp_type_bytes.make_new(&mp_type_bytes, 1, &value, NULL);
+ }
+
uint32_t color;
mp_int_t int_value;
mp_buffer_info_t bufinfo;
@@ -130,7 +138,7 @@ STATIC mp_obj_t palette_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t val
}
color = int_value;
} else {
- mp_raise_TypeError(translate("color buffer must be a buffer or int"));
+ mp_raise_TypeError(translate("color buffer must be a buffer, tuple, list, or int"));
}
common_hal_displayio_palette_set_color(self, index, color);
return mp_const_none;
diff --git a/shared-bindings/time/__init__.c b/shared-bindings/time/__init__.c
index b3e4604b5..8d7f2f3fd 100644
--- a/shared-bindings/time/__init__.c
+++ b/shared-bindings/time/__init__.c
@@ -70,14 +70,16 @@ MP_DEFINE_CONST_FUN_OBJ_0(time_monotonic_obj, time_monotonic);
//|
STATIC mp_obj_t time_sleep(mp_obj_t seconds_o) {
#if MICROPY_PY_BUILTINS_FLOAT
- float seconds = mp_obj_get_float(seconds_o);
+ mp_float_t seconds = mp_obj_get_float(seconds_o);
+ mp_float_t msecs = 1000.0f * seconds + 0.5f;
#else
- int seconds = mp_obj_get_int(seconds_o);
+ mp_int_t seconds = mp_obj_get_int(seconds_o);
+ mp_int_t msecs = 1000 * seconds;
#endif
if (seconds < 0) {
mp_raise_ValueError(translate("sleep length must be non-negative"));
}
- common_hal_time_delay_ms(1000 * seconds);
+ common_hal_time_delay_ms(msecs);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_1(time_sleep_obj, time_sleep);
@@ -216,7 +218,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(time_time_obj, time_time);
//| :rtype: int
//|
STATIC mp_obj_t time_monotonic_ns(void) {
- uint64_t time64 = common_hal_time_monotonic() * 1000000llu;
+ uint64_t time64 = common_hal_time_monotonic_ns();
return mp_obj_new_int_from_ll((long long) time64);
}
MP_DEFINE_CONST_FUN_OBJ_0(time_monotonic_ns_obj, time_monotonic_ns);
diff --git a/shared-bindings/time/__init__.h b/shared-bindings/time/__init__.h
index c5a0b47fc..ec96aea24 100644
--- a/shared-bindings/time/__init__.h
+++ b/shared-bindings/time/__init__.h
@@ -36,6 +36,7 @@ extern mp_obj_t struct_time_from_tm(timeutils_struct_time_t *tm);
extern void struct_time_to_tm(mp_obj_t t, timeutils_struct_time_t *tm);
extern uint64_t common_hal_time_monotonic(void);
+extern uint64_t common_hal_time_monotonic_ns(void);
extern void common_hal_time_delay_ms(uint32_t);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_TIME___INIT___H
diff --git a/supervisor/shared/external_flash/devices.h b/supervisor/shared/external_flash/devices.h
index 08d0a78fd..55a52b40d 100644
--- a/supervisor/shared/external_flash/devices.h
+++ b/supervisor/shared/external_flash/devices.h
@@ -371,6 +371,23 @@ typedef struct {
.single_status_byte = false, \
}
+// Settings for the Winbond W25Q80DV 1MiB SPI flash.. Note that W25Q80DL has a different memory type (0x60)
+// Datasheet: https://www.winbond.com/resource-files/w25q80dv%20dl_revh_10022015.pdf
+#define W25Q80DV {\
+ .total_size = (1 << 20), /* 1 MiB */ \
+ .start_up_time_us = 5000, \
+ .manufacturer_id = 0xef, \
+ .memory_type = 0x40, \
+ .capacity = 0x14, \
+ .max_clock_speed_mhz = 104, \
+ .quad_enable_bit_mask = 0x02, \
+ .has_sector_protection = false, \
+ .supports_fast_read = true, \
+ .supports_qspi = true, \
+ .supports_qspi_writes = false, \
+ .write_status_register_split = false, \
+ .single_status_byte = false, \
+}
// Settings for the Winbond W25Q128JV-SQ 16MiB SPI flash. Note that JV-IM has a different .memory_type (0x70)
// Datasheet: https://www.winbond.com/resource-files/w25q128jv%20revf%2003272018%20plus.pdf