From 47849a9e58d5f6d06bb92e00b3de567da1a356dd Mon Sep 17 00:00:00 2001 From: sommersoft Date: Mon, 29 Jun 2020 18:18:25 -0500 Subject: [PATCH 001/770] add custom css for 'viewing-old-docs' message --- docs/static/customstyle.css | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/static/customstyle.css b/docs/static/customstyle.css index 6c964b762c3a8..1136edcd3135d 100644 --- a/docs/static/customstyle.css +++ b/docs/static/customstyle.css @@ -10,6 +10,19 @@ } +/* custom CSS to sticky the ' viewing outdated version' + warning +*/ +.document > .admonition { + position: sticky; + top: 0px; + background-color: salmon; + z-index: 2; +} + +body { + overflow-x: unset!important; +} /* override table width restrictions */ @media screen and (min-width: 767px) { From e1a843878e4272334869b1db4a8222ae344f5cb8 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 17 Aug 2020 09:48:17 -0400 Subject: [PATCH 002/770] add robots.txt to specify doc versions to appear in search engines --- conf.py | 2 +- docs/robots.txt | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 docs/robots.txt diff --git a/conf.py b/conf.py index 4a8b72584e467..f7d028c19bb7c 100644 --- a/conf.py +++ b/conf.py @@ -272,7 +272,7 @@ # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. -#html_extra_path = [] +html_extra_path = ["docs/robots.txt"] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. diff --git a/docs/robots.txt b/docs/robots.txt new file mode 100644 index 0000000000000..39a4eaeed9f59 --- /dev/null +++ b/docs/robots.txt @@ -0,0 +1,6 @@ +User-agent: * +Allow: /*/latest/ +Allow: /en/latest/ # Fallback for bots that don't understand wildcards +Allow: /*/5.3.x/ +Allow: /en/5.3.x/ # Fallback for bots that don't understand wildcards +Disallow: / From dc10e968149f50fbc88158bcb3f78380667abb40 Mon Sep 17 00:00:00 2001 From: Noel Gaetan Date: Sat, 17 Oct 2020 16:54:13 +0200 Subject: [PATCH 003/770] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 29db397932c1f..15b4cfc892222 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ SPDX-License-Identifier: MIT # Contributing Please note that this project is released with a -[Contributor Code of Conduct](https://github.com/adafruit/circuitpython/blob/main/CODE_OF_CONDUCT.md). +[Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms. Participation covers any forum used to converse about CircuitPython including unofficial and official spaces. Failure to do so will result in corrective actions such as time out or ban from the project. From 7cf776d39e9c9e4694b65b636f456630b462958c Mon Sep 17 00:00:00 2001 From: Noel Gaetan Date: Sat, 17 Oct 2020 17:11:17 +0200 Subject: [PATCH 004/770] Update CONTRIBUTING.md test fix url 404 --- CONTRIBUTING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 15b4cfc892222..c94e8db8c63f0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,6 +4,8 @@ SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://g SPDX-License-Identifier: MIT --> + + # Contributing Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). From eb139c9babeda44a7e613602f8aa86d6207cb994 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 19 Oct 2020 17:41:16 -0700 Subject: [PATCH 005/770] Correct pins to not reset. They must have the PORT_ prefix otherwise they mask the wrong pins. Fixes #3552 --- ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.h b/ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.h index cbca94e030944..475752afb3ce8 100644 --- a/ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.h +++ b/ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.h @@ -9,7 +9,7 @@ // These are pins not to reset. // QSPI Data pins, PA23 is NeoPixel -#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11 | PA23) +#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11 | PORT_PA23) // QSPI CS, QSPI SCK #define MICROPY_PORT_B (PORT_PB10 | PORT_PB11) #define MICROPY_PORT_C (0) From 599bacb0b4f4654ad0fbc9844d8cc9365d2ee26e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 20 Oct 2020 10:06:26 -0500 Subject: [PATCH 006/770] build.yml: Fix building mpy-cross-mac Recently, the macos-10.15 image was updated with a non-brew version of awscli. This made our CI script, which does a `brew install awscli` fail: ``` Error: The `brew link` step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink bin/aws Target /usr/local/bin/aws already exists. You may want to remove it: rm '/usr/local/bin/aws' ``` --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b3455cb537f32..447961f85f5d8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -131,7 +131,7 @@ jobs: run: echo "$GITHUB_CONTEXT" - name: Install dependencies run: | - brew install gettext awscli + brew install gettext echo >>$GITHUB_PATH /usr/local/opt/gettext/bin - name: Versions run: | From c58b0adf64a99916a3b360d62dee3b2964f3876b Mon Sep 17 00:00:00 2001 From: "Ryan T. Hamilton" Date: Tue, 20 Oct 2020 14:49:57 -0700 Subject: [PATCH 007/770] Reset sta_mode and ap_mode flags --- ports/esp32s2/common-hal/wifi/__init__.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ports/esp32s2/common-hal/wifi/__init__.c b/ports/esp32s2/common-hal/wifi/__init__.c index 5c8d2e95263f1..65186e9b17f77 100644 --- a/ports/esp32s2/common-hal/wifi/__init__.c +++ b/ports/esp32s2/common-hal/wifi/__init__.c @@ -100,6 +100,13 @@ void common_hal_wifi_init(void) { wifi_radio_obj_t* self = &common_hal_wifi_radio_obj; self->netif = esp_netif_create_default_wifi_sta(); + // Even though we just called esp_netif_create_default_wifi_sta, + // station mode isn't actually set until esp_wifi_set_mode() + // is called and the configuration is loaded via esp_wifi_set_config(). + // Set both convienence flags to false so it's not forgotten. + self->sta_mode = 0; + self->ap_mode = 0; + self->event_group_handle = xEventGroupCreateStatic(&self->event_group); ESP_ERROR_CHECK(esp_event_handler_instance_register(WIFI_EVENT, ESP_EVENT_ANY_ID, From e202da4dadeadfe22d30251d99c5247f024bd746 Mon Sep 17 00:00:00 2001 From: "Ryan T. Hamilton" Date: Tue, 20 Oct 2020 15:14:35 -0700 Subject: [PATCH 008/770] Change comment wording --- ports/esp32s2/common-hal/wifi/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/common-hal/wifi/__init__.c b/ports/esp32s2/common-hal/wifi/__init__.c index 65186e9b17f77..833ef0623fba8 100644 --- a/ports/esp32s2/common-hal/wifi/__init__.c +++ b/ports/esp32s2/common-hal/wifi/__init__.c @@ -101,7 +101,7 @@ void common_hal_wifi_init(void) { self->netif = esp_netif_create_default_wifi_sta(); // Even though we just called esp_netif_create_default_wifi_sta, - // station mode isn't actually set until esp_wifi_set_mode() + // station mode isn't actually ready for use until esp_wifi_set_mode() // is called and the configuration is loaded via esp_wifi_set_config(). // Set both convienence flags to false so it's not forgotten. self->sta_mode = 0; From ea6ef8b1423c653a461371e1bc105b6ff75d88b5 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 20 Oct 2020 00:40:50 +0200 Subject: [PATCH 009/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 6 +++++- locale/cs.po | 6 +++++- locale/de_DE.po | 10 +++++++--- locale/el.po | 6 +++++- locale/es.po | 6 +++++- locale/fil.po | 6 +++++- locale/fr.po | 6 +++++- locale/hi.po | 6 +++++- locale/it_IT.po | 6 +++++- locale/ja.po | 6 +++++- locale/ko.po | 6 +++++- locale/nl.po | 6 +++++- locale/pl.po | 6 +++++- locale/pt_BR.po | 6 +++++- locale/sv.po | 6 +++++- locale/zh_Latn_pinyin.po | 6 +++++- 16 files changed, 82 insertions(+), 18 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index f35afea66de92..ef090afec7189 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-15 16:06+0530\n" +"POT-Creation-Date: 2020-10-16 13:56-0500\n" "PO-Revision-Date: 2020-10-10 23:51+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -2154,6 +2154,10 @@ msgstr "" msgid "buffer too small" msgstr "" +#: shared-bindings/socketpool/Socket.c +msgid "buffer too small for requested bytes" +msgstr "" + #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index d7caa43ea12d1..f86f0fcfdd81c 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-15 16:06+0530\n" +"POT-Creation-Date: 2020-10-16 13:56-0500\n" "PO-Revision-Date: 2020-05-24 03:22+0000\n" "Last-Translator: dronecz \n" "Language-Team: LANGUAGE \n" @@ -2111,6 +2111,10 @@ msgstr "" msgid "buffer too small" msgstr "" +#: shared-bindings/socketpool/Socket.c +msgid "buffer too small for requested bytes" +msgstr "" + #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 6529715660b1e..d400f0a761c4d 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-15 16:06+0530\n" +"POT-Creation-Date: 2020-10-16 13:56-0500\n" "PO-Revision-Date: 2020-06-16 18:24+0000\n" "Last-Translator: Andreas Buchen \n" "Language: de_DE\n" @@ -1986,8 +1986,8 @@ msgstr "WatchDogTimer läuft aktuell nicht" #: shared-bindings/watchdog/WatchDogTimer.c msgid "WatchDogTimer.mode cannot be changed once set to WatchDogMode.RESET" msgstr "" -"WatchDogTimer.mode kann nicht geändert werden, nachdem " -"er auf WatchDogMode.RESET gesetzt wurde" +"WatchDogTimer.mode kann nicht geändert werden, nachdem er auf WatchDogMode." +"RESET gesetzt wurde" #: shared-bindings/watchdog/WatchDogTimer.c msgid "WatchDogTimer.timeout must be greater than 0" @@ -2170,6 +2170,10 @@ msgstr "Puffersegmente müssen gleich lang sein" msgid "buffer too small" msgstr "Der Puffer ist zu klein" +#: shared-bindings/socketpool/Socket.c +msgid "buffer too small for requested bytes" +msgstr "" + #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" msgstr "Tasten müssen digitalio.DigitalInOut sein" diff --git a/locale/el.po b/locale/el.po index 42b083e3c9ff7..676c54c7bc1c8 100644 --- a/locale/el.po +++ b/locale/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-15 16:06+0530\n" +"POT-Creation-Date: 2020-10-16 13:56-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -2106,6 +2106,10 @@ msgstr "" msgid "buffer too small" msgstr "" +#: shared-bindings/socketpool/Socket.c +msgid "buffer too small for requested bytes" +msgstr "" + #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" msgstr "" diff --git a/locale/es.po b/locale/es.po index db20dea1204a1..50c3620d6945d 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-10-15 16:06+0530\n" +"POT-Creation-Date: 2020-10-16 13:56-0500\n" "PO-Revision-Date: 2020-10-17 02:31+0000\n" "Last-Translator: Alvaro Figueroa \n" "Language-Team: \n" @@ -2169,6 +2169,10 @@ msgstr "Las secciones del buffer necesitan tener longitud igual" msgid "buffer too small" msgstr "buffer demasiado pequeño" +#: shared-bindings/socketpool/Socket.c +msgid "buffer too small for requested bytes" +msgstr "" + #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" msgstr "los botones necesitan ser digitalio.DigitalInOut" diff --git a/locale/fil.po b/locale/fil.po index ecda65cb218ea..f90f5bbed762f 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-15 16:06+0530\n" +"POT-Creation-Date: 2020-10-16 13:56-0500\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -2139,6 +2139,10 @@ msgstr "aarehas na haba dapat ang buffer slices" msgid "buffer too small" msgstr "masyadong maliit ang buffer" +#: shared-bindings/socketpool/Socket.c +msgid "buffer too small for requested bytes" +msgstr "" + #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index a8a382c709d34..d1e8b268d6329 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-15 16:06+0530\n" +"POT-Creation-Date: 2020-10-16 13:56-0500\n" "PO-Revision-Date: 2020-10-17 15:35+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" @@ -2179,6 +2179,10 @@ msgstr "les tranches de tampon doivent être de longueurs égales" msgid "buffer too small" msgstr "tampon trop petit" +#: shared-bindings/socketpool/Socket.c +msgid "buffer too small for requested bytes" +msgstr "" + #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" msgstr "les boutons doivent être des digitalio.DigitalInOut" diff --git a/locale/hi.po b/locale/hi.po index 88c795a7ce674..485ce63988140 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-15 16:06+0530\n" +"POT-Creation-Date: 2020-10-16 13:56-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -2106,6 +2106,10 @@ msgstr "" msgid "buffer too small" msgstr "" +#: shared-bindings/socketpool/Socket.c +msgid "buffer too small for requested bytes" +msgstr "" + #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 1650a5bdbda2d..9d299b49b9318 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-15 16:06+0530\n" +"POT-Creation-Date: 2020-10-16 13:56-0500\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -2144,6 +2144,10 @@ msgstr "slice del buffer devono essere della stessa lunghezza" msgid "buffer too small" msgstr "buffer troppo piccolo" +#: shared-bindings/socketpool/Socket.c +msgid "buffer too small for requested bytes" +msgstr "" + #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" msgstr "" diff --git a/locale/ja.po b/locale/ja.po index 01900d9a8f178..ac883044cba05 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-15 16:06+0530\n" +"POT-Creation-Date: 2020-10-16 13:56-0500\n" "PO-Revision-Date: 2020-09-25 18:20+0000\n" "Last-Translator: Taku Fukada \n" "Language-Team: none\n" @@ -2131,6 +2131,10 @@ msgstr "バッファのスライスは同じ長さでなければなりません msgid "buffer too small" msgstr "" +#: shared-bindings/socketpool/Socket.c +msgid "buffer too small for requested bytes" +msgstr "" + #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" msgstr "buttonsはdigitalio.DigitalInOutでなければなりません" diff --git a/locale/ko.po b/locale/ko.po index a9bc60f781455..dea656591cb88 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-15 16:06+0530\n" +"POT-Creation-Date: 2020-10-16 13:56-0500\n" "PO-Revision-Date: 2020-10-05 12:12+0000\n" "Last-Translator: Michal Čihař \n" "Language-Team: LANGUAGE \n" @@ -2112,6 +2112,10 @@ msgstr "" msgid "buffer too small" msgstr "" +#: shared-bindings/socketpool/Socket.c +msgid "buffer too small for requested bytes" +msgstr "" + #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index edcaefb8325ac..ed75cdd8c1823 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-15 16:06+0530\n" +"POT-Creation-Date: 2020-10-16 13:56-0500\n" "PO-Revision-Date: 2020-09-09 16:05+0000\n" "Last-Translator: Jelle Jager \n" "Language-Team: none\n" @@ -2158,6 +2158,10 @@ msgstr "buffer slices moeten van gelijke grootte zijn" msgid "buffer too small" msgstr "buffer te klein" +#: shared-bindings/socketpool/Socket.c +msgid "buffer too small for requested bytes" +msgstr "" + #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" msgstr "buttons moeten digitalio.DigitalInOut zijn" diff --git a/locale/pl.po b/locale/pl.po index b79fcc606b88e..ec5fe5a65c015 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-15 16:06+0530\n" +"POT-Creation-Date: 2020-10-16 13:56-0500\n" "PO-Revision-Date: 2020-09-29 01:39+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" @@ -2128,6 +2128,10 @@ msgstr "fragmenty bufora muszą mieć tę samą długość" msgid "buffer too small" msgstr "zbyt mały bufor" +#: shared-bindings/socketpool/Socket.c +msgid "buffer too small for requested bytes" +msgstr "" + #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" msgstr "buttons musi być digitalio.DigitalInOut" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 240a56104e64d..b21b728eadc73 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-15 16:06+0530\n" +"POT-Creation-Date: 2020-10-16 13:56-0500\n" "PO-Revision-Date: 2020-10-16 17:01+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -2177,6 +2177,10 @@ msgstr "as fatias do buffer devem ter o mesmo comprimento" msgid "buffer too small" msgstr "o buffer é muito pequeno" +#: shared-bindings/socketpool/Socket.c +msgid "buffer too small for requested bytes" +msgstr "" + #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" msgstr "os botões devem ser digitalio.DigitalInOut" diff --git a/locale/sv.po b/locale/sv.po index f3bf71558aa56..42e8ce2c452cd 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-15 16:06+0530\n" +"POT-Creation-Date: 2020-10-16 13:56-0500\n" "PO-Revision-Date: 2020-10-14 18:12+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -2155,6 +2155,10 @@ msgstr "buffertsegmenten måste vara lika långa" msgid "buffer too small" msgstr "buffert för liten" +#: shared-bindings/socketpool/Socket.c +msgid "buffer too small for requested bytes" +msgstr "" + #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" msgstr "buttons måste vara digitalio.DigitalInOut" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 892b9ac58baa9..42c6e39d58515 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-15 16:06+0530\n" +"POT-Creation-Date: 2020-10-16 13:56-0500\n" "PO-Revision-Date: 2020-10-17 02:31+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -2147,6 +2147,10 @@ msgstr "huǎnchōng qū qiēpiàn bìxū chángdù xiāngděng" msgid "buffer too small" msgstr "huǎnchōng qū tài xiǎo" +#: shared-bindings/socketpool/Socket.c +msgid "buffer too small for requested bytes" +msgstr "" + #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" msgstr "ànniǔ bìxū shì digitalio.DigitalInOut" From c65b0985b897b21129356cad95df75d9698478eb Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Tue, 20 Oct 2020 02:57:36 +0000 Subject: [PATCH 010/770] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (835 of 835 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index b21b728eadc73..20e7d68962749 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-10-16 13:56-0500\n" -"PO-Revision-Date: 2020-10-16 17:01+0000\n" +"PO-Revision-Date: 2020-10-20 17:13+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.3.1-dev\n" +"X-Generator: Weblate 4.3.1\n" #: main.c msgid "" @@ -2179,7 +2179,7 @@ msgstr "o buffer é muito pequeno" #: shared-bindings/socketpool/Socket.c msgid "buffer too small for requested bytes" -msgstr "" +msgstr "o buffer é pequeno demais para os bytes requisitados" #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" From 41d02fd53d39b01deff2d8cc0da83f1407cdf888 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 20 Oct 2020 19:42:08 +0200 Subject: [PATCH 011/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 6 +++++- locale/cs.po | 6 +++++- locale/de_DE.po | 6 +++++- locale/el.po | 6 +++++- locale/es.po | 6 +++++- locale/fil.po | 6 +++++- locale/fr.po | 6 +++++- locale/hi.po | 6 +++++- locale/it_IT.po | 6 +++++- locale/ja.po | 6 +++++- locale/ko.po | 6 +++++- locale/nl.po | 6 +++++- locale/pl.po | 6 +++++- locale/pt_BR.po | 6 +++++- locale/sv.po | 6 +++++- locale/zh_Latn_pinyin.po | 6 +++++- 16 files changed, 80 insertions(+), 16 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index ef090afec7189..958ff1e6b2691 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 13:56-0500\n" +"POT-Creation-Date: 2020-10-16 19:50-0500\n" "PO-Revision-Date: 2020-10-10 23:51+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -1431,6 +1431,10 @@ msgstr "" "Hanya monokrom, 4bpp atau 8bpp yang diindeks, dan 16bpp atau lebih yang " "didukung: %d bpp diberikan" +#: shared-module/displayio/ColorConverter.c +msgid "Only one color can be transparent at a time" +msgstr "" + #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index f86f0fcfdd81c..6a3d00d993f5c 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 13:56-0500\n" +"POT-Creation-Date: 2020-10-16 19:50-0500\n" "PO-Revision-Date: 2020-05-24 03:22+0000\n" "Last-Translator: dronecz \n" "Language-Team: LANGUAGE \n" @@ -1408,6 +1408,10 @@ msgid "" "%d bpp given" msgstr "" +#: shared-module/displayio/ColorConverter.c +msgid "Only one color can be transparent at a time" +msgstr "" + #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index d400f0a761c4d..e54b670a9029d 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 13:56-0500\n" +"POT-Creation-Date: 2020-10-16 19:50-0500\n" "PO-Revision-Date: 2020-06-16 18:24+0000\n" "Last-Translator: Andreas Buchen \n" "Language: de_DE\n" @@ -1433,6 +1433,10 @@ msgstr "" "Nur monochrome, indizierte 4bpp oder 8bpp, und 16bpp oder größere BMPs " "unterstützt: %d bpp wurden gegeben" +#: shared-module/displayio/ColorConverter.c +msgid "Only one color can be transparent at a time" +msgstr "" + #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" msgstr "" diff --git a/locale/el.po b/locale/el.po index 676c54c7bc1c8..5e55065b30dd6 100644 --- a/locale/el.po +++ b/locale/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 13:56-0500\n" +"POT-Creation-Date: 2020-10-16 19:50-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -1403,6 +1403,10 @@ msgid "" "%d bpp given" msgstr "" +#: shared-module/displayio/ColorConverter.c +msgid "Only one color can be transparent at a time" +msgstr "" + #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" msgstr "" diff --git a/locale/es.po b/locale/es.po index 50c3620d6945d..8cd5e6c22b6f9 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-10-16 13:56-0500\n" +"POT-Creation-Date: 2020-10-16 19:50-0500\n" "PO-Revision-Date: 2020-10-17 02:31+0000\n" "Last-Translator: Alvaro Figueroa \n" "Language-Team: \n" @@ -1432,6 +1432,10 @@ msgstr "" "Solo se admiten BMP monocromáticos, indexados de 4 bpp u 8 bpp y 16 bpp o " "más: %d bpp proporcionados" +#: shared-module/displayio/ColorConverter.c +msgid "Only one color can be transparent at a time" +msgstr "" + #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" msgstr "Solo se aceptan enteros crudos para ip" diff --git a/locale/fil.po b/locale/fil.po index f90f5bbed762f..7a91f5c8598e9 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 13:56-0500\n" +"POT-Creation-Date: 2020-10-16 19:50-0500\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -1421,6 +1421,10 @@ msgid "" "%d bpp given" msgstr "" +#: shared-module/displayio/ColorConverter.c +msgid "Only one color can be transparent at a time" +msgstr "" + #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index d1e8b268d6329..9bfc14428a50a 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 13:56-0500\n" +"POT-Creation-Date: 2020-10-16 19:50-0500\n" "PO-Revision-Date: 2020-10-17 15:35+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" @@ -1437,6 +1437,10 @@ msgstr "" "Prise en charge uniquement des monochromes, 4 bpp ou 8 bpp indexés et 16 bpp " "ou plus : %d bpp fournis" +#: shared-module/displayio/ColorConverter.c +msgid "Only one color can be transparent at a time" +msgstr "" + #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" msgstr "IP n'accepte que les entiers bruts" diff --git a/locale/hi.po b/locale/hi.po index 485ce63988140..bd6d5395bf1b2 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 13:56-0500\n" +"POT-Creation-Date: 2020-10-16 19:50-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -1403,6 +1403,10 @@ msgid "" "%d bpp given" msgstr "" +#: shared-module/displayio/ColorConverter.c +msgid "Only one color can be transparent at a time" +msgstr "" + #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 9d299b49b9318..9ed3bb1e1cc78 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 13:56-0500\n" +"POT-Creation-Date: 2020-10-16 19:50-0500\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -1426,6 +1426,10 @@ msgid "" "%d bpp given" msgstr "" +#: shared-module/displayio/ColorConverter.c +msgid "Only one color can be transparent at a time" +msgstr "" + #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" msgstr "" diff --git a/locale/ja.po b/locale/ja.po index ac883044cba05..8c3751c8e8155 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 13:56-0500\n" +"POT-Creation-Date: 2020-10-16 19:50-0500\n" "PO-Revision-Date: 2020-09-25 18:20+0000\n" "Last-Translator: Taku Fukada \n" "Language-Team: none\n" @@ -1420,6 +1420,10 @@ msgid "" "%d bpp given" msgstr "" +#: shared-module/displayio/ColorConverter.c +msgid "Only one color can be transparent at a time" +msgstr "" + #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" msgstr "" diff --git a/locale/ko.po b/locale/ko.po index dea656591cb88..9c5750b9f5adb 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 13:56-0500\n" +"POT-Creation-Date: 2020-10-16 19:50-0500\n" "PO-Revision-Date: 2020-10-05 12:12+0000\n" "Last-Translator: Michal Čihař \n" "Language-Team: LANGUAGE \n" @@ -1408,6 +1408,10 @@ msgid "" "%d bpp given" msgstr "" +#: shared-module/displayio/ColorConverter.c +msgid "Only one color can be transparent at a time" +msgstr "" + #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index ed75cdd8c1823..ca7530c0fdef8 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 13:56-0500\n" +"POT-Creation-Date: 2020-10-16 19:50-0500\n" "PO-Revision-Date: 2020-09-09 16:05+0000\n" "Last-Translator: Jelle Jager \n" "Language-Team: none\n" @@ -1426,6 +1426,10 @@ msgstr "" "Alleen monochrome en 4bpp of 8bpp, en 16bpp of grotere geïndiceerde BMP's " "zijn ondersteund: %d bpp is gegeven" +#: shared-module/displayio/ColorConverter.c +msgid "Only one color can be transparent at a time" +msgstr "" + #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" msgstr "" diff --git a/locale/pl.po b/locale/pl.po index ec5fe5a65c015..f6292a0a3b175 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 13:56-0500\n" +"POT-Creation-Date: 2020-10-16 19:50-0500\n" "PO-Revision-Date: 2020-09-29 01:39+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" @@ -1419,6 +1419,10 @@ msgid "" "%d bpp given" msgstr "" +#: shared-module/displayio/ColorConverter.c +msgid "Only one color can be transparent at a time" +msgstr "" + #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" msgstr "" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 20e7d68962749..94ec881cb5d52 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 13:56-0500\n" +"POT-Creation-Date: 2020-10-16 19:50-0500\n" "PO-Revision-Date: 2020-10-20 17:13+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -1434,6 +1434,10 @@ msgstr "" "São compatíveis apenas os BMPs monocromáticos, indexados em 4bpp ou 8bpp e " "16bpp ou superior: determinado %d bpp" +#: shared-module/displayio/ColorConverter.c +msgid "Only one color can be transparent at a time" +msgstr "" + #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" msgstr "Apenas o int bruto é compatível para o ip" diff --git a/locale/sv.po b/locale/sv.po index 42e8ce2c452cd..d4be9db170e76 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 13:56-0500\n" +"POT-Creation-Date: 2020-10-16 19:50-0500\n" "PO-Revision-Date: 2020-10-14 18:12+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -1424,6 +1424,10 @@ msgstr "" "Endast monokrom, indexerad 4 bpp eller 8 bpp och 16 bpp eller högre BMP: er " "stöds: %d bpp angiven" +#: shared-module/displayio/ColorConverter.c +msgid "Only one color can be transparent at a time" +msgstr "" + #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" msgstr "Endast raw int stöds för ip" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 42c6e39d58515..6ad1c722d5ac8 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 13:56-0500\n" +"POT-Creation-Date: 2020-10-16 19:50-0500\n" "PO-Revision-Date: 2020-10-17 02:31+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -1421,6 +1421,10 @@ msgstr "" "Jǐn zhīchí dān sè, suǒyǐn wéi 4bpp huò 8bpp yǐjí 16bpp huò gèng gāo de BMP: " "Gěi chū %d bpp" +#: shared-module/displayio/ColorConverter.c +msgid "Only one color can be transparent at a time" +msgstr "" + #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" msgstr "Ip jǐn zhīchí raw int" From 7d1c1c815df859eadbe180f4ca57df9a38bdec75 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Wed, 21 Oct 2020 04:15:35 +0000 Subject: [PATCH 012/770] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (836 of 836 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 94ec881cb5d52..b80afeb1aa92d 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-10-16 19:50-0500\n" -"PO-Revision-Date: 2020-10-20 17:13+0000\n" +"PO-Revision-Date: 2020-10-21 19:58+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -1436,7 +1436,7 @@ msgstr "" #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" -msgstr "" +msgstr "Apenas uma cor pode ser transparente de cada vez" #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" From ff69ab603d0ccec3b44ce72e5f365a0c91d33b97 Mon Sep 17 00:00:00 2001 From: Jerry Needell Date: Wed, 21 Oct 2020 17:07:30 -0400 Subject: [PATCH 013/770] fix CPB SPI pin definitions --- ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.h b/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.h index 17b044b145f51..ef34465dcd903 100644 --- a/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.h +++ b/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.h @@ -59,8 +59,8 @@ #define DEFAULT_I2C_BUS_SCL (&pin_P0_04) #define DEFAULT_I2C_BUS_SDA (&pin_P0_05) -#define DEFAULT_SPI_BUS_SCK (&pin_P0_05) -#define DEFAULT_SPI_BUS_MOSI (&pin_P1_03) +#define DEFAULT_SPI_BUS_SCK (&pin_P0_02) +#define DEFAULT_SPI_BUS_MOSI (&pin_P0_03) #define DEFAULT_SPI_BUS_MISO (&pin_P0_29) #define DEFAULT_UART_BUS_RX (&pin_P0_30) From 05e4172ea0999a03ec8d59b509de1ee0307515e4 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Wed, 21 Oct 2020 21:51:47 +0000 Subject: [PATCH 014/770] Translated using Weblate (Swedish) Currently translated at 100.0% (836 of 836 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index d4be9db170e76..22007e11f32fc 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-10-16 19:50-0500\n" -"PO-Revision-Date: 2020-10-14 18:12+0000\n" +"PO-Revision-Date: 2020-10-22 01:12+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.3-dev\n" +"X-Generator: Weblate 4.3.1\n" #: main.c msgid "" @@ -961,7 +961,7 @@ msgstr "Hårdvaran används redan, prova alternativa pinnar" #: shared-bindings/wifi/Radio.c msgid "Hostname must be between 1 and 253 characters" -msgstr "" +msgstr "Hostname måste vara mellan 1 och 253 tecken" #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" @@ -1426,7 +1426,7 @@ msgstr "" #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" -msgstr "" +msgstr "Bara en färg kan vara genomskinlig i taget" #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" @@ -2161,7 +2161,7 @@ msgstr "buffert för liten" #: shared-bindings/socketpool/Socket.c msgid "buffer too small for requested bytes" -msgstr "" +msgstr "buffertför liten för begärd längd" #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" @@ -2795,7 +2795,7 @@ msgstr "ogiltig formatspecificerare" #: shared-bindings/wifi/Radio.c msgid "invalid hostname" -msgstr "" +msgstr "Ogiltigt värdnamn" #: extmod/modussl_axtls.c msgid "invalid key" From f431f859e74a92099079bd8753c2319566dbf3c7 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 22 Oct 2020 21:32:44 +0530 Subject: [PATCH 015/770] Initial support for native touchio --- ports/esp32s2/common-hal/touchio/TouchIn.c | 109 ++++++++++++++++++++ ports/esp32s2/common-hal/touchio/TouchIn.h | 42 ++++++++ ports/esp32s2/common-hal/touchio/__init__.c | 1 + ports/esp32s2/mpconfigport.mk | 4 + ports/esp32s2/peripherals/pins.c | 95 +++++++++-------- ports/esp32s2/peripherals/pins.h | 1 + 6 files changed, 208 insertions(+), 44 deletions(-) create mode 100644 ports/esp32s2/common-hal/touchio/TouchIn.c create mode 100644 ports/esp32s2/common-hal/touchio/TouchIn.h create mode 100644 ports/esp32s2/common-hal/touchio/__init__.c diff --git a/ports/esp32s2/common-hal/touchio/TouchIn.c b/ports/esp32s2/common-hal/touchio/TouchIn.c new file mode 100644 index 0000000000000..7d30d1a325580 --- /dev/null +++ b/ports/esp32s2/common-hal/touchio/TouchIn.c @@ -0,0 +1,109 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 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 "shared-bindings/touchio/TouchIn.h" +#include "py/runtime.h" + +#include "driver/touch_pad.h" + +static const touch_pad_t touch_pad[] = { + TOUCH_PAD_NUM1, + TOUCH_PAD_NUM2, + TOUCH_PAD_NUM3, + TOUCH_PAD_NUM4, + TOUCH_PAD_NUM5, + TOUCH_PAD_NUM6, + TOUCH_PAD_NUM7, + TOUCH_PAD_NUM8, + TOUCH_PAD_NUM9, + TOUCH_PAD_NUM10, + TOUCH_PAD_NUM11, + TOUCH_PAD_NUM12, + TOUCH_PAD_NUM13, + TOUCH_PAD_NUM14 +}; + +static uint16_t get_raw_reading(touchio_touchin_obj_t *self) { + uint32_t touch_value; + touch_pad_read_raw_data(touch_pad[self->pin], &touch_value); + return touch_value; +} + +void common_hal_touchio_touchin_construct(touchio_touchin_obj_t* self, + const mcu_pin_obj_t *pin) { + if (!pin->has_touch) { + mp_raise_ValueError(translate("Invalid pin")); + } + claim_pin(pin); + + touch_pad_init(); + touch_pad_config(touch_pad[pin->number]); + + touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER); + touch_pad_fsm_start(); + + // Initial values for pins will vary, depending on what peripherals the pins + // share on-chip. + + // Set a "touched" threshold not too far above the initial value. + // For simple finger touch, the values may vary as much as a factor of two, + // but for touches using fruit or other objects, the difference is much less. + + self->pin = pin->number; + self->threshold = get_raw_reading(self) + 100; +} + +bool common_hal_touchio_touchin_deinited(touchio_touchin_obj_t* self) { + return self->pin == 0xff; +} + +void common_hal_touchio_touchin_deinit(touchio_touchin_obj_t* self) { + if (common_hal_touchio_touchin_deinited(self)) { + return; + } + + //touch_pad_deinit(); + + reset_pin_number(self->pin); + self->pin = 0xff; +} + +bool common_hal_touchio_touchin_get_value(touchio_touchin_obj_t *self) { + uint16_t reading = get_raw_reading(self); + return reading > self->threshold; +} + +uint16_t common_hal_touchio_touchin_get_raw_value(touchio_touchin_obj_t *self) { + return get_raw_reading(self); +} + +uint16_t common_hal_touchio_touchin_get_threshold(touchio_touchin_obj_t *self) { + return self->threshold; +} + +void common_hal_touchio_touchin_set_threshold(touchio_touchin_obj_t *self, uint16_t new_threshold) { + self->threshold = new_threshold; +} diff --git a/ports/esp32s2/common-hal/touchio/TouchIn.h b/ports/esp32s2/common-hal/touchio/TouchIn.h new file mode 100644 index 0000000000000..81d80c9dd92f9 --- /dev/null +++ b/ports/esp32s2/common-hal/touchio/TouchIn.h @@ -0,0 +1,42 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Scott Shawcroft + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_TOUCHIO_TOUCHIN_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_TOUCHIO_TOUCHIN_H + +#include "common-hal/microcontroller/Pin.h" + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + uint8_t pin; + uint16_t threshold; +} touchio_touchin_obj_t; + +void touchin_reset(void); + +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_TOUCHIO_TOUCHIN_H diff --git a/ports/esp32s2/common-hal/touchio/__init__.c b/ports/esp32s2/common-hal/touchio/__init__.c new file mode 100644 index 0000000000000..d2290447c95e7 --- /dev/null +++ b/ports/esp32s2/common-hal/touchio/__init__.c @@ -0,0 +1 @@ +// No touchio module functions. diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index 4e8a7bdef2f98..60a3a14ca91df 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -26,4 +26,8 @@ CIRCUITPY_USB_MIDI = 0 CIRCUITPY_WIFI = 1 CIRCUITPY_ESPIDF = 1 +ifndef CIRCUITPY_TOUCHIO_USE_NATIVE +CIRCUITPY_TOUCHIO_USE_NATIVE = 1 +endif + CIRCUITPY_MODULE ?= none diff --git a/ports/esp32s2/peripherals/pins.c b/ports/esp32s2/peripherals/pins.c index 2c8b61c6277d6..e372c84b1d0c7 100755 --- a/ports/esp32s2/peripherals/pins.c +++ b/ports/esp32s2/peripherals/pins.c @@ -29,55 +29,62 @@ #define NO_ADC 0 #define NO_ADC_CHANNEL ADC_CHANNEL_MAX +#define TOUCH \ + .has_touch = true, + +#define NO_TOUCH \ + .has_touch = false, + // This macro is used to simplify pin definition in boards//pins.c -#define PIN(p_name, p_number, p_adc_index, p_adc_channel) \ +#define PIN(p_name, p_number, p_adc_index, p_adc_channel, p_touch_channel) \ const mcu_pin_obj_t pin_## p_name = { \ PIN_PREFIX_VALUES \ .number = p_number, \ .adc_index = p_adc_index, \ .adc_channel = p_adc_channel, \ + p_touch_channel \ } -PIN(GPIO0, 0, NO_ADC, NO_ADC_CHANNEL); -PIN(GPIO1, 1, ADC_UNIT_1, ADC_CHANNEL_0); -PIN(GPIO2, 2, ADC_UNIT_1, ADC_CHANNEL_1); -PIN(GPIO3, 3, ADC_UNIT_1, ADC_CHANNEL_2); -PIN(GPIO4, 4, ADC_UNIT_1, ADC_CHANNEL_3); -PIN(GPIO5, 5, ADC_UNIT_1, ADC_CHANNEL_4); -PIN(GPIO6, 6, ADC_UNIT_1, ADC_CHANNEL_5); -PIN(GPIO7, 7, ADC_UNIT_1, ADC_CHANNEL_6); -PIN(GPIO8, 8, ADC_UNIT_1, ADC_CHANNEL_7); -PIN(GPIO9, 9, ADC_UNIT_1, ADC_CHANNEL_8); -PIN(GPIO10, 10, ADC_UNIT_1, ADC_CHANNEL_9); -PIN(GPIO11, 11, ADC_UNIT_2, ADC_CHANNEL_0); -PIN(GPIO12, 12, ADC_UNIT_2, ADC_CHANNEL_1); -PIN(GPIO13, 13, ADC_UNIT_2, ADC_CHANNEL_2); -PIN(GPIO14, 14, ADC_UNIT_2, ADC_CHANNEL_3); -PIN(GPIO15, 15, ADC_UNIT_2, ADC_CHANNEL_4); -PIN(GPIO16, 16, ADC_UNIT_2, ADC_CHANNEL_5); -PIN(GPIO17, 17, ADC_UNIT_2, ADC_CHANNEL_6); -PIN(GPIO18, 18, ADC_UNIT_2, ADC_CHANNEL_7); -PIN(GPIO19, 19, ADC_UNIT_2, ADC_CHANNEL_8); -PIN(GPIO20, 20, ADC_UNIT_2, ADC_CHANNEL_9); -PIN(GPIO21, 21, NO_ADC, NO_ADC_CHANNEL); -PIN(GPIO26, 26, NO_ADC, NO_ADC_CHANNEL); -PIN(GPIO27, 27, NO_ADC, NO_ADC_CHANNEL); -PIN(GPIO28, 28, NO_ADC, NO_ADC_CHANNEL); -PIN(GPIO29, 29, NO_ADC, NO_ADC_CHANNEL); -PIN(GPIO30, 30, NO_ADC, NO_ADC_CHANNEL); -PIN(GPIO31, 31, NO_ADC, NO_ADC_CHANNEL); -PIN(GPIO32, 32, NO_ADC, NO_ADC_CHANNEL); -PIN(GPIO33, 33, NO_ADC, NO_ADC_CHANNEL); -PIN(GPIO34, 34, NO_ADC, NO_ADC_CHANNEL); -PIN(GPIO35, 35, NO_ADC, NO_ADC_CHANNEL); -PIN(GPIO36, 36, NO_ADC, NO_ADC_CHANNEL); -PIN(GPIO37, 37, NO_ADC, NO_ADC_CHANNEL); -PIN(GPIO38, 38, NO_ADC, NO_ADC_CHANNEL); -PIN(GPIO39, 39, NO_ADC, NO_ADC_CHANNEL); -PIN(GPIO40, 40, NO_ADC, NO_ADC_CHANNEL); -PIN(GPIO41, 41, NO_ADC, NO_ADC_CHANNEL); -PIN(GPIO42, 42, NO_ADC, NO_ADC_CHANNEL); -PIN(GPIO43, 43, NO_ADC, NO_ADC_CHANNEL); -PIN(GPIO44, 44, NO_ADC, NO_ADC_CHANNEL); -PIN(GPIO45, 45, NO_ADC, NO_ADC_CHANNEL); -PIN(GPIO46, 46, NO_ADC, NO_ADC_CHANNEL); +PIN(GPIO0, 0, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); +PIN(GPIO1, 1, ADC_UNIT_1, ADC_CHANNEL_0, TOUCH); +PIN(GPIO2, 2, ADC_UNIT_1, ADC_CHANNEL_1, TOUCH); +PIN(GPIO3, 3, ADC_UNIT_1, ADC_CHANNEL_2, TOUCH); +PIN(GPIO4, 4, ADC_UNIT_1, ADC_CHANNEL_3, TOUCH); +PIN(GPIO5, 5, ADC_UNIT_1, ADC_CHANNEL_4, TOUCH); +PIN(GPIO6, 6, ADC_UNIT_1, ADC_CHANNEL_5, TOUCH); +PIN(GPIO7, 7, ADC_UNIT_1, ADC_CHANNEL_6, TOUCH); +PIN(GPIO8, 8, ADC_UNIT_1, ADC_CHANNEL_7, TOUCH); +PIN(GPIO9, 9, ADC_UNIT_1, ADC_CHANNEL_8, TOUCH); +PIN(GPIO10, 10, ADC_UNIT_1, ADC_CHANNEL_9, TOUCH); +PIN(GPIO11, 11, ADC_UNIT_2, ADC_CHANNEL_0, TOUCH); +PIN(GPIO12, 12, ADC_UNIT_2, ADC_CHANNEL_1, TOUCH); +PIN(GPIO13, 13, ADC_UNIT_2, ADC_CHANNEL_2, TOUCH); +PIN(GPIO14, 14, ADC_UNIT_2, ADC_CHANNEL_3, TOUCH); +PIN(GPIO15, 15, ADC_UNIT_2, ADC_CHANNEL_4, NO_TOUCH); +PIN(GPIO16, 16, ADC_UNIT_2, ADC_CHANNEL_5, NO_TOUCH); +PIN(GPIO17, 17, ADC_UNIT_2, ADC_CHANNEL_6, NO_TOUCH); +PIN(GPIO18, 18, ADC_UNIT_2, ADC_CHANNEL_7, NO_TOUCH); +PIN(GPIO19, 19, ADC_UNIT_2, ADC_CHANNEL_8, NO_TOUCH); +PIN(GPIO20, 20, ADC_UNIT_2, ADC_CHANNEL_9, NO_TOUCH); +PIN(GPIO21, 21, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); +PIN(GPIO26, 26, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); +PIN(GPIO27, 27, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); +PIN(GPIO28, 28, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); +PIN(GPIO29, 29, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); +PIN(GPIO30, 30, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); +PIN(GPIO31, 31, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); +PIN(GPIO32, 32, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); +PIN(GPIO33, 33, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); +PIN(GPIO34, 34, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); +PIN(GPIO35, 35, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); +PIN(GPIO36, 36, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); +PIN(GPIO37, 37, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); +PIN(GPIO38, 38, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); +PIN(GPIO39, 39, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); +PIN(GPIO40, 40, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); +PIN(GPIO41, 41, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); +PIN(GPIO42, 42, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); +PIN(GPIO43, 43, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); +PIN(GPIO44, 44, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); +PIN(GPIO45, 45, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); +PIN(GPIO46, 46, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); diff --git a/ports/esp32s2/peripherals/pins.h b/ports/esp32s2/peripherals/pins.h index 84123a80e6006..8be57f320f775 100644 --- a/ports/esp32s2/peripherals/pins.h +++ b/ports/esp32s2/peripherals/pins.h @@ -41,6 +41,7 @@ typedef struct { PIN_PREFIX_FIELDS gpio_num_t number; + bool has_touch:1; uint8_t adc_index:2; uint8_t adc_channel:6; } mcu_pin_obj_t; From b520498c733356afdc418bd5a9841c7496a3926e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 1 Oct 2020 10:30:35 -0500 Subject: [PATCH 016/770] sharpdisplay: Re-use supervisor allocations if possible This is enabled by #3482 I was unable to determine why previously I had added sizeof(void*) to the GC heap allocation, so I removed that code as a mistake. --- .../sharpdisplay/SharpMemoryFramebuffer.c | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/shared-module/sharpdisplay/SharpMemoryFramebuffer.c b/shared-module/sharpdisplay/SharpMemoryFramebuffer.c index c234468283c32..b199e98d63efc 100644 --- a/shared-module/sharpdisplay/SharpMemoryFramebuffer.c +++ b/shared-module/sharpdisplay/SharpMemoryFramebuffer.c @@ -34,21 +34,22 @@ #include "shared-module/sharpdisplay/SharpMemoryFramebuffer.h" #include "supervisor/memory.h" +#include "supervisor/shared/safe_mode.h" #define SHARPMEM_BIT_WRITECMD_LSB (0x80) #define SHARPMEM_BIT_VCOM_LSB (0x40) -static inline void *hybrid_alloc(size_t sz) { - if (gc_alloc_possible()) { - return m_malloc(sz + sizeof(void*), true); - } else { - supervisor_allocation *allocation = allocate_memory(align32_size(sz), false); - if (!allocation) { - return NULL; - } +static void *hybrid_alloc(size_t sz) { + supervisor_allocation *allocation = allocate_memory(align32_size(sz), false); + if (allocation) { memset(allocation->ptr, 0, sz); return allocation->ptr; } + if (gc_alloc_possible()) { + return m_malloc(sz, true); + } + reset_into_safe_mode(MEM_MANAGE); + return NULL; // unreached } static inline void hybrid_free(void *ptr_in) { @@ -155,7 +156,8 @@ void common_hal_sharpdisplay_framebuffer_construct(sharpdisplay_framebuffer_obj_ int row_stride = common_hal_sharpdisplay_framebuffer_get_row_stride(self); self->bufinfo.len = row_stride * height + 2; - self->bufinfo.buf = gc_alloc(self->bufinfo.len, false, true); + // re-use a supervisor allocation if possible + self->bufinfo.buf = hybrid_alloc(self->bufinfo.len); uint8_t *data = self->bufinfo.buf; *data++ = SHARPMEM_BIT_WRITECMD_LSB; From 04cf88deae155f99995e510270fd133ed2039f45 Mon Sep 17 00:00:00 2001 From: Antonin ENFRUN Date: Thu, 22 Oct 2020 07:50:31 +0000 Subject: [PATCH 017/770] Translated using Weblate (French) Currently translated at 100.0% (836 of 836 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index 9bfc14428a50a..cf0ea4fc31534 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,14 +8,14 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-10-16 19:50-0500\n" -"PO-Revision-Date: 2020-10-17 15:35+0000\n" +"PO-Revision-Date: 2020-10-22 20:48+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.3.1-dev\n" +"X-Generator: Weblate 4.3.1\n" #: main.c msgid "" @@ -1439,7 +1439,7 @@ msgstr "" #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" -msgstr "" +msgstr "Une seule couleur peut être transparente à la fois" #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" @@ -2185,7 +2185,7 @@ msgstr "tampon trop petit" #: shared-bindings/socketpool/Socket.c msgid "buffer too small for requested bytes" -msgstr "" +msgstr "tampon trop petit pour le nombre d'octets demandé" #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" From f4f6b082b46ae91ea9647bca5166bb0e6851b452 Mon Sep 17 00:00:00 2001 From: hexthat Date: Thu, 22 Oct 2020 02:52:04 +0000 Subject: [PATCH 018/770] Translated using Weblate (Chinese (Pinyin)) Currently translated at 100.0% (836 of 836 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/ --- locale/zh_Latn_pinyin.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 6ad1c722d5ac8..13d0dfa7966f8 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-10-16 19:50-0500\n" -"PO-Revision-Date: 2020-10-17 02:31+0000\n" +"PO-Revision-Date: 2020-10-22 20:48+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" "Language: zh_Latn_pinyin\n" @@ -15,7 +15,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.3.1-dev\n" +"X-Generator: Weblate 4.3.1\n" #: main.c msgid "" @@ -1423,7 +1423,7 @@ msgstr "" #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" -msgstr "" +msgstr "Yīcì zhǐ néng yǒuyī zhǒng yánsè shì tòumíng de" #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" @@ -2153,7 +2153,7 @@ msgstr "huǎnchōng qū tài xiǎo" #: shared-bindings/socketpool/Socket.c msgid "buffer too small for requested bytes" -msgstr "" +msgstr "huǎn chōng qū tài xiǎo, duì yú qǐng qiú de zì jié" #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" From 73aae6bbcd10abac422199b2f484859f1a4c83fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tino=20Mart=C3=ADnez?= <43123591+tinomtzlpz@users.noreply.github.com> Date: Thu, 22 Oct 2020 16:09:17 -0500 Subject: [PATCH 019/770] Update es.po Fixed typos UARL -> UART --- locale/es.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/es.po b/locale/es.po index 8cd5e6c22b6f9..7b6dac46eae8c 100644 --- a/locale/es.po +++ b/locale/es.po @@ -1826,15 +1826,15 @@ msgstr "No se pudo encontrar el búfer para UART" #: ports/stm/common-hal/busio/UART.c msgid "UART De-init error" -msgstr "Error de desinicialización de UARL" +msgstr "Error de desinicialización de UART" #: ports/stm/common-hal/busio/UART.c msgid "UART Init Error" -msgstr "Error de inicialización de UARL" +msgstr "Error de inicialización de UART" #: ports/stm/common-hal/busio/UART.c msgid "UART Re-init error" -msgstr "Error de reinicialización de UARL" +msgstr "Error de reinicialización de UART" #: ports/stm/common-hal/busio/UART.c msgid "UART write error" From efd8f1ab888d1b72c4b25972e2e2d54ded3af455 Mon Sep 17 00:00:00 2001 From: Alvaro Figueroa Date: Thu, 22 Oct 2020 22:02:25 +0000 Subject: [PATCH 020/770] Translated using Weblate (Spanish) Currently translated at 100.0% (836 of 836 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/es.po b/locale/es.po index 8cd5e6c22b6f9..b3a4333a809e4 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-10-16 19:50-0500\n" -"PO-Revision-Date: 2020-10-17 02:31+0000\n" +"PO-Revision-Date: 2020-10-22 22:15+0000\n" "Last-Translator: Alvaro Figueroa \n" "Language-Team: \n" "Language: es\n" @@ -16,7 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.3.1-dev\n" +"X-Generator: Weblate 4.3.1\n" #: main.c msgid "" @@ -1434,7 +1434,7 @@ msgstr "" #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" -msgstr "" +msgstr "Solo un color puede ser transparente a la vez" #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" @@ -2175,7 +2175,7 @@ msgstr "buffer demasiado pequeño" #: shared-bindings/socketpool/Socket.c msgid "buffer too small for requested bytes" -msgstr "" +msgstr "búfer muy pequeño para los bytes solicitados" #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" From ef97ed6ab6938bc9c12987d7584cbc715a0f85bf Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Fri, 23 Oct 2020 13:17:49 +0530 Subject: [PATCH 021/770] Update touchio implementation --- ports/esp32s2/common-hal/touchio/TouchIn.c | 41 ++++------ ports/esp32s2/common-hal/touchio/TouchIn.h | 2 +- ports/esp32s2/peripherals/pins.c | 94 +++++++++++----------- ports/esp32s2/peripherals/pins.h | 3 +- 4 files changed, 62 insertions(+), 78 deletions(-) diff --git a/ports/esp32s2/common-hal/touchio/TouchIn.c b/ports/esp32s2/common-hal/touchio/TouchIn.c index 7d30d1a325580..3e3e4b55116e3 100644 --- a/ports/esp32s2/common-hal/touchio/TouchIn.c +++ b/ports/esp32s2/common-hal/touchio/TouchIn.c @@ -29,42 +29,31 @@ #include "driver/touch_pad.h" -static const touch_pad_t touch_pad[] = { - TOUCH_PAD_NUM1, - TOUCH_PAD_NUM2, - TOUCH_PAD_NUM3, - TOUCH_PAD_NUM4, - TOUCH_PAD_NUM5, - TOUCH_PAD_NUM6, - TOUCH_PAD_NUM7, - TOUCH_PAD_NUM8, - TOUCH_PAD_NUM9, - TOUCH_PAD_NUM10, - TOUCH_PAD_NUM11, - TOUCH_PAD_NUM12, - TOUCH_PAD_NUM13, - TOUCH_PAD_NUM14 -}; - static uint16_t get_raw_reading(touchio_touchin_obj_t *self) { uint32_t touch_value; - touch_pad_read_raw_data(touch_pad[self->pin], &touch_value); + touch_pad_read_raw_data((touch_pad_t)self->pin->touch_channel, &touch_value); + if (touch_value > UINT16_MAX) { + return UINT16_MAX; + } return touch_value; } void common_hal_touchio_touchin_construct(touchio_touchin_obj_t* self, const mcu_pin_obj_t *pin) { - if (!pin->has_touch) { + if (pin->touch_channel == TOUCH_PAD_MAX) { mp_raise_ValueError(translate("Invalid pin")); } claim_pin(pin); touch_pad_init(); - touch_pad_config(touch_pad[pin->number]); + touch_pad_config((touch_pad_t)pin->touch_channel); touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER); touch_pad_fsm_start(); + // wait for "raw data" to reset + mp_hal_delay_ms(10); + // Initial values for pins will vary, depending on what peripherals the pins // share on-chip. @@ -72,23 +61,21 @@ void common_hal_touchio_touchin_construct(touchio_touchin_obj_t* self, // For simple finger touch, the values may vary as much as a factor of two, // but for touches using fruit or other objects, the difference is much less. - self->pin = pin->number; + self->pin = pin; self->threshold = get_raw_reading(self) + 100; } bool common_hal_touchio_touchin_deinited(touchio_touchin_obj_t* self) { - return self->pin == 0xff; + return self->pin == NULL; } void common_hal_touchio_touchin_deinit(touchio_touchin_obj_t* self) { if (common_hal_touchio_touchin_deinited(self)) { return; } - - //touch_pad_deinit(); - - reset_pin_number(self->pin); - self->pin = 0xff; + touch_pad_deinit(); + reset_pin_number(self->pin->touch_channel); + self->pin = NULL; } bool common_hal_touchio_touchin_get_value(touchio_touchin_obj_t *self) { diff --git a/ports/esp32s2/common-hal/touchio/TouchIn.h b/ports/esp32s2/common-hal/touchio/TouchIn.h index 81d80c9dd92f9..585bb37bf1df5 100644 --- a/ports/esp32s2/common-hal/touchio/TouchIn.h +++ b/ports/esp32s2/common-hal/touchio/TouchIn.h @@ -33,7 +33,7 @@ typedef struct { mp_obj_base_t base; - uint8_t pin; + const mcu_pin_obj_t * pin; uint16_t threshold; } touchio_touchin_obj_t; diff --git a/ports/esp32s2/peripherals/pins.c b/ports/esp32s2/peripherals/pins.c index e372c84b1d0c7..0d3d89ad50c3c 100755 --- a/ports/esp32s2/peripherals/pins.c +++ b/ports/esp32s2/peripherals/pins.c @@ -29,11 +29,7 @@ #define NO_ADC 0 #define NO_ADC_CHANNEL ADC_CHANNEL_MAX -#define TOUCH \ - .has_touch = true, - -#define NO_TOUCH \ - .has_touch = false, +#define NO_TOUCH_CHANNEL TOUCH_PAD_MAX // This macro is used to simplify pin definition in boards//pins.c #define PIN(p_name, p_number, p_adc_index, p_adc_channel, p_touch_channel) \ @@ -42,49 +38,49 @@ const mcu_pin_obj_t pin_## p_name = { \ .number = p_number, \ .adc_index = p_adc_index, \ .adc_channel = p_adc_channel, \ - p_touch_channel \ + .touch_channel = p_touch_channel, \ } -PIN(GPIO0, 0, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); -PIN(GPIO1, 1, ADC_UNIT_1, ADC_CHANNEL_0, TOUCH); -PIN(GPIO2, 2, ADC_UNIT_1, ADC_CHANNEL_1, TOUCH); -PIN(GPIO3, 3, ADC_UNIT_1, ADC_CHANNEL_2, TOUCH); -PIN(GPIO4, 4, ADC_UNIT_1, ADC_CHANNEL_3, TOUCH); -PIN(GPIO5, 5, ADC_UNIT_1, ADC_CHANNEL_4, TOUCH); -PIN(GPIO6, 6, ADC_UNIT_1, ADC_CHANNEL_5, TOUCH); -PIN(GPIO7, 7, ADC_UNIT_1, ADC_CHANNEL_6, TOUCH); -PIN(GPIO8, 8, ADC_UNIT_1, ADC_CHANNEL_7, TOUCH); -PIN(GPIO9, 9, ADC_UNIT_1, ADC_CHANNEL_8, TOUCH); -PIN(GPIO10, 10, ADC_UNIT_1, ADC_CHANNEL_9, TOUCH); -PIN(GPIO11, 11, ADC_UNIT_2, ADC_CHANNEL_0, TOUCH); -PIN(GPIO12, 12, ADC_UNIT_2, ADC_CHANNEL_1, TOUCH); -PIN(GPIO13, 13, ADC_UNIT_2, ADC_CHANNEL_2, TOUCH); -PIN(GPIO14, 14, ADC_UNIT_2, ADC_CHANNEL_3, TOUCH); -PIN(GPIO15, 15, ADC_UNIT_2, ADC_CHANNEL_4, NO_TOUCH); -PIN(GPIO16, 16, ADC_UNIT_2, ADC_CHANNEL_5, NO_TOUCH); -PIN(GPIO17, 17, ADC_UNIT_2, ADC_CHANNEL_6, NO_TOUCH); -PIN(GPIO18, 18, ADC_UNIT_2, ADC_CHANNEL_7, NO_TOUCH); -PIN(GPIO19, 19, ADC_UNIT_2, ADC_CHANNEL_8, NO_TOUCH); -PIN(GPIO20, 20, ADC_UNIT_2, ADC_CHANNEL_9, NO_TOUCH); -PIN(GPIO21, 21, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); -PIN(GPIO26, 26, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); -PIN(GPIO27, 27, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); -PIN(GPIO28, 28, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); -PIN(GPIO29, 29, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); -PIN(GPIO30, 30, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); -PIN(GPIO31, 31, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); -PIN(GPIO32, 32, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); -PIN(GPIO33, 33, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); -PIN(GPIO34, 34, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); -PIN(GPIO35, 35, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); -PIN(GPIO36, 36, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); -PIN(GPIO37, 37, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); -PIN(GPIO38, 38, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); -PIN(GPIO39, 39, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); -PIN(GPIO40, 40, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); -PIN(GPIO41, 41, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); -PIN(GPIO42, 42, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); -PIN(GPIO43, 43, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); -PIN(GPIO44, 44, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); -PIN(GPIO45, 45, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); -PIN(GPIO46, 46, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH); +PIN(GPIO0, 0, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +PIN(GPIO1, 1, ADC_UNIT_1, ADC_CHANNEL_0, TOUCH_PAD_NUM1); +PIN(GPIO2, 2, ADC_UNIT_1, ADC_CHANNEL_1, TOUCH_PAD_NUM2); +PIN(GPIO3, 3, ADC_UNIT_1, ADC_CHANNEL_2, TOUCH_PAD_NUM3); +PIN(GPIO4, 4, ADC_UNIT_1, ADC_CHANNEL_3, TOUCH_PAD_NUM4); +PIN(GPIO5, 5, ADC_UNIT_1, ADC_CHANNEL_4, TOUCH_PAD_NUM5); +PIN(GPIO6, 6, ADC_UNIT_1, ADC_CHANNEL_5, TOUCH_PAD_NUM6); +PIN(GPIO7, 7, ADC_UNIT_1, ADC_CHANNEL_6, TOUCH_PAD_NUM7); +PIN(GPIO8, 8, ADC_UNIT_1, ADC_CHANNEL_7, TOUCH_PAD_NUM8); +PIN(GPIO9, 9, ADC_UNIT_1, ADC_CHANNEL_8, TOUCH_PAD_NUM9); +PIN(GPIO10, 10, ADC_UNIT_1, ADC_CHANNEL_9, TOUCH_PAD_NUM10); +PIN(GPIO11, 11, ADC_UNIT_2, ADC_CHANNEL_0, TOUCH_PAD_NUM11); +PIN(GPIO12, 12, ADC_UNIT_2, ADC_CHANNEL_1, TOUCH_PAD_NUM12); +PIN(GPIO13, 13, ADC_UNIT_2, ADC_CHANNEL_2, TOUCH_PAD_NUM13); +PIN(GPIO14, 14, ADC_UNIT_2, ADC_CHANNEL_3, TOUCH_PAD_NUM14); +PIN(GPIO15, 15, ADC_UNIT_2, ADC_CHANNEL_4, NO_TOUCH_CHANNEL); +PIN(GPIO16, 16, ADC_UNIT_2, ADC_CHANNEL_5, NO_TOUCH_CHANNEL); +PIN(GPIO17, 17, ADC_UNIT_2, ADC_CHANNEL_6, NO_TOUCH_CHANNEL); +PIN(GPIO18, 18, ADC_UNIT_2, ADC_CHANNEL_7, NO_TOUCH_CHANNEL); +PIN(GPIO19, 19, ADC_UNIT_2, ADC_CHANNEL_8, NO_TOUCH_CHANNEL); +PIN(GPIO20, 20, ADC_UNIT_2, ADC_CHANNEL_9, NO_TOUCH_CHANNEL); +PIN(GPIO21, 21, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +PIN(GPIO26, 26, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +PIN(GPIO27, 27, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +PIN(GPIO28, 28, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +PIN(GPIO29, 29, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +PIN(GPIO30, 30, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +PIN(GPIO31, 31, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +PIN(GPIO32, 32, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +PIN(GPIO33, 33, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +PIN(GPIO34, 34, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +PIN(GPIO35, 35, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +PIN(GPIO36, 36, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +PIN(GPIO37, 37, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +PIN(GPIO38, 38, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +PIN(GPIO39, 39, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +PIN(GPIO40, 40, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +PIN(GPIO41, 41, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +PIN(GPIO42, 42, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +PIN(GPIO43, 43, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +PIN(GPIO44, 44, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +PIN(GPIO45, 45, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +PIN(GPIO46, 46, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); diff --git a/ports/esp32s2/peripherals/pins.h b/ports/esp32s2/peripherals/pins.h index 8be57f320f775..c78eb83851382 100644 --- a/ports/esp32s2/peripherals/pins.h +++ b/ports/esp32s2/peripherals/pins.h @@ -37,13 +37,14 @@ #include "components/hal/include/hal/gpio_types.h" #include "components/hal/include/hal/adc_types.h" +#include "components/hal/include/hal/touch_sensor_types.h" typedef struct { PIN_PREFIX_FIELDS gpio_num_t number; - bool has_touch:1; uint8_t adc_index:2; uint8_t adc_channel:6; + uint8_t touch_channel; } mcu_pin_obj_t; extern const mcu_pin_obj_t pin_GPIO0; From 2ebd06f8ee3d5818cd0c61468a7e12072b59c973 Mon Sep 17 00:00:00 2001 From: 0-Arngerdur-1 Date: Fri, 23 Oct 2020 15:14:45 -0500 Subject: [PATCH 022/770] Fix typos and fix translate --- locale/es.po | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/locale/es.po b/locale/es.po index b3a4333a809e4..e2ae41ee3dbe4 100644 --- a/locale/es.po +++ b/locale/es.po @@ -168,7 +168,7 @@ msgstr "'%s' espera un registro" #: py/emitinlinethumb.c #, c-format msgid "'%s' expects a special register" -msgstr "'%s' espera un carácter" +msgstr "'%s' espera un registro especial" #: py/emitinlinethumb.c #, c-format @@ -239,7 +239,7 @@ msgstr "el objeto 'coroutine' no es un iterador" #: py/compile.c msgid "'data' requires at least 2 arguments" -msgstr "'data' requiere como minomo 2 argumentos" +msgstr "'data' requiere como mínimo 2 argumentos" #: py/compile.c msgid "'data' requires integer arguments" @@ -255,7 +255,7 @@ msgstr "'return' fuera de una función" #: py/compile.c msgid "'yield from' inside async function" -msgstr "'yield from' dentro función asincrónica" +msgstr "'yield from' dentro de una función asincrónica" #: py/compile.c msgid "'yield' outside function" @@ -289,7 +289,7 @@ msgstr "ADC2 está siendo usado por WiFi" #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format msgid "Address must be %d bytes long" -msgstr "La dirección debe ser %d bytes de largo" +msgstr "La dirección debe tener %d bytes de largo" #: shared-bindings/_bleio/Address.c msgid "Address type out of range" @@ -318,9 +318,7 @@ msgstr "Todos los canales de eventos estan siendo usados" #: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "All sync event channels in use" -msgstr "" -"Todos los canales de eventos de sincronización (sync event channels) están " -"siendo utilizados" +msgstr "Todos los canales de eventos de sincronización (sync event channels) están siendo utilizados" #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" @@ -347,7 +345,7 @@ msgstr "Ya se encuentra publicando." #: ports/atmel-samd/common-hal/canio/Listener.c msgid "Already have all-matches listener" -msgstr "Ya se tiene un escucha todas-las-coincidencias" +msgstr "Ya se tiene un escucha de todas las coincidencias" #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c @@ -370,7 +368,7 @@ msgstr "Funcionalidad AnalogOut no soportada" #: shared-bindings/analogio/AnalogOut.c msgid "AnalogOut is only 16 bits. Value must be less than 65536." -msgstr "AnalogOut es solo de 16 bits. Value debe ser menos a 65536." +msgstr "AnalogOut es solo de 16 bits. El valor debe ser menor que 65536." #: ports/atmel-samd/common-hal/analogio/AnalogOut.c msgid "AnalogOut not supported on given pin" @@ -383,7 +381,7 @@ msgstr "Otro envío ya está activo" #: shared-bindings/pulseio/PulseOut.c msgid "Array must contain halfwords (type 'H')" -msgstr "Array debe contener media palabra (type 'H')" +msgstr "El array debe contener medias palabras (escriba 'H')" #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." @@ -4013,7 +4011,7 @@ msgstr "zi debe ser una forma (n_section,2)" #~ msgstr "Falló el iniciar borrado de flash, err 0x%04x" #~ msgid "Flash write failed" -#~ msgstr "Falló la escritura" +#~ msgstr "Falló la escritura flash" #~ msgid "Flash write failed to start, err 0x%04x" #~ msgstr "Falló el iniciar la escritura de flash, err 0x%04x" @@ -4070,7 +4068,7 @@ msgstr "zi debe ser una forma (n_section,2)" #~ msgstr "Sin soporte PulseIn para %q" #~ msgid "No hardware support for analog out." -#~ msgstr "Sin soporte de hardware para analog out" +#~ msgstr "Sin soporte de hardware para salida analógica" #~ msgid "Not connected." #~ msgstr "No conectado." @@ -4079,24 +4077,24 @@ msgstr "zi debe ser una forma (n_section,2)" #~ msgstr "Solo formato Windows, BMP sin comprimir soportado %d" #~ msgid "Only bit maps of 8 bit color or less are supported" -#~ msgstr "Solo se admiten bit maps de color de 8 bits o menos" +#~ msgstr "Solo se admiten mapas de bits de color de 8 bits o menos" #~ msgid "" #~ "Only monochrome, indexed 8bpp, and 16bpp or greater BMPs supported: %d " #~ "bpp given" #~ msgstr "" #~ "Solo se admiten BMP monocromos, indexados de 8bpp y 16bpp o superiores:%d " -#~ "bppdado" +#~ "bpp dado" #, fuzzy #~ msgid "Only slices with step=1 (aka None) are supported" -#~ msgstr "solo se admiten segmentos con step=1 (alias None)" +#~ msgstr "Solo se admiten segmentos con step=1 (alias None)" #~ msgid "Only true color (24 bpp or higher) BMP supported %x" #~ msgstr "Solo color verdadero (24 bpp o superior) BMP admitido %x" #~ msgid "Only tx supported on UART1 (GPIO2)." -#~ msgstr "Solo tx soportada en UART1 (GPIO2)" +#~ msgstr "Solo tx soportada en UART1 (GPIO2)." #~ msgid "PWM not supported on pin %d" #~ msgstr "El pin %d no soporta PWM" @@ -4111,11 +4109,11 @@ msgstr "zi debe ser una forma (n_section,2)" #~ msgstr "Pines no válidos para SPI" #~ msgid "Pixel beyond bounds of buffer" -#~ msgstr "Pixel beyond bounds of buffer" +#~ msgstr "Píxel fuera de los límites del búfer" #, fuzzy #~ msgid "Range out of bounds" -#~ msgstr "address fuera de límites" +#~ msgstr "Rango fuera de límites" #~ msgid "STA must be active" #~ msgstr "STA debe estar activo" @@ -4135,10 +4133,10 @@ msgstr "zi debe ser una forma (n_section,2)" #~ msgstr "" #~ "El heap de CircuitPython estaba corrupto porque el stack era demasiado " #~ "pequeño.\n" -#~ "Aumente los límites del tamaño del stacj y presione reset (después de " +#~ "Aumente los límites del tamaño del stack y presione reset (después de " #~ "expulsarCIRCUITPY).\n" #~ "Si no cambió el stack, entonces reporte un issue aquí con el contenido " -#~ "desu unidad CIRCUITPY:\n" +#~ "de su unidad CIRCUITPY:\n" #~ msgid "" #~ "The microcontroller's power dipped. Please make sure your power supply " @@ -4191,7 +4189,7 @@ msgstr "zi debe ser una forma (n_section,2)" #~ "malo ha sucedido.\n" #~ msgid "bad GATT role" -#~ msgstr "mal GATT role" +#~ msgstr "rol de GATT malo" #~ msgid "bits must be 8" #~ msgstr "bits debe ser 8" @@ -4224,7 +4222,7 @@ msgstr "zi debe ser una forma (n_section,2)" #~ msgstr "no se puede establecer STA config" #~ msgid "characteristics includes an object that is not a Characteristic" -#~ msgstr "characteristics incluye un objeto que no es una Characteristica" +#~ msgstr "characteristics incluye un objeto que no es una Characteristic" #~ msgid "color buffer must be a buffer or int" #~ msgstr "color buffer deber ser un buffer o un int" From b4eb27557d98084024e9392dcb64bf9724c04517 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 24 Oct 2020 07:26:01 -0500 Subject: [PATCH 023/770] workflows: Upload stubs to s3 --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fa576bbf0ac98..0792d36a014ff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -111,11 +111,13 @@ jobs: with: name: mpy-cross.static-x64-windows path: mpy-cross/mpy-cross.static.exe - - name: Upload mpy-cross builds to S3 + - name: Upload stubs and mpy-cross builds to S3 run: | [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static-raspbian s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-raspbian-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-amd64-linux-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static.exe s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-x64-windows-${{ env.CP_VERSION }}.exe --no-progress --region us-east-1 + zip -9 circuitpython-stubs.CP_VERSION }}.zip stubs + [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp circuitpython-stubs.zip s3://adafruit-circuit-python/bin/mpy-cross/circuitpython-stubs-${{ env.CP_VERSION }}.zip --no-progress --region us-east-1 env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} From 4cad5478e6b6abe6c15546fee4d1a81e180f6d15 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 24 Oct 2020 13:15:50 -0500 Subject: [PATCH 024/770] ulab: Incorporate bugfixes (update to tag 0.54.5) In particular, this closes #3954. --- extmod/ulab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extmod/ulab b/extmod/ulab index 11a7ecff6d76a..7f2c1ae52bee5 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit 11a7ecff6d76a02644ff23a734b792afaa615e44 +Subproject commit 7f2c1ae52bee57ce32ac0a74652610cc233d3442 From b637d3911e71c6136f761960f293954366dd76a1 Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Sat, 24 Oct 2020 20:48:35 -0500 Subject: [PATCH 025/770] Initial commit --- py/circuitpy_defns.mk | 5 + py/circuitpy_mpconfig.h | 8 + py/circuitpy_mpconfig.mk | 3 + shared-bindings/busdevice/I2CDevice.c | 246 ++++++++++++++++++++++++++ shared-bindings/busdevice/I2CDevice.h | 58 ++++++ shared-bindings/busdevice/__init__.c | 79 +++++++++ shared-bindings/busdevice/__init__.h | 32 ++++ shared-module/busdevice/I2CDevice.c | 101 +++++++++++ shared-module/busdevice/I2CDevice.h | 40 +++++ shared-module/busdevice/__init__.c | 0 10 files changed, 572 insertions(+) create mode 100644 shared-bindings/busdevice/I2CDevice.c create mode 100644 shared-bindings/busdevice/I2CDevice.h create mode 100644 shared-bindings/busdevice/__init__.c create mode 100644 shared-bindings/busdevice/__init__.h create mode 100644 shared-module/busdevice/I2CDevice.c create mode 100644 shared-module/busdevice/I2CDevice.h create mode 100644 shared-module/busdevice/__init__.c diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index ccdf973e9fb5c..9318bd466bb8b 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -133,6 +133,9 @@ endif ifeq ($(CIRCUITPY_BOARD),1) SRC_PATTERNS += board/% endif +ifeq ($(CIRCUITPY_BUSDEVICE),1) +SRC_PATTERNS += busdevice/% +endif ifeq ($(CIRCUITPY_BUSIO),1) SRC_PATTERNS += busio/% bitbangio/OneWire.% endif @@ -432,6 +435,8 @@ SRC_SHARED_MODULE_ALL = \ bitbangio/SPI.c \ bitbangio/__init__.c \ board/__init__.c \ + busdevice/__init__.c \ + busdevice/I2CDevice.c \ busio/OneWire.c \ displayio/Bitmap.c \ displayio/ColorConverter.c \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 1e01bd9c5e0b6..240fac189befe 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -324,6 +324,13 @@ extern const struct _mp_obj_module_t board_module; #define BOARD_UART_ROOT_POINTER #endif +#if CIRCUITPY_BUSDEVICE +extern const struct _mp_obj_module_t busdevice_module; +#define BUSDEVICE_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_busdevice), (mp_obj_t)&busdevice_module }, +#else +#define BUSDEVICE_MODULE +#endif + #if CIRCUITPY_BUSIO extern const struct _mp_obj_module_t busio_module; #define BUSIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_busio), (mp_obj_t)&busio_module }, @@ -773,6 +780,7 @@ extern const struct _mp_obj_module_t wifi_module; BITBANGIO_MODULE \ BLEIO_MODULE \ BOARD_MODULE \ + BUSDEVICE_MODULE \ BUSIO_MODULE \ CAMERA_MODULE \ CANIO_MODULE \ diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index a6aabec33d18f..1f96a8f2dd8c6 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -90,6 +90,9 @@ CFLAGS += -DCIRCUITPY_BLEIO=$(CIRCUITPY_BLEIO) CIRCUITPY_BOARD ?= 1 CFLAGS += -DCIRCUITPY_BOARD=$(CIRCUITPY_BOARD) +CIRCUITPY_BUSDEVICE ?= 1 +CFLAGS += -DCIRCUITPY_BUSDEVICE=$(CIRCUITPY_BUSDEVICE) + CIRCUITPY_BUSIO ?= 1 CFLAGS += -DCIRCUITPY_BUSIO=$(CIRCUITPY_BUSIO) diff --git a/shared-bindings/busdevice/I2CDevice.c b/shared-bindings/busdevice/I2CDevice.c new file mode 100644 index 0000000000000..02dac6a95b8eb --- /dev/null +++ b/shared-bindings/busdevice/I2CDevice.c @@ -0,0 +1,246 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Scott Shawcroft + * + * 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. + */ + +// This file contains all of the Python API definitions for the +// busio.I2C class. + +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/busdevice/I2CDevice.h" +#include "shared-bindings/util.h" +#include "shared-module/busdevice/I2CDevice.h" + +#include "lib/utils/buffer_helper.h" +#include "lib/utils/context_manager_helpers.h" +#include "py/runtime.h" +#include "supervisor/shared/translate.h" + +//| class I2CDevice: +//| """Two wire serial protocol""" +//| +//| def __init__(self, i2c, device_address, probe=True) -> None: +//| +//| ... +//| +STATIC mp_obj_t busdevice_i2cdevice_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + busdevice_i2cdevice_obj_t *self = m_new_obj(busdevice_i2cdevice_obj_t); + self->base.type = &busdevice_i2cdevice_type; + enum { ARG_i2c, ARG_device_address, ARG_probe }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_i2c, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_device_address, MP_ARG_REQUIRED | MP_ARG_INT }, + { MP_QSTR_probe, MP_ARG_BOOL, {.u_bool = true} }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + busio_i2c_obj_t* i2c = args[ARG_i2c].u_obj; + + common_hal_busdevice_i2cdevice_construct(self, i2c, args[ARG_device_address].u_int, args[ARG_probe].u_bool); + return (mp_obj_t)self; +} + +//| def __enter__(self) -> None: +//| """Automatically initializes the hardware on context exit. See FIX +//| :ref:`lifetime-and-contextmanagers` for more info.""" +//| ... +//| +STATIC mp_obj_t busdevice_i2cdevice_obj___enter__(mp_obj_t self_in) { + common_hal_busdevice_i2cdevice_lock(self_in); + return self_in; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(busdevice_i2cdevice___enter___obj, busdevice_i2cdevice_obj___enter__); + +//| def __exit__(self) -> None: +//| """Automatically deinitializes the hardware on context exit. See +//| :ref:`lifetime-and-contextmanagers` for more info.""" +//| ... +//| +STATIC mp_obj_t busdevice_i2cdevice_obj___exit__(size_t n_args, const mp_obj_t *args) { + common_hal_busdevice_i2cdevice_unlock(args[0]); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busdevice_i2cdevice___exit___obj, 4, 4, busdevice_i2cdevice_obj___exit__); + +STATIC void readinto(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, int32_t start, mp_int_t end) { + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_WRITE); + + size_t length = bufinfo.len; + normalize_buffer_bounds(&start, end, &length); + if (length == 0) { + mp_raise_ValueError(translate("Buffer must be at least length 1")); + } + + uint8_t status = common_hal_busdevice_i2cdevice_readinto(self, ((uint8_t*)bufinfo.buf) + start, length); + if (status != 0) { + mp_raise_OSError(status); + } +} + +STATIC mp_obj_t busdevice_i2cdevice_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_buffer, ARG_start, ARG_end }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, + }; + + busdevice_i2cdevice_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + readinto(self, args[ARG_buffer].u_obj, args[ARG_start].u_int, args[ARG_end].u_int); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busdevice_i2cdevice_readinto_obj, 2, busdevice_i2cdevice_readinto); + + +STATIC void write(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, int32_t start, mp_int_t end) { + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_READ); + + size_t length = bufinfo.len; + normalize_buffer_bounds(&start, end, &length); + if (length == 0) { + mp_raise_ValueError(translate("Buffer must be at least length 1")); + } + + uint8_t status = common_hal_busdevice_i2cdevice_write(self, ((uint8_t*)bufinfo.buf) + start, length); + if (status != 0) { + mp_raise_OSError(status); + } +} + +STATIC mp_obj_t busdevice_i2cdevice_write(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_buffer, ARG_start, ARG_end }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, + }; + busdevice_i2cdevice_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + write(self, args[ARG_buffer].u_obj, args[ARG_start].u_int, args[ARG_end].u_int); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_KW(busdevice_i2cdevice_write_obj, 2, busdevice_i2cdevice_write); + + +/*STATIC void write_then_readinto(busdevice_i2cdevice_obj_t *self, mp_obj_t out_buffer, mp_obj_t in_buffer, + int32_t out_start, mp_int_t out_end, int32_t in_start, mp_int_t in_end) { + mp_buffer_info_t out_bufinfo; + mp_get_buffer_raise(out_buffer, &out_bufinfo, MP_BUFFER_READ); + + size_t out_length = out_bufinfo.len; + normalize_buffer_bounds(&out_start, out_end, &out_length); + if (out_length == 0) { + mp_raise_ValueError(translate("Buffer must be at least length 1")); + } + + mp_buffer_info_t in_bufinfo; + mp_get_buffer_raise(in_buffer, &in_bufinfo, MP_BUFFER_WRITE); + + size_t in_length = in_bufinfo.len; + normalize_buffer_bounds(&in_start, in_end, &in_length); + if (in_length == 0) { + mp_raise_ValueError(translate("Buffer must be at least length 1")); + } + + uint8_t status = common_hal_busdevice_i2cdevice_write_then_readinto(self, out_buffer, in_buffer, out_length, in_length); + if (status != 0) { + mp_raise_OSError(status); + } +}*/ + +STATIC mp_obj_t busdevice_i2cdevice_write_then_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_out_buffer, ARG_in_buffer, ARG_out_start, ARG_out_end, ARG_in_start, ARG_in_end }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_out_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_in_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_out_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_out_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, + { MP_QSTR_in_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_in_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, + }; + busdevice_i2cdevice_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + write(self, args[ARG_out_buffer].u_obj, args[ARG_out_start].u_int, args[ARG_out_end].u_int); + + readinto(self, args[ARG_in_buffer].u_obj, args[ARG_in_start].u_int, args[ARG_in_end].u_int); + + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_KW(busdevice_i2cdevice_write_then_readinto_obj, 3, busdevice_i2cdevice_write_then_readinto); + + +STATIC mp_obj_t busdevice_i2cdevice___probe_for_device(mp_obj_t self_in) { + //busdevice_i2cdevice_obj_t *self = self_in; + + //common_hal_busdevice_i2cdevice_lock(self_in); + +/* + uint8_t buffer; + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(&buffer, &bufinfo, MP_BUFFER_WRITE); + + uint8_t status = common_hal_busdevice_i2cdevice_readinto(self_in, (uint8_t*)bufinfo.buf, 1); + if (status != 0) { + common_hal_busdevice_i2cdevice_unlock(self_in); + mp_raise_ValueError_varg(translate("No I2C device at address: %x"), self->device_address); + } +*/ + //common_hal_busdevice_i2cdevice_unlock(self_in); + + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(busdevice_i2cdevice___probe_for_device_obj, busdevice_i2cdevice___probe_for_device); + + +STATIC const mp_rom_map_elem_t busdevice_i2cdevice_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&busdevice_i2cdevice___enter___obj) }, + { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&busdevice_i2cdevice___exit___obj) }, + { MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&busdevice_i2cdevice_readinto_obj) }, + { MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&busdevice_i2cdevice_write_obj) }, + { MP_ROM_QSTR(MP_QSTR_write_then_readinto), MP_ROM_PTR(&busdevice_i2cdevice_write_then_readinto_obj) }, + { MP_ROM_QSTR(MP_QSTR___probe_for_device), MP_ROM_PTR(&busdevice_i2cdevice___probe_for_device_obj) }, +}; + + +STATIC MP_DEFINE_CONST_DICT(busdevice_i2cdevice_locals_dict, busdevice_i2cdevice_locals_dict_table); + +const mp_obj_type_t busdevice_i2cdevice_type = { + { &mp_type_type }, + .name = MP_QSTR_I2CDevice, + .make_new = busdevice_i2cdevice_make_new, + .locals_dict = (mp_obj_dict_t*)&busdevice_i2cdevice_locals_dict, +}; \ No newline at end of file diff --git a/shared-bindings/busdevice/I2CDevice.h b/shared-bindings/busdevice/I2CDevice.h new file mode 100644 index 0000000000000..bc85023d7912d --- /dev/null +++ b/shared-bindings/busdevice/I2CDevice.h @@ -0,0 +1,58 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Mark Komus + * + * 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. + */ + +// Machine is the HAL for low-level, hardware accelerated functions. It is not +// meant to simplify APIs, its only meant to unify them so that other modules +// do not require port specific logic. +// +// This file includes externs for all functions a port should implement to +// support the machine module. + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_BUSDEVICE_I2CDEVICE_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_BUSDEVICE_I2CDEVICE_H + +#include "py/obj.h" + +#include "common-hal/microcontroller/Pin.h" +#include "shared-module/busdevice/I2CDevice.h" +#include "shared-bindings/busio/I2C.h" + +// Type object used in Python. Should be shared between ports. +extern const mp_obj_type_t busdevice_i2cdevice_type; + +// Initializes the hardware peripheral. +extern void common_hal_busdevice_i2cdevice_construct(busdevice_i2cdevice_obj_t *self, busio_i2c_obj_t *i2c, uint8_t device_address, bool probe); +extern void common_hal_busdevice_i2cdevice___enter__(busdevice_i2cdevice_obj_t *self); +extern void common_hal_busdevice_i2cdevice___exit__(busdevice_i2cdevice_obj_t *self); +extern uint8_t common_hal_busdevice_i2cdevice_readinto(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length); +extern uint8_t common_hal_busdevice_i2cdevice_write(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length); +extern uint8_t common_hal_busdevice_i2cdevice_write_then_readinto(busdevice_i2cdevice_obj_t *self, mp_obj_t out_buffer, + mp_obj_t in_buffer, size_t out_length, size_t in_length); +extern uint8_t common_hal_busdevice_i2cdevice___probe_for_device(busdevice_i2cdevice_obj_t *self); +extern void common_hal_busdevice_i2cdevice_lock(busdevice_i2cdevice_obj_t *self); +extern void common_hal_busdevice_i2cdevice_unlock(busdevice_i2cdevice_obj_t *self); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BUSDEVICE_I2CDEVICE_H diff --git a/shared-bindings/busdevice/__init__.c b/shared-bindings/busdevice/__init__.c new file mode 100644 index 0000000000000..6b24160a02517 --- /dev/null +++ b/shared-bindings/busdevice/__init__.c @@ -0,0 +1,79 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 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 + +#include "py/obj.h" +#include "py/runtime.h" +#include "py/mphal.h" +#include "py/objproperty.h" + +#include "shared-bindings/busdevice/__init__.h" +#include "shared-bindings/busdevice/I2CDevice.h" + + +//| """Hardware accelerated external bus access +//| +//| The `busio` module contains classes to support a variety of serial +//| protocols. +//| +//| When the microcontroller does not support the behavior in a hardware +//| accelerated fashion it may internally use a bitbang routine. However, if +//| hardware support is available on a subset of pins but not those provided, +//| then a RuntimeError will be raised. Use the `bitbangio` module to explicitly +//| bitbang a serial protocol on any general purpose pins. +//| +//| All classes change hardware state and should be deinitialized when they +//| are no longer needed if the program continues after use. To do so, either +//| call :py:meth:`!deinit` or use a context manager. See +//| :ref:`lifetime-and-contextmanagers` for more info. +//| +//| For example:: +//| +//| import busio +//| from board import * +//| +//| i2c = busio.I2C(SCL, SDA) +//| print(i2c.scan()) +//| i2c.deinit() +//| +//| This example will initialize the the device, run +//| :py:meth:`~busio.I2C.scan` and then :py:meth:`~busio.I2C.deinit` the +//| hardware. The last step is optional because CircuitPython automatically +//| resets hardware after a program finishes.""" +//| + +STATIC const mp_rom_map_elem_t busdevice_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_busdevice) }, + { MP_ROM_QSTR(MP_QSTR_I2CDevice), MP_ROM_PTR(&busdevice_i2cdevice_type) }, +}; + +STATIC MP_DEFINE_CONST_DICT(busdevice_module_globals, busdevice_module_globals_table); + +const mp_obj_module_t busdevice_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&busdevice_module_globals, +}; diff --git a/shared-bindings/busdevice/__init__.h b/shared-bindings/busdevice/__init__.h new file mode 100644 index 0000000000000..4a669807be38c --- /dev/null +++ b/shared-bindings/busdevice/__init__.h @@ -0,0 +1,32 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Mark Komus + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_BUSDEVICE___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_BUSDEVICE___INIT___H + +// Nothing now. + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BUSDEVICE___INIT___H diff --git a/shared-module/busdevice/I2CDevice.c b/shared-module/busdevice/I2CDevice.c new file mode 100644 index 0000000000000..30f4aad339901 --- /dev/null +++ b/shared-module/busdevice/I2CDevice.c @@ -0,0 +1,101 @@ +/* + * 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 "shared-bindings/busdevice/I2CDevice.h" +#include "shared-bindings/busio/I2C.h" +#include "py/mperrno.h" +#include "py/nlr.h" + +void common_hal_busdevice_i2cdevice_construct(busdevice_i2cdevice_obj_t *self, busio_i2c_obj_t *i2c, uint8_t device_address, bool probe) { + self->i2c = i2c; + self->device_address = device_address; + self->probe = probe; + + if (self->probe == true) { + common_hal_busdevice_i2cdevice___probe_for_device(self); + } +} + +void common_hal_busdevice_i2cdevice_lock(busdevice_i2cdevice_obj_t *self) { + bool success = false; + while (!success) { + success = common_hal_busio_i2c_try_lock(self->i2c); + } +} + +void common_hal_busdevice_i2cdevice_unlock(busdevice_i2cdevice_obj_t *self) { + common_hal_busio_i2c_unlock(self->i2c); +} + +uint8_t common_hal_busdevice_i2cdevice_readinto(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length) { + uint8_t status = common_hal_busio_i2c_read(self->i2c, self->device_address, buffer, length); + + return status; +} + +uint8_t common_hal_busdevice_i2cdevice_write(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length) { + uint8_t status = common_hal_busio_i2c_write(self->i2c, self->device_address, buffer, length, true); + + return status; +} + +uint8_t common_hal_busdevice_i2cdevice_write_then_readinto(busdevice_i2cdevice_obj_t *self, mp_obj_t out_buffer, mp_obj_t in_buffer, + size_t out_length, size_t in_length) { + uint8_t status = 0; + + status = common_hal_busio_i2c_write(self->i2c, self->device_address, out_buffer, out_length, true); + + status = common_hal_busio_i2c_read(self->i2c, self->device_address, in_buffer, in_length); + + return status; +} + +uint8_t common_hal_busdevice_i2cdevice___probe_for_device(busdevice_i2cdevice_obj_t *self) { + + + + + // write "" + + +/* + while not self.i2c.try_lock(): + pass + try: + self.i2c.writeto(self.device_address, b"") + except OSError: + # some OS's dont like writing an empty bytesting... + # Retry by reading a byte + try: + result = bytearray(1) + self.i2c.readfrom_into(self.device_address, result) + except OSError: + raise ValueError("No I2C device at address: %x" % self.device_address) + finally: + self.i2c.unlock() +*/ + return 0; +} diff --git a/shared-module/busdevice/I2CDevice.h b/shared-module/busdevice/I2CDevice.h new file mode 100644 index 0000000000000..c872704db6438 --- /dev/null +++ b/shared-module/busdevice/I2CDevice.h @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#ifndef MICROPY_INCLUDED_ATMEL_SAMD_SHARED_MODULE_BUSDEVICE_I2CDEVICE_H +#define MICROPY_INCLUDED_ATMEL_SAMD_SHARED_MODULE_BUSDEVICE_I2CDEVICE_H + +#include "py/obj.h" +#include "common-hal/busio/I2C.h" + +typedef struct { + mp_obj_base_t base; + busio_i2c_obj_t *i2c; + uint8_t device_address; + bool probe; +} busdevice_i2cdevice_obj_t; + +#endif // MICROPY_INCLUDED_ATMEL_SAMD_SHARED_MODULE_BUSDEVICE_I2CDEVICE_H diff --git a/shared-module/busdevice/__init__.c b/shared-module/busdevice/__init__.c new file mode 100644 index 0000000000000..e69de29bb2d1d From 12d770b427e77c207b85aa9ddcda0047fa6d040a Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Sun, 25 Oct 2020 10:15:45 -0500 Subject: [PATCH 026/770] Added __probe_for_device --- shared-bindings/busdevice/I2CDevice.c | 24 ++++++++++------ shared-bindings/busdevice/I2CDevice.h | 4 +-- shared-module/busdevice/I2CDevice.c | 41 +++++++++------------------ 3 files changed, 31 insertions(+), 38 deletions(-) diff --git a/shared-bindings/busdevice/I2CDevice.c b/shared-bindings/busdevice/I2CDevice.c index 02dac6a95b8eb..fa5cb02e0beb2 100644 --- a/shared-bindings/busdevice/I2CDevice.c +++ b/shared-bindings/busdevice/I2CDevice.c @@ -37,6 +37,7 @@ #include "py/runtime.h" #include "supervisor/shared/translate.h" + //| class I2CDevice: //| """Two wire serial protocol""" //| @@ -59,6 +60,10 @@ STATIC mp_obj_t busdevice_i2cdevice_make_new(const mp_obj_type_t *type, size_t n busio_i2c_obj_t* i2c = args[ARG_i2c].u_obj; common_hal_busdevice_i2cdevice_construct(self, i2c, args[ARG_device_address].u_int, args[ARG_probe].u_bool); + if (args[ARG_probe].u_bool == true) { + common_hal_busdevice_i2cdevice___probe_for_device(self); + } + return (mp_obj_t)self; } @@ -204,28 +209,31 @@ MP_DEFINE_CONST_FUN_OBJ_KW(busdevice_i2cdevice_write_then_readinto_obj, 3, busde STATIC mp_obj_t busdevice_i2cdevice___probe_for_device(mp_obj_t self_in) { - //busdevice_i2cdevice_obj_t *self = self_in; + busdevice_i2cdevice_obj_t *self = self_in; + common_hal_busdevice_i2cdevice___probe_for_device(self); - //common_hal_busdevice_i2cdevice_lock(self_in); +/* common_hal_busdevice_i2cdevice_lock(self); -/* - uint8_t buffer; + + //uint8_t buffer; mp_buffer_info_t bufinfo; - mp_get_buffer_raise(&buffer, &bufinfo, MP_BUFFER_WRITE); + //mp_obj_t bufobj = MP_OBJ_FROM_PTR(&buffer) + mp_obj_t buffer = mp_obj_new_bytearray_of_zeros(1); + + mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_WRITE); uint8_t status = common_hal_busdevice_i2cdevice_readinto(self_in, (uint8_t*)bufinfo.buf, 1); if (status != 0) { common_hal_busdevice_i2cdevice_unlock(self_in); mp_raise_ValueError_varg(translate("No I2C device at address: %x"), self->device_address); } + + common_hal_busdevice_i2cdevice_unlock(self); */ - //common_hal_busdevice_i2cdevice_unlock(self_in); - return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_1(busdevice_i2cdevice___probe_for_device_obj, busdevice_i2cdevice___probe_for_device); - STATIC const mp_rom_map_elem_t busdevice_i2cdevice_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&busdevice_i2cdevice___enter___obj) }, { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&busdevice_i2cdevice___exit___obj) }, diff --git a/shared-bindings/busdevice/I2CDevice.h b/shared-bindings/busdevice/I2CDevice.h index bc85023d7912d..795905b32de95 100644 --- a/shared-bindings/busdevice/I2CDevice.h +++ b/shared-bindings/busdevice/I2CDevice.h @@ -45,14 +45,12 @@ extern const mp_obj_type_t busdevice_i2cdevice_type; // Initializes the hardware peripheral. extern void common_hal_busdevice_i2cdevice_construct(busdevice_i2cdevice_obj_t *self, busio_i2c_obj_t *i2c, uint8_t device_address, bool probe); -extern void common_hal_busdevice_i2cdevice___enter__(busdevice_i2cdevice_obj_t *self); -extern void common_hal_busdevice_i2cdevice___exit__(busdevice_i2cdevice_obj_t *self); extern uint8_t common_hal_busdevice_i2cdevice_readinto(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length); extern uint8_t common_hal_busdevice_i2cdevice_write(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length); extern uint8_t common_hal_busdevice_i2cdevice_write_then_readinto(busdevice_i2cdevice_obj_t *self, mp_obj_t out_buffer, mp_obj_t in_buffer, size_t out_length, size_t in_length); -extern uint8_t common_hal_busdevice_i2cdevice___probe_for_device(busdevice_i2cdevice_obj_t *self); extern void common_hal_busdevice_i2cdevice_lock(busdevice_i2cdevice_obj_t *self); extern void common_hal_busdevice_i2cdevice_unlock(busdevice_i2cdevice_obj_t *self); +extern void common_hal_busdevice_i2cdevice___probe_for_device(busdevice_i2cdevice_obj_t *self); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_BUSDEVICE_I2CDEVICE_H diff --git a/shared-module/busdevice/I2CDevice.c b/shared-module/busdevice/I2CDevice.c index 30f4aad339901..516132c84ebeb 100644 --- a/shared-module/busdevice/I2CDevice.c +++ b/shared-module/busdevice/I2CDevice.c @@ -28,15 +28,12 @@ #include "shared-bindings/busio/I2C.h" #include "py/mperrno.h" #include "py/nlr.h" +#include "py/runtime.h" void common_hal_busdevice_i2cdevice_construct(busdevice_i2cdevice_obj_t *self, busio_i2c_obj_t *i2c, uint8_t device_address, bool probe) { self->i2c = i2c; self->device_address = device_address; self->probe = probe; - - if (self->probe == true) { - common_hal_busdevice_i2cdevice___probe_for_device(self); - } } void common_hal_busdevice_i2cdevice_lock(busdevice_i2cdevice_obj_t *self) { @@ -73,29 +70,19 @@ uint8_t common_hal_busdevice_i2cdevice_write_then_readinto(busdevice_i2cdevice_o return status; } -uint8_t common_hal_busdevice_i2cdevice___probe_for_device(busdevice_i2cdevice_obj_t *self) { - - +void common_hal_busdevice_i2cdevice___probe_for_device(busdevice_i2cdevice_obj_t *self) { + common_hal_busdevice_i2cdevice_lock(self); + mp_buffer_info_t bufinfo; + mp_obj_t buffer = mp_obj_new_bytearray_of_zeros(1); - // write "" + mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_WRITE); - -/* - while not self.i2c.try_lock(): - pass - try: - self.i2c.writeto(self.device_address, b"") - except OSError: - # some OS's dont like writing an empty bytesting... - # Retry by reading a byte - try: - result = bytearray(1) - self.i2c.readfrom_into(self.device_address, result) - except OSError: - raise ValueError("No I2C device at address: %x" % self.device_address) - finally: - self.i2c.unlock() -*/ - return 0; -} + uint8_t status = common_hal_busdevice_i2cdevice_readinto(self, (uint8_t*)bufinfo.buf, 1); + if (status != 0) { + common_hal_busdevice_i2cdevice_unlock(self); + mp_raise_ValueError_varg(translate("No I2C device at address: %x"), self->device_address); + } + + common_hal_busdevice_i2cdevice_unlock(self); +} \ No newline at end of file From 543316a8fbaa78db485c1135b8f9ee5c2d1982e3 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 25 Oct 2020 13:26:55 -0500 Subject: [PATCH 027/770] ulab: Update again .. pull in various doc build fixes that prevented the previous commit from building. This is still "0.54.5", the tag was updated in micropython-ulab (since no functional difference was introduced, only doc and CI differences, I imagine) --- extmod/ulab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extmod/ulab b/extmod/ulab index 7f2c1ae52bee5..8242b84753355 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit 7f2c1ae52bee57ce32ac0a74652610cc233d3442 +Subproject commit 8242b84753355433b61230ab6631c06e5ac77f35 From 85aa851714f8bc24817b2d56b3286419b43b537a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 25 Oct 2020 15:21:13 -0500 Subject: [PATCH 028/770] make translate --- locale/circuitpython.pot | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index cf92b0584a860..cc058e61a2e0f 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-10-15 16:06+0530\n" +"POT-Creation-Date: 2020-10-25 15:21-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2863,6 +2863,14 @@ msgstr "" msgid "maximum recursion depth exceeded" msgstr "" +#: extmod/ulab/code/approx/approx.c +msgid "maxiter must be > 0" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "maxiter should be > 0" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3295,6 +3303,10 @@ msgstr "" msgid "sort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "sorted axis can't be longer than 65535" +msgstr "" + #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" From c43011f149b981b4f9919a221f4ad4e9861b43a1 Mon Sep 17 00:00:00 2001 From: Senuros Date: Sun, 25 Oct 2020 22:08:10 +0100 Subject: [PATCH 029/770] Improving German translation --- locale/de_DE.po | 62 ++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/locale/de_DE.po b/locale/de_DE.po index e54b670a9029d..0e2e5a038e1dc 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -73,7 +73,7 @@ msgstr "Der Index %q befindet sich außerhalb des Bereiches" #: py/obj.c msgid "%q indices must be integers, not %q" -msgstr "" +msgstr "%q Indizes müssen Integer sein, nicht %q" #: shared-bindings/vectorio/Polygon.c msgid "%q list must be a list" @@ -81,7 +81,7 @@ msgstr "%q Liste muss eine Liste sein" #: shared-bindings/memorymonitor/AllocationAlarm.c msgid "%q must be >= 0" -msgstr "" +msgstr "%q muss >= 0 sein" #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c @@ -97,11 +97,11 @@ msgstr "%q muss ein Tupel der Länge 2 sein" #: shared-bindings/canio/Match.c msgid "%q out of range" -msgstr "" +msgstr "%q außerhalb des Bereichs" #: ports/atmel-samd/common-hal/microcontroller/Pin.c msgid "%q pin invalid" -msgstr "" +msgstr "%q Pin ungültig" #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" @@ -117,11 +117,11 @@ msgstr "'%q' Argument erforderlich" #: py/runtime.c msgid "'%q' object cannot assign attribute '%q'" -msgstr "" +msgstr "'%q' Objekt kann das Attribut '%q' nicht zuweisen" #: py/proto.c msgid "'%q' object does not support '%q'" -msgstr "" +msgstr "'%q' Objekt unterstützt '%q' nicht" #: py/obj.c msgid "'%q' object does not support item assignment" @@ -129,11 +129,11 @@ msgstr "" #: py/obj.c msgid "'%q' object does not support item deletion" -msgstr "" +msgstr "'%q' objekt unterstützt das " #: py/runtime.c msgid "'%q' object has no attribute '%q'" -msgstr "" +msgstr "'%q' Objekt hat kein Attribut '%q'" #: py/runtime.c msgid "'%q' object is not an iterator" @@ -141,7 +141,7 @@ msgstr "" #: py/objtype.c py/runtime.c msgid "'%q' object is not callable" -msgstr "" +msgstr "'%q' Objekt ist kein callable" #: py/runtime.c msgid "'%q' object is not iterable" @@ -280,7 +280,7 @@ msgstr "Ein Hardware Interrupt Kanal wird schon benutzt" #: ports/esp32s2/common-hal/analogio/AnalogIn.c msgid "ADC2 is being used by WiFi" -msgstr "" +msgstr "ADC2 wird vom WiFi benutzt" #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format @@ -346,11 +346,11 @@ msgstr "" #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" -msgstr "" +msgstr "Läuft bereits" #: ports/esp32s2/common-hal/wifi/Radio.c msgid "Already scanning for wifi networks" -msgstr "" +msgstr "Sucht bereits nach wifi Netzwerken" #: ports/cxd56/common-hal/analogio/AnalogIn.c msgid "AnalogIn not supported on given pin" @@ -390,7 +390,7 @@ msgstr "Es darf höchstens %d %q spezifiziert werden (nicht %d)" #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" -msgstr "" +msgstr "Versuche %d Blöcke zu allokieren" #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." @@ -400,7 +400,7 @@ msgstr "" #: shared-bindings/wifi/Radio.c msgid "Authentication failure" -msgstr "" +msgstr "Authentifizierungsfehler" #: main.c msgid "Auto-reload is off.\n" @@ -478,11 +478,11 @@ msgstr "Die Pufferlänge %d ist zu groß. Sie muss kleiner als %d sein" #: ports/atmel-samd/common-hal/sdioio/SDCard.c #: ports/cxd56/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c msgid "Buffer length must be a multiple of 512" -msgstr "" +msgstr "Die Pufferlänge muss ein vielfaches von 512 sein" #: ports/stm/common-hal/sdioio/SDCard.c msgid "Buffer must be a multiple of 512 bytes" -msgstr "" +msgstr "Der Puffer muss ein vielfaches von 512 bytes sein" #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" @@ -660,7 +660,7 @@ msgstr "Beschädigter raw code" #: ports/cxd56/common-hal/camera/Camera.c msgid "Could not initialize Camera" -msgstr "" +msgstr "Konnte Kamera nicht initialisieren" #: ports/cxd56/common-hal/gnss/GNSS.c msgid "Could not initialize GNSS" @@ -668,7 +668,7 @@ msgstr "" #: ports/cxd56/common-hal/sdioio/SDCard.c msgid "Could not initialize SDCard" -msgstr "" +msgstr "Konnte SDKarte nicht initialisieren" #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c @@ -701,7 +701,7 @@ msgstr "" #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" -msgstr "" +msgstr "Konnte Adresse nicht setzen" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Could not start PWM" @@ -818,7 +818,7 @@ msgstr "Characteristic wird erwartet" #: shared-bindings/_bleio/Adapter.c msgid "Expected a DigitalInOut" -msgstr "" +msgstr "DigitanInOut wird erwartet" #: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" @@ -826,7 +826,7 @@ msgstr "Ein Service wird erwartet" #: shared-bindings/_bleio/Adapter.c msgid "Expected a UART" -msgstr "" +msgstr "UART wird erwartet" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c #: shared-bindings/_bleio/Service.c @@ -853,7 +853,7 @@ msgstr "FFT ist nur für ndarrays definiert" #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" -msgstr "" +msgstr "SSL Handshake fehlgeschlagen" #: shared-bindings/ps2io/Ps2.c msgid "Failed sending command." @@ -918,16 +918,16 @@ msgstr "Datei existiert" #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "Filters too complex" -msgstr "" +msgstr "Filter zu komplex" #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" -msgstr "" +msgstr "Format nicht unterstützt" #: shared-module/framebufferio/FramebufferDisplay.c #, c-format msgid "Framebuffer requires %d bytes" -msgstr "" +msgstr "Framepuffer benötigt %d bytes" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "Frequency captured is above capability. Capture Paused." @@ -968,7 +968,7 @@ msgstr "Hardware in benutzung, probiere alternative Pins" #: shared-bindings/wifi/Radio.c msgid "Hostname must be between 1 and 253 characters" -msgstr "" +msgstr "Der Hostname muss zwischen 1 und 253 Zeichen haben" #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" @@ -980,7 +980,7 @@ msgstr "I2C-Init-Fehler" #: shared-bindings/audiobusio/I2SOut.c msgid "I2SOut not available" -msgstr "" +msgstr "I2SOut nicht verfügbar" #: shared-bindings/aesio/aes.c #, c-format @@ -1026,12 +1026,12 @@ msgstr "Interner Fehler #%d" #: shared-bindings/sdioio/SDCard.c msgid "Invalid %q" -msgstr "" +msgstr "Ungültiger %q" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "Invalid %q pin" -msgstr "Ungültiger %q pin" +msgstr "Ungültiger %q Pin" #: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/UART.c ports/stm/common-hal/canio/CAN.c @@ -1049,7 +1049,7 @@ msgstr "Ungültige BMP-Datei" #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" -msgstr "" +msgstr "Ungültige BSSID" #: ports/esp32s2/common-hal/analogio/AnalogOut.c #: ports/stm/common-hal/analogio/AnalogOut.c @@ -1100,7 +1100,7 @@ msgstr "Ungültige format chunk size" #: ports/esp32s2/common-hal/pwmio/PWMOut.c msgid "Invalid frequency" -msgstr "" +msgstr "Ungültige Frequenz" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Invalid frequency supplied" From 998661246cc84330a239e33a89e2ce6f8f3e9c38 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Sun, 25 Oct 2020 21:03:27 +0000 Subject: [PATCH 030/770] Translated using Weblate (Swedish) Currently translated at 100.0% (836 of 836 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 22007e11f32fc..989b8257e75ca 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-10-16 19:50-0500\n" -"PO-Revision-Date: 2020-10-22 01:12+0000\n" +"PO-Revision-Date: 2020-10-26 02:36+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.3.1\n" +"X-Generator: Weblate 4.3.2-dev\n" #: main.c msgid "" @@ -494,7 +494,7 @@ msgstr "Bufferten är för stor och kan inte allokeras" #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" -msgstr "Buffert år %d bytes för kort" +msgstr "Buffert är %d bytes för kort" #: ports/atmel-samd/common-hal/displayio/ParallelBus.c #: ports/nrf/common-hal/displayio/ParallelBus.c @@ -2161,7 +2161,7 @@ msgstr "buffert för liten" #: shared-bindings/socketpool/Socket.c msgid "buffer too small for requested bytes" -msgstr "buffertför liten för begärd längd" +msgstr "buffert för liten för begärd längd" #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" From 396d92f867c66673c8dffc77f7c0cbcaa83a157f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 21 Oct 2020 10:38:01 -0500 Subject: [PATCH 031/770] esp32s2: Add canio This works in loopback mode, though the hardware filtering only permits a single address or mask filter. --- ports/esp32s2/Makefile | 4 +- .../espressif_kaluga_1/mpconfigboard.mk | 2 +- ports/esp32s2/common-hal/canio/CAN.c | 297 ++++++++++++++++++ ports/esp32s2/common-hal/canio/CAN.h | 52 +++ ports/esp32s2/common-hal/canio/Listener.c | 182 +++++++++++ ports/esp32s2/common-hal/canio/Listener.h | 40 +++ ports/esp32s2/common-hal/canio/__init__.c | 25 ++ ports/esp32s2/common-hal/canio/__init__.h | 27 ++ ports/esp32s2/mpconfigport.mk | 1 + 9 files changed, 627 insertions(+), 3 deletions(-) create mode 100644 ports/esp32s2/common-hal/canio/CAN.c create mode 100644 ports/esp32s2/common-hal/canio/CAN.h create mode 100644 ports/esp32s2/common-hal/canio/Listener.c create mode 100644 ports/esp32s2/common-hal/canio/Listener.h create mode 100644 ports/esp32s2/common-hal/canio/__init__.c create mode 100644 ports/esp32s2/common-hal/canio/__init__.h diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 8d891edd02482..5d8ccad50de38 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -331,10 +331,10 @@ $(BUILD)/firmware.uf2: $(BUILD)/circuitpython-firmware.bin $(Q)$(PYTHON3) $(TOP)/tools/uf2/utils/uf2conv.py -f 0xbfdd4eee -b 0x0000 -c -o $@ $^ flash: $(BUILD)/firmware.bin - esptool.py --chip esp32s2 -p $(PORT) --no-stub -b 460800 --before=default_reset --after=hard_reset write_flash $(FLASH_FLAGS) 0x0000 $^ + esptool.py --chip esp32s2 -p $(PORT) -b 460800 --before=default_reset --after=hard_reset write_flash $(FLASH_FLAGS) 0x0000 $^ flash-circuitpython-only: $(BUILD)/circuitpython-firmware.bin - esptool.py --chip esp32s2 -p $(PORT) --no-stub -b 460800 --before=default_reset --after=hard_reset write_flash $(FLASH_FLAGS) 0x10000 $^ + esptool.py --chip esp32s2 -p $(PORT) -b 460800 --before=default_reset --after=hard_reset write_flash $(FLASH_FLAGS) 0x10000 $^ include $(TOP)/py/mkrules.mk diff --git a/ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.mk b/ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.mk index ba85e46efc2f1..2dce0388199f8 100644 --- a/ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.mk +++ b/ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.mk @@ -11,7 +11,7 @@ LONGINT_IMPL = MPZ CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m +CIRCUITPY_ESP_FLASH_FREQ=80m CIRCUITPY_ESP_FLASH_SIZE=4MB CIRCUITPY_MODULE=wrover diff --git a/ports/esp32s2/common-hal/canio/CAN.c b/ports/esp32s2/common-hal/canio/CAN.c new file mode 100644 index 0000000000000..f1741969db37e --- /dev/null +++ b/ports/esp32s2/common-hal/canio/CAN.c @@ -0,0 +1,297 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler 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 + +#include "py/runtime.h" +#include "py/mperrno.h" + +#include "common-hal/canio/CAN.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/util.h" +#include "supervisor/port.h" +#include "hal/twai_ll.h" + +#include "hal/twai_types.h" + +STATIC bool reserved_can; + +twai_timing_config_t get_t_config(int baudrate) { + switch(baudrate) { + case 1000000: + { + twai_timing_config_t t_config = TWAI_TIMING_CONFIG_1MBITS(); + return t_config; + } + case 800000: + { + twai_timing_config_t t_config = TWAI_TIMING_CONFIG_800KBITS(); + return t_config; + } + case 500000: + { + twai_timing_config_t t_config = TWAI_TIMING_CONFIG_500KBITS(); + return t_config; + } + case 250000: + { + twai_timing_config_t t_config = TWAI_TIMING_CONFIG_250KBITS(); + return t_config; + } + case 125000: + { + twai_timing_config_t t_config = TWAI_TIMING_CONFIG_125KBITS(); + return t_config; + } + case 100000: + { + twai_timing_config_t t_config = TWAI_TIMING_CONFIG_100KBITS(); + return t_config; + } + case 50000: + { + twai_timing_config_t t_config = TWAI_TIMING_CONFIG_50KBITS(); + return t_config; + } + case 25000: + { + twai_timing_config_t t_config = TWAI_TIMING_CONFIG_25KBITS(); + return t_config; + } + case 20000: + { + twai_timing_config_t t_config = TWAI_TIMING_CONFIG_20KBITS(); + return t_config; + } + case 16000: + { + twai_timing_config_t t_config = TWAI_TIMING_CONFIG_16KBITS(); + return t_config; + } + case 12500: + { + twai_timing_config_t t_config = TWAI_TIMING_CONFIG_12_5KBITS(); + return t_config; + } + case 10000: + { + twai_timing_config_t t_config = TWAI_TIMING_CONFIG_10KBITS(); + return t_config; + } + case 5000: + { + twai_timing_config_t t_config = TWAI_TIMING_CONFIG_5KBITS(); + return t_config; + } + case 1000: + { + twai_timing_config_t t_config = TWAI_TIMING_CONFIG_1KBITS(); + return t_config; + } + default: + mp_raise_ValueError(translate("Baudrate not supported by peripheral")); + } +} + +__attribute__((optimize("O0"))) +void common_hal_canio_can_construct(canio_can_obj_t *self, mcu_pin_obj_t *tx, mcu_pin_obj_t *rx, int baudrate, bool loopback, bool silent) +{ +#define DIV_ROUND(a, b) (((a) + (b)/2) / (b)) +#define DIV_ROUND_UP(a, b) (((a) + (b) - 1) / (b)) + if (reserved_can) { + mp_raise_ValueError(translate("All CAN peripherals are in use")); + } + + if (loopback && silent) { + mp_raise_ValueError(translate("loopback + silent mode not supported by peripheral")); + } + + self->t_config = get_t_config(baudrate);; + twai_general_config_t g_config = TWAI_GENERAL_CONFIG_DEFAULT(-1, -1, TWAI_MODE_NORMAL); + g_config.tx_io = tx->number; + g_config.rx_io = rx->number; + if (loopback) { + g_config.mode = TWAI_MODE_NO_ACK; + } + if (silent) { + g_config.mode = TWAI_MODE_LISTEN_ONLY; + } + self->g_config = g_config; + + { + twai_filter_config_t f_config = TWAI_FILTER_CONFIG_ACCEPT_ALL(); + self->f_config = f_config; + } + + esp_err_t result = twai_driver_install(&self->g_config, &self->t_config, &self->f_config); + if (result == ESP_ERR_NO_MEM) { + mp_raise_msg(&mp_type_MemoryError, translate("ESP-IDF memory allocation failed")); + } else if (result == ESP_ERR_INVALID_ARG) { + mp_raise_ValueError(translate("Invalid pins")); + } else if (result != ESP_OK) { + mp_raise_OSError_msg_varg(translate("twai_driver_install returned esp-idf error #%d"), (int)result); + } + + result = twai_start(); + if (result != ESP_OK) { + mp_raise_OSError_msg_varg(translate("twai_start returned esp-idf error #%d"), (int)result); + } + + self->silent = silent; + self->loopback = loopback; + self->baudrate = baudrate; + self->tx_pin = tx; + self->rx_pin = rx; + + claim_pin(tx); + claim_pin(rx); + + reserved_can = true; +} + +bool common_hal_canio_can_loopback_get(canio_can_obj_t *self) +{ + return self->loopback; +} + +int common_hal_canio_can_baudrate_get(canio_can_obj_t *self) +{ + return self->baudrate; +} + +int common_hal_canio_can_transmit_error_count_get(canio_can_obj_t *self) +{ + twai_status_info_t info; + twai_get_status_info(&info); + return info.tx_error_counter; +} + +int common_hal_canio_can_receive_error_count_get(canio_can_obj_t *self) +{ + twai_status_info_t info; + twai_get_status_info(&info); + return info.rx_error_counter; +} + +canio_bus_state_t common_hal_canio_can_state_get(canio_can_obj_t *self) { + twai_status_info_t info; + twai_get_status_info(&info); + if (info.state == TWAI_STATE_BUS_OFF || info.state == TWAI_STATE_RECOVERING) { + return BUS_STATE_OFF; + } + if (info.tx_error_counter > 127 || info.rx_error_counter > 127) { + return BUS_STATE_ERROR_PASSIVE; + } + if (info.tx_error_counter > 96 || info.rx_error_counter > 96) { + return BUS_STATE_ERROR_WARNING; + } + return BUS_STATE_ERROR_ACTIVE; +} + +static void can_restart(void) { + twai_status_info_t info; + twai_get_status_info(&info); + if (info.state != TWAI_STATE_BUS_OFF) { + return; + } + twai_initiate_recovery(); + // wait 100ms (hard coded for now) for bus to recover + uint64_t deadline = port_get_raw_ticks(NULL) + 100; + do { + twai_get_status_info(&info); + } while (port_get_raw_ticks(NULL) < deadline && (info.state == TWAI_STATE_BUS_OFF || info.state == TWAI_STATE_RECOVERING)); +} + +void canio_maybe_auto_restart(canio_can_obj_t *self) { + if (self->auto_restart) can_restart(); +} + +void common_hal_canio_can_restart(canio_can_obj_t *self) { + if (!common_hal_canio_can_auto_restart_get(self)) { + can_restart(); + } +} + +bool common_hal_canio_can_auto_restart_get(canio_can_obj_t *self) { + return self->auto_restart; +} + +void common_hal_canio_can_auto_restart_set(canio_can_obj_t *self, bool value) { + self->auto_restart = value; + canio_maybe_auto_restart(self); +} + +void common_hal_canio_can_send(canio_can_obj_t *self, mp_obj_t message_in) +{ + canio_maybe_auto_restart(self); + canio_message_obj_t *message = message_in; + bool rtr = message->base.type == &canio_remote_transmission_request_type; + twai_message_t message_out = { + .extd = message->extended, + .rtr = rtr, + .self = self->loopback, + .identifier = message->id, + .data_length_code = message->size, + }; + if (!rtr) { + memcpy(message_out.data, message->data, message->size); + } + // Allow transmission to occur in background + twai_transmit(&message_out, 0); +} + +bool common_hal_canio_can_silent_get(canio_can_obj_t *self) { + return self->silent; +} + +bool common_hal_canio_can_deinited(canio_can_obj_t *self) { + return !self->tx_pin; +} + +void common_hal_canio_can_check_for_deinit(canio_can_obj_t *self) { + if (common_hal_canio_can_deinited(self)) { + raise_deinited_error(); + } +} + +void common_hal_canio_can_deinit(canio_can_obj_t *self) +{ + if (self->tx_pin) { + (void)twai_stop(); + (void)twai_driver_uninstall(); + reset_pin_number(self->tx_pin->number); + reset_pin_number(self->rx_pin->number); + reserved_can = false; + } + self->tx_pin = NULL; + self->rx_pin = NULL; +} + +void common_hal_canio_reset(void) { + (void)twai_stop(); + (void)twai_driver_uninstall(); + reserved_can = false; +} diff --git a/ports/esp32s2/common-hal/canio/CAN.h b/ports/esp32s2/common-hal/canio/CAN.h new file mode 100644 index 0000000000000..e15d515908529 --- /dev/null +++ b/ports/esp32s2/common-hal/canio/CAN.h @@ -0,0 +1,52 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler 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. + */ + +#pragma once + +#include "py/obj.h" +#include "shared-bindings/canio/__init__.h" +#include "shared-bindings/canio/CAN.h" +#include "common-hal/microcontroller/Pin.h" +#include "common-hal/canio/__init__.h" +#include "shared-module/canio/Message.h" + +#include "driver/twai.h" + +#define FILTER_BANK_COUNT (28) + +typedef struct canio_can_obj { + mp_obj_base_t base; + int baudrate; + const mcu_pin_obj_t *rx_pin; + const mcu_pin_obj_t *tx_pin; + bool loopback:1; + bool silent:1; + bool auto_restart:1; + bool fifo_in_use:1; + twai_filter_config_t f_config; + twai_general_config_t g_config; + twai_timing_config_t t_config; +} canio_can_obj_t; diff --git a/ports/esp32s2/common-hal/canio/Listener.c b/ports/esp32s2/common-hal/canio/Listener.c new file mode 100644 index 0000000000000..fddbfeb583b54 --- /dev/null +++ b/ports/esp32s2/common-hal/canio/Listener.c @@ -0,0 +1,182 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler 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 +#include + +#include "py/obj.h" +#include "py/runtime.h" + +#include "common-hal/canio/__init__.h" +#include "common-hal/canio/Listener.h" +#include "shared-bindings/canio/Listener.h" +#include "shared-bindings/util.h" +#include "supervisor/shared/tick.h" +#include "supervisor/shared/safe_mode.h" + +#include "hal/twai_ll.h" + +// IDE = "extended ID" flag of packet header. We always add this bit to the +// mask because a match is always for just one kind of address length +#define FILTER16_IDE (1<<3) +#define FILTER32_IDE (1<<2) + +// Work around a problem reported at +// https://github.com/espressif/esp-idf/issues/6020 where +// twai_ll_set_acc_filter does not work under -Os optimization +__attribute__((optimize("O0"))) +__attribute__((noinline)) +static void canio_set_acc_filter(twai_dev_t* hw, uint32_t code, uint32_t mask, bool single_filter) +{ + uint32_t code_swapped = __builtin_bswap32(code); + uint32_t mask_swapped = __builtin_bswap32(mask); + for (int i = 0; i < 4; i++) { + hw->acceptance_filter.acr[i].val = ((code_swapped >> (i * 8)) & 0xFF); + hw->acceptance_filter.amr[i].val = ((mask_swapped >> (i * 8)) & 0xFF); + } + hw->mode_reg.afm = single_filter; +} + +STATIC void install_standard_filter(canio_listener_obj_t *self, canio_match_obj_t *match) { + canio_set_acc_filter(&TWAI, match->id << 21, ~(match->mask << 21), true); + self->extended = false; + self->standard = true; +} + +STATIC void install_extended_filter(canio_listener_obj_t *self, canio_match_obj_t *match) { + canio_set_acc_filter(&TWAI, match->id << 3, ~(match->mask << 3), true); + self->extended = true; + self->standard = false; +} + +STATIC void install_all_match_filter(canio_listener_obj_t *self) { + canio_set_acc_filter(&TWAI, 0u, ~0u, true); + self->extended = true; + self->standard = true; +} + +__attribute__((noinline,optimize("O0"))) +void set_filters(canio_listener_obj_t *self, size_t nmatch, canio_match_obj_t **matches) { + twai_ll_enter_reset_mode(&TWAI); + + if (!nmatch) { + install_all_match_filter(self); + } else { + canio_match_obj_t *match = matches[0]; + if (match->extended) { + install_extended_filter(self, match); + } else { + install_standard_filter(self, match); + } + } + + twai_ll_exit_reset_mode(&TWAI); +} + + +void common_hal_canio_listener_construct(canio_listener_obj_t *self, canio_can_obj_t *can, size_t nmatch, canio_match_obj_t **matches, float timeout) { + if (can->fifo_in_use) { + mp_raise_ValueError(translate("All RX FIFOs in use")); + } + if (nmatch > 1) { + mp_raise_ValueError(translate("Filters too complex")); + } + + // Nothing can fail now so it's safe to assign self->can + can->fifo_in_use = 1; + self->can = can; + self->pending = false; + + set_filters(self, nmatch, matches); + self->extended = self->standard = true; + + common_hal_canio_listener_set_timeout(self, timeout); +} + +void common_hal_canio_listener_set_timeout(canio_listener_obj_t *self, float timeout) { + self->timeout_ms = (int)MICROPY_FLOAT_C_FUN(ceil)(timeout * 1000); +} + +float common_hal_canio_listener_get_timeout(canio_listener_obj_t *self) { + return self->timeout_ms / 1000.0f; +} + +void common_hal_canio_listener_check_for_deinit(canio_listener_obj_t *self) { + if (!self->can) { + raise_deinited_error(); + } + common_hal_canio_can_check_for_deinit(self->can); +} + +// The API has no peek method so we must receive a packet into a holding area +// and then we can say that we have 1 message pending +int common_hal_canio_listener_in_waiting(canio_listener_obj_t *self) { + while (!self->pending && twai_receive(&self->message_in, 0) == ESP_OK) { + if (self->message_in.extd && self->extended) { + self->pending = true; + } + if (!self->message_in.extd && self->standard) { + self->pending = true; + } + } + return self->pending; +} + +mp_obj_t common_hal_canio_listener_receive(canio_listener_obj_t *self) { + if (!common_hal_canio_listener_in_waiting(self)) { + uint64_t deadline = supervisor_ticks_ms64() + self->timeout_ms; + do { + if (supervisor_ticks_ms64() > deadline) { + return NULL; + } + } while (!common_hal_canio_listener_in_waiting(self)); + } + + bool rtr = self->message_in.rtr; + + int dlc = self->message_in.data_length_code; + canio_message_obj_t *message = m_new_obj(canio_message_obj_t); + message->base.type = rtr ? &canio_remote_transmission_request_type : &canio_message_type; + message->extended = self->message_in.extd; + message->id = self->message_in.identifier; + message->size = dlc; + + if (!rtr) { + MP_STATIC_ASSERT(sizeof(self->message_in.data) == sizeof(message->data)); + memcpy(message->data, self->message_in.data, sizeof(message->data)); + } + + self->pending = false; + + return message; +} + +void common_hal_canio_listener_deinit(canio_listener_obj_t *self) { + if (self->can) { + self->can->fifo_in_use = false; + } + self->can = NULL; +} diff --git a/ports/esp32s2/common-hal/canio/Listener.h b/ports/esp32s2/common-hal/canio/Listener.h new file mode 100644 index 0000000000000..d24900e4357fb --- /dev/null +++ b/ports/esp32s2/common-hal/canio/Listener.h @@ -0,0 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler 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. + */ + +#pragma once + +#include "common-hal/canio/CAN.h" +#include "shared-module/canio/Match.h" + +typedef struct canio_listener_obj { + mp_obj_base_t base; + canio_can_obj_t *can; + bool extended:1; + bool standard:1; + bool pending:1; + twai_message_t message_in; + uint32_t timeout_ms; +} canio_listener_obj_t; diff --git a/ports/esp32s2/common-hal/canio/__init__.c b/ports/esp32s2/common-hal/canio/__init__.c new file mode 100644 index 0000000000000..7932bfc2da82a --- /dev/null +++ b/ports/esp32s2/common-hal/canio/__init__.c @@ -0,0 +1,25 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler 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. + */ diff --git a/ports/esp32s2/common-hal/canio/__init__.h b/ports/esp32s2/common-hal/canio/__init__.h new file mode 100644 index 0000000000000..20b6638cd8ff2 --- /dev/null +++ b/ports/esp32s2/common-hal/canio/__init__.h @@ -0,0 +1,27 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler 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. + */ + +#pragma once diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index 4e8a7bdef2f98..c9863572a5476 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -16,6 +16,7 @@ LONGINT_IMPL = MPZ CIRCUITPY_FULL_BUILD = 1 CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_AUDIOIO = 0 +CIRCUITPY_CANIO = 1 CIRCUITPY_COUNTIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 From bdc13437910320c0784902661b16b6171720f1ab Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 21 Oct 2020 11:30:33 -0500 Subject: [PATCH 032/770] make translate --- locale/circuitpython.pot | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 7ed2d1ba1d8ae..94a6a8514d2dd 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-10-16 19:50-0500\n" +"POT-Creation-Date: 2020-10-21 20:13-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -288,11 +288,16 @@ msgstr "" msgid "Address type out of range" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "All CAN peripherals are in use" +msgstr "" + #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "All RX FIFOs in use" msgstr "" @@ -407,6 +412,10 @@ msgid "" "disable.\n" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "Baudrate not supported by peripheral" +msgstr "" + #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" @@ -775,7 +784,7 @@ msgstr "" msgid "ECB only operates on 16 bytes at a time" msgstr "" -#: ports/esp32s2/common-hal/busio/SPI.c +#: ports/esp32s2/common-hal/busio/SPI.c ports/esp32s2/common-hal/canio/CAN.c msgid "ESP-IDF memory allocation failed" msgstr "" @@ -901,6 +910,7 @@ msgid "File exists" msgstr "" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "Filters too complex" msgstr "" @@ -1119,7 +1129,7 @@ msgstr "" #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c #: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/SPI.c -#: ports/esp32s2/common-hal/busio/UART.c +#: ports/esp32s2/common-hal/busio/UART.c ports/esp32s2/common-hal/canio/CAN.c #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c @@ -2837,6 +2847,10 @@ msgstr "" msgid "long int not supported in this build" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "loopback + silent mode not supported by peripheral" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "" @@ -3181,6 +3195,8 @@ msgstr "" #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wrover/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h msgid "pressing boot button at start up.\n" @@ -3432,6 +3448,16 @@ msgstr "" msgid "tuple/list has wrong length" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_driver_install returned esp-idf error #%d" +msgstr "" + +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_start returned esp-idf error #%d" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: shared-bindings/busio/UART.c shared-bindings/canio/CAN.c From 32f2a8d54cf54bb3f9dcba33f4b617d4dcf8b596 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Mon, 26 Oct 2020 11:03:54 -0400 Subject: [PATCH 033/770] Fix readme link --- ports/esp32s2/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/README.md b/ports/esp32s2/README.md index 8a6dfbd2d8ef8..f3e678de85e5a 100644 --- a/ports/esp32s2/README.md +++ b/ports/esp32s2/README.md @@ -30,18 +30,20 @@ Connect these pins using a [USB adapter](https://www.adafruit.com/product/4090) ## Building and flashing ## -Before building or flashing the ESP32-S2, you must [install the esp-idf](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html). This must be re-done ever time the esp-idf is updated, but not every time you build. Run `cd ports/esp32s2` from `circuitpython/` to move to the esp32s2 port root, and run: +Before building or flashing the ESP32-S2, you must [install the esp-idf](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/get-started/index.html). This must be re-done ever time the esp-idf is updated, but not every time you build. Run `cd ports/esp32s2` from `circuitpython/` to move to the esp32s2 port root, and run: ``` ./esp-idf/install.sh ``` -Additionally, any time you open a new bash environment for building or flashing, you must add the esp-idf tools to your path: +After this initial installation, you must add the esp-idf tools to your path. You must also do this **any time you open a new bash environment for building or flashing**: ``` . esp-idf/export.sh ``` +When Circuitpython updates the ESP-IDF to a new release, you may need to run this installation process again. The exact commands used may also vary based on your bash environment. + Building boards such as the Saola is typically done through `make flash`. The default port is `tty.SLAB_USBtoUART`, which will only work on certain Mac setups. On most machines, both Mac and Linux, you will need to set the port yourself by running `ls /dev/tty.usb*` and selecting the one that only appears when your development board is plugged in. An example make command with the port setting is as follows: ``` From c9f7df3bab8c46cc51b12eefc95391a00ba8c7e1 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 26 Oct 2020 10:06:49 -0500 Subject: [PATCH 034/770] canio: Give implementation-specific limits for CAN.Listen --- shared-bindings/canio/CAN.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/shared-bindings/canio/CAN.c b/shared-bindings/canio/CAN.c index 6dae36943a4a5..4982a97b9ddf7 100644 --- a/shared-bindings/canio/CAN.c +++ b/shared-bindings/canio/CAN.c @@ -214,7 +214,24 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(canio_can_restart_obj, canio_can_restart); //| //| An empty filter list causes all messages to be accepted. //| -//| Timeout dictates how long receive() and next() will block.""" +//| Timeout dictates how long receive() and next() will block. +//| +//| Platform specific notes: +//| +//| SAM E5x supports two Listeners. Filter blocks are shared between the two +//| listeners. There are 4 standard filter blocks and 4 extended filter blocks. +//| Each block can either match 2 single addresses or a mask of addresses. +//| The number of filter blocks can be increased, up to a hardware maximum, by +//| rebuilding CircuitPython, but this decreases the CircuitPython free +//| memory even if canio is not used. +//| +//| STM32F405 supports two Listeners. Filter blocks are shared between the two listeners. +//| There are 14 filter blocks. Each block can match 2 standard addresses with +//| mask or 1 extended address with mask. +//| +//| ESP32S2 supports one Listener. There is a single filter block, which can either match a +//| standard address with mask or an extended address with mask. +//| """ //| ... //| STATIC mp_obj_t canio_can_listen(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { From 81ab6a05d0652688d446fc75c838be95f13fb32b Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 26 Oct 2020 13:25:00 -0700 Subject: [PATCH 035/770] Use old translation date to avoid merge conflict --- locale/circuitpython.pot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index cc058e61a2e0f..a5581e7fa7b29 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-10-25 15:21-0500\n" +"POT-Creation-Date: 2020-10-15 16:06+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" From 1117edae63df7b66f1575980bf54d6836f9a8aa8 Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Sat, 24 Oct 2020 17:13:10 +0200 Subject: [PATCH 036/770] Fix erroneous claim of board.I2C() by deinited display. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit At the end of a session that called displayio.release_displays() (and did not initialize a new display), a board.I2C() bus that was previously used by a display would wrongly be considered still in use. While I can’t think of any unrecoverable problem this would cause in the next session, it violates the assumption that a soft reboot resets everything not needed by displays, potentially leading to confusion. By itself, this change does not fix the problem yet - rather, it introduces the same issue as in #3581 for SPI. This needs to be solved in the same way for I2C and SPI. --- shared-module/board/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-module/board/__init__.c b/shared-module/board/__init__.c index 39b68a0f11548..856103b7b60bd 100644 --- a/shared-module/board/__init__.c +++ b/shared-module/board/__init__.c @@ -139,7 +139,7 @@ void reset_board_busses(void) { bool display_using_i2c = false; #if CIRCUITPY_DISPLAYIO for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { - if (displays[i].i2cdisplay_bus.bus == i2c_singleton) { + if (displays[i].bus_base.type == &displayio_i2cdisplay_type && displays[i].i2cdisplay_bus.bus == i2c_singleton) { display_using_i2c = true; break; } From f4f80e07ca3dc2f5a93484e5342540837a94a505 Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Sat, 24 Oct 2020 17:23:17 +0200 Subject: [PATCH 037/770] Fix lost board.SPI and board.I2C after being used by display. Fixes #3581. Pins were marked as never_reset by common_hal_displayio_fourwire_construct() and common_hal_sharpdisplay_framebuffer_construct(), but these marks were never removed, so at the end of a session after displayio.release_displays(), {spi|i2c}_singleton would be set to NULL but the pins would not be reset. In the next session, board.SPI() and board.I2C() were unable to reconstruct the object because the pins were still in use. For symmetry with creation of the singleton, add deinitialization before setting it to NULL in reset_board_busses(). This makes the pins resettable, so that reset_port(), moved behind it, then resets them. --- main.c | 4 +++- shared-module/board/__init__.c | 14 +++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index b43b3b8c806bb..80b163f6079f7 100755 --- a/main.c +++ b/main.c @@ -234,10 +234,12 @@ void cleanup_after_vm(supervisor_allocation* heap) { common_hal_canio_reset(); #endif - reset_port(); + // reset_board_busses() first because it may release pins from the never_reset state, so that + // reset_port() can reset them. #if CIRCUITPY_BOARD reset_board_busses(); #endif + reset_port(); reset_board(); reset_status_led(); } diff --git a/shared-module/board/__init__.c b/shared-module/board/__init__.c index 856103b7b60bd..967b430d2bae3 100644 --- a/shared-module/board/__init__.c +++ b/shared-module/board/__init__.c @@ -145,8 +145,11 @@ void reset_board_busses(void) { } } #endif - if (!display_using_i2c) { - i2c_singleton = NULL; + if (i2c_singleton != NULL) { + if (!display_using_i2c) { + common_hal_busio_i2c_deinit(i2c_singleton); + i2c_singleton = NULL; + } } #endif #if BOARD_SPI @@ -169,9 +172,10 @@ void reset_board_busses(void) { // make sure SPI lock is not held over a soft reset if (spi_singleton != NULL) { common_hal_busio_spi_unlock(spi_singleton); - } - if (!display_using_spi) { - spi_singleton = NULL; + if (!display_using_spi) { + common_hal_busio_spi_deinit(spi_singleton); + spi_singleton = NULL; + } } #endif #if BOARD_UART From 99a3750a2cfd1da8cdd266ca9a0367f0c3a54092 Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Sat, 24 Oct 2020 17:50:11 +0200 Subject: [PATCH 038/770] Fix lost board.SPI and board.I2C after explicitly deiniting them. After calling board.SPI().deinit(), calling board.SPI() again would return the unusable deinited object and there was no way of getting it back into an initialized state until the end of the session. --- shared-bindings/board/__init__.c | 10 ++++++++-- shared-module/board/__init__.c | 10 ++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/shared-bindings/board/__init__.c b/shared-bindings/board/__init__.c index 6837fc41c2dc9..717698408aa68 100644 --- a/shared-bindings/board/__init__.c +++ b/shared-bindings/board/__init__.c @@ -28,6 +28,12 @@ #include "py/runtime.h" #include "shared-bindings/board/__init__.h" +#if BOARD_I2C +#include "shared-bindings/busio/I2C.h" +#endif +#if BOARD_SPI +#include "shared-bindings/busio/SPI.h" +#endif //| """Board specific pin names //| @@ -45,7 +51,7 @@ #if BOARD_I2C mp_obj_t board_i2c(void) { mp_obj_t singleton = common_hal_board_get_i2c(); - if (singleton != NULL) { + if (singleton != NULL && !common_hal_busio_i2c_deinited(singleton)) { return singleton; } assert_pin_free(DEFAULT_I2C_BUS_SDA); @@ -69,7 +75,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c); #if BOARD_SPI mp_obj_t board_spi(void) { mp_obj_t singleton = common_hal_board_get_spi(); - if (singleton != NULL) { + if (singleton != NULL && !common_hal_busio_spi_deinited(singleton)) { return singleton; } assert_pin_free(DEFAULT_SPI_BUS_SCK); diff --git a/shared-module/board/__init__.c b/shared-module/board/__init__.c index 967b430d2bae3..2f1c34e565cad 100644 --- a/shared-module/board/__init__.c +++ b/shared-module/board/__init__.c @@ -55,9 +55,8 @@ mp_obj_t common_hal_board_get_i2c(void) { } mp_obj_t common_hal_board_create_i2c(void) { - if (i2c_singleton != NULL) { - return i2c_singleton; - } + // All callers have either already verified this or come so early that it can't be otherwise. + assert(i2c_singleton == NULL || common_hal_busio_i2c_deinited(i2c_singleton)); busio_i2c_obj_t *self = &i2c_obj; self->base.type = &busio_i2c_type; @@ -79,9 +78,8 @@ mp_obj_t common_hal_board_get_spi(void) { } mp_obj_t common_hal_board_create_spi(void) { - if (spi_singleton != NULL) { - return spi_singleton; - } + // All callers have either already verified this or come so early that it can't be otherwise. + assert(spi_singleton == NULL || common_hal_busio_spi_deinited(spi_singleton)); busio_spi_obj_t *self = &spi_obj; self->base.type = &busio_spi_type; From 8a379830a8a583750daedb2b1c72369f6bb413ef Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Mon, 26 Oct 2020 16:54:24 -0500 Subject: [PATCH 039/770] Added doc and translations --- locale/circuitpython.pot | 12 ++- shared-bindings/busdevice/I2CDevice.c | 141 ++++++++++++++------------ shared-module/busdevice/I2CDevice.c | 2 +- 3 files changed, 89 insertions(+), 66 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 7ed2d1ba1d8ae..f96b67d2af095 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-10-16 19:50-0500\n" +"POT-Creation-Date: 2020-10-26 16:48-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -477,7 +477,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c +#: shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "" @@ -1251,6 +1252,11 @@ msgstr "" msgid "No DMA channel found" msgstr "" +#: shared-module/busdevice/I2CDevice.c +#, c-format +msgid "No I2C device at address: %x" +msgstr "" + #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c msgid "No MISO Pin" @@ -3181,6 +3187,8 @@ msgstr "" #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wrover/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h msgid "pressing boot button at start up.\n" diff --git a/shared-bindings/busdevice/I2CDevice.c b/shared-bindings/busdevice/I2CDevice.c index fa5cb02e0beb2..d8db9362f1b41 100644 --- a/shared-bindings/busdevice/I2CDevice.c +++ b/shared-bindings/busdevice/I2CDevice.c @@ -39,12 +39,29 @@ //| class I2CDevice: -//| """Two wire serial protocol""" -//| -//| def __init__(self, i2c, device_address, probe=True) -> None: -//| -//| ... -//| +//| """ +//| Represents a single I2C device and manages locking the bus and the device +//| address. +//| :param ~busio.I2C i2c: The I2C bus the device is on +//| :param int device_address: The 7 bit device address +//| :param bool probe: Probe for the device upon object creation, default is true +//| .. note:: This class is **NOT** built into CircuitPython. See +//| :ref:`here for install instructions `. +//| Example: +//| .. code-block:: python +//| import busio +//| from board import * +//| from adafruit_bus_device.i2c_device import I2CDevice +//| with busio.I2C(SCL, SDA) as i2c: +//| device = I2CDevice(i2c, 0x70) +//| bytes_read = bytearray(4) +//| with device: +//| device.readinto(bytes_read) +//| # A second transaction +//| with device: +//| device.write(bytes_read)""" +//| ... +//| STATIC mp_obj_t busdevice_i2cdevice_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { busdevice_i2cdevice_obj_t *self = m_new_obj(busdevice_i2cdevice_obj_t); self->base.type = &busdevice_i2cdevice_type; @@ -67,28 +84,30 @@ STATIC mp_obj_t busdevice_i2cdevice_make_new(const mp_obj_type_t *type, size_t n return (mp_obj_t)self; } -//| def __enter__(self) -> None: -//| """Automatically initializes the hardware on context exit. See FIX -//| :ref:`lifetime-and-contextmanagers` for more info.""" -//| ... -//| STATIC mp_obj_t busdevice_i2cdevice_obj___enter__(mp_obj_t self_in) { common_hal_busdevice_i2cdevice_lock(self_in); return self_in; } STATIC MP_DEFINE_CONST_FUN_OBJ_1(busdevice_i2cdevice___enter___obj, busdevice_i2cdevice_obj___enter__); -//| def __exit__(self) -> None: -//| """Automatically deinitializes the hardware on context exit. See -//| :ref:`lifetime-and-contextmanagers` for more info.""" -//| ... -//| STATIC mp_obj_t busdevice_i2cdevice_obj___exit__(size_t n_args, const mp_obj_t *args) { common_hal_busdevice_i2cdevice_unlock(args[0]); return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busdevice_i2cdevice___exit___obj, 4, 4, busdevice_i2cdevice_obj___exit__); +//| def readinto(self, buf, *, start=0, end=None): +//| """ +//| Read into ``buf`` from the device. The number of bytes read will be the +//| length of ``buf``. +//| If ``start`` or ``end`` is provided, then the buffer will be sliced +//| as if ``buf[start:end]``. This will not cause an allocation like +//| ``buf[start:end]`` will so it saves memory. +//| :param bytearray buffer: buffer to write into +//| :param int start: Index to start writing at +//| :param int end: Index to write up to but not include; if None, use ``len(buf)``""" +//| ... +//| STATIC void readinto(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, int32_t start, mp_int_t end) { mp_buffer_info_t bufinfo; mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_WRITE); @@ -123,7 +142,19 @@ STATIC mp_obj_t busdevice_i2cdevice_readinto(size_t n_args, const mp_obj_t *pos_ } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busdevice_i2cdevice_readinto_obj, 2, busdevice_i2cdevice_readinto); - +//| def write(self, buf, *, start=0, end=None): +//| """ +//| Write the bytes from ``buffer`` to the device, then transmit a stop +//| bit. +//| If ``start`` or ``end`` is provided, then the buffer will be sliced +//| as if ``buffer[start:end]``. This will not cause an allocation like +//| ``buffer[start:end]`` will so it saves memory. +//| :param bytearray buffer: buffer containing the bytes to write +//| :param int start: Index to start writing from +//| :param int end: Index to read up to but not include; if None, use ``len(buf)`` +//| """ +//| ... +//| STATIC void write(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, int32_t start, mp_int_t end) { mp_buffer_info_t bufinfo; mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_READ); @@ -158,32 +189,28 @@ STATIC mp_obj_t busdevice_i2cdevice_write(size_t n_args, const mp_obj_t *pos_arg MP_DEFINE_CONST_FUN_OBJ_KW(busdevice_i2cdevice_write_obj, 2, busdevice_i2cdevice_write); -/*STATIC void write_then_readinto(busdevice_i2cdevice_obj_t *self, mp_obj_t out_buffer, mp_obj_t in_buffer, - int32_t out_start, mp_int_t out_end, int32_t in_start, mp_int_t in_end) { - mp_buffer_info_t out_bufinfo; - mp_get_buffer_raise(out_buffer, &out_bufinfo, MP_BUFFER_READ); - - size_t out_length = out_bufinfo.len; - normalize_buffer_bounds(&out_start, out_end, &out_length); - if (out_length == 0) { - mp_raise_ValueError(translate("Buffer must be at least length 1")); - } - - mp_buffer_info_t in_bufinfo; - mp_get_buffer_raise(in_buffer, &in_bufinfo, MP_BUFFER_WRITE); - - size_t in_length = in_bufinfo.len; - normalize_buffer_bounds(&in_start, in_end, &in_length); - if (in_length == 0) { - mp_raise_ValueError(translate("Buffer must be at least length 1")); - } - - uint8_t status = common_hal_busdevice_i2cdevice_write_then_readinto(self, out_buffer, in_buffer, out_length, in_length); - if (status != 0) { - mp_raise_OSError(status); - } -}*/ - +//| def write_then_readinto(self, out_buffer, in_buffer, *, out_start=0, out_end=None, in_start=0, in_end=None): +//| """ +//| Write the bytes from ``out_buffer`` to the device, then immediately +//| reads into ``in_buffer`` from the device. The number of bytes read +//| will be the length of ``in_buffer``. +//| If ``out_start`` or ``out_end`` is provided, then the output buffer +//| will be sliced as if ``out_buffer[out_start:out_end]``. This will +//| not cause an allocation like ``buffer[out_start:out_end]`` will so +//| it saves memory. +//| If ``in_start`` or ``in_end`` is provided, then the input buffer +//| will be sliced as if ``in_buffer[in_start:in_end]``. This will not +//| cause an allocation like ``in_buffer[in_start:in_end]`` will so +//| it saves memory. +//| :param bytearray out_buffer: buffer containing the bytes to write +//| :param bytearray in_buffer: buffer containing the bytes to read into +//| :param int out_start: Index to start writing from +//| :param int out_end: Index to read up to but not include; if None, use ``len(out_buffer)`` +//| :param int in_start: Index to start writing at +//| :param int in_end: Index to write up to but not include; if None, use ``len(in_buffer)`` +//| """ +//| ... +//| STATIC mp_obj_t busdevice_i2cdevice_write_then_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_out_buffer, ARG_in_buffer, ARG_out_start, ARG_out_end, ARG_in_start, ARG_in_end }; static const mp_arg_t allowed_args[] = { @@ -207,29 +234,17 @@ STATIC mp_obj_t busdevice_i2cdevice_write_then_readinto(size_t n_args, const mp_ } MP_DEFINE_CONST_FUN_OBJ_KW(busdevice_i2cdevice_write_then_readinto_obj, 3, busdevice_i2cdevice_write_then_readinto); - +//| def __probe_for_device(self): +//| """ +//| Try to read a byte from an address, +//| if you get an OSError it means the device is not there +//| or that the device does not support these means of probing +//| """ +//| ... +//| STATIC mp_obj_t busdevice_i2cdevice___probe_for_device(mp_obj_t self_in) { busdevice_i2cdevice_obj_t *self = self_in; common_hal_busdevice_i2cdevice___probe_for_device(self); - -/* common_hal_busdevice_i2cdevice_lock(self); - - - //uint8_t buffer; - mp_buffer_info_t bufinfo; - //mp_obj_t bufobj = MP_OBJ_FROM_PTR(&buffer) - mp_obj_t buffer = mp_obj_new_bytearray_of_zeros(1); - - mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_WRITE); - - uint8_t status = common_hal_busdevice_i2cdevice_readinto(self_in, (uint8_t*)bufinfo.buf, 1); - if (status != 0) { - common_hal_busdevice_i2cdevice_unlock(self_in); - mp_raise_ValueError_varg(translate("No I2C device at address: %x"), self->device_address); - } - - common_hal_busdevice_i2cdevice_unlock(self); -*/ return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_1(busdevice_i2cdevice___probe_for_device_obj, busdevice_i2cdevice___probe_for_device); diff --git a/shared-module/busdevice/I2CDevice.c b/shared-module/busdevice/I2CDevice.c index 516132c84ebeb..085c4171f35ad 100644 --- a/shared-module/busdevice/I2CDevice.c +++ b/shared-module/busdevice/I2CDevice.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2020 Mark Komus * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal From 5deb045a8112100de3cb28fdb7b6c56444663503 Mon Sep 17 00:00:00 2001 From: Gaetan Date: Mon, 26 Oct 2020 23:32:57 +0100 Subject: [PATCH 040/770] Ready to PR * ../../.github/workflows/build.yml + boards/holyiot_nrf52840/board.c + boards/holyiot_nrf52840/mpconfigboard.h + boards/holyiot_nrf52840/mpconfigboard.mk + boards/holyiot_nrf52840/pins.c --- .github/workflows/build.yml | 1 + ports/nrf/boards/holyiot_nrf52840/board.c | 38 ++++++++++++ .../boards/holyiot_nrf52840/mpconfigboard.h | 33 +++++++++++ .../boards/holyiot_nrf52840/mpconfigboard.mk | 8 +++ ports/nrf/boards/holyiot_nrf52840/pins.c | 59 +++++++++++++++++++ 5 files changed, 139 insertions(+) create mode 100644 ports/nrf/boards/holyiot_nrf52840/board.c create mode 100644 ports/nrf/boards/holyiot_nrf52840/mpconfigboard.h create mode 100644 ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk create mode 100644 ports/nrf/boards/holyiot_nrf52840/pins.c diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index feb6a7f633ebf..cada55aaa4c56 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -214,6 +214,7 @@ jobs: - "hallowing_m0_express" - "hallowing_m4_express" - "hiibot_bluefi" + - "holyiot_nrf52840" - "ikigaisense_vita" - "imxrt1010_evk" - "imxrt1020_evk" diff --git a/ports/nrf/boards/holyiot_nrf52840/board.c b/ports/nrf/boards/holyiot_nrf52840/board.c new file mode 100644 index 0000000000000..4421970eefe4d --- /dev/null +++ b/ports/nrf/boards/holyiot_nrf52840/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/holyiot_nrf52840/mpconfigboard.h b/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.h new file mode 100644 index 0000000000000..3b64d3a6299fa --- /dev/null +++ b/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.h @@ -0,0 +1,33 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Glenn Ruben Bakke + * + * + * 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 "Holyiot nRF52840" +#define MICROPY_HW_MCU_NAME "nRF52840" + +#define MICROPY_HW_LED_STATUS (&pin_P0_19) diff --git a/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk b/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk new file mode 100644 index 0000000000000..d85de75071188 --- /dev/null +++ b/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk @@ -0,0 +1,8 @@ +USB_VID = 0x239A +USB_PID = 0x80A0 +USB_PRODUCT = "HOLYIOTNRF52840" +USB_MANUFACTURER = "Holyiot" + +MCU_CHIP = nrf52840 + +INTERNAL_FLASH_FILESYSTEM = 1 \ No newline at end of file diff --git a/ports/nrf/boards/holyiot_nrf52840/pins.c b/ports/nrf/boards/holyiot_nrf52840/pins.c new file mode 100644 index 0000000000000..4e2593e58f970 --- /dev/null +++ b/ports/nrf/boards/holyiot_nrf52840/pins.c @@ -0,0 +1,59 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + + { MP_ROM_QSTR(MP_QSTR_P1_10), MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR_P1_11), MP_ROM_PTR(&pin_P1_11) }, + { MP_ROM_QSTR(MP_QSTR_P1_13), MP_ROM_PTR(&pin_P1_13) }, + { MP_ROM_QSTR(MP_QSTR_P1_15), MP_ROM_PTR(&pin_P1_15) }, + { MP_ROM_QSTR(MP_QSTR_P0_03), MP_ROM_PTR(&pin_P0_03) }, + { MP_ROM_QSTR(MP_QSTR_P0_02), MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR_P0_28), MP_ROM_PTR(&pin_P0_28) }, + { MP_ROM_QSTR(MP_QSTR_P0_29), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_P0_30), MP_ROM_PTR(&pin_P0_30) }, + { MP_ROM_QSTR(MP_QSTR_P0_31), MP_ROM_PTR(&pin_P0_31) }, + { MP_ROM_QSTR(MP_QSTR_P0_04), MP_ROM_PTR(&pin_P0_04) }, + { MP_ROM_QSTR(MP_QSTR_P0_05), MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR_P1_14), MP_ROM_PTR(&pin_P1_14) }, + { MP_ROM_QSTR(MP_QSTR_P1_12), MP_ROM_PTR(&pin_P1_12) }, + { MP_ROM_QSTR(MP_QSTR_P0_25), MP_ROM_PTR(&pin_P0_25) }, + { MP_ROM_QSTR(MP_QSTR_P0_11), MP_ROM_PTR(&pin_P0_11) }, + { MP_ROM_QSTR(MP_QSTR_P1_08), MP_ROM_PTR(&pin_P1_08) }, + { MP_ROM_QSTR(MP_QSTR_P0_27), MP_ROM_PTR(&pin_P0_28) }, + { MP_ROM_QSTR(MP_QSTR_P0_08), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_P0_06), MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_P0_26), MP_ROM_PTR(&pin_P0_26) }, + + { MP_ROM_QSTR(MP_QSTR_P0_10), MP_ROM_PTR(&pin_P0_10) }, + { MP_ROM_QSTR(MP_QSTR_P0_09), MP_ROM_PTR(&pin_P0_09) }, + { MP_ROM_QSTR(MP_QSTR_P1_06), MP_ROM_PTR(&pin_P1_06) }, + { MP_ROM_QSTR(MP_QSTR_P1_04), MP_ROM_PTR(&pin_P1_04) }, + { MP_ROM_QSTR(MP_QSTR_P1_02), MP_ROM_PTR(&pin_P1_02) }, + { MP_ROM_QSTR(MP_QSTR_P1_01), MP_ROM_PTR(&pin_P1_01) }, + { MP_ROM_QSTR(MP_QSTR_P1_03), MP_ROM_PTR(&pin_P1_03) }, + { MP_ROM_QSTR(MP_QSTR_P1_00), MP_ROM_PTR(&pin_P1_00) }, + { MP_ROM_QSTR(MP_QSTR_P0_22), MP_ROM_PTR(&pin_P0_22) }, + { MP_ROM_QSTR(MP_QSTR_P1_07), MP_ROM_PTR(&pin_P1_07) }, + { MP_ROM_QSTR(MP_QSTR_P1_05), MP_ROM_PTR(&pin_P1_05) }, + { MP_ROM_QSTR(MP_QSTR_P0_24), MP_ROM_PTR(&pin_P0_24) }, + { MP_ROM_QSTR(MP_QSTR_P0_20), MP_ROM_PTR(&pin_P0_20) }, + { MP_ROM_QSTR(MP_QSTR_P0_17), MP_ROM_PTR(&pin_P0_17) }, + { MP_ROM_QSTR(MP_QSTR_P0_15), MP_ROM_PTR(&pin_P0_15) }, + { MP_ROM_QSTR(MP_QSTR_P0_14), MP_ROM_PTR(&pin_P0_14) }, + { MP_ROM_QSTR(MP_QSTR_P0_13), MP_ROM_PTR(&pin_P0_13) }, + { MP_ROM_QSTR(MP_QSTR_P0_16), MP_ROM_PTR(&pin_P0_16) }, + + + { MP_ROM_QSTR(MP_QSTR_P0_07), MP_ROM_PTR(&pin_P0_07) }, + { MP_ROM_QSTR(MP_QSTR_P1_09), MP_ROM_PTR(&pin_P1_09) }, + { MP_ROM_QSTR(MP_QSTR_P0_12), MP_ROM_PTR(&pin_P0_12) }, + { MP_ROM_QSTR(MP_QSTR_P0_23), MP_ROM_PTR(&pin_P0_23) }, + { MP_ROM_QSTR(MP_QSTR_P0_21), MP_ROM_PTR(&pin_P0_21) }, + { MP_ROM_QSTR(MP_QSTR_P0_19), MP_ROM_PTR(&pin_P0_19) }, + + // RESET { MP_ROM_QSTR(MP_QSTR_P0_18), MP_ROM_PTR(&pin_P0_18) }, + +}; + + +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); \ No newline at end of file From cfaa02ef19c2370cfa8dc5d7fc27664f34d9c90c Mon Sep 17 00:00:00 2001 From: Gaetan Date: Mon, 26 Oct 2020 23:36:54 +0100 Subject: [PATCH 041/770] Fix error --- CONTRIBUTING.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c94e8db8c63f0..15b4cfc892222 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,8 +4,6 @@ SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://g SPDX-License-Identifier: MIT --> - - # Contributing Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). From fc591c8d847ad543ee2e8a368574783e2c230309 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 19 Oct 2020 18:30:26 -0700 Subject: [PATCH 042/770] Add EInk Portal --- .../adafruit_esp32s2_eink_portal/board.c | 47 +++++++++++++++++++ .../mpconfigboard.h | 45 ++++++++++++++++++ .../mpconfigboard.mk | 17 +++++++ .../adafruit_esp32s2_eink_portal/pins.c | 39 +++++++++++++++ .../adafruit_esp32s2_eink_portal/sdkconfig | 33 +++++++++++++ 5 files changed, 181 insertions(+) create mode 100644 ports/esp32s2/boards/adafruit_esp32s2_eink_portal/board.c create mode 100644 ports/esp32s2/boards/adafruit_esp32s2_eink_portal/mpconfigboard.h create mode 100644 ports/esp32s2/boards/adafruit_esp32s2_eink_portal/mpconfigboard.mk create mode 100644 ports/esp32s2/boards/adafruit_esp32s2_eink_portal/pins.c create mode 100644 ports/esp32s2/boards/adafruit_esp32s2_eink_portal/sdkconfig diff --git a/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/board.c b/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/board.c new file mode 100644 index 0000000000000..9f708874bfdf5 --- /dev/null +++ b/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/board.c @@ -0,0 +1,47 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "boards/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // USB + common_hal_never_reset_pin(&pin_GPIO19); + common_hal_never_reset_pin(&pin_GPIO20); + + // Debug UART + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} diff --git a/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/mpconfigboard.h b/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/mpconfigboard.h new file mode 100644 index 0000000000000..5a17a0cad15ef --- /dev/null +++ b/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/mpconfigboard.h @@ -0,0 +1,45 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 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. + */ + +//Micropython setup + +#define MICROPY_HW_BOARD_NAME "EInk Portal" +#define MICROPY_HW_MCU_NAME "ESP32S2" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO1) + +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) + +#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") + +#define AUTORESET_DELAY_MS 500 + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO34) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) diff --git a/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/mpconfigboard.mk b/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/mpconfigboard.mk new file mode 100644 index 0000000000000..31aff57da454a --- /dev/null +++ b/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/mpconfigboard.mk @@ -0,0 +1,17 @@ +USB_VID = 0x239A +USB_PID = 0x80E6 +USB_PRODUCT = "EInk Portal" +USB_MANUFACTURER = "Adafruit" + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = MPZ + +# The default queue depth of 16 overflows on release builds, +# so increase it to 32. +CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 + +CIRCUITPY_ESP_FLASH_MODE=dio +CIRCUITPY_ESP_FLASH_FREQ=40m +CIRCUITPY_ESP_FLASH_SIZE=4MB + +CIRCUITPY_MODULE=wrover diff --git a/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/pins.c b/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/pins.c new file mode 100644 index 0000000000000..2cf3d240292ad --- /dev/null +++ b/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/pins.c @@ -0,0 +1,39 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_AD1), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_SPEAKER), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_SPEAKER_ENABLE), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_EPD_BUSY), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_EPD_RESET), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_EPD_DC), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_EPD_CS), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON_A), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_B), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_C), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_D), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO34) }, + + { MP_ROM_QSTR(MP_QSTR_CS), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); diff --git a/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/sdkconfig b/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/sdkconfig new file mode 100644 index 0000000000000..9d8bbde967ded --- /dev/null +++ b/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/sdkconfig @@ -0,0 +1,33 @@ +CONFIG_ESP32S2_SPIRAM_SUPPORT=y + +# +# SPI RAM config +# +# CONFIG_SPIRAM_TYPE_AUTO is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM16=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=2097152 + +# +# PSRAM clock and cs IO for ESP32S2 +# +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM clock and cs IO for ESP32S2 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +# CONFIG_SPIRAM_SPEED_80M is not set +CONFIG_SPIRAM_SPEED_40M=y +# CONFIG_SPIRAM_SPEED_26M is not set +# CONFIG_SPIRAM_SPEED_20M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# end of SPI RAM config From 0d1649880f1c23ec6c9c0a4834f3712a8495f9d8 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 26 Oct 2020 16:58:00 -0700 Subject: [PATCH 043/770] Add grayscale EInk support --- shared-bindings/displayio/EPaperDisplay.c | 35 +++++++++++++++++++---- shared-bindings/displayio/EPaperDisplay.h | 2 +- shared-module/displayio/ColorConverter.c | 9 +++--- shared-module/displayio/EPaperDisplay.c | 15 ++++++---- shared-module/displayio/EPaperDisplay.h | 1 + shared-module/displayio/Palette.h | 1 + shared-module/displayio/display_core.c | 1 + 7 files changed, 48 insertions(+), 16 deletions(-) diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index 8be4ee4c4aba6..e0326d9c82c7f 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -49,7 +49,19 @@ //| Most people should not use this class directly. Use a specific display driver instead that will //| contain the startup and shutdown sequences at minimum.""" //| -//| def __init__(self, display_bus: _DisplayBus, start_sequence: ReadableBuffer, stop_sequence: ReadableBuffer, *, width: int, height: int, ram_width: int, ram_height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, set_column_window_command: Optional[int] = None, set_row_window_command: Optional[int] = None, single_byte_bounds: bool = False, write_black_ram_command: int, black_bits_inverted: bool = False, write_color_ram_command: Optional[int] = None, color_bits_inverted: bool = False, highlight_color: int = 0x000000, refresh_display_command: int, refresh_time: float = 40, busy_pin: Optional[microcontroller.Pin] = None, busy_state: bool = True, seconds_per_frame: float = 180, always_toggle_chip_select: bool = False) -> None: +//| def __init__(self, display_bus: _DisplayBus, +//| start_sequence: ReadableBuffer, stop_sequence: ReadableBuffer, *, +//| width: int, height: int, ram_width: int, ram_height: int, +//| colstart: int = 0, rowstart: int = 0, rotation: int = 0, +//| set_column_window_command: Optional[int] = None, +//| set_row_window_command: Optional[int] = None, single_byte_bounds: bool = False, +//| write_black_ram_command: int, black_bits_inverted: bool = False, +//| write_color_ram_command: Optional[int] = None, +//| color_bits_inverted: bool = False, highlight_color: int = 0x000000, +//| refresh_display_command: int, refresh_time: float = 40, +//| busy_pin: Optional[microcontroller.Pin] = None, busy_state: bool = True, +//| seconds_per_frame: float = 180, always_toggle_chip_select: bool = False, +//| grayscale: bool = False) -> None: //| """Create a EPaperDisplay object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`). //| //| The ``start_sequence`` and ``stop_sequence`` are bitpacked to minimize the ram impact. Every @@ -84,11 +96,18 @@ //| :param microcontroller.Pin busy_pin: Pin used to signify the display is busy //| :param bool busy_state: State of the busy pin when the display is busy //| :param float seconds_per_frame: Minimum number of seconds between screen refreshes -//| :param bool always_toggle_chip_select: When True, chip select is toggled every byte""" +//| :param bool always_toggle_chip_select: When True, chip select is toggled every byte +//| :param bool grayscale: When true, the color ram is the low bit of 2-bit grayscale""" //| ... //| STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_display_bus, ARG_start_sequence, ARG_stop_sequence, ARG_width, ARG_height, ARG_ram_width, ARG_ram_height, ARG_colstart, ARG_rowstart, ARG_rotation, ARG_set_column_window_command, ARG_set_row_window_command, ARG_set_current_column_command, ARG_set_current_row_command, ARG_write_black_ram_command, ARG_black_bits_inverted, ARG_write_color_ram_command, ARG_color_bits_inverted, ARG_highlight_color, ARG_refresh_display_command, ARG_refresh_time, ARG_busy_pin, ARG_busy_state, ARG_seconds_per_frame, ARG_always_toggle_chip_select }; + enum { ARG_display_bus, ARG_start_sequence, ARG_stop_sequence, ARG_width, ARG_height, + ARG_ram_width, ARG_ram_height, ARG_colstart, ARG_rowstart, ARG_rotation, + ARG_set_column_window_command, ARG_set_row_window_command, ARG_set_current_column_command, + ARG_set_current_row_command, ARG_write_black_ram_command, ARG_black_bits_inverted, + ARG_write_color_ram_command, ARG_color_bits_inverted, ARG_highlight_color, + ARG_refresh_display_command, ARG_refresh_time, ARG_busy_pin, ARG_busy_state, + ARG_seconds_per_frame, ARG_always_toggle_chip_select, ARG_grayscale }; static const mp_arg_t allowed_args[] = { { MP_QSTR_display_bus, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_start_sequence, MP_ARG_REQUIRED | MP_ARG_OBJ }, @@ -115,6 +134,7 @@ STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size { MP_QSTR_busy_state, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} }, { MP_QSTR_seconds_per_frame, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_OBJ_NEW_SMALL_INT(180)} }, { MP_QSTR_always_toggle_chip_select, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, + { MP_QSTR_grayscale, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); @@ -151,11 +171,14 @@ STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size self, display_bus, start_bufinfo.buf, start_bufinfo.len, stop_bufinfo.buf, stop_bufinfo.len, - args[ARG_width].u_int, args[ARG_height].u_int, args[ARG_ram_width].u_int, args[ARG_ram_height].u_int, args[ARG_colstart].u_int, args[ARG_rowstart].u_int, rotation, + args[ARG_width].u_int, args[ARG_height].u_int, args[ARG_ram_width].u_int, args[ARG_ram_height].u_int, + args[ARG_colstart].u_int, args[ARG_rowstart].u_int, rotation, args[ARG_set_column_window_command].u_int, args[ARG_set_row_window_command].u_int, args[ARG_set_current_column_command].u_int, args[ARG_set_current_row_command].u_int, - args[ARG_write_black_ram_command].u_int, args[ARG_black_bits_inverted].u_bool, write_color_ram_command, args[ARG_color_bits_inverted].u_bool, highlight_color, args[ARG_refresh_display_command].u_int, refresh_time, - busy_pin, args[ARG_busy_state].u_bool, seconds_per_frame, args[ARG_always_toggle_chip_select].u_bool + args[ARG_write_black_ram_command].u_int, args[ARG_black_bits_inverted].u_bool, write_color_ram_command, + args[ARG_color_bits_inverted].u_bool, highlight_color, args[ARG_refresh_display_command].u_int, refresh_time, + busy_pin, args[ARG_busy_state].u_bool, seconds_per_frame, + args[ARG_always_toggle_chip_select].u_bool, args[ARG_grayscale].u_bool ); return self; diff --git a/shared-bindings/displayio/EPaperDisplay.h b/shared-bindings/displayio/EPaperDisplay.h index e4b81c8838e08..352de899a9cc2 100644 --- a/shared-bindings/displayio/EPaperDisplay.h +++ b/shared-bindings/displayio/EPaperDisplay.h @@ -44,7 +44,7 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* uint16_t set_column_window_command, uint16_t set_row_window_command, uint16_t set_current_column_command, uint16_t set_current_row_command, uint16_t write_black_ram_command, bool black_bits_inverted, uint16_t write_color_ram_command, bool color_bits_inverted, uint32_t highlight_color, uint16_t refresh_display_command, mp_float_t refresh_time, - const mcu_pin_obj_t* busy_pin, bool busy_state, mp_float_t seconds_per_frame, bool always_toggle_chip_select); + const mcu_pin_obj_t* busy_pin, bool busy_state, mp_float_t seconds_per_frame, bool always_toggle_chip_select, bool grayscale); bool common_hal_displayio_epaperdisplay_refresh(displayio_epaperdisplay_obj_t* self); diff --git a/shared-module/displayio/ColorConverter.c b/shared-module/displayio/ColorConverter.c index dc64da03dac84..03ec99ceb1833 100644 --- a/shared-module/displayio/ColorConverter.c +++ b/shared-module/displayio/ColorConverter.c @@ -165,9 +165,9 @@ void displayio_colorconverter_convert(displayio_colorconverter_t *self, const _d g8 = MIN(255,g8 + (randg&0x03)); } else { int bitmask = 0xFF >> colorspace->depth; - b8 = MIN(255,b8 + (randb&bitmask)); - r8 = MIN(255,r8 + (randr&bitmask)); - g8 = MIN(255,g8 + (randg&bitmask)); + b8 = MIN(255,b8 + (randb & bitmask)); + r8 = MIN(255,r8 + (randr & bitmask)); + g8 = MIN(255,g8 + (randg & bitmask)); } pixel = r8 << 16 | g8 << 8 | b8; } @@ -196,7 +196,8 @@ void displayio_colorconverter_convert(displayio_colorconverter_t *self, const _d return; } else if (colorspace->grayscale && colorspace->depth <= 8) { uint8_t luma = displayio_colorconverter_compute_luma(pixel); - output_color->pixel = luma >> (8 - colorspace->depth); + size_t bitmask = (1 << colorspace->depth) - 1; + output_color->pixel = (luma >> colorspace->grayscale_bit) & bitmask; output_color->opaque = true; return; } diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index 46c7ea82e1b28..514b99a13bdcd 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -49,7 +49,7 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* uint16_t set_column_window_command, uint16_t set_row_window_command, uint16_t set_current_column_command, uint16_t set_current_row_command, uint16_t write_black_ram_command, bool black_bits_inverted, uint16_t write_color_ram_command, bool color_bits_inverted, uint32_t highlight_color, uint16_t refresh_display_command, mp_float_t refresh_time, - const mcu_pin_obj_t* busy_pin, bool busy_state, mp_float_t seconds_per_frame, bool chip_select) { + const mcu_pin_obj_t* busy_pin, bool busy_state, mp_float_t seconds_per_frame, bool chip_select, bool grayscale) { if (highlight_color != 0x000000) { self->core.colorspace.tricolor = true; self->core.colorspace.tricolor_hue = displayio_colorconverter_compute_hue(highlight_color); @@ -72,6 +72,7 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* self->refreshing = false; self->milliseconds_per_frame = seconds_per_frame * 1000; self->chip_select = chip_select ? CHIP_SELECT_TOGGLE_EVERY_BYTE : CHIP_SELECT_UNTOUCHED; + self->grayscale = grayscale; self->start_sequence = start_sequence; self->start_sequence_len = start_sequence_len; @@ -230,17 +231,16 @@ bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t* self, c uint32_t mask[mask_length]; uint8_t passes = 1; - if (self->core.colorspace.tricolor) { + if (self->core.colorspace.tricolor || self->grayscale) { passes = 2; } for (uint8_t pass = 0; pass < passes; pass++) { uint16_t remaining_rows = displayio_area_height(&clipped); - // added false parameter at end for SH1107_addressing quirk if (self->set_row_window_command != NO_COMMAND) { displayio_display_core_set_region_to_update(&self->core, self->set_column_window_command, self->set_row_window_command, self->set_current_column_command, self->set_current_row_command, - false, self->chip_select, &clipped, false); + false, self->chip_select, &clipped, false /* SH1107_addressing */); } uint8_t write_command = self->write_black_ram_command; @@ -270,8 +270,13 @@ bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t* self, c memset(buffer, 0, buffer_size * sizeof(buffer[0])); self->core.colorspace.grayscale = true; + self->core.colorspace.grayscale_bit = 7; if (pass == 1) { - self->core.colorspace.grayscale = false; + if (self->grayscale) { // 4-color grayscale + self->core.colorspace.grayscale_bit = 6; + } else { // Tri-color + self->core.colorspace.grayscale = false; + } } displayio_display_core_fill_area(&self->core, &subrectangle, mask, buffer); diff --git a/shared-module/displayio/EPaperDisplay.h b/shared-module/displayio/EPaperDisplay.h index 3b9f6e368097b..4103fe5fce3db 100644 --- a/shared-module/displayio/EPaperDisplay.h +++ b/shared-module/displayio/EPaperDisplay.h @@ -55,6 +55,7 @@ typedef struct { bool black_bits_inverted; bool color_bits_inverted; bool refreshing; + bool grayscale; display_chip_select_behavior_t chip_select; } displayio_epaperdisplay_obj_t; diff --git a/shared-module/displayio/Palette.h b/shared-module/displayio/Palette.h index da72f250f98ec..993912cc518dc 100644 --- a/shared-module/displayio/Palette.h +++ b/shared-module/displayio/Palette.h @@ -37,6 +37,7 @@ typedef struct { uint8_t bytes_per_cell; uint8_t tricolor_hue; uint8_t tricolor_luma; + uint8_t grayscale_bit; // The lowest grayscale bit. Normally 8 - depth. bool grayscale; bool tricolor; bool pixels_in_byte_share_row; diff --git a/shared-module/displayio/display_core.c b/shared-module/displayio/display_core.c index 411f9f3736558..57d33b5651a03 100644 --- a/shared-module/displayio/display_core.c +++ b/shared-module/displayio/display_core.c @@ -48,6 +48,7 @@ void displayio_display_core_construct(displayio_display_core_t* self, uint16_t color_depth, bool grayscale, bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte, bool reverse_bytes_in_word) { self->colorspace.depth = color_depth; self->colorspace.grayscale = grayscale; + self->colorspace.grayscale_bit = 8 - color_depth; self->colorspace.pixels_in_byte_share_row = pixels_in_byte_share_row; self->colorspace.bytes_per_cell = bytes_per_cell; self->colorspace.reverse_pixels_in_byte = reverse_pixels_in_byte; From 95cb5961d26a4e1e048d48266d21547dc9229ba9 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 26 Oct 2020 16:58:56 -0700 Subject: [PATCH 044/770] Fix ESP32-S2 SPI when DMA is sometimes used --- ports/esp32s2/common-hal/busio/SPI.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/esp32s2/common-hal/busio/SPI.c b/ports/esp32s2/common-hal/busio/SPI.c index 1906ca6f00b3e..490419f34a9f3 100644 --- a/ports/esp32s2/common-hal/busio/SPI.c +++ b/ports/esp32s2/common-hal/busio/SPI.c @@ -357,6 +357,9 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_ou } else { hal->dma_enabled = 0; burst_length = sizeof(hal->hw->data_buf); + // When switching to non-DMA, we need to make sure DMA is off. Otherwise, + // the S2 will transmit zeroes instead of our data. + spi_ll_txdma_disable(hal->hw); } // This rounds up. From d86c6a74a48adc1e559845acd9821d4ad6f63590 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 26 Oct 2020 17:06:04 -0700 Subject: [PATCH 045/770] Add to CI build --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fa576bbf0ac98..95bd2bfa4719b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -418,6 +418,7 @@ jobs: fail-fast: false matrix: board: + - "adafruit_esp32s2_eink_portal" - "adafruit_metro_esp32s2" - "electroniccats_bastwifi" - "espressif_kaluga_1" From 2ba66599670c0d3d0f5ef5dc8780c34cf9d61231 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 26 Oct 2020 19:07:37 -0500 Subject: [PATCH 046/770] esp32s2: Makefile: restore --no-stub --- ports/esp32s2/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 5d8ccad50de38..8d891edd02482 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -331,10 +331,10 @@ $(BUILD)/firmware.uf2: $(BUILD)/circuitpython-firmware.bin $(Q)$(PYTHON3) $(TOP)/tools/uf2/utils/uf2conv.py -f 0xbfdd4eee -b 0x0000 -c -o $@ $^ flash: $(BUILD)/firmware.bin - esptool.py --chip esp32s2 -p $(PORT) -b 460800 --before=default_reset --after=hard_reset write_flash $(FLASH_FLAGS) 0x0000 $^ + esptool.py --chip esp32s2 -p $(PORT) --no-stub -b 460800 --before=default_reset --after=hard_reset write_flash $(FLASH_FLAGS) 0x0000 $^ flash-circuitpython-only: $(BUILD)/circuitpython-firmware.bin - esptool.py --chip esp32s2 -p $(PORT) -b 460800 --before=default_reset --after=hard_reset write_flash $(FLASH_FLAGS) 0x10000 $^ + esptool.py --chip esp32s2 -p $(PORT) --no-stub -b 460800 --before=default_reset --after=hard_reset write_flash $(FLASH_FLAGS) 0x10000 $^ include $(TOP)/py/mkrules.mk From 3a501a04951849ddd83455706fe87a6950d051fe Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 26 Oct 2020 19:18:37 -0500 Subject: [PATCH 047/770] esp32s2: canio: respond to review comments * explain the introduction of the temporary variable in get_t_config * get rid of unneeded __attribute__ * get rid of unneeded members of canio_can_obj_t * get rid of unneeded header inclusion --- ports/esp32s2/common-hal/canio/CAN.c | 14 ++++++-------- ports/esp32s2/common-hal/canio/CAN.h | 3 --- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/ports/esp32s2/common-hal/canio/CAN.c b/ports/esp32s2/common-hal/canio/CAN.c index f1741969db37e..768fde2431dc2 100644 --- a/ports/esp32s2/common-hal/canio/CAN.c +++ b/ports/esp32s2/common-hal/canio/CAN.c @@ -33,7 +33,6 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/util.h" #include "supervisor/port.h" -#include "hal/twai_ll.h" #include "hal/twai_types.h" @@ -43,6 +42,10 @@ twai_timing_config_t get_t_config(int baudrate) { switch(baudrate) { case 1000000: { + // TWAI_TIMING_CONFIG_abc expands to a C designated initializer list + // { .brp = 4, ...}. This is only acceptable to the compiler as an + // initializer and 'return TWAI_TIMING_CONFIG_1MBITS()` is not valid. + // Instead, introduce a temporary, named variable and return it. twai_timing_config_t t_config = TWAI_TIMING_CONFIG_1MBITS(); return t_config; } @@ -116,7 +119,6 @@ twai_timing_config_t get_t_config(int baudrate) { } } -__attribute__((optimize("O0"))) void common_hal_canio_can_construct(canio_can_obj_t *self, mcu_pin_obj_t *tx, mcu_pin_obj_t *rx, int baudrate, bool loopback, bool silent) { #define DIV_ROUND(a, b) (((a) + (b)/2) / (b)) @@ -129,7 +131,7 @@ void common_hal_canio_can_construct(canio_can_obj_t *self, mcu_pin_obj_t *tx, mc mp_raise_ValueError(translate("loopback + silent mode not supported by peripheral")); } - self->t_config = get_t_config(baudrate);; + twai_timing_config_t t_config = get_t_config(baudrate); twai_general_config_t g_config = TWAI_GENERAL_CONFIG_DEFAULT(-1, -1, TWAI_MODE_NORMAL); g_config.tx_io = tx->number; g_config.rx_io = rx->number; @@ -139,14 +141,10 @@ void common_hal_canio_can_construct(canio_can_obj_t *self, mcu_pin_obj_t *tx, mc if (silent) { g_config.mode = TWAI_MODE_LISTEN_ONLY; } - self->g_config = g_config; - { twai_filter_config_t f_config = TWAI_FILTER_CONFIG_ACCEPT_ALL(); - self->f_config = f_config; - } - esp_err_t result = twai_driver_install(&self->g_config, &self->t_config, &self->f_config); + esp_err_t result = twai_driver_install(&g_config, &t_config, &f_config); if (result == ESP_ERR_NO_MEM) { mp_raise_msg(&mp_type_MemoryError, translate("ESP-IDF memory allocation failed")); } else if (result == ESP_ERR_INVALID_ARG) { diff --git a/ports/esp32s2/common-hal/canio/CAN.h b/ports/esp32s2/common-hal/canio/CAN.h index e15d515908529..85fb6972bea8f 100644 --- a/ports/esp32s2/common-hal/canio/CAN.h +++ b/ports/esp32s2/common-hal/canio/CAN.h @@ -46,7 +46,4 @@ typedef struct canio_can_obj { bool silent:1; bool auto_restart:1; bool fifo_in_use:1; - twai_filter_config_t f_config; - twai_general_config_t g_config; - twai_timing_config_t t_config; } canio_can_obj_t; From 9ec224539b7c0fb4f2badf0a416e26b7c3e94854 Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Tue, 27 Oct 2020 08:43:51 -0500 Subject: [PATCH 048/770] Clean up --- shared-bindings/busdevice/I2CDevice.c | 2 +- shared-bindings/busdevice/I2CDevice.h | 3 +-- shared-bindings/busdevice/__init__.c | 33 ++++----------------------- 3 files changed, 7 insertions(+), 31 deletions(-) diff --git a/shared-bindings/busdevice/I2CDevice.c b/shared-bindings/busdevice/I2CDevice.c index d8db9362f1b41..d21ac8c6eb741 100644 --- a/shared-bindings/busdevice/I2CDevice.c +++ b/shared-bindings/busdevice/I2CDevice.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Scott Shawcroft + * Copyright (c) 2020 Mark Komus * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/shared-bindings/busdevice/I2CDevice.h b/shared-bindings/busdevice/I2CDevice.h index 795905b32de95..146013cb7620c 100644 --- a/shared-bindings/busdevice/I2CDevice.h +++ b/shared-bindings/busdevice/I2CDevice.h @@ -36,9 +36,8 @@ #include "py/obj.h" -#include "common-hal/microcontroller/Pin.h" #include "shared-module/busdevice/I2CDevice.h" -#include "shared-bindings/busio/I2C.h" +//#include "shared-bindings/busio/I2C.h" // Type object used in Python. Should be shared between ports. extern const mp_obj_type_t busdevice_i2cdevice_type; diff --git a/shared-bindings/busdevice/__init__.c b/shared-bindings/busdevice/__init__.c index 6b24160a02517..91f250c6a567b 100644 --- a/shared-bindings/busdevice/__init__.c +++ b/shared-bindings/busdevice/__init__.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2020 Mark Komus * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -37,33 +37,10 @@ //| """Hardware accelerated external bus access //| -//| The `busio` module contains classes to support a variety of serial -//| protocols. -//| -//| When the microcontroller does not support the behavior in a hardware -//| accelerated fashion it may internally use a bitbang routine. However, if -//| hardware support is available on a subset of pins but not those provided, -//| then a RuntimeError will be raised. Use the `bitbangio` module to explicitly -//| bitbang a serial protocol on any general purpose pins. -//| -//| All classes change hardware state and should be deinitialized when they -//| are no longer needed if the program continues after use. To do so, either -//| call :py:meth:`!deinit` or use a context manager. See -//| :ref:`lifetime-and-contextmanagers` for more info. -//| -//| For example:: -//| -//| import busio -//| from board import * -//| -//| i2c = busio.I2C(SCL, SDA) -//| print(i2c.scan()) -//| i2c.deinit() -//| -//| This example will initialize the the device, run -//| :py:meth:`~busio.I2C.scan` and then :py:meth:`~busio.I2C.deinit` the -//| hardware. The last step is optional because CircuitPython automatically -//| resets hardware after a program finishes.""" +//| The I2CDevice and SPIDevice helper classes make managing transaction state on a bus easy. +//| For example, they manage locking the bus to prevent other concurrent access. For SPI +//| devices, it manages the chip select and protocol changes such as mode. For I2C, it +//| manages the device address. //| STATIC const mp_rom_map_elem_t busdevice_module_globals_table[] = { From 2374b0d013e60b543164f208315ed9f52895dac2 Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Tue, 27 Oct 2020 09:13:14 -0500 Subject: [PATCH 049/770] Fixed whitespace issues --- shared-bindings/busdevice/I2CDevice.c | 16 ++++++++-------- shared-bindings/busdevice/__init__.c | 2 +- shared-module/busdevice/I2CDevice.c | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/shared-bindings/busdevice/I2CDevice.c b/shared-bindings/busdevice/I2CDevice.c index d21ac8c6eb741..1f3da465238f5 100644 --- a/shared-bindings/busdevice/I2CDevice.c +++ b/shared-bindings/busdevice/I2CDevice.c @@ -61,7 +61,7 @@ //| with device: //| device.write(bytes_read)""" //| ... -//| +//| STATIC mp_obj_t busdevice_i2cdevice_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { busdevice_i2cdevice_obj_t *self = m_new_obj(busdevice_i2cdevice_obj_t); self->base.type = &busdevice_i2cdevice_type; @@ -107,7 +107,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busdevice_i2cdevice___exit___obj, 4, //| :param int start: Index to start writing at //| :param int end: Index to write up to but not include; if None, use ``len(buf)``""" //| ... -//| +//| STATIC void readinto(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, int32_t start, mp_int_t end) { mp_buffer_info_t bufinfo; mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_WRITE); @@ -131,7 +131,7 @@ STATIC mp_obj_t busdevice_i2cdevice_readinto(size_t n_args, const mp_obj_t *pos_ { MP_QSTR_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, { MP_QSTR_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, }; - + busdevice_i2cdevice_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; @@ -179,7 +179,7 @@ STATIC mp_obj_t busdevice_i2cdevice_write(size_t n_args, const mp_obj_t *pos_arg { MP_QSTR_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, }; busdevice_i2cdevice_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); - + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); @@ -210,7 +210,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(busdevice_i2cdevice_write_obj, 2, busdevice_i2cdevice //| :param int in_end: Index to write up to but not include; if None, use ``len(in_buffer)`` //| """ //| ... -//| +//| STATIC mp_obj_t busdevice_i2cdevice_write_then_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_out_buffer, ARG_in_buffer, ARG_out_start, ARG_out_end, ARG_in_start, ARG_in_end }; static const mp_arg_t allowed_args[] = { @@ -227,7 +227,7 @@ STATIC mp_obj_t busdevice_i2cdevice_write_then_readinto(size_t n_args, const mp_ mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); write(self, args[ARG_out_buffer].u_obj, args[ARG_out_start].u_int, args[ARG_out_end].u_int); - + readinto(self, args[ARG_in_buffer].u_obj, args[ARG_in_start].u_int, args[ARG_in_end].u_int); return mp_const_none; @@ -241,7 +241,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(busdevice_i2cdevice_write_then_readinto_obj, 3, busde //| or that the device does not support these means of probing //| """ //| ... -//| +//| STATIC mp_obj_t busdevice_i2cdevice___probe_for_device(mp_obj_t self_in) { busdevice_i2cdevice_obj_t *self = self_in; common_hal_busdevice_i2cdevice___probe_for_device(self); @@ -266,4 +266,4 @@ const mp_obj_type_t busdevice_i2cdevice_type = { .name = MP_QSTR_I2CDevice, .make_new = busdevice_i2cdevice_make_new, .locals_dict = (mp_obj_dict_t*)&busdevice_i2cdevice_locals_dict, -}; \ No newline at end of file +}; diff --git a/shared-bindings/busdevice/__init__.c b/shared-bindings/busdevice/__init__.c index 91f250c6a567b..112dabb7eb2f1 100644 --- a/shared-bindings/busdevice/__init__.c +++ b/shared-bindings/busdevice/__init__.c @@ -37,7 +37,7 @@ //| """Hardware accelerated external bus access //| -//| The I2CDevice and SPIDevice helper classes make managing transaction state on a bus easy. +//| The I2CDevice and SPIDevice helper classes make managing transaction state on a bus easy. //| For example, they manage locking the bus to prevent other concurrent access. For SPI //| devices, it manages the chip select and protocol changes such as mode. For I2C, it //| manages the device address. diff --git a/shared-module/busdevice/I2CDevice.c b/shared-module/busdevice/I2CDevice.c index 085c4171f35ad..91013d52c71ae 100644 --- a/shared-module/busdevice/I2CDevice.c +++ b/shared-module/busdevice/I2CDevice.c @@ -83,6 +83,6 @@ void common_hal_busdevice_i2cdevice___probe_for_device(busdevice_i2cdevice_obj_t common_hal_busdevice_i2cdevice_unlock(self); mp_raise_ValueError_varg(translate("No I2C device at address: %x"), self->device_address); } - + common_hal_busdevice_i2cdevice_unlock(self); -} \ No newline at end of file +} From ba0a3769e343b465c82dde4aafe99bcf11c84dbe Mon Sep 17 00:00:00 2001 From: _fonzlate Date: Mon, 26 Oct 2020 17:08:51 +0000 Subject: [PATCH 050/770] Translated using Weblate (Dutch) Currently translated at 100.0% (836 of 836 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/nl/ --- locale/nl.po | 122 ++++++++++++++++++++++++++------------------------- 1 file changed, 63 insertions(+), 59 deletions(-) diff --git a/locale/nl.po b/locale/nl.po index ca7530c0fdef8..59b1f2e73b651 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -6,15 +6,15 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-10-16 19:50-0500\n" -"PO-Revision-Date: 2020-09-09 16:05+0000\n" -"Last-Translator: Jelle Jager \n" +"PO-Revision-Date: 2020-10-27 16:47+0000\n" +"Last-Translator: _fonzlate \n" "Language-Team: none\n" "Language: nl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.3-dev\n" +"X-Generator: Weblate 4.3.2-dev\n" #: main.c msgid "" @@ -98,7 +98,7 @@ msgstr "%q moet een tuple van lengte 2 zijn" #: shared-bindings/canio/Match.c msgid "%q out of range" -msgstr "" +msgstr "%q buiten bereik" #: ports/atmel-samd/common-hal/microcontroller/Pin.c msgid "%q pin invalid" @@ -252,7 +252,7 @@ msgstr "'return' buiten de functie" #: py/compile.c msgid "'yield from' inside async function" -msgstr "" +msgstr "'yield from' binnen asynchrone functie" #: py/compile.c msgid "'yield' outside function" @@ -281,7 +281,7 @@ msgstr "Een hardware interrupt kanaal is al in gebruik" #: ports/esp32s2/common-hal/analogio/AnalogIn.c msgid "ADC2 is being used by WiFi" -msgstr "" +msgstr "ADC2 wordt gebruikt door WiFi" #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format @@ -299,7 +299,7 @@ msgstr "Alle I2C peripherals zijn in gebruik" #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "All RX FIFOs in use" -msgstr "" +msgstr "Alle RX FIFO's zijn in gebruik" #: ports/esp32s2/common-hal/busio/SPI.c ports/nrf/common-hal/busio/SPI.c msgid "All SPI peripherals are in use" @@ -342,7 +342,7 @@ msgstr "Advertising is al bezig." #: ports/atmel-samd/common-hal/canio/Listener.c msgid "Already have all-matches listener" -msgstr "" +msgstr "Heeft al een luisteraar voor 'all-matches'" #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c @@ -351,7 +351,7 @@ msgstr "Wordt al uitgevoerd" #: ports/esp32s2/common-hal/wifi/Radio.c msgid "Already scanning for wifi networks" -msgstr "" +msgstr "Zoekt al naar WiFi netwerken" #: ports/cxd56/common-hal/analogio/AnalogIn.c msgid "AnalogIn not supported on given pin" @@ -399,7 +399,7 @@ msgstr "heap allocatie geprobeerd terwijl MicroPython VM niet draait." #: shared-bindings/wifi/Radio.c msgid "Authentication failure" -msgstr "" +msgstr "Authenticatiefout" #: main.c msgid "Auto-reload is off.\n" @@ -617,7 +617,7 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "CircuitPython was unable to allocate the heap.\n" -msgstr "" +msgstr "CircuitPython kon het heap geheugen niet toewijzen.\n" #: shared-module/bitbangio/SPI.c msgid "Clock pin init failed." @@ -658,7 +658,7 @@ msgstr "Corrupt raw code" #: ports/cxd56/common-hal/camera/Camera.c msgid "Could not initialize Camera" -msgstr "" +msgstr "Kon camera niet initialiseren" #: ports/cxd56/common-hal/gnss/GNSS.c msgid "Could not initialize GNSS" @@ -695,7 +695,7 @@ msgstr "Kan PWM niet herstarten" #: ports/esp32s2/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" -msgstr "" +msgstr "Kon klok niet ophalen" #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" @@ -789,7 +789,7 @@ msgstr "ECB werkt alleen met 16 bytes tegelijkertijd" #: ports/esp32s2/common-hal/busio/SPI.c msgid "ESP-IDF memory allocation failed" -msgstr "" +msgstr "ESP-IDF geheugen toewijzing mislukt" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c #: ports/atmel-samd/common-hal/ps2io/Ps2.c @@ -850,7 +850,7 @@ msgstr "FFT alleen voor ndarrays gedefineerd" #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" -msgstr "" +msgstr "SSL handdruk mislukt" #: shared-bindings/ps2io/Ps2.c msgid "Failed sending command." @@ -877,11 +877,11 @@ msgstr "Mislukt een RX buffer van %d bytes te alloceren" #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Failed to allocate Wifi memory" -msgstr "" +msgstr "Kon WiFi geheugen niet toewijzen" #: ports/esp32s2/common-hal/wifi/ScannedNetworks.c msgid "Failed to allocate wifi scan memory" -msgstr "" +msgstr "Kon WiFi scan geheugen niet toewijzen" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to connect: internal error" @@ -893,7 +893,7 @@ msgstr "Verbinding mislukt: timeout" #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Failed to init wifi" -msgstr "" +msgstr "Kon WiFi niet initialiseren" #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" @@ -915,11 +915,11 @@ msgstr "Bestand bestaat" #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "Filters too complex" -msgstr "" +msgstr "Filters zijn te complex" #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" -msgstr "" +msgstr "Formaat wordt niet ondersteund" #: shared-module/framebufferio/FramebufferDisplay.c #, c-format @@ -963,7 +963,7 @@ msgstr "Hardware in gebruik, probeer alternatieve pinnen" #: shared-bindings/wifi/Radio.c msgid "Hostname must be between 1 and 253 characters" -msgstr "" +msgstr "Hostnaam moet tussen 1 en 253 karakters zijn" #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" @@ -996,7 +996,7 @@ msgstr "Incorrecte buffer grootte" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" -msgstr "" +msgstr "Invoer duurt te lang" #: ports/esp32s2/common-hal/neopixel_write/__init__.c py/moduerrno.c msgid "Input/output error" @@ -1044,7 +1044,7 @@ msgstr "Ongeldig BMP bestand" #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" -msgstr "" +msgstr "Ongeldig BSSID" #: ports/esp32s2/common-hal/analogio/AnalogOut.c #: ports/stm/common-hal/analogio/AnalogOut.c @@ -1095,7 +1095,7 @@ msgstr "Ongeldig formaat stuk grootte" #: ports/esp32s2/common-hal/pwmio/PWMOut.c msgid "Invalid frequency" -msgstr "" +msgstr "Onjuiste frequentie" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Invalid frequency supplied" @@ -1218,7 +1218,7 @@ msgstr "Maximale x waarde indien gespiegeld is %d" #: shared-bindings/canio/Message.c msgid "Messages limited to 8 bytes" -msgstr "" +msgstr "Berichten zijn beperkt tot 8 bytes" #: supervisor/shared/safe_mode.c msgid "MicroPython NLR jump failed. Likely memory corruption." @@ -1330,11 +1330,11 @@ msgstr "Geen lange integer ondersteuning" #: ports/esp32s2/common-hal/pwmio/PWMOut.c msgid "No more channels available" -msgstr "" +msgstr "Geen kanalen meer beschikbaar" #: ports/esp32s2/common-hal/pwmio/PWMOut.c msgid "No more timers available" -msgstr "" +msgstr "Geen timers meer beschikbaar" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "No more timers available on this pin." @@ -1342,7 +1342,7 @@ msgstr "Geen timers meer beschikbaar op deze pin." #: shared-bindings/wifi/Radio.c msgid "No network with that ssid" -msgstr "" +msgstr "Geen netwerk met dat SSID gevonden" #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" @@ -1366,7 +1366,7 @@ msgstr "Nordic Soft Device assertion mislukt." #: shared-bindings/ipaddress/IPv4Address.c shared-bindings/ipaddress/__init__.c msgid "Not a valid IP string" -msgstr "" +msgstr "Geen geldige IP string" #: ports/nrf/common-hal/_bleio/__init__.c #: shared-bindings/_bleio/CharacteristicBuffer.c @@ -1384,7 +1384,7 @@ msgstr "Opgeslagen code wordt niet uitgevoerd.\n" #: shared-bindings/_bleio/__init__.c msgid "Not settable" -msgstr "" +msgstr "Niet instelbaar" #: shared-bindings/util.c msgid "" @@ -1403,11 +1403,11 @@ msgstr "Alleen 8 of 16 bit mono met " #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Only IPv4 SOCK_STREAM sockets supported" -msgstr "" +msgstr "Alleen IPv4 SOCK_STREAM sockets worden ondersteund" #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" -msgstr "" +msgstr "Alleen IPv4 adressen worden ondersteund" #: shared-module/displayio/OnDiskBitmap.c #, c-format @@ -1428,15 +1428,15 @@ msgstr "" #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" -msgstr "" +msgstr "Er kan maar één kleur per keer transparant zijn" #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" -msgstr "" +msgstr "Alleen raw int ondersteund voor IP" #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" -msgstr "" +msgstr "Geen sockets meer beschikbaar" #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." @@ -1510,6 +1510,8 @@ msgid "" "Port does not accept PWM carrier. Pass a pin, frequency and duty cycle " "instead" msgstr "" +"Poort ondersteund geen PWM drager. Geef een pin, frequentie en inschakeltijd " +"op" #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c @@ -1519,6 +1521,8 @@ msgid "" "Port does not accept pins or frequency. Construct and pass a PWMOut Carrier " "instead" msgstr "" +"Poort accepteert geen pin of frequentie. Stel een PWMOut Carrier samen en " +"geef die op" #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" @@ -1584,7 +1588,7 @@ msgstr "Verversing te snel" #: shared-bindings/canio/RemoteTransmissionRequest.c msgid "RemoteTransmissionRequests limited to 8 bytes" -msgstr "" +msgstr "RemoteTransmissionRequests is beperkt tot 8 bytes" #: shared-bindings/aesio/aes.c msgid "Requested AES mode is unsupported" @@ -1657,11 +1661,11 @@ msgstr "Serializer in gebruik" #: shared-bindings/ssl/SSLContext.c msgid "Server side context cannot have hostname" -msgstr "" +msgstr "Context aan de serverkant kan geen hostnaam hebben" #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" -msgstr "" +msgstr "Afmeting niet ondersteund" #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." @@ -1676,7 +1680,7 @@ msgstr "Slices niet ondersteund" #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" -msgstr "" +msgstr "SocketPool kan alleen met wifi.radio gebruikt worden" #: shared-bindings/aesio/aes.c msgid "Source and destination buffers must be the same length" @@ -1724,7 +1728,7 @@ msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" -msgstr "" +msgstr "De lengte van rgb_pins moet 6, 12, 18, 24 of 30 zijn" #: supervisor/shared/safe_mode.c msgid "" @@ -1783,7 +1787,7 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "To exit, please reset the board without " -msgstr "" +msgstr "Om te beëindigen, reset het bord zonder " #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." @@ -1856,7 +1860,7 @@ msgstr "Niet in staat buffers voor gesigneerde conversie te alloceren" #: ports/esp32s2/common-hal/busio/I2C.c msgid "Unable to create lock" -msgstr "" +msgstr "Kan vergrendeling niet maken" #: shared-module/displayio/I2CDisplay.c #, c-format @@ -1887,11 +1891,11 @@ msgstr "Onverwacht mrfx uuid type" #: ports/esp32s2/common-hal/socketpool/Socket.c #, c-format msgid "Unhandled ESP TLS error %d %d %x %d" -msgstr "" +msgstr "Niet behandelde ESP TLS fout %d %d %x %d" #: shared-bindings/wifi/Radio.c msgid "Unknown failure" -msgstr "" +msgstr "Onbekende fout" #: ports/nrf/common-hal/_bleio/__init__.c #, c-format @@ -2009,7 +2013,7 @@ msgstr "" #: shared-bindings/wifi/Radio.c msgid "WiFi password must be between 8 and 63 characters" -msgstr "" +msgstr "WiFi wachtwoord moet tussen 8 en 63 karakters bevatten" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" @@ -2164,7 +2168,7 @@ msgstr "buffer te klein" #: shared-bindings/socketpool/Socket.c msgid "buffer too small for requested bytes" -msgstr "" +msgstr "buffer te klein voor gevraagde bytes" #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" @@ -2185,7 +2189,7 @@ msgstr "butes > 8 niet ondersteund" #: py/objarray.c msgid "bytes length not a multiple of item size" -msgstr "" +msgstr "bytes lengte is geen veelvoud van itemgrootte" #: py/objstr.c msgid "bytes value out of range" @@ -2503,11 +2507,11 @@ msgstr "uitzonderingen moeten afleiden van BaseException" #: shared-bindings/canio/CAN.c msgid "expected '%q' but got '%q'" -msgstr "" +msgstr "verwachtte '%q' maar ontving '%q'" #: shared-bindings/canio/CAN.c msgid "expected '%q' or '%q' but got '%q'" -msgstr "" +msgstr "verwachtte '%q' of '%q' maar ontving '%q'" #: py/objstr.c msgid "expected ':' after format specifier" @@ -2721,7 +2725,7 @@ msgstr "oorspronkelijke waarden moeten itereerbaar zijn" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c msgid "initial_value length is wrong" -msgstr "" +msgstr "lengte van initial_value is onjuist" #: py/compile.c msgid "inline assembler must be a function" @@ -2798,7 +2802,7 @@ msgstr "ongeldige formaatspecificatie" #: shared-bindings/wifi/Radio.c msgid "invalid hostname" -msgstr "" +msgstr "onjuiste hostnaam" #: extmod/modussl_axtls.c msgid "invalid key" @@ -3162,11 +3166,11 @@ msgstr "ord() verwacht een teken (char) maar vond een string van lengte %d" #: shared-bindings/displayio/Bitmap.c msgid "out of range of source" -msgstr "" +msgstr "buiten bereik van bron" #: shared-bindings/displayio/Bitmap.c msgid "out of range of target" -msgstr "" +msgstr "buiten bereik van doel" #: py/objint_mpz.c msgid "overflow converting long int to machine word" @@ -3175,7 +3179,7 @@ msgstr "overloop bij converteren van long int naar machine word" #: py/modstruct.c #, c-format msgid "pack expected %d items for packing (got %d)" -msgstr "" +msgstr "pack verwachtte %d elementen (ontving %d)" #: shared-bindings/_stage/Layer.c shared-bindings/_stage/Text.c msgid "palette must be 32 bytes long" @@ -3244,7 +3248,7 @@ msgstr "pow() met 3 argumenten vereist integers" #: ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h msgid "pressing boot button at start up.\n" -msgstr "" +msgstr "druk bootknop in bij opstarten.\n" #: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h #: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h @@ -3252,7 +3256,7 @@ msgstr "" #: ports/atmel-samd/boards/escornabot_makech/mpconfigboard.h #: ports/atmel-samd/boards/meowmeow/mpconfigboard.h msgid "pressing both buttons at start up.\n" -msgstr "" +msgstr "druk beide knoppen in bij opstarten.\n" #: extmod/modutimeq.c msgid "queue overflow" @@ -3379,7 +3383,7 @@ msgstr "sosfilt vereist itereerbare argumenten" #: shared-bindings/displayio/Bitmap.c msgid "source palette too large" -msgstr "" +msgstr "bronpalet te groot" #: py/objstr.c msgid "start/end indices" @@ -3514,7 +3518,7 @@ msgstr "objecttype '%q' heeft geen attribuut '%q'" #: py/objgenerator.c msgid "type object 'generator' has no attribute '__await__'" -msgstr "" +msgstr "het type object 'generator' heeft geen attribuut '__await__'" #: py/objtype.c msgid "type takes 1 or 3 arguments" @@ -3624,7 +3628,7 @@ msgstr "watchdog time-out moet groter zijn dan 0" #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" -msgstr "" +msgstr "breedte moet groter dan nul zijn" #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" From f2e79ce89da0ed926a5b10c22e0cd3fc81197e6c Mon Sep 17 00:00:00 2001 From: Jelle Jager Date: Mon, 26 Oct 2020 16:37:46 +0000 Subject: [PATCH 051/770] Translated using Weblate (Dutch) Currently translated at 100.0% (836 of 836 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/nl/ --- locale/nl.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/nl.po b/locale/nl.po index 59b1f2e73b651..f6efee0195f1f 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -7,7 +7,7 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-10-16 19:50-0500\n" "PO-Revision-Date: 2020-10-27 16:47+0000\n" -"Last-Translator: _fonzlate \n" +"Last-Translator: Jelle Jager \n" "Language-Team: none\n" "Language: nl\n" "MIME-Version: 1.0\n" @@ -481,7 +481,7 @@ msgstr "Buffer lengte moet een veelvoud van 512 zijn" #: ports/stm/common-hal/sdioio/SDCard.c msgid "Buffer must be a multiple of 512 bytes" -msgstr "Buffer moet een veelvoud van 512 zijn" +msgstr "Buffer moet een veelvoud van 512 bytes zijn" #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" From e00ae204db06f6505f9965fb5433d8e3cb4e220c Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 27 Oct 2020 17:48:01 +0100 Subject: [PATCH 052/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 12 ++++++++++++ locale/cs.po | 12 ++++++++++++ locale/de_DE.po | 12 ++++++++++++ locale/el.po | 12 ++++++++++++ locale/es.po | 20 +++++++++++++++++--- locale/fil.po | 12 ++++++++++++ locale/fr.po | 12 ++++++++++++ locale/hi.po | 12 ++++++++++++ locale/it_IT.po | 12 ++++++++++++ locale/ja.po | 12 ++++++++++++ locale/ko.po | 12 ++++++++++++ locale/nl.po | 12 ++++++++++++ locale/pl.po | 12 ++++++++++++ locale/pt_BR.po | 12 ++++++++++++ locale/sv.po | 12 ++++++++++++ locale/zh_Latn_pinyin.po | 12 ++++++++++++ 16 files changed, 197 insertions(+), 3 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 958ff1e6b2691..94a874826d383 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -2918,6 +2918,14 @@ msgstr "" msgid "maximum recursion depth exceeded" msgstr "" +#: extmod/ulab/code/approx/approx.c +msgid "maxiter must be > 0" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "maxiter should be > 0" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3351,6 +3359,10 @@ msgstr "memulai ulang software(soft reboot)\n" msgid "sort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "sorted axis can't be longer than 65535" +msgstr "" + #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index 6a3d00d993f5c..b8da7074138b7 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -2875,6 +2875,14 @@ msgstr "" msgid "maximum recursion depth exceeded" msgstr "" +#: extmod/ulab/code/approx/approx.c +msgid "maxiter must be > 0" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "maxiter should be > 0" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3307,6 +3315,10 @@ msgstr "" msgid "sort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "sorted axis can't be longer than 65535" +msgstr "" + #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 0e2e5a038e1dc..4d43a26557dbb 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -2954,6 +2954,14 @@ msgstr "" msgid "maximum recursion depth exceeded" msgstr "maximale Rekursionstiefe überschritten" +#: extmod/ulab/code/approx/approx.c +msgid "maxiter must be > 0" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "maxiter should be > 0" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3392,6 +3400,10 @@ msgstr "weicher reboot\n" msgid "sort argument must be an ndarray" msgstr "sortierungs Argument muss ein ndarray sein" +#: extmod/ulab/code/numerical/numerical.c +msgid "sorted axis can't be longer than 65535" +msgstr "" + #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" diff --git a/locale/el.po b/locale/el.po index 5e55065b30dd6..80fdb7eca1b20 100644 --- a/locale/el.po +++ b/locale/el.po @@ -2870,6 +2870,14 @@ msgstr "" msgid "maximum recursion depth exceeded" msgstr "" +#: extmod/ulab/code/approx/approx.c +msgid "maxiter must be > 0" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "maxiter should be > 0" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3302,6 +3310,10 @@ msgstr "" msgid "sort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "sorted axis can't be longer than 65535" +msgstr "" + #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" diff --git a/locale/es.po b/locale/es.po index 5cf9cf8654a71..38e0ff8d3935b 100644 --- a/locale/es.po +++ b/locale/es.po @@ -318,7 +318,9 @@ msgstr "Todos los canales de eventos estan siendo usados" #: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "All sync event channels in use" -msgstr "Todos los canales de eventos de sincronización (sync event channels) están siendo utilizados" +msgstr "" +"Todos los canales de eventos de sincronización (sync event channels) están " +"siendo utilizados" #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" @@ -2941,6 +2943,14 @@ msgstr "max_lenght debe ser > 0" msgid "maximum recursion depth exceeded" msgstr "profundidad máxima de recursión excedida" +#: extmod/ulab/code/approx/approx.c +msgid "maxiter must be > 0" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "maxiter should be > 0" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3378,6 +3388,10 @@ msgstr "reinicio suave\n" msgid "sort argument must be an ndarray" msgstr "argumento de ordenado debe ser un ndarray" +#: extmod/ulab/code/numerical/numerical.c +msgid "sorted axis can't be longer than 65535" +msgstr "" + #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "el arreglo sos debe de forma (n_section, 6)" @@ -4135,8 +4149,8 @@ msgstr "zi debe ser una forma (n_section,2)" #~ "pequeño.\n" #~ "Aumente los límites del tamaño del stack y presione reset (después de " #~ "expulsarCIRCUITPY).\n" -#~ "Si no cambió el stack, entonces reporte un issue aquí con el contenido " -#~ "de su unidad CIRCUITPY:\n" +#~ "Si no cambió el stack, entonces reporte un issue aquí con el contenido de " +#~ "su unidad CIRCUITPY:\n" #~ msgid "" #~ "The microcontroller's power dipped. Please make sure your power supply " diff --git a/locale/fil.po b/locale/fil.po index 7a91f5c8598e9..838bca98bab93 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -2919,6 +2919,14 @@ msgstr "" msgid "maximum recursion depth exceeded" msgstr "lumagpas ang maximum recursion depth" +#: extmod/ulab/code/approx/approx.c +msgid "maxiter must be > 0" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "maxiter should be > 0" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3355,6 +3363,10 @@ msgstr "malambot na reboot\n" msgid "sort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "sorted axis can't be longer than 65535" +msgstr "" + #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index cf0ea4fc31534..b4a15ee1f96fa 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -2965,6 +2965,14 @@ msgstr "max_length doit être > 0" msgid "maximum recursion depth exceeded" msgstr "profondeur maximale de récursivité dépassée" +#: extmod/ulab/code/approx/approx.c +msgid "maxiter must be > 0" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "maxiter should be > 0" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3404,6 +3412,10 @@ msgstr "redémarrage logiciel\n" msgid "sort argument must be an ndarray" msgstr "l'argument de «sort» doit être un ndarray" +#: extmod/ulab/code/numerical/numerical.c +msgid "sorted axis can't be longer than 65535" +msgstr "" + #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "le tableau sos doit être de forme (n_section, 6)" diff --git a/locale/hi.po b/locale/hi.po index bd6d5395bf1b2..9174580a26247 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -2870,6 +2870,14 @@ msgstr "" msgid "maximum recursion depth exceeded" msgstr "" +#: extmod/ulab/code/approx/approx.c +msgid "maxiter must be > 0" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "maxiter should be > 0" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3302,6 +3310,10 @@ msgstr "" msgid "sort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "sorted axis can't be longer than 65535" +msgstr "" + #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 9ed3bb1e1cc78..6345c095c7939 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -2921,6 +2921,14 @@ msgstr "" msgid "maximum recursion depth exceeded" msgstr "profondità massima di ricorsione superata" +#: extmod/ulab/code/approx/approx.c +msgid "maxiter must be > 0" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "maxiter should be > 0" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3362,6 +3370,10 @@ msgstr "soft reboot\n" msgid "sort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "sorted axis can't be longer than 65535" +msgstr "" + #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" diff --git a/locale/ja.po b/locale/ja.po index 8c3751c8e8155..abd2e1803d4b5 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -2900,6 +2900,14 @@ msgstr "max_lengthは0より大きくなければなりません" msgid "maximum recursion depth exceeded" msgstr "最大の再帰深度を超えました" +#: extmod/ulab/code/approx/approx.c +msgid "maxiter must be > 0" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "maxiter should be > 0" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3335,6 +3343,10 @@ msgstr "ソフトリブート\n" msgid "sort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "sorted axis can't be longer than 65535" +msgstr "" + #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" diff --git a/locale/ko.po b/locale/ko.po index 9c5750b9f5adb..e5b728b846f11 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -2876,6 +2876,14 @@ msgstr "" msgid "maximum recursion depth exceeded" msgstr "" +#: extmod/ulab/code/approx/approx.c +msgid "maxiter must be > 0" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "maxiter should be > 0" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3308,6 +3316,10 @@ msgstr "" msgid "sort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "sorted axis can't be longer than 65535" +msgstr "" + #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index f6efee0195f1f..234bb930aeaf4 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -2934,6 +2934,14 @@ msgstr "max_length moet >0 zijn" msgid "maximum recursion depth exceeded" msgstr "maximale recursiediepte overschreden" +#: extmod/ulab/code/approx/approx.c +msgid "maxiter must be > 0" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "maxiter should be > 0" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3369,6 +3377,10 @@ msgstr "zachte herstart\n" msgid "sort argument must be an ndarray" msgstr "sorteerargument moet een ndarray zijn" +#: extmod/ulab/code/numerical/numerical.c +msgid "sorted axis can't be longer than 65535" +msgstr "" + #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "sos array moet vorm (n_section, 6) hebben" diff --git a/locale/pl.po b/locale/pl.po index f6292a0a3b175..cadb2c43ebd36 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -2893,6 +2893,14 @@ msgstr "max_length musi być > 0" msgid "maximum recursion depth exceeded" msgstr "przekroczono dozwoloną głębokość rekurencji" +#: extmod/ulab/code/approx/approx.c +msgid "maxiter must be > 0" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "maxiter should be > 0" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3327,6 +3335,10 @@ msgstr "programowy reset\n" msgid "sort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "sorted axis can't be longer than 65535" +msgstr "" + #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index b80afeb1aa92d..2c3d9b2074314 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -2954,6 +2954,14 @@ msgstr "max_length deve ser > 0" msgid "maximum recursion depth exceeded" msgstr "a recursão máxima da profundidade foi excedida" +#: extmod/ulab/code/approx/approx.c +msgid "maxiter must be > 0" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "maxiter should be > 0" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3395,6 +3403,10 @@ msgstr "reinicialização soft\n" msgid "sort argument must be an ndarray" msgstr "o argumento da classificação deve ser um ndarray" +#: extmod/ulab/code/numerical/numerical.c +msgid "sorted axis can't be longer than 65535" +msgstr "" + #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "o sos da matriz deve estar na forma (n_section, 6)" diff --git a/locale/sv.po b/locale/sv.po index 989b8257e75ca..f2fa50189b5e0 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -2927,6 +2927,14 @@ msgstr "max_length måste vara > 0" msgid "maximum recursion depth exceeded" msgstr "maximal rekursionsdjup överskriden" +#: extmod/ulab/code/approx/approx.c +msgid "maxiter must be > 0" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "maxiter should be > 0" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3362,6 +3370,10 @@ msgstr "mjuk omstart\n" msgid "sort argument must be an ndarray" msgstr "argumentet sort måste vara en ndarray" +#: extmod/ulab/code/numerical/numerical.c +msgid "sorted axis can't be longer than 65535" +msgstr "" + #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "sos array måste ha form (n_section, 6)" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 13d0dfa7966f8..5ed34cc6c3688 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -2917,6 +2917,14 @@ msgstr "Max_length bìxū > 0" msgid "maximum recursion depth exceeded" msgstr "chāochū zuìdà dìguī shēndù" +#: extmod/ulab/code/approx/approx.c +msgid "maxiter must be > 0" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "maxiter should be > 0" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3351,6 +3359,10 @@ msgstr "ruǎn chóngqǐ\n" msgid "sort argument must be an ndarray" msgstr "páixù cānshù bìxū shì ndarray" +#: extmod/ulab/code/numerical/numerical.c +msgid "sorted axis can't be longer than 65535" +msgstr "" + #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "sos shùzǔ de xíngzhuàng bìxū wèi (n_section, 6)" From 80029f6929ebbf6c0a02c5320e59220b0501bd55 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 28 Oct 2020 00:12:13 +0530 Subject: [PATCH 053/770] rotaryio implementation for esp32s2 --- .../common-hal/rotaryio/IncrementalEncoder.c | 115 ++++++++++++++++++ .../common-hal/rotaryio/IncrementalEncoder.h | 41 +++++++ ports/esp32s2/common-hal/rotaryio/__init__.c | 1 + ports/esp32s2/mpconfigport.mk | 2 +- 4 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c create mode 100644 ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.h create mode 100644 ports/esp32s2/common-hal/rotaryio/__init__.c diff --git a/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c b/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c new file mode 100644 index 0000000000000..bbff363740b53 --- /dev/null +++ b/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c @@ -0,0 +1,115 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2018 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 "common-hal/rotaryio/IncrementalEncoder.h" + +#include "py/runtime.h" +#include "supervisor/shared/translate.h" + +#include "driver/pcnt.h" + +static void pcnt_reset(int unit) { + // Initialize PCNT's counter + pcnt_counter_pause(unit); + pcnt_counter_clear(unit); + + // Everything is set up, now go to counting + pcnt_counter_resume(unit); +} + +static void pcnt_init(int unit, rotaryio_incrementalencoder_obj_t* self) { + // Prepare configuration for the PCNT unit + pcnt_config_t pcnt_config = { + // Set PCNT input signal and control GPIOs + .pulse_gpio_num = self->pin_a->number, + .ctrl_gpio_num = self->pin_b->number, + .channel = PCNT_CHANNEL_0, + .unit = unit, + // What to do on the positive / negative edge of pulse input? + .pos_mode = PCNT_COUNT_DEC, // Count up on the positive edge + .neg_mode = PCNT_COUNT_INC, // Keep the counter value on the negative edge + // What to do when control input is low or high? + .lctrl_mode = PCNT_MODE_REVERSE, // Reverse counting direction if low + .hctrl_mode = PCNT_MODE_KEEP, // Keep the primary counter mode if high + }; + // Initialize PCNT unit + pcnt_unit_config(&pcnt_config); + + // Configure channel 1 + pcnt_config.pulse_gpio_num = self->pin_b->number; + pcnt_config.ctrl_gpio_num = self->pin_a->number; + pcnt_config.channel = PCNT_CHANNEL_1; + pcnt_config.pos_mode = PCNT_COUNT_INC; + pcnt_config.neg_mode = PCNT_COUNT_DEC; + pcnt_unit_config(&pcnt_config); + + // Configure and enable the input filter + pcnt_set_filter_value(unit, 100); + pcnt_filter_enable(unit); + + pcnt_reset(unit); +} + +void common_hal_rotaryio_incrementalencoder_construct(rotaryio_incrementalencoder_obj_t* self, + const mcu_pin_obj_t* pin_a, const mcu_pin_obj_t* pin_b) { + claim_pin(pin_a); + claim_pin(pin_b); + + self->pin_a = pin_a; + self->pin_b = pin_b; + + self->position = 0; + + pcnt_init(PCNT_UNIT_0, self); +} + +bool common_hal_rotaryio_incrementalencoder_deinited(rotaryio_incrementalencoder_obj_t* self) { + return self->pin_a == NULL; +} + +void common_hal_rotaryio_incrementalencoder_deinit(rotaryio_incrementalencoder_obj_t* self) { + if (common_hal_rotaryio_incrementalencoder_deinited(self)) { + return; + } + + reset_pin_number(self->pin_a->number); + self->pin_a = NULL; + + reset_pin_number(self->pin_b->number); + self->pin_b = NULL; +} + +mp_int_t common_hal_rotaryio_incrementalencoder_get_position(rotaryio_incrementalencoder_obj_t* self) { + int16_t count = 0; + pcnt_get_counter_value(PCNT_UNIT_0, &count); + return self->position+count; +} + +void common_hal_rotaryio_incrementalencoder_set_position(rotaryio_incrementalencoder_obj_t* self, + mp_int_t new_position) { + self->position = new_position; + pcnt_reset(PCNT_UNIT_0); +} diff --git a/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.h b/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.h new file mode 100644 index 0000000000000..0cc2830fb7992 --- /dev/null +++ b/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.h @@ -0,0 +1,41 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2018 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. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ROTARYIO_INCREMENTALENCODER_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ROTARYIO_INCREMENTALENCODER_H + +#include "common-hal/microcontroller/Pin.h" + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + const mcu_pin_obj_t * pin_a; + const mcu_pin_obj_t * pin_b; + mp_int_t position; +} rotaryio_incrementalencoder_obj_t; + +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ROTARYIO_INCREMENTALENCODER_H diff --git a/ports/esp32s2/common-hal/rotaryio/__init__.c b/ports/esp32s2/common-hal/rotaryio/__init__.c new file mode 100644 index 0000000000000..0aae79c26a1c7 --- /dev/null +++ b/ports/esp32s2/common-hal/rotaryio/__init__.c @@ -0,0 +1 @@ +// No rotaryio module functions. diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index 4e8a7bdef2f98..dadab37515673 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -19,7 +19,7 @@ CIRCUITPY_AUDIOIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 -CIRCUITPY_ROTARYIO = 0 +CIRCUITPY_ROTARYIO = 1 CIRCUITPY_NVM = 0 # We don't have enough endpoints to include MIDI. CIRCUITPY_USB_MIDI = 0 From 54c0e98a37fc3c997d3a7a566a67e33d1636f46a Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 27 Oct 2020 13:58:23 -0700 Subject: [PATCH 054/770] Fix openbook build --- ports/atmel-samd/boards/openbook_m4/board.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/openbook_m4/board.c b/ports/atmel-samd/boards/openbook_m4/board.c index f0010f6d782a8..07dd1741aceb1 100644 --- a/ports/atmel-samd/boards/openbook_m4/board.c +++ b/ports/atmel-samd/boards/openbook_m4/board.c @@ -97,7 +97,8 @@ void board_init(void) { &pin_PA01, // busy_pin false, // busy_state 5, // seconds_per_frame - false); // chip_select (don't always toggle chip select) + false, // chip_select (don't always toggle chip select) + false); // grayscale } bool board_requests_safe_mode(void) { From 91e85e8037c058f5029f9ba61d6da952eeac436e Mon Sep 17 00:00:00 2001 From: Adolfo Jayme Barrientos Date: Tue, 27 Oct 2020 17:19:22 +0000 Subject: [PATCH 055/770] Translated using Weblate (Spanish) Currently translated at 99.6% (836 of 839 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/es.po b/locale/es.po index 38e0ff8d3935b..6b8b96d2d7490 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,15 +8,15 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-10-16 19:50-0500\n" -"PO-Revision-Date: 2020-10-22 22:15+0000\n" -"Last-Translator: Alvaro Figueroa \n" +"PO-Revision-Date: 2020-10-27 21:01+0000\n" +"Last-Translator: Adolfo Jayme Barrientos \n" "Language-Team: \n" "Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.3.1\n" +"X-Generator: Weblate 4.3.2-dev\n" #: main.c msgid "" @@ -33,7 +33,7 @@ msgid "" "https://github.com/adafruit/circuitpython/issues\n" msgstr "" "\n" -"Reporte un problema con el contenido de su unidad CIRCUITPY en\n" +"Presente un problema con el contenido de su unidad CIRCUITPY en\n" "https://github.com/adafruit/circuitpython/issues\n" #: py/obj.c From 54c26a772ba071d129c0e30e8fc6d44e1be74029 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Tue, 27 Oct 2020 16:59:40 +0000 Subject: [PATCH 056/770] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (839 of 839 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 2c3d9b2074314..16631c32a7b69 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-10-16 19:50-0500\n" -"PO-Revision-Date: 2020-10-21 19:58+0000\n" +"PO-Revision-Date: 2020-10-27 21:01+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.3.1\n" +"X-Generator: Weblate 4.3.2-dev\n" #: main.c msgid "" @@ -2956,11 +2956,11 @@ msgstr "a recursão máxima da profundidade foi excedida" #: extmod/ulab/code/approx/approx.c msgid "maxiter must be > 0" -msgstr "" +msgstr "maxiter deve ser > 0" #: extmod/ulab/code/approx/approx.c msgid "maxiter should be > 0" -msgstr "" +msgstr "maxiter pode ser > 0" #: py/runtime.c #, c-format @@ -3405,7 +3405,7 @@ msgstr "o argumento da classificação deve ser um ndarray" #: extmod/ulab/code/numerical/numerical.c msgid "sorted axis can't be longer than 65535" -msgstr "" +msgstr "o eixo ordenado não pode ser maior do que 65535" #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" From 32f6f64a288903395358b4be73a92fe03a71fc67 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 27 Oct 2020 22:01:17 +0100 Subject: [PATCH 057/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 32 +++++++++++++++++++++++++++++--- locale/cs.po | 32 +++++++++++++++++++++++++++++--- locale/de_DE.po | 32 +++++++++++++++++++++++++++++--- locale/el.po | 32 +++++++++++++++++++++++++++++--- locale/es.po | 32 +++++++++++++++++++++++++++++--- locale/fil.po | 32 +++++++++++++++++++++++++++++--- locale/fr.po | 32 +++++++++++++++++++++++++++++--- locale/hi.po | 32 +++++++++++++++++++++++++++++--- locale/it_IT.po | 32 +++++++++++++++++++++++++++++--- locale/ja.po | 32 +++++++++++++++++++++++++++++--- locale/ko.po | 32 +++++++++++++++++++++++++++++--- locale/nl.po | 32 +++++++++++++++++++++++++++++--- locale/pl.po | 32 +++++++++++++++++++++++++++++--- locale/pt_BR.po | 32 +++++++++++++++++++++++++++++--- locale/sv.po | 32 +++++++++++++++++++++++++++++--- locale/zh_Latn_pinyin.po | 32 +++++++++++++++++++++++++++++--- 16 files changed, 464 insertions(+), 48 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 94a874826d383..7debab27ac810 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 19:50-0500\n" +"POT-Creation-Date: 2020-10-21 20:13-0500\n" "PO-Revision-Date: 2020-10-10 23:51+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -292,11 +292,16 @@ msgstr "Alamat harus sepanjang %d byte" msgid "Address type out of range" msgstr "Jenis alamat di luar batas" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "All CAN peripherals are in use" +msgstr "" + #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "Semua perangkat I2C sedang digunakan" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "All RX FIFOs in use" msgstr "" @@ -413,6 +418,10 @@ msgstr "" "Auto-reload aktif. Silahkan simpan data-data (files) melalui USB untuk " "menjalankannya atau masuk ke REPL untukmenonaktifkan.\n" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "Baudrate not supported by peripheral" +msgstr "" + #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" @@ -793,7 +802,7 @@ msgstr "Mode kendara tidak digunakan saat arah input." msgid "ECB only operates on 16 bytes at a time" msgstr "ECB hanya beroperasi pada 16 byte di satu waktu" -#: ports/esp32s2/common-hal/busio/SPI.c +#: ports/esp32s2/common-hal/busio/SPI.c ports/esp32s2/common-hal/canio/CAN.c msgid "ESP-IDF memory allocation failed" msgstr "" @@ -919,6 +928,7 @@ msgid "File exists" msgstr "File sudah ada" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "Filters too complex" msgstr "" @@ -1140,7 +1150,7 @@ msgstr "Pin untuk channel kanan tidak valid" #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c #: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/SPI.c -#: ports/esp32s2/common-hal/busio/UART.c +#: ports/esp32s2/common-hal/busio/UART.c ports/esp32s2/common-hal/canio/CAN.c #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c @@ -2884,6 +2894,10 @@ msgstr "" msgid "long int not supported in this build" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "loopback + silent mode not supported by peripheral" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "" @@ -3237,6 +3251,8 @@ msgstr "" #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wrover/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h msgid "pressing boot button at start up.\n" @@ -3493,6 +3509,16 @@ msgstr "" msgid "tuple/list has wrong length" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_driver_install returned esp-idf error #%d" +msgstr "" + +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_start returned esp-idf error #%d" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: shared-bindings/busio/UART.c shared-bindings/canio/CAN.c diff --git a/locale/cs.po b/locale/cs.po index b8da7074138b7..e4f677d8e2ffe 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 19:50-0500\n" +"POT-Creation-Date: 2020-10-21 20:13-0500\n" "PO-Revision-Date: 2020-05-24 03:22+0000\n" "Last-Translator: dronecz \n" "Language-Team: LANGUAGE \n" @@ -292,11 +292,16 @@ msgstr "" msgid "Address type out of range" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "All CAN peripherals are in use" +msgstr "" + #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "All RX FIFOs in use" msgstr "" @@ -411,6 +416,10 @@ msgid "" "disable.\n" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "Baudrate not supported by peripheral" +msgstr "" + #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" @@ -779,7 +788,7 @@ msgstr "" msgid "ECB only operates on 16 bytes at a time" msgstr "" -#: ports/esp32s2/common-hal/busio/SPI.c +#: ports/esp32s2/common-hal/busio/SPI.c ports/esp32s2/common-hal/canio/CAN.c msgid "ESP-IDF memory allocation failed" msgstr "" @@ -905,6 +914,7 @@ msgid "File exists" msgstr "" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "Filters too complex" msgstr "" @@ -1123,7 +1133,7 @@ msgstr "" #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c #: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/SPI.c -#: ports/esp32s2/common-hal/busio/UART.c +#: ports/esp32s2/common-hal/busio/UART.c ports/esp32s2/common-hal/canio/CAN.c #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c @@ -2841,6 +2851,10 @@ msgstr "" msgid "long int not supported in this build" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "loopback + silent mode not supported by peripheral" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "" @@ -3193,6 +3207,8 @@ msgstr "" #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wrover/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h msgid "pressing boot button at start up.\n" @@ -3448,6 +3464,16 @@ msgstr "" msgid "tuple/list has wrong length" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_driver_install returned esp-idf error #%d" +msgstr "" + +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_start returned esp-idf error #%d" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: shared-bindings/busio/UART.c shared-bindings/canio/CAN.c diff --git a/locale/de_DE.po b/locale/de_DE.po index 4d43a26557dbb..141a5e8c036a4 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 19:50-0500\n" +"POT-Creation-Date: 2020-10-21 20:13-0500\n" "PO-Revision-Date: 2020-06-16 18:24+0000\n" "Last-Translator: Andreas Buchen \n" "Language: de_DE\n" @@ -291,11 +291,16 @@ msgstr "Die Adresse muss %d Bytes lang sein" msgid "Address type out of range" msgstr "Adresstyp außerhalb des zulässigen Bereichs" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "All CAN peripherals are in use" +msgstr "" + #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "Alle I2C-Peripheriegeräte sind in Benutzung" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "All RX FIFOs in use" msgstr "" @@ -414,6 +419,10 @@ msgstr "" "Automatisches Neuladen ist aktiv. Speichere Dateien über USB um sie " "auszuführen oder verbinde dich mit der REPL zum Deaktivieren.\n" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "Baudrate not supported by peripheral" +msgstr "" + #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" @@ -789,7 +798,7 @@ msgstr "Drive mode wird nicht verwendet, wenn die Richtung input ist." msgid "ECB only operates on 16 bytes at a time" msgstr "Die EZB arbeitet jeweils nur mit 16 Bytes" -#: ports/esp32s2/common-hal/busio/SPI.c +#: ports/esp32s2/common-hal/busio/SPI.c ports/esp32s2/common-hal/canio/CAN.c msgid "ESP-IDF memory allocation failed" msgstr "" @@ -916,6 +925,7 @@ msgid "File exists" msgstr "Datei existiert" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "Filters too complex" msgstr "Filter zu komplex" @@ -1140,7 +1150,7 @@ msgstr "Ungültiger Pin für rechten Kanal" #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c #: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/SPI.c -#: ports/esp32s2/common-hal/busio/UART.c +#: ports/esp32s2/common-hal/busio/UART.c ports/esp32s2/common-hal/canio/CAN.c #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c @@ -2920,6 +2930,10 @@ msgstr "" msgid "long int not supported in this build" msgstr "long int wird in diesem Build nicht unterstützt" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "loopback + silent mode not supported by peripheral" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "fehlformatierter f-string" @@ -3276,6 +3290,8 @@ msgstr "pow () mit 3 Argumenten erfordert Integer" #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wrover/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h msgid "pressing boot button at start up.\n" @@ -3534,6 +3550,16 @@ msgstr "Tupelindex außerhalb des Bereichs" msgid "tuple/list has wrong length" msgstr "tupel/list hat falsche Länge" +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_driver_install returned esp-idf error #%d" +msgstr "" + +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_start returned esp-idf error #%d" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: shared-bindings/busio/UART.c shared-bindings/canio/CAN.c diff --git a/locale/el.po b/locale/el.po index 80fdb7eca1b20..cc6da670cd4e4 100644 --- a/locale/el.po +++ b/locale/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 19:50-0500\n" +"POT-Creation-Date: 2020-10-21 20:13-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -287,11 +287,16 @@ msgstr "" msgid "Address type out of range" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "All CAN peripherals are in use" +msgstr "" + #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "All RX FIFOs in use" msgstr "" @@ -406,6 +411,10 @@ msgid "" "disable.\n" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "Baudrate not supported by peripheral" +msgstr "" + #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" @@ -774,7 +783,7 @@ msgstr "" msgid "ECB only operates on 16 bytes at a time" msgstr "" -#: ports/esp32s2/common-hal/busio/SPI.c +#: ports/esp32s2/common-hal/busio/SPI.c ports/esp32s2/common-hal/canio/CAN.c msgid "ESP-IDF memory allocation failed" msgstr "" @@ -900,6 +909,7 @@ msgid "File exists" msgstr "" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "Filters too complex" msgstr "" @@ -1118,7 +1128,7 @@ msgstr "" #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c #: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/SPI.c -#: ports/esp32s2/common-hal/busio/UART.c +#: ports/esp32s2/common-hal/busio/UART.c ports/esp32s2/common-hal/canio/CAN.c #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c @@ -2836,6 +2846,10 @@ msgstr "" msgid "long int not supported in this build" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "loopback + silent mode not supported by peripheral" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "" @@ -3188,6 +3202,8 @@ msgstr "" #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wrover/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h msgid "pressing boot button at start up.\n" @@ -3443,6 +3459,16 @@ msgstr "" msgid "tuple/list has wrong length" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_driver_install returned esp-idf error #%d" +msgstr "" + +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_start returned esp-idf error #%d" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: shared-bindings/busio/UART.c shared-bindings/canio/CAN.c diff --git a/locale/es.po b/locale/es.po index 6b8b96d2d7490..348af34067c96 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-10-16 19:50-0500\n" +"POT-Creation-Date: 2020-10-21 20:13-0500\n" "PO-Revision-Date: 2020-10-27 21:01+0000\n" "Last-Translator: Adolfo Jayme Barrientos \n" "Language-Team: \n" @@ -295,11 +295,16 @@ msgstr "La dirección debe tener %d bytes de largo" msgid "Address type out of range" msgstr "Tipo de dirección fuera de rango" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "All CAN peripherals are in use" +msgstr "" + #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "Todos los periféricos I2C están siendo usados" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "All RX FIFOs in use" msgstr "Todos los FIFOs de RX en uso" @@ -420,6 +425,10 @@ msgstr "" "Auto-reload habilitado. Simplemente guarda los archivos via USB para " "ejecutarlos o entra al REPL para desabilitarlos.\n" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "Baudrate not supported by peripheral" +msgstr "" + #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" @@ -794,7 +803,7 @@ msgstr "Modo Drive no se usa cuando la dirección es input." msgid "ECB only operates on 16 bytes at a time" msgstr "ECB solo opera sobre 16 bytes a la vez" -#: ports/esp32s2/common-hal/busio/SPI.c +#: ports/esp32s2/common-hal/busio/SPI.c ports/esp32s2/common-hal/canio/CAN.c msgid "ESP-IDF memory allocation failed" msgstr "Fallo ESP-IDF al tomar la memoria" @@ -920,6 +929,7 @@ msgid "File exists" msgstr "El archivo ya existe" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "Filters too complex" msgstr "Filtros muy complejos" @@ -1141,7 +1151,7 @@ msgstr "Pin inválido para canal derecho" #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c #: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/SPI.c -#: ports/esp32s2/common-hal/busio/UART.c +#: ports/esp32s2/common-hal/busio/UART.c ports/esp32s2/common-hal/canio/CAN.c #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c @@ -2909,6 +2919,10 @@ msgstr "variable local referenciada antes de la asignación" msgid "long int not supported in this build" msgstr "long int no soportado en esta compilación" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "loopback + silent mode not supported by peripheral" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "cadena-f mal formada" @@ -3264,6 +3278,8 @@ msgstr "pow() con 3 argumentos requiere enteros" #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wrover/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h msgid "pressing boot button at start up.\n" @@ -3522,6 +3538,16 @@ msgstr "tuple index fuera de rango" msgid "tuple/list has wrong length" msgstr "tupla/lista tiene una longitud incorrecta" +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_driver_install returned esp-idf error #%d" +msgstr "" + +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_start returned esp-idf error #%d" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: shared-bindings/busio/UART.c shared-bindings/canio/CAN.c diff --git a/locale/fil.po b/locale/fil.po index 838bca98bab93..7bc33dba3ee18 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 19:50-0500\n" +"POT-Creation-Date: 2020-10-21 20:13-0500\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -289,11 +289,16 @@ msgstr "ang palette ay dapat 32 bytes ang haba" msgid "Address type out of range" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "All CAN peripherals are in use" +msgstr "" + #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "Lahat ng I2C peripherals ginagamit" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "All RX FIFOs in use" msgstr "" @@ -411,6 +416,10 @@ msgstr "" "Ang awtomatikong pag re-reload ay ON. i-save lamang ang mga files sa USB " "para patakbuhin sila o pasukin ang REPL para i-disable ito.\n" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "Baudrate not supported by peripheral" +msgstr "" + #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" @@ -785,7 +794,7 @@ msgstr "Drive mode ay hindi ginagamit kapag ang direksyon ay input." msgid "ECB only operates on 16 bytes at a time" msgstr "" -#: ports/esp32s2/common-hal/busio/SPI.c +#: ports/esp32s2/common-hal/busio/SPI.c ports/esp32s2/common-hal/canio/CAN.c msgid "ESP-IDF memory allocation failed" msgstr "" @@ -913,6 +922,7 @@ msgid "File exists" msgstr "Mayroong file" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "Filters too complex" msgstr "" @@ -1133,7 +1143,7 @@ msgstr "Mali ang pin para sa kanang channel" #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c #: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/SPI.c -#: ports/esp32s2/common-hal/busio/UART.c +#: ports/esp32s2/common-hal/busio/UART.c ports/esp32s2/common-hal/canio/CAN.c #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c @@ -2885,6 +2895,10 @@ msgstr "local variable na reference bago na i-assign" msgid "long int not supported in this build" msgstr "long int hindi sinusuportahan sa build na ito" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "loopback + silent mode not supported by peripheral" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "" @@ -3239,6 +3253,8 @@ msgstr "pow() na may 3 argumento kailangan ng integers" #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wrover/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h msgid "pressing boot button at start up.\n" @@ -3498,6 +3514,16 @@ msgstr "indeks ng tuple wala sa sakop" msgid "tuple/list has wrong length" msgstr "mali ang haba ng tuple/list" +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_driver_install returned esp-idf error #%d" +msgstr "" + +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_start returned esp-idf error #%d" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: shared-bindings/busio/UART.c shared-bindings/canio/CAN.c diff --git a/locale/fr.po b/locale/fr.po index b4a15ee1f96fa..920e22cb0cb43 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 19:50-0500\n" +"POT-Creation-Date: 2020-10-21 20:13-0500\n" "PO-Revision-Date: 2020-10-22 20:48+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" @@ -296,11 +296,16 @@ msgstr "L'adresse doit être longue de %d octets" msgid "Address type out of range" msgstr "Type d'adresse hors plage" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "All CAN peripherals are in use" +msgstr "" + #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "Tous les périphériques I2C sont utilisés" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "All RX FIFOs in use" msgstr "Tout les RX FIFOs sont utilisé" @@ -420,6 +425,10 @@ msgstr "" "Auto-chargement activé. Copiez simplement les fichiers en USB pour les " "lancer ou entrez sur REPL pour le désactiver.\n" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "Baudrate not supported by peripheral" +msgstr "" + #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" @@ -798,7 +807,7 @@ msgstr "Le mode Drive n'est pas utilisé quand la direction est 'input'." msgid "ECB only operates on 16 bytes at a time" msgstr "La BCE ne fonctionne que sur 16 octets à la fois" -#: ports/esp32s2/common-hal/busio/SPI.c +#: ports/esp32s2/common-hal/busio/SPI.c ports/esp32s2/common-hal/canio/CAN.c msgid "ESP-IDF memory allocation failed" msgstr "ESP-IDF échec d'allocation de la mémoire" @@ -925,6 +934,7 @@ msgid "File exists" msgstr "Le fichier existe" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "Filters too complex" msgstr "Filtre trop complexe" @@ -1146,7 +1156,7 @@ msgstr "Broche invalide pour le canal droit" #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c #: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/SPI.c -#: ports/esp32s2/common-hal/busio/UART.c +#: ports/esp32s2/common-hal/busio/UART.c ports/esp32s2/common-hal/canio/CAN.c #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c @@ -2931,6 +2941,10 @@ msgstr "variable locale référencée avant d'être assignée" msgid "long int not supported in this build" msgstr "entiers longs non supportés dans cette build" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "loopback + silent mode not supported by peripheral" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "f-string mal formé" @@ -3288,6 +3302,8 @@ msgstr "pow() avec 3 arguments nécessite des entiers" #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wrover/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h msgid "pressing boot button at start up.\n" @@ -3546,6 +3562,16 @@ msgstr "index du tuple hors gamme" msgid "tuple/list has wrong length" msgstr "tuple/liste a une mauvaise longueur" +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_driver_install returned esp-idf error #%d" +msgstr "" + +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_start returned esp-idf error #%d" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: shared-bindings/busio/UART.c shared-bindings/canio/CAN.c diff --git a/locale/hi.po b/locale/hi.po index 9174580a26247..4966ad8e801a4 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 19:50-0500\n" +"POT-Creation-Date: 2020-10-21 20:13-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -287,11 +287,16 @@ msgstr "" msgid "Address type out of range" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "All CAN peripherals are in use" +msgstr "" + #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "All RX FIFOs in use" msgstr "" @@ -406,6 +411,10 @@ msgid "" "disable.\n" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "Baudrate not supported by peripheral" +msgstr "" + #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" @@ -774,7 +783,7 @@ msgstr "" msgid "ECB only operates on 16 bytes at a time" msgstr "" -#: ports/esp32s2/common-hal/busio/SPI.c +#: ports/esp32s2/common-hal/busio/SPI.c ports/esp32s2/common-hal/canio/CAN.c msgid "ESP-IDF memory allocation failed" msgstr "" @@ -900,6 +909,7 @@ msgid "File exists" msgstr "" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "Filters too complex" msgstr "" @@ -1118,7 +1128,7 @@ msgstr "" #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c #: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/SPI.c -#: ports/esp32s2/common-hal/busio/UART.c +#: ports/esp32s2/common-hal/busio/UART.c ports/esp32s2/common-hal/canio/CAN.c #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c @@ -2836,6 +2846,10 @@ msgstr "" msgid "long int not supported in this build" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "loopback + silent mode not supported by peripheral" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "" @@ -3188,6 +3202,8 @@ msgstr "" #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wrover/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h msgid "pressing boot button at start up.\n" @@ -3443,6 +3459,16 @@ msgstr "" msgid "tuple/list has wrong length" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_driver_install returned esp-idf error #%d" +msgstr "" + +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_start returned esp-idf error #%d" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: shared-bindings/busio/UART.c shared-bindings/canio/CAN.c diff --git a/locale/it_IT.po b/locale/it_IT.po index 6345c095c7939..82840c8523132 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 19:50-0500\n" +"POT-Creation-Date: 2020-10-21 20:13-0500\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -288,11 +288,16 @@ msgstr "la palette deve essere lunga 32 byte" msgid "Address type out of range" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "All CAN peripherals are in use" +msgstr "" + #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "Tutte le periferiche I2C sono in uso" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "All RX FIFOs in use" msgstr "" @@ -410,6 +415,10 @@ msgstr "" "L'auto-reload è attivo. Salva i file su USB per eseguirli o entra nel REPL " "per disabilitarlo.\n" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "Baudrate not supported by peripheral" +msgstr "" + #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" @@ -785,7 +794,7 @@ msgstr "" msgid "ECB only operates on 16 bytes at a time" msgstr "" -#: ports/esp32s2/common-hal/busio/SPI.c +#: ports/esp32s2/common-hal/busio/SPI.c ports/esp32s2/common-hal/canio/CAN.c msgid "ESP-IDF memory allocation failed" msgstr "" @@ -913,6 +922,7 @@ msgid "File exists" msgstr "File esistente" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "Filters too complex" msgstr "" @@ -1135,7 +1145,7 @@ msgstr "Pin non valido per il canale destro" #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c #: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/SPI.c -#: ports/esp32s2/common-hal/busio/UART.c +#: ports/esp32s2/common-hal/busio/UART.c ports/esp32s2/common-hal/canio/CAN.c #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c @@ -2887,6 +2897,10 @@ msgstr "variabile locale richiamata prima di un assegnamento" msgid "long int not supported in this build" msgstr "long int non supportata in questa build" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "loopback + silent mode not supported by peripheral" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "" @@ -3246,6 +3260,8 @@ msgstr "pow() con 3 argomenti richiede interi" #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wrover/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h msgid "pressing boot button at start up.\n" @@ -3505,6 +3521,16 @@ msgstr "indice della tupla fuori intervallo" msgid "tuple/list has wrong length" msgstr "tupla/lista ha la lunghezza sbagliata" +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_driver_install returned esp-idf error #%d" +msgstr "" + +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_start returned esp-idf error #%d" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: shared-bindings/busio/UART.c shared-bindings/canio/CAN.c diff --git a/locale/ja.po b/locale/ja.po index abd2e1803d4b5..ae7e51ba6b504 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 19:50-0500\n" +"POT-Creation-Date: 2020-10-21 20:13-0500\n" "PO-Revision-Date: 2020-09-25 18:20+0000\n" "Last-Translator: Taku Fukada \n" "Language-Team: none\n" @@ -294,11 +294,16 @@ msgstr "アドレスは、%dバイト長でなければなりません" msgid "Address type out of range" msgstr "address_typeが範囲外" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "All CAN peripherals are in use" +msgstr "" + #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "全てのI2C周辺機器が使用中" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "All RX FIFOs in use" msgstr "全てのRX FIFOが使用中" @@ -415,6 +420,10 @@ msgstr "" "オートリロードがオンです。ファイルをUSB経由で保存するだけで実行できます。REPL" "に入ると無効化します。\n" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "Baudrate not supported by peripheral" +msgstr "" + #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" @@ -787,7 +796,7 @@ msgstr "方向がinputのときドライブモードは使われません" msgid "ECB only operates on 16 bytes at a time" msgstr "ECBは一度に16バイトの演算のみを行います" -#: ports/esp32s2/common-hal/busio/SPI.c +#: ports/esp32s2/common-hal/busio/SPI.c ports/esp32s2/common-hal/canio/CAN.c msgid "ESP-IDF memory allocation failed" msgstr "" @@ -913,6 +922,7 @@ msgid "File exists" msgstr "ファイルが存在します" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "Filters too complex" msgstr "" @@ -1133,7 +1143,7 @@ msgstr "右チャネルのピンが不正" #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c #: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/SPI.c -#: ports/esp32s2/common-hal/busio/UART.c +#: ports/esp32s2/common-hal/busio/UART.c ports/esp32s2/common-hal/canio/CAN.c #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c @@ -2866,6 +2876,10 @@ msgstr "" msgid "long int not supported in this build" msgstr "このビルドはlong intに非対応" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "loopback + silent mode not supported by peripheral" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "不正な形式のf-string" @@ -3220,6 +3234,8 @@ msgstr "pow()の第3引数には整数が必要" #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wrover/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h msgid "pressing boot button at start up.\n" @@ -3476,6 +3492,16 @@ msgstr "" msgid "tuple/list has wrong length" msgstr "タプル/リストの長さが正しくありません" +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_driver_install returned esp-idf error #%d" +msgstr "" + +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_start returned esp-idf error #%d" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: shared-bindings/busio/UART.c shared-bindings/canio/CAN.c diff --git a/locale/ko.po b/locale/ko.po index e5b728b846f11..858a036c835f9 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 19:50-0500\n" +"POT-Creation-Date: 2020-10-21 20:13-0500\n" "PO-Revision-Date: 2020-10-05 12:12+0000\n" "Last-Translator: Michal Čihař \n" "Language-Team: LANGUAGE \n" @@ -290,11 +290,16 @@ msgstr "" msgid "Address type out of range" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "All CAN peripherals are in use" +msgstr "" + #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "사용중인 모든 I2C주변 기기" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "All RX FIFOs in use" msgstr "" @@ -411,6 +416,10 @@ msgstr "" "자동 새로 고침이 켜져 있습니다. USB를 통해 파일을 저장하여 실행하십시오. 비활" "성화하려면 REPL을 입력하십시오.\n" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "Baudrate not supported by peripheral" +msgstr "" + #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" @@ -779,7 +788,7 @@ msgstr "" msgid "ECB only operates on 16 bytes at a time" msgstr "" -#: ports/esp32s2/common-hal/busio/SPI.c +#: ports/esp32s2/common-hal/busio/SPI.c ports/esp32s2/common-hal/canio/CAN.c msgid "ESP-IDF memory allocation failed" msgstr "" @@ -905,6 +914,7 @@ msgid "File exists" msgstr "" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "Filters too complex" msgstr "" @@ -1123,7 +1133,7 @@ msgstr "오른쪽 채널 핀이 잘못되었습니다" #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c #: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/SPI.c -#: ports/esp32s2/common-hal/busio/UART.c +#: ports/esp32s2/common-hal/busio/UART.c ports/esp32s2/common-hal/canio/CAN.c #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c @@ -2842,6 +2852,10 @@ msgstr "" msgid "long int not supported in this build" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "loopback + silent mode not supported by peripheral" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "" @@ -3194,6 +3208,8 @@ msgstr "" #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wrover/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h msgid "pressing boot button at start up.\n" @@ -3449,6 +3465,16 @@ msgstr "" msgid "tuple/list has wrong length" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_driver_install returned esp-idf error #%d" +msgstr "" + +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_start returned esp-idf error #%d" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: shared-bindings/busio/UART.c shared-bindings/canio/CAN.c diff --git a/locale/nl.po b/locale/nl.po index 234bb930aeaf4..bf05abb721f78 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 19:50-0500\n" +"POT-Creation-Date: 2020-10-21 20:13-0500\n" "PO-Revision-Date: 2020-10-27 16:47+0000\n" "Last-Translator: Jelle Jager \n" "Language-Team: none\n" @@ -292,11 +292,16 @@ msgstr "Adres moet %d bytes lang zijn" msgid "Address type out of range" msgstr "Adres type buiten bereik" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "All CAN peripherals are in use" +msgstr "" + #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "Alle I2C peripherals zijn in gebruik" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "All RX FIFOs in use" msgstr "Alle RX FIFO's zijn in gebruik" @@ -413,6 +418,10 @@ msgstr "" "Auto-herlaad staat aan. Sla bestanden simpelweg op over USB om uit te voeren " "of start REPL om uit te schakelen.\n" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "Baudrate not supported by peripheral" +msgstr "" + #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" @@ -787,7 +796,7 @@ msgstr "Drive modus niet gebruikt als de richting input is." msgid "ECB only operates on 16 bytes at a time" msgstr "ECB werkt alleen met 16 bytes tegelijkertijd" -#: ports/esp32s2/common-hal/busio/SPI.c +#: ports/esp32s2/common-hal/busio/SPI.c ports/esp32s2/common-hal/canio/CAN.c msgid "ESP-IDF memory allocation failed" msgstr "ESP-IDF geheugen toewijzing mislukt" @@ -913,6 +922,7 @@ msgid "File exists" msgstr "Bestand bestaat" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "Filters too complex" msgstr "Filters zijn te complex" @@ -1135,7 +1145,7 @@ msgstr "Ongeldige pin voor rechter kanaal" #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c #: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/SPI.c -#: ports/esp32s2/common-hal/busio/UART.c +#: ports/esp32s2/common-hal/busio/UART.c ports/esp32s2/common-hal/canio/CAN.c #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c @@ -2900,6 +2910,10 @@ msgstr "verwijzing naar een (nog) niet toegewezen lokale variabele" msgid "long int not supported in this build" msgstr "long int wordt niet ondersteund in deze build" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "loopback + silent mode not supported by peripheral" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "onjuist gevormde f-string" @@ -3253,6 +3267,8 @@ msgstr "pow() met 3 argumenten vereist integers" #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wrover/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h msgid "pressing boot button at start up.\n" @@ -3510,6 +3526,16 @@ msgstr "tuple index buiten bereik" msgid "tuple/list has wrong length" msgstr "tuple of lijst heeft onjuiste lengte" +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_driver_install returned esp-idf error #%d" +msgstr "" + +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_start returned esp-idf error #%d" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: shared-bindings/busio/UART.c shared-bindings/canio/CAN.c diff --git a/locale/pl.po b/locale/pl.po index cadb2c43ebd36..1dbb0ba12ba6c 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 19:50-0500\n" +"POT-Creation-Date: 2020-10-21 20:13-0500\n" "PO-Revision-Date: 2020-09-29 01:39+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" @@ -294,11 +294,16 @@ msgstr "Adres musi mieć %d bajtów" msgid "Address type out of range" msgstr "" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "All CAN peripherals are in use" +msgstr "" + #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "Wszystkie peryferia I2C w użyciu" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "All RX FIFOs in use" msgstr "" @@ -415,6 +420,10 @@ msgstr "" "Samo-przeładowywanie włączone. Po prostu zapisz pliki przez USB aby je " "uruchomić, albo wejdź w konsolę aby wyłączyć.\n" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "Baudrate not supported by peripheral" +msgstr "" + #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" @@ -787,7 +796,7 @@ msgstr "Tryb sterowania nieużywany w trybie wejścia." msgid "ECB only operates on 16 bytes at a time" msgstr "ECB działa tylko na 16 bajtach naraz" -#: ports/esp32s2/common-hal/busio/SPI.c +#: ports/esp32s2/common-hal/busio/SPI.c ports/esp32s2/common-hal/canio/CAN.c msgid "ESP-IDF memory allocation failed" msgstr "" @@ -913,6 +922,7 @@ msgid "File exists" msgstr "Plik istnieje" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "Filters too complex" msgstr "" @@ -1133,7 +1143,7 @@ msgstr "Zła nóżka dla prawego kanału" #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c #: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/SPI.c -#: ports/esp32s2/common-hal/busio/UART.c +#: ports/esp32s2/common-hal/busio/UART.c ports/esp32s2/common-hal/canio/CAN.c #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c @@ -2859,6 +2869,10 @@ msgstr "zmienna lokalna użyta przed przypisaniem" msgid "long int not supported in this build" msgstr "long int jest nieobsługiwany" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "loopback + silent mode not supported by peripheral" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "" @@ -3212,6 +3226,8 @@ msgstr "trzyargumentowe pow() wymaga liczb całkowitych" #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wrover/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h msgid "pressing boot button at start up.\n" @@ -3468,6 +3484,16 @@ msgstr "indeks krotki poza zakresem" msgid "tuple/list has wrong length" msgstr "krotka/lista ma złą długość" +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_driver_install returned esp-idf error #%d" +msgstr "" + +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_start returned esp-idf error #%d" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: shared-bindings/busio/UART.c shared-bindings/canio/CAN.c diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 16631c32a7b69..8696d7509a2c8 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 19:50-0500\n" +"POT-Creation-Date: 2020-10-21 20:13-0500\n" "PO-Revision-Date: 2020-10-27 21:01+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -296,11 +296,16 @@ msgstr "O endereço deve ter %d bytes de comprimento" msgid "Address type out of range" msgstr "O tipo do endereço está fora do alcance" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "All CAN peripherals are in use" +msgstr "" + #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "Todos os periféricos I2C estão em uso" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "All RX FIFOs in use" msgstr "Todos os FIFOs RX estão em uso" @@ -419,6 +424,10 @@ msgstr "" "O recarregamento automático está ativo. Simplesmente salve os arquivos via " "USB para executá-los ou digite REPL para desativar.\n" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "Baudrate not supported by peripheral" +msgstr "" + #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" @@ -796,7 +805,7 @@ msgstr "O modo do controlador não é usado quando a direção for inserida." msgid "ECB only operates on 16 bytes at a time" msgstr "O BCE opera apenas com 16 bytes por vez" -#: ports/esp32s2/common-hal/busio/SPI.c +#: ports/esp32s2/common-hal/busio/SPI.c ports/esp32s2/common-hal/canio/CAN.c msgid "ESP-IDF memory allocation failed" msgstr "Houve uma falha na alocação da memória ESP-IDF" @@ -922,6 +931,7 @@ msgid "File exists" msgstr "Arquivo já existe" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "Filters too complex" msgstr "Os filtros são muito complexos" @@ -1144,7 +1154,7 @@ msgstr "Pino inválido para canal direito" #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c #: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/SPI.c -#: ports/esp32s2/common-hal/busio/UART.c +#: ports/esp32s2/common-hal/busio/UART.c ports/esp32s2/common-hal/canio/CAN.c #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c @@ -2920,6 +2930,10 @@ msgstr "a variável local referenciada antes da atribuição" msgid "long int not supported in this build" msgstr "o long int não é suportado nesta compilação" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "loopback + silent mode not supported by peripheral" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "f-string malformado" @@ -3279,6 +3293,8 @@ msgstr "o pow() com 3 argumentos requer números inteiros" #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wrover/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h msgid "pressing boot button at start up.\n" @@ -3536,6 +3552,16 @@ msgstr "o índice da tupla está fora do intervalo" msgid "tuple/list has wrong length" msgstr "a tupla/lista está com tamanho incorreto" +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_driver_install returned esp-idf error #%d" +msgstr "" + +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_start returned esp-idf error #%d" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: shared-bindings/busio/UART.c shared-bindings/canio/CAN.c diff --git a/locale/sv.po b/locale/sv.po index f2fa50189b5e0..53ed60acae4e4 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 19:50-0500\n" +"POT-Creation-Date: 2020-10-21 20:13-0500\n" "PO-Revision-Date: 2020-10-26 02:36+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -292,11 +292,16 @@ msgstr "Adressen måste vara %d byte lång" msgid "Address type out of range" msgstr "Adresstyp utanför intervallet" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "All CAN peripherals are in use" +msgstr "" + #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "All I2C-kringutrustning används" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "All RX FIFOs in use" msgstr "Alla RX FIFO i bruk" @@ -413,6 +418,10 @@ msgstr "" "Autoladdning är på. Spara bara filer via USB för att köra dem eller ange " "REPL för att inaktivera.\n" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "Baudrate not supported by peripheral" +msgstr "" + #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" @@ -787,7 +796,7 @@ msgstr "Drivläge används inte när riktning är input." msgid "ECB only operates on 16 bytes at a time" msgstr "ECB arbetar endast på 16 byte åt gången" -#: ports/esp32s2/common-hal/busio/SPI.c +#: ports/esp32s2/common-hal/busio/SPI.c ports/esp32s2/common-hal/canio/CAN.c msgid "ESP-IDF memory allocation failed" msgstr "ESP-IDF-minnetilldelning misslyckades" @@ -913,6 +922,7 @@ msgid "File exists" msgstr "Filen finns redan" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "Filters too complex" msgstr "Filter för komplexa" @@ -1133,7 +1143,7 @@ msgstr "Ogiltig pinne för höger kanal" #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c #: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/SPI.c -#: ports/esp32s2/common-hal/busio/UART.c +#: ports/esp32s2/common-hal/busio/UART.c ports/esp32s2/common-hal/canio/CAN.c #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c @@ -2893,6 +2903,10 @@ msgstr "lokal variabel refererad före tilldelning" msgid "long int not supported in this build" msgstr "long int stöds inte i denna build" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "loopback + silent mode not supported by peripheral" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "f-sträng har felaktigt format" @@ -3246,6 +3260,8 @@ msgstr "pow() med 3 argument kräver heltal" #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wrover/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h msgid "pressing boot button at start up.\n" @@ -3503,6 +3519,16 @@ msgstr "tupelindex utanför intervallet" msgid "tuple/list has wrong length" msgstr "tupel/lista har fel längd" +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_driver_install returned esp-idf error #%d" +msgstr "" + +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_start returned esp-idf error #%d" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: shared-bindings/busio/UART.c shared-bindings/canio/CAN.c diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 5ed34cc6c3688..9b32993eb0540 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-16 19:50-0500\n" +"POT-Creation-Date: 2020-10-21 20:13-0500\n" "PO-Revision-Date: 2020-10-22 20:48+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -294,11 +294,16 @@ msgstr "Dìzhǐ bìxū shì %d zì jié zhǎng" msgid "Address type out of range" msgstr "Dìzhǐ lèixíng chāochū fànwéi" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "All CAN peripherals are in use" +msgstr "" + #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "Suǒyǒu I2C wàiwéi qì zhèngzài shǐyòng" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "All RX FIFOs in use" msgstr "Suǒyǒu shǐyòng zhōng de RX FIFO" @@ -415,6 +420,10 @@ msgstr "" "Zìdòng chóngxīn jiāzài. Zhǐ xū tōngguò USB bǎocún wénjiàn lái yùnxíng tāmen " "huò shūrù REPL jìnyòng.\n" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "Baudrate not supported by peripheral" +msgstr "" + #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" @@ -785,7 +794,7 @@ msgstr "Fāngxiàng shūrù shí qūdòng móshì méiyǒu shǐyòng." msgid "ECB only operates on 16 bytes at a time" msgstr "ECB yí cì zhǐ shǐ yòng 16 gè zì jié" -#: ports/esp32s2/common-hal/busio/SPI.c +#: ports/esp32s2/common-hal/busio/SPI.c ports/esp32s2/common-hal/canio/CAN.c msgid "ESP-IDF memory allocation failed" msgstr "ESP-IDF nèicún fēnpèi shībài" @@ -911,6 +920,7 @@ msgid "File exists" msgstr "Wénjiàn cúnzài" #: ports/atmel-samd/common-hal/canio/Listener.c +#: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "Filters too complex" msgstr "guò lǜ qì tài fù zá" @@ -1131,7 +1141,7 @@ msgstr "Yòuxián tōngdào yǐn jiǎo wúxiào" #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c #: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/SPI.c -#: ports/esp32s2/common-hal/busio/UART.c +#: ports/esp32s2/common-hal/busio/UART.c ports/esp32s2/common-hal/canio/CAN.c #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c @@ -2883,6 +2893,10 @@ msgstr "fùzhí qián yǐnyòng de júbù biànliàng" msgid "long int not supported in this build" msgstr "cǐ bǎnběn bù zhīchí zhǎng zhěngshù" +#: ports/esp32s2/common-hal/canio/CAN.c +msgid "loopback + silent mode not supported by peripheral" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "jīxíng de f-string" @@ -3235,6 +3249,8 @@ msgstr "pow() yǒu 3 cānshù xūyào zhěngshù" #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h +#: ports/esp32s2/boards/targett_module_clip_wrover/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h msgid "pressing boot button at start up.\n" @@ -3492,6 +3508,16 @@ msgstr "yuán zǔ suǒyǐn chāochū fànwéi" msgid "tuple/list has wrong length" msgstr "yuán zǔ/lièbiǎo chángdù cuòwù" +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_driver_install returned esp-idf error #%d" +msgstr "" + +#: ports/esp32s2/common-hal/canio/CAN.c +#, c-format +msgid "twai_start returned esp-idf error #%d" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: shared-bindings/busio/UART.c shared-bindings/canio/CAN.c From d0426b3438a934257c5351f7eb2d9cdd79881c03 Mon Sep 17 00:00:00 2001 From: Noel Gaetan Date: Tue, 27 Oct 2020 23:54:46 +0100 Subject: [PATCH 058/770] Update pins.c fix mistake --- ports/nrf/boards/holyiot_nrf52840/pins.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/nrf/boards/holyiot_nrf52840/pins.c b/ports/nrf/boards/holyiot_nrf52840/pins.c index 4e2593e58f970..cdec4dfa8ec3a 100644 --- a/ports/nrf/boards/holyiot_nrf52840/pins.c +++ b/ports/nrf/boards/holyiot_nrf52840/pins.c @@ -51,9 +51,9 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_P0_21), MP_ROM_PTR(&pin_P0_21) }, { MP_ROM_QSTR(MP_QSTR_P0_19), MP_ROM_PTR(&pin_P0_19) }, - // RESET { MP_ROM_QSTR(MP_QSTR_P0_18), MP_ROM_PTR(&pin_P0_18) }, + // RESET { MP_ROM_QSTR(MP_QSTR_P0_18), MP_ROM_PTR(&pin_P0_18) } }; -MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); \ No newline at end of file +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 90b9ec6f2ce840885492f125f8c473df8bd67337 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Fri, 18 Sep 2020 17:40:49 +0530 Subject: [PATCH 059/770] Initial Sleep Support --- .../common-hal/microcontroller/__init__.c | 6 ++++ ports/esp32s2/common-hal/timealarm/__init__.c | 10 ++++++ ports/esp32s2/mpconfigport.mk | 1 + py/circuitpy_defns.mk | 4 +++ py/circuitpy_mpconfig.h | 8 +++++ py/circuitpy_mpconfig.mk | 3 ++ shared-bindings/microcontroller/__init__.c | 17 ++++++++++ shared-bindings/microcontroller/__init__.h | 2 ++ shared-bindings/timealarm/__init__.c | 31 +++++++++++++++++++ shared-bindings/timealarm/__init__.h | 8 +++++ 10 files changed, 90 insertions(+) create mode 100644 ports/esp32s2/common-hal/timealarm/__init__.c create mode 100644 shared-bindings/timealarm/__init__.c create mode 100644 shared-bindings/timealarm/__init__.h diff --git a/ports/esp32s2/common-hal/microcontroller/__init__.c b/ports/esp32s2/common-hal/microcontroller/__init__.c index 6b2e18673db1d..2fcc2ceda1716 100644 --- a/ports/esp32s2/common-hal/microcontroller/__init__.c +++ b/ports/esp32s2/common-hal/microcontroller/__init__.c @@ -41,6 +41,8 @@ #include "freertos/FreeRTOS.h" +#include "esp_sleep.h" + void common_hal_mcu_delay_us(uint32_t delay) { } @@ -77,6 +79,10 @@ void common_hal_mcu_reset(void) { while(1); } +void common_hal_mcu_sleep(void) { + esp_deep_sleep_start(); +} + // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/ports/esp32s2/common-hal/timealarm/__init__.c b/ports/esp32s2/common-hal/timealarm/__init__.c new file mode 100644 index 0000000000000..e404f801a6930 --- /dev/null +++ b/ports/esp32s2/common-hal/timealarm/__init__.c @@ -0,0 +1,10 @@ +#include "esp_sleep.h" + +#include "shared-bindings/timealarm/__init__.h" + +void common_hal_timealarm_duration (uint32_t ms) { + if (esp_sleep_enable_timer_wakeup((ms) * 1000) == ESP_ERR_INVALID_ARG) { + mp_raise_ValueError(translate("time out of range")); + } +} + diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index c06c89c909337..125d078e8adb6 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -22,6 +22,7 @@ CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_NVM = 0 +CIRCUITPY_TIMEALARM = 1 # We don't have enough endpoints to include MIDI. CIRCUITPY_USB_MIDI = 0 CIRCUITPY_WIFI = 1 diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index ccdf973e9fb5c..91af6ffc15e8d 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -259,6 +259,9 @@ endif ifeq ($(CIRCUITPY_TIME),1) SRC_PATTERNS += time/% endif +ifeq ($(CIRCUITPY_TIMEALARM),1) +SRC_PATTERNS += timealarm/% +endif ifeq ($(CIRCUITPY_TOUCHIO),1) SRC_PATTERNS += touchio/% endif @@ -360,6 +363,7 @@ SRC_COMMON_HAL_ALL = \ ssl/SSLContext.c \ supervisor/Runtime.c \ supervisor/__init__.c \ + timealarm/__init__.c \ watchdog/WatchDogMode.c \ watchdog/WatchDogTimer.c \ watchdog/__init__.c \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 1e01bd9c5e0b6..8efd439212a70 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -663,6 +663,13 @@ extern const struct _mp_obj_module_t time_module; #define TIME_MODULE_ALT_NAME #endif +#if CIRCUITPY_TIMEALARM +extern const struct _mp_obj_module_t timealarm_module; +#define TIMEALARM_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_timealarm), (mp_obj_t)&timealarm_module }, +#else +#define TIMEALARM_MODULE +#endif + #if CIRCUITPY_TOUCHIO extern const struct _mp_obj_module_t touchio_module; #define TOUCHIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_touchio), (mp_obj_t)&touchio_module }, @@ -821,6 +828,7 @@ extern const struct _mp_obj_module_t wifi_module; STRUCT_MODULE \ SUPERVISOR_MODULE \ TOUCHIO_MODULE \ + TIMEALARM_MODULE \ UHEAP_MODULE \ USB_HID_MODULE \ USB_MIDI_MODULE \ diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index a6aabec33d18f..bb70daccc79c0 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -234,6 +234,9 @@ CFLAGS += -DCIRCUITPY_TERMINALIO=$(CIRCUITPY_TERMINALIO) CIRCUITPY_TIME ?= 1 CFLAGS += -DCIRCUITPY_TIME=$(CIRCUITPY_TIME) +CIRCUITPY_TIMEALARM ?= 0 +CFLAGS += -DCIRCUITPY_TIMEALARM=$(CIRCUITPY_TIMEALARM) + # touchio might be native or generic. See circuitpy_defns.mk. CIRCUITPY_TOUCHIO_USE_NATIVE ?= 0 CFLAGS += -DCIRCUITPY_TOUCHIO_USE_NATIVE=$(CIRCUITPY_TOUCHIO_USE_NATIVE) diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index 2e58bdcc290f0..b8ca8f18ba753 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -136,6 +136,22 @@ STATIC mp_obj_t mcu_reset(void) { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_reset_obj, mcu_reset); +//| def sleep() -> None: +//| """Microcontroller will go into deep sleep. +//| cpy will restart when wakeup func. is triggered`. +//| +//| .. warning:: This may result in file system corruption when connected to a +//| host computer. Be very careful when calling this! Make sure the device +//| "Safely removed" on Windows or "ejected" on Mac OSX and Linux.""" +//| ... +//| +STATIC mp_obj_t mcu_sleep(void) { + common_hal_mcu_sleep(); + // We won't actually get here because mcu is going into sleep. + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_sleep_obj, mcu_sleep); + //| nvm: Optional[ByteArray] //| """Available non-volatile memory. //| This object is the sole instance of `nvm.ByteArray` when available or ``None`` otherwise. @@ -171,6 +187,7 @@ STATIC const mp_rom_map_elem_t mcu_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_enable_interrupts), MP_ROM_PTR(&mcu_enable_interrupts_obj) }, { MP_ROM_QSTR(MP_QSTR_on_next_reset), MP_ROM_PTR(&mcu_on_next_reset_obj) }, { MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&mcu_reset_obj) }, + { MP_ROM_QSTR(MP_QSTR_sleep), MP_ROM_PTR(&mcu_sleep_obj) }, #if CIRCUITPY_INTERNAL_NVM_SIZE > 0 { MP_ROM_QSTR(MP_QSTR_nvm), MP_ROM_PTR(&common_hal_mcu_nvm_obj) }, #else diff --git a/shared-bindings/microcontroller/__init__.h b/shared-bindings/microcontroller/__init__.h index 8abdff763c1ff..b0f61e64b9185 100644 --- a/shared-bindings/microcontroller/__init__.h +++ b/shared-bindings/microcontroller/__init__.h @@ -43,6 +43,8 @@ extern void common_hal_mcu_enable_interrupts(void); extern void common_hal_mcu_on_next_reset(mcu_runmode_t runmode); extern void common_hal_mcu_reset(void); +extern void common_hal_mcu_sleep(void); + extern const mp_obj_dict_t mcu_pin_globals; extern const mcu_processor_obj_t common_hal_mcu_processor_obj; diff --git a/shared-bindings/timealarm/__init__.c b/shared-bindings/timealarm/__init__.c new file mode 100644 index 0000000000000..19fb4f093a374 --- /dev/null +++ b/shared-bindings/timealarm/__init__.c @@ -0,0 +1,31 @@ +#include "py/obj.h" +#include "shared-bindings/timealarm/__init__.h" + +//| Set Timer Wakeup +//| +STATIC mp_obj_t timealarm_duration(mp_obj_t seconds_o) { + #if MICROPY_PY_BUILTINS_FLOAT + mp_float_t seconds = mp_obj_get_float(seconds_o); + mp_float_t msecs = 1000.0f * seconds + 0.5f; + #else + 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_timealarm_duration(msecs); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(timealarm_duration_obj, timealarm_duration); + +STATIC const mp_rom_map_elem_t timealarm_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_timealarm) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_duration), MP_ROM_PTR(&timealarm_duration_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(timealarm_module_globals, timealarm_module_globals_table); + +const mp_obj_module_t timealarm_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&timealarm_module_globals, +}; diff --git a/shared-bindings/timealarm/__init__.h b/shared-bindings/timealarm/__init__.h new file mode 100644 index 0000000000000..b70cbda1f27e9 --- /dev/null +++ b/shared-bindings/timealarm/__init__.h @@ -0,0 +1,8 @@ +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ulp___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_ulp___INIT___H + +#include "py/runtime.h" + +extern void common_hal_timealarm_duration(uint32_t); + +#endif \ No newline at end of file From 3a30887b444c6c17f116abd85308251486c9dfe9 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Fri, 18 Sep 2020 17:59:18 +0530 Subject: [PATCH 060/770] Update soft reboot message --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index b43b3b8c806bb..ebce8cd4035f7 100755 --- a/main.c +++ b/main.c @@ -509,7 +509,7 @@ int __attribute__((used)) main(void) { } if (exit_code == PYEXEC_FORCED_EXIT) { if (!first_run) { - serial_write_compressed(translate("soft reboot\n")); + serial_write_compressed(translate("\n\n ----- soft reboot -----\n")); } first_run = false; skip_repl = run_code_py(safe_mode); From e310b871c8eb8cf924e6937edc7cd51a2be1a6b7 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Sat, 19 Sep 2020 17:48:36 +0530 Subject: [PATCH 061/770] Get io wake working --- main.c | 2 +- ports/esp32s2/common-hal/io_alarm/__init__.c | 27 +++++++++++++++ .../{timealarm => time_alarm}/__init__.c | 4 +-- ports/esp32s2/mpconfigport.mk | 3 +- py/circuitpy_defns.mk | 10 ++++-- py/circuitpy_mpconfig.h | 18 +++++++--- py/circuitpy_mpconfig.mk | 7 ++-- shared-bindings/io_alarm/__init__.c | 34 +++++++++++++++++++ shared-bindings/io_alarm/__init__.h | 8 +++++ shared-bindings/time_alarm/__init__.c | 31 +++++++++++++++++ shared-bindings/time_alarm/__init__.h | 8 +++++ shared-bindings/timealarm/__init__.c | 31 ----------------- shared-bindings/timealarm/__init__.h | 8 ----- 13 files changed, 138 insertions(+), 53 deletions(-) create mode 100644 ports/esp32s2/common-hal/io_alarm/__init__.c rename ports/esp32s2/common-hal/{timealarm => time_alarm}/__init__.c (63%) create mode 100644 shared-bindings/io_alarm/__init__.c create mode 100644 shared-bindings/io_alarm/__init__.h create mode 100644 shared-bindings/time_alarm/__init__.c create mode 100644 shared-bindings/time_alarm/__init__.h delete mode 100644 shared-bindings/timealarm/__init__.c delete mode 100644 shared-bindings/timealarm/__init__.h diff --git a/main.c b/main.c index ebce8cd4035f7..5a30f4bb26cb7 100755 --- a/main.c +++ b/main.c @@ -509,7 +509,7 @@ int __attribute__((used)) main(void) { } if (exit_code == PYEXEC_FORCED_EXIT) { if (!first_run) { - serial_write_compressed(translate("\n\n ----- soft reboot -----\n")); + serial_write_compressed(translate("\n\n------ soft reboot ------\n")); } first_run = false; skip_repl = run_code_py(safe_mode); diff --git a/ports/esp32s2/common-hal/io_alarm/__init__.c b/ports/esp32s2/common-hal/io_alarm/__init__.c new file mode 100644 index 0000000000000..d88c147fe0972 --- /dev/null +++ b/ports/esp32s2/common-hal/io_alarm/__init__.c @@ -0,0 +1,27 @@ +#include "shared-bindings/io_alarm/__init__.h" + +#include "esp_sleep.h" +#include "driver/rtc_io.h" + +void common_hal_io_alarm_pin_state (uint8_t gpio, uint8_t level, bool pull) { + if (!rtc_gpio_is_valid_gpio(gpio)) { + mp_raise_ValueError(translate("io must be rtc io")); + return; + } + + switch(esp_sleep_enable_ext0_wakeup(gpio, level)) { + case ESP_ERR_INVALID_ARG: + mp_raise_ValueError(translate("trigger level must be 0 or 1")); + return; + case ESP_ERR_INVALID_STATE: + mp_raise_RuntimeError(translate("wakeup conflict")); + return; + default: + break; + } + + if (pull) { + (level) ? rtc_gpio_pulldown_en(gpio) : rtc_gpio_pullup_en(gpio); + } +} + diff --git a/ports/esp32s2/common-hal/timealarm/__init__.c b/ports/esp32s2/common-hal/time_alarm/__init__.c similarity index 63% rename from ports/esp32s2/common-hal/timealarm/__init__.c rename to ports/esp32s2/common-hal/time_alarm/__init__.c index e404f801a6930..342ca9d154096 100644 --- a/ports/esp32s2/common-hal/timealarm/__init__.c +++ b/ports/esp32s2/common-hal/time_alarm/__init__.c @@ -1,8 +1,8 @@ #include "esp_sleep.h" -#include "shared-bindings/timealarm/__init__.h" +#include "shared-bindings/time_alarm/__init__.h" -void common_hal_timealarm_duration (uint32_t ms) { +void common_hal_time_alarm_duration (uint32_t ms) { if (esp_sleep_enable_timer_wakeup((ms) * 1000) == ESP_ERR_INVALID_ARG) { mp_raise_ValueError(translate("time out of range")); } diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index 125d078e8adb6..0f8f3ada53628 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -22,7 +22,8 @@ CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_NVM = 0 -CIRCUITPY_TIMEALARM = 1 +CIRCUITPY_TIME_ALARM = 1 +CIRCUITPY_IO_ALARM = 1 # We don't have enough endpoints to include MIDI. CIRCUITPY_USB_MIDI = 0 CIRCUITPY_WIFI = 1 diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 91af6ffc15e8d..672eeda40cae5 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -259,8 +259,11 @@ endif ifeq ($(CIRCUITPY_TIME),1) SRC_PATTERNS += time/% endif -ifeq ($(CIRCUITPY_TIMEALARM),1) -SRC_PATTERNS += timealarm/% +ifeq ($(CIRCUITPY_TIME_ALARM),1) +SRC_PATTERNS += time_alarm/% +endif +ifeq ($(CIRCUITPY_IO_ALARM),1) +SRC_PATTERNS += io_alarm/% endif ifeq ($(CIRCUITPY_TOUCHIO),1) SRC_PATTERNS += touchio/% @@ -363,7 +366,8 @@ SRC_COMMON_HAL_ALL = \ ssl/SSLContext.c \ supervisor/Runtime.c \ supervisor/__init__.c \ - timealarm/__init__.c \ + time_alarm/__init__.c \ + io_alarm/__init__.c \ watchdog/WatchDogMode.c \ watchdog/WatchDogTimer.c \ watchdog/__init__.c \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 8efd439212a70..d899ecacb6ac4 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -663,11 +663,18 @@ extern const struct _mp_obj_module_t time_module; #define TIME_MODULE_ALT_NAME #endif -#if CIRCUITPY_TIMEALARM -extern const struct _mp_obj_module_t timealarm_module; -#define TIMEALARM_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_timealarm), (mp_obj_t)&timealarm_module }, +#if CIRCUITPY_TIME_ALARM +extern const struct _mp_obj_module_t time_alarm_module; +#define TIME_ALARM_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_time_alarm), (mp_obj_t)&time_alarm_module }, #else -#define TIMEALARM_MODULE +#define TIME_ALARM_MODULE +#endif + +#if CIRCUITPY_IO_ALARM +extern const struct _mp_obj_module_t io_alarm_module; +#define IO_ALARM_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_io_alarm), (mp_obj_t)&io_alarm_module }, +#else +#define IO_ALARM_MODULE #endif #if CIRCUITPY_TOUCHIO @@ -828,7 +835,8 @@ extern const struct _mp_obj_module_t wifi_module; STRUCT_MODULE \ SUPERVISOR_MODULE \ TOUCHIO_MODULE \ - TIMEALARM_MODULE \ + TIME_ALARM_MODULE \ + IO_ALARM_MODULE \ UHEAP_MODULE \ USB_HID_MODULE \ USB_MIDI_MODULE \ diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index bb70daccc79c0..4cce2a0a1a49b 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -234,8 +234,11 @@ CFLAGS += -DCIRCUITPY_TERMINALIO=$(CIRCUITPY_TERMINALIO) CIRCUITPY_TIME ?= 1 CFLAGS += -DCIRCUITPY_TIME=$(CIRCUITPY_TIME) -CIRCUITPY_TIMEALARM ?= 0 -CFLAGS += -DCIRCUITPY_TIMEALARM=$(CIRCUITPY_TIMEALARM) +CIRCUITPY_TIME_ALARM ?= 0 +CFLAGS += -DCIRCUITPY_TIME_ALARM=$(CIRCUITPY_TIME_ALARM) + +CIRCUITPY_IO_ALARM ?= 0 +CFLAGS += -DCIRCUITPY_IO_ALARM=$(CIRCUITPY_IO_ALARM) # touchio might be native or generic. See circuitpy_defns.mk. CIRCUITPY_TOUCHIO_USE_NATIVE ?= 0 diff --git a/shared-bindings/io_alarm/__init__.c b/shared-bindings/io_alarm/__init__.c new file mode 100644 index 0000000000000..534b7e66f5b65 --- /dev/null +++ b/shared-bindings/io_alarm/__init__.c @@ -0,0 +1,34 @@ +#include "py/obj.h" + +#include "shared-bindings/io_alarm/__init__.h" +#include "shared-bindings/microcontroller/Pin.h" + +//| Set Timer Wakeup +//| +STATIC mp_obj_t io_alarm_pin_state(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_level, ARG_pull }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_level, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_pull, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_bool = false} }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + mcu_pin_obj_t *pin = validate_obj_is_pin(pos_args[0]); + common_hal_io_alarm_pin_state(pin->number, args[ARG_level].u_int, args[ARG_pull].u_bool); + + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(io_alarm_pin_state_obj, 1, io_alarm_pin_state); + +STATIC const mp_rom_map_elem_t io_alarm_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_io_alarm) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_PinState), MP_ROM_PTR(&io_alarm_pin_state_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(io_alarm_module_globals, io_alarm_module_globals_table); + +const mp_obj_module_t io_alarm_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&io_alarm_module_globals, +}; diff --git a/shared-bindings/io_alarm/__init__.h b/shared-bindings/io_alarm/__init__.h new file mode 100644 index 0000000000000..dd4b8816570ca --- /dev/null +++ b/shared-bindings/io_alarm/__init__.h @@ -0,0 +1,8 @@ +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_IO_ALARM___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_IO_ALARM___INIT___H + +#include "py/runtime.h" + +extern void common_hal_io_alarm_pin_state(uint8_t gpio, uint8_t level, bool pull); + +#endif //MICROPY_INCLUDED_SHARED_BINDINGS_IO_ALARM___INIT___H diff --git a/shared-bindings/time_alarm/__init__.c b/shared-bindings/time_alarm/__init__.c new file mode 100644 index 0000000000000..bfbece83c0b16 --- /dev/null +++ b/shared-bindings/time_alarm/__init__.c @@ -0,0 +1,31 @@ +#include "py/obj.h" +#include "shared-bindings/time_alarm/__init__.h" + +//| Set Timer Wakeup +//| +STATIC mp_obj_t time_alarm_duration(mp_obj_t seconds_o) { + #if MICROPY_PY_BUILTINS_FLOAT + mp_float_t seconds = mp_obj_get_float(seconds_o); + mp_float_t msecs = 1000.0f * seconds + 0.5f; + #else + 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_alarm_duration(msecs); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(time_alarm_duration_obj, time_alarm_duration); + +STATIC const mp_rom_map_elem_t time_alarm_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_time_alarm) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_Duration), MP_ROM_PTR(&time_alarm_duration_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(time_alarm_module_globals, time_alarm_module_globals_table); + +const mp_obj_module_t time_alarm_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&time_alarm_module_globals, +}; diff --git a/shared-bindings/time_alarm/__init__.h b/shared-bindings/time_alarm/__init__.h new file mode 100644 index 0000000000000..0913f7fded9ec --- /dev/null +++ b/shared-bindings/time_alarm/__init__.h @@ -0,0 +1,8 @@ +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_TIME_ALARM___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_TIME_ALARM___INIT___H + +#include "py/runtime.h" + +extern void common_hal_time_alarm_duration(uint32_t); + +#endif //MICROPY_INCLUDED_SHARED_BINDINGS_TIME_ALARM___INIT___H diff --git a/shared-bindings/timealarm/__init__.c b/shared-bindings/timealarm/__init__.c deleted file mode 100644 index 19fb4f093a374..0000000000000 --- a/shared-bindings/timealarm/__init__.c +++ /dev/null @@ -1,31 +0,0 @@ -#include "py/obj.h" -#include "shared-bindings/timealarm/__init__.h" - -//| Set Timer Wakeup -//| -STATIC mp_obj_t timealarm_duration(mp_obj_t seconds_o) { - #if MICROPY_PY_BUILTINS_FLOAT - mp_float_t seconds = mp_obj_get_float(seconds_o); - mp_float_t msecs = 1000.0f * seconds + 0.5f; - #else - 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_timealarm_duration(msecs); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(timealarm_duration_obj, timealarm_duration); - -STATIC const mp_rom_map_elem_t timealarm_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_timealarm) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_duration), MP_ROM_PTR(&timealarm_duration_obj) }, -}; -STATIC MP_DEFINE_CONST_DICT(timealarm_module_globals, timealarm_module_globals_table); - -const mp_obj_module_t timealarm_module = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t*)&timealarm_module_globals, -}; diff --git a/shared-bindings/timealarm/__init__.h b/shared-bindings/timealarm/__init__.h deleted file mode 100644 index b70cbda1f27e9..0000000000000 --- a/shared-bindings/timealarm/__init__.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ulp___INIT___H -#define MICROPY_INCLUDED_SHARED_BINDINGS_ulp___INIT___H - -#include "py/runtime.h" - -extern void common_hal_timealarm_duration(uint32_t); - -#endif \ No newline at end of file From 05a3f203dbaf53fbccd97395a90d025f2d3b9dc2 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Tue, 22 Sep 2020 23:45:38 +0530 Subject: [PATCH 062/770] Add function to get time elapsed during sleep --- .../common-hal/microcontroller/__init__.c | 46 +++++++++++++++++++ shared-bindings/microcontroller/__init__.c | 20 ++++++++ shared-bindings/microcontroller/__init__.h | 5 ++ 3 files changed, 71 insertions(+) diff --git a/ports/esp32s2/common-hal/microcontroller/__init__.c b/ports/esp32s2/common-hal/microcontroller/__init__.c index 2fcc2ceda1716..8b9fef2f98990 100644 --- a/ports/esp32s2/common-hal/microcontroller/__init__.c +++ b/ports/esp32s2/common-hal/microcontroller/__init__.c @@ -25,6 +25,8 @@ * THE SOFTWARE. */ +#include + #include "py/mphal.h" #include "py/obj.h" #include "py/runtime.h" @@ -42,6 +44,9 @@ #include "freertos/FreeRTOS.h" #include "esp_sleep.h" +#include "soc/rtc_periph.h" + +static RTC_DATA_ATTR struct timeval sleep_enter_time; void common_hal_mcu_delay_us(uint32_t delay) { @@ -80,9 +85,50 @@ void common_hal_mcu_reset(void) { } void common_hal_mcu_sleep(void) { + gettimeofday(&sleep_enter_time, NULL); esp_deep_sleep_start(); } +int common_hal_mcu_get_sleep_time(void) { + struct timeval now; + gettimeofday(&now, NULL); + return (now.tv_sec - sleep_enter_time.tv_sec) * 1000 + (now.tv_usec - sleep_enter_time.tv_usec) / 1000; +} + +mp_obj_t common_hal_mcu_get_wake_alarm(void) { + switch (esp_sleep_get_wakeup_cause()) { + case ESP_SLEEP_WAKEUP_TIMER: ; + //Wake up from timer. + time_alarm_obj_t *timer = m_new_obj(time_alarm_obj_t); + timer->base.type = &time_alarm_type; + return timer; + case ESP_SLEEP_WAKEUP_EXT0: ; + //Wake up from GPIO + io_alarm_obj_t *ext0 = m_new_obj(io_alarm_obj_t); + ext0->base.type = &io_alarm_type; + return ext0; + case ESP_SLEEP_WAKEUP_EXT1: + //Wake up from GPIO, returns -> esp_sleep_get_ext1_wakeup_status() + /*uint64_t wakeup_pin_mask = esp_sleep_get_ext1_wakeup_status(); + if (wakeup_pin_mask != 0) { + int pin = __builtin_ffsll(wakeup_pin_mask) - 1; + printf("Wake up from GPIO %d\n", pin); + } else { + printf("Wake up from GPIO\n"); + }*/ + break; + case ESP_SLEEP_WAKEUP_TOUCHPAD: + //TODO: implement TouchIO + //Wake up from touch on pad, returns -> esp_sleep_get_touchpad_wakeup_status() + break; + case ESP_SLEEP_WAKEUP_UNDEFINED: + default: + //Not a deep sleep reset + break; + } + return mp_const_none; +} + // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index b8ca8f18ba753..7b896d99b2e4d 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -152,6 +152,24 @@ STATIC mp_obj_t mcu_sleep(void) { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_sleep_obj, mcu_sleep); +//| def getWakeAlarm() -> None: +//| """This returns the alarm that triggered wakeup, +//| also returns alarm specific parameters`. +//| +STATIC mp_obj_t mcu_get_wake_alarm(void) { + return common_hal_mcu_get_wake_alarm(); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_get_wake_alarm_obj, mcu_get_wake_alarm); + +//| def getSleepTime() -> None: +//| """This returns the period of time in ms, +//| in which the board was in deep sleep`. +//| +STATIC mp_obj_t mcu_get_sleep_time(void) { + return mp_obj_new_int(common_hal_mcu_get_sleep_time()); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_get_sleep_time_obj, mcu_get_sleep_time); + //| nvm: Optional[ByteArray] //| """Available non-volatile memory. //| This object is the sole instance of `nvm.ByteArray` when available or ``None`` otherwise. @@ -188,6 +206,8 @@ STATIC const mp_rom_map_elem_t mcu_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_on_next_reset), MP_ROM_PTR(&mcu_on_next_reset_obj) }, { MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&mcu_reset_obj) }, { MP_ROM_QSTR(MP_QSTR_sleep), MP_ROM_PTR(&mcu_sleep_obj) }, + { MP_ROM_QSTR(MP_QSTR_getSleepTime), MP_ROM_PTR(&mcu_get_sleep_time_obj) }, + { MP_ROM_QSTR(MP_QSTR_getWakeAlarm), MP_ROM_PTR(&mcu_get_wake_alarm_obj) }, #if CIRCUITPY_INTERNAL_NVM_SIZE > 0 { MP_ROM_QSTR(MP_QSTR_nvm), MP_ROM_PTR(&common_hal_mcu_nvm_obj) }, #else diff --git a/shared-bindings/microcontroller/__init__.h b/shared-bindings/microcontroller/__init__.h index b0f61e64b9185..f0a3cee2df1b9 100644 --- a/shared-bindings/microcontroller/__init__.h +++ b/shared-bindings/microcontroller/__init__.h @@ -35,6 +35,9 @@ #include "shared-bindings/microcontroller/RunMode.h" +#include "shared-bindings/io_alarm/__init__.h" +#include "shared-bindings/time_alarm/__init__.h" + extern void common_hal_mcu_delay_us(uint32_t); extern void common_hal_mcu_disable_interrupts(void); @@ -44,6 +47,8 @@ extern void common_hal_mcu_on_next_reset(mcu_runmode_t runmode); extern void common_hal_mcu_reset(void); extern void common_hal_mcu_sleep(void); +extern int common_hal_mcu_get_sleep_time(void); +extern mp_obj_t common_hal_mcu_get_wake_alarm(void); extern const mp_obj_dict_t mcu_pin_globals; From 21ba61afbbdfbf1a693e9e136c645d970c0a7e9c Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Tue, 22 Sep 2020 23:47:10 +0530 Subject: [PATCH 063/770] Add function to disable alarm --- ports/esp32s2/common-hal/io_alarm/__init__.c | 20 +++++++------- .../esp32s2/common-hal/time_alarm/__init__.c | 3 +++ shared-bindings/io_alarm/__init__.c | 26 ++++++++++++++++--- shared-bindings/io_alarm/__init__.h | 11 +++++++- shared-bindings/time_alarm/__init__.c | 21 ++++++++++++++- shared-bindings/time_alarm/__init__.h | 7 +++++ 6 files changed, 73 insertions(+), 15 deletions(-) diff --git a/ports/esp32s2/common-hal/io_alarm/__init__.c b/ports/esp32s2/common-hal/io_alarm/__init__.c index d88c147fe0972..5d926d4e93d21 100644 --- a/ports/esp32s2/common-hal/io_alarm/__init__.c +++ b/ports/esp32s2/common-hal/io_alarm/__init__.c @@ -3,25 +3,25 @@ #include "esp_sleep.h" #include "driver/rtc_io.h" -void common_hal_io_alarm_pin_state (uint8_t gpio, uint8_t level, bool pull) { - if (!rtc_gpio_is_valid_gpio(gpio)) { - mp_raise_ValueError(translate("io must be rtc io")); - return; +mp_obj_t common_hal_io_alarm_pin_state (io_alarm_obj_t *self_in) { + if (!rtc_gpio_is_valid_gpio(self_in->gpio)) { + mp_raise_ValueError(translate("io must be rtc io")); } - switch(esp_sleep_enable_ext0_wakeup(gpio, level)) { + switch(esp_sleep_enable_ext0_wakeup(self_in->gpio, self_in->level)) { case ESP_ERR_INVALID_ARG: mp_raise_ValueError(translate("trigger level must be 0 or 1")); - return; case ESP_ERR_INVALID_STATE: mp_raise_RuntimeError(translate("wakeup conflict")); - return; default: break; } - if (pull) { - (level) ? rtc_gpio_pulldown_en(gpio) : rtc_gpio_pullup_en(gpio); - } + if (self_in->pull) { (self_in->level) ? rtc_gpio_pulldown_en(self_in->gpio) : rtc_gpio_pullup_en(self_in->gpio); } + + return self_in; } +void common_hal_io_alarm_disable (void) { + esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_EXT0 | ESP_SLEEP_WAKEUP_EXT1); +} diff --git a/ports/esp32s2/common-hal/time_alarm/__init__.c b/ports/esp32s2/common-hal/time_alarm/__init__.c index 342ca9d154096..a33376bb09f55 100644 --- a/ports/esp32s2/common-hal/time_alarm/__init__.c +++ b/ports/esp32s2/common-hal/time_alarm/__init__.c @@ -8,3 +8,6 @@ void common_hal_time_alarm_duration (uint32_t ms) { } } +void common_hal_time_alarm_disable (void) { + esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_TIMER); +} diff --git a/shared-bindings/io_alarm/__init__.c b/shared-bindings/io_alarm/__init__.c index 534b7e66f5b65..934b34e49d180 100644 --- a/shared-bindings/io_alarm/__init__.c +++ b/shared-bindings/io_alarm/__init__.c @@ -3,7 +3,7 @@ #include "shared-bindings/io_alarm/__init__.h" #include "shared-bindings/microcontroller/Pin.h" -//| Set Timer Wakeup +//| Set Pin Wakeup //| STATIC mp_obj_t io_alarm_pin_state(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_level, ARG_pull }; @@ -16,15 +16,30 @@ STATIC mp_obj_t io_alarm_pin_state(size_t n_args, const mp_obj_t *pos_args, mp_m mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); mcu_pin_obj_t *pin = validate_obj_is_pin(pos_args[0]); - common_hal_io_alarm_pin_state(pin->number, args[ARG_level].u_int, args[ARG_pull].u_bool); + io_alarm_obj_t *self = m_new_obj(io_alarm_obj_t); - return mp_const_none; + self->base.type = &io_alarm_type; + self->gpio = pin->number; + self->level = args[ARG_level].u_int; + self->pull = args[ARG_pull].u_bool; + + return common_hal_io_alarm_pin_state(self); } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(io_alarm_pin_state_obj, 1, io_alarm_pin_state); + +//| Disable Pin Wakeup +//| +STATIC mp_obj_t io_alarm_disable(void) { + common_hal_io_alarm_disable(); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(io_alarm_disable_obj, io_alarm_disable); + STATIC const mp_rom_map_elem_t io_alarm_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_io_alarm) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PinState), MP_ROM_PTR(&io_alarm_pin_state_obj) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_Disable), MP_ROM_PTR(&io_alarm_disable_obj) }, }; STATIC MP_DEFINE_CONST_DICT(io_alarm_module_globals, io_alarm_module_globals_table); @@ -32,3 +47,8 @@ const mp_obj_module_t io_alarm_module = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t*)&io_alarm_module_globals, }; + +const mp_obj_type_t io_alarm_type = { + { &mp_type_type }, + .name = MP_QSTR_ioAlarm, +}; diff --git a/shared-bindings/io_alarm/__init__.h b/shared-bindings/io_alarm/__init__.h index dd4b8816570ca..2b91f781d50c1 100644 --- a/shared-bindings/io_alarm/__init__.h +++ b/shared-bindings/io_alarm/__init__.h @@ -3,6 +3,15 @@ #include "py/runtime.h" -extern void common_hal_io_alarm_pin_state(uint8_t gpio, uint8_t level, bool pull); +typedef struct { + mp_obj_base_t base; + uint8_t gpio, level; + bool pull; +} io_alarm_obj_t; + +extern const mp_obj_type_t io_alarm_type; + +extern mp_obj_t common_hal_io_alarm_pin_state (io_alarm_obj_t *self_in); +extern void common_hal_io_alarm_disable (void); #endif //MICROPY_INCLUDED_SHARED_BINDINGS_IO_ALARM___INIT___H diff --git a/shared-bindings/time_alarm/__init__.c b/shared-bindings/time_alarm/__init__.c index bfbece83c0b16..e45c5239f1a16 100644 --- a/shared-bindings/time_alarm/__init__.c +++ b/shared-bindings/time_alarm/__init__.c @@ -11,17 +11,31 @@ STATIC mp_obj_t time_alarm_duration(mp_obj_t 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_alarm_duration(msecs); - return mp_const_none; + + time_alarm_obj_t *self = m_new_obj(time_alarm_obj_t); + self->base.type = &time_alarm_type; + + return self; } STATIC MP_DEFINE_CONST_FUN_OBJ_1(time_alarm_duration_obj, time_alarm_duration); +//| Disable Timer Wakeup +//| +STATIC mp_obj_t time_alarm_disable(void) { + common_hal_time_alarm_disable(); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(time_alarm_disable_obj, time_alarm_disable); + STATIC const mp_rom_map_elem_t time_alarm_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_time_alarm) }, { MP_OBJ_NEW_QSTR(MP_QSTR_Duration), MP_ROM_PTR(&time_alarm_duration_obj) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_Disable), MP_ROM_PTR(&time_alarm_disable_obj) }, }; STATIC MP_DEFINE_CONST_DICT(time_alarm_module_globals, time_alarm_module_globals_table); @@ -29,3 +43,8 @@ const mp_obj_module_t time_alarm_module = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t*)&time_alarm_module_globals, }; + +const mp_obj_type_t time_alarm_type = { + { &mp_type_type }, + .name = MP_QSTR_timeAlarm, +}; diff --git a/shared-bindings/time_alarm/__init__.h b/shared-bindings/time_alarm/__init__.h index 0913f7fded9ec..52b6e89ee2249 100644 --- a/shared-bindings/time_alarm/__init__.h +++ b/shared-bindings/time_alarm/__init__.h @@ -3,6 +3,13 @@ #include "py/runtime.h" +typedef struct { + mp_obj_base_t base; +} time_alarm_obj_t; + +extern const mp_obj_type_t time_alarm_type; + extern void common_hal_time_alarm_duration(uint32_t); +extern void common_hal_time_alarm_disable (void); #endif //MICROPY_INCLUDED_SHARED_BINDINGS_TIME_ALARM___INIT___H From e5ff55b15c8cc67c2ece3b8857b5805109b858b3 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 23 Sep 2020 12:54:07 +0530 Subject: [PATCH 064/770] Renamed alarm modules --- .../{io_alarm => alarm_io}/__init__.c | 6 +-- .../{time_alarm => alarm_time}/__init__.c | 6 +-- .../common-hal/microcontroller/__init__.c | 8 +-- ports/esp32s2/mpconfigport.mk | 4 +- py/circuitpy_defns.mk | 12 ++--- py/circuitpy_mpconfig.h | 20 +++---- py/circuitpy_mpconfig.mk | 8 +-- shared-bindings/alarm_io/__init__.c | 54 +++++++++++++++++++ shared-bindings/alarm_io/__init__.h | 17 ++++++ shared-bindings/alarm_time/__init__.c | 50 +++++++++++++++++ shared-bindings/alarm_time/__init__.h | 15 ++++++ shared-bindings/io_alarm/__init__.c | 54 ------------------- shared-bindings/io_alarm/__init__.h | 17 ------ shared-bindings/microcontroller/__init__.h | 4 +- shared-bindings/time_alarm/__init__.c | 50 ----------------- shared-bindings/time_alarm/__init__.h | 15 ------ 16 files changed, 170 insertions(+), 170 deletions(-) rename ports/esp32s2/common-hal/{io_alarm => alarm_io}/__init__.c (83%) rename ports/esp32s2/common-hal/{time_alarm => alarm_time}/__init__.c (62%) create mode 100644 shared-bindings/alarm_io/__init__.c create mode 100644 shared-bindings/alarm_io/__init__.h create mode 100644 shared-bindings/alarm_time/__init__.c create mode 100644 shared-bindings/alarm_time/__init__.h delete mode 100644 shared-bindings/io_alarm/__init__.c delete mode 100644 shared-bindings/io_alarm/__init__.h delete mode 100644 shared-bindings/time_alarm/__init__.c delete mode 100644 shared-bindings/time_alarm/__init__.h diff --git a/ports/esp32s2/common-hal/io_alarm/__init__.c b/ports/esp32s2/common-hal/alarm_io/__init__.c similarity index 83% rename from ports/esp32s2/common-hal/io_alarm/__init__.c rename to ports/esp32s2/common-hal/alarm_io/__init__.c index 5d926d4e93d21..9aa28f4156dea 100644 --- a/ports/esp32s2/common-hal/io_alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm_io/__init__.c @@ -1,9 +1,9 @@ -#include "shared-bindings/io_alarm/__init__.h" +#include "shared-bindings/alarm_io/__init__.h" #include "esp_sleep.h" #include "driver/rtc_io.h" -mp_obj_t common_hal_io_alarm_pin_state (io_alarm_obj_t *self_in) { +mp_obj_t common_hal_alarm_io_pin_state (alarm_io_obj_t *self_in) { if (!rtc_gpio_is_valid_gpio(self_in->gpio)) { mp_raise_ValueError(translate("io must be rtc io")); } @@ -22,6 +22,6 @@ mp_obj_t common_hal_io_alarm_pin_state (io_alarm_obj_t *self_in) { return self_in; } -void common_hal_io_alarm_disable (void) { +void common_hal_alarm_io_disable (void) { esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_EXT0 | ESP_SLEEP_WAKEUP_EXT1); } diff --git a/ports/esp32s2/common-hal/time_alarm/__init__.c b/ports/esp32s2/common-hal/alarm_time/__init__.c similarity index 62% rename from ports/esp32s2/common-hal/time_alarm/__init__.c rename to ports/esp32s2/common-hal/alarm_time/__init__.c index a33376bb09f55..fb601e6be009f 100644 --- a/ports/esp32s2/common-hal/time_alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm_time/__init__.c @@ -1,13 +1,13 @@ #include "esp_sleep.h" -#include "shared-bindings/time_alarm/__init__.h" +#include "shared-bindings/alarm_time/__init__.h" -void common_hal_time_alarm_duration (uint32_t ms) { +void common_hal_alarm_time_duration (uint32_t ms) { if (esp_sleep_enable_timer_wakeup((ms) * 1000) == ESP_ERR_INVALID_ARG) { mp_raise_ValueError(translate("time out of range")); } } -void common_hal_time_alarm_disable (void) { +void common_hal_alarm_time_disable (void) { esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_TIMER); } diff --git a/ports/esp32s2/common-hal/microcontroller/__init__.c b/ports/esp32s2/common-hal/microcontroller/__init__.c index 8b9fef2f98990..e79c602020f92 100644 --- a/ports/esp32s2/common-hal/microcontroller/__init__.c +++ b/ports/esp32s2/common-hal/microcontroller/__init__.c @@ -99,13 +99,13 @@ mp_obj_t common_hal_mcu_get_wake_alarm(void) { switch (esp_sleep_get_wakeup_cause()) { case ESP_SLEEP_WAKEUP_TIMER: ; //Wake up from timer. - time_alarm_obj_t *timer = m_new_obj(time_alarm_obj_t); - timer->base.type = &time_alarm_type; + alarm_time_obj_t *timer = m_new_obj(alarm_time_obj_t); + timer->base.type = &alarm_time_type; return timer; case ESP_SLEEP_WAKEUP_EXT0: ; //Wake up from GPIO - io_alarm_obj_t *ext0 = m_new_obj(io_alarm_obj_t); - ext0->base.type = &io_alarm_type; + alarm_io_obj_t *ext0 = m_new_obj(alarm_io_obj_t); + ext0->base.type = &alarm_io_type; return ext0; case ESP_SLEEP_WAKEUP_EXT1: //Wake up from GPIO, returns -> esp_sleep_get_ext1_wakeup_status() diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index 0f8f3ada53628..4aaf1d00c77aa 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -22,8 +22,8 @@ CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_NVM = 0 -CIRCUITPY_TIME_ALARM = 1 -CIRCUITPY_IO_ALARM = 1 +CIRCUITPY_ALARM_TIME = 1 +CIRCUITPY_ALARM_IO = 1 # We don't have enough endpoints to include MIDI. CIRCUITPY_USB_MIDI = 0 CIRCUITPY_WIFI = 1 diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 672eeda40cae5..4c571659362a2 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -259,11 +259,11 @@ endif ifeq ($(CIRCUITPY_TIME),1) SRC_PATTERNS += time/% endif -ifeq ($(CIRCUITPY_TIME_ALARM),1) -SRC_PATTERNS += time_alarm/% +ifeq ($(CIRCUITPY_ALARM_TIME),1) +SRC_PATTERNS += alarm_time/% endif -ifeq ($(CIRCUITPY_IO_ALARM),1) -SRC_PATTERNS += io_alarm/% +ifeq ($(CIRCUITPY_ALARM_IO),1) +SRC_PATTERNS += alarm_io/% endif ifeq ($(CIRCUITPY_TOUCHIO),1) SRC_PATTERNS += touchio/% @@ -366,8 +366,8 @@ SRC_COMMON_HAL_ALL = \ ssl/SSLContext.c \ supervisor/Runtime.c \ supervisor/__init__.c \ - time_alarm/__init__.c \ - io_alarm/__init__.c \ + alarm_time/__init__.c \ + alarm_io/__init__.c \ watchdog/WatchDogMode.c \ watchdog/WatchDogTimer.c \ watchdog/__init__.c \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index d899ecacb6ac4..94072f580be35 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -663,18 +663,18 @@ extern const struct _mp_obj_module_t time_module; #define TIME_MODULE_ALT_NAME #endif -#if CIRCUITPY_TIME_ALARM -extern const struct _mp_obj_module_t time_alarm_module; -#define TIME_ALARM_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_time_alarm), (mp_obj_t)&time_alarm_module }, +#if CIRCUITPY_ALARM_TIME +extern const struct _mp_obj_module_t alarm_time_module; +#define ALARM_TIME_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_alarm_time), (mp_obj_t)&alarm_time_module }, #else -#define TIME_ALARM_MODULE +#define ALARM_TIME_MODULE #endif -#if CIRCUITPY_IO_ALARM -extern const struct _mp_obj_module_t io_alarm_module; -#define IO_ALARM_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_io_alarm), (mp_obj_t)&io_alarm_module }, +#if CIRCUITPY_ALARM_IO +extern const struct _mp_obj_module_t alarm_io_module; +#define ALARM_IO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_alarm_io), (mp_obj_t)&alarm_io_module }, #else -#define IO_ALARM_MODULE +#define ALARM_IO_MODULE #endif #if CIRCUITPY_TOUCHIO @@ -835,8 +835,8 @@ extern const struct _mp_obj_module_t wifi_module; STRUCT_MODULE \ SUPERVISOR_MODULE \ TOUCHIO_MODULE \ - TIME_ALARM_MODULE \ - IO_ALARM_MODULE \ + ALARM_TIME_MODULE \ + ALARM_IO_MODULE \ UHEAP_MODULE \ USB_HID_MODULE \ USB_MIDI_MODULE \ diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 4cce2a0a1a49b..e8619347dd27f 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -234,11 +234,11 @@ CFLAGS += -DCIRCUITPY_TERMINALIO=$(CIRCUITPY_TERMINALIO) CIRCUITPY_TIME ?= 1 CFLAGS += -DCIRCUITPY_TIME=$(CIRCUITPY_TIME) -CIRCUITPY_TIME_ALARM ?= 0 -CFLAGS += -DCIRCUITPY_TIME_ALARM=$(CIRCUITPY_TIME_ALARM) +CIRCUITPY_ALARM_TIME ?= 0 +CFLAGS += -DCIRCUITPY_ALARM_TIME=$(CIRCUITPY_ALARM_TIME) -CIRCUITPY_IO_ALARM ?= 0 -CFLAGS += -DCIRCUITPY_IO_ALARM=$(CIRCUITPY_IO_ALARM) +CIRCUITPY_ALARM_IO ?= 0 +CFLAGS += -DCIRCUITPY_ALARM_IO=$(CIRCUITPY_ALARM_IO) # touchio might be native or generic. See circuitpy_defns.mk. CIRCUITPY_TOUCHIO_USE_NATIVE ?= 0 diff --git a/shared-bindings/alarm_io/__init__.c b/shared-bindings/alarm_io/__init__.c new file mode 100644 index 0000000000000..09783d0d0873a --- /dev/null +++ b/shared-bindings/alarm_io/__init__.c @@ -0,0 +1,54 @@ +#include "py/obj.h" + +#include "shared-bindings/alarm_io/__init__.h" +#include "shared-bindings/microcontroller/Pin.h" + +//| Set Pin Wakeup +//| +STATIC mp_obj_t alarm_io_pin_state(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_level, ARG_pull }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_level, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_pull, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_bool = false} }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + mcu_pin_obj_t *pin = validate_obj_is_pin(pos_args[0]); + alarm_io_obj_t *self = m_new_obj(alarm_io_obj_t); + + self->base.type = &alarm_io_type; + self->gpio = pin->number; + self->level = args[ARG_level].u_int; + self->pull = args[ARG_pull].u_bool; + + return common_hal_alarm_io_pin_state(self); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(alarm_io_pin_state_obj, 1, alarm_io_pin_state); + + +//| Disable Pin Wakeup +//| +STATIC mp_obj_t alarm_io_disable(void) { + common_hal_alarm_io_disable(); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(alarm_io_disable_obj, alarm_io_disable); + +STATIC const mp_rom_map_elem_t alarm_io_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_alarm_io) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_PinState), MP_ROM_PTR(&alarm_io_pin_state_obj) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_Disable), MP_ROM_PTR(&alarm_io_disable_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(alarm_io_module_globals, alarm_io_module_globals_table); + +const mp_obj_module_t alarm_io_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&alarm_io_module_globals, +}; + +const mp_obj_type_t alarm_io_type = { + { &mp_type_type }, + .name = MP_QSTR_ioAlarm, +}; diff --git a/shared-bindings/alarm_io/__init__.h b/shared-bindings/alarm_io/__init__.h new file mode 100644 index 0000000000000..0a53497c01f3e --- /dev/null +++ b/shared-bindings/alarm_io/__init__.h @@ -0,0 +1,17 @@ +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_IO___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_IO___INIT___H + +#include "py/runtime.h" + +typedef struct { + mp_obj_base_t base; + uint8_t gpio, level; + bool pull; +} alarm_io_obj_t; + +extern const mp_obj_type_t alarm_io_type; + +extern mp_obj_t common_hal_alarm_io_pin_state (alarm_io_obj_t *self_in); +extern void common_hal_alarm_io_disable (void); + +#endif //MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_IO___INIT___H diff --git a/shared-bindings/alarm_time/__init__.c b/shared-bindings/alarm_time/__init__.c new file mode 100644 index 0000000000000..22fb93506434d --- /dev/null +++ b/shared-bindings/alarm_time/__init__.c @@ -0,0 +1,50 @@ +#include "py/obj.h" +#include "shared-bindings/alarm_time/__init__.h" + +//| Set Timer Wakeup +//| +STATIC mp_obj_t alarm_time_duration(mp_obj_t seconds_o) { + #if MICROPY_PY_BUILTINS_FLOAT + mp_float_t seconds = mp_obj_get_float(seconds_o); + mp_float_t msecs = 1000.0f * seconds + 0.5f; + #else + 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_alarm_time_duration(msecs); + + alarm_time_obj_t *self = m_new_obj(alarm_time_obj_t); + self->base.type = &alarm_time_type; + + return self; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(alarm_time_duration_obj, alarm_time_duration); + +//| Disable Timer Wakeup +//| +STATIC mp_obj_t alarm_time_disable(void) { + common_hal_alarm_time_disable(); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(alarm_time_disable_obj, alarm_time_disable); + +STATIC const mp_rom_map_elem_t alarm_time_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_alarm_time) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_Duration), MP_ROM_PTR(&alarm_time_duration_obj) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_Disable), MP_ROM_PTR(&alarm_time_disable_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(alarm_time_module_globals, alarm_time_module_globals_table); + +const mp_obj_module_t alarm_time_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&alarm_time_module_globals, +}; + +const mp_obj_type_t alarm_time_type = { + { &mp_type_type }, + .name = MP_QSTR_timeAlarm, +}; diff --git a/shared-bindings/alarm_time/__init__.h b/shared-bindings/alarm_time/__init__.h new file mode 100644 index 0000000000000..d69aa5a4433ff --- /dev/null +++ b/shared-bindings/alarm_time/__init__.h @@ -0,0 +1,15 @@ +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME___INIT___H + +#include "py/runtime.h" + +typedef struct { + mp_obj_base_t base; +} alarm_time_obj_t; + +extern const mp_obj_type_t alarm_time_type; + +extern void common_hal_alarm_time_duration(uint32_t); +extern void common_hal_alarm_time_disable (void); + +#endif //MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME___INIT___H diff --git a/shared-bindings/io_alarm/__init__.c b/shared-bindings/io_alarm/__init__.c deleted file mode 100644 index 934b34e49d180..0000000000000 --- a/shared-bindings/io_alarm/__init__.c +++ /dev/null @@ -1,54 +0,0 @@ -#include "py/obj.h" - -#include "shared-bindings/io_alarm/__init__.h" -#include "shared-bindings/microcontroller/Pin.h" - -//| Set Pin Wakeup -//| -STATIC mp_obj_t io_alarm_pin_state(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_level, ARG_pull }; - static const mp_arg_t allowed_args[] = { - { MP_QSTR_level, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, - { MP_QSTR_pull, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_bool = false} }, - }; - - mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - - mcu_pin_obj_t *pin = validate_obj_is_pin(pos_args[0]); - io_alarm_obj_t *self = m_new_obj(io_alarm_obj_t); - - self->base.type = &io_alarm_type; - self->gpio = pin->number; - self->level = args[ARG_level].u_int; - self->pull = args[ARG_pull].u_bool; - - return common_hal_io_alarm_pin_state(self); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(io_alarm_pin_state_obj, 1, io_alarm_pin_state); - - -//| Disable Pin Wakeup -//| -STATIC mp_obj_t io_alarm_disable(void) { - common_hal_io_alarm_disable(); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(io_alarm_disable_obj, io_alarm_disable); - -STATIC const mp_rom_map_elem_t io_alarm_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_io_alarm) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_PinState), MP_ROM_PTR(&io_alarm_pin_state_obj) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_Disable), MP_ROM_PTR(&io_alarm_disable_obj) }, -}; -STATIC MP_DEFINE_CONST_DICT(io_alarm_module_globals, io_alarm_module_globals_table); - -const mp_obj_module_t io_alarm_module = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t*)&io_alarm_module_globals, -}; - -const mp_obj_type_t io_alarm_type = { - { &mp_type_type }, - .name = MP_QSTR_ioAlarm, -}; diff --git a/shared-bindings/io_alarm/__init__.h b/shared-bindings/io_alarm/__init__.h deleted file mode 100644 index 2b91f781d50c1..0000000000000 --- a/shared-bindings/io_alarm/__init__.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_IO_ALARM___INIT___H -#define MICROPY_INCLUDED_SHARED_BINDINGS_IO_ALARM___INIT___H - -#include "py/runtime.h" - -typedef struct { - mp_obj_base_t base; - uint8_t gpio, level; - bool pull; -} io_alarm_obj_t; - -extern const mp_obj_type_t io_alarm_type; - -extern mp_obj_t common_hal_io_alarm_pin_state (io_alarm_obj_t *self_in); -extern void common_hal_io_alarm_disable (void); - -#endif //MICROPY_INCLUDED_SHARED_BINDINGS_IO_ALARM___INIT___H diff --git a/shared-bindings/microcontroller/__init__.h b/shared-bindings/microcontroller/__init__.h index f0a3cee2df1b9..cd234fb033731 100644 --- a/shared-bindings/microcontroller/__init__.h +++ b/shared-bindings/microcontroller/__init__.h @@ -35,8 +35,8 @@ #include "shared-bindings/microcontroller/RunMode.h" -#include "shared-bindings/io_alarm/__init__.h" -#include "shared-bindings/time_alarm/__init__.h" +#include "shared-bindings/alarm_io/__init__.h" +#include "shared-bindings/alarm_time/__init__.h" extern void common_hal_mcu_delay_us(uint32_t); diff --git a/shared-bindings/time_alarm/__init__.c b/shared-bindings/time_alarm/__init__.c deleted file mode 100644 index e45c5239f1a16..0000000000000 --- a/shared-bindings/time_alarm/__init__.c +++ /dev/null @@ -1,50 +0,0 @@ -#include "py/obj.h" -#include "shared-bindings/time_alarm/__init__.h" - -//| Set Timer Wakeup -//| -STATIC mp_obj_t time_alarm_duration(mp_obj_t seconds_o) { - #if MICROPY_PY_BUILTINS_FLOAT - mp_float_t seconds = mp_obj_get_float(seconds_o); - mp_float_t msecs = 1000.0f * seconds + 0.5f; - #else - 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_alarm_duration(msecs); - - time_alarm_obj_t *self = m_new_obj(time_alarm_obj_t); - self->base.type = &time_alarm_type; - - return self; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(time_alarm_duration_obj, time_alarm_duration); - -//| Disable Timer Wakeup -//| -STATIC mp_obj_t time_alarm_disable(void) { - common_hal_time_alarm_disable(); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(time_alarm_disable_obj, time_alarm_disable); - -STATIC const mp_rom_map_elem_t time_alarm_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_time_alarm) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_Duration), MP_ROM_PTR(&time_alarm_duration_obj) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_Disable), MP_ROM_PTR(&time_alarm_disable_obj) }, -}; -STATIC MP_DEFINE_CONST_DICT(time_alarm_module_globals, time_alarm_module_globals_table); - -const mp_obj_module_t time_alarm_module = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t*)&time_alarm_module_globals, -}; - -const mp_obj_type_t time_alarm_type = { - { &mp_type_type }, - .name = MP_QSTR_timeAlarm, -}; diff --git a/shared-bindings/time_alarm/__init__.h b/shared-bindings/time_alarm/__init__.h deleted file mode 100644 index 52b6e89ee2249..0000000000000 --- a/shared-bindings/time_alarm/__init__.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_TIME_ALARM___INIT___H -#define MICROPY_INCLUDED_SHARED_BINDINGS_TIME_ALARM___INIT___H - -#include "py/runtime.h" - -typedef struct { - mp_obj_base_t base; -} time_alarm_obj_t; - -extern const mp_obj_type_t time_alarm_type; - -extern void common_hal_time_alarm_duration(uint32_t); -extern void common_hal_time_alarm_disable (void); - -#endif //MICROPY_INCLUDED_SHARED_BINDINGS_TIME_ALARM___INIT___H From 4d8ffdca8dc570f63c34b8f02856feae2d880688 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 24 Sep 2020 10:59:04 +0530 Subject: [PATCH 065/770] restructure alarm modules --- ports/esp32s2/common-hal/alarm/__init__.c | 84 +++++++++++++++++++ ports/esp32s2/common-hal/alarm/__init__.h | 6 ++ .../common-hal/microcontroller/__init__.c | 48 +---------- ports/esp32s2/mpconfigport.mk | 6 +- ports/esp32s2/supervisor/port.c | 7 +- py/circuitpy_defns.mk | 20 +++-- py/circuitpy_mpconfig.h | 40 +++++---- py/circuitpy_mpconfig.mk | 15 ++-- shared-bindings/alarm/__init__.c | 32 +++++++ shared-bindings/alarm/__init__.h | 12 +++ shared-bindings/alarm_time/__init__.h | 2 +- shared-bindings/microcontroller/__init__.c | 21 ----- shared-bindings/microcontroller/__init__.h | 7 +- 13 files changed, 191 insertions(+), 109 deletions(-) create mode 100644 ports/esp32s2/common-hal/alarm/__init__.c create mode 100644 ports/esp32s2/common-hal/alarm/__init__.h create mode 100644 shared-bindings/alarm/__init__.c create mode 100644 shared-bindings/alarm/__init__.h diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c new file mode 100644 index 0000000000000..90e8e9ecc8790 --- /dev/null +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -0,0 +1,84 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Scott Shawcroft for Adafruit Industries + * 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. + */ + +#include + +#include "common-hal/alarm/__init__.h" +#include "shared-bindings/alarm/__init__.h" + +#include "esp_sleep.h" +#include "soc/rtc_periph.h" +#include "driver/rtc_io.h" + +static RTC_DATA_ATTR struct timeval sleep_enter_time; +static RTC_DATA_ATTR struct timeval sleep_exit_time; +static RTC_DATA_ATTR uint8_t wake_io; + +int common_hal_alarm_get_sleep_time(void) { + return (sleep_exit_time.tv_sec - sleep_enter_time.tv_sec) * 1000 + (sleep_exit_time.tv_usec - sleep_enter_time.tv_usec) / 1000; +} + +void RTC_IRAM_ATTR esp_wake_deep_sleep(void) { + esp_default_wake_deep_sleep(); + wake_io = rtc_gpio_get_level(6); + gettimeofday(&sleep_exit_time, NULL); +} + +mp_obj_t common_hal_alarm_get_wake_alarm(void) { + switch (esp_sleep_get_wakeup_cause()) { + case ESP_SLEEP_WAKEUP_TIMER: ; + //Wake up from timer. + alarm_time_obj_t *timer = m_new_obj(alarm_time_obj_t); + timer->base.type = &alarm_time_type; + return timer; + case ESP_SLEEP_WAKEUP_EXT0: ; + //Wake up from GPIO + /*alarm_io_obj_t *ext0 = m_new_obj(alarm_io_obj_t); + ext0->base.type = &alarm_io_type; + return ext0;*/ + return mp_obj_new_int(wake_io); + case ESP_SLEEP_WAKEUP_EXT1: + //Wake up from GPIO, returns -> esp_sleep_get_ext1_wakeup_status() + /*uint64_t wakeup_pin_mask = esp_sleep_get_ext1_wakeup_status(); + if (wakeup_pin_mask != 0) { + int pin = __builtin_ffsll(wakeup_pin_mask) - 1; + printf("Wake up from GPIO %d\n", pin); + } else { + printf("Wake up from GPIO\n"); + }*/ + break; + case ESP_SLEEP_WAKEUP_TOUCHPAD: + //TODO: implement TouchIO + //Wake up from touch on pad, returns -> esp_sleep_get_touchpad_wakeup_status() + break; + case ESP_SLEEP_WAKEUP_UNDEFINED: + default: + //Not a deep sleep reset + break; + } + return mp_const_none; +} diff --git a/ports/esp32s2/common-hal/alarm/__init__.h b/ports/esp32s2/common-hal/alarm/__init__.h new file mode 100644 index 0000000000000..8ba5e2b04afe3 --- /dev/null +++ b/ports/esp32s2/common-hal/alarm/__init__.h @@ -0,0 +1,6 @@ +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_MICROCONTROLLER_ALARM_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_MICROCONTROLLER_ALARM_H + +extern void esp_wake_deep_sleep(void); + +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_MICROCONTROLLER_ALARM_H \ No newline at end of file diff --git a/ports/esp32s2/common-hal/microcontroller/__init__.c b/ports/esp32s2/common-hal/microcontroller/__init__.c index e79c602020f92..ba24e1c48d524 100644 --- a/ports/esp32s2/common-hal/microcontroller/__init__.c +++ b/ports/esp32s2/common-hal/microcontroller/__init__.c @@ -25,10 +25,8 @@ * THE SOFTWARE. */ -#include - -#include "py/mphal.h" #include "py/obj.h" +#include "py/mphal.h" #include "py/runtime.h" #include "common-hal/microcontroller/Pin.h" @@ -44,9 +42,6 @@ #include "freertos/FreeRTOS.h" #include "esp_sleep.h" -#include "soc/rtc_periph.h" - -static RTC_DATA_ATTR struct timeval sleep_enter_time; void common_hal_mcu_delay_us(uint32_t delay) { @@ -85,50 +80,9 @@ void common_hal_mcu_reset(void) { } void common_hal_mcu_sleep(void) { - gettimeofday(&sleep_enter_time, NULL); esp_deep_sleep_start(); } -int common_hal_mcu_get_sleep_time(void) { - struct timeval now; - gettimeofday(&now, NULL); - return (now.tv_sec - sleep_enter_time.tv_sec) * 1000 + (now.tv_usec - sleep_enter_time.tv_usec) / 1000; -} - -mp_obj_t common_hal_mcu_get_wake_alarm(void) { - switch (esp_sleep_get_wakeup_cause()) { - case ESP_SLEEP_WAKEUP_TIMER: ; - //Wake up from timer. - alarm_time_obj_t *timer = m_new_obj(alarm_time_obj_t); - timer->base.type = &alarm_time_type; - return timer; - case ESP_SLEEP_WAKEUP_EXT0: ; - //Wake up from GPIO - alarm_io_obj_t *ext0 = m_new_obj(alarm_io_obj_t); - ext0->base.type = &alarm_io_type; - return ext0; - case ESP_SLEEP_WAKEUP_EXT1: - //Wake up from GPIO, returns -> esp_sleep_get_ext1_wakeup_status() - /*uint64_t wakeup_pin_mask = esp_sleep_get_ext1_wakeup_status(); - if (wakeup_pin_mask != 0) { - int pin = __builtin_ffsll(wakeup_pin_mask) - 1; - printf("Wake up from GPIO %d\n", pin); - } else { - printf("Wake up from GPIO\n"); - }*/ - break; - case ESP_SLEEP_WAKEUP_TOUCHPAD: - //TODO: implement TouchIO - //Wake up from touch on pad, returns -> esp_sleep_get_touchpad_wakeup_status() - break; - case ESP_SLEEP_WAKEUP_UNDEFINED: - default: - //Not a deep sleep reset - break; - } - return mp_const_none; -} - // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index 4aaf1d00c77aa..1a78821d325db 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -14,6 +14,9 @@ LONGINT_IMPL = MPZ # These modules are implemented in ports//common-hal: CIRCUITPY_FULL_BUILD = 1 +CIRCUITPY_ALARM = 1 +CIRCUITPY_ALARM_IO = 1 +CIRCUITPY_ALARM_TIME = 1 CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_AUDIOIO = 0 CIRCUITPY_CANIO = 1 @@ -22,8 +25,7 @@ CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_NVM = 0 -CIRCUITPY_ALARM_TIME = 1 -CIRCUITPY_ALARM_IO = 1 + # We don't have enough endpoints to include MIDI. CIRCUITPY_USB_MIDI = 0 CIRCUITPY_WIFI = 1 diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 0b9c03f74724d..98c064a8b75b6 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -34,13 +34,14 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" -#include "common-hal/microcontroller/Pin.h" +#include "common-hal/alarm/__init__.h" #include "common-hal/analogio/AnalogOut.h" #include "common-hal/busio/I2C.h" #include "common-hal/busio/SPI.h" #include "common-hal/busio/UART.h" -#include "common-hal/pulseio/PulseIn.h" #include "common-hal/pwmio/PWMOut.h" +#include "common-hal/pulseio/PulseIn.h" +#include "common-hal/microcontroller/Pin.h" #include "common-hal/wifi/__init__.h" #include "supervisor/memory.h" #include "supervisor/shared/tick.h" @@ -87,6 +88,8 @@ safe_mode_t port_init(void) { return NO_HEAP; } + esp_wake_deep_sleep(); + return NO_SAFE_MODE; } diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 4c571659362a2..cd25c01f2323b 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -99,6 +99,15 @@ endif ifeq ($(CIRCUITPY_AESIO),1) SRC_PATTERNS += aesio/% endif +ifeq ($(CIRCUITPY_ALARM),1) +SRC_PATTERNS += alarm/% +endif +ifeq ($(CIRCUITPY_ALARM_IO),1) +SRC_PATTERNS += alarm_io/% +endif +ifeq ($(CIRCUITPY_ALARM_TIME),1) +SRC_PATTERNS += alarm_time/% +endif ifeq ($(CIRCUITPY_ANALOGIO),1) SRC_PATTERNS += analogio/% endif @@ -259,12 +268,6 @@ endif ifeq ($(CIRCUITPY_TIME),1) SRC_PATTERNS += time/% endif -ifeq ($(CIRCUITPY_ALARM_TIME),1) -SRC_PATTERNS += alarm_time/% -endif -ifeq ($(CIRCUITPY_ALARM_IO),1) -SRC_PATTERNS += alarm_io/% -endif ifeq ($(CIRCUITPY_TOUCHIO),1) SRC_PATTERNS += touchio/% endif @@ -304,6 +307,9 @@ SRC_COMMON_HAL_ALL = \ _bleio/__init__.c \ _pew/PewPew.c \ _pew/__init__.c \ + alarm/__init__.c \ + alarm_io/__init__.c \ + alarm_time/__init__.c \ analogio/AnalogIn.c \ analogio/AnalogOut.c \ analogio/__init__.c \ @@ -366,8 +372,6 @@ SRC_COMMON_HAL_ALL = \ ssl/SSLContext.c \ supervisor/Runtime.c \ supervisor/__init__.c \ - alarm_time/__init__.c \ - alarm_io/__init__.c \ watchdog/WatchDogMode.c \ watchdog/WatchDogTimer.c \ watchdog/__init__.c \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 94072f580be35..778c3131b64bc 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -240,6 +240,27 @@ extern const struct _mp_obj_module_t aesio_module; #define AESIO_MODULE #endif +#if CIRCUITPY_ALARM +extern const struct _mp_obj_module_t alarm_module; +#define ALARM_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_alarm), (mp_obj_t)&alarm_module }, +#else +#define ALARM_MODULE +#endif + +#if CIRCUITPY_ALARM_IO +extern const struct _mp_obj_module_t alarm_io_module; +#define ALARM_IO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_alarm_io), (mp_obj_t)&alarm_io_module }, +#else +#define ALARM_IO_MODULE +#endif + +#if CIRCUITPY_ALARM_TIME +extern const struct _mp_obj_module_t alarm_time_module; +#define ALARM_TIME_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_alarm_time), (mp_obj_t)&alarm_time_module }, +#else +#define ALARM_TIME_MODULE +#endif + #if CIRCUITPY_ANALOGIO #define ANALOGIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_analogio), (mp_obj_t)&analogio_module }, extern const struct _mp_obj_module_t analogio_module; @@ -663,20 +684,6 @@ extern const struct _mp_obj_module_t time_module; #define TIME_MODULE_ALT_NAME #endif -#if CIRCUITPY_ALARM_TIME -extern const struct _mp_obj_module_t alarm_time_module; -#define ALARM_TIME_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_alarm_time), (mp_obj_t)&alarm_time_module }, -#else -#define ALARM_TIME_MODULE -#endif - -#if CIRCUITPY_ALARM_IO -extern const struct _mp_obj_module_t alarm_io_module; -#define ALARM_IO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_alarm_io), (mp_obj_t)&alarm_io_module }, -#else -#define ALARM_IO_MODULE -#endif - #if CIRCUITPY_TOUCHIO extern const struct _mp_obj_module_t touchio_module; #define TOUCHIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_touchio), (mp_obj_t)&touchio_module }, @@ -777,6 +784,9 @@ extern const struct _mp_obj_module_t wifi_module; // Some are omitted because they're in MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS above. #define MICROPY_PORT_BUILTIN_MODULES_STRONG_LINKS \ AESIO_MODULE \ + ALARM_MODULE \ + ALARM_IO_MODULE \ + ALARM_TIME_MODULE \ ANALOGIO_MODULE \ AUDIOBUSIO_MODULE \ AUDIOCORE_MODULE \ @@ -835,8 +845,6 @@ extern const struct _mp_obj_module_t wifi_module; STRUCT_MODULE \ SUPERVISOR_MODULE \ TOUCHIO_MODULE \ - ALARM_TIME_MODULE \ - ALARM_IO_MODULE \ UHEAP_MODULE \ USB_HID_MODULE \ USB_MIDI_MODULE \ diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index e8619347dd27f..c1790e5e35dee 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -39,6 +39,15 @@ CFLAGS += -DMICROPY_PY_ASYNC_AWAIT=$(MICROPY_PY_ASYNC_AWAIT) CIRCUITPY_AESIO ?= 0 CFLAGS += -DCIRCUITPY_AESIO=$(CIRCUITPY_AESIO) +CIRCUITPY_ALARM ?= 0 +CFLAGS += -DCIRCUITPY_ALARM=$(CIRCUITPY_ALARM) + +CIRCUITPY_ALARM_IO ?= 0 +CFLAGS += -DCIRCUITPY_ALARM_IO=$(CIRCUITPY_ALARM_IO) + +CIRCUITPY_ALARM_TIME ?= 0 +CFLAGS += -DCIRCUITPY_ALARM_TIME=$(CIRCUITPY_ALARM_TIME) + CIRCUITPY_ANALOGIO ?= 1 CFLAGS += -DCIRCUITPY_ANALOGIO=$(CIRCUITPY_ANALOGIO) @@ -234,12 +243,6 @@ CFLAGS += -DCIRCUITPY_TERMINALIO=$(CIRCUITPY_TERMINALIO) CIRCUITPY_TIME ?= 1 CFLAGS += -DCIRCUITPY_TIME=$(CIRCUITPY_TIME) -CIRCUITPY_ALARM_TIME ?= 0 -CFLAGS += -DCIRCUITPY_ALARM_TIME=$(CIRCUITPY_ALARM_TIME) - -CIRCUITPY_ALARM_IO ?= 0 -CFLAGS += -DCIRCUITPY_ALARM_IO=$(CIRCUITPY_ALARM_IO) - # touchio might be native or generic. See circuitpy_defns.mk. CIRCUITPY_TOUCHIO_USE_NATIVE ?= 0 CFLAGS += -DCIRCUITPY_TOUCHIO_USE_NATIVE=$(CIRCUITPY_TOUCHIO_USE_NATIVE) diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c new file mode 100644 index 0000000000000..51a3776934609 --- /dev/null +++ b/shared-bindings/alarm/__init__.c @@ -0,0 +1,32 @@ +#include "shared-bindings/alarm/__init__.h" + +//| def getWakeAlarm() -> None: +//| """This returns the alarm that triggered wakeup, +//| also returns alarm specific parameters`. +//| +STATIC mp_obj_t alarm_get_wake_alarm(void) { + return common_hal_alarm_get_wake_alarm(); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(alarm_get_wake_alarm_obj, alarm_get_wake_alarm); + +//| def getSleepTime() -> None: +//| """This returns the period of time in ms, +//| in which the board was in deep sleep`. +//| +STATIC mp_obj_t alarm_get_sleep_time(void) { + return mp_obj_new_int(common_hal_alarm_get_sleep_time()); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(alarm_get_sleep_time_obj, alarm_get_sleep_time); + +STATIC const mp_rom_map_elem_t alarm_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_alarm) }, + { MP_ROM_QSTR(MP_QSTR_getSleepTime), MP_ROM_PTR(&alarm_get_sleep_time_obj) }, + { MP_ROM_QSTR(MP_QSTR_getWakeAlarm), MP_ROM_PTR(&alarm_get_wake_alarm_obj) }, +}; + +STATIC MP_DEFINE_CONST_DICT(alarm_module_globals, alarm_module_globals_table); + +const mp_obj_module_t alarm_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&alarm_module_globals, +}; diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h new file mode 100644 index 0000000000000..2289028efffa8 --- /dev/null +++ b/shared-bindings/alarm/__init__.h @@ -0,0 +1,12 @@ +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM___INIT___H + +#include "py/obj.h" + +#include "shared-bindings/alarm_io/__init__.h" +#include "shared-bindings/alarm_time/__init__.h" + +extern int common_hal_alarm_get_sleep_time(void); +extern mp_obj_t common_hal_alarm_get_wake_alarm(void); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM___INIT___H diff --git a/shared-bindings/alarm_time/__init__.h b/shared-bindings/alarm_time/__init__.h index d69aa5a4433ff..a96383069339b 100644 --- a/shared-bindings/alarm_time/__init__.h +++ b/shared-bindings/alarm_time/__init__.h @@ -9,7 +9,7 @@ typedef struct { extern const mp_obj_type_t alarm_time_type; -extern void common_hal_alarm_time_duration(uint32_t); +extern void common_hal_alarm_time_duration (uint32_t); extern void common_hal_alarm_time_disable (void); #endif //MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME___INIT___H diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index 7b896d99b2e4d..eb58a409822fa 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -39,7 +39,6 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Processor.h" -#include "py/runtime.h" #include "supervisor/shared/translate.h" //| """Pin references and cpu functionality @@ -152,24 +151,6 @@ STATIC mp_obj_t mcu_sleep(void) { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_sleep_obj, mcu_sleep); -//| def getWakeAlarm() -> None: -//| """This returns the alarm that triggered wakeup, -//| also returns alarm specific parameters`. -//| -STATIC mp_obj_t mcu_get_wake_alarm(void) { - return common_hal_mcu_get_wake_alarm(); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_get_wake_alarm_obj, mcu_get_wake_alarm); - -//| def getSleepTime() -> None: -//| """This returns the period of time in ms, -//| in which the board was in deep sleep`. -//| -STATIC mp_obj_t mcu_get_sleep_time(void) { - return mp_obj_new_int(common_hal_mcu_get_sleep_time()); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_get_sleep_time_obj, mcu_get_sleep_time); - //| nvm: Optional[ByteArray] //| """Available non-volatile memory. //| This object is the sole instance of `nvm.ByteArray` when available or ``None`` otherwise. @@ -206,8 +187,6 @@ STATIC const mp_rom_map_elem_t mcu_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_on_next_reset), MP_ROM_PTR(&mcu_on_next_reset_obj) }, { MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&mcu_reset_obj) }, { MP_ROM_QSTR(MP_QSTR_sleep), MP_ROM_PTR(&mcu_sleep_obj) }, - { MP_ROM_QSTR(MP_QSTR_getSleepTime), MP_ROM_PTR(&mcu_get_sleep_time_obj) }, - { MP_ROM_QSTR(MP_QSTR_getWakeAlarm), MP_ROM_PTR(&mcu_get_wake_alarm_obj) }, #if CIRCUITPY_INTERNAL_NVM_SIZE > 0 { MP_ROM_QSTR(MP_QSTR_nvm), MP_ROM_PTR(&common_hal_mcu_nvm_obj) }, #else diff --git a/shared-bindings/microcontroller/__init__.h b/shared-bindings/microcontroller/__init__.h index cd234fb033731..95f1cf8fc703d 100644 --- a/shared-bindings/microcontroller/__init__.h +++ b/shared-bindings/microcontroller/__init__.h @@ -28,16 +28,13 @@ #ifndef MICROPY_INCLUDED_SHARED_BINDINGS_MICROCONTROLLER___INIT___H #define MICROPY_INCLUDED_SHARED_BINDINGS_MICROCONTROLLER___INIT___H -#include "py/mpconfig.h" #include "py/obj.h" +#include "py/mpconfig.h" #include "common-hal/microcontroller/Processor.h" #include "shared-bindings/microcontroller/RunMode.h" -#include "shared-bindings/alarm_io/__init__.h" -#include "shared-bindings/alarm_time/__init__.h" - extern void common_hal_mcu_delay_us(uint32_t); extern void common_hal_mcu_disable_interrupts(void); @@ -47,8 +44,6 @@ extern void common_hal_mcu_on_next_reset(mcu_runmode_t runmode); extern void common_hal_mcu_reset(void); extern void common_hal_mcu_sleep(void); -extern int common_hal_mcu_get_sleep_time(void); -extern mp_obj_t common_hal_mcu_get_wake_alarm(void); extern const mp_obj_dict_t mcu_pin_globals; From da449723df14623647729954dd5427101070d01c Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 24 Sep 2020 15:01:36 +0530 Subject: [PATCH 066/770] Fix build error --- locale/circuitpython.pot | 13 +++++--- ports/esp32s2/common-hal/alarm/__init__.c | 38 +++-------------------- ports/esp32s2/common-hal/alarm/__init__.h | 6 ---- ports/esp32s2/supervisor/port.c | 5 +-- py/circuitpy_defns.mk | 2 +- shared-bindings/alarm/__init__.c | 14 --------- shared-bindings/alarm/__init__.h | 4 --- shared-bindings/alarm_io/__init__.c | 5 --- shared-bindings/alarm_time/__init__.c | 4 --- 9 files changed, 15 insertions(+), 76 deletions(-) delete mode 100644 ports/esp32s2/common-hal/alarm/__init__.h diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 16c3dd973a0e0..e344f4dd8198d 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -17,6 +17,13 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" +#: main.c +msgid "" +"\n" +"\n" +"------ soft reboot ------\n" +msgstr "" + #: main.c msgid "" "\n" @@ -3303,7 +3310,7 @@ msgstr "" msgid "size is defined for ndarrays only" msgstr "" -#: shared-bindings/time/__init__.c +#: shared-bindings/alarm_time/__init__.c shared-bindings/time/__init__.c msgid "sleep length must be non-negative" msgstr "" @@ -3319,10 +3326,6 @@ msgstr "" msgid "small int overflow" msgstr "" -#: main.c -msgid "soft reboot\n" -msgstr "" - #: extmod/ulab/code/numerical/numerical.c msgid "sort argument must be an ndarray" msgstr "" diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index 90e8e9ecc8790..89ff6865ded37 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -25,28 +25,11 @@ * THE SOFTWARE. */ -#include - -#include "common-hal/alarm/__init__.h" #include "shared-bindings/alarm/__init__.h" +#include "shared-bindings/alarm_io/__init__.h" +#include "shared-bindings/alarm_time/__init__.h" #include "esp_sleep.h" -#include "soc/rtc_periph.h" -#include "driver/rtc_io.h" - -static RTC_DATA_ATTR struct timeval sleep_enter_time; -static RTC_DATA_ATTR struct timeval sleep_exit_time; -static RTC_DATA_ATTR uint8_t wake_io; - -int common_hal_alarm_get_sleep_time(void) { - return (sleep_exit_time.tv_sec - sleep_enter_time.tv_sec) * 1000 + (sleep_exit_time.tv_usec - sleep_enter_time.tv_usec) / 1000; -} - -void RTC_IRAM_ATTR esp_wake_deep_sleep(void) { - esp_default_wake_deep_sleep(); - wake_io = rtc_gpio_get_level(6); - gettimeofday(&sleep_exit_time, NULL); -} mp_obj_t common_hal_alarm_get_wake_alarm(void) { switch (esp_sleep_get_wakeup_cause()) { @@ -57,23 +40,12 @@ mp_obj_t common_hal_alarm_get_wake_alarm(void) { return timer; case ESP_SLEEP_WAKEUP_EXT0: ; //Wake up from GPIO - /*alarm_io_obj_t *ext0 = m_new_obj(alarm_io_obj_t); + alarm_io_obj_t *ext0 = m_new_obj(alarm_io_obj_t); ext0->base.type = &alarm_io_type; - return ext0;*/ - return mp_obj_new_int(wake_io); - case ESP_SLEEP_WAKEUP_EXT1: - //Wake up from GPIO, returns -> esp_sleep_get_ext1_wakeup_status() - /*uint64_t wakeup_pin_mask = esp_sleep_get_ext1_wakeup_status(); - if (wakeup_pin_mask != 0) { - int pin = __builtin_ffsll(wakeup_pin_mask) - 1; - printf("Wake up from GPIO %d\n", pin); - } else { - printf("Wake up from GPIO\n"); - }*/ - break; + return ext0; case ESP_SLEEP_WAKEUP_TOUCHPAD: //TODO: implement TouchIO - //Wake up from touch on pad, returns -> esp_sleep_get_touchpad_wakeup_status() + //Wake up from touch on pad, esp_sleep_get_touchpad_wakeup_status() break; case ESP_SLEEP_WAKEUP_UNDEFINED: default: diff --git a/ports/esp32s2/common-hal/alarm/__init__.h b/ports/esp32s2/common-hal/alarm/__init__.h deleted file mode 100644 index 8ba5e2b04afe3..0000000000000 --- a/ports/esp32s2/common-hal/alarm/__init__.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_MICROCONTROLLER_ALARM_H -#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_MICROCONTROLLER_ALARM_H - -extern void esp_wake_deep_sleep(void); - -#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_MICROCONTROLLER_ALARM_H \ No newline at end of file diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 98c064a8b75b6..840b9796325c0 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -34,7 +34,6 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" -#include "common-hal/alarm/__init__.h" #include "common-hal/analogio/AnalogOut.h" #include "common-hal/busio/I2C.h" #include "common-hal/busio/SPI.h" @@ -87,9 +86,7 @@ safe_mode_t port_init(void) { if (heap == NULL) { return NO_HEAP; } - - esp_wake_deep_sleep(); - + return NO_SAFE_MODE; } diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index cd25c01f2323b..473536d530ed5 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -309,7 +309,7 @@ SRC_COMMON_HAL_ALL = \ _pew/__init__.c \ alarm/__init__.c \ alarm_io/__init__.c \ - alarm_time/__init__.c \ + alarm_time/__init__.c \ analogio/AnalogIn.c \ analogio/AnalogOut.c \ analogio/__init__.c \ diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 51a3776934609..37462d88cc4c3 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -1,26 +1,12 @@ #include "shared-bindings/alarm/__init__.h" -//| def getWakeAlarm() -> None: -//| """This returns the alarm that triggered wakeup, -//| also returns alarm specific parameters`. -//| STATIC mp_obj_t alarm_get_wake_alarm(void) { return common_hal_alarm_get_wake_alarm(); } STATIC MP_DEFINE_CONST_FUN_OBJ_0(alarm_get_wake_alarm_obj, alarm_get_wake_alarm); -//| def getSleepTime() -> None: -//| """This returns the period of time in ms, -//| in which the board was in deep sleep`. -//| -STATIC mp_obj_t alarm_get_sleep_time(void) { - return mp_obj_new_int(common_hal_alarm_get_sleep_time()); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(alarm_get_sleep_time_obj, alarm_get_sleep_time); - STATIC const mp_rom_map_elem_t alarm_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_alarm) }, - { MP_ROM_QSTR(MP_QSTR_getSleepTime), MP_ROM_PTR(&alarm_get_sleep_time_obj) }, { MP_ROM_QSTR(MP_QSTR_getWakeAlarm), MP_ROM_PTR(&alarm_get_wake_alarm_obj) }, }; diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h index 2289028efffa8..8b2cd9f770c3b 100644 --- a/shared-bindings/alarm/__init__.h +++ b/shared-bindings/alarm/__init__.h @@ -3,10 +3,6 @@ #include "py/obj.h" -#include "shared-bindings/alarm_io/__init__.h" -#include "shared-bindings/alarm_time/__init__.h" - -extern int common_hal_alarm_get_sleep_time(void); extern mp_obj_t common_hal_alarm_get_wake_alarm(void); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM___INIT___H diff --git a/shared-bindings/alarm_io/__init__.c b/shared-bindings/alarm_io/__init__.c index 09783d0d0873a..d772ccb7961e5 100644 --- a/shared-bindings/alarm_io/__init__.c +++ b/shared-bindings/alarm_io/__init__.c @@ -3,8 +3,6 @@ #include "shared-bindings/alarm_io/__init__.h" #include "shared-bindings/microcontroller/Pin.h" -//| Set Pin Wakeup -//| STATIC mp_obj_t alarm_io_pin_state(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_level, ARG_pull }; static const mp_arg_t allowed_args[] = { @@ -27,9 +25,6 @@ STATIC mp_obj_t alarm_io_pin_state(size_t n_args, const mp_obj_t *pos_args, mp_m } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(alarm_io_pin_state_obj, 1, alarm_io_pin_state); - -//| Disable Pin Wakeup -//| STATIC mp_obj_t alarm_io_disable(void) { common_hal_alarm_io_disable(); return mp_const_none; diff --git a/shared-bindings/alarm_time/__init__.c b/shared-bindings/alarm_time/__init__.c index 22fb93506434d..d4474ea2de993 100644 --- a/shared-bindings/alarm_time/__init__.c +++ b/shared-bindings/alarm_time/__init__.c @@ -1,8 +1,6 @@ #include "py/obj.h" #include "shared-bindings/alarm_time/__init__.h" -//| Set Timer Wakeup -//| STATIC mp_obj_t alarm_time_duration(mp_obj_t seconds_o) { #if MICROPY_PY_BUILTINS_FLOAT mp_float_t seconds = mp_obj_get_float(seconds_o); @@ -24,8 +22,6 @@ STATIC mp_obj_t alarm_time_duration(mp_obj_t seconds_o) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(alarm_time_duration_obj, alarm_time_duration); -//| Disable Timer Wakeup -//| STATIC mp_obj_t alarm_time_disable(void) { common_hal_alarm_time_disable(); return mp_const_none; From 59df1a11ade4a39d079c9f418740b45b4d6121ce Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Fri, 25 Sep 2020 00:28:50 +0530 Subject: [PATCH 067/770] Add alarm_touch module --- ports/esp32s2/common-hal/alarm/__init__.c | 10 ++++---- ports/esp32s2/common-hal/alarm_io/__init__.c | 12 +++++----- .../esp32s2/common-hal/alarm_time/__init__.c | 4 ++-- .../esp32s2/common-hal/alarm_touch/__init__.c | 7 ++++++ .../common-hal/microcontroller/__init__.c | 2 +- ports/esp32s2/mpconfigport.mk | 1 + ports/esp32s2/supervisor/port.c | 2 +- py/circuitpy_defns.mk | 4 ++++ py/circuitpy_mpconfig.h | 8 +++++++ py/circuitpy_mpconfig.mk | 3 +++ shared-bindings/alarm_io/__init__.c | 10 ++++---- shared-bindings/alarm_time/__init__.c | 4 ++-- shared-bindings/alarm_touch/__init__.c | 24 +++++++++++++++++++ shared-bindings/alarm_touch/__init__.h | 14 +++++++++++ shared-bindings/microcontroller/__init__.c | 9 ------- 15 files changed, 83 insertions(+), 31 deletions(-) create mode 100644 ports/esp32s2/common-hal/alarm_touch/__init__.c create mode 100644 shared-bindings/alarm_touch/__init__.c create mode 100644 shared-bindings/alarm_touch/__init__.h diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index 89ff6865ded37..46715d9bf6859 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -36,17 +36,17 @@ mp_obj_t common_hal_alarm_get_wake_alarm(void) { case ESP_SLEEP_WAKEUP_TIMER: ; //Wake up from timer. alarm_time_obj_t *timer = m_new_obj(alarm_time_obj_t); - timer->base.type = &alarm_time_type; + timer->base.type = &alarm_time_type; return timer; case ESP_SLEEP_WAKEUP_EXT0: ; //Wake up from GPIO alarm_io_obj_t *ext0 = m_new_obj(alarm_io_obj_t); - ext0->base.type = &alarm_io_type; - return ext0; - case ESP_SLEEP_WAKEUP_TOUCHPAD: + ext0->base.type = &alarm_io_type; + return ext0; + case ESP_SLEEP_WAKEUP_TOUCHPAD: //TODO: implement TouchIO //Wake up from touch on pad, esp_sleep_get_touchpad_wakeup_status() - break; + break; case ESP_SLEEP_WAKEUP_UNDEFINED: default: //Not a deep sleep reset diff --git a/ports/esp32s2/common-hal/alarm_io/__init__.c b/ports/esp32s2/common-hal/alarm_io/__init__.c index 9aa28f4156dea..a98b9332466ae 100644 --- a/ports/esp32s2/common-hal/alarm_io/__init__.c +++ b/ports/esp32s2/common-hal/alarm_io/__init__.c @@ -5,22 +5,22 @@ mp_obj_t common_hal_alarm_io_pin_state (alarm_io_obj_t *self_in) { if (!rtc_gpio_is_valid_gpio(self_in->gpio)) { - mp_raise_ValueError(translate("io must be rtc io")); - } + mp_raise_ValueError(translate("io must be rtc io")); + } switch(esp_sleep_enable_ext0_wakeup(self_in->gpio, self_in->level)) { case ESP_ERR_INVALID_ARG: mp_raise_ValueError(translate("trigger level must be 0 or 1")); case ESP_ERR_INVALID_STATE: mp_raise_RuntimeError(translate("wakeup conflict")); - default: - break; + default: + break; } if (self_in->pull) { (self_in->level) ? rtc_gpio_pulldown_en(self_in->gpio) : rtc_gpio_pullup_en(self_in->gpio); } - return self_in; -} + return self_in; +} void common_hal_alarm_io_disable (void) { esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_EXT0 | ESP_SLEEP_WAKEUP_EXT1); diff --git a/ports/esp32s2/common-hal/alarm_time/__init__.c b/ports/esp32s2/common-hal/alarm_time/__init__.c index fb601e6be009f..252b6e107cdb5 100644 --- a/ports/esp32s2/common-hal/alarm_time/__init__.c +++ b/ports/esp32s2/common-hal/alarm_time/__init__.c @@ -5,8 +5,8 @@ void common_hal_alarm_time_duration (uint32_t ms) { if (esp_sleep_enable_timer_wakeup((ms) * 1000) == ESP_ERR_INVALID_ARG) { mp_raise_ValueError(translate("time out of range")); - } -} + } +} void common_hal_alarm_time_disable (void) { esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_TIMER); diff --git a/ports/esp32s2/common-hal/alarm_touch/__init__.c b/ports/esp32s2/common-hal/alarm_touch/__init__.c new file mode 100644 index 0000000000000..df32b269306a3 --- /dev/null +++ b/ports/esp32s2/common-hal/alarm_touch/__init__.c @@ -0,0 +1,7 @@ +#include "esp_sleep.h" + +#include "shared-bindings/alarm_touch/__init__.h" + +void common_hal_alarm_touch_disable (void) { + esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_TOUCHPAD); +} diff --git a/ports/esp32s2/common-hal/microcontroller/__init__.c b/ports/esp32s2/common-hal/microcontroller/__init__.c index ba24e1c48d524..f1dc24bb898a1 100644 --- a/ports/esp32s2/common-hal/microcontroller/__init__.c +++ b/ports/esp32s2/common-hal/microcontroller/__init__.c @@ -80,7 +80,7 @@ void common_hal_mcu_reset(void) { } void common_hal_mcu_sleep(void) { - esp_deep_sleep_start(); + esp_deep_sleep_start(); } // The singleton microcontroller.Processor object, bound to microcontroller.cpu diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index 1a78821d325db..7024ceb6304e0 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -17,6 +17,7 @@ CIRCUITPY_FULL_BUILD = 1 CIRCUITPY_ALARM = 1 CIRCUITPY_ALARM_IO = 1 CIRCUITPY_ALARM_TIME = 1 +CIRCUITPY_ALARM_TOUCH = 1 CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_AUDIOIO = 0 CIRCUITPY_CANIO = 1 diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 840b9796325c0..df6755783d941 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -86,7 +86,7 @@ safe_mode_t port_init(void) { if (heap == NULL) { return NO_HEAP; } - + return NO_SAFE_MODE; } diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 473536d530ed5..72091decbf87b 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -108,6 +108,9 @@ endif ifeq ($(CIRCUITPY_ALARM_TIME),1) SRC_PATTERNS += alarm_time/% endif +ifeq ($(CIRCUITPY_ALARM_TIME),1) +SRC_PATTERNS += alarm_touch/% +endif ifeq ($(CIRCUITPY_ANALOGIO),1) SRC_PATTERNS += analogio/% endif @@ -310,6 +313,7 @@ SRC_COMMON_HAL_ALL = \ alarm/__init__.c \ alarm_io/__init__.c \ alarm_time/__init__.c \ + alarm_touch/__init__.c \ analogio/AnalogIn.c \ analogio/AnalogOut.c \ analogio/__init__.c \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 778c3131b64bc..c8141a99a6d70 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -261,6 +261,13 @@ extern const struct _mp_obj_module_t alarm_time_module; #define ALARM_TIME_MODULE #endif +#if CIRCUITPY_ALARM_TOUCH +extern const struct _mp_obj_module_t alarm_touch_module; +#define ALARM_TOUCH_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_alarm_touch), (mp_obj_t)&alarm_touch_module }, +#else +#define ALARM_TOUCH_MODULE +#endif + #if CIRCUITPY_ANALOGIO #define ANALOGIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_analogio), (mp_obj_t)&analogio_module }, extern const struct _mp_obj_module_t analogio_module; @@ -787,6 +794,7 @@ extern const struct _mp_obj_module_t wifi_module; ALARM_MODULE \ ALARM_IO_MODULE \ ALARM_TIME_MODULE \ + ALARM_TOUCH_MODULE \ ANALOGIO_MODULE \ AUDIOBUSIO_MODULE \ AUDIOCORE_MODULE \ diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index c1790e5e35dee..59d23e4667151 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -48,6 +48,9 @@ CFLAGS += -DCIRCUITPY_ALARM_IO=$(CIRCUITPY_ALARM_IO) CIRCUITPY_ALARM_TIME ?= 0 CFLAGS += -DCIRCUITPY_ALARM_TIME=$(CIRCUITPY_ALARM_TIME) +CIRCUITPY_ALARM_TOUCH ?= 0 +CFLAGS += -DCIRCUITPY_ALARM_TOUCH=$(CIRCUITPY_ALARM_TOUCH) + CIRCUITPY_ANALOGIO ?= 1 CFLAGS += -DCIRCUITPY_ANALOGIO=$(CIRCUITPY_ANALOGIO) diff --git a/shared-bindings/alarm_io/__init__.c b/shared-bindings/alarm_io/__init__.c index d772ccb7961e5..dbe4671763ff3 100644 --- a/shared-bindings/alarm_io/__init__.c +++ b/shared-bindings/alarm_io/__init__.c @@ -3,15 +3,15 @@ #include "shared-bindings/alarm_io/__init__.h" #include "shared-bindings/microcontroller/Pin.h" -STATIC mp_obj_t alarm_io_pin_state(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +STATIC mp_obj_t alarm_io_pin_state(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_level, ARG_pull }; static const mp_arg_t allowed_args[] = { { MP_QSTR_level, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, { MP_QSTR_pull, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_bool = false} }, - }; + }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); mcu_pin_obj_t *pin = validate_obj_is_pin(pos_args[0]); alarm_io_obj_t *self = m_new_obj(alarm_io_obj_t); @@ -20,12 +20,12 @@ STATIC mp_obj_t alarm_io_pin_state(size_t n_args, const mp_obj_t *pos_args, mp_m self->gpio = pin->number; self->level = args[ARG_level].u_int; self->pull = args[ARG_pull].u_bool; - + return common_hal_alarm_io_pin_state(self); } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(alarm_io_pin_state_obj, 1, alarm_io_pin_state); -STATIC mp_obj_t alarm_io_disable(void) { +STATIC mp_obj_t alarm_io_disable(void) { common_hal_alarm_io_disable(); return mp_const_none; } diff --git a/shared-bindings/alarm_time/__init__.c b/shared-bindings/alarm_time/__init__.c index d4474ea2de993..218ac6857596d 100644 --- a/shared-bindings/alarm_time/__init__.c +++ b/shared-bindings/alarm_time/__init__.c @@ -1,7 +1,7 @@ #include "py/obj.h" #include "shared-bindings/alarm_time/__init__.h" -STATIC mp_obj_t alarm_time_duration(mp_obj_t seconds_o) { +STATIC mp_obj_t alarm_time_duration(mp_obj_t seconds_o) { #if MICROPY_PY_BUILTINS_FLOAT mp_float_t seconds = mp_obj_get_float(seconds_o); mp_float_t msecs = 1000.0f * seconds + 0.5f; @@ -22,7 +22,7 @@ STATIC mp_obj_t alarm_time_duration(mp_obj_t seconds_o) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(alarm_time_duration_obj, alarm_time_duration); -STATIC mp_obj_t alarm_time_disable(void) { +STATIC mp_obj_t alarm_time_disable(void) { common_hal_alarm_time_disable(); return mp_const_none; } diff --git a/shared-bindings/alarm_touch/__init__.c b/shared-bindings/alarm_touch/__init__.c new file mode 100644 index 0000000000000..e36fa73cb8a81 --- /dev/null +++ b/shared-bindings/alarm_touch/__init__.c @@ -0,0 +1,24 @@ +#include "py/obj.h" +#include "shared-bindings/alarm_touch/__init__.h" + +STATIC mp_obj_t alarm_touch_disable(void) { + common_hal_alarm_touch_disable(); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(alarm_touch_disable_obj, alarm_touch_disable); + +STATIC const mp_rom_map_elem_t alarm_touch_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_alarm_touch) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_Disable), MP_ROM_PTR(&alarm_touch_disable_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(alarm_touch_module_globals, alarm_touch_module_globals_table); + +const mp_obj_module_t alarm_touch_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&alarm_touch_module_globals, +}; + +const mp_obj_type_t alarm_touch_type = { + { &mp_type_type }, + .name = MP_QSTR_touchAlarm, +}; diff --git a/shared-bindings/alarm_touch/__init__.h b/shared-bindings/alarm_touch/__init__.h new file mode 100644 index 0000000000000..600587d247e2c --- /dev/null +++ b/shared-bindings/alarm_touch/__init__.h @@ -0,0 +1,14 @@ +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TOUCH___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TOUCH___INIT___H + +#include "py/runtime.h" + +typedef struct { + mp_obj_base_t base; +} alarm_touch_obj_t; + +extern const mp_obj_type_t alarm_touch_type; + +extern void common_hal_alarm_touch_disable (void); + +#endif //MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TOUCH___INIT___H diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index eb58a409822fa..88dc4179d60ea 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -135,15 +135,6 @@ STATIC mp_obj_t mcu_reset(void) { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_reset_obj, mcu_reset); -//| def sleep() -> None: -//| """Microcontroller will go into deep sleep. -//| cpy will restart when wakeup func. is triggered`. -//| -//| .. warning:: This may result in file system corruption when connected to a -//| host computer. Be very careful when calling this! Make sure the device -//| "Safely removed" on Windows or "ejected" on Mac OSX and Linux.""" -//| ... -//| STATIC mp_obj_t mcu_sleep(void) { common_hal_mcu_sleep(); // We won't actually get here because mcu is going into sleep. From e35938971a4e9c0177e68163e1baab3b25c17ca8 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Fri, 25 Sep 2020 03:32:31 +0530 Subject: [PATCH 068/770] Add description of alarm modules --- ports/atmel-samd/common-hal/microcontroller/__init__.c | 4 ++++ ports/cxd56/common-hal/microcontroller/__init__.c | 4 ++++ ports/litex/common-hal/microcontroller/__init__.c | 4 ++++ ports/mimxrt10xx/common-hal/microcontroller/__init__.c | 4 ++++ ports/nrf/common-hal/microcontroller/__init__.c | 4 ++++ ports/stm/common-hal/microcontroller/__init__.c | 4 ++++ shared-bindings/alarm/__init__.c | 4 ++++ shared-bindings/alarm_io/__init__.c | 4 ++++ shared-bindings/alarm_time/__init__.c | 4 ++++ shared-bindings/alarm_touch/__init__.c | 4 ++++ 10 files changed, 40 insertions(+) diff --git a/ports/atmel-samd/common-hal/microcontroller/__init__.c b/ports/atmel-samd/common-hal/microcontroller/__init__.c index 50a1ec038e931..b3ff06b62f1ea 100644 --- a/ports/atmel-samd/common-hal/microcontroller/__init__.c +++ b/ports/atmel-samd/common-hal/microcontroller/__init__.c @@ -84,6 +84,10 @@ void common_hal_mcu_reset(void) { reset(); } +void common_hal_mcu_sleep(void) { + //deep sleep call here +} + // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/ports/cxd56/common-hal/microcontroller/__init__.c b/ports/cxd56/common-hal/microcontroller/__init__.c index 7aa3b839d7801..4379f9be66897 100644 --- a/ports/cxd56/common-hal/microcontroller/__init__.c +++ b/ports/cxd56/common-hal/microcontroller/__init__.c @@ -81,6 +81,10 @@ void common_hal_mcu_reset(void) { boardctl(BOARDIOC_RESET, 0); } +void common_hal_mcu_sleep(void) { + //deep sleep call here +} + STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_UART2_RXD), MP_ROM_PTR(&pin_UART2_RXD) }, { MP_ROM_QSTR(MP_QSTR_UART2_TXD), MP_ROM_PTR(&pin_UART2_TXD) }, diff --git a/ports/litex/common-hal/microcontroller/__init__.c b/ports/litex/common-hal/microcontroller/__init__.c index 3c91661144b81..3b1628c39ae2b 100644 --- a/ports/litex/common-hal/microcontroller/__init__.c +++ b/ports/litex/common-hal/microcontroller/__init__.c @@ -89,6 +89,10 @@ void common_hal_mcu_reset(void) { while(1); } +void common_hal_mcu_sleep(void) { + //deep sleep call here +} + // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/ports/mimxrt10xx/common-hal/microcontroller/__init__.c b/ports/mimxrt10xx/common-hal/microcontroller/__init__.c index 6a8537e2da17b..c7bc7eb9e834f 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/__init__.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/__init__.c @@ -86,6 +86,10 @@ void common_hal_mcu_reset(void) { NVIC_SystemReset(); } +void common_hal_mcu_sleep(void) { + //deep sleep call here +} + // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/ports/nrf/common-hal/microcontroller/__init__.c b/ports/nrf/common-hal/microcontroller/__init__.c index 06aac9409dc1f..ff6c658b8b01c 100644 --- a/ports/nrf/common-hal/microcontroller/__init__.c +++ b/ports/nrf/common-hal/microcontroller/__init__.c @@ -95,6 +95,10 @@ void common_hal_mcu_reset(void) { reset_cpu(); } +void common_hal_mcu_sleep(void) { + //deep sleep call here +} + // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/ports/stm/common-hal/microcontroller/__init__.c b/ports/stm/common-hal/microcontroller/__init__.c index a827399ccb05f..2a60c53426cee 100644 --- a/ports/stm/common-hal/microcontroller/__init__.c +++ b/ports/stm/common-hal/microcontroller/__init__.c @@ -81,6 +81,10 @@ void common_hal_mcu_reset(void) { NVIC_SystemReset(); } +void common_hal_mcu_sleep(void) { + //deep sleep call here +} + // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 37462d88cc4c3..88c4bc8878c41 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -1,5 +1,9 @@ #include "shared-bindings/alarm/__init__.h" +//| """alarm module +//| +//| The `alarm` module implements deep sleep.""" + STATIC mp_obj_t alarm_get_wake_alarm(void) { return common_hal_alarm_get_wake_alarm(); } diff --git a/shared-bindings/alarm_io/__init__.c b/shared-bindings/alarm_io/__init__.c index dbe4671763ff3..4e42f9a2e1606 100644 --- a/shared-bindings/alarm_io/__init__.c +++ b/shared-bindings/alarm_io/__init__.c @@ -3,6 +3,10 @@ #include "shared-bindings/alarm_io/__init__.h" #include "shared-bindings/microcontroller/Pin.h" +//| """alarm_io module +//| +//| The `alarm_io` module implements deep sleep.""" + STATIC mp_obj_t alarm_io_pin_state(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_level, ARG_pull }; static const mp_arg_t allowed_args[] = { diff --git a/shared-bindings/alarm_time/__init__.c b/shared-bindings/alarm_time/__init__.c index 218ac6857596d..1707f7488f342 100644 --- a/shared-bindings/alarm_time/__init__.c +++ b/shared-bindings/alarm_time/__init__.c @@ -1,6 +1,10 @@ #include "py/obj.h" #include "shared-bindings/alarm_time/__init__.h" +//| """alarm_time module +//| +//| The `alarm_time` module implements deep sleep.""" + STATIC mp_obj_t alarm_time_duration(mp_obj_t seconds_o) { #if MICROPY_PY_BUILTINS_FLOAT mp_float_t seconds = mp_obj_get_float(seconds_o); diff --git a/shared-bindings/alarm_touch/__init__.c b/shared-bindings/alarm_touch/__init__.c index e36fa73cb8a81..5f5a156d8012c 100644 --- a/shared-bindings/alarm_touch/__init__.c +++ b/shared-bindings/alarm_touch/__init__.c @@ -1,6 +1,10 @@ #include "py/obj.h" #include "shared-bindings/alarm_touch/__init__.h" +//| """alarm_touch module +//| +//| The `alarm_touch` module implements deep sleep.""" + STATIC mp_obj_t alarm_touch_disable(void) { common_hal_alarm_touch_disable(); return mp_const_none; From 930cf14dcef3e3552a0e7d7476fd89b873738c2d Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Sat, 26 Sep 2020 11:15:50 +0530 Subject: [PATCH 069/770] Add check for invalid io, function to disable all alarms --- ports/atmel-samd/common-hal/microcontroller/__init__.c | 2 +- ports/cxd56/common-hal/microcontroller/__init__.c | 2 +- ports/esp32s2/common-hal/alarm/__init__.c | 4 ++++ ports/esp32s2/common-hal/alarm_io/__init__.c | 8 ++++++++ ports/esp32s2/common-hal/microcontroller/__init__.c | 2 +- ports/litex/common-hal/microcontroller/__init__.c | 2 +- ports/mimxrt10xx/common-hal/microcontroller/__init__.c | 2 +- ports/nrf/common-hal/microcontroller/__init__.c | 2 +- ports/stm/common-hal/microcontroller/__init__.c | 2 +- py/circuitpy_defns.mk | 2 +- shared-bindings/alarm/__init__.c | 9 ++++++++- shared-bindings/alarm/__init__.h | 1 + shared-bindings/microcontroller/__init__.c | 3 ++- shared-bindings/microcontroller/__init__.h | 2 +- 14 files changed, 32 insertions(+), 11 deletions(-) diff --git a/ports/atmel-samd/common-hal/microcontroller/__init__.c b/ports/atmel-samd/common-hal/microcontroller/__init__.c index b3ff06b62f1ea..ca39f28386cdd 100644 --- a/ports/atmel-samd/common-hal/microcontroller/__init__.c +++ b/ports/atmel-samd/common-hal/microcontroller/__init__.c @@ -84,7 +84,7 @@ void common_hal_mcu_reset(void) { reset(); } -void common_hal_mcu_sleep(void) { +void common_hal_mcu_deep_sleep(void) { //deep sleep call here } diff --git a/ports/cxd56/common-hal/microcontroller/__init__.c b/ports/cxd56/common-hal/microcontroller/__init__.c index 4379f9be66897..57140dec7041f 100644 --- a/ports/cxd56/common-hal/microcontroller/__init__.c +++ b/ports/cxd56/common-hal/microcontroller/__init__.c @@ -81,7 +81,7 @@ void common_hal_mcu_reset(void) { boardctl(BOARDIOC_RESET, 0); } -void common_hal_mcu_sleep(void) { +void common_hal_mcu_deep_sleep(void) { //deep sleep call here } diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index 46715d9bf6859..552ad4452bf46 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -31,6 +31,10 @@ #include "esp_sleep.h" +void common_hal_alarm_disable_all(void) { + esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL); +} + mp_obj_t common_hal_alarm_get_wake_alarm(void) { switch (esp_sleep_get_wakeup_cause()) { case ESP_SLEEP_WAKEUP_TIMER: ; diff --git a/ports/esp32s2/common-hal/alarm_io/__init__.c b/ports/esp32s2/common-hal/alarm_io/__init__.c index a98b9332466ae..b39693c6af657 100644 --- a/ports/esp32s2/common-hal/alarm_io/__init__.c +++ b/ports/esp32s2/common-hal/alarm_io/__init__.c @@ -8,6 +8,14 @@ mp_obj_t common_hal_alarm_io_pin_state (alarm_io_obj_t *self_in) { mp_raise_ValueError(translate("io must be rtc io")); } + if (self_in->pull && !self_in->level) { + for (uint8_t i = 0; i<=4; i+=2) { + if (self_in->gpio == i) { + mp_raise_ValueError(translate("IOs 0, 2 & 4 do not support internal pullup in sleep")); + } + } + } + switch(esp_sleep_enable_ext0_wakeup(self_in->gpio, self_in->level)) { case ESP_ERR_INVALID_ARG: mp_raise_ValueError(translate("trigger level must be 0 or 1")); diff --git a/ports/esp32s2/common-hal/microcontroller/__init__.c b/ports/esp32s2/common-hal/microcontroller/__init__.c index f1dc24bb898a1..ab0e1bfaa47cf 100644 --- a/ports/esp32s2/common-hal/microcontroller/__init__.c +++ b/ports/esp32s2/common-hal/microcontroller/__init__.c @@ -79,7 +79,7 @@ void common_hal_mcu_reset(void) { while(1); } -void common_hal_mcu_sleep(void) { +void common_hal_mcu_deep_sleep(void) { esp_deep_sleep_start(); } diff --git a/ports/litex/common-hal/microcontroller/__init__.c b/ports/litex/common-hal/microcontroller/__init__.c index 3b1628c39ae2b..e6f50ed5a6abe 100644 --- a/ports/litex/common-hal/microcontroller/__init__.c +++ b/ports/litex/common-hal/microcontroller/__init__.c @@ -89,7 +89,7 @@ void common_hal_mcu_reset(void) { while(1); } -void common_hal_mcu_sleep(void) { +void common_hal_mcu_deep_sleep(void) { //deep sleep call here } diff --git a/ports/mimxrt10xx/common-hal/microcontroller/__init__.c b/ports/mimxrt10xx/common-hal/microcontroller/__init__.c index c7bc7eb9e834f..0329ced69b5d9 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/__init__.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/__init__.c @@ -86,7 +86,7 @@ void common_hal_mcu_reset(void) { NVIC_SystemReset(); } -void common_hal_mcu_sleep(void) { +void common_hal_mcu_deep_sleep(void) { //deep sleep call here } diff --git a/ports/nrf/common-hal/microcontroller/__init__.c b/ports/nrf/common-hal/microcontroller/__init__.c index ff6c658b8b01c..9911896bff751 100644 --- a/ports/nrf/common-hal/microcontroller/__init__.c +++ b/ports/nrf/common-hal/microcontroller/__init__.c @@ -95,7 +95,7 @@ void common_hal_mcu_reset(void) { reset_cpu(); } -void common_hal_mcu_sleep(void) { +void common_hal_mcu_deep_sleep(void) { //deep sleep call here } diff --git a/ports/stm/common-hal/microcontroller/__init__.c b/ports/stm/common-hal/microcontroller/__init__.c index 2a60c53426cee..bc81b0e4f5e90 100644 --- a/ports/stm/common-hal/microcontroller/__init__.c +++ b/ports/stm/common-hal/microcontroller/__init__.c @@ -81,7 +81,7 @@ void common_hal_mcu_reset(void) { NVIC_SystemReset(); } -void common_hal_mcu_sleep(void) { +void common_hal_mcu_deep_sleep(void) { //deep sleep call here } diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 72091decbf87b..7e17934a56d0b 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -108,7 +108,7 @@ endif ifeq ($(CIRCUITPY_ALARM_TIME),1) SRC_PATTERNS += alarm_time/% endif -ifeq ($(CIRCUITPY_ALARM_TIME),1) +ifeq ($(CIRCUITPY_ALARM_TOUCH),1) SRC_PATTERNS += alarm_touch/% endif ifeq ($(CIRCUITPY_ANALOGIO),1) diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 88c4bc8878c41..f43c2ea12de95 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -4,6 +4,12 @@ //| //| The `alarm` module implements deep sleep.""" +STATIC mp_obj_t alarm_disable_all(void) { + common_hal_alarm_disable_all(); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(alarm_disable_all_obj, alarm_disable_all); + STATIC mp_obj_t alarm_get_wake_alarm(void) { return common_hal_alarm_get_wake_alarm(); } @@ -11,7 +17,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(alarm_get_wake_alarm_obj, alarm_get_wake_alarm) STATIC const mp_rom_map_elem_t alarm_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_alarm) }, - { MP_ROM_QSTR(MP_QSTR_getWakeAlarm), MP_ROM_PTR(&alarm_get_wake_alarm_obj) }, + { MP_ROM_QSTR(MP_QSTR_Disable), MP_ROM_PTR(&alarm_disable_all_obj) }, + { MP_ROM_QSTR(MP_QSTR_get_wake_alarm), MP_ROM_PTR(&alarm_get_wake_alarm_obj) }, }; STATIC MP_DEFINE_CONST_DICT(alarm_module_globals, alarm_module_globals_table); diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h index 8b2cd9f770c3b..db3966ac5d28f 100644 --- a/shared-bindings/alarm/__init__.h +++ b/shared-bindings/alarm/__init__.h @@ -3,6 +3,7 @@ #include "py/obj.h" +extern void common_hal_alarm_disable_all(void); extern mp_obj_t common_hal_alarm_get_wake_alarm(void); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM___INIT___H diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index 88dc4179d60ea..bbc1640f76146 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -136,7 +136,7 @@ STATIC mp_obj_t mcu_reset(void) { STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_reset_obj, mcu_reset); STATIC mp_obj_t mcu_sleep(void) { - common_hal_mcu_sleep(); + common_hal_mcu_deep_sleep(); // We won't actually get here because mcu is going into sleep. return mp_const_none; } @@ -177,6 +177,7 @@ STATIC const mp_rom_map_elem_t mcu_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_enable_interrupts), MP_ROM_PTR(&mcu_enable_interrupts_obj) }, { MP_ROM_QSTR(MP_QSTR_on_next_reset), MP_ROM_PTR(&mcu_on_next_reset_obj) }, { MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&mcu_reset_obj) }, + //ToDo: Remove MP_QSTR_sleep when sleep on code.py exit implemented. { MP_ROM_QSTR(MP_QSTR_sleep), MP_ROM_PTR(&mcu_sleep_obj) }, #if CIRCUITPY_INTERNAL_NVM_SIZE > 0 { MP_ROM_QSTR(MP_QSTR_nvm), MP_ROM_PTR(&common_hal_mcu_nvm_obj) }, diff --git a/shared-bindings/microcontroller/__init__.h b/shared-bindings/microcontroller/__init__.h index 95f1cf8fc703d..f5bcfaa08a5f1 100644 --- a/shared-bindings/microcontroller/__init__.h +++ b/shared-bindings/microcontroller/__init__.h @@ -43,7 +43,7 @@ extern void common_hal_mcu_enable_interrupts(void); extern void common_hal_mcu_on_next_reset(mcu_runmode_t runmode); extern void common_hal_mcu_reset(void); -extern void common_hal_mcu_sleep(void); +extern void common_hal_mcu_deep_sleep(void); extern const mp_obj_dict_t mcu_pin_globals; From 0e444f0de8dd4db8b5be1c41b4c8062364e4fd94 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 30 Sep 2020 11:15:02 +0530 Subject: [PATCH 070/770] Implement sleep on code.py exit --- main.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/main.c b/main.c index 5a30f4bb26cb7..328c3bbcba881 100755 --- a/main.c +++ b/main.c @@ -57,6 +57,9 @@ #include "supervisor/shared/status_leds.h" #include "supervisor/shared/stack.h" #include "supervisor/serial.h" +#include "supervisor/usb.h" + +#include "shared-bindings/microcontroller/__init__.h" #include "boards/board.h" @@ -300,6 +303,19 @@ bool run_code_py(safe_mode_t safe_mode) { } } + for (uint8_t i = 0; i<=100; i++) { + if (!usb_msc_ejected()) { + //Go into light sleep + break; + } + mp_hal_delay_ms(10); + } + + if (usb_msc_ejected()) { + //Go into deep sleep + common_hal_mcu_deep_sleep(); + } + // Display a different completion message if the user has no USB attached (cannot save files) if (!serial_connected_at_start) { serial_write_compressed(translate("\nCode done running. Waiting for reload.\n")); From 354536c09fca3cecca6e6e5605710436501fccac Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 7 Oct 2020 09:55:48 +0530 Subject: [PATCH 071/770] Update translation --- locale/circuitpython.pot | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index e344f4dd8198d..eb958a5999a90 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -980,6 +980,10 @@ msgstr "" msgid "I2SOut not available" msgstr "" +#: ports/esp32s2/common-hal/alarm_io/__init__.c +msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" +msgstr "" + #: shared-bindings/aesio/aes.c #, c-format msgid "IV must be %d bytes long" @@ -2790,6 +2794,10 @@ msgstr "" msgid "invalid syntax for number" msgstr "" +#: ports/esp32s2/common-hal/alarm_io/__init__.c +msgid "io must be rtc io" +msgstr "" + #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "" @@ -3410,6 +3418,10 @@ msgstr "" msgid "threshold must be in the range 0-65536" msgstr "" +#: ports/esp32s2/common-hal/alarm_time/__init__.c +msgid "time out of range" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" @@ -3455,6 +3467,10 @@ msgstr "" msgid "trapz is defined for 1D arrays of equal length" msgstr "" +#: ports/esp32s2/common-hal/alarm_io/__init__.c +msgid "trigger level must be 0 or 1" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" msgstr "" @@ -3597,6 +3613,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/alarm_io/__init__.c +msgid "wakeup conflict" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "" From 1196d4bcf62884a18316bf44258a8d9b838f7273 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 14 Oct 2020 14:09:41 -0700 Subject: [PATCH 072/770] move to new module --- shared-bindings/alarm/__init__.c | 29 --------- shared-bindings/alarm/__init__.h | 9 --- shared-bindings/sleepio/__init__.c | 101 +++++++++++++++++++++++++++++ shared-bindings/sleepio/__init__.h | 10 +++ 4 files changed, 111 insertions(+), 38 deletions(-) delete mode 100644 shared-bindings/alarm/__init__.c delete mode 100644 shared-bindings/alarm/__init__.h create mode 100644 shared-bindings/sleepio/__init__.c create mode 100644 shared-bindings/sleepio/__init__.h diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c deleted file mode 100644 index f43c2ea12de95..0000000000000 --- a/shared-bindings/alarm/__init__.c +++ /dev/null @@ -1,29 +0,0 @@ -#include "shared-bindings/alarm/__init__.h" - -//| """alarm module -//| -//| The `alarm` module implements deep sleep.""" - -STATIC mp_obj_t alarm_disable_all(void) { - common_hal_alarm_disable_all(); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(alarm_disable_all_obj, alarm_disable_all); - -STATIC mp_obj_t alarm_get_wake_alarm(void) { - return common_hal_alarm_get_wake_alarm(); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(alarm_get_wake_alarm_obj, alarm_get_wake_alarm); - -STATIC const mp_rom_map_elem_t alarm_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_alarm) }, - { MP_ROM_QSTR(MP_QSTR_Disable), MP_ROM_PTR(&alarm_disable_all_obj) }, - { MP_ROM_QSTR(MP_QSTR_get_wake_alarm), MP_ROM_PTR(&alarm_get_wake_alarm_obj) }, -}; - -STATIC MP_DEFINE_CONST_DICT(alarm_module_globals, alarm_module_globals_table); - -const mp_obj_module_t alarm_module = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t*)&alarm_module_globals, -}; diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h deleted file mode 100644 index db3966ac5d28f..0000000000000 --- a/shared-bindings/alarm/__init__.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM___INIT___H -#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM___INIT___H - -#include "py/obj.h" - -extern void common_hal_alarm_disable_all(void); -extern mp_obj_t common_hal_alarm_get_wake_alarm(void); - -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM___INIT___H diff --git a/shared-bindings/sleepio/__init__.c b/shared-bindings/sleepio/__init__.c new file mode 100644 index 0000000000000..2f7a8c6c7b487 --- /dev/null +++ b/shared-bindings/sleepio/__init__.c @@ -0,0 +1,101 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft + * + * 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 "shared-bindings/alarm/__init__.h" + +//| """Light and deep sleep used to save power +//| +//| The `sleepio` module provides sleep related functionality. There are two supported levels of +//| sleep, light and deep. +//| +//| Light sleep leaves the CPU and RAM powered so that CircuitPython can resume where it left off +//| after being woken up. Light sleep is automatically done by CircuitPython when `time.sleep()` is +//| called. To light sleep until a non-time alarm use `sleepio.sleep_until_alarm()`. +//| +//| Deep sleep shuts down power to nearly all of the chip including the CPU and RAM. This can save +//| a more significant amount of power at the cost of starting CircuitPython from scratch when woken +//| up. CircuitPython will enter deep sleep automatically when code exits without error. If an +//| error causes CircuitPython to exit, error LED error flashes will be done periodically. To set +//| alarms for deep sleep use `sleepio.set_alarms` they will apply to next deep sleep only.""" + + +//| wake_alarm: Alarm +//| """The most recent alarm to wake us up from a sleep (light or deep.)""" +//| + +//| def sleep_until_alarm(alarm: Alarm, ...) -> Alarm: +//| """Performs a light sleep until woken by one of the alarms. The alarm that woke us up is +//| returned.""" +//| ... +//| + +STATIC mp_obj_t sleepio_sleep_until_alarm(size_t n_args, const mp_obj_t *args) { + // mp_int_t size = MP_OBJ_SMALL_INT_VALUE(struct_calcsize(args[0])); + // vstr_t vstr; + // vstr_init_len(&vstr, size); + // byte *p = (byte*)vstr.buf; + // memset(p, 0, size); + // byte *end_p = &p[size]; + // shared_modules_struct_pack_into(args[0], p, end_p, n_args - 1, &args[1]); + // return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); +} +MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(sleepio_sleep_until_alarm_obj, 1, MP_OBJ_FUN_ARGS_MAX, sleepio_sleep_until_alarm); + +//| def set_alarms(alarm: Alarm, ...) -> None: +//| """Set one or more alarms to wake up from a deep sleep. The last alarm to wake us up is +//| available as `wake_alarm`.""" +//| ... +//| +STATIC mp_obj_t sleepio_set_alarms(size_t n_args, const mp_obj_t *args) { + // mp_int_t size = MP_OBJ_SMALL_INT_VALUE(struct_calcsize(args[0])); + // vstr_t vstr; + // vstr_init_len(&vstr, size); + // byte *p = (byte*)vstr.buf; + // memset(p, 0, size); + // byte *end_p = &p[size]; + // shared_modules_struct_pack_into(args[0], p, end_p, n_args - 1, &args[1]); + // return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); +} +MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(sleepio_set_alarms_obj, 1, MP_OBJ_FUN_ARGS_MAX, sleepio_set_alarms); + + +mp_map_elem_t sleepio_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_sleepio) }, + + { MP_ROM_QSTR(MP_QSTR_wake_alarm), mp_const_none }, + { MP_ROM_QSTR(MP_QSTR_sleep_until_alarm), mp_const_none }, + { MP_ROM_QSTR(MP_QSTR_set_alarms), mp_const_none }, +}; +STATIC MP_DEFINE_CONST_DICT(sleepio_module_globals, sleepio_module_globals_table); + +void common_hal_sleepio_set_wake_alarm(mp_obj_t alarm) { + // sleepio_module_globals_table[1].value = alarm; +} + +const mp_obj_module_t sleepio_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&sleepio_module_globals, +}; diff --git a/shared-bindings/sleepio/__init__.h b/shared-bindings/sleepio/__init__.h new file mode 100644 index 0000000000000..ccd3bf4a02687 --- /dev/null +++ b/shared-bindings/sleepio/__init__.h @@ -0,0 +1,10 @@ +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_SLEEPIO___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_SLEEPIO___INIT___H + +#include "py/obj.h" + +// This is implemented by shared-bindings so that implementations can set the +// newest alarm source. +extern void common_hal_sleepio_set_wake_alarm(mp_obj_t alarm); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_SLEEPIO___INIT___H From 85dadf3a561c21e284d5daf42b1b3e367ce7ebc6 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 15 Oct 2020 16:59:29 -0700 Subject: [PATCH 073/770] More API changes --- shared-bindings/_typing/__init__.pyi | 12 ++++ shared-bindings/alarm_time/Time.c | 76 ++++++++++++++++++++++++++ shared-bindings/alarm_time/Time.h | 42 ++++++++++++++ shared-bindings/alarm_time/__init__.c | 26 +++++++++ shared-bindings/canio/BusState.c | 70 ++++++++++++++++++++++++ shared-bindings/canio/BusState.h | 33 +++++++++++ shared-bindings/canio/__init__.c | 60 ++++---------------- shared-bindings/canio/__init__.h | 6 -- shared-bindings/sleepio/__init__.c | 10 ++-- shared-bindings/supervisor/RunReason.c | 62 +++++++++++++++++++++ shared-bindings/supervisor/RunReason.h | 36 ++++++++++++ shared-bindings/supervisor/Runtime.c | 22 ++++++++ 12 files changed, 395 insertions(+), 60 deletions(-) create mode 100644 shared-bindings/alarm_time/Time.c create mode 100644 shared-bindings/alarm_time/Time.h create mode 100644 shared-bindings/canio/BusState.c create mode 100644 shared-bindings/canio/BusState.h create mode 100644 shared-bindings/supervisor/RunReason.c create mode 100644 shared-bindings/supervisor/RunReason.h diff --git a/shared-bindings/_typing/__init__.pyi b/shared-bindings/_typing/__init__.pyi index 48e68a8d574e9..3b3f18cb9b427 100644 --- a/shared-bindings/_typing/__init__.pyi +++ b/shared-bindings/_typing/__init__.pyi @@ -52,3 +52,15 @@ FrameBuffer = Union[rgbmatrix.RGBMatrix] - `rgbmatrix.RGBMatrix` """ + +Alarm = Union[ + alarm_time.Time, alarm_pin.PinLevel, alarm_touch.PinTouch +] +"""Classes that implement the audiosample protocol + + - `alarm_time.Time` + - `alarm_pin.PinLevel` + - `alarm_touch.PinTouch` + + You can play use these alarms to wake from light or deep sleep. +""" diff --git a/shared-bindings/alarm_time/Time.c b/shared-bindings/alarm_time/Time.c new file mode 100644 index 0000000000000..904bf522e22f5 --- /dev/null +++ b/shared-bindings/alarm_time/Time.c @@ -0,0 +1,76 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft + * + * 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 "py/obj.h" +#include "shared-bindings/alarm_time/__init__.h" + +//| """alarm_time module +//| +//| The `alarm_time` module implements deep sleep.""" + +STATIC mp_obj_t alarm_time_duration(mp_obj_t seconds_o) { + #if MICROPY_PY_BUILTINS_FLOAT + mp_float_t seconds = mp_obj_get_float(seconds_o); + mp_float_t msecs = 1000.0f * seconds + 0.5f; + #else + 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_alarm_time_duration(msecs); + + alarm_time_obj_t *self = m_new_obj(alarm_time_obj_t); + self->base.type = &alarm_time_type; + + return self; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(alarm_time_duration_obj, alarm_time_duration); + +STATIC mp_obj_t alarm_time_disable(void) { + common_hal_alarm_time_disable(); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(alarm_time_disable_obj, alarm_time_disable); + +STATIC const mp_rom_map_elem_t alarm_time_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_alarm_time) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_Duration), MP_ROM_PTR(&alarm_time_duration_obj) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_Disable), MP_ROM_PTR(&alarm_time_disable_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(alarm_time_module_globals, alarm_time_module_globals_table); + +const mp_obj_module_t alarm_time_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&alarm_time_module_globals, +}; + +const mp_obj_type_t alarm_time_type = { + { &mp_type_type }, + .name = MP_QSTR_timeAlarm, +}; diff --git a/shared-bindings/alarm_time/Time.h b/shared-bindings/alarm_time/Time.h new file mode 100644 index 0000000000000..9962c26f258b1 --- /dev/null +++ b/shared-bindings/alarm_time/Time.h @@ -0,0 +1,42 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_TIME_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_TIME_H + +#include "py/runtime.h" + +typedef struct { + mp_obj_base_t base; + uint64_t time_to_alarm; +} alarm_time_time_obj_t; + +extern const mp_obj_type_t alarm_time_time_type; + +void common_hal_alarm_time_time_construct(alarm_time_time_obj_t* self, + uint64_t ticks_ms); + +#endif //MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_TIME_H diff --git a/shared-bindings/alarm_time/__init__.c b/shared-bindings/alarm_time/__init__.c index 1707f7488f342..904bf522e22f5 100644 --- a/shared-bindings/alarm_time/__init__.c +++ b/shared-bindings/alarm_time/__init__.c @@ -1,3 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft + * + * 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 "py/obj.h" #include "shared-bindings/alarm_time/__init__.h" diff --git a/shared-bindings/canio/BusState.c b/shared-bindings/canio/BusState.c new file mode 100644 index 0000000000000..e0501b8d83948 --- /dev/null +++ b/shared-bindings/canio/BusState.c @@ -0,0 +1,70 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler 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 "py/enum.h" + +#include "shared-bindings/canio/BusState.h" + +MAKE_ENUM_VALUE(canio_bus_state_type, bus_state, ERROR_ACTIVE, BUS_STATE_ERROR_ACTIVE); +MAKE_ENUM_VALUE(canio_bus_state_type, bus_state, ERROR_PASSIVE, BUS_STATE_ERROR_PASSIVE); +MAKE_ENUM_VALUE(canio_bus_state_type, bus_state, ERROR_WARNING, BUS_STATE_ERROR_WARNING); +MAKE_ENUM_VALUE(canio_bus_state_type, bus_state, BUS_OFF, BUS_STATE_OFF); + +//| class BusState: +//| """The state of the CAN bus""" +//| +//| ERROR_ACTIVE: object +//| """The bus is in the normal (active) state""" +//| +//| ERROR_WARNING: object +//| """The bus is in the normal (active) state, but a moderate number of errors have occurred recently. +//| +//| NOTE: Not all implementations may use ERROR_WARNING. Do not rely on seeing ERROR_WARNING before ERROR_PASSIVE.""" +//| +//| ERROR_PASSIVE: object +//| """The bus is in the passive state due to the number of errors that have occurred recently. +//| +//| This device will acknowledge packets it receives, but cannot transmit messages. +//| If additional errors occur, this device may progress to BUS_OFF. +//| If it successfully acknowledges other packets on the bus, it can return to ERROR_WARNING or ERROR_ACTIVE and transmit packets. +//| """ +//| +//| BUS_OFF: object +//| """The bus has turned off due to the number of errors that have +//| occurred recently. It must be restarted before it will send or receive +//| packets. This device will neither send or acknowledge packets on the bus.""" +//| +MAKE_ENUM_MAP(canio_bus_state) { + MAKE_ENUM_MAP_ENTRY(bus_state, ERROR_ACTIVE), + MAKE_ENUM_MAP_ENTRY(bus_state, ERROR_PASSIVE), + MAKE_ENUM_MAP_ENTRY(bus_state, ERROR_WARNING), + MAKE_ENUM_MAP_ENTRY(bus_state, BUS_OFF), +}; +STATIC MP_DEFINE_CONST_DICT(canio_bus_state_locals_dict, canio_bus_state_locals_table); + +MAKE_PRINTER(canio, canio_bus_state); + +MAKE_ENUM_TYPE(canio, BusState, canio_bus_state); diff --git a/shared-bindings/canio/BusState.h b/shared-bindings/canio/BusState.h new file mode 100644 index 0000000000000..e24eba92c11a3 --- /dev/null +++ b/shared-bindings/canio/BusState.h @@ -0,0 +1,33 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler 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. + */ + +#pragma once + +typedef enum { + BUS_STATE_ERROR_ACTIVE, BUS_STATE_ERROR_PASSIVE, BUS_STATE_ERROR_WARNING, BUS_STATE_OFF +} canio_bus_state_t; + +extern const mp_obj_type_t canio_bus_state_type; diff --git a/shared-bindings/canio/__init__.c b/shared-bindings/canio/__init__.c index f29d3ab8ac5df..451a68c9eb7d7 100644 --- a/shared-bindings/canio/__init__.c +++ b/shared-bindings/canio/__init__.c @@ -24,6 +24,16 @@ * THE SOFTWARE. */ +#include "py/obj.h" + +#include "shared-bindings/canio/__init__.h" + +#include "shared-bindings/canio/BusState.h" +#include "shared-bindings/canio/CAN.h" +#include "shared-bindings/canio/Match.h" +#include "shared-bindings/canio/Message.h" +#include "shared-bindings/canio/Listener.h" + //| """CAN bus access //| //| The `canio` module contains low level classes to support the CAN bus @@ -57,56 +67,6 @@ //| """ //| -#include "py/obj.h" -#include "py/enum.h" - -#include "shared-bindings/canio/__init__.h" -#include "shared-bindings/canio/CAN.h" -#include "shared-bindings/canio/Match.h" -#include "shared-bindings/canio/Message.h" -#include "shared-bindings/canio/Listener.h" - -MAKE_ENUM_VALUE(canio_bus_state_type, bus_state, ERROR_ACTIVE, BUS_STATE_ERROR_ACTIVE); -MAKE_ENUM_VALUE(canio_bus_state_type, bus_state, ERROR_PASSIVE, BUS_STATE_ERROR_PASSIVE); -MAKE_ENUM_VALUE(canio_bus_state_type, bus_state, ERROR_WARNING, BUS_STATE_ERROR_WARNING); -MAKE_ENUM_VALUE(canio_bus_state_type, bus_state, BUS_OFF, BUS_STATE_OFF); - -//| class BusState: -//| """The state of the CAN bus""" -//| -//| ERROR_ACTIVE: object -//| """The bus is in the normal (active) state""" -//| -//| ERROR_WARNING: object -//| """The bus is in the normal (active) state, but a moderate number of errors have occurred recently. -//| -//| NOTE: Not all implementations may use ERROR_WARNING. Do not rely on seeing ERROR_WARNING before ERROR_PASSIVE.""" -//| -//| ERROR_PASSIVE: object -//| """The bus is in the passive state due to the number of errors that have occurred recently. -//| -//| This device will acknowledge packets it receives, but cannot transmit messages. -//| If additional errors occur, this device may progress to BUS_OFF. -//| If it successfully acknowledges other packets on the bus, it can return to ERROR_WARNING or ERROR_ACTIVE and transmit packets. -//| """ -//| -//| BUS_OFF: object -//| """The bus has turned off due to the number of errors that have -//| occurred recently. It must be restarted before it will send or receive -//| packets. This device will neither send or acknowledge packets on the bus.""" -//| -MAKE_ENUM_MAP(canio_bus_state) { - MAKE_ENUM_MAP_ENTRY(bus_state, ERROR_ACTIVE), - MAKE_ENUM_MAP_ENTRY(bus_state, ERROR_PASSIVE), - MAKE_ENUM_MAP_ENTRY(bus_state, ERROR_WARNING), - MAKE_ENUM_MAP_ENTRY(bus_state, BUS_OFF), -}; -STATIC MP_DEFINE_CONST_DICT(canio_bus_state_locals_dict, canio_bus_state_locals_table); - -MAKE_PRINTER(canio, canio_bus_state); - -MAKE_ENUM_TYPE(canio, BusState, canio_bus_state); - STATIC const mp_rom_map_elem_t canio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_BusState), MP_ROM_PTR(&canio_bus_state_type) }, { MP_ROM_QSTR(MP_QSTR_CAN), MP_ROM_PTR(&canio_can_type) }, diff --git a/shared-bindings/canio/__init__.h b/shared-bindings/canio/__init__.h index e24eba92c11a3..20b6638cd8ff2 100644 --- a/shared-bindings/canio/__init__.h +++ b/shared-bindings/canio/__init__.h @@ -25,9 +25,3 @@ */ #pragma once - -typedef enum { - BUS_STATE_ERROR_ACTIVE, BUS_STATE_ERROR_PASSIVE, BUS_STATE_ERROR_WARNING, BUS_STATE_OFF -} canio_bus_state_t; - -extern const mp_obj_type_t canio_bus_state_type; diff --git a/shared-bindings/sleepio/__init__.c b/shared-bindings/sleepio/__init__.c index 2f7a8c6c7b487..2d5db18f0a5e4 100644 --- a/shared-bindings/sleepio/__init__.c +++ b/shared-bindings/sleepio/__init__.c @@ -33,14 +33,15 @@ //| //| Light sleep leaves the CPU and RAM powered so that CircuitPython can resume where it left off //| after being woken up. Light sleep is automatically done by CircuitPython when `time.sleep()` is -//| called. To light sleep until a non-time alarm use `sleepio.sleep_until_alarm()`. +//| called. To light sleep until a non-time alarm use `sleepio.sleep_until_alarm()`. Any active +//| peripherals, such as I2C, are left on. //| //| Deep sleep shuts down power to nearly all of the chip including the CPU and RAM. This can save //| a more significant amount of power at the cost of starting CircuitPython from scratch when woken //| up. CircuitPython will enter deep sleep automatically when code exits without error. If an //| error causes CircuitPython to exit, error LED error flashes will be done periodically. To set //| alarms for deep sleep use `sleepio.set_alarms` they will apply to next deep sleep only.""" - +//| //| wake_alarm: Alarm //| """The most recent alarm to wake us up from a sleep (light or deep.)""" @@ -86,8 +87,9 @@ mp_map_elem_t sleepio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_sleepio) }, { MP_ROM_QSTR(MP_QSTR_wake_alarm), mp_const_none }, - { MP_ROM_QSTR(MP_QSTR_sleep_until_alarm), mp_const_none }, - { MP_ROM_QSTR(MP_QSTR_set_alarms), mp_const_none }, + + { MP_ROM_QSTR(MP_QSTR_sleep_until_alarm), sleepio_sleep_until_alarm_obj }, + { MP_ROM_QSTR(MP_QSTR_set_alarms), sleepio_set_alarms_obj }, }; STATIC MP_DEFINE_CONST_DICT(sleepio_module_globals, sleepio_module_globals_table); diff --git a/shared-bindings/supervisor/RunReason.c b/shared-bindings/supervisor/RunReason.c new file mode 100644 index 0000000000000..5233cf959b19e --- /dev/null +++ b/shared-bindings/supervisor/RunReason.c @@ -0,0 +1,62 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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 "py/enum.h" + +#include "shared-bindings/supervisor/RunReason.h" + +MAKE_ENUM_VALUE(canio_bus_state_type, run_reason, ERROR_ACTIVE, RUN_REASON_STARTUP); +MAKE_ENUM_VALUE(canio_bus_state_type, bus_state, ERROR_PASSIVE, RUN_REASON_AUTORELOAD); +MAKE_ENUM_VALUE(canio_bus_state_type, bus_state, ERROR_WARNING, RUN_REASON_SUPERVISOR_RELOAD); +MAKE_ENUM_VALUE(canio_bus_state_type, bus_state, BUS_OFF, RUN_REASON_RELOAD_HOTKEY); + +//| class RunReason: +//| """The state of the CAN bus""" +//| +//| STARTUP: object +//| """The first VM was run after the microcontroller started up. See `microcontroller.start_reason` +//| for more detail why the microcontroller was started.""" +//| +//| AUTORELOAD: object +//| """The VM was run due to a USB write to the filesystem.""" +//| +//| SUPERVISOR_RELOAD: object +//| """The VM was run due to a call to `supervisor.reload()`.""" +//| +//| RELOAD_HOTKEY: object +//| """The VM was run due CTRL-D.""" +//| +MAKE_ENUM_MAP(canio_bus_state) { + MAKE_ENUM_MAP_ENTRY(bus_state, ERROR_ACTIVE), + MAKE_ENUM_MAP_ENTRY(bus_state, ERROR_PASSIVE), + MAKE_ENUM_MAP_ENTRY(bus_state, ERROR_WARNING), + MAKE_ENUM_MAP_ENTRY(bus_state, BUS_OFF), +}; +STATIC MP_DEFINE_CONST_DICT(canio_bus_state_locals_dict, canio_bus_state_locals_table); + +MAKE_PRINTER(canio, canio_bus_state); + +MAKE_ENUM_TYPE(canio, BusState, canio_bus_state); diff --git a/shared-bindings/supervisor/RunReason.h b/shared-bindings/supervisor/RunReason.h new file mode 100644 index 0000000000000..f9aaacae634bf --- /dev/null +++ b/shared-bindings/supervisor/RunReason.h @@ -0,0 +1,36 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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. + */ + +#pragma once + +typedef enum { + RUN_REASON_STARTUP, + RUN_REASON_AUTORELOAD, + RUN_REASON_SUPERVISOR_RELOAD, + RUN_REASON_RELOAD_HOTKEY +} supervisor_run_reason_t; + +extern const mp_obj_type_t canio_bus_state_type; diff --git a/shared-bindings/supervisor/Runtime.c b/shared-bindings/supervisor/Runtime.c index bfca6e7b1da17..f9db38c9b5636 100755 --- a/shared-bindings/supervisor/Runtime.c +++ b/shared-bindings/supervisor/Runtime.c @@ -90,9 +90,31 @@ const mp_obj_property_t supervisor_serial_bytes_available_obj = { }; +//| run_reason: RunReason +//| """Returns why the Python VM was run this time.""" +//| +STATIC mp_obj_t supervisor_get_run_reason(mp_obj_t self) { + if (!common_hal_get_serial_bytes_available()) { + return mp_const_false; + } + else { + return mp_const_true; + } +} +MP_DEFINE_CONST_FUN_OBJ_1(supervisor_get_run_reason_obj, supervisor_get_run_reason); + +const mp_obj_property_t supervisor_run_reason_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&supervisor_get_run_reason_obj, + (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + + STATIC const mp_rom_map_elem_t supervisor_runtime_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_serial_connected), MP_ROM_PTR(&supervisor_serial_connected_obj) }, { MP_ROM_QSTR(MP_QSTR_serial_bytes_available), MP_ROM_PTR(&supervisor_serial_bytes_available_obj) }, + { MP_ROM_QSTR(MP_QSTR_run_reason), MP_ROM_PTR(&supervisor_run_reason_obj) }, }; STATIC MP_DEFINE_CONST_DICT(supervisor_runtime_locals_dict, supervisor_runtime_locals_dict_table); From 27827a4fef74dc66996ecb670f01ad5d58500899 Mon Sep 17 00:00:00 2001 From: Gaetan Date: Wed, 28 Oct 2020 00:34:07 +0100 Subject: [PATCH 074/770] =?UTF-8?q?Fix=20EOF=20error=20modifi=C3=A9=C2=A0:?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20mpconfigboard.mk=20modifi=C3=A9?= =?UTF-8?q?=C2=A0:=20=20=20=20=20=20=20=20=20pins.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk | 2 +- ports/nrf/boards/holyiot_nrf52840/pins.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk b/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk index d85de75071188..ead2059531b8f 100644 --- a/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk +++ b/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk @@ -5,4 +5,4 @@ USB_MANUFACTURER = "Holyiot" MCU_CHIP = nrf52840 -INTERNAL_FLASH_FILESYSTEM = 1 \ No newline at end of file +INTERNAL_FLASH_FILESYSTEM = 1 diff --git a/ports/nrf/boards/holyiot_nrf52840/pins.c b/ports/nrf/boards/holyiot_nrf52840/pins.c index 4e2593e58f970..604744e0eaa92 100644 --- a/ports/nrf/boards/holyiot_nrf52840/pins.c +++ b/ports/nrf/boards/holyiot_nrf52840/pins.c @@ -43,7 +43,6 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_P0_13), MP_ROM_PTR(&pin_P0_13) }, { MP_ROM_QSTR(MP_QSTR_P0_16), MP_ROM_PTR(&pin_P0_16) }, - { MP_ROM_QSTR(MP_QSTR_P0_07), MP_ROM_PTR(&pin_P0_07) }, { MP_ROM_QSTR(MP_QSTR_P1_09), MP_ROM_PTR(&pin_P1_09) }, { MP_ROM_QSTR(MP_QSTR_P0_12), MP_ROM_PTR(&pin_P0_12) }, @@ -55,5 +54,4 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { }; - -MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); \ No newline at end of file +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 9b911b2211715e9da7ae55b691f54fe2f33a4486 Mon Sep 17 00:00:00 2001 From: Gaetan Date: Wed, 28 Oct 2020 00:38:07 +0100 Subject: [PATCH 075/770] =?UTF-8?q?modifi=C3=A9=C2=A0:=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20pins.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ports/nrf/boards/holyiot_nrf52840/pins.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/nrf/boards/holyiot_nrf52840/pins.c b/ports/nrf/boards/holyiot_nrf52840/pins.c index 604744e0eaa92..8e06675916125 100644 --- a/ports/nrf/boards/holyiot_nrf52840/pins.c +++ b/ports/nrf/boards/holyiot_nrf52840/pins.c @@ -50,8 +50,12 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_P0_21), MP_ROM_PTR(&pin_P0_21) }, { MP_ROM_QSTR(MP_QSTR_P0_19), MP_ROM_PTR(&pin_P0_19) }, - // RESET { MP_ROM_QSTR(MP_QSTR_P0_18), MP_ROM_PTR(&pin_P0_18) }, + // RESET { MP_ROM_QSTR(MP_QSTR_P0_18), MP_ROM_PTR(&pin_P0_18) } }; +<<<<<<< HEAD +======= + +>>>>>>> d0426b3438a934257c5351f7eb2d9cdd79881c03 MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From b44011d196a0a7294fca1e1825054761979ba075 Mon Sep 17 00:00:00 2001 From: Gaetan Date: Wed, 28 Oct 2020 01:43:42 +0100 Subject: [PATCH 076/770] fix railing Whitespace pin.c --- ports/nrf/boards/holyiot_nrf52840/pins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/nrf/boards/holyiot_nrf52840/pins.c b/ports/nrf/boards/holyiot_nrf52840/pins.c index c9e222b671677..83be4f0ac7bab 100644 --- a/ports/nrf/boards/holyiot_nrf52840/pins.c +++ b/ports/nrf/boards/holyiot_nrf52840/pins.c @@ -49,7 +49,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_P0_23), MP_ROM_PTR(&pin_P0_23) }, { MP_ROM_QSTR(MP_QSTR_P0_21), MP_ROM_PTR(&pin_P0_21) }, { MP_ROM_QSTR(MP_QSTR_P0_19), MP_ROM_PTR(&pin_P0_19) }, - + // RESET { MP_ROM_QSTR(MP_QSTR_P0_18), MP_ROM_PTR(&pin_P0_18) } }; From 9a4efed8cbaca3aa48c6cc0ce0a4e267eef7a8e1 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 27 Oct 2020 17:55:03 -0700 Subject: [PATCH 077/770] Start tweaking the workflow to sleep --- main.c | 49 ++++++++++----- .../esp32s2/common-hal/alarm_touch/__init__.c | 7 --- shared-bindings/alarm_touch/__init__.c | 28 --------- shared-bindings/alarm_touch/__init__.h | 14 ----- shared-bindings/sleepio/ResetReason.c | 61 +++++++++++++++++++ shared-bindings/sleepio/ResetReason.h | 36 +++++++++++ shared-bindings/sleepio/__init__.c | 27 ++++---- shared-bindings/sleepio/__init__.h | 5 +- supervisor/serial.h | 1 - supervisor/shared/rgb_led_status.c | 10 ++- supervisor/shared/safe_mode.c | 4 ++ supervisor/shared/serial.h | 29 +++++++++ supervisor/shared/usb/usb.c | 9 ++- supervisor/shared/workflow.c | 32 ++++++++++ supervisor/shared/workflow.h | 29 +++++++++ supervisor/supervisor.mk | 1 + supervisor/workflow.h | 30 +++++++++ 17 files changed, 282 insertions(+), 90 deletions(-) delete mode 100644 ports/esp32s2/common-hal/alarm_touch/__init__.c delete mode 100644 shared-bindings/alarm_touch/__init__.c delete mode 100644 shared-bindings/alarm_touch/__init__.h create mode 100644 shared-bindings/sleepio/ResetReason.c create mode 100644 shared-bindings/sleepio/ResetReason.h create mode 100644 supervisor/shared/serial.h create mode 100644 supervisor/shared/workflow.c create mode 100644 supervisor/shared/workflow.h create mode 100755 supervisor/workflow.h diff --git a/main.c b/main.c index 328c3bbcba881..1854a140719cc 100755 --- a/main.c +++ b/main.c @@ -88,6 +88,10 @@ #include "common-hal/canio/CAN.h" #endif +#if CIRCUITPY_SLEEPIO +#include "shared-bindings/sleepio/__init__.h" +#endif + void do_str(const char *src, mp_parse_input_kind_t input_kind) { mp_lexer_t *lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, src, strlen(src), 0); if (lex == NULL) { @@ -303,19 +307,6 @@ bool run_code_py(safe_mode_t safe_mode) { } } - for (uint8_t i = 0; i<=100; i++) { - if (!usb_msc_ejected()) { - //Go into light sleep - break; - } - mp_hal_delay_ms(10); - } - - if (usb_msc_ejected()) { - //Go into deep sleep - common_hal_mcu_deep_sleep(); - } - // Display a different completion message if the user has no USB attached (cannot save files) if (!serial_connected_at_start) { serial_write_compressed(translate("\nCode done running. Waiting for reload.\n")); @@ -326,6 +317,14 @@ bool run_code_py(safe_mode_t safe_mode) { bool refreshed_epaper_display = false; #endif rgb_status_animation_t animation; + bool ok = result->return_code != PYEXEC_EXCEPTION; + #if CIRCUITPY_SLEEPIO + // If USB isn't enumerated then deep sleep. + if (ok && !supervisor_workflow_active() && supervisor_ticks_ms64() > CIRCUITPY_USB_ENUMERATION_DELAY * 1024) { + common_hal_sleepio_deep_sleep(); + } + #endif + // Show the animation every N seconds. prep_rgb_status_animation(&result, found_main, safe_mode, &animation); while (true) { RUN_BACKGROUND_TASKS; @@ -358,8 +357,24 @@ bool run_code_py(safe_mode_t safe_mode) { refreshed_epaper_display = maybe_refresh_epaperdisplay(); } #endif - - tick_rgb_status_animation(&animation); + bool animation_done = tick_rgb_status_animation(&animation); + if (animation_done && supervisor_workflow_active()) { + #if CIRCUITPY_SLEEPIO + int64_t remaining_enumeration_wait = CIRCUITPY_USB_ENUMERATION_DELAY * 1024 - supervisor_ticks_ms64(); + // If USB isn't enumerated then deep sleep after our waiting period. + if (ok && remaining_enumeration_wait < 0) { + common_hal_sleepio_deep_sleep(); + return; // Doesn't actually get here. + } + #endif + // Wake up every so often to flash the error code. + if (!ok) { + port_interrupt_after_ticks(CIRCUITPY_FLASH_ERROR_PERIOD * 1024); + } else { + port_interrupt_after_ticks(remaining_enumeration_wait); + } + port_sleep_until_interrupt(); + } } } @@ -406,7 +421,9 @@ void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) { if (!skip_boot_output) { // Wait 1.5 seconds before opening CIRCUITPY_BOOT_OUTPUT_FILE for write, // in case power is momentary or will fail shortly due to, say a low, battery. - mp_hal_delay_ms(1500); + if (common_hal_sleepio_get_reset_reason() == RESET_REASON_POWER_VALID) { + mp_hal_delay_ms(1500); + } // USB isn't up, so we can write the file. filesystem_set_internal_writable_by_usb(false); diff --git a/ports/esp32s2/common-hal/alarm_touch/__init__.c b/ports/esp32s2/common-hal/alarm_touch/__init__.c deleted file mode 100644 index df32b269306a3..0000000000000 --- a/ports/esp32s2/common-hal/alarm_touch/__init__.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "esp_sleep.h" - -#include "shared-bindings/alarm_touch/__init__.h" - -void common_hal_alarm_touch_disable (void) { - esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_TOUCHPAD); -} diff --git a/shared-bindings/alarm_touch/__init__.c b/shared-bindings/alarm_touch/__init__.c deleted file mode 100644 index 5f5a156d8012c..0000000000000 --- a/shared-bindings/alarm_touch/__init__.c +++ /dev/null @@ -1,28 +0,0 @@ -#include "py/obj.h" -#include "shared-bindings/alarm_touch/__init__.h" - -//| """alarm_touch module -//| -//| The `alarm_touch` module implements deep sleep.""" - -STATIC mp_obj_t alarm_touch_disable(void) { - common_hal_alarm_touch_disable(); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(alarm_touch_disable_obj, alarm_touch_disable); - -STATIC const mp_rom_map_elem_t alarm_touch_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_alarm_touch) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_Disable), MP_ROM_PTR(&alarm_touch_disable_obj) }, -}; -STATIC MP_DEFINE_CONST_DICT(alarm_touch_module_globals, alarm_touch_module_globals_table); - -const mp_obj_module_t alarm_touch_module = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t*)&alarm_touch_module_globals, -}; - -const mp_obj_type_t alarm_touch_type = { - { &mp_type_type }, - .name = MP_QSTR_touchAlarm, -}; diff --git a/shared-bindings/alarm_touch/__init__.h b/shared-bindings/alarm_touch/__init__.h deleted file mode 100644 index 600587d247e2c..0000000000000 --- a/shared-bindings/alarm_touch/__init__.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TOUCH___INIT___H -#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TOUCH___INIT___H - -#include "py/runtime.h" - -typedef struct { - mp_obj_base_t base; -} alarm_touch_obj_t; - -extern const mp_obj_type_t alarm_touch_type; - -extern void common_hal_alarm_touch_disable (void); - -#endif //MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TOUCH___INIT___H diff --git a/shared-bindings/sleepio/ResetReason.c b/shared-bindings/sleepio/ResetReason.c new file mode 100644 index 0000000000000..095f4bed0dadc --- /dev/null +++ b/shared-bindings/sleepio/ResetReason.c @@ -0,0 +1,61 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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 "py/enum.h" + +#include "shared-bindings/sleepio/ResetReason.h" + +MAKE_ENUM_VALUE(sleepio_reset_reason_type, reset_reason, POWER_VALID, RESET_REASON_POWER_VALID); +MAKE_ENUM_VALUE(sleepio_reset_reason_type, reset_reason, SOFTWARE, RESET_REASON_SOFTWARE); +MAKE_ENUM_VALUE(sleepio_reset_reason_type, reset_reason, DEEP_SLEEP_ALARM, RESET_REASON_DEEP_SLEEP_ALARM); +MAKE_ENUM_VALUE(sleepio_reset_reason_type, reset_reason, EXTERNAL, RESET_REASON_EXTERNAL); + +//| class ResetReason: +//| """The reason the chip was last reset""" +//| +//| POWER_VALID: object +//| """The chip was reset and started once power levels were valid.""" +//| +//| SOFTWARE: object +//| """The chip was reset from software.""" +//| +//| DEEP_SLEEP_ALARM: object +//| """The chip was reset for deep sleep and started by an alarm.""" +//| +//| EXTERNAL: object +//| """The chip was reset by an external input such as a button.""" +//| +MAKE_ENUM_MAP(sleepio_reset_reason) { + MAKE_ENUM_MAP_ENTRY(reset_reason, POWER_VALID), + MAKE_ENUM_MAP_ENTRY(reset_reason, SOFTWARE), + MAKE_ENUM_MAP_ENTRY(reset_reason, DEEP_SLEEP_ALARM), + MAKE_ENUM_MAP_ENTRY(reset_reason, EXTERNAL), +}; +STATIC MP_DEFINE_CONST_DICT(sleepio_reset_reason_locals_dict, sleepio_reset_reason_locals_table); + +MAKE_PRINTER(sleepio, sleepio_reset_reason); + +MAKE_ENUM_TYPE(sleepio, ResetReason, sleepio_reset_reason); diff --git a/shared-bindings/sleepio/ResetReason.h b/shared-bindings/sleepio/ResetReason.h new file mode 100644 index 0000000000000..50b8d002aae84 --- /dev/null +++ b/shared-bindings/sleepio/ResetReason.h @@ -0,0 +1,36 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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. + */ + +#pragma once + +typedef enum { + RESET_REASON_POWER_APPLIED, + RESET_REASON_SOFTWARE, + RESET_REASON_DEEP_SLEEP_ALARM, + RESET_REASON_BUTTON, +} sleepio_reset_reason_t; + +extern const mp_obj_type_t sleepio_reset_reason_type; diff --git a/shared-bindings/sleepio/__init__.c b/shared-bindings/sleepio/__init__.c index 2d5db18f0a5e4..9793c1b5021a4 100644 --- a/shared-bindings/sleepio/__init__.c +++ b/shared-bindings/sleepio/__init__.c @@ -47,6 +47,10 @@ //| """The most recent alarm to wake us up from a sleep (light or deep.)""" //| +//| reset_reason: ResetReason +//| """The reason the chip started up from reset state. This can may be power up or due to an alarm.""" +//| + //| def sleep_until_alarm(alarm: Alarm, ...) -> Alarm: //| """Performs a light sleep until woken by one of the alarms. The alarm that woke us up is //| returned.""" @@ -54,14 +58,6 @@ //| STATIC mp_obj_t sleepio_sleep_until_alarm(size_t n_args, const mp_obj_t *args) { - // mp_int_t size = MP_OBJ_SMALL_INT_VALUE(struct_calcsize(args[0])); - // vstr_t vstr; - // vstr_init_len(&vstr, size); - // byte *p = (byte*)vstr.buf; - // memset(p, 0, size); - // byte *end_p = &p[size]; - // shared_modules_struct_pack_into(args[0], p, end_p, n_args - 1, &args[1]); - // return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(sleepio_sleep_until_alarm_obj, 1, MP_OBJ_FUN_ARGS_MAX, sleepio_sleep_until_alarm); @@ -71,14 +67,6 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(sleepio_sleep_until_alarm_obj, 1, MP_OBJ_FUN //| ... //| STATIC mp_obj_t sleepio_set_alarms(size_t n_args, const mp_obj_t *args) { - // mp_int_t size = MP_OBJ_SMALL_INT_VALUE(struct_calcsize(args[0])); - // vstr_t vstr; - // vstr_init_len(&vstr, size); - // byte *p = (byte*)vstr.buf; - // memset(p, 0, size); - // byte *end_p = &p[size]; - // shared_modules_struct_pack_into(args[0], p, end_p, n_args - 1, &args[1]); - // return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(sleepio_set_alarms_obj, 1, MP_OBJ_FUN_ARGS_MAX, sleepio_set_alarms); @@ -87,16 +75,23 @@ mp_map_elem_t sleepio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_sleepio) }, { MP_ROM_QSTR(MP_QSTR_wake_alarm), mp_const_none }, + { MP_ROM_QSTR(MP_QSTR_reset_reason), mp_const_none }, { MP_ROM_QSTR(MP_QSTR_sleep_until_alarm), sleepio_sleep_until_alarm_obj }, { MP_ROM_QSTR(MP_QSTR_set_alarms), sleepio_set_alarms_obj }, }; STATIC MP_DEFINE_CONST_DICT(sleepio_module_globals, sleepio_module_globals_table); +// These are called from common hal code to set the current wake alarm. void common_hal_sleepio_set_wake_alarm(mp_obj_t alarm) { // sleepio_module_globals_table[1].value = alarm; } +// These are called from common hal code to set the current wake alarm. +void common_hal_sleepio_set_reset_reason(mp_obj_t reset_reason) { + // sleepio_module_globals_table[1].value = alarm; +} + const mp_obj_module_t sleepio_module = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t*)&sleepio_module_globals, diff --git a/shared-bindings/sleepio/__init__.h b/shared-bindings/sleepio/__init__.h index ccd3bf4a02687..6ea538055aab7 100644 --- a/shared-bindings/sleepio/__init__.h +++ b/shared-bindings/sleepio/__init__.h @@ -3,8 +3,7 @@ #include "py/obj.h" -// This is implemented by shared-bindings so that implementations can set the -// newest alarm source. -extern void common_hal_sleepio_set_wake_alarm(mp_obj_t alarm); +extern mp_obj_t common_hal_sleepio_get_wake_alarm(void); +extern sleepio_reset_reason_t common_hal_sleepio_get_reset_reason(void); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_SLEEPIO___INIT___H diff --git a/supervisor/serial.h b/supervisor/serial.h index 9c2d44737a9d6..066886303e920 100644 --- a/supervisor/serial.h +++ b/supervisor/serial.h @@ -47,5 +47,4 @@ char serial_read(void); bool serial_bytes_available(void); bool serial_connected(void); -extern volatile bool _serial_connected; #endif // MICROPY_INCLUDED_SUPERVISOR_SERIAL_H diff --git a/supervisor/shared/rgb_led_status.c b/supervisor/shared/rgb_led_status.c index 283b9da123b14..bff74a1f0e86b 100644 --- a/supervisor/shared/rgb_led_status.c +++ b/supervisor/shared/rgb_led_status.c @@ -367,6 +367,7 @@ void prep_rgb_status_animation(const pyexec_result_t* result, status->found_main = found_main; status->total_exception_cycle = 0; status->ok = result->return_code != PYEXEC_EXCEPTION; + status->cycles = 0; if (status->ok) { // If this isn't an exception, skip exception sorting and handling return; @@ -411,14 +412,16 @@ void prep_rgb_status_animation(const pyexec_result_t* result, #endif } -void tick_rgb_status_animation(rgb_status_animation_t* status) { +bool tick_rgb_status_animation(rgb_status_animation_t* status) { #if defined(MICROPY_HW_NEOPIXEL) || (defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK)) || (defined(CP_RGB_STATUS_LED)) uint32_t tick_diff = supervisor_ticks_ms32() - status->pattern_start; if (status->ok) { // All is good. Ramp ALL_DONE up and down. if (tick_diff > ALL_GOOD_CYCLE_MS) { status->pattern_start = supervisor_ticks_ms32(); - tick_diff = 0; + status->cycles++; + new_status_color(BLACK); + return status->cycles; } uint16_t brightness = tick_diff * 255 / (ALL_GOOD_CYCLE_MS / 2); @@ -433,7 +436,8 @@ void tick_rgb_status_animation(rgb_status_animation_t* status) { } else { if (tick_diff > status->total_exception_cycle) { status->pattern_start = supervisor_ticks_ms32(); - tick_diff = 0; + status->cycles++; + return; } // First flash the file color. if (tick_diff < EXCEPTION_TYPE_LENGTH_MS) { diff --git a/supervisor/shared/safe_mode.c b/supervisor/shared/safe_mode.c index d59e754ed4d76..fa871eeebf7fd 100644 --- a/supervisor/shared/safe_mode.c +++ b/supervisor/shared/safe_mode.c @@ -52,6 +52,10 @@ safe_mode_t wait_for_safe_mode_reset(void) { current_safe_mode = safe_mode; return safe_mode; } + if (common_hal_sleepio_get_reset_reason() != RESET_REASON_POWER_VALID && + common_hal_sleepio_get_reset_reason() != RESET_REASON_BUTTON) { + return NO_SAFE_MODE; + } port_set_saved_word(SAFE_MODE_DATA_GUARD | (MANUAL_SAFE_MODE << 8)); // Wait for a while to allow for reset. temp_status_color(SAFE_MODE); diff --git a/supervisor/shared/serial.h b/supervisor/shared/serial.h new file mode 100644 index 0000000000000..84f92c337ca96 --- /dev/null +++ b/supervisor/shared/serial.h @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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. + */ + +#pragma once + +extern volatile bool _serial_connected; diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c index 89fbf56f37e06..7fbc5cbe6a37c 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -30,6 +30,7 @@ #include "supervisor/background_callback.h" #include "supervisor/port.h" #include "supervisor/serial.h" +#include "supervisor/shared/serial.h" #include "supervisor/usb.h" #include "lib/utils/interrupt_char.h" #include "lib/mp-readline/readline.h" @@ -102,14 +103,16 @@ void usb_irq_handler(void) { // tinyusb callbacks //--------------------------------------------------------------------+ -// Invoked when device is mounted +// Invoked when device is plugged into a host void tud_mount_cb(void) { usb_msc_mount(); + _workflow_active = true; } -// Invoked when device is unmounted +// Invoked when device is unplugged from the host void tud_umount_cb(void) { usb_msc_umount(); + _workflow_active = false; } // Invoked when usb bus is suspended @@ -117,10 +120,12 @@ void tud_umount_cb(void) { // USB Specs: Within 7ms, device must draw an average current less than 2.5 mA from bus void tud_suspend_cb(bool remote_wakeup_en) { _serial_connected = false; + _workflow_active = false; } // Invoked when usb bus is resumed void tud_resume_cb(void) { + _workflow_active = true; } // Invoked when cdc when line state changed e.g connected/disconnected diff --git a/supervisor/shared/workflow.c b/supervisor/shared/workflow.c new file mode 100644 index 0000000000000..adcffb319acb1 --- /dev/null +++ b/supervisor/shared/workflow.c @@ -0,0 +1,32 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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. + */ + +// Set by the shared USB code. +volatile bool _workflow_active; + +bool workflow_active(void) { + return _workflow_active; +} diff --git a/supervisor/shared/workflow.h b/supervisor/shared/workflow.h new file mode 100644 index 0000000000000..4a138332a7861 --- /dev/null +++ b/supervisor/shared/workflow.h @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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. + */ + +#pragma once + +extern volatile bool _workflow_active; diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk index e81c51a88c862..a59e99e3def2b 100644 --- a/supervisor/supervisor.mk +++ b/supervisor/supervisor.mk @@ -75,6 +75,7 @@ else lib/tinyusb/src/class/cdc/cdc_device.c \ lib/tinyusb/src/tusb.c \ supervisor/shared/serial.c \ + supervisor/shared/workflow.c \ supervisor/usb.c \ supervisor/shared/usb/usb_desc.c \ supervisor/shared/usb/usb.c \ diff --git a/supervisor/workflow.h b/supervisor/workflow.h new file mode 100755 index 0000000000000..4008b83a11fec --- /dev/null +++ b/supervisor/workflow.h @@ -0,0 +1,30 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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. + */ + +#pragma once + +// True when the user could be actively iterating on their code. +bool workflow_active(void); From 5e3bfa1956ca4d327fcad23ce508ebbdaeac4d69 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 28 Oct 2020 20:08:25 +0530 Subject: [PATCH 078/770] countio implementation for esp32s2 --- ports/esp32s2/common-hal/countio/Counter.c | 69 +++++++++++++++++++++ ports/esp32s2/common-hal/countio/Counter.h | 15 +++++ ports/esp32s2/common-hal/countio/__init__.c | 1 + ports/esp32s2/mpconfigport.mk | 2 +- 4 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 ports/esp32s2/common-hal/countio/Counter.c create mode 100644 ports/esp32s2/common-hal/countio/Counter.h create mode 100644 ports/esp32s2/common-hal/countio/__init__.c diff --git a/ports/esp32s2/common-hal/countio/Counter.c b/ports/esp32s2/common-hal/countio/Counter.c new file mode 100644 index 0000000000000..6a76a163d78e6 --- /dev/null +++ b/ports/esp32s2/common-hal/countio/Counter.c @@ -0,0 +1,69 @@ +#include "common-hal/countio/Counter.h" + +#include "py/runtime.h" +#include "supervisor/shared/translate.h" + +#include "driver/pcnt.h" + +static void pcnt_init(countio_counter_obj_t* self) { + int unit = PCNT_UNIT_0; + // Prepare configuration for the PCNT unit + pcnt_config_t pcnt_config = { + // Set PCNT input signal and control GPIOs + .pulse_gpio_num = self->pin->number, + .ctrl_gpio_num = PCNT_PIN_NOT_USED, + .channel = PCNT_CHANNEL_0, + .unit = unit, + // What to do on the positive / negative edge of pulse input? + .pos_mode = PCNT_COUNT_INC, // Count up on the positive edge + .neg_mode = PCNT_COUNT_DIS, // Keep the counter value on the negative edge + }; + // Initialize PCNT unit + pcnt_unit_config(&pcnt_config); + + // Configure and enable the input filter + pcnt_set_filter_value(unit, 100); + pcnt_filter_enable(unit); + + // Initialize PCNT's counter + pcnt_counter_pause(unit); + pcnt_counter_clear(unit); + + // Everything is set up, now go to counting + pcnt_counter_resume(unit); +} + +void common_hal_countio_counter_construct(countio_counter_obj_t* self, + const mcu_pin_obj_t* pin) { + claim_pin(pin); + self->pin = pin; + pcnt_init(self); +} + +bool common_hal_countio_counter_deinited(countio_counter_obj_t* self) { + return self->pin == NULL; +} + +void common_hal_countio_counter_deinit(countio_counter_obj_t* self) { + if (common_hal_countio_counter_deinited(self)) { + return; + } + reset_pin_number(self->pin->number); + self->pin = NULL; +} + +mp_int_t common_hal_countio_counter_get_count(countio_counter_obj_t* self) { + int16_t count; + pcnt_get_counter_value(PCNT_UNIT_0, &count); + return count+self->count; +} + +void common_hal_countio_counter_set_count(countio_counter_obj_t* self, + mp_int_t new_count) { + self->count = new_count; + pcnt_counter_clear(PCNT_UNIT_0); +} + +void common_hal_countio_counter_reset(countio_counter_obj_t* self) { + common_hal_countio_counter_set_count(self, 0); +} diff --git a/ports/esp32s2/common-hal/countio/Counter.h b/ports/esp32s2/common-hal/countio/Counter.h new file mode 100644 index 0000000000000..3406f9daaf5c7 --- /dev/null +++ b/ports/esp32s2/common-hal/countio/Counter.h @@ -0,0 +1,15 @@ + +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_COUNTIO_COUNTER_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_COUNTIO_COUNTER_H + +#include "common-hal/microcontroller/Pin.h" + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + const mcu_pin_obj_t * pin; + mp_int_t count; +} countio_counter_obj_t; + +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_COUNTIO_COUNT_H diff --git a/ports/esp32s2/common-hal/countio/__init__.c b/ports/esp32s2/common-hal/countio/__init__.c new file mode 100644 index 0000000000000..b95b20d1534ea --- /dev/null +++ b/ports/esp32s2/common-hal/countio/__init__.c @@ -0,0 +1 @@ +//No countio module functions diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index c06c89c909337..bdb25a87b8046 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -17,7 +17,7 @@ CIRCUITPY_FULL_BUILD = 1 CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_AUDIOIO = 0 CIRCUITPY_CANIO = 1 -CIRCUITPY_COUNTIO = 0 +CIRCUITPY_COUNTIO = 1 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_ROTARYIO = 0 From 5ab2f16f64f0935ac8ad6fa776c435d55a3cff1e Mon Sep 17 00:00:00 2001 From: Gaetan Date: Wed, 28 Oct 2020 22:08:10 +0100 Subject: [PATCH 079/770] =?UTF-8?q?Change=20Board=20Name=20to=20ADM=5FB=5F?= =?UTF-8?q?NRF52840=5F1=20edit=20=20=20:=20=20=20=20=20=20=20=20=20.github?= =?UTF-8?q?/workflows/build.yml=20rename=C2=A0:=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?ports/nrf/boards/holyiot=5Fnrf52840/board.c=20->=20ports/nrf/bo?= =?UTF-8?q?ards/ADM=5FB=5FNRF52840=5F1/board.c=20rename=C2=A0:=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20ports/nrf/boards/holyiot=5Fnrf52840/mpconfigboar?= =?UTF-8?q?d.h=20->=20ports/nrf/boards/ADM=5FB=5FNRF52840=5F1/mpconfigboar?= =?UTF-8?q?d.h=20rename=C2=A0:=20=20=20=20=20=20=20=20=20ports/nrf/boards/?= =?UTF-8?q?holyiot=5Fnrf52840/mpconfigboard.mk=20->=20ports/nrf/boards/ADM?= =?UTF-8?q?=5FB=5FNRF52840=5F1/mpconfigboard.mk=20rename=C2=A0:=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20ports/nrf/boards/holyiot=5Fnrf52840/pins.c=20?= =?UTF-8?q?->=20ports/nrf/boards/ADM=5FB=5FNRF52840=5F1/pins.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 2 +- .../nrf/boards/{holyiot_nrf52840 => ADM_B_NRF52840_1}/board.c | 0 .../{holyiot_nrf52840 => ADM_B_NRF52840_1}/mpconfigboard.h | 2 +- .../{holyiot_nrf52840 => ADM_B_NRF52840_1}/mpconfigboard.mk | 4 ++-- .../nrf/boards/{holyiot_nrf52840 => ADM_B_NRF52840_1}/pins.c | 0 5 files changed, 4 insertions(+), 4 deletions(-) rename ports/nrf/boards/{holyiot_nrf52840 => ADM_B_NRF52840_1}/board.c (100%) rename ports/nrf/boards/{holyiot_nrf52840 => ADM_B_NRF52840_1}/mpconfigboard.h (95%) rename ports/nrf/boards/{holyiot_nrf52840 => ADM_B_NRF52840_1}/mpconfigboard.mk (55%) rename ports/nrf/boards/{holyiot_nrf52840 => ADM_B_NRF52840_1}/pins.c (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cada55aaa4c56..1a967046cae37 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -162,6 +162,7 @@ jobs: board: - "8086_commander" - "TG-Watch02A" + - "ADM_B_NRF52840_1" - "aloriumtech_evo_m51" - "aramcon_badge_2019" - "arduino_mkr1300" @@ -214,7 +215,6 @@ jobs: - "hallowing_m0_express" - "hallowing_m4_express" - "hiibot_bluefi" - - "holyiot_nrf52840" - "ikigaisense_vita" - "imxrt1010_evk" - "imxrt1020_evk" diff --git a/ports/nrf/boards/holyiot_nrf52840/board.c b/ports/nrf/boards/ADM_B_NRF52840_1/board.c similarity index 100% rename from ports/nrf/boards/holyiot_nrf52840/board.c rename to ports/nrf/boards/ADM_B_NRF52840_1/board.c diff --git a/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.h b/ports/nrf/boards/ADM_B_NRF52840_1/mpconfigboard.h similarity index 95% rename from ports/nrf/boards/holyiot_nrf52840/mpconfigboard.h rename to ports/nrf/boards/ADM_B_NRF52840_1/mpconfigboard.h index 3b64d3a6299fa..575d09feb5a6a 100644 --- a/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.h +++ b/ports/nrf/boards/ADM_B_NRF52840_1/mpconfigboard.h @@ -27,7 +27,7 @@ #include "nrfx/hal/nrf_gpio.h" -#define MICROPY_HW_BOARD_NAME "Holyiot nRF52840" +#define MICROPY_HW_BOARD_NAME "AtelierDuMaker nRF52840 Breakout" #define MICROPY_HW_MCU_NAME "nRF52840" #define MICROPY_HW_LED_STATUS (&pin_P0_19) diff --git a/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk b/ports/nrf/boards/ADM_B_NRF52840_1/mpconfigboard.mk similarity index 55% rename from ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk rename to ports/nrf/boards/ADM_B_NRF52840_1/mpconfigboard.mk index ead2059531b8f..f3a2e830dd7ed 100644 --- a/ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk +++ b/ports/nrf/boards/ADM_B_NRF52840_1/mpconfigboard.mk @@ -1,7 +1,7 @@ USB_VID = 0x239A USB_PID = 0x80A0 -USB_PRODUCT = "HOLYIOTNRF52840" -USB_MANUFACTURER = "Holyiot" +USB_PRODUCT = "ADM_B_NRF52840_1" +USB_MANUFACTURER = "AtelierDuMaker" MCU_CHIP = nrf52840 diff --git a/ports/nrf/boards/holyiot_nrf52840/pins.c b/ports/nrf/boards/ADM_B_NRF52840_1/pins.c similarity index 100% rename from ports/nrf/boards/holyiot_nrf52840/pins.c rename to ports/nrf/boards/ADM_B_NRF52840_1/pins.c From 3dcee5be803a4d6bd9f05ecb13608467dc2e3a55 Mon Sep 17 00:00:00 2001 From: Gaetan Date: Wed, 28 Oct 2020 22:38:13 +0100 Subject: [PATCH 080/770] Fix: .github/workflows/build.yml --- .github/workflows/build.yml | 49 ++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1a967046cae37..2f61b60415380 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,7 +28,7 @@ jobs: - name: CircuitPython version run: | git describe --dirty --tags - echo "::set-env name=CP_VERSION::$(git describe --dirty --tags)" + echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags) - name: Set up Python 3.8 uses: actions/setup-python@v1 with: @@ -36,7 +36,7 @@ jobs: - name: Install deps run: | sudo apt-get install -y eatmydata - sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 + sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 latexmk texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black awscli - name: Versions run: | @@ -73,17 +73,26 @@ jobs: with: name: stubs path: circuitpython-stubs* - - name: Docs + - name: Test Documentation Build (HTML) run: sphinx-build -E -W -b html -D version=${{ env.CP_VERSION }} -D release=${{ env.CP_VERSION }} . _build/html - uses: actions/upload-artifact@v2 with: name: docs path: _build/html + - name: Test Documentation Build (LaTeX/PDF) + run: | + make latexpdf + - uses: actions/upload-artifact@v2 + with: + name: docs + path: _build/latex - name: Translations run: make check-translate - name: New boards check run: python3 -u ci_new_boards_check.py working-directory: tools + - name: Duplicate USB VID/PID Check + run: python3 -u -m tools.ci_check_duplicate_usb_vid_pid - name: Build mpy-cross.static-raspbian run: make -C mpy-cross -j2 -f Makefile.static-raspbian - uses: actions/upload-artifact@v2 @@ -122,8 +131,8 @@ jobs: run: echo "$GITHUB_CONTEXT" - name: Install dependencies run: | - brew install gettext awscli - echo "::set-env name=PATH::/usr/local/opt/gettext/bin:$PATH" + brew install gettext + echo >>$GITHUB_PATH /usr/local/opt/gettext/bin - name: Versions run: | gcc --version @@ -137,7 +146,7 @@ jobs: - name: CircuitPython version run: | git describe --dirty --tags - echo "::set-env name=CP_VERSION::$(git describe --dirty --tags)" + echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags) - name: Build mpy-cross run: make -C mpy-cross -j2 - uses: actions/upload-artifact@v2 @@ -161,8 +170,8 @@ jobs: matrix: board: - "8086_commander" - - "TG-Watch02A" - "ADM_B_NRF52840_1" + - "TG-Watch02A" - "aloriumtech_evo_m51" - "aramcon_badge_2019" - "arduino_mkr1300" @@ -171,7 +180,8 @@ jobs: - "arduino_nano_33_iot" - "arduino_zero" - "bast_pro_mini_m0" - - "bdmicro_vina_m0" + - "bdmicro_vina_d21" + - "bdmicro_vina_d51" - "bless_dev_board_multi_sensor" - "blm_badge" - "capablerobot_usbhub" @@ -189,6 +199,8 @@ jobs: - "datum_imu" - "datum_light" - "datum_weather" + - "dynossat_edu_eps" + - "dynossat_edu_obc" - "electronut_labs_blip" - "electronut_labs_papyr" - "escornabot_makech" @@ -202,6 +214,7 @@ jobs: - "feather_m0_rfm69" - "feather_m0_rfm9x" - "feather_m0_supersized" + - "feather_m4_can" - "feather_m4_express" - "feather_m7_1011" - "feather_mimxrt1011" @@ -228,11 +241,13 @@ jobs: - "makerdiary_nrf52840_m2_devkit" - "makerdiary_nrf52840_mdk" - "makerdiary_nrf52840_mdk_usb_dongle" + - "matrixportal_m4" - "meowbit_v121" - "meowmeow" - "metro_m0_express" - "metro_m4_airlift_lite" - "metro_m4_express" + - "metro_m7_1011" - "metro_nrf52840_express" - "mini_sam_m4" - "monster_m4sk" @@ -254,6 +269,7 @@ jobs: - "pca10100" - "pewpew10" - "pewpew_m4" + - "picoplanet" - "pirkey_m0" - "pitaya_go" - "pyb_nano_v2" @@ -267,6 +283,8 @@ jobs: - "pyportal" - "pyportal_titano" - "pyruler" + - "qtpy_m0" + - "qtpy_m0_haxpress" - "raytac_mdbt50q-db-40" - "robohatmm1_m4" - "sam32" @@ -401,9 +419,17 @@ jobs: fail-fast: false matrix: board: + - "adafruit_metro_esp32s2" + - "electroniccats_bastwifi" + - "espressif_kaluga_1" - "espressif_saola_1_wroom" - "espressif_saola_1_wrover" + - "microdev_micro_s2" + - "muselab_nanoesp32_s2" + - "targett_module_clip_wroom" + - "targett_module_clip_wrover" - "unexpectedmaker_feathers2" + - "unexpectedmaker_feathers2_prerelease" steps: - name: Set up Python 3.8 @@ -423,6 +449,11 @@ jobs: with: path: ${{ github.workspace }}/.idf_tools key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20200801 + - name: Clone IDF submodules + run: | + (cd $IDF_PATH && git submodule update --init) + env: + IDF_PATH: ${{ github.workspace }}/ports/esp32s2/esp-idf - name: Install IDF tools run: | $IDF_PATH/tools/idf_tools.py --non-interactive install required @@ -473,4 +504,4 @@ jobs: env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) + if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) \ No newline at end of file From 34ce8d8642d43397627e6001b221039d7190db5b Mon Sep 17 00:00:00 2001 From: Noel Gaetan Date: Wed, 28 Oct 2020 22:43:54 +0100 Subject: [PATCH 081/770] Update build.yml --- .github/workflows/build.yml | 47 +++++++------------------------------ 1 file changed, 8 insertions(+), 39 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2f61b60415380..6619cbdf23084 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,7 +28,7 @@ jobs: - name: CircuitPython version run: | git describe --dirty --tags - echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags) + echo "::set-env name=CP_VERSION::$(git describe --dirty --tags)" - name: Set up Python 3.8 uses: actions/setup-python@v1 with: @@ -36,7 +36,7 @@ jobs: - name: Install deps run: | sudo apt-get install -y eatmydata - sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 latexmk texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra + sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black awscli - name: Versions run: | @@ -73,26 +73,17 @@ jobs: with: name: stubs path: circuitpython-stubs* - - name: Test Documentation Build (HTML) + - name: Docs run: sphinx-build -E -W -b html -D version=${{ env.CP_VERSION }} -D release=${{ env.CP_VERSION }} . _build/html - uses: actions/upload-artifact@v2 with: name: docs path: _build/html - - name: Test Documentation Build (LaTeX/PDF) - run: | - make latexpdf - - uses: actions/upload-artifact@v2 - with: - name: docs - path: _build/latex - name: Translations run: make check-translate - name: New boards check run: python3 -u ci_new_boards_check.py working-directory: tools - - name: Duplicate USB VID/PID Check - run: python3 -u -m tools.ci_check_duplicate_usb_vid_pid - name: Build mpy-cross.static-raspbian run: make -C mpy-cross -j2 -f Makefile.static-raspbian - uses: actions/upload-artifact@v2 @@ -131,8 +122,8 @@ jobs: run: echo "$GITHUB_CONTEXT" - name: Install dependencies run: | - brew install gettext - echo >>$GITHUB_PATH /usr/local/opt/gettext/bin + brew install gettext awscli + echo "::set-env name=PATH::/usr/local/opt/gettext/bin:$PATH" - name: Versions run: | gcc --version @@ -146,7 +137,7 @@ jobs: - name: CircuitPython version run: | git describe --dirty --tags - echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags) + echo "::set-env name=CP_VERSION::$(git describe --dirty --tags)" - name: Build mpy-cross run: make -C mpy-cross -j2 - uses: actions/upload-artifact@v2 @@ -180,8 +171,7 @@ jobs: - "arduino_nano_33_iot" - "arduino_zero" - "bast_pro_mini_m0" - - "bdmicro_vina_d21" - - "bdmicro_vina_d51" + - "bdmicro_vina_m0" - "bless_dev_board_multi_sensor" - "blm_badge" - "capablerobot_usbhub" @@ -199,8 +189,6 @@ jobs: - "datum_imu" - "datum_light" - "datum_weather" - - "dynossat_edu_eps" - - "dynossat_edu_obc" - "electronut_labs_blip" - "electronut_labs_papyr" - "escornabot_makech" @@ -214,7 +202,6 @@ jobs: - "feather_m0_rfm69" - "feather_m0_rfm9x" - "feather_m0_supersized" - - "feather_m4_can" - "feather_m4_express" - "feather_m7_1011" - "feather_mimxrt1011" @@ -241,13 +228,11 @@ jobs: - "makerdiary_nrf52840_m2_devkit" - "makerdiary_nrf52840_mdk" - "makerdiary_nrf52840_mdk_usb_dongle" - - "matrixportal_m4" - "meowbit_v121" - "meowmeow" - "metro_m0_express" - "metro_m4_airlift_lite" - "metro_m4_express" - - "metro_m7_1011" - "metro_nrf52840_express" - "mini_sam_m4" - "monster_m4sk" @@ -269,7 +254,6 @@ jobs: - "pca10100" - "pewpew10" - "pewpew_m4" - - "picoplanet" - "pirkey_m0" - "pitaya_go" - "pyb_nano_v2" @@ -283,8 +267,6 @@ jobs: - "pyportal" - "pyportal_titano" - "pyruler" - - "qtpy_m0" - - "qtpy_m0_haxpress" - "raytac_mdbt50q-db-40" - "robohatmm1_m4" - "sam32" @@ -419,17 +401,9 @@ jobs: fail-fast: false matrix: board: - - "adafruit_metro_esp32s2" - - "electroniccats_bastwifi" - - "espressif_kaluga_1" - "espressif_saola_1_wroom" - "espressif_saola_1_wrover" - - "microdev_micro_s2" - - "muselab_nanoesp32_s2" - - "targett_module_clip_wroom" - - "targett_module_clip_wrover" - "unexpectedmaker_feathers2" - - "unexpectedmaker_feathers2_prerelease" steps: - name: Set up Python 3.8 @@ -449,11 +423,6 @@ jobs: with: path: ${{ github.workspace }}/.idf_tools key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20200801 - - name: Clone IDF submodules - run: | - (cd $IDF_PATH && git submodule update --init) - env: - IDF_PATH: ${{ github.workspace }}/ports/esp32s2/esp-idf - name: Install IDF tools run: | $IDF_PATH/tools/idf_tools.py --non-interactive install required @@ -504,4 +473,4 @@ jobs: env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) \ No newline at end of file + if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) From cbad75a7d2c2b997a7663f7793fe36cac82a9deb Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Wed, 28 Oct 2020 15:40:36 +0000 Subject: [PATCH 082/770] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (844 of 844 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 8696d7509a2c8..7ad85e0b7840e 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-10-21 20:13-0500\n" -"PO-Revision-Date: 2020-10-27 21:01+0000\n" +"PO-Revision-Date: 2020-10-28 21:45+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -298,7 +298,7 @@ msgstr "O tipo do endereço está fora do alcance" #: ports/esp32s2/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" -msgstr "" +msgstr "Todos os periféricos CAN estão em uso" #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" @@ -426,7 +426,7 @@ msgstr "" #: ports/esp32s2/common-hal/canio/CAN.c msgid "Baudrate not supported by peripheral" -msgstr "" +msgstr "O Baudrate não é suportado pelo periférico" #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c @@ -2932,7 +2932,7 @@ msgstr "o long int não é suportado nesta compilação" #: ports/esp32s2/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" -msgstr "" +msgstr "o loopback + o modo silencioso não é suportado pelo periférico" #: py/parse.c msgid "malformed f-string" @@ -3555,12 +3555,12 @@ msgstr "a tupla/lista está com tamanho incorreto" #: ports/esp32s2/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" -msgstr "" +msgstr "o twai_driver_install retornou um erro esp-idf #%d" #: ports/esp32s2/common-hal/canio/CAN.c #, c-format msgid "twai_start returned esp-idf error #%d" -msgstr "" +msgstr "o twai_start retornou um erro esp-idf #%d" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c From a28755d53df963ad70cae62e526a3cb2f147851f Mon Sep 17 00:00:00 2001 From: hexthat Date: Wed, 28 Oct 2020 06:14:24 +0000 Subject: [PATCH 083/770] Translated using Weblate (Chinese (Pinyin)) Currently translated at 100.0% (844 of 844 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/ --- locale/zh_Latn_pinyin.po | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 9b32993eb0540..4cc86400d9b5f 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-10-21 20:13-0500\n" -"PO-Revision-Date: 2020-10-22 20:48+0000\n" +"PO-Revision-Date: 2020-10-28 21:45+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" "Language: zh_Latn_pinyin\n" @@ -15,7 +15,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.3.1\n" +"X-Generator: Weblate 4.3.2-dev\n" #: main.c msgid "" @@ -296,7 +296,7 @@ msgstr "Dìzhǐ lèixíng chāochū fànwéi" #: ports/esp32s2/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" -msgstr "" +msgstr "suǒ yǒu CAN wài shè dōu zài shǐ yòng zhōng" #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" @@ -422,7 +422,7 @@ msgstr "" #: ports/esp32s2/common-hal/canio/CAN.c msgid "Baudrate not supported by peripheral" -msgstr "" +msgstr "wài shè bù zhī chí de bō tè lā tè" #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c @@ -2895,7 +2895,7 @@ msgstr "cǐ bǎnběn bù zhīchí zhǎng zhěngshù" #: ports/esp32s2/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" -msgstr "" +msgstr "Wài shè bù zhī chí huán huí + jìng yīn mó shì" #: py/parse.c msgid "malformed f-string" @@ -2933,11 +2933,11 @@ msgstr "chāochū zuìdà dìguī shēndù" #: extmod/ulab/code/approx/approx.c msgid "maxiter must be > 0" -msgstr "" +msgstr "maxiter bì xū > 0" #: extmod/ulab/code/approx/approx.c msgid "maxiter should be > 0" -msgstr "" +msgstr "maxiter yìng wéi > 0" #: py/runtime.c #, c-format @@ -3377,7 +3377,7 @@ msgstr "páixù cānshù bìxū shì ndarray" #: extmod/ulab/code/numerical/numerical.c msgid "sorted axis can't be longer than 65535" -msgstr "" +msgstr "pái xù zhóu bù néng chāo guò 65535" #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" @@ -3511,12 +3511,12 @@ msgstr "yuán zǔ/lièbiǎo chángdù cuòwù" #: ports/esp32s2/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" -msgstr "" +msgstr "twai_driver_install fǎn huí esp-idf cuò wù #%d" #: ports/esp32s2/common-hal/canio/CAN.c #, c-format msgid "twai_start returned esp-idf error #%d" -msgstr "" +msgstr "twai_start fǎn huí esp -idf cuò wù #%d" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c From e83be19d0f43d406c0968eb3903972cf127efb8d Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 28 Oct 2020 17:48:12 -0500 Subject: [PATCH 084/770] actions: Fix location of stubs upload --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0792d36a014ff..5092e4832360c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -117,7 +117,7 @@ jobs: [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-amd64-linux-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static.exe s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-x64-windows-${{ env.CP_VERSION }}.exe --no-progress --region us-east-1 zip -9 circuitpython-stubs.CP_VERSION }}.zip stubs - [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp circuitpython-stubs.zip s3://adafruit-circuit-python/bin/mpy-cross/circuitpython-stubs-${{ env.CP_VERSION }}.zip --no-progress --region us-east-1 + [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp circuitpython-stubs.zip s3://adafruit-circuit-python/bin/stubs/circuitpython-stubs-${{ env.CP_VERSION }}.zip --no-progress --region us-east-1 env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} From 25bad660c6cfc0c697ad02da18d9b9e8c1d9053e Mon Sep 17 00:00:00 2001 From: lady ada Date: Wed, 28 Oct 2020 19:23:18 -0400 Subject: [PATCH 085/770] add light sensor, move batt monitor --- ports/esp32s2/boards/adafruit_esp32s2_eink_portal/pins.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/pins.c b/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/pins.c index 2cf3d240292ad..65bc3fb53b42e 100644 --- a/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/pins.c +++ b/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/pins.c @@ -18,8 +18,10 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_BUTTON_C), MP_ROM_PTR(&pin_GPIO12) }, { MP_ROM_QSTR(MP_QSTR_BUTTON_D), MP_ROM_PTR(&pin_GPIO11) }, - { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO2) }, - { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_LIGHT), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO33) }, { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO34) }, From 59b9ca409cc6d1835567f866f9a96c04bc78d2c3 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 28 Oct 2020 20:33:10 -0400 Subject: [PATCH 086/770] matrixportal ESP TX and RX pins were swapped --- ports/atmel-samd/boards/matrixportal_m4/pins.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/atmel-samd/boards/matrixportal_m4/pins.c b/ports/atmel-samd/boards/matrixportal_m4/pins.c index 34865597b6432..1f9956d9ecebf 100644 --- a/ports/atmel-samd/boards/matrixportal_m4/pins.c +++ b/ports/atmel-samd/boards/matrixportal_m4/pins.c @@ -16,8 +16,8 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_BUSY), MP_ROM_PTR(&pin_PA22) }, { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RESET), MP_ROM_PTR(&pin_PA21) }, { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RTS), MP_ROM_PTR(&pin_PA18) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_TX), MP_ROM_PTR(&pin_PA12) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_PA13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_TX), MP_ROM_PTR(&pin_PA13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_PA12) }, { MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_PB30) }, { MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_PB31) }, From 7fd73c7d39399042ad6ed3bfe5b1c64da05c964e Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 28 Oct 2020 18:08:31 -0700 Subject: [PATCH 087/770] Initial UDP work. Need to test --- ports/esp32s2/common-hal/socketpool/Socket.c | 63 ++++++++- .../common-hal/socketpool/SocketPool.c | 7 +- shared-bindings/socketpool/Socket.c | 120 ++++++++---------- shared-bindings/socketpool/Socket.h | 4 + 4 files changed, 121 insertions(+), 73 deletions(-) diff --git a/ports/esp32s2/common-hal/socketpool/Socket.c b/ports/esp32s2/common-hal/socketpool/Socket.c index 0a994c604ec84..7f031521f7ff4 100644 --- a/ports/esp32s2/common-hal/socketpool/Socket.c +++ b/ports/esp32s2/common-hal/socketpool/Socket.c @@ -121,16 +121,77 @@ mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, return received; } +mp_uint_t common_hal_socketpool_socket_sendto(socketpool_socket_obj_t* self, + const char* host, size_t hostlen, uint8_t port, const uint8_t* buf, mp_uint_t len) { + + struct sockaddr_in dest_addr; + dest_addr.sin_addr.s_addr = inet_addr(HOST_IP_ADDR); + dest_addr.sin_family = AF_INET; + dest_addr.sin_port = htons(port); + + + const struct addrinfo hints = { + .ai_family = AF_INET, + .ai_socktype = SOCK_STREAM, + }; + struct addrinfo *res; + int err = getaddrinfo(host, NULL, &hints, &res); + if (err != 0 || res == NULL) { + return mp_const_none; + } + + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-align" + struct in_addr *addr = &((struct sockaddr_in *)res->ai_addr)->sin_addr; + #pragma GCC diagnostic pop + char ip_str[IP4ADDR_STRLEN_MAX]; + inet_ntoa_r(*addr, ip_str, IP4ADDR_STRLEN_MAX); + mp_obj_t ip_obj = mp_obj_new_str(ip_str, strlen(ip_str)); + freeaddrinfo(res); + + + + int err = lwip_sendto(self->num, buf, len, 0 /* flags */, + (struct sockaddr *)&dest_addr, sizeof(dest_addr)); +} + +mp_uint_t common_hal_socketpool_socket_recvfrom_into(socketpool_socket_obj_t* self, + const uint8_t* buf, mp_uint_t len, uint8_t* ip, uint8_t port) { + + const struct addrinfo hints = { + .ai_family = AF_INET, + .ai_socktype = SOCK_STREAM, + }; + struct addrinfo *res; + int err = getaddrinfo(host, NULL, &hints, &res); + if (err != 0 || res == NULL) { + return mp_const_none; + } + + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-align" + struct in_addr *addr = &((struct sockaddr_in *)res->ai_addr)->sin_addr; + #pragma GCC diagnostic pop + char ip_str[IP4ADDR_STRLEN_MAX]; + inet_ntoa_r(*addr, ip_str, IP4ADDR_STRLEN_MAX); + mp_obj_t ip_obj = mp_obj_new_str(ip_str, strlen(ip_str)); + freeaddrinfo(res); +} + void common_hal_socketpool_socket_close(socketpool_socket_obj_t* self) { self->connected = false; if (self->tcp != NULL) { esp_tls_conn_destroy(self->tcp); self->tcp = NULL; } + if (self->num >= 0) { + lwip_shutdown(self->num, 0); + lwip_close(self->num); + } } bool common_hal_socketpool_socket_get_closed(socketpool_socket_obj_t* self) { - return self->tcp == NULL; + return self->tcp == NULL && self->num < 0; } diff --git a/ports/esp32s2/common-hal/socketpool/SocketPool.c b/ports/esp32s2/common-hal/socketpool/SocketPool.c index 1d4d04b034d11..3bec5f337f0e2 100644 --- a/ports/esp32s2/common-hal/socketpool/SocketPool.c +++ b/ports/esp32s2/common-hal/socketpool/SocketPool.c @@ -61,15 +61,14 @@ socketpool_socket_obj_t* common_hal_socketpool_socket(socketpool_socketpool_obj_ socket_type = SOCK_RAW; } - if (socket_type == SOCK_DGRAM || socket_type == SOCK_RAW || - addr_family == AF_INET6 || ipproto == IPPROTO_IPV6) { - mp_raise_NotImplementedError(translate("Only IPv4 SOCK_STREAM sockets supported")); + if (addr_family == AF_INET6 || ipproto == IPPROTO_IPV6) { + mp_raise_NotImplementedError(translate("Only IPv4 sockets supported")); } int socknum = -1; esp_tls_t* tcp_handle = NULL; if (socket_type == SOCK_DGRAM || socket_type == SOCK_RAW) { - // socknum = lwip_socket(addr_family, socket_type, ipproto); + socknum = lwip_socket(addr_family, socket_type, ipproto); } else { tcp_handle = esp_tls_init(); diff --git a/shared-bindings/socketpool/Socket.c b/shared-bindings/socketpool/Socket.c index e7b31842d2b51..2e369d442bb1f 100644 --- a/shared-bindings/socketpool/Socket.c +++ b/shared-bindings/socketpool/Socket.c @@ -274,79 +274,63 @@ STATIC mp_obj_t socketpool_socket_recv_into(size_t n_args, const mp_obj_t *args) } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socketpool_socket_recv_into_obj, 2, 3, socketpool_socket_recv_into); -// //| def sendto(self, bytes: ReadableBuffer, address: tuple) -> int: -// //| """Send some bytes to a specific address. -// //| Suits sockets of type SOCK_DGRAM -// //| -// //| :param ~bytes bytes: some bytes to send -// //| :param ~tuple address: tuple of (remote_address, remote_port)""" -// //| ... -// //| - -// STATIC mp_obj_t socketpool_socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_in) { -// // mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(self_in); +//| def sendto(self, bytes: ReadableBuffer, address: tuple) -> int: +//| """Send some bytes to a specific address. +//| Suits sockets of type SOCK_DGRAM +//| +//| :param ~bytes bytes: some bytes to send +//| :param ~tuple address: tuple of (remote_address, remote_port)""" +//| ... +//| -// // // get the data -// // mp_buffer_info_t bufinfo; -// // mp_get_buffer_raise(data_in, &bufinfo, MP_BUFFER_READ); +STATIC mp_obj_t socketpool_socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_in) { + socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in); -// // // get address -// // uint8_t ip[MOD_NETWORK_IPADDR_BUF_SIZE]; -// // mp_uint_t port = netutils_parse_inet_addr(addr_in, ip, NETUTILS_BIG); + // get the data + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(data_in, &bufinfo, MP_BUFFER_READ); -// // // check if we need to select a NIC -// // socket_select_nic(self, ip); + mp_obj_t *addr_items; + mp_obj_get_array_fixed_n(addr_in, 2, &addr_items); -// // // call the NIC to sendto -// // int _errno; -// // mp_int_t ret = self->nic_type->sendto(self, bufinfo.buf, bufinfo.len, ip, port, &_errno); -// // if (ret == -1) { -// // mp_raise_OSError(_errno); -// // } -// mp_int_t ret = 0; + size_t hostlen; + const char* host = mp_obj_str_get_data(addr_items[0], &hostlen); + mp_int_t port = mp_obj_get_int(addr_items[1]); -// return mp_obj_new_int(ret); -// } -// STATIC MP_DEFINE_CONST_FUN_OBJ_3(socketpool_socket_sendto_obj, socketpool_socket_sendto); + mp_int_t ret = common_hal_socketpool_socket_sendto(self, host, hostlen, port, bufinfo.buf, bufinfo.len); + if (!ok) { + mp_raise_OSError(0); + } -// //| def recvfrom(self, bufsize: int) -> Tuple[bytes, tuple]: -// //| """Reads some bytes from the connected remote address. -// //| Suits sockets of type SOCK_STREAM -// //| -// //| Returns a tuple containing -// //| * a bytes() of length <= bufsize -// //| * a remote_address, which is a tuple of ip address and port number -// //| -// //| :param ~int bufsize: maximum number of bytes to receive""" -// //| ... -// //| + return mp_obj_new_int_from_uint(ret); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_3(socketpool_socket_sendto_obj, socketpool_socket_sendto); -// STATIC mp_obj_t socketpool_socket_recvfrom_into(mp_obj_t self_in, mp_obj_t len_in) { -// // mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(self_in); -// // if (self->nic == MP_OBJ_NULL) { -// // // not connected -// // mp_raise_OSError(MP_ENOTCONN); -// // } -// // vstr_t vstr; -// // vstr_init_len(&vstr, mp_obj_get_int(len_in)); -// // byte ip[4]; -// // mp_uint_t port; -// // int _errno; -// // mp_int_t ret = self->nic_type->recvfrom(self, (byte*)vstr.buf, vstr.len, ip, &port, &_errno); -// // if (ret == -1) { -// // mp_raise_OSError(_errno); -// // } -// mp_obj_t tuple[2]; -// // if (ret == 0) { -// // tuple[0] = mp_const_empty_bytes; -// // } else { -// // vstr.len = ret; -// // tuple[0] = mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); -// // } -// // tuple[1] = netutils_format_inet_addr(ip, port, NETUTILS_BIG); -// return mp_obj_new_tuple(2, tuple); -// } -// STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_recvfrom_into_obj, socketpool_socket_recvfrom_into); +//| def recvfrom_into(self, buffer) -> Tuple[int, tuple]: +//| """Reads some bytes from a remote address. +//| +//| Returns a tuple containing +//| * the number of bytes received into the given buffer +//| * a remote_address, which is a tuple of ip address and port number +//| +//| :param object buffer: buffer to read into""" +//| ... +//| +STATIC mp_obj_t socketpool_socket_recvfrom_into(mp_obj_t self_in, mp_obj_t data_in) { + socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in); + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(data_in, &bufinfo, MP_BUFFER_WRITE); + + byte ip[4]; + mp_uint_t port; + mp_int_t ret = common_hal_socketpool_socket_recvfrom_into(self, + (byte*)bufinfo.buf, len, ip, &port); + mp_obj_t tuple_contents[2]; + tuple_contents[0] = mp_obj_new_int_from_uint(ret); + tuple_contents[1] = netutils_format_inet_addr(ip, port, NETUTILS_BIG); + return mp_obj_new_tuple(2, tuple); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_recvfrom_into_obj, socketpool_socket_recvfrom_into); // //| def setsockopt(self, level: int, optname: int, value: int) -> None: // //| """Sets socket options""" @@ -449,8 +433,8 @@ STATIC const mp_rom_map_elem_t socketpool_socket_locals_dict_table[] = { // { MP_ROM_QSTR(MP_QSTR_accept), MP_ROM_PTR(&socketpool_socket_accept_obj) }, { MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&socketpool_socket_connect_obj) }, { MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&socketpool_socket_send_obj) }, - // { MP_ROM_QSTR(MP_QSTR_sendto), MP_ROM_PTR(&socketpool_socket_sendto_obj) }, - // { MP_ROM_QSTR(MP_QSTR_recvfrom_into), MP_ROM_PTR(&socketpool_socket_recvfrom_into_obj) }, + { MP_ROM_QSTR(MP_QSTR_sendto), MP_ROM_PTR(&socketpool_socket_sendto_obj) }, + { MP_ROM_QSTR(MP_QSTR_recvfrom_into), MP_ROM_PTR(&socketpool_socket_recvfrom_into_obj) }, { MP_ROM_QSTR(MP_QSTR_recv_into), MP_ROM_PTR(&socketpool_socket_recv_into_obj) }, // { MP_ROM_QSTR(MP_QSTR_setsockopt), MP_ROM_PTR(&socketpool_socket_setsockopt_obj) }, { MP_ROM_QSTR(MP_QSTR_settimeout), MP_ROM_PTR(&socketpool_socket_settimeout_obj) }, diff --git a/shared-bindings/socketpool/Socket.h b/shared-bindings/socketpool/Socket.h index f0be95c92504d..72a4c9e3c3df7 100644 --- a/shared-bindings/socketpool/Socket.h +++ b/shared-bindings/socketpool/Socket.h @@ -35,6 +35,10 @@ void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t* self, mp_u bool common_hal_socketpool_socket_connect(socketpool_socket_obj_t* self, const char* host, size_t hostlen, mp_int_t port); mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len); mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len); +mp_uint_t common_hal_socketpool_socket_sendto(socketpool_socket_obj_t* self, + const uint8_t* host, size_t hostlen, uint8_t port, const uint8_t* buf, mp_uint_t len); +mp_uint_t common_hal_socketpool_socket_recvfrom_into(socketpool_socket_obj_t* self, + const uint8_t* buf, mp_uint_t len, uint8_t* ip, uint8_t port); void common_hal_socketpool_socket_close(socketpool_socket_obj_t* self); bool common_hal_socketpool_socket_get_closed(socketpool_socket_obj_t* self); bool common_hal_socketpool_socket_get_connected(socketpool_socket_obj_t* self); From e7da852db7c3784c8c162f7914815ba439baa989 Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Thu, 29 Oct 2020 16:13:03 -0500 Subject: [PATCH 088/770] Fixing review comments --- shared-bindings/busdevice/I2CDevice.c | 40 ++++++++------------------- shared-bindings/busdevice/I2CDevice.h | 6 ++-- shared-module/busdevice/I2CDevice.c | 26 ++++------------- shared-module/busdevice/I2CDevice.h | 1 - 4 files changed, 20 insertions(+), 53 deletions(-) diff --git a/shared-bindings/busdevice/I2CDevice.c b/shared-bindings/busdevice/I2CDevice.c index 1f3da465238f5..f5e968137c43c 100644 --- a/shared-bindings/busdevice/I2CDevice.c +++ b/shared-bindings/busdevice/I2CDevice.c @@ -76,22 +76,23 @@ STATIC mp_obj_t busdevice_i2cdevice_make_new(const mp_obj_type_t *type, size_t n busio_i2c_obj_t* i2c = args[ARG_i2c].u_obj; - common_hal_busdevice_i2cdevice_construct(self, i2c, args[ARG_device_address].u_int, args[ARG_probe].u_bool); + common_hal_busdevice_i2cdevice_construct(MP_OBJ_TO_PTR(self), i2c, args[ARG_device_address].u_int); if (args[ARG_probe].u_bool == true) { - common_hal_busdevice_i2cdevice___probe_for_device(self); + common_hal_busdevice_i2cdevice_probe_for_device(self); } return (mp_obj_t)self; } STATIC mp_obj_t busdevice_i2cdevice_obj___enter__(mp_obj_t self_in) { - common_hal_busdevice_i2cdevice_lock(self_in); - return self_in; + busdevice_i2cdevice_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_busdevice_i2cdevice_lock(self); + return self; } STATIC MP_DEFINE_CONST_FUN_OBJ_1(busdevice_i2cdevice___enter___obj, busdevice_i2cdevice_obj___enter__); STATIC mp_obj_t busdevice_i2cdevice_obj___exit__(size_t n_args, const mp_obj_t *args) { - common_hal_busdevice_i2cdevice_unlock(args[0]); + common_hal_busdevice_i2cdevice_unlock(MP_OBJ_TO_PTR(args[0])); return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busdevice_i2cdevice___exit___obj, 4, 4, busdevice_i2cdevice_obj___exit__); @@ -118,7 +119,7 @@ STATIC void readinto(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, int32_t s mp_raise_ValueError(translate("Buffer must be at least length 1")); } - uint8_t status = common_hal_busdevice_i2cdevice_readinto(self, ((uint8_t*)bufinfo.buf) + start, length); + uint8_t status = common_hal_busdevice_i2cdevice_readinto(MP_OBJ_TO_PTR(self), ((uint8_t*)bufinfo.buf) + start, length); if (status != 0) { mp_raise_OSError(status); } @@ -127,7 +128,7 @@ STATIC void readinto(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, int32_t s STATIC mp_obj_t busdevice_i2cdevice_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buffer, ARG_start, ARG_end }; static const mp_arg_t allowed_args[] = { - { MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, { MP_QSTR_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, }; @@ -165,7 +166,7 @@ STATIC void write(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, int32_t star mp_raise_ValueError(translate("Buffer must be at least length 1")); } - uint8_t status = common_hal_busdevice_i2cdevice_write(self, ((uint8_t*)bufinfo.buf) + start, length); + uint8_t status = common_hal_busdevice_i2cdevice_write(MP_OBJ_TO_PTR(self), ((uint8_t*)bufinfo.buf) + start, length); if (status != 0) { mp_raise_OSError(status); } @@ -174,7 +175,7 @@ STATIC void write(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, int32_t star STATIC mp_obj_t busdevice_i2cdevice_write(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buffer, ARG_start, ARG_end }; static const mp_arg_t allowed_args[] = { - { MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, { MP_QSTR_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, }; @@ -214,8 +215,8 @@ MP_DEFINE_CONST_FUN_OBJ_KW(busdevice_i2cdevice_write_obj, 2, busdevice_i2cdevice STATIC mp_obj_t busdevice_i2cdevice_write_then_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_out_buffer, ARG_in_buffer, ARG_out_start, ARG_out_end, ARG_in_start, ARG_in_end }; static const mp_arg_t allowed_args[] = { - { MP_QSTR_out_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, - { MP_QSTR_in_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_out_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_in_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_out_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, { MP_QSTR_out_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, { MP_QSTR_in_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, @@ -234,31 +235,14 @@ STATIC mp_obj_t busdevice_i2cdevice_write_then_readinto(size_t n_args, const mp_ } MP_DEFINE_CONST_FUN_OBJ_KW(busdevice_i2cdevice_write_then_readinto_obj, 3, busdevice_i2cdevice_write_then_readinto); -//| def __probe_for_device(self): -//| """ -//| Try to read a byte from an address, -//| if you get an OSError it means the device is not there -//| or that the device does not support these means of probing -//| """ -//| ... -//| -STATIC mp_obj_t busdevice_i2cdevice___probe_for_device(mp_obj_t self_in) { - busdevice_i2cdevice_obj_t *self = self_in; - common_hal_busdevice_i2cdevice___probe_for_device(self); - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(busdevice_i2cdevice___probe_for_device_obj, busdevice_i2cdevice___probe_for_device); - STATIC const mp_rom_map_elem_t busdevice_i2cdevice_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&busdevice_i2cdevice___enter___obj) }, { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&busdevice_i2cdevice___exit___obj) }, { MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&busdevice_i2cdevice_readinto_obj) }, { MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&busdevice_i2cdevice_write_obj) }, { MP_ROM_QSTR(MP_QSTR_write_then_readinto), MP_ROM_PTR(&busdevice_i2cdevice_write_then_readinto_obj) }, - { MP_ROM_QSTR(MP_QSTR___probe_for_device), MP_ROM_PTR(&busdevice_i2cdevice___probe_for_device_obj) }, }; - STATIC MP_DEFINE_CONST_DICT(busdevice_i2cdevice_locals_dict, busdevice_i2cdevice_locals_dict_table); const mp_obj_type_t busdevice_i2cdevice_type = { diff --git a/shared-bindings/busdevice/I2CDevice.h b/shared-bindings/busdevice/I2CDevice.h index 146013cb7620c..a1f869c4508ad 100644 --- a/shared-bindings/busdevice/I2CDevice.h +++ b/shared-bindings/busdevice/I2CDevice.h @@ -43,13 +43,11 @@ extern const mp_obj_type_t busdevice_i2cdevice_type; // Initializes the hardware peripheral. -extern void common_hal_busdevice_i2cdevice_construct(busdevice_i2cdevice_obj_t *self, busio_i2c_obj_t *i2c, uint8_t device_address, bool probe); +extern void common_hal_busdevice_i2cdevice_construct(busdevice_i2cdevice_obj_t *self, busio_i2c_obj_t *i2c, uint8_t device_address); extern uint8_t common_hal_busdevice_i2cdevice_readinto(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length); extern uint8_t common_hal_busdevice_i2cdevice_write(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length); -extern uint8_t common_hal_busdevice_i2cdevice_write_then_readinto(busdevice_i2cdevice_obj_t *self, mp_obj_t out_buffer, - mp_obj_t in_buffer, size_t out_length, size_t in_length); extern void common_hal_busdevice_i2cdevice_lock(busdevice_i2cdevice_obj_t *self); extern void common_hal_busdevice_i2cdevice_unlock(busdevice_i2cdevice_obj_t *self); -extern void common_hal_busdevice_i2cdevice___probe_for_device(busdevice_i2cdevice_obj_t *self); +extern void common_hal_busdevice_i2cdevice_probe_for_device(busdevice_i2cdevice_obj_t *self); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_BUSDEVICE_I2CDEVICE_H diff --git a/shared-module/busdevice/I2CDevice.c b/shared-module/busdevice/I2CDevice.c index 91013d52c71ae..41706c1a8148b 100644 --- a/shared-module/busdevice/I2CDevice.c +++ b/shared-module/busdevice/I2CDevice.c @@ -30,16 +30,17 @@ #include "py/nlr.h" #include "py/runtime.h" -void common_hal_busdevice_i2cdevice_construct(busdevice_i2cdevice_obj_t *self, busio_i2c_obj_t *i2c, uint8_t device_address, bool probe) { +void common_hal_busdevice_i2cdevice_construct(busdevice_i2cdevice_obj_t *self, busio_i2c_obj_t *i2c, uint8_t device_address) { self->i2c = i2c; self->device_address = device_address; - self->probe = probe; } void common_hal_busdevice_i2cdevice_lock(busdevice_i2cdevice_obj_t *self) { bool success = false; while (!success) { success = common_hal_busio_i2c_try_lock(self->i2c); + RUN_BACKGROUND_TASKS; + mp_handle_pending(); } } @@ -48,29 +49,14 @@ void common_hal_busdevice_i2cdevice_unlock(busdevice_i2cdevice_obj_t *self) { } uint8_t common_hal_busdevice_i2cdevice_readinto(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length) { - uint8_t status = common_hal_busio_i2c_read(self->i2c, self->device_address, buffer, length); - - return status; + return common_hal_busio_i2c_read(self->i2c, self->device_address, buffer, length); } uint8_t common_hal_busdevice_i2cdevice_write(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length) { - uint8_t status = common_hal_busio_i2c_write(self->i2c, self->device_address, buffer, length, true); - - return status; -} - -uint8_t common_hal_busdevice_i2cdevice_write_then_readinto(busdevice_i2cdevice_obj_t *self, mp_obj_t out_buffer, mp_obj_t in_buffer, - size_t out_length, size_t in_length) { - uint8_t status = 0; - - status = common_hal_busio_i2c_write(self->i2c, self->device_address, out_buffer, out_length, true); - - status = common_hal_busio_i2c_read(self->i2c, self->device_address, in_buffer, in_length); - - return status; + return common_hal_busio_i2c_write(self->i2c, self->device_address, buffer, length, true); } -void common_hal_busdevice_i2cdevice___probe_for_device(busdevice_i2cdevice_obj_t *self) { +void common_hal_busdevice_i2cdevice_probe_for_device(busdevice_i2cdevice_obj_t *self) { common_hal_busdevice_i2cdevice_lock(self); mp_buffer_info_t bufinfo; diff --git a/shared-module/busdevice/I2CDevice.h b/shared-module/busdevice/I2CDevice.h index c872704db6438..918dc7719dd26 100644 --- a/shared-module/busdevice/I2CDevice.h +++ b/shared-module/busdevice/I2CDevice.h @@ -34,7 +34,6 @@ typedef struct { mp_obj_base_t base; busio_i2c_obj_t *i2c; uint8_t device_address; - bool probe; } busdevice_i2cdevice_obj_t; #endif // MICROPY_INCLUDED_ATMEL_SAMD_SHARED_MODULE_BUSDEVICE_I2CDEVICE_H From ad166ca479f405a9cb43fae9fe7b082d2e6ba19f Mon Sep 17 00:00:00 2001 From: sw23 Date: Thu, 29 Oct 2020 20:15:34 -0400 Subject: [PATCH 089/770] Fixing make stub warnings and mypy issuesmak --- shared-bindings/canio/CAN.c | 8 ++++---- shared-bindings/canio/Listener.c | 2 +- shared-bindings/canio/Match.c | 2 +- shared-bindings/canio/Message.c | 2 +- shared-bindings/canio/RemoteTransmissionRequest.c | 2 +- shared-bindings/displayio/Bitmap.c | 4 ++-- shared-bindings/displayio/Display.c | 2 +- shared-bindings/socketpool/Socket.c | 2 +- shared-bindings/socketpool/SocketPool.c | 2 +- shared-bindings/ssl/SSLContext.c | 2 +- shared-bindings/wifi/Radio.c | 4 ++-- tools/extract_pyi.py | 9 ++++++++- 12 files changed, 24 insertions(+), 17 deletions(-) diff --git a/shared-bindings/canio/CAN.c b/shared-bindings/canio/CAN.c index 4982a97b9ddf7..13066764e33b9 100644 --- a/shared-bindings/canio/CAN.c +++ b/shared-bindings/canio/CAN.c @@ -49,7 +49,7 @@ //| loopback: bool = False, //| silent: bool = False, //| auto_restart: bool = False, -//| ): +//| ) -> None: //| """A common shared-bus protocol. The rx and tx pins are generally //| connected to a transceiver which controls the H and L pins on a //| shared bus. @@ -171,7 +171,7 @@ STATIC const mp_obj_property_t canio_can_receive_error_count_obj = { (mp_obj_t)mp_const_none}, }; -//| state: State +//| state: BusState //| """The current state of the bus. (read-only)""" STATIC mp_obj_t canio_can_state_get(mp_obj_t self_in) { canio_can_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -291,7 +291,7 @@ STATIC const mp_obj_property_t canio_can_loopback_obj = { }; -//| def send(message: Union[RemoteTransmissionRequest, Message]) -> None: +//| def send(self, message: Union[RemoteTransmissionRequest, Message]) -> None: //| """Send a message on the bus with the given data and id. //| If the message could not be sent due to a full fifo or a bus error condition, RuntimeError is raised. //| """ @@ -352,7 +352,7 @@ STATIC mp_obj_t canio_can_enter(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(canio_can_enter_obj, canio_can_enter); -//| def __exit__(self, unused1, unused2, unused3) -> None: +//| def __exit__(self, unused1: Optional[Type[BaseException]], unused2: Optional[BaseException], unused3: Optional[TracebackType]) -> None: //| """Calls deinit()""" //| ... STATIC mp_obj_t canio_can_exit(size_t num_args, const mp_obj_t args[]) { diff --git a/shared-bindings/canio/Listener.c b/shared-bindings/canio/Listener.c index 93552af814f57..8a39f0f2ae601 100644 --- a/shared-bindings/canio/Listener.c +++ b/shared-bindings/canio/Listener.c @@ -123,7 +123,7 @@ STATIC mp_obj_t canio_listener_enter(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(canio_listener_enter_obj, canio_listener_enter); -//| def __exit__(self, unused1, unused2, unused3) -> None: +//| def __exit__(self, unused1: Optional[Type[BaseException]], unused2: Optional[BaseException], unused3: Optional[TracebackType]) -> None: //| """Calls deinit()""" //| ... STATIC mp_obj_t canio_listener_exit(size_t num_args, const mp_obj_t args[]) { diff --git a/shared-bindings/canio/Match.c b/shared-bindings/canio/Match.c index 3fbc1773e84e1..6039631fad071 100644 --- a/shared-bindings/canio/Match.c +++ b/shared-bindings/canio/Match.c @@ -33,7 +33,7 @@ //| """Describe CAN bus messages to match""" //| //| -//| def __init__(self, id: int, *, mask: Optional[int] = None, extended: bool = False): +//| def __init__(self, id: int, *, mask: Optional[int] = None, extended: bool = False) -> None: //| """Construct a Match with the given properties. //| //| If mask is not None, then the filter is for any id which matches all diff --git a/shared-bindings/canio/Message.c b/shared-bindings/canio/Message.c index e47e997c70429..04fa8fc6c2b58 100644 --- a/shared-bindings/canio/Message.c +++ b/shared-bindings/canio/Message.c @@ -31,7 +31,7 @@ #include "py/runtime.h" //| class Message: -//| def __init__(self, id: int, data: bytes, *, extended: bool = False): +//| def __init__(self, id: int, data: bytes, *, extended: bool = False) -> None: //| """Construct a Message to send on a CAN bus. //| //| :param int id: The numeric ID of the message diff --git a/shared-bindings/canio/RemoteTransmissionRequest.c b/shared-bindings/canio/RemoteTransmissionRequest.c index d762787b180a4..fcd2590340994 100644 --- a/shared-bindings/canio/RemoteTransmissionRequest.c +++ b/shared-bindings/canio/RemoteTransmissionRequest.c @@ -31,7 +31,7 @@ #include "py/runtime.h" //| class RemoteTransmissionRequest: -//| def __init__(self, id: int, length: int, *, extended: bool = False): +//| def __init__(self, id: int, length: int, *, extended: bool = False) -> None: //| """Construct a RemoteTransmissionRequest to send on a CAN bus. //| //| :param int id: The numeric ID of the requested message diff --git a/shared-bindings/displayio/Bitmap.c b/shared-bindings/displayio/Bitmap.c index 5a2fc785f898e..b9f06fe143c9e 100644 --- a/shared-bindings/displayio/Bitmap.c +++ b/shared-bindings/displayio/Bitmap.c @@ -172,7 +172,7 @@ STATIC mp_obj_t bitmap_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t val return mp_const_none; } -//| def blit(self, x: int, y: int, source_bitmap: bitmap, *, x1: int, y1: int, x2: int, y2: int, skip_index: int) -> None: +//| def blit(self, x: int, y: int, source_bitmap: Bitmap, *, x1: int, y1: int, x2: int, y2: int, skip_index: int) -> None: //| """Inserts the source_bitmap region defined by rectangular boundaries //| (x1,y1) and (x2,y2) into the bitmap at the specified (x,y) location. //| @@ -274,7 +274,7 @@ STATIC mp_obj_t displayio_bitmap_obj_blit(size_t n_args, const mp_obj_t *pos_arg MP_DEFINE_CONST_FUN_OBJ_KW(displayio_bitmap_blit_obj, 4, displayio_bitmap_obj_blit); // `displayio_bitmap_obj_blit` requires at least 4 arguments -//| def fill(self, value: Any) -> None: +//| def fill(self, value: int) -> None: //| """Fills the bitmap with the supplied palette index value.""" //| ... //| diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index e78a893b01fca..1ed59f23319bd 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -39,7 +39,7 @@ #include "shared-module/displayio/__init__.h" #include "supervisor/shared/translate.h" -//| _DisplayBus = Union[FourWire, ParallelBus, I2CDisplay] +//| _DisplayBus = Union['FourWire', 'ParallelBus', 'I2CDisplay'] //| """:py:class:`FourWire`, :py:class:`ParallelBus` or :py:class:`I2CDisplay`""" //| diff --git a/shared-bindings/socketpool/Socket.c b/shared-bindings/socketpool/Socket.c index e7b31842d2b51..362e4d7e866af 100644 --- a/shared-bindings/socketpool/Socket.c +++ b/shared-bindings/socketpool/Socket.c @@ -161,7 +161,7 @@ STATIC mp_obj_t socketpool_socket_close(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(socketpool_socket_close_obj, socketpool_socket_close); -//| def connect(self, address: tuple) -> None: +//| def connect(self, address: Tuple[str, int]) -> None: //| """Connect a socket to a remote address //| //| :param ~tuple address: tuple of (remote_address, remote_port)""" diff --git a/shared-bindings/socketpool/SocketPool.c b/shared-bindings/socketpool/SocketPool.c index 527cf7e984229..b737b5fc2d8d4 100644 --- a/shared-bindings/socketpool/SocketPool.c +++ b/shared-bindings/socketpool/SocketPool.c @@ -82,7 +82,7 @@ STATIC mp_obj_t socketpool_socketpool_socket(size_t n_args, const mp_obj_t *pos_ } MP_DEFINE_CONST_FUN_OBJ_KW(socketpool_socketpool_socket_obj, 1, socketpool_socketpool_socket); -//| def getaddrinfo(host: str, port: int, family: int = 0, type: int = 0, proto: int = 0, flags: int = 0) -> tuple: +//| def getaddrinfo(host: str, port: int, family: int = 0, type: int = 0, proto: int = 0, flags: int = 0) -> Tuple[int, int, int, str, Tuple[str, int]]: //| """Gets the address information for a hostname and port //| //| Returns the appropriate family, socket type, socket protocol and diff --git a/shared-bindings/ssl/SSLContext.c b/shared-bindings/ssl/SSLContext.c index d2c236d3bfd7d..9d4df72619d51 100644 --- a/shared-bindings/ssl/SSLContext.c +++ b/shared-bindings/ssl/SSLContext.c @@ -51,7 +51,7 @@ STATIC mp_obj_t ssl_sslcontext_make_new(const mp_obj_type_t *type, size_t n_args return MP_OBJ_FROM_PTR(s); } -//| def wrap_socket(sock: socketpool.Socket, *, server_side: bool = False, server_hostname: str = None) -> socketpool.Socket: +//| def wrap_socket(sock: socketpool.Socket, *, server_side: bool = False, server_hostname: Optional[str] = None) -> socketpool.Socket: //| """Wraps the socket into a socket-compatible class that handles SSL negotiation. //| The socket must be of type SOCK_STREAM.""" //| ... diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index a274c437e0cec..a56ca5aaa66b1 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -79,7 +79,7 @@ const mp_obj_property_t wifi_radio_mac_address_obj = { }; -//| def start_scanning_networks(self, *, start_channel=1, stop_channel=11) -> Iterable[Network]: +//| def start_scanning_networks(self, *, start_channel: int = 1, stop_channel: int = 11) -> Iterable[Network]: //| """Scans for available wifi networks over the given channel range. Make sure the channels are allowed in your country.""" //| ... //| @@ -283,7 +283,7 @@ const mp_obj_property_t wifi_radio_ap_info_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| def ping(self, ip, *, timeout: float = 0.5) -> float: +//| def ping(self, ip: wifi.Radio, *, timeout: float = 0.5) -> float: //| """Ping an IP to test connectivity. Returns echo time in seconds. //| Returns None when it times out.""" //| ... diff --git a/tools/extract_pyi.py b/tools/extract_pyi.py index 651216e11acdc..b7ce584a1e1d3 100644 --- a/tools/extract_pyi.py +++ b/tools/extract_pyi.py @@ -17,7 +17,8 @@ IMPORTS_IGNORE = frozenset({'int', 'float', 'bool', 'str', 'bytes', 'tuple', 'list', 'set', 'dict', 'bytearray', 'slice', 'file', 'buffer', 'range', 'array', 'struct_time'}) -IMPORTS_TYPING = frozenset({'Any', 'Optional', 'Union', 'Tuple', 'List', 'Sequence', 'NamedTuple', 'Iterable', 'Iterator', 'Callable', 'AnyStr', 'overload'}) +IMPORTS_TYPING = frozenset({'Any', 'Optional', 'Union', 'Tuple', 'List', 'Sequence', 'NamedTuple', 'Iterable', 'Iterator', 'Callable', 'AnyStr', 'overload', 'Type'}) +IMPORTS_TYPES = frozenset({'TracebackType'}) CPY_TYPING = frozenset({'ReadableBuffer', 'WriteableBuffer', 'AudioSample', 'FrameBuffer'}) @@ -63,6 +64,7 @@ def find_stub_issues(tree): def extract_imports(tree): modules = set() typing = set() + types = set() cpy_typing = set() def collect_annotations(anno_tree): @@ -74,6 +76,8 @@ def collect_annotations(anno_tree): continue elif node.id in IMPORTS_TYPING: typing.add(node.id) + elif node.id in IMPORTS_TYPES: + types.add(node.id) elif node.id in CPY_TYPING: cpy_typing.add(node.id) elif isinstance(node, ast.Attribute): @@ -94,6 +98,7 @@ def collect_annotations(anno_tree): return { "modules": sorted(modules), "typing": sorted(typing), + "types": sorted(types), "cpy_typing": sorted(cpy_typing), } @@ -181,6 +186,8 @@ def convert_folder(top_level, stub_directory): # Add import statements imports = extract_imports(tree) import_lines = ["from __future__ import annotations"] + if imports["types"]: + import_lines.append("from types import " + ", ".join(imports["types"])) if imports["typing"]: import_lines.append("from typing import " + ", ".join(imports["typing"])) if imports["cpy_typing"]: From 9f3a1fe27b9f29771b87a4d5eb1914075d2b1e3a Mon Sep 17 00:00:00 2001 From: sw23 Date: Fri, 30 Oct 2020 01:29:58 -0400 Subject: [PATCH 090/770] Fixing stub for wifi_radio_ping --- shared-bindings/wifi/Radio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index a56ca5aaa66b1..e81e8793c4602 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -283,7 +283,7 @@ const mp_obj_property_t wifi_radio_ap_info_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| def ping(self, ip: wifi.Radio, *, timeout: float = 0.5) -> float: +//| def ping(self, ip: ipaddress.IPv4Address, *, timeout: Optional[float] = 0.5) -> float: //| """Ping an IP to test connectivity. Returns echo time in seconds. //| Returns None when it times out.""" //| ... From 6a63d20a5d2e7184bfc5747b465818fb7eee6b49 Mon Sep 17 00:00:00 2001 From: sw23 Date: Fri, 30 Oct 2020 18:56:40 -0400 Subject: [PATCH 091/770] Fixing remaining stub mypy issues + run check-stubs to CI --- .github/workflows/build.yml | 2 +- shared-bindings/ipaddress/IPv4Address.c | 2 +- shared-bindings/socketpool/SocketPool.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 64d43f4d984f8..8039883e34261 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,7 +68,7 @@ jobs: run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float working-directory: tests - name: Stubs - run: make stubs -j2 + run: make check-stubs -j2 - uses: actions/upload-artifact@v2 with: name: stubs diff --git a/shared-bindings/ipaddress/IPv4Address.c b/shared-bindings/ipaddress/IPv4Address.c index b2a10158ae2a4..e027f32d65d14 100644 --- a/shared-bindings/ipaddress/IPv4Address.c +++ b/shared-bindings/ipaddress/IPv4Address.c @@ -126,7 +126,7 @@ const mp_obj_property_t ipaddress_ipv4address_version_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def __eq__(self, other: IPv4Address) -> bool: +//| def __eq__(self, other: object) -> bool: //| """Two Address objects are equal if their addresses and address types are equal.""" //| ... //| diff --git a/shared-bindings/socketpool/SocketPool.c b/shared-bindings/socketpool/SocketPool.c index b737b5fc2d8d4..0cead525f8d1a 100644 --- a/shared-bindings/socketpool/SocketPool.c +++ b/shared-bindings/socketpool/SocketPool.c @@ -58,7 +58,7 @@ STATIC mp_obj_t socketpool_socketpool_make_new(const mp_obj_type_t *type, size_t } -//| def socket(self, family: int = AF_INET, type: int = SOCK_STREAM, proto: int = IPPROTO_TCP) -> None: +//| def socket(self, family: int, type: int, proto: int) -> socketpool.Socket: //| """Create a new socket //| //| :param ~int family: AF_INET or AF_INET6 From 8e72b68e3de90f87261ce289dd7d3a28815cfd0b Mon Sep 17 00:00:00 2001 From: sw23 Date: Fri, 30 Oct 2020 19:16:26 -0400 Subject: [PATCH 092/770] Adding mypy to dep list and clarifying Stubs stage name --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8039883e34261..07db88963ba45 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,7 +37,7 @@ jobs: run: | sudo apt-get install -y eatmydata sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 latexmk texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra - pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black awscli + pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black awscli mypy - name: Versions run: | gcc --version @@ -67,7 +67,7 @@ jobs: - name: mpy Tests run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float working-directory: tests - - name: Stubs + - name: Build and Validate Stubs run: make check-stubs -j2 - uses: actions/upload-artifact@v2 with: From 345d84ffde527b16f50c203f7b6a718886be34f6 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 30 Oct 2020 22:16:12 -0400 Subject: [PATCH 093/770] improve USB CDC disconnect/reconnect checking --- supervisor/serial.h | 1 - supervisor/shared/serial.c | 6 +++--- supervisor/shared/usb/usb.c | 3 --- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/supervisor/serial.h b/supervisor/serial.h index 9c2d44737a9d6..066886303e920 100644 --- a/supervisor/serial.h +++ b/supervisor/serial.h @@ -47,5 +47,4 @@ char serial_read(void); bool serial_bytes_available(void); bool serial_connected(void); -extern volatile bool _serial_connected; #endif // MICROPY_INCLUDED_SUPERVISOR_SERIAL_H diff --git a/supervisor/shared/serial.c b/supervisor/shared/serial.c index 91e90671d23ce..7383cc2282fc1 100644 --- a/supervisor/shared/serial.c +++ b/supervisor/shared/serial.c @@ -47,8 +47,6 @@ busio_uart_obj_t debug_uart; byte buf_array[64]; #endif -volatile bool _serial_connected; - void serial_early_init(void) { #if defined(DEBUG_UART_TX) && defined(DEBUG_UART_RX) debug_uart.base.type = &busio_uart_type; @@ -71,7 +69,9 @@ bool serial_connected(void) { #if defined(DEBUG_UART_TX) && defined(DEBUG_UART_RX) return true; #else - return _serial_connected; + // True if DTR is asserted, and the USB connection is up. + // tud_cdc_get_line_state(): bit 0 is DTR, bit 1 is RTS + return (tud_cdc_get_line_state() & 1) && tud_ready(); #endif } diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c index 89fbf56f37e06..93d3436e9da5d 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -116,7 +116,6 @@ void tud_umount_cb(void) { // remote_wakeup_en : if host allows us to perform remote wakeup // USB Specs: Within 7ms, device must draw an average current less than 2.5 mA from bus void tud_suspend_cb(bool remote_wakeup_en) { - _serial_connected = false; } // Invoked when usb bus is resumed @@ -128,8 +127,6 @@ void tud_resume_cb(void) { void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts) { (void) itf; // interface ID, not used - _serial_connected = dtr; - // DTR = false is counted as disconnected if ( !dtr ) { From 1f179b331750fbe05ccb4caff44e985234c9ee71 Mon Sep 17 00:00:00 2001 From: sw23 Date: Fri, 30 Oct 2020 23:19:27 -0400 Subject: [PATCH 094/770] Adding socket and socketpool class attributes --- shared-bindings/socket/__init__.c | 15 ++++++++------- shared-bindings/socketpool/SocketPool.c | 11 +++++++++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/shared-bindings/socket/__init__.c b/shared-bindings/socket/__init__.c index 38840da5eab95..2969b371494a1 100644 --- a/shared-bindings/socket/__init__.c +++ b/shared-bindings/socket/__init__.c @@ -49,7 +49,14 @@ STATIC const mp_obj_type_t socket_type; //| class socket: //| -//| def __init__(self, family: int, type: int, proto: int) -> None: +//| AF_INET = 2 +//| AF_INET6 = 10 +//| SOCK_STREAM = 1 +//| SOCK_DGRAM = 2 +//| SOCK_RAW = 3 +//| IPPROTO_TCP = 6 +//| +//| def __init__(self, family: int = AF_INET, type: int = SOCK_STREAM, proto: int = IPPROTO_TCP) -> None: //| """Create a new socket //| //| :param int family: AF_INET or AF_INET6 @@ -57,12 +64,6 @@ STATIC const mp_obj_type_t socket_type; //| :param int proto: IPPROTO_TCP, IPPROTO_UDP or IPPROTO_RAW (ignored)""" //| ... //| -//| AF_INET: int -//| AF_INET6: int -//| SOCK_STREAM: int -//| SOCK_DGRAM: int -//| SOCK_RAW: int -//| STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) { mp_arg_check_num(n_args, kw_args, 0, 4, false); diff --git a/shared-bindings/socketpool/SocketPool.c b/shared-bindings/socketpool/SocketPool.c index 0cead525f8d1a..2234f359ef320 100644 --- a/shared-bindings/socketpool/SocketPool.c +++ b/shared-bindings/socketpool/SocketPool.c @@ -57,8 +57,14 @@ STATIC mp_obj_t socketpool_socketpool_make_new(const mp_obj_type_t *type, size_t return MP_OBJ_FROM_PTR(s); } - -//| def socket(self, family: int, type: int, proto: int) -> socketpool.Socket: +//| AF_INET = 0 +//| AF_INET6 = 1 +//| SOCK_STREAM = 0 +//| SOCK_DGRAM = 1 +//| SOCK_RAW = 2 +//| IPPROTO_TCP = 6 +//| +//| def socket(self, family: int = AF_INET, type: int = SOCK_STREAM, proto: int = IPPROTO_TCP) -> socketpool.Socket: //| """Create a new socket //| //| :param ~int family: AF_INET or AF_INET6 @@ -66,6 +72,7 @@ STATIC mp_obj_t socketpool_socketpool_make_new(const mp_obj_type_t *type, size_t //| :param ~int proto: IPPROTO_TCP, IPPROTO_UDP or IPPROTO_RAW (ignored)""" //| ... //| + STATIC mp_obj_t socketpool_socketpool_socket(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { mp_arg_check_num(n_args, kw_args, 0, 5, false); From a7616808e951b52e2ced08a7a279a224490ae404 Mon Sep 17 00:00:00 2001 From: "ITACA Innovation S.R.L" <40298126+ITACAInnovation@users.noreply.github.com> Date: Sat, 31 Oct 2020 10:12:49 +0100 Subject: [PATCH 095/770] Updated pinout --- ports/atmel-samd/boards/uchip/pins.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/ports/atmel-samd/boards/uchip/pins.c b/ports/atmel-samd/boards/uchip/pins.c index 856a220742e30..cfb6432336d43 100644 --- a/ports/atmel-samd/boards/uchip/pins.c +++ b/ports/atmel-samd/boards/uchip/pins.c @@ -1,14 +1,15 @@ #include "shared-bindings/board/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA08) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA10) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA11) }, - { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA02) }, - { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA04) }, - { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PA03) }, - { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PA03) }, + { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PA04) }, { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA16) }, { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA08) }, { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA10) }, @@ -19,8 +20,10 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA19) }, { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA22) }, { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA23) }, - { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA03) }, - { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA31) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA30) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA03) }, { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA09) }, { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA08) }, { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) }, From 9a8484b853116e6f95f50da6d3bc66323d55ca9f Mon Sep 17 00:00:00 2001 From: "ITACA Innovation S.R.L" <40298126+ITACAInnovation@users.noreply.github.com> Date: Sat, 31 Oct 2020 11:06:56 +0100 Subject: [PATCH 096/770] Update mpconfigboard.h Removed ignore PA30 PA31 in order to allow using them as pinout --- ports/atmel-samd/boards/uchip/mpconfigboard.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/ports/atmel-samd/boards/uchip/mpconfigboard.h b/ports/atmel-samd/boards/uchip/mpconfigboard.h index 1877a41ef963b..5d6af4b782a78 100644 --- a/ports/atmel-samd/boards/uchip/mpconfigboard.h +++ b/ports/atmel-samd/boards/uchip/mpconfigboard.h @@ -16,8 +16,6 @@ #define IGNORE_PIN_PA27 1 #define IGNORE_PIN_PA28 1 -#define IGNORE_PIN_PA30 1 -#define IGNORE_PIN_PA31 1 #define IGNORE_PIN_PB01 1 #define IGNORE_PIN_PB02 1 From 80ad300cad64a7da77d9292dbe5d2b81e458d5dc Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 31 Oct 2020 11:58:28 -0500 Subject: [PATCH 097/770] workflows: Fix typo that broke builds while trying to upload stubs --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 64d43f4d984f8..00db4f8cdee2c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -116,7 +116,7 @@ jobs: [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static-raspbian s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-raspbian-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-amd64-linux-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static.exe s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-x64-windows-${{ env.CP_VERSION }}.exe --no-progress --region us-east-1 - zip -9 circuitpython-stubs.CP_VERSION }}.zip stubs + zip -9 circuitpython-stubs.${{ env.CP_VERSION }}.zip stubs [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp circuitpython-stubs.zip s3://adafruit-circuit-python/bin/stubs/circuitpython-stubs-${{ env.CP_VERSION }}.zip --no-progress --region us-east-1 env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} From 78477a374afad09aa7141af5cf590652b32c141f Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Sat, 31 Oct 2020 12:17:29 -0500 Subject: [PATCH 098/770] Initial SPI commit --- py/circuitpy_defns.mk | 1 + shared-bindings/busdevice/SPIDevice.c | 124 ++++++++++++++++++++++++++ shared-bindings/busdevice/SPIDevice.h | 50 +++++++++++ shared-module/busdevice/SPIDevice.c | 85 ++++++++++++++++++ shared-module/busdevice/SPIDevice.h | 44 +++++++++ 5 files changed, 304 insertions(+) create mode 100644 shared-bindings/busdevice/SPIDevice.c create mode 100644 shared-bindings/busdevice/SPIDevice.h create mode 100644 shared-module/busdevice/SPIDevice.c create mode 100644 shared-module/busdevice/SPIDevice.h diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 9318bd466bb8b..4822c0320827d 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -437,6 +437,7 @@ SRC_SHARED_MODULE_ALL = \ board/__init__.c \ busdevice/__init__.c \ busdevice/I2CDevice.c \ + busdevice/SPIDevice.c \ busio/OneWire.c \ displayio/Bitmap.c \ displayio/ColorConverter.c \ diff --git a/shared-bindings/busdevice/SPIDevice.c b/shared-bindings/busdevice/SPIDevice.c new file mode 100644 index 0000000000000..7ef047349c00b --- /dev/null +++ b/shared-bindings/busdevice/SPIDevice.c @@ -0,0 +1,124 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Mark Komus + * + * 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. + */ + +// This file contains all of the Python API definitions for the +// busio.SPI class. + +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/busdevice/SPIDevice.h" +#include "shared-bindings/util.h" +#include "shared-module/busdevice/SPIDevice.h" +#include "common-hal/digitalio/DigitalInOut.h" +#include "shared-bindings/digitalio/DigitalInOut.h" + + +#include "lib/utils/buffer_helper.h" +#include "lib/utils/context_manager_helpers.h" +#include "py/runtime.h" +#include "supervisor/shared/translate.h" + + +//| class SPIDevice: +//| """ +//| Represents a single SPI device and manages locking the bus and the device +//| address. +//| :param ~busio.SPI spi: The SPI bus the device is on +//| :param int device_address: The 7 bit device address +//| :param bool probe: Probe for the device upon object creation, default is true +//| .. note:: This class is **NOT** built into CircuitPython. See +//| :ref:`here for install instructions `. +//| Example: +//| .. code-block:: python +//| import busio +//| from board import * +//| from adafruit_bus_device.spi_device import SPIDevice +//| with busio.SPI(SCL, SDA) as spi: +//| device = SPIDevice(spi, 0x70) +//| bytes_read = bytearray(4) +//| with device: +//| device.readinto(bytes_read) +//| # A second transaction +//| with device: +//| device.write(bytes_read)""" +//| ... +//| +STATIC mp_obj_t busdevice_spidevice_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + busdevice_spidevice_obj_t *self = m_new_obj(busdevice_spidevice_obj_t); + self->base.type = &busdevice_spidevice_type; + enum { ARG_spi, ARG_chip_select, ARG_baudrate, ARG_polarity, ARG_phase, ARG_extra_clocks }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_spi, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_chip_select, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_baudrate, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 100000} }, + { MP_QSTR_polarity, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_phase, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_extra_clocks, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + busio_spi_obj_t* spi = args[ARG_spi].u_obj; + + common_hal_busdevice_spidevice_construct(MP_OBJ_TO_PTR(self), spi, args[ARG_chip_select].u_obj, args[ARG_baudrate].u_int, args[ARG_polarity].u_int, + args[ARG_phase].u_int, args[ARG_extra_clocks].u_int); + + if (args[ARG_chip_select].u_obj != MP_OBJ_NULL) { + digitalinout_result_t result = common_hal_digitalio_digitalinout_switch_to_output(MP_OBJ_TO_PTR(args[ARG_chip_select].u_obj), + true, DRIVE_MODE_PUSH_PULL); + if (result == DIGITALINOUT_INPUT_ONLY) { + mp_raise_NotImplementedError(translate("Pin is input only")); + } + } + + return (mp_obj_t)self; +} + +STATIC mp_obj_t busdevice_spidevice_obj___enter__(mp_obj_t self_in) { + busdevice_spidevice_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_busdevice_spidevice_enter(self); + return self; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(busdevice_spidevice___enter___obj, busdevice_spidevice_obj___enter__); + +STATIC mp_obj_t busdevice_spidevice_obj___exit__(size_t n_args, const mp_obj_t *args) { + common_hal_busdevice_spidevice_exit(MP_OBJ_TO_PTR(args[0])); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busdevice_spidevice___exit___obj, 4, 4, busdevice_spidevice_obj___exit__); + +STATIC const mp_rom_map_elem_t busdevice_spidevice_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&busdevice_spidevice___enter___obj) }, + { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&busdevice_spidevice___exit___obj) }, +}; + +STATIC MP_DEFINE_CONST_DICT(busdevice_spidevice_locals_dict, busdevice_spidevice_locals_dict_table); + +const mp_obj_type_t busdevice_spidevice_type = { + { &mp_type_type }, + .name = MP_QSTR_SPIDevice, + .make_new = busdevice_spidevice_make_new, + .locals_dict = (mp_obj_dict_t*)&busdevice_spidevice_locals_dict, +}; diff --git a/shared-bindings/busdevice/SPIDevice.h b/shared-bindings/busdevice/SPIDevice.h new file mode 100644 index 0000000000000..040f98548e38e --- /dev/null +++ b/shared-bindings/busdevice/SPIDevice.h @@ -0,0 +1,50 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Mark Komus + * + * 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. + */ + +// Machine is the HAL for low-level, hardware accelerated functions. It is not +// meant to simplify APIs, its only meant to unify them so that other modules +// do not require port specific logic. +// +// This file includes externs for all functions a port should implement to +// support the machine module. + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_BUSDEVICE_SPIDEVICE_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_BUSDEVICE_SPIDEVICE_H + +#include "py/obj.h" + +#include "shared-module/busdevice/SPIDevice.h" + +// Type object used in Python. Should be shared between ports. +extern const mp_obj_type_t busdevice_spidevice_type; + +// Initializes the hardware peripheral. +extern void common_hal_busdevice_spidevice_construct(busdevice_spidevice_obj_t *self, busio_spi_obj_t *spi, digitalio_digitalinout_obj_t *cs, + uint32_t baudrate, uint8_t polarity, uint8_t phase, uint8_t extra_clocks); +extern void common_hal_busdevice_spidevice_enter(busdevice_spidevice_obj_t *self); +extern void common_hal_busdevice_spidevice_exit(busdevice_spidevice_obj_t *self); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BUSDEVICE_SPIDEVICE_H diff --git a/shared-module/busdevice/SPIDevice.c b/shared-module/busdevice/SPIDevice.c new file mode 100644 index 0000000000000..d9b63a007eae9 --- /dev/null +++ b/shared-module/busdevice/SPIDevice.c @@ -0,0 +1,85 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Mark Komus + * + * 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 "shared-bindings/busdevice/SPIDevice.h" +#include "shared-bindings/busio/SPI.h" +#include "shared-bindings/digitalio/DigitalInOut.h" +#include "py/mperrno.h" +#include "py/nlr.h" +#include "py/runtime.h" + +void common_hal_busdevice_spidevice_construct(busdevice_spidevice_obj_t *self, busio_spi_obj_t *spi, digitalio_digitalinout_obj_t *cs, + uint32_t baudrate, uint8_t polarity, uint8_t phase, uint8_t extra_clocks) { + self->spi = spi; + self->baudrate = baudrate; + self->polarity = polarity; + self->phase = phase; + self->extra_clocks = extra_clocks; + self->chip_select = cs; +} + +void common_hal_busdevice_spidevice_enter(busdevice_spidevice_obj_t *self) { + bool success = false; + while (!success) { + success = common_hal_busio_spi_try_lock(self->spi); + RUN_BACKGROUND_TASKS; + mp_handle_pending(); + } + + common_hal_busio_spi_configure(self->spi, self->baudrate, self->polarity, self->phase, 8); + + if (self->chip_select != MP_OBJ_NULL) { + common_hal_digitalio_digitalinout_set_value(MP_OBJ_TO_PTR(self->chip_select), false); + } +} + +void common_hal_busdevice_spidevice_exit(busdevice_spidevice_obj_t *self) { + if (self->chip_select != MP_OBJ_NULL) { + common_hal_digitalio_digitalinout_set_value(MP_OBJ_TO_PTR(self->chip_select), true); + } + + if (self->extra_clocks > 0) { + + mp_buffer_info_t bufinfo; + mp_obj_t buffer = mp_obj_new_bytearray_of_zeros(1); + + mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_READ); + ((uint8_t*)bufinfo.buf)[0] = 0xFF; + + uint8_t clocks = self->extra_clocks / 8; + if ((self->extra_clocks % 8) != 0) + clocks += 1; + + while (clocks > 0) { + if (!common_hal_busio_spi_write(self->spi, ((uint8_t*)bufinfo.buf), 1)) { + mp_raise_OSError(MP_EIO); + } + clocks--; + } + } + + common_hal_busio_spi_unlock(self->spi); +} diff --git a/shared-module/busdevice/SPIDevice.h b/shared-module/busdevice/SPIDevice.h new file mode 100644 index 0000000000000..ffabf79dff413 --- /dev/null +++ b/shared-module/busdevice/SPIDevice.h @@ -0,0 +1,44 @@ +/* + * 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. + */ + +#ifndef MICROPY_INCLUDED_ATMEL_SAMD_SHARED_MODULE_BUSDEVICE_SPIDEVICE_H +#define MICROPY_INCLUDED_ATMEL_SAMD_SHARED_MODULE_BUSDEVICE_SPIDEVICE_H + +#include "py/obj.h" +#include "common-hal/busio/SPI.h" +#include "common-hal/digitalio/DigitalInOut.h" + +typedef struct { + mp_obj_base_t base; + busio_spi_obj_t *spi; + uint32_t baudrate; + uint8_t polarity; + uint8_t phase; + uint8_t extra_clocks; + digitalio_digitalinout_obj_t *chip_select; +} busdevice_spidevice_obj_t; + +#endif // MICROPY_INCLUDED_ATMEL_SAMD_SHARED_MODULE_BUSDEVICE_SPIDEVICE_H From 0c30a26c9bcdfe537262d4ad3ea62b7eaba0c7b8 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sat, 31 Oct 2020 13:19:13 -0400 Subject: [PATCH 099/770] Update .github/workflows/build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 00db4f8cdee2c..36bf136d4d2fc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -116,7 +116,7 @@ jobs: [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static-raspbian s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-raspbian-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-amd64-linux-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static.exe s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-x64-windows-${{ env.CP_VERSION }}.exe --no-progress --region us-east-1 - zip -9 circuitpython-stubs.${{ env.CP_VERSION }}.zip stubs + zip -9 circuitpython-stubs.zip stubs [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp circuitpython-stubs.zip s3://adafruit-circuit-python/bin/stubs/circuitpython-stubs-${{ env.CP_VERSION }}.zip --no-progress --region us-east-1 env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} From 5ea09fe34847f6d05e579e8e838501438f122640 Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Sat, 31 Oct 2020 13:37:05 -0500 Subject: [PATCH 100/770] Fixed stubs --- shared-bindings/busdevice/I2CDevice.c | 80 +++++++++++++++------------ shared-bindings/busdevice/__init__.c | 2 +- 2 files changed, 46 insertions(+), 36 deletions(-) diff --git a/shared-bindings/busdevice/I2CDevice.c b/shared-bindings/busdevice/I2CDevice.c index f5e968137c43c..e0e89e16aba5a 100644 --- a/shared-bindings/busdevice/I2CDevice.c +++ b/shared-bindings/busdevice/I2CDevice.c @@ -39,27 +39,30 @@ //| class I2CDevice: -//| """ -//| Represents a single I2C device and manages locking the bus and the device -//| address. -//| :param ~busio.I2C i2c: The I2C bus the device is on -//| :param int device_address: The 7 bit device address -//| :param bool probe: Probe for the device upon object creation, default is true -//| .. note:: This class is **NOT** built into CircuitPython. See -//| :ref:`here for install instructions `. -//| Example: -//| .. code-block:: python -//| import busio -//| from board import * -//| from adafruit_bus_device.i2c_device import I2CDevice -//| with busio.I2C(SCL, SDA) as i2c: -//| device = I2CDevice(i2c, 0x70) -//| bytes_read = bytearray(4) -//| with device: -//| device.readinto(bytes_read) -//| # A second transaction -//| with device: -//| device.write(bytes_read)""" +//| """I2C Device Manager""" +//| +//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 100000, timeout: int = 255) -> None: +//| +//| """Represents a single I2C device and manages locking the bus and the device +//| address. +//| :param ~busio.I2C i2c: The I2C bus the device is on +//| :param int device_address: The 7 bit device address +//| :param bool probe: Probe for the device upon object creation, default is true +//| .. note:: This class is **NOT** built into CircuitPython. See +//| :ref:`here for install instructions `. +//| Example: +//| .. code-block:: python +//| import busio +//| from board import * +//| from adafruit_bus_device.i2c_device import I2CDevice +//| with busio.I2C(SCL, SDA) as i2c: +//| device = I2CDevice(i2c, 0x70) +//| bytes_read = bytearray(4) +//| with device: +//| device.readinto(bytes_read) +//| # A second transaction +//| with device: +//| device.write(bytes_read)""" //| ... //| STATIC mp_obj_t busdevice_i2cdevice_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { @@ -84,6 +87,10 @@ STATIC mp_obj_t busdevice_i2cdevice_make_new(const mp_obj_type_t *type, size_t n return (mp_obj_t)self; } +//| def __enter__(self) -> I2C: +//| """Context manager entry to lock bus.""" +//| ... +//| STATIC mp_obj_t busdevice_i2cdevice_obj___enter__(mp_obj_t self_in) { busdevice_i2cdevice_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_busdevice_i2cdevice_lock(self); @@ -91,13 +98,17 @@ STATIC mp_obj_t busdevice_i2cdevice_obj___enter__(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(busdevice_i2cdevice___enter___obj, busdevice_i2cdevice_obj___enter__); +//| def __exit__(self) -> None: +//| """Automatically unlocks the bus on exit.""" +//| ... +//| STATIC mp_obj_t busdevice_i2cdevice_obj___exit__(size_t n_args, const mp_obj_t *args) { common_hal_busdevice_i2cdevice_unlock(MP_OBJ_TO_PTR(args[0])); return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busdevice_i2cdevice___exit___obj, 4, 4, busdevice_i2cdevice_obj___exit__); -//| def readinto(self, buf, *, start=0, end=None): +//| def readinto(self, buf, *, start=0, end=None) -> None: //| """ //| Read into ``buf`` from the device. The number of bytes read will be the //| length of ``buf``. @@ -143,18 +154,17 @@ STATIC mp_obj_t busdevice_i2cdevice_readinto(size_t n_args, const mp_obj_t *pos_ } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busdevice_i2cdevice_readinto_obj, 2, busdevice_i2cdevice_readinto); -//| def write(self, buf, *, start=0, end=None): -//| """ -//| Write the bytes from ``buffer`` to the device, then transmit a stop -//| bit. -//| If ``start`` or ``end`` is provided, then the buffer will be sliced -//| as if ``buffer[start:end]``. This will not cause an allocation like -//| ``buffer[start:end]`` will so it saves memory. -//| :param bytearray buffer: buffer containing the bytes to write -//| :param int start: Index to start writing from -//| :param int end: Index to read up to but not include; if None, use ``len(buf)`` -//| """ -//| ... +//| def write(self, buf, *, start=0, end=None) -> None: +//| """ +//| Write the bytes from ``buffer`` to the device, then transmit a stop bit. +//| If ``start`` or ``end`` is provided, then the buffer will be sliced +//| as if ``buffer[start:end]``. This will not cause an allocation like +//| ``buffer[start:end]`` will so it saves memory. +//| :param bytearray buffer: buffer containing the bytes to write +//| :param int start: Index to start writing from +//| :param int end: Index to read up to but not include; if None, use ``len(buf)`` +//| """ +//| ... //| STATIC void write(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, int32_t start, mp_int_t end) { mp_buffer_info_t bufinfo; @@ -190,7 +200,7 @@ STATIC mp_obj_t busdevice_i2cdevice_write(size_t n_args, const mp_obj_t *pos_arg MP_DEFINE_CONST_FUN_OBJ_KW(busdevice_i2cdevice_write_obj, 2, busdevice_i2cdevice_write); -//| def write_then_readinto(self, out_buffer, in_buffer, *, out_start=0, out_end=None, in_start=0, in_end=None): +//| def write_then_readinto(self, out_buffer, in_buffer, *, out_start=0, out_end=None, in_start=0, in_end=None) -> None: //| """ //| Write the bytes from ``out_buffer`` to the device, then immediately //| reads into ``in_buffer`` from the device. The number of bytes read diff --git a/shared-bindings/busdevice/__init__.c b/shared-bindings/busdevice/__init__.c index 112dabb7eb2f1..391d3698a8451 100644 --- a/shared-bindings/busdevice/__init__.c +++ b/shared-bindings/busdevice/__init__.c @@ -40,7 +40,7 @@ //| The I2CDevice and SPIDevice helper classes make managing transaction state on a bus easy. //| For example, they manage locking the bus to prevent other concurrent access. For SPI //| devices, it manages the chip select and protocol changes such as mode. For I2C, it -//| manages the device address. +//| manages the device address.""" //| STATIC const mp_rom_map_elem_t busdevice_module_globals_table[] = { From 073dc8751c92d943897db9e68b617fe7ba358f00 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sat, 31 Oct 2020 14:50:13 -0400 Subject: [PATCH 101/770] Use correct stubs directory name The stubs directory is called `circuitpython-stubs`, not `stubs`. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 36bf136d4d2fc..514fa82da23a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -116,7 +116,7 @@ jobs: [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static-raspbian s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-raspbian-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-amd64-linux-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static.exe s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-x64-windows-${{ env.CP_VERSION }}.exe --no-progress --region us-east-1 - zip -9 circuitpython-stubs.zip stubs + zip -9 circuitpython-stubs.zip circuitpython-stubs [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp circuitpython-stubs.zip s3://adafruit-circuit-python/bin/stubs/circuitpython-stubs-${{ env.CP_VERSION }}.zip --no-progress --region us-east-1 env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} From 3845db4bb98dbfa0b35b11baaa5d62f9f4266dea Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 31 Oct 2020 20:13:51 -0500 Subject: [PATCH 102/770] Update build.yml Need to request zip to recurse, because it is not the default --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 514fa82da23a5..b6c80558ebb76 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -116,7 +116,7 @@ jobs: [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static-raspbian s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-raspbian-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-amd64-linux-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static.exe s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-x64-windows-${{ env.CP_VERSION }}.exe --no-progress --region us-east-1 - zip -9 circuitpython-stubs.zip circuitpython-stubs + zip -9r circuitpython-stubs.zip circuitpython-stubs [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp circuitpython-stubs.zip s3://adafruit-circuit-python/bin/stubs/circuitpython-stubs-${{ env.CP_VERSION }}.zip --no-progress --region us-east-1 env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} From 1762a36438f7b54536186ab4d3bb11ef77553168 Mon Sep 17 00:00:00 2001 From: Jerry Needell Date: Sun, 1 Nov 2020 05:46:13 -0500 Subject: [PATCH 103/770] restore analogio to feather_m0_rfm9x/rfm69 builds --- ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk | 2 +- ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk index c33ab0740097d..d746cdf811a5f 100644 --- a/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk @@ -12,7 +12,7 @@ CIRCUITPY_FULL_BUILD = 0 # A number of modules are removed for RFM69 to make room for frozen libraries. # Many I/O functions are not available. -CIRCUITPY_ANALOGIO = 0 +CIRCUITPY_ANALOGIO = 1 CIRCUITPY_PULSEIO = 0 CIRCUITPY_NEOPIXEL_WRITE = 1 CIRCUITPY_ROTARYIO = 0 diff --git a/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk index 49b0ef5e362ab..d373346889ee5 100644 --- a/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk @@ -13,7 +13,7 @@ CIRCUITPY_FULL_BUILD = 0 # A number of modules are removed for RFM9x to make room for frozen libraries. # Many I/O functions are not available. -CIRCUITPY_ANALOGIO = 0 +CIRCUITPY_ANALOGIO = 1 CIRCUITPY_PULSEIO = 0 CIRCUITPY_NEOPIXEL_WRITE = 1 CIRCUITPY_ROTARYIO = 0 From 4438050f794edea5c6a3f919964908800dd6b522 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Sun, 1 Nov 2020 18:00:07 +0530 Subject: [PATCH 104/770] Add pcnt handler --- locale/circuitpython.pot | 9 ++- ports/esp32s2/Makefile | 1 + ports/esp32s2/common-hal/countio/Counter.c | 70 ++++++++++++---------- ports/esp32s2/common-hal/countio/Counter.h | 31 +++++++++- ports/esp32s2/pcnt_handler.c | 67 +++++++++++++++++++++ ports/esp32s2/pcnt_handler.h | 35 +++++++++++ 6 files changed, 177 insertions(+), 36 deletions(-) create mode 100644 ports/esp32s2/pcnt_handler.c create mode 100644 ports/esp32s2/pcnt_handler.h diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 16c3dd973a0e0..1336ab25cd15c 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-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-01 11:11+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1109,7 +1109,8 @@ msgid "Invalid phase" msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "" @@ -1271,6 +1272,10 @@ msgstr "" msgid "No MOSI Pin" msgstr "" +#: ports/esp32s2/pcnt_handler.c +msgid "No PCNT unit free" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 8d891edd02482..6dbbf58d4d392 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -173,6 +173,7 @@ SRC_C += \ background.c \ fatfs_port.c \ mphalport.c \ + pcnt_handler.c \ bindings/espidf/__init__.c \ boards/$(BOARD)/board.c \ boards/$(BOARD)/pins.c \ diff --git a/ports/esp32s2/common-hal/countio/Counter.c b/ports/esp32s2/common-hal/countio/Counter.c index 6a76a163d78e6..4357624733815 100644 --- a/ports/esp32s2/common-hal/countio/Counter.c +++ b/ports/esp32s2/common-hal/countio/Counter.c @@ -1,67 +1,75 @@ -#include "common-hal/countio/Counter.h" +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * 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 "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "common-hal/countio/Counter.h" +#include "common-hal/microcontroller/Pin.h" -#include "driver/pcnt.h" +void common_hal_countio_counter_construct(countio_counter_obj_t* self, + const mcu_pin_obj_t* pin) { + claim_pin(pin); -static void pcnt_init(countio_counter_obj_t* self) { - int unit = PCNT_UNIT_0; // Prepare configuration for the PCNT unit pcnt_config_t pcnt_config = { // Set PCNT input signal and control GPIOs - .pulse_gpio_num = self->pin->number, + .pulse_gpio_num = pin->number, .ctrl_gpio_num = PCNT_PIN_NOT_USED, .channel = PCNT_CHANNEL_0, - .unit = unit, // What to do on the positive / negative edge of pulse input? .pos_mode = PCNT_COUNT_INC, // Count up on the positive edge .neg_mode = PCNT_COUNT_DIS, // Keep the counter value on the negative edge }; // Initialize PCNT unit - pcnt_unit_config(&pcnt_config); - - // Configure and enable the input filter - pcnt_set_filter_value(unit, 100); - pcnt_filter_enable(unit); + pcnt_handler_init(&pcnt_config); - // Initialize PCNT's counter - pcnt_counter_pause(unit); - pcnt_counter_clear(unit); - - // Everything is set up, now go to counting - pcnt_counter_resume(unit); -} - -void common_hal_countio_counter_construct(countio_counter_obj_t* self, - const mcu_pin_obj_t* pin) { - claim_pin(pin); - self->pin = pin; - pcnt_init(self); + self->pin = pin->number; + self->unit = pcnt_config.unit; } bool common_hal_countio_counter_deinited(countio_counter_obj_t* self) { - return self->pin == NULL; + return self->unit == PCNT_UNIT_MAX; } void common_hal_countio_counter_deinit(countio_counter_obj_t* self) { if (common_hal_countio_counter_deinited(self)) { return; } - reset_pin_number(self->pin->number); - self->pin = NULL; + reset_pin_number(self->pin); + pcnt_handler_deinit(&self->unit); } mp_int_t common_hal_countio_counter_get_count(countio_counter_obj_t* self) { int16_t count; - pcnt_get_counter_value(PCNT_UNIT_0, &count); + pcnt_get_counter_value(self->unit, &count); return count+self->count; } void common_hal_countio_counter_set_count(countio_counter_obj_t* self, mp_int_t new_count) { self->count = new_count; - pcnt_counter_clear(PCNT_UNIT_0); + pcnt_counter_clear(self->unit); } void common_hal_countio_counter_reset(countio_counter_obj_t* self) { diff --git a/ports/esp32s2/common-hal/countio/Counter.h b/ports/esp32s2/common-hal/countio/Counter.h index 3406f9daaf5c7..63d1eb98b25a8 100644 --- a/ports/esp32s2/common-hal/countio/Counter.h +++ b/ports/esp32s2/common-hal/countio/Counter.h @@ -1,15 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ #ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_COUNTIO_COUNTER_H #define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_COUNTIO_COUNTER_H -#include "common-hal/microcontroller/Pin.h" - #include "py/obj.h" +#include "pcnt_handler.h" typedef struct { mp_obj_base_t base; - const mcu_pin_obj_t * pin; + uint8_t pin; mp_int_t count; + pcnt_unit_t unit; } countio_counter_obj_t; #endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_COUNTIO_COUNT_H diff --git a/ports/esp32s2/pcnt_handler.c b/ports/esp32s2/pcnt_handler.c new file mode 100644 index 0000000000000..56fb0f21c8063 --- /dev/null +++ b/ports/esp32s2/pcnt_handler.c @@ -0,0 +1,67 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * 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 "pcnt_handler.h" + +#include "py/runtime.h" +#include "supervisor/shared/translate.h" + +#define PCNT_UNIT_ACTIVE 1 +#define PCNT_UNIT_INACTIVE 0 + +static uint8_t pcnt_state[4]; + +void pcnt_handler_init(pcnt_config_t* pcnt_config) { + // Look for available pcnt unit + for (uint8_t i = 0; i<=3; i++) { + if (pcnt_state[i] == PCNT_UNIT_INACTIVE) { + pcnt_config->unit = (pcnt_unit_t)i; + pcnt_state[i] = PCNT_UNIT_ACTIVE; + break; + } else if (i == 3) { + mp_raise_RuntimeError(translate("No PCNT unit free")); + } + } + + // Initialize PCNT unit + pcnt_unit_config(pcnt_config); + + // Configure and enable the input filter + pcnt_set_filter_value(pcnt_config->unit, 100); + pcnt_filter_enable(pcnt_config->unit); + + // Initialize PCNT's counter + pcnt_counter_pause(pcnt_config->unit); + pcnt_counter_clear(pcnt_config->unit); + + // Everything is set up, now go to counting + pcnt_counter_resume(pcnt_config->unit); +} + +void pcnt_handler_deinit(pcnt_unit_t* unit) { + pcnt_state[*unit] = PCNT_UNIT_INACTIVE; + *unit = PCNT_UNIT_MAX; +} diff --git a/ports/esp32s2/pcnt_handler.h b/ports/esp32s2/pcnt_handler.h new file mode 100644 index 0000000000000..4bdaee1b87ad4 --- /dev/null +++ b/ports/esp32s2/pcnt_handler.h @@ -0,0 +1,35 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_PCNT_HANDLER_H +#define MICROPY_INCLUDED_ESP32S2_PCNT_HANDLER_H + +#include "driver/pcnt.h" + +extern void pcnt_handler_init(pcnt_config_t* pcnt_config); +extern void pcnt_handler_deinit(pcnt_unit_t* unit); + +#endif // MICROPY_INCLUDED_ESP32S2_PCNT_HANDLER_H From 76c11533807a12571889b81136d710dfc9da2c56 Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Sun, 1 Nov 2020 08:57:31 -0600 Subject: [PATCH 105/770] Fixed stubs --- shared-bindings/busdevice/I2CDevice.c | 2 +- shared-bindings/busdevice/SPIDevice.c | 53 +++++++++++++++------------ 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/shared-bindings/busdevice/I2CDevice.c b/shared-bindings/busdevice/I2CDevice.c index e0e89e16aba5a..5f1fac319712e 100644 --- a/shared-bindings/busdevice/I2CDevice.c +++ b/shared-bindings/busdevice/I2CDevice.c @@ -41,7 +41,7 @@ //| class I2CDevice: //| """I2C Device Manager""" //| -//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 100000, timeout: int = 255) -> None: +//| def __init__(self, i2c: busio.I2C, device_address: int, probe: bool = True) -> None: //| //| """Represents a single I2C device and manages locking the bus and the device //| address. diff --git a/shared-bindings/busdevice/SPIDevice.c b/shared-bindings/busdevice/SPIDevice.c index 7ef047349c00b..039cd842c95c2 100644 --- a/shared-bindings/busdevice/SPIDevice.c +++ b/shared-bindings/busdevice/SPIDevice.c @@ -24,9 +24,6 @@ * THE SOFTWARE. */ -// This file contains all of the Python API definitions for the -// busio.SPI class. - #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/busdevice/SPIDevice.h" #include "shared-bindings/util.h" @@ -42,27 +39,35 @@ //| class SPIDevice: -//| """ -//| Represents a single SPI device and manages locking the bus and the device -//| address. -//| :param ~busio.SPI spi: The SPI bus the device is on -//| :param int device_address: The 7 bit device address -//| :param bool probe: Probe for the device upon object creation, default is true -//| .. note:: This class is **NOT** built into CircuitPython. See -//| :ref:`here for install instructions `. -//| Example: -//| .. code-block:: python -//| import busio -//| from board import * -//| from adafruit_bus_device.spi_device import SPIDevice -//| with busio.SPI(SCL, SDA) as spi: -//| device = SPIDevice(spi, 0x70) -//| bytes_read = bytearray(4) -//| with device: -//| device.readinto(bytes_read) -//| # A second transaction -//| with device: -//| device.write(bytes_read)""" +//| """SPI Device Manager""" +//| +//| def __init__(self, spi: busio.SPI, chip_select: microcontroller.Pin, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, extra_clocks : int = 0) -> None: +//| +//| """ +//| Represents a single SPI device and manages locking the bus and the device address. +//| :param ~busio.SPI spi: The SPI bus the device is on +//| :param ~digitalio.DigitalInOut chip_select: The chip select pin object that implements the +//| DigitalInOut API. +//| :param int extra_clocks: The minimum number of clock cycles to cycle the bus after CS is high. +//| (Used for SD cards.) +//| Example: +//| .. code-block:: python +//| import busio +//| import digitalio +//| from board import * +//| from adafruit_bus_device.spi_device import SPIDevice +//| with busio.SPI(SCK, MOSI, MISO) as spi_bus: +//| cs = digitalio.DigitalInOut(D10) +//| device = SPIDevice(spi_bus, cs) +//| bytes_read = bytearray(4) +//| # The object assigned to spi in the with statements below +//| # is the original spi_bus object. We are using the busio.SPI +//| # operations busio.SPI.readinto() and busio.SPI.write(). +//| with device as spi: +//| spi.readinto(bytes_read) +//| # A second transaction +//| with device as spi: +//| spi.write(bytes_read)""" //| ... //| STATIC mp_obj_t busdevice_spidevice_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { From 856a6d4558d594e690a9e39ba841ef086c37ed9f Mon Sep 17 00:00:00 2001 From: Alvaro Figueroa Date: Sat, 31 Oct 2020 15:51:35 +0000 Subject: [PATCH 106/770] Translated using Weblate (Spanish) Currently translated at 99.2% (838 of 844 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/es.po b/locale/es.po index 348af34067c96..a750c80554319 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-10-21 20:13-0500\n" -"PO-Revision-Date: 2020-10-27 21:01+0000\n" -"Last-Translator: Adolfo Jayme Barrientos \n" +"PO-Revision-Date: 2020-11-01 16:26+0000\n" +"Last-Translator: Alvaro Figueroa \n" "Language-Team: \n" "Language: es\n" "MIME-Version: 1.0\n" @@ -297,7 +297,7 @@ msgstr "Tipo de dirección fuera de rango" #: ports/esp32s2/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" -msgstr "" +msgstr "Todos los periféricos CAN están en uso" #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" @@ -427,7 +427,7 @@ msgstr "" #: ports/esp32s2/common-hal/canio/CAN.c msgid "Baudrate not supported by peripheral" -msgstr "" +msgstr "El periférico no maneja el Baudrate" #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c From 7a07e8fa32de376c2f523b6c7d13e1b473198423 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Fri, 30 Oct 2020 21:04:56 +0000 Subject: [PATCH 107/770] Translated using Weblate (Swedish) Currently translated at 100.0% (844 of 844 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 53ed60acae4e4..65cd9f6f1f5e3 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-10-21 20:13-0500\n" -"PO-Revision-Date: 2020-10-26 02:36+0000\n" +"PO-Revision-Date: 2020-11-01 16:26+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -294,7 +294,7 @@ msgstr "Adresstyp utanför intervallet" #: ports/esp32s2/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" -msgstr "" +msgstr "All I2C-kringutrustning används" #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" @@ -420,7 +420,7 @@ msgstr "" #: ports/esp32s2/common-hal/canio/CAN.c msgid "Baudrate not supported by peripheral" -msgstr "" +msgstr "Baudrate stöds inte av kringutrustning" #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c @@ -2905,7 +2905,7 @@ msgstr "long int stöds inte i denna build" #: ports/esp32s2/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" -msgstr "" +msgstr "loopback + tyst läge stöds inte av kringutrustning" #: py/parse.c msgid "malformed f-string" @@ -2943,11 +2943,11 @@ msgstr "maximal rekursionsdjup överskriden" #: extmod/ulab/code/approx/approx.c msgid "maxiter must be > 0" -msgstr "" +msgstr "maxiter måste vara > 0" #: extmod/ulab/code/approx/approx.c msgid "maxiter should be > 0" -msgstr "" +msgstr "maxiter bör vara > 0" #: py/runtime.c #, c-format @@ -3388,7 +3388,7 @@ msgstr "argumentet sort måste vara en ndarray" #: extmod/ulab/code/numerical/numerical.c msgid "sorted axis can't be longer than 65535" -msgstr "" +msgstr "sorterad axel kan inte vara längre än 65535" #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" @@ -3522,12 +3522,12 @@ msgstr "tupel/lista har fel längd" #: ports/esp32s2/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" -msgstr "" +msgstr "twai_driver_install returnerade esp-idf-fel #%d" #: ports/esp32s2/common-hal/canio/CAN.c #, c-format msgid "twai_start returned esp-idf error #%d" -msgstr "" +msgstr "twai_start returnerade esp-idf-fel #%d" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c From 7dd53804a023dad0ae8f6b8504522f88c6015e90 Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Sun, 1 Nov 2020 10:31:31 -0600 Subject: [PATCH 108/770] Fixed stubs again --- shared-bindings/busdevice/I2CDevice.c | 7 +++---- shared-bindings/busdevice/SPIDevice.c | 11 +++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/shared-bindings/busdevice/I2CDevice.c b/shared-bindings/busdevice/I2CDevice.c index 5f1fac319712e..43996138b7f8f 100644 --- a/shared-bindings/busdevice/I2CDevice.c +++ b/shared-bindings/busdevice/I2CDevice.c @@ -48,10 +48,9 @@ //| :param ~busio.I2C i2c: The I2C bus the device is on //| :param int device_address: The 7 bit device address //| :param bool probe: Probe for the device upon object creation, default is true -//| .. note:: This class is **NOT** built into CircuitPython. See -//| :ref:`here for install instructions `. -//| Example: -//| .. code-block:: python +//| +//| Example:: +//| //| import busio //| from board import * //| from adafruit_bus_device.i2c_device import I2CDevice diff --git a/shared-bindings/busdevice/SPIDevice.c b/shared-bindings/busdevice/SPIDevice.c index 039cd842c95c2..4c633b4fd40ae 100644 --- a/shared-bindings/busdevice/SPIDevice.c +++ b/shared-bindings/busdevice/SPIDevice.c @@ -46,12 +46,11 @@ //| """ //| Represents a single SPI device and manages locking the bus and the device address. //| :param ~busio.SPI spi: The SPI bus the device is on -//| :param ~digitalio.DigitalInOut chip_select: The chip select pin object that implements the -//| DigitalInOut API. -//| :param int extra_clocks: The minimum number of clock cycles to cycle the bus after CS is high. -//| (Used for SD cards.) -//| Example: -//| .. code-block:: python +//| :param ~digitalio.DigitalInOut chip_select: The chip select pin object that implements the DigitalInOut API. +//| :param int extra_clocks: The minimum number of clock cycles to cycle the bus after CS is high. (Used for SD cards.) +//| +//| Example:: +//| //| import busio //| import digitalio //| from board import * From 72b829dff02cb9b8ebe6e2b47354f06650dbe864 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sun, 1 Nov 2020 14:52:03 -0500 Subject: [PATCH 109/770] add binascii to most builds --- ports/atmel-samd/mpconfigport.h | 1 + py/circuitpy_mpconfig.h | 10 ++++++++++ py/objmodule.c | 7 ++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ports/atmel-samd/mpconfigport.h b/ports/atmel-samd/mpconfigport.h index f7ccff4da2840..ed10da9b9d4bc 100644 --- a/ports/atmel-samd/mpconfigport.h +++ b/ports/atmel-samd/mpconfigport.h @@ -47,6 +47,7 @@ // MICROPY_PY_UJSON depends on MICROPY_PY_IO #define MICROPY_PY_IO (0) #define MICROPY_PY_REVERSE_SPECIAL_METHODS (0) +#define MICROPY_PY_UBINASCII (0) #define MICROPY_PY_UJSON (0) #define MICROPY_PY_COLLECTIONS_ORDEREDDICT (0) #define MICROPY_PY_UERRNO_LIST \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 1e01bd9c5e0b6..08efabddb5f1e 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -197,6 +197,9 @@ typedef long mp_off_t; #ifndef MICROPY_PY_COLLECTIONS_ORDEREDDICT #define MICROPY_PY_COLLECTIONS_ORDEREDDICT (CIRCUITPY_FULL_BUILD) #endif +#ifndef MICROPY_PY_UBINASCII +#define MICROPY_PY_UBINASCII (CIRCUITPY_FULL_BUILD) +#endif // Opposite setting is deliberate. #define MICROPY_PY_UERRNO_ERRORCODE (!CIRCUITPY_FULL_BUILD) #ifndef MICROPY_PY_URE @@ -699,6 +702,12 @@ extern const struct _mp_obj_module_t ustack_module; #endif // These modules are not yet in shared-bindings, but we prefer the non-uxxx names. +#if MICROPY_PY_UBINASCII +#define BINASCII_MODULE { MP_ROM_QSTR(MP_QSTR_binascii), MP_ROM_PTR(&mp_module_ubinascii) }, +#else +#define BINASCII_MODULE +#endif + #if MICROPY_PY_UERRNO #define ERRNO_MODULE { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_uerrno) }, #else @@ -770,6 +779,7 @@ extern const struct _mp_obj_module_t wifi_module; AUDIOMIXER_MODULE \ AUDIOMP3_MODULE \ AUDIOPWMIO_MODULE \ + BINASCII_MODULE \ BITBANGIO_MODULE \ BLEIO_MODULE \ BOARD_MODULE \ diff --git a/py/objmodule.c b/py/objmodule.c index 757aece046882..90796c5357deb 100644 --- a/py/objmodule.c +++ b/py/objmodule.c @@ -239,7 +239,12 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = { { MP_ROM_QSTR(MP_QSTR_hashlib), MP_ROM_PTR(&mp_module_uhashlib) }, #endif #if MICROPY_PY_UBINASCII - { MP_ROM_QSTR(MP_QSTR_binascii), MP_ROM_PTR(&mp_module_ubinascii) }, +#if CIRCUITPY +// CircuitPython: Defined in MICROPY_PORT_BUILTIN_MODULES, so not defined here. +// TODO: move to shared-bindings/ +#else + { MP_ROM_QSTR(MP_QSTR_ubinascii), MP_ROM_PTR(&mp_module_ubinascii) }, +#endif #endif #if MICROPY_PY_URANDOM { MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&mp_module_urandom) }, From 4e52757f2653b16b91856df7575ec503c02c5d22 Mon Sep 17 00:00:00 2001 From: "ITACA Innovation S.R.L" <40298126+ITACAInnovation@users.noreply.github.com> Date: Sun, 1 Nov 2020 22:22:55 +0100 Subject: [PATCH 110/770] Update pins.c Added LED, BOOST_EN and VEXT_SELECT pins. --- ports/atmel-samd/boards/uchip/pins.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/atmel-samd/boards/uchip/pins.c b/ports/atmel-samd/boards/uchip/pins.c index cfb6432336d43..2d7eeebe11084 100644 --- a/ports/atmel-samd/boards/uchip/pins.c +++ b/ports/atmel-samd/boards/uchip/pins.c @@ -1,6 +1,9 @@ #include "shared-bindings/board/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_LED_BUILTIN), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_BOOST_EN), MP_ROM_PTR(&pin_PA14) }, + { MP_ROM_QSTR(MP_QSTR_VEXT_SELECT), MP_ROM_PTR(&pin_PA15) }, { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA06) }, { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA06) }, { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA08) }, From 8bbbb2833ad6d9b649132559795f58f8f31f486f Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Sun, 1 Nov 2020 21:38:20 -0600 Subject: [PATCH 111/770] Fixes from testing SPI --- shared-bindings/busdevice/SPIDevice.c | 2 +- shared-bindings/busdevice/__init__.c | 2 ++ shared-module/busdevice/I2CDevice.c | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/shared-bindings/busdevice/SPIDevice.c b/shared-bindings/busdevice/SPIDevice.c index 4c633b4fd40ae..631d0eec499d1 100644 --- a/shared-bindings/busdevice/SPIDevice.c +++ b/shared-bindings/busdevice/SPIDevice.c @@ -103,7 +103,7 @@ STATIC mp_obj_t busdevice_spidevice_make_new(const mp_obj_type_t *type, size_t n STATIC mp_obj_t busdevice_spidevice_obj___enter__(mp_obj_t self_in) { busdevice_spidevice_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_busdevice_spidevice_enter(self); - return self; + return self->spi; } STATIC MP_DEFINE_CONST_FUN_OBJ_1(busdevice_spidevice___enter___obj, busdevice_spidevice_obj___enter__); diff --git a/shared-bindings/busdevice/__init__.c b/shared-bindings/busdevice/__init__.c index 391d3698a8451..6e6ede532f7a0 100644 --- a/shared-bindings/busdevice/__init__.c +++ b/shared-bindings/busdevice/__init__.c @@ -33,6 +33,7 @@ #include "shared-bindings/busdevice/__init__.h" #include "shared-bindings/busdevice/I2CDevice.h" +#include "shared-bindings/busdevice/SPIDevice.h" //| """Hardware accelerated external bus access @@ -46,6 +47,7 @@ STATIC const mp_rom_map_elem_t busdevice_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_busdevice) }, { MP_ROM_QSTR(MP_QSTR_I2CDevice), MP_ROM_PTR(&busdevice_i2cdevice_type) }, + { MP_ROM_QSTR(MP_QSTR_SPIDevice), MP_ROM_PTR(&busdevice_spidevice_type) }, }; STATIC MP_DEFINE_CONST_DICT(busdevice_module_globals, busdevice_module_globals_table); diff --git a/shared-module/busdevice/I2CDevice.c b/shared-module/busdevice/I2CDevice.c index 41706c1a8148b..b9f8ee25c0902 100644 --- a/shared-module/busdevice/I2CDevice.c +++ b/shared-module/busdevice/I2CDevice.c @@ -39,8 +39,8 @@ void common_hal_busdevice_i2cdevice_lock(busdevice_i2cdevice_obj_t *self) { bool success = false; while (!success) { success = common_hal_busio_i2c_try_lock(self->i2c); - RUN_BACKGROUND_TASKS; - mp_handle_pending(); + //RUN_BACKGROUND_TASKS; + //mp_handle_pending(); } } From 041c2a9f6174996a7c841e4ff7a1e158958c9745 Mon Sep 17 00:00:00 2001 From: Brian Dean Date: Mon, 2 Nov 2020 08:35:25 -0500 Subject: [PATCH 112/770] .../boards/bdmicro_vina_d51: PAD updates for better resource flexibility. --- .../boards/bdmicro_vina_d51/mpconfigboard.h | 10 +- .../atmel-samd/boards/bdmicro_vina_d51/pins.c | 118 ++++++++++-------- 2 files changed, 68 insertions(+), 60 deletions(-) diff --git a/ports/atmel-samd/boards/bdmicro_vina_d51/mpconfigboard.h b/ports/atmel-samd/boards/bdmicro_vina_d51/mpconfigboard.h index 6bc9bb70632c2..8b015df05ed2b 100644 --- a/ports/atmel-samd/boards/bdmicro_vina_d51/mpconfigboard.h +++ b/ports/atmel-samd/boards/bdmicro_vina_d51/mpconfigboard.h @@ -12,14 +12,14 @@ #define BOARD_HAS_CRYSTAL 1 -#define DEFAULT_I2C_BUS_SDA (&pin_PB02) -#define DEFAULT_I2C_BUS_SCL (&pin_PB03) +#define DEFAULT_I2C_BUS_SCL (&pin_PA16) +#define DEFAULT_I2C_BUS_SDA (&pin_PA17) +#define DEFAULT_UART_BUS_RX (&pin_PB20) +#define DEFAULT_UART_BUS_TX (&pin_PB21) #define DEFAULT_SPI_BUS_MISO (&pin_PB23) -#define DEFAULT_UART_BUS_TX (&pin_PB24) -#define DEFAULT_UART_BUS_RX (&pin_PB25) #define DEFAULT_SPI_BUS_MOSI (&pin_PC27) #define DEFAULT_SPI_BUS_SCK (&pin_PC28) -#define MICROPY_HW_LED_STATUS (&pin_PA15) +#define MICROPY_HW_LED_STATUS (&pin_PA23) #define MICROPY_HW_LED_RX (&pin_PC05) #define MICROPY_HW_LED_TX (&pin_PC06) diff --git a/ports/atmel-samd/boards/bdmicro_vina_d51/pins.c b/ports/atmel-samd/boards/bdmicro_vina_d51/pins.c index 931e0328fc480..8eeab8a9a5bf9 100644 --- a/ports/atmel-samd/boards/bdmicro_vina_d51/pins.c +++ b/ports/atmel-samd/boards/bdmicro_vina_d51/pins.c @@ -1,64 +1,70 @@ #include "shared-bindings/board/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PB08) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB09) }, - { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_PC00) }, - { MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_PC01) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA04) }, - { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA07) }, - { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB00) }, - { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PB01) }, - { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PB05) }, - { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PB06) }, - { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_PB07) }, - { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PC10) }, - { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PC11) }, - { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA14) }, - { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA13) }, - { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PB14) }, - { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PB15) }, - { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PC20) }, - { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PC21) }, - { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA12) }, - { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PB31) }, - { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA16) }, - { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA04) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_PB07) }, + { MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_PC00) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PB08) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PB09) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PC02) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PC03) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PB04) }, + { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PB05) }, + { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_PB06) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PB31) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PC16) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PC13) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA14) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA15) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PB12) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PB13) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PC17) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PC18) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PC19) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PC20) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PC21) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PB18) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PB19) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PC12) }, { MP_ROM_QSTR(MP_QSTR_DAC0), MP_ROM_PTR(&pin_PA02) }, { MP_ROM_QSTR(MP_QSTR_DAC1), MP_ROM_PTR(&pin_PA05) }, - { MP_ROM_QSTR(MP_QSTR_ESP01_EN), MP_ROM_PTR(&pin_PC03) }, + { MP_ROM_QSTR(MP_QSTR_ESP01_EN), MP_ROM_PTR(&pin_PC15) }, + { MP_ROM_QSTR(MP_QSTR_E5), MP_ROM_PTR(&pin_PC15) }, { MP_ROM_QSTR(MP_QSTR_ESP01_GPIO0), MP_ROM_PTR(&pin_PA18) }, - { MP_ROM_QSTR(MP_QSTR_UART3_RTS), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_E3), MP_ROM_PTR(&pin_PA18) }, { MP_ROM_QSTR(MP_QSTR_ESP01_GPIO2), MP_ROM_PTR(&pin_PA19) }, - { MP_ROM_QSTR(MP_QSTR_UART3_CTS), MP_ROM_PTR(&pin_PA19) }, - { MP_ROM_QSTR(MP_QSTR_ESP01_RESET), MP_ROM_PTR(&pin_PC02) }, - { MP_ROM_QSTR(MP_QSTR_ESP01_RX), MP_ROM_PTR(&pin_PB21) }, - { MP_ROM_QSTR(MP_QSTR_UART3_RX), MP_ROM_PTR(&pin_PB21) }, - { MP_ROM_QSTR(MP_QSTR_ESP01_TX), MP_ROM_PTR(&pin_PB20) }, - { MP_ROM_QSTR(MP_QSTR_UART3_TX), MP_ROM_PTR(&pin_PB20) }, - { MP_ROM_QSTR(MP_QSTR_I2C_SCL), MP_ROM_PTR(&pin_PB03) }, - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB03) }, - { MP_ROM_QSTR(MP_QSTR_I2C_SDA), MP_ROM_PTR(&pin_PB02) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB02) }, + { MP_ROM_QSTR(MP_QSTR_E4), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_ESP01_RESET), MP_ROM_PTR(&pin_PC14) }, + { MP_ROM_QSTR(MP_QSTR_E6), MP_ROM_PTR(&pin_PC14) }, + { MP_ROM_QSTR(MP_QSTR_ESP01_RX), MP_ROM_PTR(&pin_PA12) }, + { MP_ROM_QSTR(MP_QSTR_UART3_RX), MP_ROM_PTR(&pin_PA12) }, + { MP_ROM_QSTR(MP_QSTR_I2C3_SCL), MP_ROM_PTR(&pin_PA12) }, + { MP_ROM_QSTR(MP_QSTR_E2), MP_ROM_PTR(&pin_PA12) }, + { MP_ROM_QSTR(MP_QSTR_ESP01_TX), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_UART3_TX), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_I2C3_SDA), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_E1), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_I2C1_SCL), MP_ROM_PTR(&pin_PA16) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA16) }, + { MP_ROM_QSTR(MP_QSTR_I2C1_SDA), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA17) }, { MP_ROM_QSTR(MP_QSTR_I2S_FS_0), MP_ROM_PTR(&pin_PA20) }, - { MP_ROM_QSTR(MP_QSTR_I2S_FS_1), MP_ROM_PTR(&pin_PA23) }, { MP_ROM_QSTR(MP_QSTR_I2S_MCK_0), MP_ROM_PTR(&pin_PB17) }, - { MP_ROM_QSTR(MP_QSTR_I2S_MCK_1), MP_ROM_PTR(&pin_PB13) }, { MP_ROM_QSTR(MP_QSTR_I2S_SCK_0), MP_ROM_PTR(&pin_PB16) }, - { MP_ROM_QSTR(MP_QSTR_I2S_SCK_1), MP_ROM_PTR(&pin_PB12) }, { MP_ROM_QSTR(MP_QSTR_I2S_SDI), MP_ROM_PTR(&pin_PA22) }, { MP_ROM_QSTR(MP_QSTR_I2S_SDO), MP_ROM_PTR(&pin_PA21) }, - { MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_PA15) }, - { MP_ROM_QSTR(MP_QSTR_LED_STATUS), MP_ROM_PTR(&pin_PA15) }, - { MP_ROM_QSTR(MP_QSTR_LED_G), MP_ROM_PTR(&pin_PB18) }, - { MP_ROM_QSTR(MP_QSTR_LED_R), MP_ROM_PTR(&pin_PB19) }, + { MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_PA23) }, + { MP_ROM_QSTR(MP_QSTR_LED_STATUS), MP_ROM_PTR(&pin_PA23) }, + { MP_ROM_QSTR(MP_QSTR_LED_G), MP_ROM_PTR(&pin_PB15) }, + { MP_ROM_QSTR(MP_QSTR_LED_R), MP_ROM_PTR(&pin_PB14) }, { MP_ROM_QSTR(MP_QSTR_LED_RX), MP_ROM_PTR(&pin_PC05) }, { MP_ROM_QSTR(MP_QSTR_LED_TX), MP_ROM_PTR(&pin_PC06) }, - { MP_ROM_QSTR(MP_QSTR_RS485_RE), MP_ROM_PTR(&pin_PC15) }, - { MP_ROM_QSTR(MP_QSTR_RS485_RX), MP_ROM_PTR(&pin_PC13) }, - { MP_ROM_QSTR(MP_QSTR_RS485_TE), MP_ROM_PTR(&pin_PC14) }, - { MP_ROM_QSTR(MP_QSTR_RS485_TX), MP_ROM_PTR(&pin_PC12) }, + { MP_ROM_QSTR(MP_QSTR_RS485_RE), MP_ROM_PTR(&pin_PB01) }, + { MP_ROM_QSTR(MP_QSTR_RS485_RX), MP_ROM_PTR(&pin_PB03) }, + { MP_ROM_QSTR(MP_QSTR_RS485_TE), MP_ROM_PTR(&pin_PB00) }, + { MP_ROM_QSTR(MP_QSTR_RS485_TX), MP_ROM_PTR(&pin_PB02) }, { MP_ROM_QSTR(MP_QSTR_SPI_MISO), MP_ROM_PTR(&pin_PB23) }, { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB23) }, { MP_ROM_QSTR(MP_QSTR_SPI_MOSI), MP_ROM_PTR(&pin_PC27) }, @@ -67,14 +73,16 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PC28) }, { MP_ROM_QSTR(MP_QSTR_SPI_SS), MP_ROM_PTR(&pin_PB22) }, { MP_ROM_QSTR(MP_QSTR_SS), MP_ROM_PTR(&pin_PB22) }, - { MP_ROM_QSTR(MP_QSTR_UART1_CTS), MP_ROM_PTR(&pin_PC19) }, - { MP_ROM_QSTR(MP_QSTR_UART1_RTS), MP_ROM_PTR(&pin_PC18) }, - { MP_ROM_QSTR(MP_QSTR_UART1_RX), MP_ROM_PTR(&pin_PC17) }, - { MP_ROM_QSTR(MP_QSTR_UART1_TX), MP_ROM_PTR(&pin_PC16) }, - { MP_ROM_QSTR(MP_QSTR_UART2_RX), MP_ROM_PTR(&pin_PB25) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB25) }, - { MP_ROM_QSTR(MP_QSTR_UART2_TX), MP_ROM_PTR(&pin_PB24) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB24) }, + { MP_ROM_QSTR(MP_QSTR_UART1_CTS), MP_ROM_PTR(&pin_PC25) }, + { MP_ROM_QSTR(MP_QSTR_UART1_RTS), MP_ROM_PTR(&pin_PC24) }, + { MP_ROM_QSTR(MP_QSTR_UART1_RX), MP_ROM_PTR(&pin_PB24) }, + { MP_ROM_QSTR(MP_QSTR_UART1_TX), MP_ROM_PTR(&pin_PB25) }, + { MP_ROM_QSTR(MP_QSTR_UART2_RX), MP_ROM_PTR(&pin_PB20) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB20) }, + { MP_ROM_QSTR(MP_QSTR_I2C2_SCL), MP_ROM_PTR(&pin_PB20) }, + { MP_ROM_QSTR(MP_QSTR_UART2_TX), MP_ROM_PTR(&pin_PB21) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB21) }, + { MP_ROM_QSTR(MP_QSTR_I2C2_SDA), MP_ROM_PTR(&pin_PB21) }, { 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) }, From 1f7a3f0dfab05ab9551f0e1ecff9f45805897837 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 2 Nov 2020 15:28:30 -0500 Subject: [PATCH 113/770] Rev C Feather M4 CAN pin changes --- ports/atmel-samd/boards/feather_m4_can/pins.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ports/atmel-samd/boards/feather_m4_can/pins.c b/ports/atmel-samd/boards/feather_m4_can/pins.c index 2b67709f871ed..01504733015c1 100644 --- a/ports/atmel-samd/boards/feather_m4_can/pins.c +++ b/ports/atmel-samd/boards/feather_m4_can/pins.c @@ -36,6 +36,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA12) }, { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA14) }, { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA16) }, { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA18) }, @@ -45,14 +46,17 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA22) }, { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA23) }, - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PB03) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PB02) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_PB03) }, + + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PB00) }, + { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PB00) }, - { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PB01) }, - { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PB01) }, + { MP_ROM_QSTR(MP_QSTR_BOOST_ENABLE), MP_ROM_PTR(&pin_PB13) }, { MP_OBJ_NEW_QSTR(MP_QSTR_CAN_RX), MP_ROM_PTR(&pin_PB15) }, { MP_OBJ_NEW_QSTR(MP_QSTR_CAN_TX), MP_ROM_PTR(&pin_PB14) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_CAN_STANDBY), MP_ROM_PTR(&pin_PB13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CAN_STANDBY), MP_ROM_PTR(&pin_PB12) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, From 23afe08b6f81b70e2f24c609e6c43b0682aaf30b Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Mon, 2 Nov 2020 17:15:19 -0500 Subject: [PATCH 114/770] Add GPIO reset to end of neopixel-write --- ports/esp32s2/common-hal/neopixel_write/__init__.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/esp32s2/common-hal/neopixel_write/__init__.c b/ports/esp32s2/common-hal/neopixel_write/__init__.c index 553cb79f8316f..63d50bf14affa 100644 --- a/ports/esp32s2/common-hal/neopixel_write/__init__.c +++ b/ports/esp32s2/common-hal/neopixel_write/__init__.c @@ -125,4 +125,6 @@ void common_hal_neopixel_write (const digitalio_digitalinout_obj_t* digitalinout // Free channel again esp32s2_peripherals_free_rmt(config.channel); + // Swap pin back to GPIO mode + gpio_set_direction(digitalinout->pin->number, GPIO_MODE_OUTPUT); } From 6c61a53e0fc7a2b56156551a7da07e8734e00a33 Mon Sep 17 00:00:00 2001 From: lady ada Date: Mon, 2 Nov 2020 18:38:23 -0500 Subject: [PATCH 115/770] io naming for gpio (credit to @kattni) --- .../boards/adafruit_metro_esp32s2/pins.c | 60 ++++++++++++------- 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/ports/esp32s2/boards/adafruit_metro_esp32s2/pins.c b/ports/esp32s2/boards/adafruit_metro_esp32s2/pins.c index 08d2b2a1a3a4e..a7fc8b2d7cf9a 100644 --- a/ports/esp32s2/boards/adafruit_metro_esp32s2/pins.c +++ b/ports/esp32s2/boards/adafruit_metro_esp32s2/pins.c @@ -2,41 +2,61 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO17) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO18) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO1) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO2) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO3) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO4) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO5) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO5) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO6) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO6) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO7) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO8) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO9) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO10) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO11) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO12) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO13) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO14) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO15) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO16) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO21) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO42) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, { MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_GPIO33) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO33),MP_ROM_PTR(&pin_GPIO33) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_GPIO34) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO34),MP_ROM_PTR(&pin_GPIO34) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_GPIO35) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO35),MP_ROM_PTR(&pin_GPIO35) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_GPIO37) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO37),MP_ROM_PTR(&pin_GPIO37) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO42) }, { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO45) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, { MP_OBJ_NEW_QSTR(MP_QSTR_DEBUG_RX), MP_ROM_PTR(&pin_GPIO38) }, { MP_OBJ_NEW_QSTR(MP_QSTR_DEBUG_TX), MP_ROM_PTR(&pin_GPIO37) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_GPIO35) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_GPIO37) }, - { 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) }, From 18838e390a71366ccaa1aaeda8964e65d70fc43f Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 29 Oct 2020 19:38:25 -0700 Subject: [PATCH 116/770] reduce connection footprint and fix recv --- ports/esp32s2/common-hal/socketpool/Socket.c | 22 ++++++------- .../esp32s2/esp-idf-config/sdkconfig.defaults | 33 ++++++++++++------- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/ports/esp32s2/common-hal/socketpool/Socket.c b/ports/esp32s2/common-hal/socketpool/Socket.c index 0a994c604ec84..750415dc7b165 100644 --- a/ports/esp32s2/common-hal/socketpool/Socket.c +++ b/ports/esp32s2/common-hal/socketpool/Socket.c @@ -79,15 +79,15 @@ mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t* self, const mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len) { size_t received = 0; - ssize_t last_read = 1; + int status = 0; uint64_t start_ticks = supervisor_ticks_ms64(); int sockfd; esp_err_t err = esp_tls_get_conn_sockfd(self->tcp, &sockfd); if (err != ESP_OK) { mp_raise_OSError(MP_EBADF); } - while (received < len && - last_read > 0 && + while (received == 0 && + status >= 0 && (self->timeout_ms == 0 || supervisor_ticks_ms64() - start_ticks <= self->timeout_ms) && !mp_hal_is_interrupted()) { RUN_BACKGROUND_TASKS; @@ -95,27 +95,25 @@ mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, if (available == 0) { // This reads the raw socket buffer and is used for non-TLS connections // and between encrypted TLS blocks. - int status = lwip_ioctl(sockfd, FIONREAD, &available); - if (status < 0) { - last_read = status; - break; - } + status = lwip_ioctl(sockfd, FIONREAD, &available); } size_t remaining = len - received; if (available > remaining) { available = remaining; } if (available > 0) { - last_read = esp_tls_conn_read(self->tcp, (void*) buf + received, available); - received += last_read; + status = esp_tls_conn_read(self->tcp, (void*) buf + received, available); + if (status > 0) { + received += status; + } } } - if (last_read == 0) { + if (received == 0) { // socket closed common_hal_socketpool_socket_close(self); } - if (last_read < 0) { + if (status < 0) { mp_raise_BrokenPipeError(); } return received; diff --git a/ports/esp32s2/esp-idf-config/sdkconfig.defaults b/ports/esp32s2/esp-idf-config/sdkconfig.defaults index 4094367e0cdb8..37b33fc69e7ef 100644 --- a/ports/esp32s2/esp-idf-config/sdkconfig.defaults +++ b/ports/esp32s2/esp-idf-config/sdkconfig.defaults @@ -135,6 +135,7 @@ CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y # CONFIG_COMPILER_STACK_CHECK_MODE_ALL is not set # CONFIG_COMPILER_WARN_WRITE_STRINGS is not set # CONFIG_COMPILER_DISABLE_GCC8_WARNINGS is not set +# CONFIG_COMPILER_DUMP_RTL_FILES is not set # end of Compiler options # @@ -332,12 +333,13 @@ CONFIG_ESP_TIMER_IMPL_SYSTIMER=y # # Wi-Fi # -CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10 -CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=32 +CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 +CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 # CONFIG_ESP32_WIFI_STATIC_TX_BUFFER is not set CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER=y CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=1 -CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=32 +CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=16 +CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 # CONFIG_ESP32_WIFI_CSI_ENABLED is not set CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y CONFIG_ESP32_WIFI_TX_BA_WIN=6 @@ -439,7 +441,7 @@ CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y # CONFIG_LWIP_L2_TO_L3_COPY is not set # CONFIG_LWIP_IRAM_OPTIMIZATION is not set CONFIG_LWIP_TIMERS_ONDEMAND=y -CONFIG_LWIP_MAX_SOCKETS=10 +CONFIG_LWIP_MAX_SOCKETS=4 # CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set # CONFIG_LWIP_SO_LINGER is not set CONFIG_LWIP_SO_REUSE=y @@ -459,6 +461,9 @@ CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32 CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y # CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set +# +# CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH is not set + # # DHCP server # @@ -474,15 +479,15 @@ CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 # # TCP # -CONFIG_LWIP_MAX_ACTIVE_TCP=16 -CONFIG_LWIP_MAX_LISTENING_TCP=16 +CONFIG_LWIP_MAX_ACTIVE_TCP=4 +CONFIG_LWIP_MAX_LISTENING_TCP=4 CONFIG_LWIP_TCP_MAXRTX=12 CONFIG_LWIP_TCP_SYNMAXRTX=6 CONFIG_LWIP_TCP_MSS=1440 CONFIG_LWIP_TCP_TMR_INTERVAL=250 CONFIG_LWIP_TCP_MSL=60000 -CONFIG_LWIP_TCP_SND_BUF_DEFAULT=5744 -CONFIG_LWIP_TCP_WND_DEFAULT=5744 +CONFIG_LWIP_TCP_SND_BUF_DEFAULT=2880 +CONFIG_LWIP_TCP_WND_DEFAULT=2880 CONFIG_LWIP_TCP_RECVMBOX_SIZE=6 CONFIG_LWIP_TCP_QUEUE_OOSEQ=y # CONFIG_LWIP_TCP_SACK_OUT is not set @@ -505,6 +510,8 @@ CONFIG_LWIP_TCPIP_TASK_AFFINITY_NO_AFFINITY=y # CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0 is not set CONFIG_LWIP_TCPIP_TASK_AFFINITY=0x7FFFFFFF # CONFIG_LWIP_PPP_SUPPORT is not set +CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE=3 +CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS=5 # CONFIG_LWIP_SLIP_SUPPORT is not set # @@ -552,8 +559,10 @@ CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y # CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC is not set CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384 -CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096 -# CONFIG_MBEDTLS_DYNAMIC_BUFFER is not set +CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=2048 +CONFIG_MBEDTLS_DYNAMIC_BUFFER=y +CONFIG_MBEDTLS_DYNAMIC_FREE_PEER_CERT=y +CONFIG_MBEDTLS_DYNAMIC_FREE_CONFIG_DATA=y # CONFIG_MBEDTLS_DEBUG is not set # @@ -824,8 +833,8 @@ CONFIG_TCP_MAXRTX=12 CONFIG_TCP_SYNMAXRTX=6 CONFIG_TCP_MSS=1440 CONFIG_TCP_MSL=60000 -CONFIG_TCP_SND_BUF_DEFAULT=5744 -CONFIG_TCP_WND_DEFAULT=5744 +CONFIG_TCP_SND_BUF_DEFAULT=2880 +CONFIG_TCP_WND_DEFAULT=2880 CONFIG_TCP_RECVMBOX_SIZE=6 CONFIG_TCP_QUEUE_OOSEQ=y # CONFIG_ESP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set From 88fcf4ef7e001e547ed94747df5d22b6736c881c Mon Sep 17 00:00:00 2001 From: sw23 Date: Mon, 2 Nov 2020 19:59:07 -0500 Subject: [PATCH 117/770] Removing implementation-specific values for socket/socketpool class attributes --- shared-bindings/socket/__init__.c | 12 ++++++------ shared-bindings/socketpool/SocketPool.c | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/shared-bindings/socket/__init__.c b/shared-bindings/socket/__init__.c index 2969b371494a1..799bf28afaf61 100644 --- a/shared-bindings/socket/__init__.c +++ b/shared-bindings/socket/__init__.c @@ -49,12 +49,12 @@ STATIC const mp_obj_type_t socket_type; //| class socket: //| -//| AF_INET = 2 -//| AF_INET6 = 10 -//| SOCK_STREAM = 1 -//| SOCK_DGRAM = 2 -//| SOCK_RAW = 3 -//| IPPROTO_TCP = 6 +//| AF_INET: int +//| AF_INET6: int +//| SOCK_STREAM: int +//| SOCK_DGRAM: int +//| SOCK_RAW: int +//| IPPROTO_TCP: int //| //| def __init__(self, family: int = AF_INET, type: int = SOCK_STREAM, proto: int = IPPROTO_TCP) -> None: //| """Create a new socket diff --git a/shared-bindings/socketpool/SocketPool.c b/shared-bindings/socketpool/SocketPool.c index 2234f359ef320..73eeed2652bab 100644 --- a/shared-bindings/socketpool/SocketPool.c +++ b/shared-bindings/socketpool/SocketPool.c @@ -57,12 +57,12 @@ STATIC mp_obj_t socketpool_socketpool_make_new(const mp_obj_type_t *type, size_t return MP_OBJ_FROM_PTR(s); } -//| AF_INET = 0 -//| AF_INET6 = 1 -//| SOCK_STREAM = 0 -//| SOCK_DGRAM = 1 -//| SOCK_RAW = 2 -//| IPPROTO_TCP = 6 +//| AF_INET: int +//| AF_INET6: int +//| SOCK_STREAM: int +//| SOCK_DGRAM: int +//| SOCK_RAW: int +//| IPPROTO_TCP: int //| //| def socket(self, family: int = AF_INET, type: int = SOCK_STREAM, proto: int = IPPROTO_TCP) -> socketpool.Socket: //| """Create a new socket From 7441344c6f29d9dbf7f8cedef55f394c42916963 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 2 Nov 2020 17:22:24 -0800 Subject: [PATCH 118/770] Add new config options to default --- ports/esp32s2/esp-idf-config/sdkconfig.defaults | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ports/esp32s2/esp-idf-config/sdkconfig.defaults b/ports/esp32s2/esp-idf-config/sdkconfig.defaults index 37b33fc69e7ef..025b05caa681a 100644 --- a/ports/esp32s2/esp-idf-config/sdkconfig.defaults +++ b/ports/esp32s2/esp-idf-config/sdkconfig.defaults @@ -264,6 +264,11 @@ CONFIG_ESP32S2_ALLOW_RTC_FAST_MEM_AS_HEAP=y # CONFIG_PM_ENABLE is not set # end of Power Management +# +# ADC-Calibration +# +# end of ADC-Calibration + # # Common ESP-related # @@ -403,6 +408,7 @@ CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 # CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y # CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set +# CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH is not set CONFIG_FREERTOS_DEBUG_OCDAWARE=y # end of FreeRTOS @@ -715,6 +721,7 @@ CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=20 CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=1 CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=8192 +# CONFIG_SPI_FLASH_SIZE_OVERRIDE is not set # # Auto-detect flash chips From c4521287e39abf92f1833a25f950aa5bd8e4857c Mon Sep 17 00:00:00 2001 From: lady ada Date: Mon, 2 Nov 2020 23:22:53 -0500 Subject: [PATCH 119/770] add rx/tx default uart names --- ports/esp32s2/boards/adafruit_metro_esp32s2/pins.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports/esp32s2/boards/adafruit_metro_esp32s2/pins.c b/ports/esp32s2/boards/adafruit_metro_esp32s2/pins.c index a7fc8b2d7cf9a..dbd6cfef8d967 100644 --- a/ports/esp32s2/boards/adafruit_metro_esp32s2/pins.c +++ b/ports/esp32s2/boards/adafruit_metro_esp32s2/pins.c @@ -19,8 +19,12 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO4) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO5) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO6) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, From 4055c5ac61f824f7f2cfd72e670037af2f601427 Mon Sep 17 00:00:00 2001 From: Ed Hagerty Date: Tue, 3 Nov 2020 17:14:58 +0000 Subject: [PATCH 120/770] Update README.md --- ports/esp32s2/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/README.md b/ports/esp32s2/README.md index f3e678de85e5a..0738d520e7f30 100644 --- a/ports/esp32s2/README.md +++ b/ports/esp32s2/README.md @@ -30,7 +30,7 @@ Connect these pins using a [USB adapter](https://www.adafruit.com/product/4090) ## Building and flashing ## -Before building or flashing the ESP32-S2, you must [install the esp-idf](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/get-started/index.html). This must be re-done ever time the esp-idf is updated, but not every time you build. Run `cd ports/esp32s2` from `circuitpython/` to move to the esp32s2 port root, and run: +Before building or flashing the ESP32-S2, you must [install the esp-idf](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/get-started/index.html). This must be re-done every time the esp-idf is updated, but not every time you build. Run `cd ports/esp32s2` from `circuitpython/` to move to the esp32s2 port root, and run: ``` ./esp-idf/install.sh From ca935c0dafba767f8eae681664972d0f6a0c5507 Mon Sep 17 00:00:00 2001 From: "ITACA Innovation S.R.L" <40298126+ITACAInnovation@users.noreply.github.com> Date: Tue, 3 Nov 2020 21:22:19 +0100 Subject: [PATCH 121/770] Update pins.c Changed builtin to standard --- ports/atmel-samd/boards/uchip/pins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/uchip/pins.c b/ports/atmel-samd/boards/uchip/pins.c index 2d7eeebe11084..de5508110dc77 100644 --- a/ports/atmel-samd/boards/uchip/pins.c +++ b/ports/atmel-samd/boards/uchip/pins.c @@ -1,7 +1,7 @@ #include "shared-bindings/board/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_LED_BUILTIN), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA07) }, { MP_ROM_QSTR(MP_QSTR_BOOST_EN), MP_ROM_PTR(&pin_PA14) }, { MP_ROM_QSTR(MP_QSTR_VEXT_SELECT), MP_ROM_PTR(&pin_PA15) }, { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA06) }, From 472a5a99ec31a2acf14883caf635f66080947d78 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Tue, 3 Nov 2020 16:31:53 -0500 Subject: [PATCH 122/770] Add API reset to reset_pin_number --- ports/esp32s2/common-hal/microcontroller/Pin.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index 3c2611efeba79..72db5da471048 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -63,6 +63,8 @@ void reset_pin_number(gpio_num_t pin_number) { never_reset_pins[pin_number / 32] &= ~(1 << pin_number % 32); in_use[pin_number / 32] &= ~(1 << pin_number % 32); + gpio_reset_pin(pin_number); + #ifdef MICROPY_HW_NEOPIXEL if (pin_number == MICROPY_HW_NEOPIXEL->number) { neopixel_in_use = false; @@ -83,9 +85,7 @@ void reset_all_pins(void) { (never_reset_pins[i / 32] & (1 << i % 32)) != 0) { continue; } - gpio_set_direction(i, GPIO_MODE_DEF_INPUT); - gpio_pullup_dis(i); - gpio_pulldown_dis(i); + gpio_reset_pin(i); } in_use[0] = 0; in_use[1] = 0; From 197539bd8262132155929927db974616f550f033 Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Tue, 3 Nov 2020 17:30:33 -0600 Subject: [PATCH 123/770] Moved I2CDevice and SPI to match python library --- shared-bindings/busdevice/__init__.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/shared-bindings/busdevice/__init__.c b/shared-bindings/busdevice/__init__.c index 6e6ede532f7a0..a9a1a83a33e77 100644 --- a/shared-bindings/busdevice/__init__.c +++ b/shared-bindings/busdevice/__init__.c @@ -35,6 +35,27 @@ #include "shared-bindings/busdevice/I2CDevice.h" #include "shared-bindings/busdevice/SPIDevice.h" +STATIC const mp_rom_map_elem_t busdevice_i2c_device_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_i2c_device) }, + { MP_ROM_QSTR(MP_QSTR_I2CDevice), MP_ROM_PTR(&busdevice_i2cdevice_type) }, +}; +STATIC MP_DEFINE_CONST_DICT(busdevice_i2c_device_globals, busdevice_i2c_device_globals_table); + +const mp_obj_module_t busdevice_i2c_device_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&busdevice_i2c_device_globals, +}; + +STATIC const mp_rom_map_elem_t busdevice_spi_device_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_spi_device) }, + { MP_ROM_QSTR(MP_QSTR_SPIDevice), MP_ROM_PTR(&busdevice_spidevice_type) }, +}; +STATIC MP_DEFINE_CONST_DICT(busdevice_spi_device_globals, busdevice_spi_device_globals_table); + +const mp_obj_module_t busdevice_spi_device_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&busdevice_spi_device_globals, +}; //| """Hardware accelerated external bus access //| @@ -43,11 +64,10 @@ //| devices, it manages the chip select and protocol changes such as mode. For I2C, it //| manages the device address.""" //| - STATIC const mp_rom_map_elem_t busdevice_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_busdevice) }, - { MP_ROM_QSTR(MP_QSTR_I2CDevice), MP_ROM_PTR(&busdevice_i2cdevice_type) }, - { MP_ROM_QSTR(MP_QSTR_SPIDevice), MP_ROM_PTR(&busdevice_spidevice_type) }, + { MP_ROM_QSTR(MP_QSTR_i2c_device), MP_ROM_PTR(&busdevice_i2c_device_module) }, + { MP_ROM_QSTR(MP_QSTR_spi_device), MP_ROM_PTR(&busdevice_spi_device_module) }, }; STATIC MP_DEFINE_CONST_DICT(busdevice_module_globals, busdevice_module_globals_table); From 4c93db35959e96889b3a28af792c837fbe1fdca5 Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Tue, 3 Nov 2020 18:35:20 -0600 Subject: [PATCH 124/770] Renamed to adafruit_bus_device --- py/circuitpy_defns.mk | 8 +- py/circuitpy_mpconfig.h | 4 +- py/circuitpy_mpconfig.mk | 2 +- .../I2CDevice.c | 76 +++++++++---------- .../I2CDevice.h | 16 ++-- .../SPIDevice.c | 40 +++++----- .../SPIDevice.h | 10 +-- .../__init__.c | 40 +++++----- .../__init__.h | 0 .../I2CDevice.c | 22 +++--- .../I2CDevice.h | 2 +- .../SPIDevice.c | 8 +- .../SPIDevice.h | 2 +- .../__init__.c | 0 14 files changed, 115 insertions(+), 115 deletions(-) rename shared-bindings/{busdevice => adafruit_bus_device}/I2CDevice.c (71%) rename shared-bindings/{busdevice => adafruit_bus_device}/I2CDevice.h (68%) rename shared-bindings/{busdevice => adafruit_bus_device}/SPIDevice.c (70%) rename shared-bindings/{busdevice => adafruit_bus_device}/SPIDevice.h (79%) rename shared-bindings/{busdevice => adafruit_bus_device}/__init__.c (55%) rename shared-bindings/{busdevice => adafruit_bus_device}/__init__.h (100%) rename shared-module/{busdevice => adafruit_bus_device}/I2CDevice.c (66%) rename shared-module/{busdevice => adafruit_bus_device}/I2CDevice.h (97%) rename shared-module/{busdevice => adafruit_bus_device}/SPIDevice.c (87%) rename shared-module/{busdevice => adafruit_bus_device}/SPIDevice.h (97%) rename shared-module/{busdevice => adafruit_bus_device}/__init__.c (100%) diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 4822c0320827d..41ef8d742a8cb 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -134,7 +134,7 @@ ifeq ($(CIRCUITPY_BOARD),1) SRC_PATTERNS += board/% endif ifeq ($(CIRCUITPY_BUSDEVICE),1) -SRC_PATTERNS += busdevice/% +SRC_PATTERNS += adafruit_bus_device/% endif ifeq ($(CIRCUITPY_BUSIO),1) SRC_PATTERNS += busio/% bitbangio/OneWire.% @@ -435,9 +435,9 @@ SRC_SHARED_MODULE_ALL = \ bitbangio/SPI.c \ bitbangio/__init__.c \ board/__init__.c \ - busdevice/__init__.c \ - busdevice/I2CDevice.c \ - busdevice/SPIDevice.c \ + adafruit_bus_device/__init__.c \ + adafruit_bus_device/I2CDevice.c \ + adafruit_bus_device/SPIDevice.c \ busio/OneWire.c \ displayio/Bitmap.c \ displayio/ColorConverter.c \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 240fac189befe..78de7905a2de2 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -325,8 +325,8 @@ extern const struct _mp_obj_module_t board_module; #endif #if CIRCUITPY_BUSDEVICE -extern const struct _mp_obj_module_t busdevice_module; -#define BUSDEVICE_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_busdevice), (mp_obj_t)&busdevice_module }, +extern const struct _mp_obj_module_t adafruit_bus_device_module; +#define BUSDEVICE_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_adafruit_bus_device), (mp_obj_t)&adafruit_bus_device_module }, #else #define BUSDEVICE_MODULE #endif diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 1f96a8f2dd8c6..e814edd1696db 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -90,7 +90,7 @@ CFLAGS += -DCIRCUITPY_BLEIO=$(CIRCUITPY_BLEIO) CIRCUITPY_BOARD ?= 1 CFLAGS += -DCIRCUITPY_BOARD=$(CIRCUITPY_BOARD) -CIRCUITPY_BUSDEVICE ?= 1 +CIRCUITPY_BUSDEVICE ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_BUSDEVICE=$(CIRCUITPY_BUSDEVICE) CIRCUITPY_BUSIO ?= 1 diff --git a/shared-bindings/busdevice/I2CDevice.c b/shared-bindings/adafruit_bus_device/I2CDevice.c similarity index 71% rename from shared-bindings/busdevice/I2CDevice.c rename to shared-bindings/adafruit_bus_device/I2CDevice.c index 43996138b7f8f..3ec4dae12ed04 100644 --- a/shared-bindings/busdevice/I2CDevice.c +++ b/shared-bindings/adafruit_bus_device/I2CDevice.c @@ -28,9 +28,9 @@ // busio.I2C class. #include "shared-bindings/microcontroller/Pin.h" -#include "shared-bindings/busdevice/I2CDevice.h" +#include "shared-bindings/adafruit_bus_device/I2CDevice.h" #include "shared-bindings/util.h" -#include "shared-module/busdevice/I2CDevice.h" +#include "shared-module/adafruit_bus_device/I2CDevice.h" #include "lib/utils/buffer_helper.h" #include "lib/utils/context_manager_helpers.h" @@ -64,9 +64,9 @@ //| device.write(bytes_read)""" //| ... //| -STATIC mp_obj_t busdevice_i2cdevice_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - busdevice_i2cdevice_obj_t *self = m_new_obj(busdevice_i2cdevice_obj_t); - self->base.type = &busdevice_i2cdevice_type; +STATIC mp_obj_t adafruit_bus_device_i2cdevice_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + adafruit_bus_device_i2cdevice_obj_t *self = m_new_obj(adafruit_bus_device_i2cdevice_obj_t); + self->base.type = &adafruit_bus_device_i2cdevice_type; enum { ARG_i2c, ARG_device_address, ARG_probe }; static const mp_arg_t allowed_args[] = { { MP_QSTR_i2c, MP_ARG_REQUIRED | MP_ARG_OBJ }, @@ -78,9 +78,9 @@ STATIC mp_obj_t busdevice_i2cdevice_make_new(const mp_obj_type_t *type, size_t n busio_i2c_obj_t* i2c = args[ARG_i2c].u_obj; - common_hal_busdevice_i2cdevice_construct(MP_OBJ_TO_PTR(self), i2c, args[ARG_device_address].u_int); + common_hal_adafruit_bus_device_i2cdevice_construct(MP_OBJ_TO_PTR(self), i2c, args[ARG_device_address].u_int); if (args[ARG_probe].u_bool == true) { - common_hal_busdevice_i2cdevice_probe_for_device(self); + common_hal_adafruit_bus_device_i2cdevice_probe_for_device(self); } return (mp_obj_t)self; @@ -90,22 +90,22 @@ STATIC mp_obj_t busdevice_i2cdevice_make_new(const mp_obj_type_t *type, size_t n //| """Context manager entry to lock bus.""" //| ... //| -STATIC mp_obj_t busdevice_i2cdevice_obj___enter__(mp_obj_t self_in) { - busdevice_i2cdevice_obj_t *self = MP_OBJ_TO_PTR(self_in); - common_hal_busdevice_i2cdevice_lock(self); +STATIC mp_obj_t adafruit_bus_device_i2cdevice_obj___enter__(mp_obj_t self_in) { + adafruit_bus_device_i2cdevice_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_adafruit_bus_device_i2cdevice_lock(self); return self; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(busdevice_i2cdevice___enter___obj, busdevice_i2cdevice_obj___enter__); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(adafruit_bus_device_i2cdevice___enter___obj, adafruit_bus_device_i2cdevice_obj___enter__); //| def __exit__(self) -> None: //| """Automatically unlocks the bus on exit.""" //| ... //| -STATIC mp_obj_t busdevice_i2cdevice_obj___exit__(size_t n_args, const mp_obj_t *args) { - common_hal_busdevice_i2cdevice_unlock(MP_OBJ_TO_PTR(args[0])); +STATIC mp_obj_t adafruit_bus_device_i2cdevice_obj___exit__(size_t n_args, const mp_obj_t *args) { + common_hal_adafruit_bus_device_i2cdevice_unlock(MP_OBJ_TO_PTR(args[0])); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busdevice_i2cdevice___exit___obj, 4, 4, busdevice_i2cdevice_obj___exit__); +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(adafruit_bus_device_i2cdevice___exit___obj, 4, 4, adafruit_bus_device_i2cdevice_obj___exit__); //| def readinto(self, buf, *, start=0, end=None) -> None: //| """ @@ -119,7 +119,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busdevice_i2cdevice___exit___obj, 4, //| :param int end: Index to write up to but not include; if None, use ``len(buf)``""" //| ... //| -STATIC void readinto(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, int32_t start, mp_int_t end) { +STATIC void readinto(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, int32_t start, mp_int_t end) { mp_buffer_info_t bufinfo; mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_WRITE); @@ -129,13 +129,13 @@ STATIC void readinto(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, int32_t s mp_raise_ValueError(translate("Buffer must be at least length 1")); } - uint8_t status = common_hal_busdevice_i2cdevice_readinto(MP_OBJ_TO_PTR(self), ((uint8_t*)bufinfo.buf) + start, length); + uint8_t status = common_hal_adafruit_bus_device_i2cdevice_readinto(MP_OBJ_TO_PTR(self), ((uint8_t*)bufinfo.buf) + start, length); if (status != 0) { mp_raise_OSError(status); } } -STATIC mp_obj_t busdevice_i2cdevice_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +STATIC mp_obj_t adafruit_bus_device_i2cdevice_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buffer, ARG_start, ARG_end }; static const mp_arg_t allowed_args[] = { { MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ }, @@ -143,7 +143,7 @@ STATIC mp_obj_t busdevice_i2cdevice_readinto(size_t n_args, const mp_obj_t *pos_ { MP_QSTR_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, }; - busdevice_i2cdevice_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + adafruit_bus_device_i2cdevice_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); @@ -151,7 +151,7 @@ STATIC mp_obj_t busdevice_i2cdevice_readinto(size_t n_args, const mp_obj_t *pos_ readinto(self, args[ARG_buffer].u_obj, args[ARG_start].u_int, args[ARG_end].u_int); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busdevice_i2cdevice_readinto_obj, 2, busdevice_i2cdevice_readinto); +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(adafruit_bus_device_i2cdevice_readinto_obj, 2, adafruit_bus_device_i2cdevice_readinto); //| def write(self, buf, *, start=0, end=None) -> None: //| """ @@ -165,7 +165,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busdevice_i2cdevice_readinto_obj, 2, busdevice //| """ //| ... //| -STATIC void write(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, int32_t start, mp_int_t end) { +STATIC void write(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, int32_t start, mp_int_t end) { mp_buffer_info_t bufinfo; mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_READ); @@ -175,20 +175,20 @@ STATIC void write(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, int32_t star mp_raise_ValueError(translate("Buffer must be at least length 1")); } - uint8_t status = common_hal_busdevice_i2cdevice_write(MP_OBJ_TO_PTR(self), ((uint8_t*)bufinfo.buf) + start, length); + uint8_t status = common_hal_adafruit_bus_device_i2cdevice_write(MP_OBJ_TO_PTR(self), ((uint8_t*)bufinfo.buf) + start, length); if (status != 0) { mp_raise_OSError(status); } } -STATIC mp_obj_t busdevice_i2cdevice_write(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +STATIC mp_obj_t adafruit_bus_device_i2cdevice_write(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buffer, ARG_start, ARG_end }; static const mp_arg_t allowed_args[] = { { MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, { MP_QSTR_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, }; - busdevice_i2cdevice_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + adafruit_bus_device_i2cdevice_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); @@ -196,7 +196,7 @@ STATIC mp_obj_t busdevice_i2cdevice_write(size_t n_args, const mp_obj_t *pos_arg write(self, args[ARG_buffer].u_obj, args[ARG_start].u_int, args[ARG_end].u_int); return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_KW(busdevice_i2cdevice_write_obj, 2, busdevice_i2cdevice_write); +MP_DEFINE_CONST_FUN_OBJ_KW(adafruit_bus_device_i2cdevice_write_obj, 2, adafruit_bus_device_i2cdevice_write); //| def write_then_readinto(self, out_buffer, in_buffer, *, out_start=0, out_end=None, in_start=0, in_end=None) -> None: @@ -221,7 +221,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(busdevice_i2cdevice_write_obj, 2, busdevice_i2cdevice //| """ //| ... //| -STATIC mp_obj_t busdevice_i2cdevice_write_then_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +STATIC mp_obj_t adafruit_bus_device_i2cdevice_write_then_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_out_buffer, ARG_in_buffer, ARG_out_start, ARG_out_end, ARG_in_start, ARG_in_end }; static const mp_arg_t allowed_args[] = { { MP_QSTR_out_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ }, @@ -231,7 +231,7 @@ STATIC mp_obj_t busdevice_i2cdevice_write_then_readinto(size_t n_args, const mp_ { MP_QSTR_in_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, { MP_QSTR_in_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, }; - busdevice_i2cdevice_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + adafruit_bus_device_i2cdevice_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); @@ -242,21 +242,21 @@ STATIC mp_obj_t busdevice_i2cdevice_write_then_readinto(size_t n_args, const mp_ return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_KW(busdevice_i2cdevice_write_then_readinto_obj, 3, busdevice_i2cdevice_write_then_readinto); - -STATIC const mp_rom_map_elem_t busdevice_i2cdevice_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&busdevice_i2cdevice___enter___obj) }, - { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&busdevice_i2cdevice___exit___obj) }, - { MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&busdevice_i2cdevice_readinto_obj) }, - { MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&busdevice_i2cdevice_write_obj) }, - { MP_ROM_QSTR(MP_QSTR_write_then_readinto), MP_ROM_PTR(&busdevice_i2cdevice_write_then_readinto_obj) }, +MP_DEFINE_CONST_FUN_OBJ_KW(adafruit_bus_device_i2cdevice_write_then_readinto_obj, 3, adafruit_bus_device_i2cdevice_write_then_readinto); + +STATIC const mp_rom_map_elem_t adafruit_bus_device_i2cdevice_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&adafruit_bus_device_i2cdevice___enter___obj) }, + { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&adafruit_bus_device_i2cdevice___exit___obj) }, + { MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&adafruit_bus_device_i2cdevice_readinto_obj) }, + { MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&adafruit_bus_device_i2cdevice_write_obj) }, + { MP_ROM_QSTR(MP_QSTR_write_then_readinto), MP_ROM_PTR(&adafruit_bus_device_i2cdevice_write_then_readinto_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(busdevice_i2cdevice_locals_dict, busdevice_i2cdevice_locals_dict_table); +STATIC MP_DEFINE_CONST_DICT(adafruit_bus_device_i2cdevice_locals_dict, adafruit_bus_device_i2cdevice_locals_dict_table); -const mp_obj_type_t busdevice_i2cdevice_type = { +const mp_obj_type_t adafruit_bus_device_i2cdevice_type = { { &mp_type_type }, .name = MP_QSTR_I2CDevice, - .make_new = busdevice_i2cdevice_make_new, - .locals_dict = (mp_obj_dict_t*)&busdevice_i2cdevice_locals_dict, + .make_new = adafruit_bus_device_i2cdevice_make_new, + .locals_dict = (mp_obj_dict_t*)&adafruit_bus_device_i2cdevice_locals_dict, }; diff --git a/shared-bindings/busdevice/I2CDevice.h b/shared-bindings/adafruit_bus_device/I2CDevice.h similarity index 68% rename from shared-bindings/busdevice/I2CDevice.h rename to shared-bindings/adafruit_bus_device/I2CDevice.h index a1f869c4508ad..7b2182ff03ad6 100644 --- a/shared-bindings/busdevice/I2CDevice.h +++ b/shared-bindings/adafruit_bus_device/I2CDevice.h @@ -36,18 +36,18 @@ #include "py/obj.h" -#include "shared-module/busdevice/I2CDevice.h" +#include "shared-module/adafruit_bus_device/I2CDevice.h" //#include "shared-bindings/busio/I2C.h" // Type object used in Python. Should be shared between ports. -extern const mp_obj_type_t busdevice_i2cdevice_type; +extern const mp_obj_type_t adafruit_bus_device_i2cdevice_type; // Initializes the hardware peripheral. -extern void common_hal_busdevice_i2cdevice_construct(busdevice_i2cdevice_obj_t *self, busio_i2c_obj_t *i2c, uint8_t device_address); -extern uint8_t common_hal_busdevice_i2cdevice_readinto(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length); -extern uint8_t common_hal_busdevice_i2cdevice_write(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length); -extern void common_hal_busdevice_i2cdevice_lock(busdevice_i2cdevice_obj_t *self); -extern void common_hal_busdevice_i2cdevice_unlock(busdevice_i2cdevice_obj_t *self); -extern void common_hal_busdevice_i2cdevice_probe_for_device(busdevice_i2cdevice_obj_t *self); +extern void common_hal_adafruit_bus_device_i2cdevice_construct(adafruit_bus_device_i2cdevice_obj_t *self, busio_i2c_obj_t *i2c, uint8_t device_address); +extern uint8_t common_hal_adafruit_bus_device_i2cdevice_readinto(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length); +extern uint8_t common_hal_adafruit_bus_device_i2cdevice_write(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length); +extern void common_hal_adafruit_bus_device_i2cdevice_lock(adafruit_bus_device_i2cdevice_obj_t *self); +extern void common_hal_adafruit_bus_device_i2cdevice_unlock(adafruit_bus_device_i2cdevice_obj_t *self); +extern void common_hal_adafruit_bus_device_i2cdevice_probe_for_device(adafruit_bus_device_i2cdevice_obj_t *self); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_BUSDEVICE_I2CDEVICE_H diff --git a/shared-bindings/busdevice/SPIDevice.c b/shared-bindings/adafruit_bus_device/SPIDevice.c similarity index 70% rename from shared-bindings/busdevice/SPIDevice.c rename to shared-bindings/adafruit_bus_device/SPIDevice.c index 631d0eec499d1..e127e39b81670 100644 --- a/shared-bindings/busdevice/SPIDevice.c +++ b/shared-bindings/adafruit_bus_device/SPIDevice.c @@ -25,9 +25,9 @@ */ #include "shared-bindings/microcontroller/Pin.h" -#include "shared-bindings/busdevice/SPIDevice.h" +#include "shared-bindings/adafruit_bus_device/SPIDevice.h" #include "shared-bindings/util.h" -#include "shared-module/busdevice/SPIDevice.h" +#include "shared-module/adafruit_bus_device/SPIDevice.h" #include "common-hal/digitalio/DigitalInOut.h" #include "shared-bindings/digitalio/DigitalInOut.h" @@ -69,9 +69,9 @@ //| spi.write(bytes_read)""" //| ... //| -STATIC mp_obj_t busdevice_spidevice_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - busdevice_spidevice_obj_t *self = m_new_obj(busdevice_spidevice_obj_t); - self->base.type = &busdevice_spidevice_type; +STATIC mp_obj_t adafruit_bus_device_spidevice_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + adafruit_bus_device_spidevice_obj_t *self = m_new_obj(adafruit_bus_device_spidevice_obj_t); + self->base.type = &adafruit_bus_device_spidevice_type; enum { ARG_spi, ARG_chip_select, ARG_baudrate, ARG_polarity, ARG_phase, ARG_extra_clocks }; static const mp_arg_t allowed_args[] = { { MP_QSTR_spi, MP_ARG_REQUIRED | MP_ARG_OBJ }, @@ -86,7 +86,7 @@ STATIC mp_obj_t busdevice_spidevice_make_new(const mp_obj_type_t *type, size_t n busio_spi_obj_t* spi = args[ARG_spi].u_obj; - common_hal_busdevice_spidevice_construct(MP_OBJ_TO_PTR(self), spi, args[ARG_chip_select].u_obj, args[ARG_baudrate].u_int, args[ARG_polarity].u_int, + common_hal_adafruit_bus_device_spidevice_construct(MP_OBJ_TO_PTR(self), spi, args[ARG_chip_select].u_obj, args[ARG_baudrate].u_int, args[ARG_polarity].u_int, args[ARG_phase].u_int, args[ARG_extra_clocks].u_int); if (args[ARG_chip_select].u_obj != MP_OBJ_NULL) { @@ -100,29 +100,29 @@ STATIC mp_obj_t busdevice_spidevice_make_new(const mp_obj_type_t *type, size_t n return (mp_obj_t)self; } -STATIC mp_obj_t busdevice_spidevice_obj___enter__(mp_obj_t self_in) { - busdevice_spidevice_obj_t *self = MP_OBJ_TO_PTR(self_in); - common_hal_busdevice_spidevice_enter(self); +STATIC mp_obj_t adafruit_bus_device_spidevice_obj___enter__(mp_obj_t self_in) { + adafruit_bus_device_spidevice_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_adafruit_bus_device_spidevice_enter(self); return self->spi; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(busdevice_spidevice___enter___obj, busdevice_spidevice_obj___enter__); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(adafruit_bus_device_spidevice___enter___obj, adafruit_bus_device_spidevice_obj___enter__); -STATIC mp_obj_t busdevice_spidevice_obj___exit__(size_t n_args, const mp_obj_t *args) { - common_hal_busdevice_spidevice_exit(MP_OBJ_TO_PTR(args[0])); +STATIC mp_obj_t adafruit_bus_device_spidevice_obj___exit__(size_t n_args, const mp_obj_t *args) { + common_hal_adafruit_bus_device_spidevice_exit(MP_OBJ_TO_PTR(args[0])); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busdevice_spidevice___exit___obj, 4, 4, busdevice_spidevice_obj___exit__); +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(adafruit_bus_device_spidevice___exit___obj, 4, 4, adafruit_bus_device_spidevice_obj___exit__); -STATIC const mp_rom_map_elem_t busdevice_spidevice_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&busdevice_spidevice___enter___obj) }, - { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&busdevice_spidevice___exit___obj) }, +STATIC const mp_rom_map_elem_t adafruit_bus_device_spidevice_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&adafruit_bus_device_spidevice___enter___obj) }, + { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&adafruit_bus_device_spidevice___exit___obj) }, }; -STATIC MP_DEFINE_CONST_DICT(busdevice_spidevice_locals_dict, busdevice_spidevice_locals_dict_table); +STATIC MP_DEFINE_CONST_DICT(adafruit_bus_device_spidevice_locals_dict, adafruit_bus_device_spidevice_locals_dict_table); -const mp_obj_type_t busdevice_spidevice_type = { +const mp_obj_type_t adafruit_bus_device_spidevice_type = { { &mp_type_type }, .name = MP_QSTR_SPIDevice, - .make_new = busdevice_spidevice_make_new, - .locals_dict = (mp_obj_dict_t*)&busdevice_spidevice_locals_dict, + .make_new = adafruit_bus_device_spidevice_make_new, + .locals_dict = (mp_obj_dict_t*)&adafruit_bus_device_spidevice_locals_dict, }; diff --git a/shared-bindings/busdevice/SPIDevice.h b/shared-bindings/adafruit_bus_device/SPIDevice.h similarity index 79% rename from shared-bindings/busdevice/SPIDevice.h rename to shared-bindings/adafruit_bus_device/SPIDevice.h index 040f98548e38e..5596b157f0fdd 100644 --- a/shared-bindings/busdevice/SPIDevice.h +++ b/shared-bindings/adafruit_bus_device/SPIDevice.h @@ -36,15 +36,15 @@ #include "py/obj.h" -#include "shared-module/busdevice/SPIDevice.h" +#include "shared-module/adafruit_bus_device/SPIDevice.h" // Type object used in Python. Should be shared between ports. -extern const mp_obj_type_t busdevice_spidevice_type; +extern const mp_obj_type_t adafruit_bus_device_spidevice_type; // Initializes the hardware peripheral. -extern void common_hal_busdevice_spidevice_construct(busdevice_spidevice_obj_t *self, busio_spi_obj_t *spi, digitalio_digitalinout_obj_t *cs, +extern void common_hal_adafruit_bus_device_spidevice_construct(adafruit_bus_device_spidevice_obj_t *self, busio_spi_obj_t *spi, digitalio_digitalinout_obj_t *cs, uint32_t baudrate, uint8_t polarity, uint8_t phase, uint8_t extra_clocks); -extern void common_hal_busdevice_spidevice_enter(busdevice_spidevice_obj_t *self); -extern void common_hal_busdevice_spidevice_exit(busdevice_spidevice_obj_t *self); +extern void common_hal_adafruit_bus_device_spidevice_enter(adafruit_bus_device_spidevice_obj_t *self); +extern void common_hal_adafruit_bus_device_spidevice_exit(adafruit_bus_device_spidevice_obj_t *self); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_BUSDEVICE_SPIDEVICE_H diff --git a/shared-bindings/busdevice/__init__.c b/shared-bindings/adafruit_bus_device/__init__.c similarity index 55% rename from shared-bindings/busdevice/__init__.c rename to shared-bindings/adafruit_bus_device/__init__.c index a9a1a83a33e77..e01abcab3f20a 100644 --- a/shared-bindings/busdevice/__init__.c +++ b/shared-bindings/adafruit_bus_device/__init__.c @@ -31,30 +31,30 @@ #include "py/mphal.h" #include "py/objproperty.h" -#include "shared-bindings/busdevice/__init__.h" -#include "shared-bindings/busdevice/I2CDevice.h" -#include "shared-bindings/busdevice/SPIDevice.h" +#include "shared-bindings/adafruit_bus_device/__init__.h" +#include "shared-bindings/adafruit_bus_device/I2CDevice.h" +#include "shared-bindings/adafruit_bus_device/SPIDevice.h" -STATIC const mp_rom_map_elem_t busdevice_i2c_device_globals_table[] = { +STATIC const mp_rom_map_elem_t adafruit_bus_device_i2c_device_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_i2c_device) }, - { MP_ROM_QSTR(MP_QSTR_I2CDevice), MP_ROM_PTR(&busdevice_i2cdevice_type) }, + { MP_ROM_QSTR(MP_QSTR_I2CDevice), MP_ROM_PTR(&adafruit_bus_device_i2cdevice_type) }, }; -STATIC MP_DEFINE_CONST_DICT(busdevice_i2c_device_globals, busdevice_i2c_device_globals_table); +STATIC MP_DEFINE_CONST_DICT(adafruit_bus_device_i2c_device_globals, adafruit_bus_device_i2c_device_globals_table); -const mp_obj_module_t busdevice_i2c_device_module = { +const mp_obj_module_t adafruit_bus_device_i2c_device_module = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t*)&busdevice_i2c_device_globals, + .globals = (mp_obj_dict_t*)&adafruit_bus_device_i2c_device_globals, }; -STATIC const mp_rom_map_elem_t busdevice_spi_device_globals_table[] = { +STATIC const mp_rom_map_elem_t adafruit_bus_device_spi_device_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_spi_device) }, - { MP_ROM_QSTR(MP_QSTR_SPIDevice), MP_ROM_PTR(&busdevice_spidevice_type) }, + { MP_ROM_QSTR(MP_QSTR_SPIDevice), MP_ROM_PTR(&adafruit_bus_device_spidevice_type) }, }; -STATIC MP_DEFINE_CONST_DICT(busdevice_spi_device_globals, busdevice_spi_device_globals_table); +STATIC MP_DEFINE_CONST_DICT(adafruit_bus_device_spi_device_globals, adafruit_bus_device_spi_device_globals_table); -const mp_obj_module_t busdevice_spi_device_module = { +const mp_obj_module_t adafruit_bus_device_spi_device_module = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t*)&busdevice_spi_device_globals, + .globals = (mp_obj_dict_t*)&adafruit_bus_device_spi_device_globals, }; //| """Hardware accelerated external bus access @@ -64,15 +64,15 @@ const mp_obj_module_t busdevice_spi_device_module = { //| devices, it manages the chip select and protocol changes such as mode. For I2C, it //| manages the device address.""" //| -STATIC const mp_rom_map_elem_t busdevice_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_busdevice) }, - { MP_ROM_QSTR(MP_QSTR_i2c_device), MP_ROM_PTR(&busdevice_i2c_device_module) }, - { MP_ROM_QSTR(MP_QSTR_spi_device), MP_ROM_PTR(&busdevice_spi_device_module) }, +STATIC const mp_rom_map_elem_t adafruit_bus_device_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_adafruit_bus_device) }, + { MP_ROM_QSTR(MP_QSTR_i2c_device), MP_ROM_PTR(&adafruit_bus_device_i2c_device_module) }, + { MP_ROM_QSTR(MP_QSTR_spi_device), MP_ROM_PTR(&adafruit_bus_device_spi_device_module) }, }; -STATIC MP_DEFINE_CONST_DICT(busdevice_module_globals, busdevice_module_globals_table); +STATIC MP_DEFINE_CONST_DICT(adafruit_bus_device_module_globals, adafruit_bus_device_module_globals_table); -const mp_obj_module_t busdevice_module = { +const mp_obj_module_t adafruit_bus_device_module = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t*)&busdevice_module_globals, + .globals = (mp_obj_dict_t*)&adafruit_bus_device_module_globals, }; diff --git a/shared-bindings/busdevice/__init__.h b/shared-bindings/adafruit_bus_device/__init__.h similarity index 100% rename from shared-bindings/busdevice/__init__.h rename to shared-bindings/adafruit_bus_device/__init__.h diff --git a/shared-module/busdevice/I2CDevice.c b/shared-module/adafruit_bus_device/I2CDevice.c similarity index 66% rename from shared-module/busdevice/I2CDevice.c rename to shared-module/adafruit_bus_device/I2CDevice.c index b9f8ee25c0902..d790ff53a4c0d 100644 --- a/shared-module/busdevice/I2CDevice.c +++ b/shared-module/adafruit_bus_device/I2CDevice.c @@ -24,18 +24,18 @@ * THE SOFTWARE. */ -#include "shared-bindings/busdevice/I2CDevice.h" +#include "shared-bindings/adafruit_bus_device/I2CDevice.h" #include "shared-bindings/busio/I2C.h" #include "py/mperrno.h" #include "py/nlr.h" #include "py/runtime.h" -void common_hal_busdevice_i2cdevice_construct(busdevice_i2cdevice_obj_t *self, busio_i2c_obj_t *i2c, uint8_t device_address) { +void common_hal_adafruit_bus_device_i2cdevice_construct(adafruit_bus_device_i2cdevice_obj_t *self, busio_i2c_obj_t *i2c, uint8_t device_address) { self->i2c = i2c; self->device_address = device_address; } -void common_hal_busdevice_i2cdevice_lock(busdevice_i2cdevice_obj_t *self) { +void common_hal_adafruit_bus_device_i2cdevice_lock(adafruit_bus_device_i2cdevice_obj_t *self) { bool success = false; while (!success) { success = common_hal_busio_i2c_try_lock(self->i2c); @@ -44,31 +44,31 @@ void common_hal_busdevice_i2cdevice_lock(busdevice_i2cdevice_obj_t *self) { } } -void common_hal_busdevice_i2cdevice_unlock(busdevice_i2cdevice_obj_t *self) { +void common_hal_adafruit_bus_device_i2cdevice_unlock(adafruit_bus_device_i2cdevice_obj_t *self) { common_hal_busio_i2c_unlock(self->i2c); } -uint8_t common_hal_busdevice_i2cdevice_readinto(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length) { +uint8_t common_hal_adafruit_bus_device_i2cdevice_readinto(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length) { return common_hal_busio_i2c_read(self->i2c, self->device_address, buffer, length); } -uint8_t common_hal_busdevice_i2cdevice_write(busdevice_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length) { +uint8_t common_hal_adafruit_bus_device_i2cdevice_write(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length) { return common_hal_busio_i2c_write(self->i2c, self->device_address, buffer, length, true); } -void common_hal_busdevice_i2cdevice_probe_for_device(busdevice_i2cdevice_obj_t *self) { - common_hal_busdevice_i2cdevice_lock(self); +void common_hal_adafruit_bus_device_i2cdevice_probe_for_device(adafruit_bus_device_i2cdevice_obj_t *self) { + common_hal_adafruit_bus_device_i2cdevice_lock(self); mp_buffer_info_t bufinfo; mp_obj_t buffer = mp_obj_new_bytearray_of_zeros(1); mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_WRITE); - uint8_t status = common_hal_busdevice_i2cdevice_readinto(self, (uint8_t*)bufinfo.buf, 1); + uint8_t status = common_hal_adafruit_bus_device_i2cdevice_readinto(self, (uint8_t*)bufinfo.buf, 1); if (status != 0) { - common_hal_busdevice_i2cdevice_unlock(self); + common_hal_adafruit_bus_device_i2cdevice_unlock(self); mp_raise_ValueError_varg(translate("No I2C device at address: %x"), self->device_address); } - common_hal_busdevice_i2cdevice_unlock(self); + common_hal_adafruit_bus_device_i2cdevice_unlock(self); } diff --git a/shared-module/busdevice/I2CDevice.h b/shared-module/adafruit_bus_device/I2CDevice.h similarity index 97% rename from shared-module/busdevice/I2CDevice.h rename to shared-module/adafruit_bus_device/I2CDevice.h index 918dc7719dd26..d06adb9f5067f 100644 --- a/shared-module/busdevice/I2CDevice.h +++ b/shared-module/adafruit_bus_device/I2CDevice.h @@ -34,6 +34,6 @@ typedef struct { mp_obj_base_t base; busio_i2c_obj_t *i2c; uint8_t device_address; -} busdevice_i2cdevice_obj_t; +} adafruit_bus_device_i2cdevice_obj_t; #endif // MICROPY_INCLUDED_ATMEL_SAMD_SHARED_MODULE_BUSDEVICE_I2CDEVICE_H diff --git a/shared-module/busdevice/SPIDevice.c b/shared-module/adafruit_bus_device/SPIDevice.c similarity index 87% rename from shared-module/busdevice/SPIDevice.c rename to shared-module/adafruit_bus_device/SPIDevice.c index d9b63a007eae9..e489fc7c0791d 100644 --- a/shared-module/busdevice/SPIDevice.c +++ b/shared-module/adafruit_bus_device/SPIDevice.c @@ -24,14 +24,14 @@ * THE SOFTWARE. */ -#include "shared-bindings/busdevice/SPIDevice.h" +#include "shared-bindings/adafruit_bus_device/SPIDevice.h" #include "shared-bindings/busio/SPI.h" #include "shared-bindings/digitalio/DigitalInOut.h" #include "py/mperrno.h" #include "py/nlr.h" #include "py/runtime.h" -void common_hal_busdevice_spidevice_construct(busdevice_spidevice_obj_t *self, busio_spi_obj_t *spi, digitalio_digitalinout_obj_t *cs, +void common_hal_adafruit_bus_device_spidevice_construct(adafruit_bus_device_spidevice_obj_t *self, busio_spi_obj_t *spi, digitalio_digitalinout_obj_t *cs, uint32_t baudrate, uint8_t polarity, uint8_t phase, uint8_t extra_clocks) { self->spi = spi; self->baudrate = baudrate; @@ -41,7 +41,7 @@ void common_hal_busdevice_spidevice_construct(busdevice_spidevice_obj_t *self, b self->chip_select = cs; } -void common_hal_busdevice_spidevice_enter(busdevice_spidevice_obj_t *self) { +void common_hal_adafruit_bus_device_spidevice_enter(adafruit_bus_device_spidevice_obj_t *self) { bool success = false; while (!success) { success = common_hal_busio_spi_try_lock(self->spi); @@ -56,7 +56,7 @@ void common_hal_busdevice_spidevice_enter(busdevice_spidevice_obj_t *self) { } } -void common_hal_busdevice_spidevice_exit(busdevice_spidevice_obj_t *self) { +void common_hal_adafruit_bus_device_spidevice_exit(adafruit_bus_device_spidevice_obj_t *self) { if (self->chip_select != MP_OBJ_NULL) { common_hal_digitalio_digitalinout_set_value(MP_OBJ_TO_PTR(self->chip_select), true); } diff --git a/shared-module/busdevice/SPIDevice.h b/shared-module/adafruit_bus_device/SPIDevice.h similarity index 97% rename from shared-module/busdevice/SPIDevice.h rename to shared-module/adafruit_bus_device/SPIDevice.h index ffabf79dff413..1a7c70fa7329d 100644 --- a/shared-module/busdevice/SPIDevice.h +++ b/shared-module/adafruit_bus_device/SPIDevice.h @@ -39,6 +39,6 @@ typedef struct { uint8_t phase; uint8_t extra_clocks; digitalio_digitalinout_obj_t *chip_select; -} busdevice_spidevice_obj_t; +} adafruit_bus_device_spidevice_obj_t; #endif // MICROPY_INCLUDED_ATMEL_SAMD_SHARED_MODULE_BUSDEVICE_SPIDEVICE_H diff --git a/shared-module/busdevice/__init__.c b/shared-module/adafruit_bus_device/__init__.c similarity index 100% rename from shared-module/busdevice/__init__.c rename to shared-module/adafruit_bus_device/__init__.c From fe6bfde590fc325c984c679825024241afd23a5f Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 4 Nov 2020 21:20:24 +0530 Subject: [PATCH 125/770] move pcnt handler --- locale/circuitpython.pot | 10 +++++----- ports/esp32s2/Makefile | 2 +- ports/esp32s2/{ => peripherals}/pcnt_handler.c | 2 +- ports/esp32s2/{ => peripherals}/pcnt_handler.h | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) rename ports/esp32s2/{ => peripherals}/pcnt_handler.c (96%) rename ports/esp32s2/{ => peripherals}/pcnt_handler.h (88%) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 1336ab25cd15c..b4445abfbfee4 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-11-01 11:11+0530\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -296,6 +296,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1272,10 +1276,6 @@ msgstr "" msgid "No MOSI Pin" msgstr "" -#: ports/esp32s2/pcnt_handler.c -msgid "No PCNT unit free" -msgstr "" - #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 6dbbf58d4d392..56f0d46a318dc 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -173,7 +173,6 @@ SRC_C += \ background.c \ fatfs_port.c \ mphalport.c \ - pcnt_handler.c \ bindings/espidf/__init__.c \ boards/$(BOARD)/board.c \ boards/$(BOARD)/pins.c \ @@ -189,6 +188,7 @@ SRC_C += \ lib/utils/pyexec.c \ lib/utils/stdout_helpers.c \ lib/utils/sys_stdio_mphal.c \ + peripherals/pcnt_handler.c \ peripherals/pins.c \ peripherals/rmt.c \ supervisor/shared/memory.c diff --git a/ports/esp32s2/pcnt_handler.c b/ports/esp32s2/peripherals/pcnt_handler.c similarity index 96% rename from ports/esp32s2/pcnt_handler.c rename to ports/esp32s2/peripherals/pcnt_handler.c index 56fb0f21c8063..5a0cc9a7c2f9d 100644 --- a/ports/esp32s2/pcnt_handler.c +++ b/ports/esp32s2/peripherals/pcnt_handler.c @@ -42,7 +42,7 @@ void pcnt_handler_init(pcnt_config_t* pcnt_config) { pcnt_state[i] = PCNT_UNIT_ACTIVE; break; } else if (i == 3) { - mp_raise_RuntimeError(translate("No PCNT unit free")); + mp_raise_RuntimeError(translate("All PCNT units in use")); } } diff --git a/ports/esp32s2/pcnt_handler.h b/ports/esp32s2/peripherals/pcnt_handler.h similarity index 88% rename from ports/esp32s2/pcnt_handler.h rename to ports/esp32s2/peripherals/pcnt_handler.h index 4bdaee1b87ad4..f44ee1f830166 100644 --- a/ports/esp32s2/pcnt_handler.h +++ b/ports/esp32s2/peripherals/pcnt_handler.h @@ -24,12 +24,12 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_ESP32S2_PCNT_HANDLER_H -#define MICROPY_INCLUDED_ESP32S2_PCNT_HANDLER_H +#ifndef MICROPY_INCLUDED_ESP32S2_PERIPHERALS_PCNT_HANDLER_H +#define MICROPY_INCLUDED_ESP32S2_PERIPHERALS_PCNT_HANDLER_H #include "driver/pcnt.h" extern void pcnt_handler_init(pcnt_config_t* pcnt_config); extern void pcnt_handler_deinit(pcnt_unit_t* unit); -#endif // MICROPY_INCLUDED_ESP32S2_PCNT_HANDLER_H +#endif // MICROPY_INCLUDED_ESP32S2_PERIPHERALS_PCNT_HANDLER_H From 92cd599ea31482b5462438334ef36ae3cfd9dba8 Mon Sep 17 00:00:00 2001 From: cyz Date: Thu, 5 Nov 2020 09:14:53 +0800 Subject: [PATCH 126/770] Modify the pins of the hiibot_bluefi. --- ports/nrf/boards/hiibot_bluefi/pins.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/nrf/boards/hiibot_bluefi/pins.c b/ports/nrf/boards/hiibot_bluefi/pins.c index 340ea948cfe70..bce4ee52dd4ab 100644 --- a/ports/nrf/boards/hiibot_bluefi/pins.c +++ b/ports/nrf/boards/hiibot_bluefi/pins.c @@ -109,10 +109,10 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_P0_27) }, { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_P0_27) }, - { MP_ROM_QSTR(MP_QSTR_P27), MP_ROM_PTR(&pin_P1_14) }, - { MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_P1_14) }, - { MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_P1_14) }, - { MP_ROM_QSTR(MP_QSTR_TFT_BACKLIGHT), MP_ROM_PTR(&pin_P1_14) }, + { MP_ROM_QSTR(MP_QSTR_P27), MP_ROM_PTR(&pin_P1_13) }, + { MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_P1_13) }, + //{ MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_P1_13) }, + { MP_ROM_QSTR(MP_QSTR_TFT_BACKLIGHT), MP_ROM_PTR(&pin_P1_13) }, // P28~P33/D28~D33 connecte into QSPI FlashROM (W25Q16JV_IQ) From d8ef9a127b4914f7d9b50131c15e653aef94cb8f Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 5 Nov 2020 10:10:39 +0530 Subject: [PATCH 127/770] rename pcnt_handler to pcnt --- ports/esp32s2/Makefile | 2 +- ports/esp32s2/common-hal/countio/Counter.c | 5 +++-- ports/esp32s2/common-hal/countio/Counter.h | 2 +- ports/esp32s2/peripherals/{pcnt_handler.c => pcnt.c} | 6 +++--- ports/esp32s2/peripherals/{pcnt_handler.h => pcnt.h} | 4 ++-- 5 files changed, 10 insertions(+), 9 deletions(-) rename ports/esp32s2/peripherals/{pcnt_handler.c => pcnt.c} (94%) rename ports/esp32s2/peripherals/{pcnt_handler.h => pcnt.h} (92%) diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 56f0d46a318dc..55d6e91d44cb7 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -188,7 +188,7 @@ SRC_C += \ lib/utils/pyexec.c \ lib/utils/stdout_helpers.c \ lib/utils/sys_stdio_mphal.c \ - peripherals/pcnt_handler.c \ + peripherals/pcnt.c \ peripherals/pins.c \ peripherals/rmt.c \ supervisor/shared/memory.c diff --git a/ports/esp32s2/common-hal/countio/Counter.c b/ports/esp32s2/common-hal/countio/Counter.c index 4357624733815..81f9f7ad2a692 100644 --- a/ports/esp32s2/common-hal/countio/Counter.c +++ b/ports/esp32s2/common-hal/countio/Counter.c @@ -42,7 +42,8 @@ void common_hal_countio_counter_construct(countio_counter_obj_t* self, .neg_mode = PCNT_COUNT_DIS, // Keep the counter value on the negative edge }; // Initialize PCNT unit - pcnt_handler_init(&pcnt_config); + // This also sets pcnt_config.unit + peripherals_pcnt_init(&pcnt_config); self->pin = pin->number; self->unit = pcnt_config.unit; @@ -57,7 +58,7 @@ void common_hal_countio_counter_deinit(countio_counter_obj_t* self) { return; } reset_pin_number(self->pin); - pcnt_handler_deinit(&self->unit); + peripherals_pcnt_deinit(&self->unit); } mp_int_t common_hal_countio_counter_get_count(countio_counter_obj_t* self) { diff --git a/ports/esp32s2/common-hal/countio/Counter.h b/ports/esp32s2/common-hal/countio/Counter.h index 63d1eb98b25a8..20fe5b83e60b4 100644 --- a/ports/esp32s2/common-hal/countio/Counter.h +++ b/ports/esp32s2/common-hal/countio/Counter.h @@ -28,7 +28,7 @@ #define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_COUNTIO_COUNTER_H #include "py/obj.h" -#include "pcnt_handler.h" +#include "peripherals/pcnt.h" typedef struct { mp_obj_base_t base; diff --git a/ports/esp32s2/peripherals/pcnt_handler.c b/ports/esp32s2/peripherals/pcnt.c similarity index 94% rename from ports/esp32s2/peripherals/pcnt_handler.c rename to ports/esp32s2/peripherals/pcnt.c index 5a0cc9a7c2f9d..e7eb32c1d194a 100644 --- a/ports/esp32s2/peripherals/pcnt_handler.c +++ b/ports/esp32s2/peripherals/pcnt.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "pcnt_handler.h" +#include "peripherals/pcnt.h" #include "py/runtime.h" #include "supervisor/shared/translate.h" @@ -34,7 +34,7 @@ static uint8_t pcnt_state[4]; -void pcnt_handler_init(pcnt_config_t* pcnt_config) { +void peripherals_pcnt_init(pcnt_config_t* pcnt_config) { // Look for available pcnt unit for (uint8_t i = 0; i<=3; i++) { if (pcnt_state[i] == PCNT_UNIT_INACTIVE) { @@ -61,7 +61,7 @@ void pcnt_handler_init(pcnt_config_t* pcnt_config) { pcnt_counter_resume(pcnt_config->unit); } -void pcnt_handler_deinit(pcnt_unit_t* unit) { +void peripherals_pcnt_deinit(pcnt_unit_t* unit) { pcnt_state[*unit] = PCNT_UNIT_INACTIVE; *unit = PCNT_UNIT_MAX; } diff --git a/ports/esp32s2/peripherals/pcnt_handler.h b/ports/esp32s2/peripherals/pcnt.h similarity index 92% rename from ports/esp32s2/peripherals/pcnt_handler.h rename to ports/esp32s2/peripherals/pcnt.h index f44ee1f830166..64072501cb3ea 100644 --- a/ports/esp32s2/peripherals/pcnt_handler.h +++ b/ports/esp32s2/peripherals/pcnt.h @@ -29,7 +29,7 @@ #include "driver/pcnt.h" -extern void pcnt_handler_init(pcnt_config_t* pcnt_config); -extern void pcnt_handler_deinit(pcnt_unit_t* unit); +extern void peripherals_pcnt_init(pcnt_config_t* pcnt_config); +extern void peripherals_pcnt_deinit(pcnt_unit_t* unit); #endif // MICROPY_INCLUDED_ESP32S2_PERIPHERALS_PCNT_HANDLER_H From c2aa54ae661612e68768e10b76fd942af036ecda Mon Sep 17 00:00:00 2001 From: root Date: Thu, 5 Nov 2020 11:10:40 -0600 Subject: [PATCH 128/770] Check for Ctrl-C during sleeps --- ports/esp32s2/supervisor/port.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 0b9c03f74724d..2aa01cb1520fa 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -203,7 +203,16 @@ void port_sleep_until_interrupt(void) { if (sleep_time_duration == 0) { return; } - vTaskDelayUntil(&sleep_time_set, sleep_time_duration); + // Need to run in a loop in order to check if CTRL-C was received + TickType_t start_ticks = 0; + while (sleep_time_duration > start_ticks ) { + vTaskDelayUntil(&sleep_time_set, 1); + if ( mp_hal_is_interrupted() ) { + mp_handle_pending(); + } + start_ticks = start_ticks + 1; + } + } From ac8a0faa0d64fd07af65a798c7e1fc5ce4e39df2 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Fri, 6 Nov 2020 01:42:20 +0530 Subject: [PATCH 129/770] update peripherals_pcnt_init() --- ports/esp32s2/common-hal/countio/Counter.c | 14 +++++++++---- ports/esp32s2/peripherals/pcnt.c | 23 +++++++++++----------- ports/esp32s2/peripherals/pcnt.h | 2 +- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/ports/esp32s2/common-hal/countio/Counter.c b/ports/esp32s2/common-hal/countio/Counter.c index 81f9f7ad2a692..fe52d93add4d4 100644 --- a/ports/esp32s2/common-hal/countio/Counter.c +++ b/ports/esp32s2/common-hal/countio/Counter.c @@ -27,12 +27,15 @@ #include "common-hal/countio/Counter.h" #include "common-hal/microcontroller/Pin.h" +#include "py/runtime.h" +#include "supervisor/shared/translate.h" + void common_hal_countio_counter_construct(countio_counter_obj_t* self, const mcu_pin_obj_t* pin) { claim_pin(pin); // Prepare configuration for the PCNT unit - pcnt_config_t pcnt_config = { + const pcnt_config_t pcnt_config = { // Set PCNT input signal and control GPIOs .pulse_gpio_num = pin->number, .ctrl_gpio_num = PCNT_PIN_NOT_USED, @@ -41,12 +44,15 @@ void common_hal_countio_counter_construct(countio_counter_obj_t* self, .pos_mode = PCNT_COUNT_INC, // Count up on the positive edge .neg_mode = PCNT_COUNT_DIS, // Keep the counter value on the negative edge }; + // Initialize PCNT unit - // This also sets pcnt_config.unit - peripherals_pcnt_init(&pcnt_config); + const int8_t unit = peripherals_pcnt_init(pcnt_config); + if (unit == -1) { + mp_raise_RuntimeError(translate("All PCNT units in use")); + } self->pin = pin->number; - self->unit = pcnt_config.unit; + self->unit = (pcnt_unit_t)unit; } bool common_hal_countio_counter_deinited(countio_counter_obj_t* self) { diff --git a/ports/esp32s2/peripherals/pcnt.c b/ports/esp32s2/peripherals/pcnt.c index e7eb32c1d194a..555a0ec1d3601 100644 --- a/ports/esp32s2/peripherals/pcnt.c +++ b/ports/esp32s2/peripherals/pcnt.c @@ -26,39 +26,38 @@ #include "peripherals/pcnt.h" -#include "py/runtime.h" -#include "supervisor/shared/translate.h" - #define PCNT_UNIT_ACTIVE 1 #define PCNT_UNIT_INACTIVE 0 static uint8_t pcnt_state[4]; -void peripherals_pcnt_init(pcnt_config_t* pcnt_config) { +int peripherals_pcnt_init(pcnt_config_t pcnt_config) { // Look for available pcnt unit for (uint8_t i = 0; i<=3; i++) { if (pcnt_state[i] == PCNT_UNIT_INACTIVE) { - pcnt_config->unit = (pcnt_unit_t)i; + pcnt_config.unit = (pcnt_unit_t)i; pcnt_state[i] = PCNT_UNIT_ACTIVE; break; } else if (i == 3) { - mp_raise_RuntimeError(translate("All PCNT units in use")); + return -1; } } // Initialize PCNT unit - pcnt_unit_config(pcnt_config); + pcnt_unit_config(&pcnt_config); // Configure and enable the input filter - pcnt_set_filter_value(pcnt_config->unit, 100); - pcnt_filter_enable(pcnt_config->unit); + pcnt_set_filter_value(pcnt_config.unit, 100); + pcnt_filter_enable(pcnt_config.unit); // Initialize PCNT's counter - pcnt_counter_pause(pcnt_config->unit); - pcnt_counter_clear(pcnt_config->unit); + pcnt_counter_pause(pcnt_config.unit); + pcnt_counter_clear(pcnt_config.unit); // Everything is set up, now go to counting - pcnt_counter_resume(pcnt_config->unit); + pcnt_counter_resume(pcnt_config.unit); + + return pcnt_config.unit; } void peripherals_pcnt_deinit(pcnt_unit_t* unit) { diff --git a/ports/esp32s2/peripherals/pcnt.h b/ports/esp32s2/peripherals/pcnt.h index 64072501cb3ea..abed80fd0c415 100644 --- a/ports/esp32s2/peripherals/pcnt.h +++ b/ports/esp32s2/peripherals/pcnt.h @@ -29,7 +29,7 @@ #include "driver/pcnt.h" -extern void peripherals_pcnt_init(pcnt_config_t* pcnt_config); +extern int peripherals_pcnt_init(pcnt_config_t pcnt_config); extern void peripherals_pcnt_deinit(pcnt_unit_t* unit); #endif // MICROPY_INCLUDED_ESP32S2_PERIPHERALS_PCNT_HANDLER_H From da04efbf2ed205d73de4f0082017ed15c3f59896 Mon Sep 17 00:00:00 2001 From: DavePutz Date: Thu, 5 Nov 2020 14:25:45 -0600 Subject: [PATCH 130/770] Fix missing include in port.c --- ports/esp32s2/supervisor/port.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 2aa01cb1520fa..5cd62044057f1 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -30,6 +30,7 @@ #include "supervisor/port.h" #include "boards/board.h" #include "modules/module.h" +#include "py/runtime.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" From 8ce852e6523a51b419a28642732d5ad3813bdb88 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Wed, 4 Nov 2020 20:02:37 +0000 Subject: [PATCH 131/770] Translated using Weblate (Swedish) Currently translated at 100.0% (844 of 844 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 65cd9f6f1f5e3..9182a99430a0e 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-10-21 20:13-0500\n" -"PO-Revision-Date: 2020-11-01 16:26+0000\n" +"PO-Revision-Date: 2020-11-05 20:26+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.3.2-dev\n" +"X-Generator: Weblate 4.3.2\n" #: main.c msgid "" @@ -415,8 +415,8 @@ msgid "" "Auto-reload is on. Simply save files over USB to run them or enter REPL to " "disable.\n" msgstr "" -"Autoladdning är på. Spara bara filer via USB för att köra dem eller ange " -"REPL för att inaktivera.\n" +"Autoladdning är på. Spara filer via USB för att köra dem eller ange REPL för " +"att inaktivera.\n" #: ports/esp32s2/common-hal/canio/CAN.c msgid "Baudrate not supported by peripheral" @@ -2220,7 +2220,7 @@ msgstr "kan bara ha upp till 4 parametrar att Xtensa assembly" #: py/persistentcode.c msgid "can only save bytecode" -msgstr "kan bara spara bytekod" +msgstr "kan bara spara bytecode" #: py/objtype.c msgid "can't add special method to already-subclassed class" From d948e6570f32b08de71b5d088ab445d2de3a7661 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 5 Nov 2020 21:27:21 -0600 Subject: [PATCH 132/770] Changes to handle Ctrl-C during sleep --- ports/esp32s2/supervisor/port.c | 32 ++++++++++++++------------------ ports/esp32s2/supervisor/usb.c | 20 ++++++++++++++++++++ 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 2aa01cb1520fa..46de6362762f5 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -30,6 +30,7 @@ #include "supervisor/port.h" #include "boards/board.h" #include "modules/module.h" +#include "py/runtime.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -54,6 +55,7 @@ uint32_t* heap; uint32_t heap_size; +extern TaskHandle_t xTaskToNotify; STATIC esp_timer_handle_t _tick_timer; @@ -188,34 +190,28 @@ void port_disable_tick(void) { esp_timer_stop(_tick_timer); } -TickType_t sleep_time_set; TickType_t sleep_time_duration; +uint32_t NotifyValue = 0; +BaseType_t notify_wait = 0; + void port_interrupt_after_ticks(uint32_t ticks) { - sleep_time_set = xTaskGetTickCount(); - sleep_time_duration = ticks / portTICK_PERIOD_MS; - // esp_sleep_enable_timer_wakeup(uint64_t time_in_us) + sleep_time_duration = (ticks * 100)/1024; + xTaskToNotify = xTaskGetCurrentTaskHandle(); } void port_sleep_until_interrupt(void) { - // FreeRTOS delay here maybe. - // Light sleep shuts down BLE and wifi. - // esp_light_sleep_start() + if (sleep_time_duration == 0) { return; } - // Need to run in a loop in order to check if CTRL-C was received - TickType_t start_ticks = 0; - while (sleep_time_duration > start_ticks ) { - vTaskDelayUntil(&sleep_time_set, 1); - if ( mp_hal_is_interrupted() ) { - mp_handle_pending(); - } - start_ticks = start_ticks + 1; - } - + notify_wait = xTaskNotifyWait(0x01,0x01,&NotifyValue, + sleep_time_duration ); + if (NotifyValue == 1) { + xTaskToNotify = NULL; + mp_handle_pending(); + } } - // Wrap main in app_main that the IDF expects. extern void main(void); void app_main(void) { diff --git a/ports/esp32s2/supervisor/usb.c b/ports/esp32s2/supervisor/usb.c index 1ad6af04702e7..86186d36b8eb9 100644 --- a/ports/esp32s2/supervisor/usb.c +++ b/ports/esp32s2/supervisor/usb.c @@ -52,6 +52,8 @@ StackType_t usb_device_stack[USBD_STACK_SIZE]; StaticTask_t usb_device_taskdef; +TaskHandle_t xTaskToNotify = NULL; + // USB Device Driver task // This top level thread process all usb events and invoke callbacks void usb_device_task(void* param) @@ -114,3 +116,21 @@ void init_usb_hardware(void) { usb_device_stack, &usb_device_taskdef); } +/** + * Callback invoked when received an "wanted" char. + * @param itf Interface index (for multiple cdc interfaces) + * @param wanted_char The wanted char (set previously) + */ +void tud_cdc_rx_wanted_cb(uint8_t itf, char wanted_char) +{ + (void) itf; // not used + // Workaround for using lib/utils/interrupt_char.c + // Compare mp_interrupt_char with wanted_char and ignore if not matched + if (mp_interrupt_char == wanted_char) { + tud_cdc_read_flush(); // flush read fifo + mp_keyboard_interrupt(); + if (xTaskToNotify != NULL) { + xTaskNotifyGive(xTaskToNotify); + } + } +} From 93193f2f0b843fc8c052edecd362a1cdd7b30d5d Mon Sep 17 00:00:00 2001 From: sporeball Date: Fri, 6 Nov 2020 19:49:49 +0000 Subject: [PATCH 133/770] Translated using Weblate (Japanese) Currently translated at 71.8% (606 of 844 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ja/ --- locale/ja.po | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/locale/ja.po b/locale/ja.po index ae7e51ba6b504..c9a85c1a23d56 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -8,15 +8,15 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-10-21 20:13-0500\n" -"PO-Revision-Date: 2020-09-25 18:20+0000\n" -"Last-Translator: Taku Fukada \n" +"PO-Revision-Date: 2020-11-06 20:29+0000\n" +"Last-Translator: sporeball \n" "Language-Team: none\n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.3-dev\n" +"X-Generator: Weblate 4.3.2\n" #: main.c msgid "" @@ -162,12 +162,12 @@ msgstr "'%s' にはラベルが必要" #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects a register" -msgstr "" +msgstr "'%s'にはレジスタが必要" #: py/emitinlinethumb.c #, c-format msgid "'%s' expects a special register" -msgstr "" +msgstr "'%s'には特別レジスタが必要" #: py/emitinlinethumb.c #, c-format @@ -192,7 +192,7 @@ msgstr "" #: py/emitinlinethumb.c #, c-format msgid "'%s' expects {r0, r1, ...}" -msgstr "" +msgstr "'%s'には{r0, r1, ...}が必要" #: py/emitinlinextensa.c #, c-format @@ -246,7 +246,7 @@ msgstr "'data'には整数の引数が必要" #: py/compile.c msgid "'label' requires 1 argument" -msgstr "" +msgstr "'label'には1つの引数が必要" #: py/compile.c msgid "'return' outside function" @@ -296,7 +296,7 @@ msgstr "address_typeが範囲外" #: ports/esp32s2/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" -msgstr "" +msgstr "全てのCAN周辺機器が使用中" #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" @@ -821,19 +821,19 @@ msgstr "%qが必要" #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/Descriptor.c shared-bindings/_bleio/PacketBuffer.c msgid "Expected a Characteristic" -msgstr "" +msgstr "Characteristicが必要" #: shared-bindings/_bleio/Adapter.c msgid "Expected a DigitalInOut" -msgstr "" +msgstr "DigitalInOutが必要" #: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" -msgstr "" +msgstr "Serviceが必要" #: shared-bindings/_bleio/Adapter.c msgid "Expected a UART" -msgstr "" +msgstr "UARTが必要" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c #: shared-bindings/_bleio/Service.c @@ -842,7 +842,7 @@ msgstr "UUIDが必要" #: shared-bindings/_bleio/Adapter.c msgid "Expected an Address" -msgstr "" +msgstr "Addressが必要" #: shared-module/_pixelbuf/PixelBuf.c #, c-format @@ -886,7 +886,7 @@ msgstr "%dバイトのRXバッファの確保に失敗" #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Failed to allocate Wifi memory" -msgstr "" +msgstr "Wi-Fiのメモリの確保に失敗" #: ports/esp32s2/common-hal/wifi/ScannedNetworks.c msgid "Failed to allocate wifi scan memory" @@ -1052,7 +1052,7 @@ msgstr "不正なBMPファイル" #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" -msgstr "" +msgstr "不正なBSSID" #: ports/esp32s2/common-hal/analogio/AnalogOut.c #: ports/stm/common-hal/analogio/AnalogOut.c @@ -1103,7 +1103,7 @@ msgstr "フォーマットチャンクのサイズが不正" #: ports/esp32s2/common-hal/pwmio/PWMOut.c msgid "Invalid frequency" -msgstr "" +msgstr "不正な周波数" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Invalid frequency supplied" @@ -1338,11 +1338,11 @@ msgstr "long integerに対応していません" #: ports/esp32s2/common-hal/pwmio/PWMOut.c msgid "No more channels available" -msgstr "" +msgstr "使えるチャネルがもうありません" #: ports/esp32s2/common-hal/pwmio/PWMOut.c msgid "No more timers available" -msgstr "" +msgstr "使えるタイマーがもうありません" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "No more timers available on this pin." @@ -1658,7 +1658,7 @@ msgstr "" #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" -msgstr "" +msgstr "サイズは対応していません" #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." From cb159569c23f71704b1787f8d6cabacedccca958 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Fri, 6 Nov 2020 21:29:26 +0100 Subject: [PATCH 134/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 9 +++++++-- locale/cs.po | 9 +++++++-- locale/de_DE.po | 9 +++++++-- locale/el.po | 9 +++++++-- locale/es.po | 9 +++++++-- locale/fil.po | 9 +++++++-- locale/fr.po | 9 +++++++-- locale/hi.po | 9 +++++++-- locale/it_IT.po | 9 +++++++-- locale/ja.po | 9 +++++++-- locale/ko.po | 9 +++++++-- locale/nl.po | 9 +++++++-- locale/pl.po | 9 +++++++-- locale/pt_BR.po | 9 +++++++-- locale/sv.po | 9 +++++++-- locale/zh_Latn_pinyin.po | 9 +++++++-- 16 files changed, 112 insertions(+), 32 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 7debab27ac810..3e47dc9a18dcc 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-10-10 23:51+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -300,6 +300,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Semua perangkat I2C sedang digunakan" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1130,7 +1134,8 @@ msgid "Invalid phase" msgstr "Fase tidak valid" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "Pin tidak valid" diff --git a/locale/cs.po b/locale/cs.po index e4f677d8e2ffe..428d6d1fe6a2e 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-05-24 03:22+0000\n" "Last-Translator: dronecz \n" "Language-Team: LANGUAGE \n" @@ -300,6 +300,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1113,7 +1117,8 @@ msgid "Invalid phase" msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 141a5e8c036a4..059d726cabe84 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-06-16 18:24+0000\n" "Last-Translator: Andreas Buchen \n" "Language: de_DE\n" @@ -299,6 +299,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Alle I2C-Peripheriegeräte sind in Benutzung" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1130,7 +1134,8 @@ msgid "Invalid phase" msgstr "Ungültige Phase" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "Ungültiger Pin" diff --git a/locale/el.po b/locale/el.po index cc6da670cd4e4..327f4dbe0f322 100644 --- a/locale/el.po +++ b/locale/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -295,6 +295,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1108,7 +1112,8 @@ msgid "Invalid phase" msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "" diff --git a/locale/es.po b/locale/es.po index a750c80554319..95d6a92ff52ac 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-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-11-01 16:26+0000\n" "Last-Translator: Alvaro Figueroa \n" "Language-Team: \n" @@ -303,6 +303,10 @@ msgstr "Todos los periféricos CAN están en uso" msgid "All I2C peripherals are in use" msgstr "Todos los periféricos I2C están siendo usados" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1131,7 +1135,8 @@ msgid "Invalid phase" msgstr "Fase inválida" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "Pin inválido" diff --git a/locale/fil.po b/locale/fil.po index 7bc33dba3ee18..ce3b5616a32fc 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -297,6 +297,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Lahat ng I2C peripherals ginagamit" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1123,7 +1127,8 @@ msgid "Invalid phase" msgstr "Mali ang phase" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "Mali ang pin" diff --git a/locale/fr.po b/locale/fr.po index 920e22cb0cb43..94ca1f21cf4aa 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-10-22 20:48+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" @@ -304,6 +304,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Tous les périphériques I2C sont utilisés" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1136,7 +1140,8 @@ msgid "Invalid phase" msgstr "Phase invalide" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "Broche invalide" diff --git a/locale/hi.po b/locale/hi.po index 4966ad8e801a4..d87a1eb9ceb1b 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -295,6 +295,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1108,7 +1112,8 @@ msgid "Invalid phase" msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 82840c8523132..657c581cefcec 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -296,6 +296,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Tutte le periferiche I2C sono in uso" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1125,7 +1129,8 @@ msgid "Invalid phase" msgstr "Fase non valida" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "Pin non valido" diff --git a/locale/ja.po b/locale/ja.po index c9a85c1a23d56..7004c49f30350 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-11-06 20:29+0000\n" "Last-Translator: sporeball \n" "Language-Team: none\n" @@ -302,6 +302,10 @@ msgstr "全てのCAN周辺機器が使用中" msgid "All I2C peripherals are in use" msgstr "全てのI2C周辺機器が使用中" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1123,7 +1127,8 @@ msgid "Invalid phase" msgstr "不正なphase" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "不正なピン" diff --git a/locale/ko.po b/locale/ko.po index 858a036c835f9..4b302f3b9fb6b 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-10-05 12:12+0000\n" "Last-Translator: Michal Čihař \n" "Language-Team: LANGUAGE \n" @@ -298,6 +298,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "사용중인 모든 I2C주변 기기" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1113,7 +1117,8 @@ msgid "Invalid phase" msgstr "단계가 잘못되었습니다" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "핀이 잘못되었습니다" diff --git a/locale/nl.po b/locale/nl.po index bf05abb721f78..6851e6ef328d7 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-10-27 16:47+0000\n" "Last-Translator: Jelle Jager \n" "Language-Team: none\n" @@ -300,6 +300,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Alle I2C peripherals zijn in gebruik" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1125,7 +1129,8 @@ msgid "Invalid phase" msgstr "Ongeldige fase" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "Ongeldige pin" diff --git a/locale/pl.po b/locale/pl.po index 1dbb0ba12ba6c..54ef4d9185529 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-09-29 01:39+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" @@ -302,6 +302,10 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Wszystkie peryferia I2C w użyciu" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1123,7 +1127,8 @@ msgid "Invalid phase" msgstr "Zła faza" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "Zła nóżka" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 7ad85e0b7840e..ac5c7a66783f8 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-10-28 21:45+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -304,6 +304,10 @@ msgstr "Todos os periféricos CAN estão em uso" msgid "All I2C peripherals are in use" msgstr "Todos os periféricos I2C estão em uso" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1134,7 +1138,8 @@ msgid "Invalid phase" msgstr "Fase Inválida" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "Pino inválido" diff --git a/locale/sv.po b/locale/sv.po index 9182a99430a0e..d9639aff6ef3c 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-11-05 20:26+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -300,6 +300,10 @@ msgstr "All I2C-kringutrustning används" msgid "All I2C peripherals are in use" msgstr "All I2C-kringutrustning används" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1123,7 +1127,8 @@ msgid "Invalid phase" msgstr "Ogiltig fas" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "Ogiltig pinne" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 4cc86400d9b5f..c1853a73a5931 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 20:13-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-10-28 21:45+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -302,6 +302,10 @@ msgstr "suǒ yǒu CAN wài shè dōu zài shǐ yòng zhōng" msgid "All I2C peripherals are in use" msgstr "Suǒyǒu I2C wàiwéi qì zhèngzài shǐyòng" +#: ports/esp32s2/peripherals/pcnt_handler.c +msgid "All PCNT units in use" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1121,7 +1125,8 @@ msgid "Invalid phase" msgstr "Jiēduàn wúxiào" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c +#: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" msgstr "Wúxiào de yǐn jiǎo" From b2e83952c026485866a7b5a830d85850b09abb38 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 6 Nov 2020 15:27:16 -0800 Subject: [PATCH 135/770] Rebrand EInk Portal to MagTag --- .../{adafruit_esp32s2_eink_portal => adafruit_magtag}/board.c | 0 .../mpconfigboard.h | 2 +- .../mpconfigboard.mk | 2 +- .../{adafruit_esp32s2_eink_portal => adafruit_magtag}/pins.c | 0 .../{adafruit_esp32s2_eink_portal => adafruit_magtag}/sdkconfig | 0 5 files changed, 2 insertions(+), 2 deletions(-) rename ports/esp32s2/boards/{adafruit_esp32s2_eink_portal => adafruit_magtag}/board.c (100%) rename ports/esp32s2/boards/{adafruit_esp32s2_eink_portal => adafruit_magtag}/mpconfigboard.h (97%) rename ports/esp32s2/boards/{adafruit_esp32s2_eink_portal => adafruit_magtag}/mpconfigboard.mk (92%) rename ports/esp32s2/boards/{adafruit_esp32s2_eink_portal => adafruit_magtag}/pins.c (100%) rename ports/esp32s2/boards/{adafruit_esp32s2_eink_portal => adafruit_magtag}/sdkconfig (100%) diff --git a/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/board.c b/ports/esp32s2/boards/adafruit_magtag/board.c similarity index 100% rename from ports/esp32s2/boards/adafruit_esp32s2_eink_portal/board.c rename to ports/esp32s2/boards/adafruit_magtag/board.c diff --git a/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/mpconfigboard.h b/ports/esp32s2/boards/adafruit_magtag/mpconfigboard.h similarity index 97% rename from ports/esp32s2/boards/adafruit_esp32s2_eink_portal/mpconfigboard.h rename to ports/esp32s2/boards/adafruit_magtag/mpconfigboard.h index 5a17a0cad15ef..be376e5a94b51 100644 --- a/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/mpconfigboard.h +++ b/ports/esp32s2/boards/adafruit_magtag/mpconfigboard.h @@ -26,7 +26,7 @@ //Micropython setup -#define MICROPY_HW_BOARD_NAME "EInk Portal" +#define MICROPY_HW_BOARD_NAME "MagTag" #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO1) diff --git a/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/mpconfigboard.mk b/ports/esp32s2/boards/adafruit_magtag/mpconfigboard.mk similarity index 92% rename from ports/esp32s2/boards/adafruit_esp32s2_eink_portal/mpconfigboard.mk rename to ports/esp32s2/boards/adafruit_magtag/mpconfigboard.mk index 31aff57da454a..0a141cbe3ee2d 100644 --- a/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/mpconfigboard.mk +++ b/ports/esp32s2/boards/adafruit_magtag/mpconfigboard.mk @@ -1,6 +1,6 @@ USB_VID = 0x239A USB_PID = 0x80E6 -USB_PRODUCT = "EInk Portal" +USB_PRODUCT = "MagTag" USB_MANUFACTURER = "Adafruit" INTERNAL_FLASH_FILESYSTEM = 1 diff --git a/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/pins.c b/ports/esp32s2/boards/adafruit_magtag/pins.c similarity index 100% rename from ports/esp32s2/boards/adafruit_esp32s2_eink_portal/pins.c rename to ports/esp32s2/boards/adafruit_magtag/pins.c diff --git a/ports/esp32s2/boards/adafruit_esp32s2_eink_portal/sdkconfig b/ports/esp32s2/boards/adafruit_magtag/sdkconfig similarity index 100% rename from ports/esp32s2/boards/adafruit_esp32s2_eink_portal/sdkconfig rename to ports/esp32s2/boards/adafruit_magtag/sdkconfig From 9ef23e8659d4ee58e3158c63f690108b411015a1 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 6 Nov 2020 15:29:58 -0800 Subject: [PATCH 136/770] Fix build board list --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 404d2ea2e5391..a2e9e92abacb7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -421,7 +421,7 @@ jobs: fail-fast: false matrix: board: - - "adafruit_esp32s2_eink_portal" + - "adafruit_magtag" - "adafruit_metro_esp32s2" - "electroniccats_bastwifi" - "espressif_kaluga_1" From 6a6e998ea5bcfcc5ca4ca8a689720acc365b6927 Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Sat, 7 Nov 2020 19:21:36 -0600 Subject: [PATCH 137/770] Added BastBLE --- ports/nrf/boards/bastble/README.md | 8 ++++ ports/nrf/boards/bastble/board.c | 41 +++++++++++++++++++ ports/nrf/boards/bastble/mpconfigboard.h | 16 ++++++++ ports/nrf/boards/bastble/mpconfigboard.mk | 12 ++++++ ports/nrf/boards/bastble/pins.c | 48 +++++++++++++++++++++++ 5 files changed, 125 insertions(+) create mode 100644 ports/nrf/boards/bastble/README.md create mode 100644 ports/nrf/boards/bastble/board.c create mode 100644 ports/nrf/boards/bastble/mpconfigboard.h create mode 100644 ports/nrf/boards/bastble/mpconfigboard.mk create mode 100644 ports/nrf/boards/bastble/pins.c diff --git a/ports/nrf/boards/bastble/README.md b/ports/nrf/boards/bastble/README.md new file mode 100644 index 0000000000000..c68464106275e --- /dev/null +++ b/ports/nrf/boards/bastble/README.md @@ -0,0 +1,8 @@ +# Electronic Cats BastBLE + +The [BastBLE](https://electroniccats.com/store/bast-ble/) based on Nordic nRF 52840 and containing +a powerful Cortex M4F. This board include a external memory QSPI flash. + + +I2C pins `board.SCL1` and `board.SDA1` are not exposed and are used for onboard peripherals. + diff --git a/ports/nrf/boards/bastble/board.c b/ports/nrf/boards/bastble/board.c new file mode 100644 index 0000000000000..d91a915f19721 --- /dev/null +++ b/ports/nrf/boards/bastble/board.c @@ -0,0 +1,41 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "boards/board.h" +#include "nrf.h" +#include "nrf_rtc.h" + +void board_init(void) { + +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} diff --git a/ports/nrf/boards/bastble/mpconfigboard.h b/ports/nrf/boards/bastble/mpconfigboard.h new file mode 100644 index 0000000000000..67a62e915bd0d --- /dev/null +++ b/ports/nrf/boards/bastble/mpconfigboard.h @@ -0,0 +1,16 @@ +#include "nrfx/hal/nrf_gpio.h" + +#define MICROPY_HW_BOARD_NAME "BastBLE" +#define MICROPY_HW_MCU_NAME "nRF52840" + +#define CIRCUITPY_AUTORELOAD_DELAY_MS 500 + +#define DEFAULT_I2C_BUS_SCL (&pin_P1_10) +#define DEFAULT_I2C_BUS_SDA (&pin_P1_11) + +#define DEFAULT_SPI_BUS_SCK (&pin_P1_00) +#define DEFAULT_SPI_BUS_MOSI (&pin_P1_06) +#define DEFAULT_SPI_BUS_MISO (&pin_P0_15) + +#define DEFAULT_UART_BUS_RX (&pin_P0_09) +#define DEFAULT_UART_BUS_TX (&pin_P0_10) diff --git a/ports/nrf/boards/bastble/mpconfigboard.mk b/ports/nrf/boards/bastble/mpconfigboard.mk new file mode 100644 index 0000000000000..9441b913b7288 --- /dev/null +++ b/ports/nrf/boards/bastble/mpconfigboard.mk @@ -0,0 +1,12 @@ +USB_VID = 0x2341 +USB_PID = 0x805A +USB_PRODUCT = "BastBLE" +USB_MANUFACTURER = "ElectronicCats" + +MCU_CHIP = nrf52840 + +INTERNAL_FLASH_FILESYSTEM = 1 + +QSPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICE_COUNT = 1 +EXTERNAL_FLASH_DEVICES = "GD25Q16C" diff --git a/ports/nrf/boards/bastble/pins.c b/ports/nrf/boards/bastble/pins.c new file mode 100644 index 0000000000000..6e4cc511b03db --- /dev/null +++ b/ports/nrf/boards/bastble/pins.c @@ -0,0 +1,48 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_P1_11) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_P1_10) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_P1_00) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P1_02) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_P1_13) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_P1_06) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_P0_15) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_P1_09) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_P0_26) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_P0_07) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_28) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_P0_03) }, + + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_P0_30) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P1_11) }, + + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P1_10) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P1_06) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_15) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P1_00) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_P0_24) }, + + { MP_ROM_QSTR(MP_QSTR_AREF), MP_ROM_PTR(&pin_P0_31) }, + + // voltage sense battery + { MP_ROM_QSTR(MP_QSTR_VBAT), MP_ROM_PTR(&pin_P0_26) }, + + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_10) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_09) }, + + { 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); From 55e0e2c4ba7dfa1d3e2ba84a4af3b4f132ae1a23 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Sun, 8 Nov 2020 11:12:32 +0530 Subject: [PATCH 138/770] Update rotaryio implementation --- .../common-hal/rotaryio/IncrementalEncoder.c | 79 ++++++------------- .../common-hal/rotaryio/IncrementalEncoder.h | 9 +-- 2 files changed, 29 insertions(+), 59 deletions(-) diff --git a/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c b/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c index bbff363740b53..25529ac723006 100644 --- a/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c +++ b/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2018 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2020 microDev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -25,29 +25,22 @@ */ #include "common-hal/rotaryio/IncrementalEncoder.h" +#include "common-hal/microcontroller/Pin.h" #include "py/runtime.h" #include "supervisor/shared/translate.h" -#include "driver/pcnt.h" - -static void pcnt_reset(int unit) { - // Initialize PCNT's counter - pcnt_counter_pause(unit); - pcnt_counter_clear(unit); - - // Everything is set up, now go to counting - pcnt_counter_resume(unit); -} +void common_hal_rotaryio_incrementalencoder_construct(rotaryio_incrementalencoder_obj_t* self, + const mcu_pin_obj_t* pin_a, const mcu_pin_obj_t* pin_b) { + claim_pin(pin_a); + claim_pin(pin_b); -static void pcnt_init(int unit, rotaryio_incrementalencoder_obj_t* self) { // Prepare configuration for the PCNT unit - pcnt_config_t pcnt_config = { + const pcnt_config_t pcnt_config = { // Set PCNT input signal and control GPIOs - .pulse_gpio_num = self->pin_a->number, - .ctrl_gpio_num = self->pin_b->number, + .pulse_gpio_num = pin_a->number, + .ctrl_gpio_num = pin_b->number, .channel = PCNT_CHANNEL_0, - .unit = unit, // What to do on the positive / negative edge of pulse input? .pos_mode = PCNT_COUNT_DEC, // Count up on the positive edge .neg_mode = PCNT_COUNT_INC, // Keep the counter value on the negative edge @@ -55,61 +48,39 @@ static void pcnt_init(int unit, rotaryio_incrementalencoder_obj_t* self) { .lctrl_mode = PCNT_MODE_REVERSE, // Reverse counting direction if low .hctrl_mode = PCNT_MODE_KEEP, // Keep the primary counter mode if high }; - // Initialize PCNT unit - pcnt_unit_config(&pcnt_config); - - // Configure channel 1 - pcnt_config.pulse_gpio_num = self->pin_b->number; - pcnt_config.ctrl_gpio_num = self->pin_a->number; - pcnt_config.channel = PCNT_CHANNEL_1; - pcnt_config.pos_mode = PCNT_COUNT_INC; - pcnt_config.neg_mode = PCNT_COUNT_DEC; - pcnt_unit_config(&pcnt_config); - - // Configure and enable the input filter - pcnt_set_filter_value(unit, 100); - pcnt_filter_enable(unit); - - pcnt_reset(unit); -} - -void common_hal_rotaryio_incrementalencoder_construct(rotaryio_incrementalencoder_obj_t* self, - const mcu_pin_obj_t* pin_a, const mcu_pin_obj_t* pin_b) { - claim_pin(pin_a); - claim_pin(pin_b); - - self->pin_a = pin_a; - self->pin_b = pin_b; - self->position = 0; + // Initialize PCNT unit + const int8_t unit = peripherals_pcnt_init(pcnt_config); + if (unit == -1) { + mp_raise_RuntimeError(translate("All PCNT units in use")); + } - pcnt_init(PCNT_UNIT_0, self); + self->pin_a = pin_a->number; + self->pin_b = pin_b->number; + self->unit = (pcnt_unit_t)unit; } bool common_hal_rotaryio_incrementalencoder_deinited(rotaryio_incrementalencoder_obj_t* self) { - return self->pin_a == NULL; + return self->unit == PCNT_UNIT_MAX; } void common_hal_rotaryio_incrementalencoder_deinit(rotaryio_incrementalencoder_obj_t* self) { if (common_hal_rotaryio_incrementalencoder_deinited(self)) { return; } - - reset_pin_number(self->pin_a->number); - self->pin_a = NULL; - - reset_pin_number(self->pin_b->number); - self->pin_b = NULL; + reset_pin_number(self->pin_a); + reset_pin_number(self->pin_b); + peripherals_pcnt_deinit(&self->unit); } mp_int_t common_hal_rotaryio_incrementalencoder_get_position(rotaryio_incrementalencoder_obj_t* self) { - int16_t count = 0; - pcnt_get_counter_value(PCNT_UNIT_0, &count); - return self->position+count; + int16_t count; + pcnt_get_counter_value(self->unit, &count); + return (count/2)+self->position; } void common_hal_rotaryio_incrementalencoder_set_position(rotaryio_incrementalencoder_obj_t* self, mp_int_t new_position) { self->position = new_position; - pcnt_reset(PCNT_UNIT_0); + pcnt_counter_clear(self->unit); } diff --git a/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.h b/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.h index 0cc2830fb7992..8a717b7b5d754 100644 --- a/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.h +++ b/ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2018 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2020 microDev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -27,15 +27,14 @@ #ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ROTARYIO_INCREMENTALENCODER_H #define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ROTARYIO_INCREMENTALENCODER_H -#include "common-hal/microcontroller/Pin.h" - #include "py/obj.h" +#include "peripherals/pcnt.h" typedef struct { mp_obj_base_t base; - const mcu_pin_obj_t * pin_a; - const mcu_pin_obj_t * pin_b; + uint8_t pin_a, pin_b; mp_int_t position; + pcnt_unit_t unit; } rotaryio_incrementalencoder_obj_t; #endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ROTARYIO_INCREMENTALENCODER_H From 7ba2c5772ccbe48c5c52d62493f9c899a1d0963a Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Sun, 8 Nov 2020 11:18:05 +0530 Subject: [PATCH 139/770] Update license --- ports/esp32s2/common-hal/touchio/TouchIn.c | 2 +- ports/esp32s2/common-hal/touchio/TouchIn.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/touchio/TouchIn.c b/ports/esp32s2/common-hal/touchio/TouchIn.c index 3e3e4b55116e3..b44234775e2b5 100644 --- a/ports/esp32s2/common-hal/touchio/TouchIn.c +++ b/ports/esp32s2/common-hal/touchio/TouchIn.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2020 microDev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/esp32s2/common-hal/touchio/TouchIn.h b/ports/esp32s2/common-hal/touchio/TouchIn.h index 585bb37bf1df5..91de209316f34 100644 --- a/ports/esp32s2/common-hal/touchio/TouchIn.h +++ b/ports/esp32s2/common-hal/touchio/TouchIn.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Scott Shawcroft + * Copyright (c) 2020 microDev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal From 5505a3649fe56738321e2138aa918d05d63da6b4 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Sat, 7 Nov 2020 10:04:39 +0000 Subject: [PATCH 140/770] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (845 of 845 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index ac5c7a66783f8..99f090dbd2e2d 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-04 21:18+0530\n" -"PO-Revision-Date: 2020-10-28 21:45+0000\n" +"PO-Revision-Date: 2020-11-08 10:26+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.3.2-dev\n" +"X-Generator: Weblate 4.3.2\n" #: main.c msgid "" @@ -306,7 +306,7 @@ msgstr "Todos os periféricos I2C estão em uso" #: ports/esp32s2/peripherals/pcnt_handler.c msgid "All PCNT units in use" -msgstr "" +msgstr "Todas as unidades PCNT estão em uso" #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c From 9adb77a2d0179f89c7402451f6b25be74629ffbd Mon Sep 17 00:00:00 2001 From: foamyguy Date: Sun, 8 Nov 2020 19:28:46 -0600 Subject: [PATCH 141/770] set moved true when unhiding tilegrid --- shared-module/displayio/TileGrid.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/shared-module/displayio/TileGrid.c b/shared-module/displayio/TileGrid.c index e3642107f8ba1..e8050a5397b8b 100644 --- a/shared-module/displayio/TileGrid.c +++ b/shared-module/displayio/TileGrid.c @@ -83,10 +83,16 @@ bool common_hal_displayio_tilegrid_get_hidden(displayio_tilegrid_t* self) { void common_hal_displayio_tilegrid_set_hidden(displayio_tilegrid_t* self, bool hidden) { self->hidden = hidden; + if(!hidden){ + self->moved = true; + } } void displayio_tilegrid_set_hidden_by_parent(displayio_tilegrid_t *self, bool hidden) { self->hidden_by_parent = hidden; + if(!hidden){ + self->moved = true; + } } bool displayio_tilegrid_get_previous_area(displayio_tilegrid_t *self, displayio_area_t* area) { From 0ff20cdd85d742c2668b044474b2ddc29546fc9c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 9 Nov 2020 08:27:20 -0600 Subject: [PATCH 142/770] RGBMatrix: Detect invalid bit_depth selection Closes: #3650 --- shared-bindings/rgbmatrix/RGBMatrix.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index 753c1c9203262..5f5ea4fae7943 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -197,6 +197,11 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n uint8_t clock_pin = validate_pin(args[ARG_clock_pin].u_obj); uint8_t latch_pin = validate_pin(args[ARG_latch_pin].u_obj); uint8_t output_enable_pin = validate_pin(args[ARG_output_enable_pin].u_obj); + int bit_depth = args[ARG_bit_depth].u_int; + + if (bit_depth <= 0 || bit_depth > 6) { + mp_raise_ValueError_varg(translate("Bit depth must be from 1 to 6 inclusive, not %d"), bit_depth); + } validate_pins(MP_QSTR_rgb_pins, rgb_pins, MP_ARRAY_SIZE(self->rgb_pins), args[ARG_rgb_list].u_obj, &rgb_count); validate_pins(MP_QSTR_addr_pins, addr_pins, MP_ARRAY_SIZE(self->addr_pins), args[ARG_addr_list].u_obj, &addr_count); @@ -229,7 +234,7 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n common_hal_rgbmatrix_rgbmatrix_construct(self, args[ARG_width].u_int, - args[ARG_bit_depth].u_int, + bit_depth, rgb_count, rgb_pins, addr_count, addr_pins, clock_pin, latch_pin, output_enable_pin, From 5554c27600291786c5f09b1671ef5e29eae22619 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 9 Nov 2020 09:49:43 -0600 Subject: [PATCH 143/770] make translate --- locale/circuitpython.pot | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index a5581e7fa7b29..3fb2f0719b386 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-10-15 16:06+0530\n" +"POT-Creation-Date: 2020-11-09 09:49-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -416,6 +416,11 @@ msgstr "" msgid "Bit clock and word select must share a clock unit" msgstr "" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "" @@ -2863,14 +2868,6 @@ msgstr "" msgid "maximum recursion depth exceeded" msgstr "" -#: extmod/ulab/code/approx/approx.c -msgid "maxiter must be > 0" -msgstr "" - -#: extmod/ulab/code/approx/approx.c -msgid "maxiter should be > 0" -msgstr "" - #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3303,10 +3300,6 @@ msgstr "" msgid "sort argument must be an ndarray" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "sorted axis can't be longer than 65535" -msgstr "" - #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" From 78dffd8ef8d88eb88e3186f68eeb988f649a7971 Mon Sep 17 00:00:00 2001 From: Ricardo Date: Mon, 9 Nov 2020 14:17:25 -0600 Subject: [PATCH 144/770] add board on build.yml --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 404d2ea2e5391..8f098cb92e43a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -182,6 +182,7 @@ jobs: - "arduino_nano_33_iot" - "arduino_zero" - "bast_pro_mini_m0" + - "bastBLE" - "bdmicro_vina_d21" - "bdmicro_vina_d51" - "bless_dev_board_multi_sensor" From ee57bc4d8359b6f833c6a34f3cc0dceabdf51cdb Mon Sep 17 00:00:00 2001 From: Ricardo Date: Mon, 9 Nov 2020 14:25:42 -0600 Subject: [PATCH 145/770] fix name --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8f098cb92e43a..f68402be8f7e6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -182,7 +182,7 @@ jobs: - "arduino_nano_33_iot" - "arduino_zero" - "bast_pro_mini_m0" - - "bastBLE" + - "bastble" - "bdmicro_vina_d21" - "bdmicro_vina_d51" - "bless_dev_board_multi_sensor" From d1f15d314bd630b073c70c093053c16ac34131bb Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 9 Nov 2020 15:03:22 -0800 Subject: [PATCH 146/770] Rename to include display details --- .github/workflows/build.yml | 2 +- .../{adafruit_magtag => adafruit_magtag_2.9_grayscale}/board.c | 0 .../mpconfigboard.h | 0 .../mpconfigboard.mk | 0 .../{adafruit_magtag => adafruit_magtag_2.9_grayscale}/pins.c | 0 .../sdkconfig | 0 6 files changed, 1 insertion(+), 1 deletion(-) rename ports/esp32s2/boards/{adafruit_magtag => adafruit_magtag_2.9_grayscale}/board.c (100%) rename ports/esp32s2/boards/{adafruit_magtag => adafruit_magtag_2.9_grayscale}/mpconfigboard.h (100%) rename ports/esp32s2/boards/{adafruit_magtag => adafruit_magtag_2.9_grayscale}/mpconfigboard.mk (100%) rename ports/esp32s2/boards/{adafruit_magtag => adafruit_magtag_2.9_grayscale}/pins.c (100%) rename ports/esp32s2/boards/{adafruit_magtag => adafruit_magtag_2.9_grayscale}/sdkconfig (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a2e9e92abacb7..c83f37e6ed9e3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -421,7 +421,7 @@ jobs: fail-fast: false matrix: board: - - "adafruit_magtag" + - "adafruit_magtag_2.9_grayscale" - "adafruit_metro_esp32s2" - "electroniccats_bastwifi" - "espressif_kaluga_1" diff --git a/ports/esp32s2/boards/adafruit_magtag/board.c b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c similarity index 100% rename from ports/esp32s2/boards/adafruit_magtag/board.c rename to ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c diff --git a/ports/esp32s2/boards/adafruit_magtag/mpconfigboard.h b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h similarity index 100% rename from ports/esp32s2/boards/adafruit_magtag/mpconfigboard.h rename to ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h diff --git a/ports/esp32s2/boards/adafruit_magtag/mpconfigboard.mk b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk similarity index 100% rename from ports/esp32s2/boards/adafruit_magtag/mpconfigboard.mk rename to ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk diff --git a/ports/esp32s2/boards/adafruit_magtag/pins.c b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c similarity index 100% rename from ports/esp32s2/boards/adafruit_magtag/pins.c rename to ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c diff --git a/ports/esp32s2/boards/adafruit_magtag/sdkconfig b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/sdkconfig similarity index 100% rename from ports/esp32s2/boards/adafruit_magtag/sdkconfig rename to ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/sdkconfig From 46c9b28dd880d4e2e2764ab67f64356b175f5f98 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Mon, 9 Nov 2020 18:14:31 -0600 Subject: [PATCH 147/770] use full_change instead of moved --- shared-module/displayio/TileGrid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-module/displayio/TileGrid.c b/shared-module/displayio/TileGrid.c index e8050a5397b8b..19ea10e55299b 100644 --- a/shared-module/displayio/TileGrid.c +++ b/shared-module/displayio/TileGrid.c @@ -84,14 +84,14 @@ bool common_hal_displayio_tilegrid_get_hidden(displayio_tilegrid_t* self) { void common_hal_displayio_tilegrid_set_hidden(displayio_tilegrid_t* self, bool hidden) { self->hidden = hidden; if(!hidden){ - self->moved = true; + self->full_change = true; } } void displayio_tilegrid_set_hidden_by_parent(displayio_tilegrid_t *self, bool hidden) { self->hidden_by_parent = hidden; if(!hidden){ - self->moved = true; + self->full_change = true; } } From 6c59836c5db03744d7dbef01c2323989d13ef02a Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Tue, 10 Nov 2020 16:32:46 +0530 Subject: [PATCH 148/770] watchdog implementation for esp32s2 --- locale/circuitpython.pot | 15 +++- .../common-hal/microcontroller/__init__.c | 11 +++ .../common-hal/watchdog/WatchDogMode.c | 1 + .../common-hal/watchdog/WatchDogTimer.c | 86 +++++++++++++++++++ .../common-hal/watchdog/WatchDogTimer.h | 44 ++++++++++ ports/esp32s2/common-hal/watchdog/__init__.c | 1 + ports/esp32s2/mpconfigport.mk | 1 + 7 files changed, 157 insertions(+), 2 deletions(-) create mode 100644 ports/esp32s2/common-hal/watchdog/WatchDogMode.c create mode 100644 ports/esp32s2/common-hal/watchdog/WatchDogTimer.c create mode 100644 ports/esp32s2/common-hal/watchdog/WatchDogTimer.h create mode 100644 ports/esp32s2/common-hal/watchdog/__init__.c diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index b4445abfbfee4..7a39e9a327405 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-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -296,7 +296,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -992,6 +993,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "" @@ -3201,6 +3206,7 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3416,6 +3422,7 @@ msgstr "" msgid "time.struct_time() takes a 9-sequence" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" @@ -3599,6 +3606,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "" diff --git a/ports/esp32s2/common-hal/microcontroller/__init__.c b/ports/esp32s2/common-hal/microcontroller/__init__.c index 6b2e18673db1d..e5cfc7eef0544 100644 --- a/ports/esp32s2/common-hal/microcontroller/__init__.c +++ b/ports/esp32s2/common-hal/microcontroller/__init__.c @@ -85,6 +85,17 @@ const mcu_processor_obj_t common_hal_mcu_processor_obj = { }, }; +#if CIRCUITPY_WATCHDOG +// The singleton watchdog.WatchDogTimer object. +watchdog_watchdogtimer_obj_t common_hal_mcu_watchdogtimer_obj = { + .base = { + .type = &watchdog_watchdogtimer_type, + }, + .timeout = 0.0f, + .mode = WATCHDOGMODE_NONE, +}; +#endif + // This maps MCU pin names to pin objects. STATIC const mp_rom_map_elem_t mcu_pin_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_GPIO0), MP_ROM_PTR(&pin_GPIO0) }, diff --git a/ports/esp32s2/common-hal/watchdog/WatchDogMode.c b/ports/esp32s2/common-hal/watchdog/WatchDogMode.c new file mode 100644 index 0000000000000..fc4e0e008cd53 --- /dev/null +++ b/ports/esp32s2/common-hal/watchdog/WatchDogMode.c @@ -0,0 +1 @@ +// No watchdog module functions. diff --git a/ports/esp32s2/common-hal/watchdog/WatchDogTimer.c b/ports/esp32s2/common-hal/watchdog/WatchDogTimer.c new file mode 100644 index 0000000000000..59b9dafcf0a1f --- /dev/null +++ b/ports/esp32s2/common-hal/watchdog/WatchDogTimer.c @@ -0,0 +1,86 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * 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 "py/runtime.h" +#include "common-hal/watchdog/WatchDogTimer.h" + +#include "shared-bindings/microcontroller/__init__.h" + +#include "esp_task_wdt.h" + +void esp_task_wdt_isr_user_handler(void) { + +} + +void common_hal_watchdog_feed(watchdog_watchdogtimer_obj_t *self) { + if (esp_task_wdt_reset() != ESP_OK) { + mp_raise_RuntimeError(translate("watchdog not initialized")); + } +} + +void common_hal_watchdog_deinit(watchdog_watchdogtimer_obj_t *self) { + if (esp_task_wdt_deinit() == ESP_OK) { + self->mode = WATCHDOGMODE_NONE; + } +} + +void watchdog_reset(void) { + common_hal_watchdog_deinit(&common_hal_mcu_watchdogtimer_obj); +} + +static void wdt_config(watchdog_watchdogtimer_obj_t *self) { + // enable panic hanler in WATCHDOGMODE_RESET mode + // initialize Task Watchdog Timer (TWDT) + if (esp_task_wdt_init((uint32_t)self->timeout, (self->mode == WATCHDOGMODE_RESET)) != ESP_OK) { + mp_raise_RuntimeError(translate("Initialization failed due to lack of memory")); + } + esp_task_wdt_add(NULL); +} + +mp_float_t common_hal_watchdog_get_timeout(watchdog_watchdogtimer_obj_t *self) { + return self->timeout; +} + +void common_hal_watchdog_set_timeout(watchdog_watchdogtimer_obj_t *self, mp_float_t new_timeout) { + if ((uint64_t)new_timeout > UINT32_MAX) { + mp_raise_ValueError(translate("timeout duration exceeded the maximum supported value")); + } + if ((uint32_t)self->timeout != (uint32_t)new_timeout) { + self->timeout = new_timeout; + wdt_config(self); + } +} + +watchdog_watchdogmode_t common_hal_watchdog_get_mode(watchdog_watchdogtimer_obj_t *self) { + return self->mode; +} + +void common_hal_watchdog_set_mode(watchdog_watchdogtimer_obj_t *self, watchdog_watchdogmode_t new_mode) { + if (self->mode != new_mode) { + self->mode = new_mode; + wdt_config(self); + } +} diff --git a/ports/esp32s2/common-hal/watchdog/WatchDogTimer.h b/ports/esp32s2/common-hal/watchdog/WatchDogTimer.h new file mode 100644 index 0000000000000..05e0e954d2378 --- /dev/null +++ b/ports/esp32s2/common-hal/watchdog/WatchDogTimer.h @@ -0,0 +1,44 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WATCHDOG_WATCHDOGTIMER_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WATCHDOG_WATCHDOGTIMER_H + +#include "py/obj.h" +#include "shared-bindings/watchdog/WatchDogMode.h" +#include "shared-bindings/watchdog/WatchDogTimer.h" + +struct _watchdog_watchdogtimer_obj_t { + mp_obj_base_t base; + mp_float_t timeout; + watchdog_watchdogmode_t mode; +}; + +// This needs to be called in order to disable the watchdog if it's set to +// "RAISE". If set to "RESET", then the watchdog cannot be reset. +void watchdog_reset(void); + +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WATCHDOG_WATCHDOGTIMER_H diff --git a/ports/esp32s2/common-hal/watchdog/__init__.c b/ports/esp32s2/common-hal/watchdog/__init__.c new file mode 100644 index 0000000000000..fc4e0e008cd53 --- /dev/null +++ b/ports/esp32s2/common-hal/watchdog/__init__.c @@ -0,0 +1 @@ +// No watchdog module functions. diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index 4579b95ab6f4e..335d2caf7280a 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -25,6 +25,7 @@ CIRCUITPY_NVM = 0 # We don't have enough endpoints to include MIDI. CIRCUITPY_USB_MIDI = 0 CIRCUITPY_WIFI = 1 +CIRCUITPY_WATCHDOG ?= 1 CIRCUITPY_ESPIDF = 1 ifndef CIRCUITPY_TOUCHIO_USE_NATIVE From b293aa7e0961f907ff49c28e3a169112cd1d0b3e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 10 Nov 2020 09:12:16 -0600 Subject: [PATCH 149/770] protomatter: Update to upstream tag 1.0.10 Among other things this fixes a problem with blanking the display and Closes #3664. --- lib/protomatter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/protomatter b/lib/protomatter index de6b7704c530d..902c16f49197a 160000 --- a/lib/protomatter +++ b/lib/protomatter @@ -1 +1 @@ -Subproject commit de6b7704c530d886ad8dfa0fa1864764d86117ee +Subproject commit 902c16f49197a8baf5e71ec924a812a86e733a74 From 2d8ebfcf633a0e744e49fe14cc0025d8d7d348fc Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 10 Nov 2020 10:41:10 -0600 Subject: [PATCH 150/770] esp32s2: Correct port_stack_get_top() Closes #3649 --- ports/esp32s2/supervisor/port.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 0b9c03f74724d..a25bcce00a67e 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -148,7 +148,18 @@ uint32_t *port_stack_get_limit(void) { } uint32_t *port_stack_get_top(void) { - return port_stack_get_limit() + CONFIG_ESP_MAIN_TASK_STACK_SIZE / (sizeof(uint32_t) / sizeof(StackType_t)); + // The sizeof-arithmetic is so that the pointer arithmetic is done on units + // of uint32_t instead of units of StackType_t. StackType_t is an alias + // for a byte sized type. + // + // The main stack is bigger than CONFIG_ESP_MAIN_TASK_STACK_SIZE -- an + // "extra" size is added to it (TASK_EXTRA_STACK_SIZE). This total size is + // available as ESP_TASK_MAIN_STACK. Presumably TASK_EXTRA_STACK_SIZE is + // additional stack that can be used by the esp-idf runtime. But what's + // important for us is that some very outermost stack frames, such as + // pyexec_friendly_repl, could lie inside the "extra" area and be invisible + // to the garbage collector. + return port_stack_get_limit() + ESP_TASK_MAIN_STACK / (sizeof(uint32_t) / sizeof(StackType_t)); } supervisor_allocation _fixed_stack; From 44425b8d94d25709cb874b35f74a31da95bbfa38 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 10 Nov 2020 11:32:59 -0600 Subject: [PATCH 151/770] Requested review changes made --- ports/esp32s2/supervisor/port.c | 13 ++++++------- ports/esp32s2/supervisor/usb.c | 8 +++++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 46de6362762f5..4b9a4f7eff8a2 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -55,8 +55,7 @@ uint32_t* heap; uint32_t heap_size; -extern TaskHandle_t xTaskToNotify; - +extern TaskHandle_t sleeping_circuitpython_task; STATIC esp_timer_handle_t _tick_timer; extern void esp_restart(void) NORETURN; @@ -191,23 +190,23 @@ void port_disable_tick(void) { } TickType_t sleep_time_duration; -uint32_t NotifyValue = 0; -BaseType_t notify_wait = 0; void port_interrupt_after_ticks(uint32_t ticks) { sleep_time_duration = (ticks * 100)/1024; - xTaskToNotify = xTaskGetCurrentTaskHandle(); + sleeping_circuitpython_task = xTaskGetCurrentTaskHandle(); } void port_sleep_until_interrupt(void) { + uint32_t NotifyValue = 0; + if (sleep_time_duration == 0) { return; } - notify_wait = xTaskNotifyWait(0x01,0x01,&NotifyValue, + xTaskNotifyWait(0x01,0x01,&NotifyValue, sleep_time_duration ); if (NotifyValue == 1) { - xTaskToNotify = NULL; + sleeping_circuitpython_task = NULL; mp_handle_pending(); } } diff --git a/ports/esp32s2/supervisor/usb.c b/ports/esp32s2/supervisor/usb.c index 86186d36b8eb9..2bfcdfb125d3a 100644 --- a/ports/esp32s2/supervisor/usb.c +++ b/ports/esp32s2/supervisor/usb.c @@ -52,7 +52,7 @@ StackType_t usb_device_stack[USBD_STACK_SIZE]; StaticTask_t usb_device_taskdef; -TaskHandle_t xTaskToNotify = NULL; +TaskHandle_t sleeping_circuitpython_task = NULL; // USB Device Driver task // This top level thread process all usb events and invoke callbacks @@ -129,8 +129,10 @@ void tud_cdc_rx_wanted_cb(uint8_t itf, char wanted_char) if (mp_interrupt_char == wanted_char) { tud_cdc_read_flush(); // flush read fifo mp_keyboard_interrupt(); - if (xTaskToNotify != NULL) { - xTaskNotifyGive(xTaskToNotify); + // CircuitPython's VM is run in a separate FreeRTOS task from TinyUSB. + // So, we must notify the other task when a CTRL-C is received. + if (sleeping_circuitpython_task != NULL) { + xTaskNotifyGive(sleeping_circuitpython_task); } } } From fe7ed999393e369243319c48453cc2f7add3e7f0 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 10 Nov 2020 12:45:39 -0600 Subject: [PATCH 152/770] Split out extern declare to ports/esp32s2/supervisor/esp_port.h --- ports/esp32s2/supervisor/esp_port.h | 35 +++++++++++++++++++++++++++++ ports/esp32s2/supervisor/port.c | 3 ++- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 ports/esp32s2/supervisor/esp_port.h diff --git a/ports/esp32s2/supervisor/esp_port.h b/ports/esp32s2/supervisor/esp_port.h new file mode 100644 index 0000000000000..1164666cda93c --- /dev/null +++ b/ports/esp32s2/supervisor/esp_port.h @@ -0,0 +1,35 @@ +/* + * 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. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_SUPERVISOR_PORT_H +#define MICROPY_INCLUDED_ESP32S2_SUPERVISOR_PORT_H + +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +extern TaskHandle_t sleeping_circuitpython_task; + +#endif // MICROPY_INCLUDED_ESP32S2_SUPERVISOR_PORT_H diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 4b9a4f7eff8a2..0ac2236d310d5 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -31,6 +31,7 @@ #include "boards/board.h" #include "modules/module.h" #include "py/runtime.h" +#include "supervisor/esp_port.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -55,7 +56,7 @@ uint32_t* heap; uint32_t heap_size; -extern TaskHandle_t sleeping_circuitpython_task; + STATIC esp_timer_handle_t _tick_timer; extern void esp_restart(void) NORETURN; From 10e8b8cf456b36b6e1e1582601a3fc437727cec5 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 11 Nov 2020 00:24:01 +0530 Subject: [PATCH 153/770] move port specific check --- ports/nrf/common-hal/watchdog/WatchDogTimer.c | 3 +++ shared-bindings/watchdog/WatchDogTimer.c | 7 +------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ports/nrf/common-hal/watchdog/WatchDogTimer.c b/ports/nrf/common-hal/watchdog/WatchDogTimer.c index bec0ac4732943..539b43e762048 100644 --- a/ports/nrf/common-hal/watchdog/WatchDogTimer.c +++ b/ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -93,6 +93,9 @@ void common_hal_watchdog_feed(watchdog_watchdogtimer_obj_t *self) { } void common_hal_watchdog_deinit(watchdog_watchdogtimer_obj_t *self) { + if (self->mode == WATCHDOGMODE_RESET) { + mp_raise_NotImplementedError(translate("WatchDogTimer cannot be deinitialized once mode is set to RESET")); + } if (timer) { timer_free(); } diff --git a/shared-bindings/watchdog/WatchDogTimer.c b/shared-bindings/watchdog/WatchDogTimer.c index 09219f710967c..575021a2191ed 100644 --- a/shared-bindings/watchdog/WatchDogTimer.c +++ b/shared-bindings/watchdog/WatchDogTimer.c @@ -66,6 +66,7 @@ STATIC mp_obj_t watchdog_watchdogtimer_feed(mp_obj_t self_in) { if (current_mode == WATCHDOGMODE_NONE) { mp_raise_ValueError(translate("WatchDogTimer is not currently running")); } + common_hal_watchdog_feed(self); return mp_const_none; } @@ -78,12 +79,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(watchdog_watchdogtimer_feed_obj, watchdog_watch //| STATIC mp_obj_t watchdog_watchdogtimer_deinit(mp_obj_t self_in) { watchdog_watchdogtimer_obj_t *self = MP_OBJ_TO_PTR(self_in); - watchdog_watchdogmode_t current_mode = common_hal_watchdog_get_mode(self); - - if (current_mode == WATCHDOGMODE_RESET) { - mp_raise_NotImplementedError(translate("WatchDogTimer cannot be deinitialized once mode is set to RESET")); - } - common_hal_watchdog_deinit(self); return mp_const_none; } From 1192eebcdf3fbfa383a868d3a349535858e3e0e3 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Tue, 10 Nov 2020 14:12:44 -0600 Subject: [PATCH 154/770] adding spi and i2c to board for um feather s2 --- .../boards/unexpectedmaker_feathers2/mpconfigboard.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h index 5a885f29cee36..b320fdc8de4a7 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h @@ -37,3 +37,10 @@ // #define MICROPY_HW_APA102_MOSI (&pin_GPIO40) // #define MICROPY_HW_APA102_SCK (&pin_GPIO45) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) \ No newline at end of file From b8f83643b532cfbd76b93f8a88dcf599f6e43c68 Mon Sep 17 00:00:00 2001 From: Szymon Jakubiak Date: Tue, 10 Nov 2020 20:52:38 +0000 Subject: [PATCH 155/770] Translated using Weblate (Polish) Currently translated at 70.7% (598 of 845 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pl/ --- locale/pl.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/locale/pl.po b/locale/pl.po index 54ef4d9185529..e3081544c01e9 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,8 +7,8 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-04 21:18+0530\n" -"PO-Revision-Date: 2020-09-29 01:39+0000\n" -"Last-Translator: Maciej Stankiewicz \n" +"PO-Revision-Date: 2020-11-10 20:52+0000\n" +"Last-Translator: Szymon Jakubiak \n" "Language-Team: pl\n" "Language: pl\n" "MIME-Version: 1.0\n" @@ -16,7 +16,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2;\n" -"X-Generator: Weblate 4.3-dev\n" +"X-Generator: Weblate 4.4-dev\n" #: main.c msgid "" @@ -76,7 +76,7 @@ msgstr "%q poza zakresem" #: py/obj.c msgid "%q indices must be integers, not %q" -msgstr "" +msgstr "%q indeksy muszą być liczbami typu int, a nie %q" #: shared-bindings/vectorio/Polygon.c msgid "%q list must be a list" @@ -104,7 +104,7 @@ msgstr "%q poza zakresem" #: ports/atmel-samd/common-hal/microcontroller/Pin.c msgid "%q pin invalid" -msgstr "" +msgstr "%q nieprawidłowy pin" #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" From b9294818da33853088957d913ef497db92584c18 Mon Sep 17 00:00:00 2001 From: Maciej Stankiewicz Date: Tue, 10 Nov 2020 20:50:02 +0000 Subject: [PATCH 156/770] Translated using Weblate (Polish) Currently translated at 70.7% (598 of 845 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pl/ --- locale/pl.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/pl.po b/locale/pl.po index e3081544c01e9..ae532a73f3d3f 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -8,7 +8,7 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: 2020-11-10 20:52+0000\n" -"Last-Translator: Szymon Jakubiak \n" +"Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" "Language: pl\n" "MIME-Version: 1.0\n" @@ -1206,7 +1206,7 @@ msgstr "" #: shared-module/displayio/Group.c msgid "Layer must be a Group or TileGrid subclass." -msgstr "Layer musi dziedziczyć z Group albo TileGrid" +msgstr "Layer musi dziedziczyć z Group albo TileGrid." #: py/objslice.c msgid "Length must be an int" From a1276be482e46c08f4ad189f9c22ee724d9d82de Mon Sep 17 00:00:00 2001 From: Maciej Stankiewicz Date: Tue, 10 Nov 2020 21:06:44 +0000 Subject: [PATCH 157/770] Translated using Weblate (Polish) Currently translated at 71.5% (605 of 845 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pl/ --- locale/pl.po | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/locale/pl.po b/locale/pl.po index ae532a73f3d3f..fbae676954164 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-04 21:18+0530\n" -"PO-Revision-Date: 2020-11-10 20:52+0000\n" +"PO-Revision-Date: 2020-11-10 21:10+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" "Language: pl\n" @@ -104,7 +104,7 @@ msgstr "%q poza zakresem" #: ports/atmel-samd/common-hal/microcontroller/Pin.c msgid "%q pin invalid" -msgstr "%q nieprawidłowy pin" +msgstr "nieprawidłowy pin %q" #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" @@ -254,7 +254,7 @@ msgstr "'return' poza funkcją" #: py/compile.c msgid "'yield from' inside async function" -msgstr "" +msgstr "'yield from' wewnątrz funkcji asynchronicznej" #: py/compile.c msgid "'yield' outside function" @@ -283,7 +283,7 @@ msgstr "Kanał przerwań sprzętowych w użyciu" #: ports/esp32s2/common-hal/analogio/AnalogIn.c msgid "ADC2 is being used by WiFi" -msgstr "" +msgstr "ADC2 jest używany przez WiFi" #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format @@ -1033,7 +1033,7 @@ msgstr "Błąd wewnętrzny #%d" #: shared-bindings/sdioio/SDCard.c msgid "Invalid %q" -msgstr "" +msgstr "Nieprawidłowe %q" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c @@ -1107,7 +1107,7 @@ msgstr "Zła wielkość fragmentu formatu" #: ports/esp32s2/common-hal/pwmio/PWMOut.c msgid "Invalid frequency" -msgstr "" +msgstr "Nieprawidłowa częstotliwość" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Invalid frequency supplied" @@ -1344,7 +1344,7 @@ msgstr "" #: ports/esp32s2/common-hal/pwmio/PWMOut.c msgid "No more channels available" -msgstr "" +msgstr "Brak dostępnych kanałów" #: ports/esp32s2/common-hal/pwmio/PWMOut.c msgid "No more timers available" @@ -1436,7 +1436,7 @@ msgstr "" #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" -msgstr "" +msgstr "W danym momencie przezroczysty może być tylko jeden kolor" #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" @@ -1505,7 +1505,7 @@ msgstr "Oraz moduły w systemie plików\n" #: shared-module/vectorio/Polygon.c msgid "Polygon needs at least 3 points" -msgstr "" +msgstr "Wielokąt musi mieć co najmniej 3 punkty" #: ports/esp32s2/common-hal/pulseio/PulseOut.c msgid "" From 8373146c56707102626e6d51d98bd87cdd43ba27 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Tue, 10 Nov 2020 15:29:17 -0600 Subject: [PATCH 158/770] newline end of file --- ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h index b320fdc8de4a7..ec49fcadf1442 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h @@ -43,4 +43,4 @@ #define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) -#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) \ No newline at end of file +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) From 9da99675b162742c0ecbd0995ce35e62204be3b1 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 10 Nov 2020 16:44:09 -0800 Subject: [PATCH 159/770] Correct display sequence format docs --- shared-bindings/displayio/Display.c | 22 ++++++++++++---------- shared-bindings/displayio/EPaperDisplay.c | 11 ++++++----- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index 1ed59f23319bd..8d1a888fe77d3 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -58,24 +58,26 @@ //| r"""Create a Display object on the given display bus (`FourWire`, `ParallelBus` or `I2CDisplay`). //| //| The ``init_sequence`` is bitpacked to minimize the ram impact. Every command begins with a -//| command byte followed by a byte to determine the parameter count and if a delay is need after. -//| When the top bit of the second byte is 1, the next byte will be the delay time in milliseconds. -//| The remaining 7 bits are the parameter count excluding any delay byte. The third through final -//| bytes are the remaining command parameters. The next byte will begin a new command definition. -//| Here is a portion of ILI9341 init code: +//| command byte followed by a byte to determine the parameter count and delay. When the top bit +//| of the second byte is 1 (0x80), a delay will occur after the command parameters are sent. +//| The remaining 7 bits are the parameter count excluding any delay byte. The bytes following +//| are the parameters. When the delay bit is set, a single byte after the parameters specifies +//| the delay duration in milliseconds. The value 0xff will lead to an extra long 500 ms delay +//| instead of 255 ms. The next byte will begin a new command definition. +//| Here is an example: //| //| .. code-block:: python //| //| init_sequence = (b"\xe1\x0f\x00\x0E\x14\x03\x11\x07\x31\xC1\x48\x08\x0F\x0C\x31\x36\x0F" # Set Gamma //| b"\x11\x80\x78"# Exit Sleep then delay 0x78 (120ms) -//| b"\x29\x80\x78"# Display on then delay 0x78 (120ms) +//| b"\x29\x81\xaa\x78"# Display on then delay 0x78 (120ms) //| ) //| display = displayio.Display(display_bus, init_sequence, width=320, height=240) //| -//| The first command is 0xe1 with 15 (0xf) parameters following. The second and third are 0x11 and -//| 0x29 respectively with delays (0x80) of 120ms (0x78) and no parameters. Multiple byte literals -//| (b"") are merged together on load. The parens are needed to allow byte literals on subsequent -//| lines. +//| The first command is 0xe1 with 15 (0xf) parameters following. The second is 0x11 with 0 +//| parameters and a 120ms (0x78) delay. The third command is 0x29 with one parameter 0xaa and a +//| 120ms delay (0x78). Multiple byte literals (b"") are merged together on load. The parens +//| are needed to allow byte literals on subsequent lines. //| //| The initialization sequence should always leave the display memory access inline with the scan //| of the display to minimize tearing artifacts. diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index e0326d9c82c7f..8518e37143985 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -65,11 +65,12 @@ //| """Create a EPaperDisplay object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`). //| //| The ``start_sequence`` and ``stop_sequence`` are bitpacked to minimize the ram impact. Every -//| command begins with a command byte followed by a byte to determine the parameter count and if -//| a delay is need after. When the top bit of the second byte is 1, the next byte will be the -//| delay time in milliseconds. The remaining 7 bits are the parameter count excluding any delay -//| byte. The third through final bytes are the remaining command parameters. The next byte will -//| begin a new command definition. +//| command begins with a command byte followed by a byte to determine the parameter count and +//| delay. When the top bit of the second byte is 1 (0x80), a delay will occur after the command +//| parameters are sent. The remaining 7 bits are the parameter count excluding any delay +//| byte. The bytes following are the parameters. When the delay bit is set, a single byte after +//| the parameters specifies the delay duration in milliseconds. The value 0xff will lead to an +//| extra long 500 ms delay instead of 255 ms. The next byte will begin a new command definition. //| //| :param display_bus: The bus that the display is connected to //| :type _DisplayBus: displayio.FourWire or displayio.ParallelBus From f9842566d8c5fe88cda2e153f1beb897aaca993a Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 11 Nov 2020 10:22:48 +0530 Subject: [PATCH 160/770] Add default pin definitions --- .../boards/microdev_micro_s2/mpconfigboard.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h b/ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h index b87b5dfa081f9..272ab20fa5112 100644 --- a/ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h +++ b/ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h @@ -25,7 +25,6 @@ */ //Micropython setup - #define MICROPY_HW_BOARD_NAME "microS2" #define MICROPY_HW_MCU_NAME "ESP32S2" @@ -33,8 +32,20 @@ #define MICROPY_HW_BUTTON (&pin_GPIO0) #define MICROPY_HW_NEOPIXEL (&pin_GPIO33) +// Default bus pins +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO1) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO2) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) + +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) + #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) +// Explanation of how a user got into safe mode. #define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") #define AUTORESET_DELAY_MS 500 From 118ca7cff44bc3aa50e57915e691e1b8c2f4e563 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Wed, 11 Nov 2020 06:56:57 -0600 Subject: [PATCH 161/770] adding default uart pins --- ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h index ec49fcadf1442..b68a31b9e5219 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h @@ -44,3 +44,6 @@ #define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) #define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) From 03b110b44c8e8fed1feb43b7c14b03bbfddf4f2c Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Wed, 11 Nov 2020 09:58:08 -0600 Subject: [PATCH 162/770] Add abort check in I2C lock --- shared-module/adafruit_bus_device/I2CDevice.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/shared-module/adafruit_bus_device/I2CDevice.c b/shared-module/adafruit_bus_device/I2CDevice.c index d790ff53a4c0d..ee4b4fa554e74 100644 --- a/shared-module/adafruit_bus_device/I2CDevice.c +++ b/shared-module/adafruit_bus_device/I2CDevice.c @@ -29,6 +29,7 @@ #include "py/mperrno.h" #include "py/nlr.h" #include "py/runtime.h" +#include "lib/utils/interrupt_char.h" void common_hal_adafruit_bus_device_i2cdevice_construct(adafruit_bus_device_i2cdevice_obj_t *self, busio_i2c_obj_t *i2c, uint8_t device_address) { self->i2c = i2c; @@ -36,11 +37,15 @@ void common_hal_adafruit_bus_device_i2cdevice_construct(adafruit_bus_device_i2cd } void common_hal_adafruit_bus_device_i2cdevice_lock(adafruit_bus_device_i2cdevice_obj_t *self) { - bool success = false; + bool success = common_hal_busio_i2c_try_lock(self->i2c); + while (!success) { + RUN_BACKGROUND_TASKS; + if (mp_hal_is_interrupted()) { + break; + } + success = common_hal_busio_i2c_try_lock(self->i2c); - //RUN_BACKGROUND_TASKS; - //mp_handle_pending(); } } From f61c4e62c14e52da83b17f740b5c5409ee4b05a5 Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Wed, 11 Nov 2020 10:24:33 -0600 Subject: [PATCH 163/770] Removing from smaller builds --- ports/atmel-samd/boards/bdmicro_vina_d21/mpconfigboard.mk | 1 + .../atmel-samd/boards/circuitplayground_express/mpconfigboard.mk | 1 - .../boards/circuitplayground_express_crickit/mpconfigboard.mk | 1 - .../boards/circuitplayground_express_displayio/mpconfigboard.mk | 1 - ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.mk | 1 + ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk | 1 + ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk | 1 + ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk | 1 + ports/atmel-samd/boards/snekboard/mpconfigboard.mk | 1 + ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk | 1 + ports/litex/mpconfigport.mk | 1 + 11 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ports/atmel-samd/boards/bdmicro_vina_d21/mpconfigboard.mk b/ports/atmel-samd/boards/bdmicro_vina_d21/mpconfigboard.mk index a9885d064bf71..a0d9a779f8827 100644 --- a/ports/atmel-samd/boards/bdmicro_vina_d21/mpconfigboard.mk +++ b/ports/atmel-samd/boards/bdmicro_vina_d21/mpconfigboard.mk @@ -15,6 +15,7 @@ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_VECTORIO = 0 +CIRCUITPY_BUSDEVICE = 0 CFLAGS_INLINE_LIMIT = 60 SUPEROPT_GC = 0 diff --git a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk index 13ec9e861cbbf..5389fc89a5790 100644 --- a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk @@ -21,7 +21,6 @@ SUPEROPT_GC = 0 CFLAGS_INLINE_LIMIT = 55 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH diff --git a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk index 7aa45eb39e4b6..31e10d736ced3 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk @@ -25,7 +25,6 @@ CFLAGS_INLINE_LIMIT = 50 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Crickit FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH diff --git a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk index 3a43093a98cef..36b49b0eef685 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk @@ -26,7 +26,6 @@ SUPEROPT_GC = 0 CFLAGS_INLINE_LIMIT = 55 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.mk b/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.mk index 3c0cc07bea0f5..733784bf4c72e 100644 --- a/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.mk +++ b/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.mk @@ -17,6 +17,7 @@ CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_VECTORIO = 0 +CIRCUITPY_BUSDEVICE = 0 CFLAGS_INLINE_LIMIT = 60 diff --git a/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk index dc02e1f60d4fd..2fe085567a0cf 100644 --- a/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk @@ -16,6 +16,7 @@ CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_VECTORIO = 0 +CIRCUITPY_BUSDEVICE = 0 CFLAGS_INLINE_LIMIT = 60 SUPEROPT_GC = 0 diff --git a/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk index 6f7f2d8b67744..c2d692f9b709b 100644 --- a/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk @@ -17,6 +17,7 @@ CIRCUITPY_COUNTIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 # supersized, not ultra-supersized CIRCUITPY_VECTORIO = 0 +CIRCUITPY_BUSDEVICE = 0 CFLAGS_INLINE_LIMIT = 60 SUPEROPT_GC = 0 diff --git a/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk index 7dd965000372c..c35854758cc98 100644 --- a/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk @@ -15,6 +15,7 @@ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_VECTORIO = 0 +CIRCUITPY_BUSDEVICE = 0 CFLAGS_INLINE_LIMIT = 60 SUPEROPT_GC = 0 diff --git a/ports/atmel-samd/boards/snekboard/mpconfigboard.mk b/ports/atmel-samd/boards/snekboard/mpconfigboard.mk index e0262b6b22a4b..67e5b2312d860 100644 --- a/ports/atmel-samd/boards/snekboard/mpconfigboard.mk +++ b/ports/atmel-samd/boards/snekboard/mpconfigboard.mk @@ -15,6 +15,7 @@ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_GAMEPAD = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_VECTORIO = 0 +CIRCUITPY_BUSDEVICE = 0 CFLAGS_INLINE_LIMIT = 60 diff --git a/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk b/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk index 5170f8a233fcc..590c4795fb196 100755 --- a/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk +++ b/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk @@ -16,6 +16,7 @@ CIRCUITPY_COUNTIO = 0 CIRCUITPY_GAMEPAD = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_VECTORIO = 0 +CIRCUITPY_BUSDEVICE = 0 CFLAGS_INLINE_LIMIT = 60 SUPEROPT_GC = 0 diff --git a/ports/litex/mpconfigport.mk b/ports/litex/mpconfigport.mk index 485a75fde0f53..003fb5c2c3718 100644 --- a/ports/litex/mpconfigport.mk +++ b/ports/litex/mpconfigport.mk @@ -18,6 +18,7 @@ CIRCUITPY_AUDIOIO = 0 CIRCUITPY_BITBANGIO = 0 CIRCUITPY_BLEIO_HCI = 0 CIRCUITPY_BOARD = 0 +CIRCUITPY_BUSDEVICE = 0 CIRCUITPY_BUSIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_DISPLAYIO = 0 From 23ed3ef971f8f38497337874da39273e5ae090d7 Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Wed, 11 Nov 2020 11:36:04 -0600 Subject: [PATCH 164/770] Removing frozen libs --- ports/atmel-samd/boards/8086_commander/mpconfigboard.mk | 1 - .../boards/feather_m0_express_crickit/mpconfigboard.mk | 1 - ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk | 1 - ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk | 1 - ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk | 1 - ports/atmel-samd/boards/pycubed/mpconfigboard.mk | 1 - ports/atmel-samd/boards/pycubed_mram/mpconfigboard.mk | 1 - ports/atmel-samd/boards/sam32/mpconfigboard.mk | 1 - ports/atmel-samd/boards/xinabox_cc03/mpconfigboard.mk | 1 - ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk | 1 - 10 files changed, 10 deletions(-) diff --git a/ports/atmel-samd/boards/8086_commander/mpconfigboard.mk b/ports/atmel-samd/boards/8086_commander/mpconfigboard.mk index 9151040a0884c..66e1a12256097 100644 --- a/ports/atmel-samd/boards/8086_commander/mpconfigboard.mk +++ b/ports/atmel-samd/boards/8086_commander/mpconfigboard.mk @@ -21,7 +21,6 @@ CFLAGS_INLINE_LIMIT = 60 CIRCUITPY_GAMEPAD = 1 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD #FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_ADXL34x diff --git a/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk index 5624144e880b1..331a3110ef4b8 100644 --- a/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk @@ -20,7 +20,6 @@ CIRCUITPY_GAMEPAD = 0 CFLAGS_INLINE_LIMIT = 50 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Crickit FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Motor FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk index c33ab0740097d..614ddfa9cee66 100644 --- a/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk @@ -27,5 +27,4 @@ CFLAGS_INLINE_LIMIT = 35 SUPEROPT_GC = 0 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_RFM69 diff --git a/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk index 49b0ef5e362ab..5c1fd1ce98f6a 100644 --- a/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk @@ -28,5 +28,4 @@ CFLAGS_INLINE_LIMIT = 35 SUPEROPT_GC = 0 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_RFM9x diff --git a/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk index 1931ceb9a87a7..2b211abd4e06d 100644 --- a/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk @@ -27,7 +27,6 @@ CFLAGS_INLINE_LIMIT = 55 SUPEROPT_GC = 0 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/atmel-samd/boards/pycubed/mpconfigboard.mk b/ports/atmel-samd/boards/pycubed/mpconfigboard.mk index b7b8073ab9f42..a82362b8d2c3d 100644 --- a/ports/atmel-samd/boards/pycubed/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pycubed/mpconfigboard.mk @@ -21,7 +21,6 @@ CIRCUITPY_GAMEPAD = 0 CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_PS2IO = 0 -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD diff --git a/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.mk b/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.mk index f49bb3fef039b..3bf42d70543b6 100644 --- a/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.mk @@ -21,7 +21,6 @@ CIRCUITPY_GAMEPAD = 0 CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_PS2IO = 0 -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD diff --git a/ports/atmel-samd/boards/sam32/mpconfigboard.mk b/ports/atmel-samd/boards/sam32/mpconfigboard.mk index 1dc686ef8aa69..9ac24a014c60e 100644 --- a/ports/atmel-samd/boards/sam32/mpconfigboard.mk +++ b/ports/atmel-samd/boards/sam32/mpconfigboard.mk @@ -13,5 +13,4 @@ LONGINT_IMPL = MPZ CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_USTACK = 1 -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/atmel-samd/boards/xinabox_cc03/mpconfigboard.mk b/ports/atmel-samd/boards/xinabox_cc03/mpconfigboard.mk index fdcde4a07e518..7243c54db7a70 100644 --- a/ports/atmel-samd/boards/xinabox_cc03/mpconfigboard.mk +++ b/ports/atmel-samd/boards/xinabox_cc03/mpconfigboard.mk @@ -23,4 +23,3 @@ CIRCUITPY_TOUCHIO_USE_NATIVE=0 CIRCUITPY_TOUCHIO=0 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice diff --git a/ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk b/ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk index 9309fdce0de31..50b2100aba33d 100644 --- a/ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk +++ b/ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk @@ -26,5 +26,4 @@ CIRCUITPY_RTC=0 CIRCUITPY_COUNTIO=0 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD From 35ef6c687fdd27a01e4e3a31731eeb622becc2fb Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 11 Nov 2020 23:11:12 +0530 Subject: [PATCH 165/770] nvm implementation for esp32s2 --- locale/circuitpython.pot | 10 ++- ports/esp32s2/Makefile | 2 + .../common-hal/microcontroller/__init__.c | 12 +++ ports/esp32s2/common-hal/nvm/ByteArray.c | 80 +++++++++++++++++++ ports/esp32s2/common-hal/nvm/ByteArray.h | 38 +++++++++ ports/esp32s2/common-hal/nvm/__init__.c | 1 + ports/esp32s2/mpconfigport.h | 7 +- ports/esp32s2/mpconfigport.mk | 2 +- 8 files changed, 147 insertions(+), 5 deletions(-) create mode 100644 ports/esp32s2/common-hal/nvm/ByteArray.c create mode 100644 ports/esp32s2/common-hal/nvm/ByteArray.h create mode 100644 ports/esp32s2/common-hal/nvm/__init__.c diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index b4445abfbfee4..2bb02b2c9dd2d 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-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-11 16:30+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -296,7 +296,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -1248,6 +1249,10 @@ msgstr "" msgid "Must use a multiple of 6 rgb pins, not %d" msgstr "" +#: ports/esp32s2/common-hal/nvm/ByteArray.c +msgid "NVS Error" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "" @@ -3201,6 +3206,7 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 55d6e91d44cb7..ec389e9feb6c5 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -104,6 +104,8 @@ INC += -isystem esp-idf/components/soc/soc/include INC += -isystem esp-idf/components/soc/soc/esp32s2/include INC += -isystem esp-idf/components/heap/include INC += -isystem esp-idf/components/esp_system/include +INC += -isystem esp-idf/components/spi_flash/include +INC += -isystem esp-idf/components/nvs_flash/include INC += -I$(BUILD)/esp-idf/config CFLAGS += -DHAVE_CONFIG_H \ diff --git a/ports/esp32s2/common-hal/microcontroller/__init__.c b/ports/esp32s2/common-hal/microcontroller/__init__.c index 6b2e18673db1d..dc4d2c095ebd4 100644 --- a/ports/esp32s2/common-hal/microcontroller/__init__.c +++ b/ports/esp32s2/common-hal/microcontroller/__init__.c @@ -35,6 +35,7 @@ #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Processor.h" +#include "shared-bindings/nvm/ByteArray.h" #include "supervisor/filesystem.h" #include "supervisor/shared/safe_mode.h" @@ -85,6 +86,17 @@ const mcu_processor_obj_t common_hal_mcu_processor_obj = { }, }; +#if CIRCUITPY_INTERNAL_NVM_SIZE > 0 +// The singleton nvm.ByteArray object. +const nvm_bytearray_obj_t common_hal_mcu_nvm_obj = { + .base = { + .type = &nvm_bytearray_type, + }, + .start_address = (uint8_t*) CIRCUITPY_INTERNAL_NVM_START_ADDR, + .len = CIRCUITPY_INTERNAL_NVM_SIZE, +}; +#endif + // This maps MCU pin names to pin objects. STATIC const mp_rom_map_elem_t mcu_pin_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_GPIO0), MP_ROM_PTR(&pin_GPIO0) }, diff --git a/ports/esp32s2/common-hal/nvm/ByteArray.c b/ports/esp32s2/common-hal/nvm/ByteArray.c new file mode 100644 index 0000000000000..30051df1efd0c --- /dev/null +++ b/ports/esp32s2/common-hal/nvm/ByteArray.c @@ -0,0 +1,80 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "common-hal/nvm/ByteArray.h" + +#include "py/runtime.h" + +#include "nvs_flash.h" + +uint32_t common_hal_nvm_bytearray_get_length(nvm_bytearray_obj_t *self) { + return self->len; +} + +static nvs_handle get_nvs_handle(void) { + // Initialize NVS + esp_err_t err = nvs_flash_init(); + if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) { + // NVS partition was truncated and needs to be erased + // Retry nvs_flash_init + ESP_ERROR_CHECK(nvs_flash_erase()); + err = nvs_flash_init(); + } + ESP_ERROR_CHECK(err); + + // Open NVS handle + nvs_handle nvs_handle; + if (nvs_open("CPY", NVS_READWRITE, &nvs_handle) != ESP_OK) { + mp_raise_RuntimeError(translate("NVS Error")); + } + return nvs_handle; +} + +bool common_hal_nvm_bytearray_set_bytes(nvm_bytearray_obj_t *self, + uint32_t start_index, uint8_t* values, uint32_t len) { + char index[9]; + sprintf(index, "%i", start_index); + // start nvs + nvs_handle handle = get_nvs_handle(); + bool status = ((nvs_set_u8(handle, (const char *)index, *values) == ESP_OK) && (nvs_commit(handle) == ESP_OK)); + // close nvs + nvs_close(handle); + return status; +} + +// NVM memory is memory mapped so reading it is easy. +void common_hal_nvm_bytearray_get_bytes(nvm_bytearray_obj_t *self, + uint32_t start_index, uint32_t len, uint8_t* values) { + char index[9]; + sprintf(index, "%i", start_index); + // start nvs + nvs_handle handle = get_nvs_handle(); + if (nvs_get_u8(handle, (const char *)index, values) != ESP_OK) { + mp_raise_RuntimeError(translate("NVS Error")); + } + // close nvs + nvs_close(handle); +} diff --git a/ports/esp32s2/common-hal/nvm/ByteArray.h b/ports/esp32s2/common-hal/nvm/ByteArray.h new file mode 100644 index 0000000000000..44b63d7241df2 --- /dev/null +++ b/ports/esp32s2/common-hal/nvm/ByteArray.h @@ -0,0 +1,38 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_NVM_BYTEARRAY_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_NVM_BYTEARRAY_H + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + uint8_t* start_address; + uint32_t len; +} nvm_bytearray_obj_t; + +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_NVM_BYTEARRAY_H diff --git a/ports/esp32s2/common-hal/nvm/__init__.c b/ports/esp32s2/common-hal/nvm/__init__.c new file mode 100644 index 0000000000000..1b702a1584d2f --- /dev/null +++ b/ports/esp32s2/common-hal/nvm/__init__.c @@ -0,0 +1 @@ +// No nvm module functions. diff --git a/ports/esp32s2/mpconfigport.h b/ports/esp32s2/mpconfigport.h index cec8dd35df1c4..11ea5f6382299 100644 --- a/ports/esp32s2/mpconfigport.h +++ b/ports/esp32s2/mpconfigport.h @@ -28,7 +28,6 @@ #ifndef ESP32S2_MPCONFIGPORT_H__ #define ESP32S2_MPCONFIGPORT_H__ -#define CIRCUITPY_INTERNAL_NVM_SIZE (0) #define MICROPY_NLR_THUMB (0) #define MICROPY_PY_UJSON (1) @@ -36,11 +35,15 @@ #include "py/circuitpy_mpconfig.h" - #define MICROPY_PORT_ROOT_POINTERS \ CIRCUITPY_COMMON_ROOT_POINTERS #define MICROPY_NLR_SETJMP (1) #define CIRCUITPY_DEFAULT_STACK_SIZE 0x6000 +#define CIRCUITPY_INTERNAL_NVM_START_ADDR (0x9000) + +#ifndef CIRCUITPY_INTERNAL_NVM_SIZE +#define CIRCUITPY_INTERNAL_NVM_SIZE (20000) +#endif #endif // __INCLUDED_ESP32S2_MPCONFIGPORT_H diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index 4579b95ab6f4e..7f3b4241a02e9 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -21,7 +21,7 @@ CIRCUITPY_COUNTIO = 1 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_ROTARYIO = 1 -CIRCUITPY_NVM = 0 +CIRCUITPY_NVM = 1 # We don't have enough endpoints to include MIDI. CIRCUITPY_USB_MIDI = 0 CIRCUITPY_WIFI = 1 From 9817672df7905a63ac168afd1792a46196864209 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 11 Nov 2020 14:06:34 -0500 Subject: [PATCH 166/770] make translate on 6.0.x --- locale/circuitpython.pot | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 3fb2f0719b386..931ae6a4238b3 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-11-09 09:49-0600\n" +"POT-Creation-Date: 2020-11-11 14:06-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2868,6 +2868,14 @@ msgstr "" msgid "maximum recursion depth exceeded" msgstr "" +#: extmod/ulab/code/approx/approx.c +msgid "maxiter must be > 0" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "maxiter should be > 0" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3300,6 +3308,10 @@ msgstr "" msgid "sort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "sorted axis can't be longer than 65535" +msgstr "" + #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" From 53e9c7b3bc0b1162028789445c2e430c06507a50 Mon Sep 17 00:00:00 2001 From: Maciej Stankiewicz Date: Tue, 10 Nov 2020 21:19:44 +0000 Subject: [PATCH 167/770] Translated using Weblate (Polish) Currently translated at 72.1% (610 of 845 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pl/ --- locale/pl.po | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/locale/pl.po b/locale/pl.po index fbae676954164..1b0b41fdf31ae 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-04 21:18+0530\n" -"PO-Revision-Date: 2020-11-10 21:10+0000\n" +"PO-Revision-Date: 2020-11-11 19:13+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" "Language: pl\n" @@ -1817,7 +1817,7 @@ msgstr "" #: ports/stm/common-hal/busio/UART.c msgid "UART write error" -msgstr "" +msgstr "Błąd zapisu UART" #: shared-module/usb_hid/Device.c msgid "USB Busy" @@ -2014,7 +2014,7 @@ msgstr "__init__() powinien zwracać None" #: py/objtype.c msgid "__init__() should return None, not '%q'" -msgstr "" +msgstr "__init__() powinno zwrócić None, a nie '%q'" #: py/objobject.c msgid "__new__ arg must be a user-type" @@ -3057,11 +3057,11 @@ msgstr "nie dość argumentów przy formatowaniu" #: extmod/ulab/code/poly/poly.c msgid "number of arguments must be 2, or 3" -msgstr "" +msgstr "liczba argumentów musi wynosić 2 lub 3" #: extmod/ulab/code/ulab_create.c msgid "number of points must be at least 2" -msgstr "" +msgstr "liczba punktów musi wynosić co najmniej 2" #: py/obj.c msgid "object '%q' is not a tuple or list" @@ -3374,7 +3374,7 @@ msgstr "" #: shared-bindings/displayio/Bitmap.c msgid "source palette too large" -msgstr "" +msgstr "źródłowa paleta jest zbyt duża" #: py/objstr.c msgid "start/end indices" From c96a86bd8a23cf5d238fabc83790d48b39fccd2c Mon Sep 17 00:00:00 2001 From: hexthat Date: Wed, 11 Nov 2020 08:03:23 +0000 Subject: [PATCH 168/770] Translated using Weblate (Chinese (Pinyin)) Currently translated at 100.0% (845 of 845 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/ --- locale/zh_Latn_pinyin.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index c1853a73a5931..4d45f65bd74b1 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-04 21:18+0530\n" -"PO-Revision-Date: 2020-10-28 21:45+0000\n" +"PO-Revision-Date: 2020-11-11 19:13+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" "Language: zh_Latn_pinyin\n" @@ -15,7 +15,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.3.2-dev\n" +"X-Generator: Weblate 4.4-dev\n" #: main.c msgid "" @@ -304,7 +304,7 @@ msgstr "Suǒyǒu I2C wàiwéi qì zhèngzài shǐyòng" #: ports/esp32s2/peripherals/pcnt_handler.c msgid "All PCNT units in use" -msgstr "" +msgstr "suǒ yǒu zhèng zài shǐ yòng zhōng de PCNT dān yuán" #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c From ff411802374d4a77b0bc76da0e4fa31076c0182e Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 12 Nov 2020 16:30:30 +0530 Subject: [PATCH 169/770] pcnt reset on reload --- ports/esp32s2/peripherals/pcnt.c | 18 ++++++++++-------- ports/esp32s2/peripherals/pcnt.h | 1 + ports/esp32s2/supervisor/port.c | 5 +++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ports/esp32s2/peripherals/pcnt.c b/ports/esp32s2/peripherals/pcnt.c index 555a0ec1d3601..dd24569bef933 100644 --- a/ports/esp32s2/peripherals/pcnt.c +++ b/ports/esp32s2/peripherals/pcnt.c @@ -29,14 +29,20 @@ #define PCNT_UNIT_ACTIVE 1 #define PCNT_UNIT_INACTIVE 0 -static uint8_t pcnt_state[4]; +static uint8_t pcnt_unit_state[4]; + +void peripherals_pcnt_reset(void) { + for (uint8_t i = 0; i<=3; i++) { + pcnt_unit_state[i] = PCNT_UNIT_INACTIVE; + } +} int peripherals_pcnt_init(pcnt_config_t pcnt_config) { // Look for available pcnt unit for (uint8_t i = 0; i<=3; i++) { - if (pcnt_state[i] == PCNT_UNIT_INACTIVE) { + if (pcnt_unit_state[i] == PCNT_UNIT_INACTIVE) { pcnt_config.unit = (pcnt_unit_t)i; - pcnt_state[i] = PCNT_UNIT_ACTIVE; + pcnt_unit_state[i] = PCNT_UNIT_ACTIVE; break; } else if (i == 3) { return -1; @@ -46,10 +52,6 @@ int peripherals_pcnt_init(pcnt_config_t pcnt_config) { // Initialize PCNT unit pcnt_unit_config(&pcnt_config); - // Configure and enable the input filter - pcnt_set_filter_value(pcnt_config.unit, 100); - pcnt_filter_enable(pcnt_config.unit); - // Initialize PCNT's counter pcnt_counter_pause(pcnt_config.unit); pcnt_counter_clear(pcnt_config.unit); @@ -61,6 +63,6 @@ int peripherals_pcnt_init(pcnt_config_t pcnt_config) { } void peripherals_pcnt_deinit(pcnt_unit_t* unit) { - pcnt_state[*unit] = PCNT_UNIT_INACTIVE; + pcnt_unit_state[*unit] = PCNT_UNIT_INACTIVE; *unit = PCNT_UNIT_MAX; } diff --git a/ports/esp32s2/peripherals/pcnt.h b/ports/esp32s2/peripherals/pcnt.h index abed80fd0c415..4fce13f4d6cac 100644 --- a/ports/esp32s2/peripherals/pcnt.h +++ b/ports/esp32s2/peripherals/pcnt.h @@ -31,5 +31,6 @@ extern int peripherals_pcnt_init(pcnt_config_t pcnt_config); extern void peripherals_pcnt_deinit(pcnt_unit_t* unit); +extern void peripherals_pcnt_reset(void); #endif // MICROPY_INCLUDED_ESP32S2_PERIPHERALS_PCNT_HANDLER_H diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 3ea1fafbb8d7f..ef032c4a76f62 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -49,6 +49,7 @@ #include "shared-bindings/rtc/__init__.h" #include "peripherals/rmt.h" +#include "peripherals/pcnt.h" #include "components/heap/include/esp_heap_caps.h" #include "components/soc/soc/esp32s2/include/soc/cache_memory.h" @@ -117,6 +118,10 @@ void reset_port(void) { uart_reset(); #endif +#if defined(CIRCUITPY_COUNTIO) || defined(CIRCUITPY_ROTARYIO) + peripherals_pcnt_reset(); +#endif + #if CIRCUITPY_RTC rtc_reset(); #endif From 9774736a50577fe9ae1426d95fc3bea5751411fc Mon Sep 17 00:00:00 2001 From: Enrique Casado Date: Thu, 12 Nov 2020 12:30:34 +0100 Subject: [PATCH 170/770] Rename pins to make them the same as the Arduino core --- .../boards/dynossat_edu_eps/mpconfigboard.mk | 3 ++- ports/atmel-samd/boards/dynossat_edu_eps/pins.c | 17 ++++++++++++----- ports/atmel-samd/boards/dynossat_edu_obc/pins.c | 4 ++++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.mk b/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.mk index 3c0cc07bea0f5..61fafe8e9d613 100644 --- a/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.mk +++ b/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.mk @@ -15,8 +15,9 @@ LONGINT_IMPL = MPZ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_COUNTIO = 0 -CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_I2CPERIPHERAL = 1 CIRCUITPY_VECTORIO = 0 +CIRCUITPY_TOUCHIO = 0 CFLAGS_INLINE_LIMIT = 60 diff --git a/ports/atmel-samd/boards/dynossat_edu_eps/pins.c b/ports/atmel-samd/boards/dynossat_edu_eps/pins.c index a910311d4a395..f960e6bb0ee7d 100644 --- a/ports/atmel-samd/boards/dynossat_edu_eps/pins.c +++ b/ports/atmel-samd/boards/dynossat_edu_eps/pins.c @@ -4,17 +4,17 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB11) }, { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA12) }, { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB10) }, - { MP_ROM_QSTR(MP_QSTR_D30), MP_ROM_PTR(&pin_PA30) }, - { MP_ROM_QSTR(MP_QSTR_D31), MP_ROM_PTR(&pin_PA31) }, + { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_PA30) }, + { MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_PA31) }, { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA17) }, { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA07) }, { MP_ROM_QSTR(MP_QSTR_OVTEMP), MP_ROM_PTR(&pin_PA07) }, { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA16) }, { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA08) }, { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA11) }, { MP_ROM_QSTR(MP_QSTR_SAT_RESET), MP_ROM_PTR(&pin_PA11) }, - { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) }, { MP_ROM_QSTR(MP_QSTR_SAT_PWR_ENABLE), MP_ROM_PTR(&pin_PA10) }, { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA19) }, { MP_ROM_QSTR(MP_QSTR_INT_IMU_OBC), MP_ROM_PTR(&pin_PA19) }, @@ -22,10 +22,17 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_PWRMON_SDA), MP_ROM_PTR(&pin_PA04) }, { MP_ROM_QSTR(MP_QSTR_PWRMON_SCL), MP_ROM_PTR(&pin_PA05) }, { MP_ROM_QSTR(MP_QSTR_PWRMON_ALERT), MP_ROM_PTR(&pin_PB03) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PB09) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB02) }, + { MP_ROM_QSTR(MP_QSTR_V_3V3_MEAS), MP_ROM_PTR(&pin_PB09) }, + { MP_ROM_QSTR(MP_QSTR_V_5V_MEAS), MP_ROM_PTR(&pin_PB02) }, + { MP_ROM_QSTR(MP_QSTR_FLASH_SCK), MP_ROM_PTR(&pin_PA23) }, + { MP_ROM_QSTR(MP_QSTR_FLASH_MOSI), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_FLASH_MISO), MP_ROM_PTR(&pin_PA21) }, + { MP_ROM_QSTR(MP_QSTR_FLASH_CS), MP_ROM_PTR(&pin_PA20) }, { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA06) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA06) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, - { MP_ROM_QSTR(MP_QSTR_I2C_MONITOR), 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) }, }; diff --git a/ports/atmel-samd/boards/dynossat_edu_obc/pins.c b/ports/atmel-samd/boards/dynossat_edu_obc/pins.c index a560360f7d0a7..8cc58d92c0299 100644 --- a/ports/atmel-samd/boards/dynossat_edu_obc/pins.c +++ b/ports/atmel-samd/boards/dynossat_edu_obc/pins.c @@ -26,12 +26,16 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PB07) }, { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PB06) }, { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PB30) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA12) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA15) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PB00) }, { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA08) }, { MP_ROM_QSTR(MP_QSTR_D32), MP_ROM_PTR(&pin_PA30) }, { MP_ROM_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_PA31) }, { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_PB22) }, { MP_ROM_QSTR(MP_QSTR_INT_IMU), MP_ROM_PTR(&pin_PA12) }, { MP_ROM_QSTR(MP_QSTR_SAT_POWER), MP_ROM_PTR(&pin_PA15) }, + { MP_ROM_QSTR(MP_QSTR_OVTEMP), MP_ROM_PTR(&pin_PB00) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA08) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, From aa68b172232f6c817d0f2d3888abd38ada966a36 Mon Sep 17 00:00:00 2001 From: Enrique Casado Date: Thu, 12 Nov 2020 13:26:26 +0100 Subject: [PATCH 171/770] Freed some more space --- ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.mk b/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.mk index 61fafe8e9d613..6d2c1379df053 100644 --- a/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.mk +++ b/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.mk @@ -12,12 +12,15 @@ EXTERNAL_FLASH_DEVICE_COUNT = 1 EXTERNAL_FLASH_DEVICES = "GD25Q32C" LONGINT_IMPL = MPZ +CIRCUITPY_FULLBUILD = 0 CIRCUITPY_BITBANGIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_I2CPERIPHERAL = 1 CIRCUITPY_VECTORIO = 0 +CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_TOUCHIO = 0 +CIRCUITPY_ROTARYIO = 0 CFLAGS_INLINE_LIMIT = 60 From f4b10879fbe6e8efb6ba62219f93fff84c383c1b Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 12 Nov 2020 11:48:01 -0800 Subject: [PATCH 172/770] Change creation date back. --- locale/circuitpython.pot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 931ae6a4238b3..60d05888fc416 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-11-11 14:06-0500\n" +"POT-Creation-Date: 2020-11-04 21:18+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" From 2f2fe10e12ba61e3a7f5b1548d89c7d294ce2d22 Mon Sep 17 00:00:00 2001 From: sporeball Date: Wed, 11 Nov 2020 23:14:48 +0000 Subject: [PATCH 173/770] Translated using Weblate (Japanese) Currently translated at 71.8% (607 of 845 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ja/ --- locale/ja.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/ja.po b/locale/ja.po index 7004c49f30350..4432095553108 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-04 21:18+0530\n" -"PO-Revision-Date: 2020-11-06 20:29+0000\n" +"PO-Revision-Date: 2020-11-12 22:51+0000\n" "Last-Translator: sporeball \n" "Language-Team: none\n" "Language: ja\n" @@ -16,7 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.3.2\n" +"X-Generator: Weblate 4.4-dev\n" #: main.c msgid "" @@ -2786,7 +2786,7 @@ msgstr "" #: shared-bindings/wifi/Radio.c msgid "invalid hostname" -msgstr "" +msgstr "不正なホスト名" #: extmod/modussl_axtls.c msgid "invalid key" From 1145fcaf3efa0ac073ae29e902a8dd5d48a1530d Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 12 Nov 2020 23:52:01 +0100 Subject: [PATCH 174/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 5 +++++ locale/cs.po | 5 +++++ locale/de_DE.po | 5 +++++ locale/el.po | 5 +++++ locale/es.po | 5 +++++ locale/fil.po | 5 +++++ locale/fr.po | 5 +++++ locale/hi.po | 5 +++++ locale/it_IT.po | 5 +++++ locale/ja.po | 5 +++++ locale/ko.po | 5 +++++ locale/nl.po | 5 +++++ locale/pl.po | 5 +++++ locale/pt_BR.po | 5 +++++ locale/sv.po | 5 +++++ locale/zh_Latn_pinyin.po | 5 +++++ 16 files changed, 80 insertions(+) diff --git a/locale/ID.po b/locale/ID.po index 3e47dc9a18dcc..90e416b3b98ac 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -435,6 +435,11 @@ msgstr "Di bawah frame rate minimum" msgid "Bit clock and word select must share a clock unit" msgstr "Bit clock dan word harus memiliki kesamaan pada clock unit" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "Kedalaman bit harus kelipatan 8." diff --git a/locale/cs.po b/locale/cs.po index 428d6d1fe6a2e..f02d31e4dd93b 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -433,6 +433,11 @@ msgstr "" msgid "Bit clock and word select must share a clock unit" msgstr "" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 059d726cabe84..c2cb265508453 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -436,6 +436,11 @@ msgstr "Unterhalb der minimalen Frame Rate" msgid "Bit clock and word select must share a clock unit" msgstr "Bit clock und word select müssen eine clock unit teilen" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "Bit depth muss ein Vielfaches von 8 sein." diff --git a/locale/el.po b/locale/el.po index 327f4dbe0f322..4d7bff1930191 100644 --- a/locale/el.po +++ b/locale/el.po @@ -428,6 +428,11 @@ msgstr "" msgid "Bit clock and word select must share a clock unit" msgstr "" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "" diff --git a/locale/es.po b/locale/es.po index 95d6a92ff52ac..ed7431eb7c7f3 100644 --- a/locale/es.po +++ b/locale/es.po @@ -442,6 +442,11 @@ msgstr "Por debajo de taza mínima de refrescamiento" msgid "Bit clock and word select must share a clock unit" msgstr "Bit clock y word select deben compartir una unidad de reloj" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "Bits depth debe ser múltiplo de 8." diff --git a/locale/fil.po b/locale/fil.po index ce3b5616a32fc..93f41a88ebb55 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -433,6 +433,11 @@ msgstr "" msgid "Bit clock and word select must share a clock unit" msgstr "Ang bit clock at word select dapat makibahagi sa isang clock unit" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "Bit depth ay dapat multiple ng 8." diff --git a/locale/fr.po b/locale/fr.po index 94ca1f21cf4aa..ff15b527e6295 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -442,6 +442,11 @@ msgstr "Inférieur à la fréquence d'images minimale" msgid "Bit clock and word select must share a clock unit" msgstr "'bit clock' et 'word select' doivent partager une horloge" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "La profondeur de bit doit être un multiple de 8." diff --git a/locale/hi.po b/locale/hi.po index d87a1eb9ceb1b..aea2b3f0c49ba 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -428,6 +428,11 @@ msgstr "" msgid "Bit clock and word select must share a clock unit" msgstr "" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 657c581cefcec..603cf9fd083fa 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -433,6 +433,11 @@ msgid "Bit clock and word select must share a clock unit" msgstr "" "Clock di bit e selezione parola devono condividere la stessa unità di clock" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "La profondità di bit deve essere multipla di 8." diff --git a/locale/ja.po b/locale/ja.po index 4432095553108..80486dc210631 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -437,6 +437,11 @@ msgstr "最低のフレームレート未満" msgid "Bit clock and word select must share a clock unit" msgstr "bit clockとword selectはクロックユニットを共有しなければなりません" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "ビット深度は8の倍数でなければなりません" diff --git a/locale/ko.po b/locale/ko.po index 4b302f3b9fb6b..c9215fb85e16b 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -433,6 +433,11 @@ msgstr "" msgid "Bit clock and word select must share a clock unit" msgstr "" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 6851e6ef328d7..cfe2193bba351 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -435,6 +435,11 @@ msgstr "Onder de minimum frame rate" msgid "Bit clock and word select must share a clock unit" msgstr "Bit clock en word select moeten een clock eenheid delen" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "Bit diepte moet een meervoud van 8 zijn." diff --git a/locale/pl.po b/locale/pl.po index 1b0b41fdf31ae..623acd4c5666a 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -437,6 +437,11 @@ msgstr "" msgid "Bit clock and word select must share a clock unit" msgstr "Zegar bitowy i wybór słowa muszą współdzielić jednostkę zegara" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "Głębia musi być wielokrotnością 8." diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 99f090dbd2e2d..67b3dc8a7d728 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -443,6 +443,11 @@ msgstr "" "O clock de bits e a seleção de palavras devem compartilhar uma unidade de " "clock" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "A profundidade de bits deve ser o múltiplo de 8." diff --git a/locale/sv.po b/locale/sv.po index d9639aff6ef3c..be7eb089461ff 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -435,6 +435,11 @@ msgstr "Under minsta bildfrekvens" msgid "Bit clock and word select must share a clock unit" msgstr "Bitklocka och ordval måste dela en klockenhet" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "Bitdjup måste vara multipel av 8." diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 4d45f65bd74b1..4ac1c3e1ee9d4 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -437,6 +437,11 @@ msgstr "Dī yú zuìdī zhèng sùlǜ" msgid "Bit clock and word select must share a clock unit" msgstr "Bǐtè shízhōng hé dānzì xuǎnzé bìxū gòngxiǎng shízhōng dānwèi" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "Bǐtè shēndù bìxū shì 8 bèi yǐshàng." From 0f7081781e8a45da513b371978a354ea8734cc31 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 12 Nov 2020 20:40:09 -0600 Subject: [PATCH 175/770] esp32s2: wifi: fix several debug-build errors Closes #3688 With this change, I don't get the ESP_ERROR_CHECK failed repeatedly running code that imports wifi. (I'm not getting a successful connection but that's probably my own fault, such as a secrets problem) --- ports/esp32s2/common-hal/wifi/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/common-hal/wifi/__init__.c b/ports/esp32s2/common-hal/wifi/__init__.c index 833ef0623fba8..2eb3719b4d8bc 100644 --- a/ports/esp32s2/common-hal/wifi/__init__.c +++ b/ports/esp32s2/common-hal/wifi/__init__.c @@ -143,8 +143,8 @@ void wifi_reset(void) { radio->handler_instance_got_ip)); ESP_ERROR_CHECK(esp_wifi_deinit()); esp_netif_destroy(radio->netif); + ESP_ERROR_CHECK(esp_event_loop_delete_default()); radio->netif = NULL; - ESP_ERROR_CHECK(esp_netif_deinit()); } void ipaddress_ipaddress_to_esp_idf(mp_obj_t ip_address, ip_addr_t* esp_ip_address) { From 7253b2eb31890d24cee10975844b8de9b4880a23 Mon Sep 17 00:00:00 2001 From: Ricardo Date: Fri, 13 Nov 2020 09:22:42 -0600 Subject: [PATCH 176/770] fix name board --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f68402be8f7e6..70fc723761882 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -182,7 +182,7 @@ jobs: - "arduino_nano_33_iot" - "arduino_zero" - "bast_pro_mini_m0" - - "bastble" + - "bastble" - "bdmicro_vina_d21" - "bdmicro_vina_d51" - "bless_dev_board_multi_sensor" From 8d4296f96430795936a22769da35732e5342b25c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 10 Nov 2020 18:02:16 -0800 Subject: [PATCH 177/770] Add board.DISPLAY to MagTag. Fix luma computation * Initialize the EPaper display on the MagTag at start. * Tweak the display send to take a const buffer. * Correct Luma math * Multiply the blue component, not add. * Add all of the components together before dividing. This reduces the impact of truncated division. --- .../adafruit_magtag_2.9_grayscale/board.c | 122 ++++++++++++++++++ .../adafruit_magtag_2.9_grayscale/pins.c | 4 + .../common-hal/displayio/ParallelBus.c | 3 +- shared-bindings/displayio/EPaperDisplay.h | 2 +- shared-bindings/displayio/FourWire.h | 3 +- shared-bindings/displayio/I2CDisplay.h | 3 +- shared-bindings/displayio/ParallelBus.h | 3 +- shared-bindings/displayio/__init__.h | 3 +- shared-module/displayio/ColorConverter.c | 2 +- shared-module/displayio/EPaperDisplay.c | 14 +- shared-module/displayio/EPaperDisplay.h | 4 +- shared-module/displayio/FourWire.c | 3 +- shared-module/displayio/I2CDisplay.c | 3 +- 13 files changed, 152 insertions(+), 17 deletions(-) diff --git a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c index 9f708874bfdf5..ecd44e423c04b 100644 --- a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c +++ b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c @@ -26,7 +26,83 @@ #include "boards/board.h" #include "mpconfigboard.h" +#include "shared-bindings/busio/SPI.h" +#include "shared-bindings/displayio/FourWire.h" #include "shared-bindings/microcontroller/Pin.h" +#include "shared-module/displayio/__init__.h" +#include "supervisor/shared/board.h" + +#define DELAY 0x80 + +// This is an ILO373 control chip. The display is a 2.9" grayscale EInk. + +const uint8_t display_start_sequence[] = { + 0x01, 5, 0x03, 0x00, 0x2b, 0x2b, 0x13, // power setting + 0x06, 3, 0x17, 0x17, 0x17, // booster soft start + 0x04, DELAY, 200, // power on and wait 200 ms + 0x00, 1, 0x7f, // panel setting + 0x50, 1, 0x97, // CDI setting + 0x30, 1, 0x3c, // PLL set to 50 Hx (M = 7, N = 4) + 0x61, 3, 0x80, 0x01, 0x28, // Resolution + 0x82, DELAY | 1, 0x12, 50, // VCM DC and delay 50ms + + // Look up tables for voltage sequence for pixel transition + // Common voltage + 0x20, 0x2a, + 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, + 0x60, 0x14, 0x14, 0x00, 0x00, 0x01, + 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x13, 0x0a, 0x01, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + // White to white + 0x21, 0x2a, + 0x40, 0x0a, 0x00, 0x00, 0x00, 0x01, + 0x90, 0x14, 0x14, 0x00, 0x00, 0x01, + 0x10, 0x14, 0x0a, 0x00, 0x00, 0x01, + 0xa0, 0x13, 0x01, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + // Black to white + 0x22, 0x2a, + 0x40, 0x0a, 0x00, 0x00, 0x00, 0x01, + 0x90, 0x14, 0x14, 0x00, 0x00, 0x01, + 0x00, 0x14, 0x0a, 0x00, 0x00, 0x01, + 0x99, 0x0c, 0x01, 0x03, 0x04, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + // White to black + 0x23, 0x2a, + 0x40, 0x0a, 0x00, 0x00, 0x00, 0x01, + 0x90, 0x14, 0x14, 0x00, 0x00, 0x01, + 0x00, 0x14, 0x0a, 0x00, 0x00, 0x01, + 0x99, 0x0b, 0x04, 0x04, 0x01, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + // Black to black + 0x24, 0x2a, + 0x80, 0x0a, 0x00, 0x00, 0x00, 0x01, + 0x90, 0x14, 0x14, 0x00, 0x00, 0x01, + 0x20, 0x14, 0x0a, 0x00, 0x00, 0x01, + 0x50, 0x13, 0x01, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +const uint8_t display_stop_sequence[] = { + 0x50, 0x01, 0x17, // CDI Setting + 0x82, 0x01, 0x00, // VCM DC to -0.1V + 0x02, 0x00 // Power off +}; void board_init(void) { // USB @@ -36,6 +112,52 @@ void board_init(void) { // Debug UART common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); + + busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; + common_hal_busio_spi_construct(spi, &pin_GPIO36, &pin_GPIO35, NULL); + common_hal_busio_spi_never_reset(spi); + + displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; + bus->base.type = &displayio_fourwire_type; + common_hal_displayio_fourwire_construct(bus, + spi, + &pin_GPIO7, // EPD_DC Command or data + &pin_GPIO8, // EPD_CS Chip select + &pin_GPIO6, // EPD_RST Reset + 4000000, // Baudrate + 0, // Polarity + 0); // Phase + + displayio_epaperdisplay_obj_t* display = &displays[0].epaper_display; + display->base.type = &displayio_epaperdisplay_type; + common_hal_displayio_epaperdisplay_construct( + display, + bus, + display_start_sequence, sizeof(display_start_sequence), + display_stop_sequence, sizeof(display_stop_sequence), + 296, // width + 128, // height + 160, // ram_width + 296, // ram_height + 0, // colstart + 0, // rowstart + 270, // rotation + NO_COMMAND, // set_column_window_command + NO_COMMAND, // set_row_window_command + NO_COMMAND, // set_current_column_command + NO_COMMAND, // set_current_row_command + 0x10, // write_black_ram_command + false, // black_bits_inverted + 0x13, // write_color_ram_command + false, // color_bits_inverted + 0x000000, // highlight_color + 0x12, // refresh_display_command + 1.0, // refresh_time + &pin_GPIO5, // busy_pin + false, // busy_state + 5.0, // seconds_per_frame + false, // always_toggle_chip_select + true); // grayscale } bool board_requests_safe_mode(void) { diff --git a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c index 65bc3fb53b42e..40c9e91e4d0d7 100644 --- a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c +++ b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c @@ -1,5 +1,7 @@ #include "shared-bindings/board/__init__.h" +#include "shared-module/displayio/__init__.h" + STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, { MP_ROM_QSTR(MP_QSTR_AD1), MP_ROM_PTR(&pin_GPIO18) }, @@ -37,5 +39,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { 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].epaper_display)} }; MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); diff --git a/ports/esp32s2/common-hal/displayio/ParallelBus.c b/ports/esp32s2/common-hal/displayio/ParallelBus.c index 314b72ff73024..d0c98f36116ff 100644 --- a/ports/esp32s2/common-hal/displayio/ParallelBus.c +++ b/ports/esp32s2/common-hal/displayio/ParallelBus.c @@ -57,7 +57,8 @@ bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) { return false; } -void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) { +void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) { } diff --git a/shared-bindings/displayio/EPaperDisplay.h b/shared-bindings/displayio/EPaperDisplay.h index 352de899a9cc2..9a2d93bac064a 100644 --- a/shared-bindings/displayio/EPaperDisplay.h +++ b/shared-bindings/displayio/EPaperDisplay.h @@ -39,7 +39,7 @@ extern const mp_obj_type_t displayio_epaperdisplay_type; #define NO_COMMAND 0x100 void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* self, - mp_obj_t bus, uint8_t* start_sequence, uint16_t start_sequence_len, uint8_t* stop_sequence, uint16_t stop_sequence_len, + mp_obj_t bus, const uint8_t* start_sequence, uint16_t start_sequence_len, const uint8_t* stop_sequence, uint16_t stop_sequence_len, uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height, int16_t colstart, int16_t rowstart, uint16_t rotation, uint16_t set_column_window_command, uint16_t set_row_window_command, uint16_t set_current_column_command, uint16_t set_current_row_command, diff --git a/shared-bindings/displayio/FourWire.h b/shared-bindings/displayio/FourWire.h index ac186d2c3ee76..6f6b528e726ce 100644 --- a/shared-bindings/displayio/FourWire.h +++ b/shared-bindings/displayio/FourWire.h @@ -48,7 +48,8 @@ bool common_hal_displayio_fourwire_bus_free(mp_obj_t self); bool common_hal_displayio_fourwire_begin_transaction(mp_obj_t self); -void common_hal_displayio_fourwire_send(mp_obj_t self, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length); +void common_hal_displayio_fourwire_send(mp_obj_t self, display_byte_type_t byte_type, + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length); void common_hal_displayio_fourwire_end_transaction(mp_obj_t self); diff --git a/shared-bindings/displayio/I2CDisplay.h b/shared-bindings/displayio/I2CDisplay.h index bae53c4914d63..37520202e407f 100644 --- a/shared-bindings/displayio/I2CDisplay.h +++ b/shared-bindings/displayio/I2CDisplay.h @@ -44,7 +44,8 @@ bool common_hal_displayio_i2cdisplay_bus_free(mp_obj_t self); bool common_hal_displayio_i2cdisplay_begin_transaction(mp_obj_t self); -void common_hal_displayio_i2cdisplay_send(mp_obj_t self, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length); +void common_hal_displayio_i2cdisplay_send(mp_obj_t self, display_byte_type_t byte_type, + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length); void common_hal_displayio_i2cdisplay_end_transaction(mp_obj_t self); diff --git a/shared-bindings/displayio/ParallelBus.h b/shared-bindings/displayio/ParallelBus.h index be2aef7d44af3..1e74e3a0acf80 100644 --- a/shared-bindings/displayio/ParallelBus.h +++ b/shared-bindings/displayio/ParallelBus.h @@ -46,7 +46,8 @@ bool common_hal_displayio_parallelbus_bus_free(mp_obj_t self); bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t self); -void common_hal_displayio_parallelbus_send(mp_obj_t self, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length); +void common_hal_displayio_parallelbus_send(mp_obj_t self, display_byte_type_t byte_type, + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length); void common_hal_displayio_parallelbus_end_transaction(mp_obj_t self); diff --git a/shared-bindings/displayio/__init__.h b/shared-bindings/displayio/__init__.h index a7748d029a534..4fc666c59866e 100644 --- a/shared-bindings/displayio/__init__.h +++ b/shared-bindings/displayio/__init__.h @@ -42,7 +42,8 @@ typedef enum { typedef bool (*display_bus_bus_reset)(mp_obj_t bus); typedef bool (*display_bus_bus_free)(mp_obj_t bus); typedef bool (*display_bus_begin_transaction)(mp_obj_t bus); -typedef void (*display_bus_send)(mp_obj_t bus, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length); +typedef void (*display_bus_send)(mp_obj_t bus, display_byte_type_t byte_type, + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length); typedef void (*display_bus_end_transaction)(mp_obj_t bus); void common_hal_displayio_release_displays(void); diff --git a/shared-module/displayio/ColorConverter.c b/shared-module/displayio/ColorConverter.c index 03ec99ceb1833..80558d037a689 100644 --- a/shared-module/displayio/ColorConverter.c +++ b/shared-module/displayio/ColorConverter.c @@ -55,7 +55,7 @@ uint8_t displayio_colorconverter_compute_luma(uint32_t color_rgb888) { uint32_t r8 = (color_rgb888 >> 16); uint32_t g8 = (color_rgb888 >> 8) & 0xff; uint32_t b8 = color_rgb888 & 0xff; - return (r8 * 19) / 255 + (g8 * 182) / 255 + (b8 + 54) / 255; + return (r8 * 19 + g8 * 182 + b8 * 54) / 255; } uint8_t displayio_colorconverter_compute_chroma(uint32_t color_rgb888) { diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index 514b99a13bdcd..acca92ac15f2f 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -43,7 +43,8 @@ #include void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* self, - mp_obj_t bus, uint8_t* start_sequence, uint16_t start_sequence_len, uint8_t* stop_sequence, uint16_t stop_sequence_len, + mp_obj_t bus, const uint8_t* start_sequence, uint16_t start_sequence_len, + const uint8_t* stop_sequence, uint16_t stop_sequence_len, uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height, int16_t colstart, int16_t rowstart, uint16_t rotation, uint16_t set_column_window_command, uint16_t set_row_window_command, @@ -133,14 +134,15 @@ STATIC void wait_for_busy(displayio_epaperdisplay_obj_t* self) { } } -STATIC void send_command_sequence(displayio_epaperdisplay_obj_t* self, bool should_wait_for_busy, uint8_t* sequence, uint32_t sequence_len) { +STATIC void send_command_sequence(displayio_epaperdisplay_obj_t* self, + bool should_wait_for_busy, const uint8_t* sequence, uint32_t sequence_len) { uint32_t i = 0; while (i < sequence_len) { - uint8_t *cmd = sequence + i; + const uint8_t *cmd = sequence + i; uint8_t data_size = *(cmd + 1); bool delay = (data_size & DELAY) != 0; data_size &= ~DELAY; - uint8_t *data = cmd + 2; + const uint8_t *data = cmd + 2; displayio_display_core_begin_transaction(&self->core); self->core.send(self->core.bus, DISPLAY_COMMAND, self->chip_select, cmd, 1); self->core.send(self->core.bus, DISPLAY_DATA, self->chip_select, data, data_size); @@ -375,8 +377,8 @@ void release_epaperdisplay(displayio_epaperdisplay_obj_t* self) { void displayio_epaperdisplay_collect_ptrs(displayio_epaperdisplay_obj_t* self) { displayio_display_core_collect_ptrs(&self->core); - gc_collect_ptr(self->start_sequence); - gc_collect_ptr(self->stop_sequence); + gc_collect_ptr((void *) self->start_sequence); + gc_collect_ptr((void *) self->stop_sequence); } bool maybe_refresh_epaperdisplay(void) { diff --git a/shared-module/displayio/EPaperDisplay.h b/shared-module/displayio/EPaperDisplay.h index 4103fe5fce3db..d0668ff444e8f 100644 --- a/shared-module/displayio/EPaperDisplay.h +++ b/shared-module/displayio/EPaperDisplay.h @@ -38,9 +38,9 @@ typedef struct { displayio_display_core_t core; digitalio_digitalinout_obj_t busy; uint32_t milliseconds_per_frame; - uint8_t* start_sequence; + const uint8_t* start_sequence; uint32_t start_sequence_len; - uint8_t* stop_sequence; + const uint8_t* stop_sequence; uint32_t stop_sequence_len; uint16_t refresh_time; uint16_t set_column_window_command; diff --git a/shared-module/displayio/FourWire.c b/shared-module/displayio/FourWire.c index 8c56d7ab60b3d..06f8a84e3506d 100644 --- a/shared-module/displayio/FourWire.c +++ b/shared-module/displayio/FourWire.c @@ -113,7 +113,8 @@ bool common_hal_displayio_fourwire_begin_transaction(mp_obj_t obj) { return true; } -void common_hal_displayio_fourwire_send(mp_obj_t obj, display_byte_type_t data_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) { +void common_hal_displayio_fourwire_send(mp_obj_t obj, display_byte_type_t data_type, + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) { displayio_fourwire_obj_t* self = MP_OBJ_TO_PTR(obj); common_hal_digitalio_digitalinout_set_value(&self->command, data_type == DISPLAY_DATA); if (chip_select == CHIP_SELECT_TOGGLE_EVERY_BYTE) { diff --git a/shared-module/displayio/I2CDisplay.c b/shared-module/displayio/I2CDisplay.c index 5bd03dcd65bb6..cc811e83d7037 100644 --- a/shared-module/displayio/I2CDisplay.c +++ b/shared-module/displayio/I2CDisplay.c @@ -103,7 +103,8 @@ bool common_hal_displayio_i2cdisplay_begin_transaction(mp_obj_t obj) { return common_hal_busio_i2c_try_lock(self->bus); } -void common_hal_displayio_i2cdisplay_send(mp_obj_t obj, display_byte_type_t data_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) { +void common_hal_displayio_i2cdisplay_send(mp_obj_t obj, display_byte_type_t data_type, + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) { displayio_i2cdisplay_obj_t* self = MP_OBJ_TO_PTR(obj); if (data_type == DISPLAY_COMMAND) { uint8_t command_bytes[2 * data_length]; From 78ccac930fbcb3dddd3a1a79809a2ec371d34c6a Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 11 Nov 2020 16:53:45 -0800 Subject: [PATCH 178/770] Add .busy property to EPaperDisplay --- shared-bindings/displayio/EPaperDisplay.c | 18 ++++++++++++++++++ shared-bindings/displayio/EPaperDisplay.h | 1 + shared-module/displayio/EPaperDisplay.c | 5 +++++ 3 files changed, 24 insertions(+) diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index 8518e37143985..ebff6400854a7 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -245,6 +245,23 @@ const mp_obj_property_t displayio_epaperdisplay_time_to_refresh_obj = { (mp_obj_t)&mp_const_none_obj}, }; +//| busy: bool +//| """True when the display is refreshing. This uses the ``busy_pin`` when available or the +//| ``refresh_time`` otherwise.""" +//| +STATIC mp_obj_t displayio_epaperdisplay_obj_get_busy(mp_obj_t self_in) { + displayio_epaperdisplay_obj_t *self = native_display(self_in); + return mp_obj_new_bool(common_hal_displayio_epaperdisplay_get_busy(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_get_busy_obj, displayio_epaperdisplay_obj_get_busy); + +const mp_obj_property_t displayio_epaperdisplay_busy_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&displayio_epaperdisplay_get_busy_obj, + (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + //| width: int //| """Gets the width of the display in pixels""" //| @@ -301,6 +318,7 @@ STATIC const mp_rom_map_elem_t displayio_epaperdisplay_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_epaperdisplay_width_obj) }, { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_epaperdisplay_height_obj) }, { MP_ROM_QSTR(MP_QSTR_bus), MP_ROM_PTR(&displayio_epaperdisplay_bus_obj) }, + { MP_ROM_QSTR(MP_QSTR_busy), MP_ROM_PTR(&displayio_epaperdisplay_busy_obj) }, { MP_ROM_QSTR(MP_QSTR_time_to_refresh), MP_ROM_PTR(&displayio_epaperdisplay_time_to_refresh_obj) }, }; STATIC MP_DEFINE_CONST_DICT(displayio_epaperdisplay_locals_dict, displayio_epaperdisplay_locals_dict_table); diff --git a/shared-bindings/displayio/EPaperDisplay.h b/shared-bindings/displayio/EPaperDisplay.h index 9a2d93bac064a..f785203a41a44 100644 --- a/shared-bindings/displayio/EPaperDisplay.h +++ b/shared-bindings/displayio/EPaperDisplay.h @@ -52,6 +52,7 @@ bool common_hal_displayio_epaperdisplay_show(displayio_epaperdisplay_obj_t* self // Returns time in milliseconds. uint32_t common_hal_displayio_epaperdisplay_get_time_to_refresh(displayio_epaperdisplay_obj_t* self); +bool common_hal_displayio_epaperdisplay_get_busy(displayio_epaperdisplay_obj_t* self); uint16_t common_hal_displayio_epaperdisplay_get_width(displayio_epaperdisplay_obj_t* self); uint16_t common_hal_displayio_epaperdisplay_get_height(displayio_epaperdisplay_obj_t* self); diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index acca92ac15f2f..1b285b4b1dd1f 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -360,6 +360,11 @@ void displayio_epaperdisplay_background(displayio_epaperdisplay_obj_t* self) { } } +bool common_hal_displayio_epaperdisplay_get_busy(displayio_epaperdisplay_obj_t* self) { + displayio_epaperdisplay_background(self); + return self->refreshing; +} + void release_epaperdisplay(displayio_epaperdisplay_obj_t* self) { if (self->refreshing) { wait_for_busy(self); From 68eb809fbf5cafdabb20c090b98aefb1628e3552 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 12 Nov 2020 12:39:31 -0800 Subject: [PATCH 179/770] Update parallel bus signatures --- ports/atmel-samd/common-hal/displayio/ParallelBus.c | 3 ++- ports/mimxrt10xx/common-hal/displayio/ParallelBus.c | 3 ++- ports/nrf/common-hal/displayio/ParallelBus.c | 3 ++- ports/stm/common-hal/displayio/ParallelBus.c | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ports/atmel-samd/common-hal/displayio/ParallelBus.c b/ports/atmel-samd/common-hal/displayio/ParallelBus.c index 405c08c64a7fb..f10dd2993bd1a 100644 --- a/ports/atmel-samd/common-hal/displayio/ParallelBus.c +++ b/ports/atmel-samd/common-hal/displayio/ParallelBus.c @@ -129,7 +129,8 @@ bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) { return true; } -void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) { +void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) { displayio_parallelbus_obj_t* self = MP_OBJ_TO_PTR(obj); common_hal_digitalio_digitalinout_set_value(&self->command, byte_type == DISPLAY_DATA); uint32_t* clear_write = (uint32_t*) &self->write_group->OUTCLR.reg; diff --git a/ports/mimxrt10xx/common-hal/displayio/ParallelBus.c b/ports/mimxrt10xx/common-hal/displayio/ParallelBus.c index 87a72d0f33ee0..0fdf4413b69d6 100644 --- a/ports/mimxrt10xx/common-hal/displayio/ParallelBus.c +++ b/ports/mimxrt10xx/common-hal/displayio/ParallelBus.c @@ -57,7 +57,8 @@ bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) { return false; } -void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) { +void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) { } diff --git a/ports/nrf/common-hal/displayio/ParallelBus.c b/ports/nrf/common-hal/displayio/ParallelBus.c index f13e03163fdb3..31ee1f48e4b6d 100644 --- a/ports/nrf/common-hal/displayio/ParallelBus.c +++ b/ports/nrf/common-hal/displayio/ParallelBus.c @@ -141,7 +141,8 @@ bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) { } // This ignores chip_select behaviour because data is clocked in by the write line toggling. -void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) { +void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) { displayio_parallelbus_obj_t* self = MP_OBJ_TO_PTR(obj); common_hal_digitalio_digitalinout_set_value(&self->command, byte_type == DISPLAY_DATA); uint32_t* clear_write = (uint32_t*) &self->write_group->OUTCLR; diff --git a/ports/stm/common-hal/displayio/ParallelBus.c b/ports/stm/common-hal/displayio/ParallelBus.c index 314b72ff73024..fd07d38af4fa2 100644 --- a/ports/stm/common-hal/displayio/ParallelBus.c +++ b/ports/stm/common-hal/displayio/ParallelBus.c @@ -57,7 +57,8 @@ bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) { return false; } -void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) { +void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) { } From bda3267432aee57e704a20308b724369cceeb6ca Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 13 Nov 2020 18:33:02 -0800 Subject: [PATCH 180/770] Save flash space * No weak link for modules. It only impacts _os and _time and is already disabled for non-full builds. * Turn off PA00 and PA01 because they are the crystal on the Metro M0 Express. * Change ejected default to false to move it to BSS. It is set on USB connection anyway. * Set sinc_filter to const. Doesn't help flash but keeps it out of RAM. --- ports/atmel-samd/boards/metro_m0_express/mpconfigboard.h | 4 ++++ ports/atmel-samd/common-hal/audiobusio/PDMIn.c | 2 +- py/circuitpy_mpconfig.h | 2 +- supervisor/shared/usb/usb_msc_flash.c | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.h b/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.h index 04565feb40891..d48c596acea3e 100644 --- a/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.h +++ b/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.h @@ -33,6 +33,10 @@ #define DEFAULT_UART_BUS_RX (&pin_PA11) #define DEFAULT_UART_BUS_TX (&pin_PA10) +// These pins are connected to the external crystal. +#define IGNORE_PIN_PA00 1 +#define IGNORE_PIN_PA01 1 + // 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/common-hal/audiobusio/PDMIn.c b/ports/atmel-samd/common-hal/audiobusio/PDMIn.c index 21474ab3b1604..3c9ec05c25e09 100644 --- a/ports/atmel-samd/common-hal/audiobusio/PDMIn.c +++ b/ports/atmel-samd/common-hal/audiobusio/PDMIn.c @@ -326,7 +326,7 @@ static void setup_dma(audiobusio_pdmin_obj_t* self, uint32_t length, // higher sample rate than specified. Then after the audio is // recorded, a more expensive filter non-real-time filter could be // used to down-sample and low-pass. -uint16_t sinc_filter [OVERSAMPLING] = { +const uint16_t sinc_filter [OVERSAMPLING] = { 0, 2, 9, 21, 39, 63, 94, 132, 179, 236, 302, 379, 467, 565, 674, 792, 920, 1055, 1196, 1341, 1487, 1633, 1776, 1913, diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 08efabddb5f1e..85e152670a2f5 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -186,7 +186,7 @@ typedef long mp_off_t; #define MICROPY_CPYTHON_COMPAT (CIRCUITPY_FULL_BUILD) #define MICROPY_PY_BUILTINS_POW3 (CIRCUITPY_FULL_BUILD) #define MICROPY_COMP_FSTRING_LITERAL (MICROPY_CPYTHON_COMPAT) -#define MICROPY_MODULE_WEAK_LINKS (CIRCUITPY_FULL_BUILD) +#define MICROPY_MODULE_WEAK_LINKS (0) #define MICROPY_PY_ALL_SPECIAL_METHODS (CIRCUITPY_FULL_BUILD) #define MICROPY_PY_BUILTINS_COMPLEX (CIRCUITPY_FULL_BUILD) #define MICROPY_PY_BUILTINS_FROZENSET (CIRCUITPY_FULL_BUILD) diff --git a/supervisor/shared/usb/usb_msc_flash.c b/supervisor/shared/usb/usb_msc_flash.c index 7532b6aead524..b39f60dcd2ff9 100644 --- a/supervisor/shared/usb/usb_msc_flash.c +++ b/supervisor/shared/usb/usb_msc_flash.c @@ -39,7 +39,7 @@ #define MSC_FLASH_BLOCK_SIZE 512 -static bool ejected[1] = {true}; +static bool ejected[1] = {false}; void usb_msc_mount(void) { // Reset the ejection tracking every time we're plugged into USB. This allows for us to battery From 146adca060d7abc76149c88c7cdd2d401f799efa Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Sat, 14 Nov 2020 11:41:14 +0530 Subject: [PATCH 181/770] Add watchdog mode raise --- ports/esp32s2/common-hal/watchdog/WatchDogTimer.c | 9 ++++++++- ports/esp32s2/common-hal/watchdog/WatchDogTimer.h | 3 +-- ports/esp32s2/supervisor/port.c | 5 +++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ports/esp32s2/common-hal/watchdog/WatchDogTimer.c b/ports/esp32s2/common-hal/watchdog/WatchDogTimer.c index 59b9dafcf0a1f..b51a391b7f3b5 100644 --- a/ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +++ b/ports/esp32s2/common-hal/watchdog/WatchDogTimer.c @@ -27,12 +27,19 @@ #include "py/runtime.h" #include "common-hal/watchdog/WatchDogTimer.h" +#include "shared-bindings/watchdog/__init__.h" #include "shared-bindings/microcontroller/__init__.h" #include "esp_task_wdt.h" void esp_task_wdt_isr_user_handler(void) { - + mp_obj_exception_clear_traceback(MP_OBJ_FROM_PTR(&mp_watchdog_timeout_exception)); + MP_STATE_VM(mp_pending_exception) = &mp_watchdog_timeout_exception; +#if MICROPY_ENABLE_SCHEDULER + if (MP_STATE_VM(sched_state) == MP_SCHED_IDLE) { + MP_STATE_VM(sched_state) = MP_SCHED_PENDING; + } +#endif } void common_hal_watchdog_feed(watchdog_watchdogtimer_obj_t *self) { diff --git a/ports/esp32s2/common-hal/watchdog/WatchDogTimer.h b/ports/esp32s2/common-hal/watchdog/WatchDogTimer.h index 05e0e954d2378..04d9aeee6c29c 100644 --- a/ports/esp32s2/common-hal/watchdog/WatchDogTimer.h +++ b/ports/esp32s2/common-hal/watchdog/WatchDogTimer.h @@ -37,8 +37,7 @@ struct _watchdog_watchdogtimer_obj_t { watchdog_watchdogmode_t mode; }; -// This needs to be called in order to disable the watchdog if it's set to -// "RAISE". If set to "RESET", then the watchdog cannot be reset. +// This needs to be called in order to disable the watchdog void watchdog_reset(void); #endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WATCHDOG_WATCHDOGTIMER_H diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 0b9c03f74724d..1b6f5ef7cb765 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -41,6 +41,7 @@ #include "common-hal/busio/UART.h" #include "common-hal/pulseio/PulseIn.h" #include "common-hal/pwmio/PWMOut.h" +#include "common-hal/watchdog/WatchDogTimer.h" #include "common-hal/wifi/__init__.h" #include "supervisor/memory.h" #include "supervisor/shared/tick.h" @@ -119,6 +120,10 @@ void reset_port(void) { rtc_reset(); #endif +#if CIRCUITPY_WATCHDOG + watchdog_reset(); +#endif + #if CIRCUITPY_WIFI wifi_reset(); #endif From 231e3d362dae1988d5103b1042957ae793599d8b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 14 Nov 2020 10:16:39 -0600 Subject: [PATCH 182/770] esp32s2: Update esp-idf submodule to include fix for #3424 This re-points the submodule to my personal fork of esp-idf. Users may need to `git submodule sync` in their existing trees when this change occurs. Adds just the following commit in esp-idf: > esp_crt_bundle: Allow verify_callback to correct BADCERT_BAD_MD --- .gitmodules | 2 +- ports/esp32s2/esp-idf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index f66ce8aafa2bc..aaa66caf71821 100644 --- a/.gitmodules +++ b/.gitmodules @@ -152,4 +152,4 @@ url = https://github.com/adafruit/Adafruit_CircuitPython_RFM69.git [submodule "ports/esp32s2/esp-idf"] path = ports/esp32s2/esp-idf - url = https://github.com/espressif/esp-idf.git + url = https://github.com/jepler/esp-idf.git diff --git a/ports/esp32s2/esp-idf b/ports/esp32s2/esp-idf index 8bc19ba893e55..d06744f5efc38 160000 --- a/ports/esp32s2/esp-idf +++ b/ports/esp32s2/esp-idf @@ -1 +1 @@ -Subproject commit 8bc19ba893e5544d571a753d82b44a84799b94b1 +Subproject commit d06744f5efc382c61cbad8758107cec308feef09 From 6c3c076cc110d935f0f8406de81007563994e553 Mon Sep 17 00:00:00 2001 From: RubenD Date: Fri, 13 Nov 2020 23:49:31 +0000 Subject: [PATCH 183/770] Translated using Weblate (Spanish) Currently translated at 99.2% (840 of 846 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/locale/es.po b/locale/es.po index ed7431eb7c7f3..c5e2ad75f01c0 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,15 +8,15 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-04 21:18+0530\n" -"PO-Revision-Date: 2020-11-01 16:26+0000\n" -"Last-Translator: Alvaro Figueroa \n" +"PO-Revision-Date: 2020-11-15 16:28+0000\n" +"Last-Translator: RubenD \n" "Language-Team: \n" "Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.3.2-dev\n" +"X-Generator: Weblate 4.4-dev\n" #: main.c msgid "" @@ -305,7 +305,7 @@ msgstr "Todos los periféricos I2C están siendo usados" #: ports/esp32s2/peripherals/pcnt_handler.c msgid "All PCNT units in use" -msgstr "" +msgstr "Todas las unidades PCNT en uso" #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c @@ -445,7 +445,7 @@ msgstr "Bit clock y word select deben compartir una unidad de reloj" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Bit depth must be from 1 to 6 inclusive, not %d" -msgstr "" +msgstr "Bit depth tiene que ser de 1 a 6 inclusivo, no %d" #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." From 76d60ba95bb79e0a553fd6f9dcb5cb25806ada2f Mon Sep 17 00:00:00 2001 From: Antonin ENFRUN Date: Fri, 13 Nov 2020 07:56:16 +0000 Subject: [PATCH 184/770] Translated using Weblate (French) Currently translated at 100.0% (846 of 846 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index ff15b527e6295..5d4ca75d5c31e 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,14 +8,14 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-04 21:18+0530\n" -"PO-Revision-Date: 2020-10-22 20:48+0000\n" +"PO-Revision-Date: 2020-11-15 16:28+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.3.1\n" +"X-Generator: Weblate 4.4-dev\n" #: main.c msgid "" @@ -298,7 +298,7 @@ msgstr "Type d'adresse hors plage" #: ports/esp32s2/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" -msgstr "" +msgstr "Tous les périphériques CAN sont utilisés" #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" @@ -306,7 +306,7 @@ msgstr "Tous les périphériques I2C sont utilisés" #: ports/esp32s2/peripherals/pcnt_handler.c msgid "All PCNT units in use" -msgstr "" +msgstr "Toutes les unités PCNT sont utilisées" #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c @@ -431,7 +431,7 @@ msgstr "" #: ports/esp32s2/common-hal/canio/CAN.c msgid "Baudrate not supported by peripheral" -msgstr "" +msgstr "Baudrate non prise en charge par le périphérique" #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c @@ -445,7 +445,7 @@ msgstr "'bit clock' et 'word select' doivent partager une horloge" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Bit depth must be from 1 to 6 inclusive, not %d" -msgstr "" +msgstr "Bit depth doit être compris entre 1 et 6 inclus, et non %d" #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." @@ -2953,7 +2953,7 @@ msgstr "entiers longs non supportés dans cette build" #: ports/esp32s2/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" -msgstr "" +msgstr "loopback + silent mode non pris en charge par le périphérique" #: py/parse.c msgid "malformed f-string" @@ -2991,11 +2991,11 @@ msgstr "profondeur maximale de récursivité dépassée" #: extmod/ulab/code/approx/approx.c msgid "maxiter must be > 0" -msgstr "" +msgstr "maxiter doit être > 0" #: extmod/ulab/code/approx/approx.c msgid "maxiter should be > 0" -msgstr "" +msgstr "maxiter devrait être > 0" #: py/runtime.c #, c-format @@ -3440,7 +3440,7 @@ msgstr "l'argument de «sort» doit être un ndarray" #: extmod/ulab/code/numerical/numerical.c msgid "sorted axis can't be longer than 65535" -msgstr "" +msgstr "sorted axis ne peut pas dépasser 65535" #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" @@ -3575,12 +3575,12 @@ msgstr "tuple/liste a une mauvaise longueur" #: ports/esp32s2/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" -msgstr "" +msgstr "twai_driver_install a renvoyé l'erreur esp-idf #%d" #: ports/esp32s2/common-hal/canio/CAN.c #, c-format msgid "twai_start returned esp-idf error #%d" -msgstr "" +msgstr "twai_start a renvoyé l'erreur esp-idf #%d" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c From 8218eb2ddf92d979b16391a9a5400ab8a5ce2e67 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Fri, 13 Nov 2020 19:51:22 +0000 Subject: [PATCH 185/770] Translated using Weblate (Swedish) Currently translated at 100.0% (846 of 846 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index be7eb089461ff..1a603e4961b04 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-04 21:18+0530\n" -"PO-Revision-Date: 2020-11-05 20:26+0000\n" +"PO-Revision-Date: 2020-11-15 16:28+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.3.2\n" +"X-Generator: Weblate 4.4-dev\n" #: main.c msgid "" @@ -302,7 +302,7 @@ msgstr "All I2C-kringutrustning används" #: ports/esp32s2/peripherals/pcnt_handler.c msgid "All PCNT units in use" -msgstr "" +msgstr "Alla PCNT-enheter används" #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c @@ -438,7 +438,7 @@ msgstr "Bitklocka och ordval måste dela en klockenhet" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Bit depth must be from 1 to 6 inclusive, not %d" -msgstr "" +msgstr "Bitdjup måste vara inom 1 till 6, inte %d" #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." From 64725190f47fbe3d2b4e54b0e58c485949878a89 Mon Sep 17 00:00:00 2001 From: hexthat Date: Sat, 14 Nov 2020 15:43:32 +0000 Subject: [PATCH 186/770] Translated using Weblate (Chinese (Pinyin)) Currently translated at 100.0% (846 of 846 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/ --- locale/zh_Latn_pinyin.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 4ac1c3e1ee9d4..2731ec4f5e1bf 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-04 21:18+0530\n" -"PO-Revision-Date: 2020-11-11 19:13+0000\n" +"PO-Revision-Date: 2020-11-15 16:28+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" "Language: zh_Latn_pinyin\n" @@ -440,7 +440,7 @@ msgstr "Bǐtè shízhōng hé dānzì xuǎnzé bìxū gòngxiǎng shízhōng dā #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Bit depth must be from 1 to 6 inclusive, not %d" -msgstr "" +msgstr "wèi shēn dù bì xū bāo hán 1 dào 6, ér bù shì %d" #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." From c4917cdabd97c016a46b6193e93b274573d94193 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Mon, 16 Nov 2020 00:11:00 +0530 Subject: [PATCH 187/770] frequencyio implementation for esp32s2 --- .../common-hal/frequencyio/FrequencyIn.c | 158 ++++++++++++++++++ .../common-hal/frequencyio/FrequencyIn.h | 43 +++++ .../esp32s2/common-hal/frequencyio/__init__.c | 1 + ports/esp32s2/mpconfigport.mk | 2 +- 4 files changed, 203 insertions(+), 1 deletion(-) create mode 100644 ports/esp32s2/common-hal/frequencyio/FrequencyIn.c create mode 100644 ports/esp32s2/common-hal/frequencyio/FrequencyIn.h create mode 100644 ports/esp32s2/common-hal/frequencyio/__init__.c diff --git a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c new file mode 100644 index 0000000000000..fce1d34d878ff --- /dev/null +++ b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c @@ -0,0 +1,158 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * 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 "shared-bindings/frequencyio/FrequencyIn.h" + +#include + +#include "py/runtime.h" + +#include "supervisor/shared/tick.h" +#include "shared-bindings/time/__init__.h" + +#include "common-hal/microcontroller/Pin.h" + +static void frequencyin_interrupt_handler(void *self_in) { + frequencyio_frequencyin_obj_t* self = self_in; + // get counter value + int16_t count; + pcnt_get_counter_value(self->unit, &count); + self->frequency = count / 2.0 / self->capture_period; + + // reset counter + pcnt_counter_clear(self->unit); +} + +static void init_timer(frequencyio_frequencyin_obj_t* self, uint16_t capture_period) { + // Prepare configuration for the timer module + timer_config_t config = { + .alarm_en = true, + .counter_en = false, + .intr_type = TIMER_INTR_LEVEL, + .counter_dir = TIMER_COUNT_UP, + .auto_reload = true, + .divider = 80 // 1 us per tick + }; + + // Initialize timer module + timer_init(TIMER_GROUP_0, TIMER_0, &config); + timer_set_counter_value(TIMER_GROUP_0, TIMER_0, 0); + timer_set_alarm_value(TIMER_GROUP_0, TIMER_0, capture_period * 1000000); + timer_enable_intr(TIMER_GROUP_0, TIMER_0); + timer_isr_register(TIMER_GROUP_0, TIMER_0, &frequencyin_interrupt_handler, (void *)self, 0, &self->handle); + + // Start timer + timer_start(TIMER_GROUP_0, TIMER_0); +} + +void common_hal_frequencyio_frequencyin_construct(frequencyio_frequencyin_obj_t* self, + const mcu_pin_obj_t* pin, const uint16_t capture_period) { + if ((capture_period == 0) || (capture_period > 500)) { + mp_raise_ValueError(translate("Invalid capture period. Valid range: 1 - 500")); + } + + // Prepare configuration for the PCNT unit + const pcnt_config_t pcnt_config = { + // Set PCNT input signal and control GPIOs + .pulse_gpio_num = pin->number, + .ctrl_gpio_num = PCNT_PIN_NOT_USED, + .channel = PCNT_CHANNEL_0, + .lctrl_mode = PCNT_MODE_DISABLE, + .hctrl_mode = PCNT_MODE_KEEP, + .pos_mode = PCNT_COUNT_INC, // count both rising and falling edges + .neg_mode = PCNT_COUNT_INC, + .counter_h_lim = 0, + .counter_l_lim = 0, + }; + + // Initialize PCNT unit + const int8_t unit = peripherals_pcnt_init(pcnt_config); + if (unit == -1) { + mp_raise_RuntimeError(translate("All PCNT units in use")); + } + + // set the GPIO back to high-impedance, as pcnt_unit_config sets it as pull-up + gpio_set_pull_mode(pin->number, GPIO_FLOATING); + + // initialize timer + init_timer(self, capture_period); + + self->pin = pin->number; + self->unit = (pcnt_unit_t)unit; + self->capture_period = capture_period; + + claim_pin(pin); +} + +bool common_hal_frequencyio_frequencyin_deinited(frequencyio_frequencyin_obj_t* self) { + return self->unit == PCNT_UNIT_MAX; +} + +void common_hal_frequencyio_frequencyin_deinit(frequencyio_frequencyin_obj_t* self) { + if (common_hal_frequencyio_frequencyin_deinited(self)) { + return; + } + reset_pin_number(self->pin); + peripherals_pcnt_deinit(&self->unit); + if (self->handle) { + timer_deinit(TIMER_GROUP_0, TIMER_0); + esp_intr_free(self->handle); + self->handle = NULL; + } +} + +uint32_t common_hal_frequencyio_frequencyin_get_item(frequencyio_frequencyin_obj_t* self) { + return (1000 / (self->capture_period / self->frequency)); +} + +void common_hal_frequencyio_frequencyin_pause(frequencyio_frequencyin_obj_t* self) { + pcnt_counter_pause(self->unit); + timer_pause(TIMER_GROUP_0, TIMER_0); +} + +void common_hal_frequencyio_frequencyin_resume(frequencyio_frequencyin_obj_t* self) { + pcnt_counter_resume(self->unit); + timer_start(TIMER_GROUP_0, TIMER_0); +} + +void common_hal_frequencyio_frequencyin_clear(frequencyio_frequencyin_obj_t* self) { + self->frequency = 0; + pcnt_counter_clear(self->unit); + timer_set_counter_value(TIMER_GROUP_0, TIMER_0, 0); +} + +uint16_t common_hal_frequencyio_frequencyin_get_capture_period(frequencyio_frequencyin_obj_t *self) { + return self->capture_period; +} + +void common_hal_frequencyio_frequencyin_set_capture_period(frequencyio_frequencyin_obj_t *self, uint16_t capture_period) { + if ((capture_period == 0) || (capture_period > 500)) { + mp_raise_ValueError(translate("Invalid capture period. Valid range: 1 - 500")); + } + self->capture_period = capture_period; + common_hal_frequencyio_frequencyin_clear(self); + timer_set_alarm_value(TIMER_GROUP_0, TIMER_0, capture_period * 1000000); +} diff --git a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.h b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.h new file mode 100644 index 0000000000000..01e617d13ade2 --- /dev/null +++ b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.h @@ -0,0 +1,43 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_FREQUENCYIO_FREQUENCYIN_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_FREQUENCYIO_FREQUENCYIN_H + +#include "py/obj.h" +#include "driver/timer.h" +#include "peripherals/pcnt.h" + +typedef struct { + mp_obj_base_t base; + pcnt_unit_t unit; + intr_handle_t handle; + uint8_t pin; + uint32_t frequency; + uint16_t capture_period; +} frequencyio_frequencyin_obj_t; + +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_FREQUENCYIO_FREQUENCYIN_H diff --git a/ports/esp32s2/common-hal/frequencyio/__init__.c b/ports/esp32s2/common-hal/frequencyio/__init__.c new file mode 100644 index 0000000000000..487814bd076b2 --- /dev/null +++ b/ports/esp32s2/common-hal/frequencyio/__init__.c @@ -0,0 +1 @@ +// No ferquencyio module functions. diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index 4579b95ab6f4e..a84965a6a11c5 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -18,7 +18,7 @@ CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_AUDIOIO = 0 CIRCUITPY_CANIO = 1 CIRCUITPY_COUNTIO = 1 -CIRCUITPY_FREQUENCYIO = 0 +CIRCUITPY_FREQUENCYIO = 1 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_ROTARYIO = 1 CIRCUITPY_NVM = 0 From d4ab00f734203d358299508c01378d97ddf9d40f Mon Sep 17 00:00:00 2001 From: BennyE Date: Mon, 16 Nov 2020 00:31:06 +0100 Subject: [PATCH 188/770] Set station mode early to avoid SoftAP on startup --- ports/esp32s2/common-hal/wifi/Radio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index 275bae31af4db..1945da207bce5 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -72,6 +72,8 @@ void common_hal_wifi_radio_set_enabled(wifi_radio_obj_t *self, bool enabled) { return; } if (!self->started && enabled) { + // esp_wifi_start() would default to soft-AP, thus setting it to station + ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA)); ESP_ERROR_CHECK(esp_wifi_start()); self->started = true; return; From 2bec02738fb7eacaaea710bd448b98a418eb2693 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Mon, 16 Nov 2020 11:44:11 +0530 Subject: [PATCH 189/770] move interrupt handler to iram --- ports/esp32s2/common-hal/frequencyio/FrequencyIn.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c index fce1d34d878ff..ec7ebb21ac1a5 100644 --- a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c +++ b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c @@ -35,7 +35,7 @@ #include "common-hal/microcontroller/Pin.h" -static void frequencyin_interrupt_handler(void *self_in) { +static void IRAM_ATTR frequencyin_interrupt_handler(void *self_in) { frequencyio_frequencyin_obj_t* self = self_in; // get counter value int16_t count; @@ -44,6 +44,10 @@ static void frequencyin_interrupt_handler(void *self_in) { // reset counter pcnt_counter_clear(self->unit); + + // reset interrupt + TIMERG0.int_clr.t0 = 1; + TIMERG0.hw_timer[0].config.alarm_en = 1; } static void init_timer(frequencyio_frequencyin_obj_t* self, uint16_t capture_period) { @@ -62,7 +66,7 @@ static void init_timer(frequencyio_frequencyin_obj_t* self, uint16_t capture_per timer_set_counter_value(TIMER_GROUP_0, TIMER_0, 0); timer_set_alarm_value(TIMER_GROUP_0, TIMER_0, capture_period * 1000000); timer_enable_intr(TIMER_GROUP_0, TIMER_0); - timer_isr_register(TIMER_GROUP_0, TIMER_0, &frequencyin_interrupt_handler, (void *)self, 0, &self->handle); + timer_isr_register(TIMER_GROUP_0, TIMER_0, frequencyin_interrupt_handler, (void *)self, ESP_INTR_FLAG_IRAM, &self->handle); // Start timer timer_start(TIMER_GROUP_0, TIMER_0); From f2824f6a68b3d326e0f4a137880e08147a0074d2 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Mon, 16 Nov 2020 12:55:55 +0530 Subject: [PATCH 190/770] update frequency measurement --- ports/esp32s2/common-hal/frequencyio/FrequencyIn.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c index ec7ebb21ac1a5..bdbe782add49e 100644 --- a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c +++ b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c @@ -84,12 +84,9 @@ void common_hal_frequencyio_frequencyin_construct(frequencyio_frequencyin_obj_t* .pulse_gpio_num = pin->number, .ctrl_gpio_num = PCNT_PIN_NOT_USED, .channel = PCNT_CHANNEL_0, - .lctrl_mode = PCNT_MODE_DISABLE, - .hctrl_mode = PCNT_MODE_KEEP, + // What to do on the positive / negative edge of pulse input? .pos_mode = PCNT_COUNT_INC, // count both rising and falling edges .neg_mode = PCNT_COUNT_INC, - .counter_h_lim = 0, - .counter_l_lim = 0, }; // Initialize PCNT unit @@ -129,7 +126,7 @@ void common_hal_frequencyio_frequencyin_deinit(frequencyio_frequencyin_obj_t* se } uint32_t common_hal_frequencyio_frequencyin_get_item(frequencyio_frequencyin_obj_t* self) { - return (1000 / (self->capture_period / self->frequency)); + return self->frequency; } void common_hal_frequencyio_frequencyin_pause(frequencyio_frequencyin_obj_t* self) { From 0cd951fb73198f5c3dd03ea0463382edac0d3d4d Mon Sep 17 00:00:00 2001 From: root Date: Mon, 16 Nov 2020 10:36:05 -0600 Subject: [PATCH 191/770] Prevent exceptions from accumulating in REPL --- py/obj.c | 1 + 1 file changed, 1 insertion(+) diff --git a/py/obj.c b/py/obj.c index 9dc0cf4749672..315e816e0b042 100644 --- a/py/obj.c +++ b/py/obj.c @@ -125,6 +125,7 @@ void mp_obj_print_exception(const mp_print_t *print, mp_obj_t exc) { mp_printf(print, decompressed_block, block); } } + mp_obj_exception_clear_traceback(exc); } } mp_obj_print_helper(print, exc, PRINT_EXC); From 18e463cca538ed80f03ce9eda0e2ff757f1ba8f4 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Mon, 16 Nov 2020 23:32:22 +0530 Subject: [PATCH 192/770] add pcnt overflow handler & clean-up --- .../common-hal/frequencyio/FrequencyIn.c | 91 +++++++++++-------- .../common-hal/frequencyio/FrequencyIn.h | 3 +- 2 files changed, 57 insertions(+), 37 deletions(-) diff --git a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c index bdbe782add49e..20d744139d89c 100644 --- a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c +++ b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c @@ -26,16 +26,21 @@ #include "shared-bindings/frequencyio/FrequencyIn.h" -#include - #include "py/runtime.h" -#include "supervisor/shared/tick.h" -#include "shared-bindings/time/__init__.h" +static void IRAM_ATTR pcnt_overflow_handler(void *self_in) { + frequencyio_frequencyin_obj_t* self = self_in; + // reset counter + pcnt_counter_clear(self->unit); -#include "common-hal/microcontroller/Pin.h" + // increase multiplier + self->multiplier++; + + // reset interrupt + PCNT.int_clr.val = BIT(self->unit); +} -static void IRAM_ATTR frequencyin_interrupt_handler(void *self_in) { +static void IRAM_ATTR timer_interrupt_handler(void *self_in) { frequencyio_frequencyin_obj_t* self = self_in; // get counter value int16_t count; @@ -50,9 +55,41 @@ static void IRAM_ATTR frequencyin_interrupt_handler(void *self_in) { TIMERG0.hw_timer[0].config.alarm_en = 1; } -static void init_timer(frequencyio_frequencyin_obj_t* self, uint16_t capture_period) { +static void init_pcnt(frequencyio_frequencyin_obj_t* self) { + // Prepare configuration for the PCNT unit + const pcnt_config_t pcnt_config = { + // Set PCNT input signal and control GPIOs + .pulse_gpio_num = self->pin, + .ctrl_gpio_num = PCNT_PIN_NOT_USED, + .channel = PCNT_CHANNEL_0, + // What to do on the positive / negative edge of pulse input? + .pos_mode = PCNT_COUNT_INC, // count both rising and falling edges + .neg_mode = PCNT_COUNT_INC, + // Set counter limit + .counter_h_lim = INT16_MAX, + .counter_l_lim = 0, + }; + + // Initialize PCNT unit + const int8_t unit = peripherals_pcnt_init(pcnt_config); + if (unit == -1) { + mp_raise_RuntimeError(translate("All PCNT units in use")); + } + + // set the GPIO back to high-impedance, as pcnt_unit_config sets it as pull-up + gpio_set_pull_mode(self->pin, GPIO_FLOATING); + + self->unit = (pcnt_unit_t)unit; + + // enable pcnt interrupt + pcnt_event_enable(self->unit, PCNT_EVT_H_LIM); + pcnt_isr_register(pcnt_overflow_handler, (void *)self, ESP_INTR_FLAG_IRAM, &self->handle); + pcnt_intr_enable(self->unit); +} + +static void init_timer(frequencyio_frequencyin_obj_t* self) { // Prepare configuration for the timer module - timer_config_t config = { + const timer_config_t config = { .alarm_en = true, .counter_en = false, .intr_type = TIMER_INTR_LEVEL, @@ -64,9 +101,9 @@ static void init_timer(frequencyio_frequencyin_obj_t* self, uint16_t capture_per // Initialize timer module timer_init(TIMER_GROUP_0, TIMER_0, &config); timer_set_counter_value(TIMER_GROUP_0, TIMER_0, 0); - timer_set_alarm_value(TIMER_GROUP_0, TIMER_0, capture_period * 1000000); + timer_set_alarm_value(TIMER_GROUP_0, TIMER_0, self->capture_period * 1000000); + timer_isr_register(TIMER_GROUP_0, TIMER_0, timer_interrupt_handler, (void *)self, ESP_INTR_FLAG_IRAM, &self->handle); timer_enable_intr(TIMER_GROUP_0, TIMER_0); - timer_isr_register(TIMER_GROUP_0, TIMER_0, frequencyin_interrupt_handler, (void *)self, ESP_INTR_FLAG_IRAM, &self->handle); // Start timer timer_start(TIMER_GROUP_0, TIMER_0); @@ -78,33 +115,15 @@ void common_hal_frequencyio_frequencyin_construct(frequencyio_frequencyin_obj_t* mp_raise_ValueError(translate("Invalid capture period. Valid range: 1 - 500")); } - // Prepare configuration for the PCNT unit - const pcnt_config_t pcnt_config = { - // Set PCNT input signal and control GPIOs - .pulse_gpio_num = pin->number, - .ctrl_gpio_num = PCNT_PIN_NOT_USED, - .channel = PCNT_CHANNEL_0, - // What to do on the positive / negative edge of pulse input? - .pos_mode = PCNT_COUNT_INC, // count both rising and falling edges - .neg_mode = PCNT_COUNT_INC, - }; - - // Initialize PCNT unit - const int8_t unit = peripherals_pcnt_init(pcnt_config); - if (unit == -1) { - mp_raise_RuntimeError(translate("All PCNT units in use")); - } - - // set the GPIO back to high-impedance, as pcnt_unit_config sets it as pull-up - gpio_set_pull_mode(pin->number, GPIO_FLOATING); - - // initialize timer - init_timer(self, capture_period); - self->pin = pin->number; - self->unit = (pcnt_unit_t)unit; + self->handle = NULL; + self->multiplier = 0; self->capture_period = capture_period; + // initialize pcnt and timer + init_pcnt(self); + init_timer(self); + claim_pin(pin); } @@ -118,15 +137,15 @@ void common_hal_frequencyio_frequencyin_deinit(frequencyio_frequencyin_obj_t* se } reset_pin_number(self->pin); peripherals_pcnt_deinit(&self->unit); + timer_deinit(TIMER_GROUP_0, TIMER_0); if (self->handle) { - timer_deinit(TIMER_GROUP_0, TIMER_0); esp_intr_free(self->handle); self->handle = NULL; } } uint32_t common_hal_frequencyio_frequencyin_get_item(frequencyio_frequencyin_obj_t* self) { - return self->frequency; + return (self->frequency + (self->multiplier * INT16_MAX)); } void common_hal_frequencyio_frequencyin_pause(frequencyio_frequencyin_obj_t* self) { diff --git a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.h b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.h index 01e617d13ade2..ce3bf8f2f9d15 100644 --- a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.h +++ b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.h @@ -36,7 +36,8 @@ typedef struct { pcnt_unit_t unit; intr_handle_t handle; uint8_t pin; - uint32_t frequency; + uint8_t multiplier; + uint16_t frequency; uint16_t capture_period; } frequencyio_frequencyin_obj_t; From 0686cde2263a50e2074f741417d169a1c1ea752e Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Tue, 17 Nov 2020 01:19:12 +0530 Subject: [PATCH 193/770] update internal nvm size --- ports/esp32s2/common-hal/nvm/ByteArray.c | 4 ++-- ports/esp32s2/mpconfigport.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/esp32s2/common-hal/nvm/ByteArray.c b/ports/esp32s2/common-hal/nvm/ByteArray.c index 30051df1efd0c..d90f7fbdc2d82 100644 --- a/ports/esp32s2/common-hal/nvm/ByteArray.c +++ b/ports/esp32s2/common-hal/nvm/ByteArray.c @@ -56,7 +56,7 @@ static nvs_handle get_nvs_handle(void) { bool common_hal_nvm_bytearray_set_bytes(nvm_bytearray_obj_t *self, uint32_t start_index, uint8_t* values, uint32_t len) { char index[9]; - sprintf(index, "%i", start_index); + sprintf(index, "%i", start_index - CIRCUITPY_INTERNAL_NVM_START_ADDR); // start nvs nvs_handle handle = get_nvs_handle(); bool status = ((nvs_set_u8(handle, (const char *)index, *values) == ESP_OK) && (nvs_commit(handle) == ESP_OK)); @@ -69,7 +69,7 @@ bool common_hal_nvm_bytearray_set_bytes(nvm_bytearray_obj_t *self, void common_hal_nvm_bytearray_get_bytes(nvm_bytearray_obj_t *self, uint32_t start_index, uint32_t len, uint8_t* values) { char index[9]; - sprintf(index, "%i", start_index); + sprintf(index, "%i", start_index - CIRCUITPY_INTERNAL_NVM_START_ADDR); // start nvs nvs_handle handle = get_nvs_handle(); if (nvs_get_u8(handle, (const char *)index, values) != ESP_OK) { diff --git a/ports/esp32s2/mpconfigport.h b/ports/esp32s2/mpconfigport.h index 11ea5f6382299..db7393d8ef142 100644 --- a/ports/esp32s2/mpconfigport.h +++ b/ports/esp32s2/mpconfigport.h @@ -43,7 +43,7 @@ #define CIRCUITPY_INTERNAL_NVM_START_ADDR (0x9000) #ifndef CIRCUITPY_INTERNAL_NVM_SIZE -#define CIRCUITPY_INTERNAL_NVM_SIZE (20000) +#define CIRCUITPY_INTERNAL_NVM_SIZE (20 * 1024) #endif #endif // __INCLUDED_ESP32S2_MPCONFIGPORT_H From 9c4b6c34b8cfacdc86074df261a4eac0fc23b129 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 16 Nov 2020 16:03:29 -0600 Subject: [PATCH 194/770] see what happens if workflows move to ubuntu 20.04 --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c83f37e6ed9e3..bd0dea5cf8c21 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ on: jobs: test: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 steps: - name: Dump GitHub context env: @@ -165,7 +165,7 @@ jobs: build-arm: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 needs: test strategy: fail-fast: false @@ -368,7 +368,7 @@ jobs: if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) build-riscv: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 needs: test strategy: fail-fast: false From 3b27810a3ab6c15d0612b986e6f6086aecccdbcb Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 17 Nov 2020 00:02:02 +0100 Subject: [PATCH 195/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 15 +++++++++++++-- locale/cs.po | 15 +++++++++++++-- locale/de_DE.po | 15 +++++++++++++-- locale/el.po | 15 +++++++++++++-- locale/es.po | 15 +++++++++++++-- locale/fil.po | 15 +++++++++++++-- locale/fr.po | 15 +++++++++++++-- locale/hi.po | 15 +++++++++++++-- locale/it_IT.po | 15 +++++++++++++-- locale/ja.po | 15 +++++++++++++-- locale/ko.po | 15 +++++++++++++-- locale/nl.po | 15 +++++++++++++-- locale/pl.po | 15 +++++++++++++-- locale/pt_BR.po | 15 +++++++++++++-- locale/sv.po | 15 +++++++++++++-- locale/zh_Latn_pinyin.po | 15 +++++++++++++-- 16 files changed, 208 insertions(+), 32 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 90e416b3b98ac..d6672b1e401cf 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-10-10 23:51+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -300,7 +300,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Semua perangkat I2C sedang digunakan" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -1018,6 +1019,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Ukuran penyangga salah" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "" @@ -3254,6 +3259,7 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3469,6 +3475,7 @@ msgstr "" msgid "time.struct_time() takes a 9-sequence" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" @@ -3653,6 +3660,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index f02d31e4dd93b..bde3a20b87198 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-05-24 03:22+0000\n" "Last-Translator: dronecz \n" "Language-Team: LANGUAGE \n" @@ -300,7 +300,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -1001,6 +1002,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "" @@ -3210,6 +3215,7 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3425,6 +3431,7 @@ msgstr "" msgid "time.struct_time() takes a 9-sequence" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" @@ -3608,6 +3615,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index c2cb265508453..dabc486595283 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-06-16 18:24+0000\n" "Last-Translator: Andreas Buchen \n" "Language: de_DE\n" @@ -299,7 +299,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Alle I2C-Peripheriegeräte sind in Benutzung" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -1018,6 +1019,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Inkorrekte Puffergröße" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "" @@ -3293,6 +3298,7 @@ msgstr "pow() drittes Argument darf nicht 0 sein" msgid "pow() with 3 arguments requires integers" msgstr "pow () mit 3 Argumenten erfordert Integer" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3511,6 +3517,7 @@ msgstr "threshold muss im Intervall 0-65536 liegen" msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() nimmt eine 9-Sequenz an" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "Das Zeitlimit hat den maximal zulässigen Wert überschritten" @@ -3698,6 +3705,10 @@ msgstr "value_count muss größer als 0 sein" msgid "vectors must have same lengths" msgstr "Vektoren müssen die selbe Länge haben" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "" diff --git a/locale/el.po b/locale/el.po index 4d7bff1930191..0d35c20cebc07 100644 --- a/locale/el.po +++ b/locale/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -295,7 +295,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -996,6 +997,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "" @@ -3205,6 +3210,7 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3420,6 +3426,7 @@ msgstr "" msgid "time.struct_time() takes a 9-sequence" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" @@ -3603,6 +3610,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "" diff --git a/locale/es.po b/locale/es.po index c5e2ad75f01c0..bdb4b68a5d7f0 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-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-11-15 16:28+0000\n" "Last-Translator: RubenD \n" "Language-Team: \n" @@ -303,7 +303,8 @@ msgstr "Todos los periféricos CAN están en uso" msgid "All I2C peripherals are in use" msgstr "Todos los periféricos I2C están siendo usados" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "Todas las unidades PCNT en uso" @@ -1019,6 +1020,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Tamaño incorrecto del buffer" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "La entrada está durando mucho tiempo" @@ -3281,6 +3286,7 @@ msgstr "el 3er argumento de pow() no puede ser 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() con 3 argumentos requiere enteros" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3498,6 +3504,7 @@ msgstr "limite debe ser en el rango 0-65536" msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() toma un sequencio 9" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" @@ -3682,6 +3689,10 @@ msgstr "value_count debe ser > 0" msgid "vectors must have same lengths" msgstr "los vectores deben tener el mismo tamaño" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "el tiempo de espera del perro guardián debe ser mayor a 0" diff --git a/locale/fil.po b/locale/fil.po index 93f41a88ebb55..c74e13c6c825a 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -297,7 +297,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Lahat ng I2C peripherals ginagamit" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -1011,6 +1012,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "" @@ -3256,6 +3261,7 @@ msgstr "pow() 3rd argument ay hindi maaring 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() na may 3 argumento kailangan ng integers" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3474,6 +3480,7 @@ msgstr "ang threshold ay dapat sa range 0-65536" msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() kumukuha ng 9-sequence" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" @@ -3658,6 +3665,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index 5d4ca75d5c31e..a15bbb8d50fee 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-11-15 16:28+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" @@ -304,7 +304,8 @@ msgstr "Tous les périphériques CAN sont utilisés" msgid "All I2C peripherals are in use" msgstr "Tous les périphériques I2C sont utilisés" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "Toutes les unités PCNT sont utilisées" @@ -1024,6 +1025,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Taille de tampon incorrecte" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "L'entrée prend trop de temps" @@ -3305,6 +3310,7 @@ msgstr "le 3e argument de pow() ne peut être 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() avec 3 arguments nécessite des entiers" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3523,6 +3529,7 @@ msgstr "le seuil doit être dans la gamme 0-65536" msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() prend une séquence de longueur 9" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "le délai d'expiration a dépassé la valeur maximale prise en charge" @@ -3706,6 +3713,10 @@ msgstr "'value_count' doit être > 0" msgid "vectors must have same lengths" msgstr "les vecteurs doivent avoir la même longueur" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "watchdog timeout doit être supérieur à 0" diff --git a/locale/hi.po b/locale/hi.po index aea2b3f0c49ba..6c49e1f01f6fd 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -295,7 +295,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -996,6 +997,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "" @@ -3205,6 +3210,7 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3420,6 +3426,7 @@ msgstr "" msgid "time.struct_time() takes a 9-sequence" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" @@ -3603,6 +3610,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 603cf9fd083fa..fc0f0167525fe 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -296,7 +296,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Tutte le periferiche I2C sono in uso" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -1011,6 +1012,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "" @@ -3263,6 +3268,7 @@ msgstr "il terzo argomento di pow() non può essere 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() con 3 argomenti richiede interi" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3481,6 +3487,7 @@ msgstr "la soglia deve essere nell'intervallo 0-65536" msgid "time.struct_time() takes a 9-sequence" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" @@ -3665,6 +3672,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "" diff --git a/locale/ja.po b/locale/ja.po index 80486dc210631..f3dfc6c900e2d 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-11-12 22:51+0000\n" "Last-Translator: sporeball \n" "Language-Team: none\n" @@ -302,7 +302,8 @@ msgstr "全てのCAN周辺機器が使用中" msgid "All I2C peripherals are in use" msgstr "全てのI2C周辺機器が使用中" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -1011,6 +1012,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "バッファサイズが正しくありません" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "" @@ -3237,6 +3242,7 @@ msgstr "pow()の3つ目の引数は0にできません" msgid "pow() with 3 arguments requires integers" msgstr "pow()の第3引数には整数が必要" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3453,6 +3459,7 @@ msgstr "threshouldは0から65536まで" msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time()は9要素のシーケンスを受け取ります" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "タイムアウト長は対応する最大値を超えています" @@ -3636,6 +3643,10 @@ msgstr "value_countは0より大きくなければなりません" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "watchdogのtimeoutは0以上でなければなりません" diff --git a/locale/ko.po b/locale/ko.po index c9215fb85e16b..bfa49ab70c597 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-10-05 12:12+0000\n" "Last-Translator: Michal Čihař \n" "Language-Team: LANGUAGE \n" @@ -298,7 +298,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "사용중인 모든 I2C주변 기기" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -1001,6 +1002,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "" @@ -3211,6 +3216,7 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3426,6 +3432,7 @@ msgstr "" msgid "time.struct_time() takes a 9-sequence" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" @@ -3609,6 +3616,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index cfe2193bba351..7625cdb26bfdb 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-10-27 16:47+0000\n" "Last-Translator: Jelle Jager \n" "Language-Team: none\n" @@ -300,7 +300,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Alle I2C peripherals zijn in gebruik" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -1013,6 +1014,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Incorrecte buffer grootte" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "Invoer duurt te lang" @@ -3270,6 +3275,7 @@ msgstr "derde argument van pow() mag geen 0 zijn" msgid "pow() with 3 arguments requires integers" msgstr "pow() met 3 argumenten vereist integers" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3487,6 +3493,7 @@ msgstr "drempelwaarde moet in het bereik 0-65536 liggen" msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() accepteert een 9-rij" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "time-outduur is groter dan de ondersteunde maximale waarde" @@ -3670,6 +3677,10 @@ msgstr "value_count moet groter dan 0 zijn" msgid "vectors must have same lengths" msgstr "vectoren moeten van gelijke lengte zijn" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "watchdog time-out moet groter zijn dan 0" diff --git a/locale/pl.po b/locale/pl.po index 623acd4c5666a..f04887e6824d3 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-11-11 19:13+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" @@ -302,7 +302,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Wszystkie peryferia I2C w użyciu" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -1011,6 +1012,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Niewłaściwa wielkość bufora" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "" @@ -3229,6 +3234,7 @@ msgstr "trzeci argument pow() nie może być 0" msgid "pow() with 3 arguments requires integers" msgstr "trzyargumentowe pow() wymaga liczb całkowitych" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3445,6 +3451,7 @@ msgstr "threshold musi być w zakresie 0-65536" msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() wymaga 9-elementowej sekwencji" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" @@ -3628,6 +3635,10 @@ msgstr "value_count musi być > 0" msgid "vectors must have same lengths" msgstr "wektory muszą mieć identyczną długość" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 67b3dc8a7d728..491868979555a 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-11-08 10:26+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -304,7 +304,8 @@ msgstr "Todos os periféricos CAN estão em uso" msgid "All I2C peripherals are in use" msgstr "Todos os periféricos I2C estão em uso" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "Todas as unidades PCNT estão em uso" @@ -1022,6 +1023,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "O tamanho do buffer está incorreto" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "A entrada está demorando demais" @@ -3296,6 +3301,7 @@ msgstr "O terceiro argumento pow() não pode ser 0" msgid "pow() with 3 arguments requires integers" msgstr "o pow() com 3 argumentos requer números inteiros" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3513,6 +3519,7 @@ msgstr "Limite deve estar no alcance de 0-65536" msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() leva uma sequência com 9" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "a duração do tempo limite excedeu o valor máximo suportado" @@ -3696,6 +3703,10 @@ msgstr "o value_count deve ser > 0" msgid "vectors must have same lengths" msgstr "os vetores devem ter os mesmos comprimentos" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "o tempo limite do watchdog deve ser maior que 0" diff --git a/locale/sv.po b/locale/sv.po index 1a603e4961b04..55e6368ae5654 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-11-15 16:28+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -300,7 +300,8 @@ msgstr "All I2C-kringutrustning används" msgid "All I2C peripherals are in use" msgstr "All I2C-kringutrustning används" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "Alla PCNT-enheter används" @@ -1011,6 +1012,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Fel buffertstorlek" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "Indata tar för lång tid" @@ -3263,6 +3268,7 @@ msgstr "pow() 3: e argument kan inte vara 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() med 3 argument kräver heltal" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3480,6 +3486,7 @@ msgstr "tröskelvärdet måste ligga i intervallet 0-65536" msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() kräver en 9-sekvens" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "timeout-längd överskred det maximala värde som stöds" @@ -3663,6 +3670,10 @@ msgstr "value_count måste vara > 0" msgid "vectors must have same lengths" msgstr "vektorer måste ha samma längd" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "watchdog timeout måste vara större än 0" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 2731ec4f5e1bf..dd44aab9396d1 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-10 15:30+0530\n" "PO-Revision-Date: 2020-11-15 16:28+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -302,7 +302,8 @@ msgstr "suǒ yǒu CAN wài shè dōu zài shǐ yòng zhōng" msgid "All I2C peripherals are in use" msgstr "Suǒyǒu I2C wàiwéi qì zhèngzài shǐyòng" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "suǒ yǒu zhèng zài shǐ yòng zhōng de PCNT dān yuán" @@ -1009,6 +1010,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Huǎnchōng qū dàxiǎo bù zhèngquè" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "Initialization failed due to lack of memory" +msgstr "" + #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" msgstr "Shūrù shíjiānguò zhǎng" @@ -3252,6 +3257,7 @@ msgstr "pow() 3 cān shǔ bùnéng wéi 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() yǒu 3 cānshù xūyào zhěngshù" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3469,6 +3475,7 @@ msgstr "yùzhí bìxū zài fànwéi 0-65536" msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() xūyào 9 xùliè" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "chāoshí shíjiān chāoguò zuìdà zhīchí zhí" @@ -3652,6 +3659,10 @@ msgstr "zhí jìshù bìxū wèi > 0" msgid "vectors must have same lengths" msgstr "xiàngliàng bìxū jùyǒu xiāngtóng de chángdù" +#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c +msgid "watchdog not initialized" +msgstr "" + #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" msgstr "kān mén gǒu chāoshí bìxū dàyú 0" From 089fa82067549b97990eaf0d61c073b852cf7636 Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Mon, 16 Nov 2020 21:21:24 -0600 Subject: [PATCH 196/770] Fix pre-commit --- ports/nrf/boards/bastble/README.md | 6 +----- ports/nrf/boards/bastble/board.c | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/ports/nrf/boards/bastble/README.md b/ports/nrf/boards/bastble/README.md index c68464106275e..0af6209bdb2df 100644 --- a/ports/nrf/boards/bastble/README.md +++ b/ports/nrf/boards/bastble/README.md @@ -1,8 +1,4 @@ # Electronic Cats BastBLE The [BastBLE](https://electroniccats.com/store/bast-ble/) based on Nordic nRF 52840 and containing -a powerful Cortex M4F. This board include a external memory QSPI flash. - - -I2C pins `board.SCL1` and `board.SDA1` are not exposed and are used for onboard peripherals. - +a powerful Cortex M4F. This board include a external memory QSPI flash. diff --git a/ports/nrf/boards/bastble/board.c b/ports/nrf/boards/bastble/board.c index d91a915f19721..7c42cee57da98 100644 --- a/ports/nrf/boards/bastble/board.c +++ b/ports/nrf/boards/bastble/board.c @@ -29,7 +29,7 @@ #include "nrf_rtc.h" void board_init(void) { - + } bool board_requests_safe_mode(void) { From 33ca357094b58f136c3d9bdf30b73d297302cbbc Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Mon, 16 Nov 2020 22:10:37 -0600 Subject: [PATCH 197/770] fix VID and PID --- ports/nrf/boards/bastble/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/nrf/boards/bastble/mpconfigboard.mk b/ports/nrf/boards/bastble/mpconfigboard.mk index 9441b913b7288..0e01c4d0f36e7 100644 --- a/ports/nrf/boards/bastble/mpconfigboard.mk +++ b/ports/nrf/boards/bastble/mpconfigboard.mk @@ -1,4 +1,4 @@ -USB_VID = 0x2341 +USB_VID = 0x1209 USB_PID = 0x805A USB_PRODUCT = "BastBLE" USB_MANUFACTURER = "ElectronicCats" From 119e9d38202cb26f7f04d1050263e27e1083865a Mon Sep 17 00:00:00 2001 From: jgillick Date: Mon, 16 Nov 2020 23:50:00 -0800 Subject: [PATCH 198/770] Add Thunderpack 1.2 --- ports/stm/boards/thunderpack_v12/board.c | 38 ++ .../boards/thunderpack_v12/mpconfigboard.h | 61 +++ .../boards/thunderpack_v12/mpconfigboard.mk | 20 + ports/stm/boards/thunderpack_v12/pins.c | 39 ++ .../thunderpack_v12/stm32f4xx_hal_conf.h | 440 ++++++++++++++++++ ports/stm/common-hal/microcontroller/Pin.c | 33 ++ 6 files changed, 631 insertions(+) create mode 100644 ports/stm/boards/thunderpack_v12/board.c create mode 100644 ports/stm/boards/thunderpack_v12/mpconfigboard.h create mode 100644 ports/stm/boards/thunderpack_v12/mpconfigboard.mk create mode 100644 ports/stm/boards/thunderpack_v12/pins.c create mode 100644 ports/stm/boards/thunderpack_v12/stm32f4xx_hal_conf.h diff --git a/ports/stm/boards/thunderpack_v12/board.c b/ports/stm/boards/thunderpack_v12/board.c new file mode 100644 index 0000000000000..4421970eefe4d --- /dev/null +++ b/ports/stm/boards/thunderpack_v12/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/stm/boards/thunderpack_v12/mpconfigboard.h b/ports/stm/boards/thunderpack_v12/mpconfigboard.h new file mode 100644 index 0000000000000..4c71b8aeb2ea6 --- /dev/null +++ b/ports/stm/boards/thunderpack_v12/mpconfigboard.h @@ -0,0 +1,61 @@ +/* + * 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. + */ +#define MICROPY_HW_BOARD_NAME "THUNDERPACK_v12" +#define MICROPY_HW_MCU_NAME "STM32F411CE" + +// Non-volatile memory config +#define CIRCUITPY_INTERNAL_NVM_SIZE (0x4000) +#define CIRCUITPY_INTERNAL_NVM_START_ADDR (0x08010000) +#define CIRCUITPY_INTERNAL_NVM_SECTOR FLASH_SECTOR_4 + +// Putting the entire flash sector in the NVM byte array buffer +// would take up too much RAM. This limits how much of the sector we use. +#define NVM_BYTEARRAY_BUFFER_SIZE 512 + +// Flash config +#define FLASH_SIZE (0x80000) +#define FLASH_PAGE_SIZE (0x4000) +#define BOARD_FLASH_SIZE (FLASH_SIZE - CIRCUITPY_INTERNAL_NVM_SIZE- 0x2000 - 0xC000) + +// On-board flash +#define SPI_FLASH_MOSI_PIN (&pin_PB15) +#define SPI_FLASH_MISO_PIN (&pin_PB14) +#define SPI_FLASH_SCK_PIN (&pin_PB13) +#define SPI_FLASH_CS_PIN (&pin_PB12) + +// Status LEDs +#define MICROPY_HW_LED_STATUS (&pin_PA02) +#define MICROPY_HW_APA102_MOSI (&pin_PB08) +#define MICROPY_HW_APA102_SCK (&pin_PB00) + +// I2C +#define DEFAULT_I2C_BUS_SCL (&pin_PB06) +#define DEFAULT_I2C_BUS_SDA (&pin_PB07) + +// General config +#define BOARD_OSC_DIV (24) +#define BOARD_OVERWRITE_SWD (1) +#define BOARD_NO_VBUS_SENSE (1) \ No newline at end of file diff --git a/ports/stm/boards/thunderpack_v12/mpconfigboard.mk b/ports/stm/boards/thunderpack_v12/mpconfigboard.mk new file mode 100644 index 0000000000000..d11cfb750537d --- /dev/null +++ b/ports/stm/boards/thunderpack_v12/mpconfigboard.mk @@ -0,0 +1,20 @@ +USB_VID = 0x239A +USB_PID = 0x806A +USB_PRODUCT = "Thunderpack STM32F411" +USB_MANUFACTURER = "Jeremy Gillick" +USB_DEVICES = "CDC,MSC" + +LONGINT_IMPL = NONE + +SPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICE_COUNT = 1 +EXTERNAL_FLASH_DEVICES = GD25Q16C + +CIRCUITPY_NVM = 1 + +MCU_SERIES = F4 +MCU_VARIANT = STM32F411xE +MCU_PACKAGE = UFQFPN48 + +LD_COMMON = boards/common_nvm.ld +LD_FILE = boards/STM32F411_nvm.ld diff --git a/ports/stm/boards/thunderpack_v12/pins.c b/ports/stm/boards/thunderpack_v12/pins.c new file mode 100644 index 0000000000000..1e07621eaa1e6 --- /dev/null +++ b/ports/stm/boards/thunderpack_v12/pins.c @@ -0,0 +1,39 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR_PA0), MP_ROM_PTR(&pin_PA00) }, + { MP_ROM_QSTR(MP_QSTR_PA1), MP_ROM_PTR(&pin_PA01) }, + { MP_ROM_QSTR(MP_QSTR_PA2), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_PA3), MP_ROM_PTR(&pin_PA03) }, + { MP_ROM_QSTR(MP_QSTR_PA4), MP_ROM_PTR(&pin_PA04) }, + { MP_ROM_QSTR(MP_QSTR_PA5), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_PA6), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_PA7), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_PA8), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_PA9), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_PA10), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_PA13), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_PA14), MP_ROM_PTR(&pin_PA14) }, + + { MP_ROM_QSTR(MP_QSTR_PB0), MP_ROM_PTR(&pin_PB00) }, + { MP_ROM_QSTR(MP_QSTR_PB5), MP_ROM_PTR(&pin_PB05) }, + { MP_ROM_QSTR(MP_QSTR_PB6), MP_ROM_PTR(&pin_PB06) }, + { MP_ROM_QSTR(MP_QSTR_PB7), MP_ROM_PTR(&pin_PB07) }, + { MP_ROM_QSTR(MP_QSTR_PB8), MP_ROM_PTR(&pin_PB08) }, + + { MP_ROM_QSTR(MP_QSTR_LED1), MP_ROM_PTR(&pin_PA00) }, + { MP_ROM_QSTR(MP_QSTR_LED2), MP_ROM_PTR(&pin_PA01) }, + { MP_ROM_QSTR(MP_QSTR_LED3), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_LED4), MP_ROM_PTR(&pin_PA03) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PB04) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB06) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB07) }, + + { MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_PB08) }, + { MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_PB00) }, + + { 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/stm/boards/thunderpack_v12/stm32f4xx_hal_conf.h b/ports/stm/boards/thunderpack_v12/stm32f4xx_hal_conf.h new file mode 100644 index 0000000000000..5cb5634223585 --- /dev/null +++ b/ports/stm/boards/thunderpack_v12/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 + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * 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)24000000) /*!< 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/stm/common-hal/microcontroller/Pin.c b/ports/stm/common-hal/microcontroller/Pin.c index 2c513f4aadc6a..cf5cd754f484a 100644 --- a/ports/stm/common-hal/microcontroller/Pin.c +++ b/ports/stm/common-hal/microcontroller/Pin.c @@ -35,6 +35,10 @@ #ifdef MICROPY_HW_NEOPIXEL bool neopixel_in_use; #endif +#ifdef MICROPY_HW_APA102_MOSI +bool apa102_sck_in_use; +bool apa102_mosi_in_use; +#endif #if defined(LQFP144) #define GPIO_PORT_COUNT 7 @@ -66,6 +70,10 @@ void reset_all_pins(void) { #ifdef MICROPY_HW_NEOPIXEL neopixel_in_use = false; #endif + #ifdef MICROPY_HW_APA102_MOSI + apa102_sck_in_use = false; + apa102_mosi_in_use = false; + #endif } // Mark pin as free and return it to a quiescent state. @@ -85,6 +93,15 @@ void reset_pin_number(uint8_t pin_port, uint8_t pin_number) { return; } #endif + #ifdef MICROPY_HW_APA102_MOSI + if ((pin_port == MICROPY_HW_APA102_MOSI->port && pin_number == MICROPY_HW_APA102_MOSI->number) + || (pin_port == MICROPY_HW_APA102_SCK->port && pin_number == MICROPY_HW_APA102_MOSI->number)) { + apa102_mosi_in_use = false; + apa102_sck_in_use = false; + rgb_led_status_init(); + return; + } + #endif } void never_reset_pin_number(uint8_t pin_port, uint8_t pin_number) { @@ -108,6 +125,14 @@ void claim_pin(const mcu_pin_obj_t* pin) { neopixel_in_use = true; } #endif + #ifdef MICROPY_HW_APA102_MOSI + if (pin == MICROPY_HW_APA102_MOSI) { + apa102_mosi_in_use = true; + } + if (pin == MICROPY_HW_APA102_SCK) { + apa102_sck_in_use = true; + } + #endif } bool pin_number_is_free(uint8_t pin_port, uint8_t pin_number) { @@ -120,6 +145,14 @@ bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) { return !neopixel_in_use; } #endif + #ifdef MICROPY_HW_APA102_MOSI + if (pin == MICROPY_HW_APA102_MOSI) { + return !apa102_mosi_in_use; + } + if (pin == MICROPY_HW_APA102_SCK) { + return !apa102_sck_in_use; + } + #endif return pin_number_is_free(pin->port, pin->number); } From 7750b4d6712b410bd8ccc498e571297b4628884a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 17 Nov 2020 07:37:07 -0600 Subject: [PATCH 199/770] actions: Disable pagination of 'aws' commands An anticipatory workaround for https://docs.aws.amazon.com/cli/latest/userguide/cliv2-migration.html#cliv2-migration-output-pager --- .github/workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bd0dea5cf8c21..9c3c87b58630f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -119,6 +119,7 @@ jobs: zip -9r circuitpython-stubs.zip circuitpython-stubs [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp circuitpython-stubs.zip s3://adafruit-circuit-python/bin/stubs/circuitpython-stubs-${{ env.CP_VERSION }}.zip --no-progress --region us-east-1 env: + AWS_PAGER: '' AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) @@ -159,6 +160,7 @@ jobs: run: | [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-catalina-${{ env.CP_VERSION }} --no-progress --region us-east-1 env: + AWS_PAGER: '' AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) @@ -363,6 +365,7 @@ jobs: - name: Upload to S3 run: "[ -z \"$AWS_ACCESS_KEY_ID\" ] || aws s3 cp bin/ s3://adafruit-circuit-python/bin/ --recursive --no-progress --region us-east-1" env: + AWS_PAGER: '' AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) @@ -411,6 +414,7 @@ jobs: - name: Upload to S3 run: "[ -z \"$AWS_ACCESS_KEY_ID\" ] || aws s3 cp bin/ s3://adafruit-circuit-python/bin/ --recursive --no-progress --region us-east-1" env: + AWS_PAGER: '' AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) @@ -505,6 +509,7 @@ jobs: - name: Upload to S3 run: "[ -z \"$AWS_ACCESS_KEY_ID\" ] || aws s3 cp bin/ s3://adafruit-circuit-python/bin/ --recursive --no-progress --region us-east-1" env: + AWS_PAGER: '' AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) From a0d305042c335d55176a8f6951572b1a1b7629ba Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 17 Nov 2020 09:01:50 -0600 Subject: [PATCH 200/770] fix ubuntu-latest stragglers --- .github/workflows/build.yml | 2 +- .github/workflows/create_website_pr.yml | 2 +- .github/workflows/pre-commit.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9c3c87b58630f..f3e728a05cbd8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -419,7 +419,7 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) build-xtensa: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 needs: test strategy: fail-fast: false diff --git a/.github/workflows/create_website_pr.yml b/.github/workflows/create_website_pr.yml index 71959ffdcdc45..c8aca30e4a1c0 100644 --- a/.github/workflows/create_website_pr.yml +++ b/.github/workflows/create_website_pr.yml @@ -10,7 +10,7 @@ on: jobs: website: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Dump GitHub context env: diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index eac9bfe096ede..8caf56d2684f3 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -11,7 +11,7 @@ on: jobs: pre-commit: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v1 - uses: actions/setup-python@v1 From 0bbdf05936c1b36bee6ef4f9f81bd3b9ea40fbc6 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Fri, 13 Nov 2020 13:12:07 -0500 Subject: [PATCH 201/770] Implement recvfrom_into and sendto for UDP --- ports/esp32s2/Makefile | 1 + ports/esp32s2/common-hal/socketpool/Socket.c | 72 ++++++++++---------- shared-bindings/socketpool/Socket.c | 8 ++- shared-bindings/socketpool/Socket.h | 4 +- 4 files changed, 45 insertions(+), 40 deletions(-) diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 55d6e91d44cb7..a2e6cb73d9c63 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -188,6 +188,7 @@ SRC_C += \ lib/utils/pyexec.c \ lib/utils/stdout_helpers.c \ lib/utils/sys_stdio_mphal.c \ + lib/netutils/netutils.c \ peripherals/pcnt.c \ peripherals/pins.c \ peripherals/rmt.c \ diff --git a/ports/esp32s2/common-hal/socketpool/Socket.c b/ports/esp32s2/common-hal/socketpool/Socket.c index de9e6ad31bff1..937d199f21c8a 100644 --- a/ports/esp32s2/common-hal/socketpool/Socket.c +++ b/ports/esp32s2/common-hal/socketpool/Socket.c @@ -32,6 +32,11 @@ #include "py/runtime.h" #include "supervisor/shared/tick.h" +#include "components/lwip/lwip/src/include/lwip/err.h" +#include "components/lwip/lwip/src/include/lwip/sockets.h" +#include "components/lwip/lwip/src/include/lwip/sys.h" +#include "components/lwip/lwip/src/include/lwip/netdb.h" + void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t* self, mp_uint_t timeout_ms) { self->timeout_ms = timeout_ms; } @@ -122,58 +127,55 @@ mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, mp_uint_t common_hal_socketpool_socket_sendto(socketpool_socket_obj_t* self, const char* host, size_t hostlen, uint8_t port, const uint8_t* buf, mp_uint_t len) { - struct sockaddr_in dest_addr; - dest_addr.sin_addr.s_addr = inet_addr(HOST_IP_ADDR); - dest_addr.sin_family = AF_INET; - dest_addr.sin_port = htons(port); - - + // Get the IP address string const struct addrinfo hints = { .ai_family = AF_INET, .ai_socktype = SOCK_STREAM, }; - struct addrinfo *res; - int err = getaddrinfo(host, NULL, &hints, &res); - if (err != 0 || res == NULL) { - return mp_const_none; + struct addrinfo *result; + int error = lwip_getaddrinfo(host, NULL, &hints, &result); + if (error != 0 || result == NULL) { + return 0; } - #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wcast-align" - struct in_addr *addr = &((struct sockaddr_in *)res->ai_addr)->sin_addr; + struct in_addr *addr = &((struct sockaddr_in *)result->ai_addr)->sin_addr; #pragma GCC diagnostic pop char ip_str[IP4ADDR_STRLEN_MAX]; inet_ntoa_r(*addr, ip_str, IP4ADDR_STRLEN_MAX); - mp_obj_t ip_obj = mp_obj_new_str(ip_str, strlen(ip_str)); - freeaddrinfo(res); - + freeaddrinfo(result); + // Set parameters + struct sockaddr_in dest_addr; + dest_addr.sin_addr.s_addr = inet_addr((const char *)ip_str); + dest_addr.sin_family = AF_INET; + dest_addr.sin_port = htons(port); - int err = lwip_sendto(self->num, buf, len, 0 /* flags */, - (struct sockaddr *)&dest_addr, sizeof(dest_addr)); + int bytes_sent = lwip_sendto(self->num, buf, len, 0, (struct sockaddr *)&dest_addr, sizeof(dest_addr)); + if (bytes_sent < 0) { + mp_raise_BrokenPipeError(); + return 0; + } + return bytes_sent; } mp_uint_t common_hal_socketpool_socket_recvfrom_into(socketpool_socket_obj_t* self, - const uint8_t* buf, mp_uint_t len, uint8_t* ip, uint8_t port) { + uint8_t* buf, mp_uint_t len, uint8_t* ip, uint *port) { - const struct addrinfo hints = { - .ai_family = AF_INET, - .ai_socktype = SOCK_STREAM, - }; - struct addrinfo *res; - int err = getaddrinfo(host, NULL, &hints, &res); - if (err != 0 || res == NULL) { - return mp_const_none; - } + struct sockaddr_in source_addr; + socklen_t socklen = sizeof(source_addr); + int bytes_received = lwip_recvfrom(self->num, buf, len - 1, 0, (struct sockaddr *)&source_addr, &socklen); - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wcast-align" - struct in_addr *addr = &((struct sockaddr_in *)res->ai_addr)->sin_addr; - #pragma GCC diagnostic pop - char ip_str[IP4ADDR_STRLEN_MAX]; - inet_ntoa_r(*addr, ip_str, IP4ADDR_STRLEN_MAX); - mp_obj_t ip_obj = mp_obj_new_str(ip_str, strlen(ip_str)); - freeaddrinfo(res); + memcpy((void *)ip, (void*)&source_addr.sin_addr.s_addr, sizeof source_addr.sin_addr.s_addr); + *port = source_addr.sin_port; + + if (bytes_received < 0) { + mp_raise_BrokenPipeError(); + return 0; + } else { + buf[bytes_received] = 0; // Null-terminate whatever we received + return bytes_received; + } } void common_hal_socketpool_socket_close(socketpool_socket_obj_t* self) { diff --git a/shared-bindings/socketpool/Socket.c b/shared-bindings/socketpool/Socket.c index 591b7d8bbddd1..99e2c8fccbd3b 100644 --- a/shared-bindings/socketpool/Socket.c +++ b/shared-bindings/socketpool/Socket.c @@ -36,6 +36,8 @@ #include "py/runtime.h" #include "py/mperrno.h" +#include "lib/netutils/netutils.h" + //| class Socket: //| """TCP, UDP and RAW socket. Cannot be created directly. Instead, call //| `SocketPool.socket()`. @@ -298,7 +300,7 @@ STATIC mp_obj_t socketpool_socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_ mp_int_t port = mp_obj_get_int(addr_items[1]); mp_int_t ret = common_hal_socketpool_socket_sendto(self, host, hostlen, port, bufinfo.buf, bufinfo.len); - if (!ok) { + if (!ret) { mp_raise_OSError(0); } @@ -324,11 +326,11 @@ STATIC mp_obj_t socketpool_socket_recvfrom_into(mp_obj_t self_in, mp_obj_t data_ byte ip[4]; mp_uint_t port; mp_int_t ret = common_hal_socketpool_socket_recvfrom_into(self, - (byte*)bufinfo.buf, len, ip, &port); + (byte*)bufinfo.buf, bufinfo.len, ip, &port); mp_obj_t tuple_contents[2]; tuple_contents[0] = mp_obj_new_int_from_uint(ret); tuple_contents[1] = netutils_format_inet_addr(ip, port, NETUTILS_BIG); - return mp_obj_new_tuple(2, tuple); + return mp_obj_new_tuple(2, tuple_contents); } STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_recvfrom_into_obj, socketpool_socket_recvfrom_into); diff --git a/shared-bindings/socketpool/Socket.h b/shared-bindings/socketpool/Socket.h index 72a4c9e3c3df7..54fbe59b28993 100644 --- a/shared-bindings/socketpool/Socket.h +++ b/shared-bindings/socketpool/Socket.h @@ -36,9 +36,9 @@ bool common_hal_socketpool_socket_connect(socketpool_socket_obj_t* self, const c mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len); mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len); mp_uint_t common_hal_socketpool_socket_sendto(socketpool_socket_obj_t* self, - const uint8_t* host, size_t hostlen, uint8_t port, const uint8_t* buf, mp_uint_t len); + const char* host, size_t hostlen, uint8_t port, const uint8_t* buf, mp_uint_t len); mp_uint_t common_hal_socketpool_socket_recvfrom_into(socketpool_socket_obj_t* self, - const uint8_t* buf, mp_uint_t len, uint8_t* ip, uint8_t port); + uint8_t* buf, mp_uint_t len, uint8_t* ip, uint *port); void common_hal_socketpool_socket_close(socketpool_socket_obj_t* self); bool common_hal_socketpool_socket_get_closed(socketpool_socket_obj_t* self); bool common_hal_socketpool_socket_get_connected(socketpool_socket_obj_t* self); From 1bc770c3dc308b91184e8cab52f6f4cabdda99fc Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 17 Nov 2020 17:31:54 -0600 Subject: [PATCH 202/770] esp32s2: PulseIn: Fix supervisor tick enabling Before, there were two problems: * Even if a pulsein was never constructed, supervisor_disable_tick would occur during restart. This could cancel out a supervisor_enable_tick from someplace else, with unexpected results. * If two or more pulseins were constructed, each one would enable ticks, but only the last one deinited (or the reset routine) would disable, leaving ticks running indefinitely. In my testing, it seemed that this led to the board sometimes stopping when it should have auto-reloaded. --- ports/esp32s2/common-hal/pulseio/PulseIn.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/pulseio/PulseIn.c b/ports/esp32s2/common-hal/pulseio/PulseIn.c index f7429ec12c911..9feeea1479bdd 100644 --- a/ports/esp32s2/common-hal/pulseio/PulseIn.c +++ b/ports/esp32s2/common-hal/pulseio/PulseIn.c @@ -77,7 +77,9 @@ void pulsein_reset(void) { for (size_t i = 0; i < RMT_CHANNEL_MAX; i++) { handles[i] = NULL; } - supervisor_disable_tick(); + if (refcount != 0) { + supervisor_disable_tick(); + } refcount = 0; } @@ -122,8 +124,10 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self, const mcu // start RMT RX, and enable ticks so the core doesn't turn off. rmt_rx_start(channel, true); - supervisor_enable_tick(); refcount++; + if (refcount == 1) { + supervisor_enable_tick(); + } } bool common_hal_pulseio_pulsein_deinited(pulseio_pulsein_obj_t* self) { From 9206925bf8d2e3d8220b59200ee50c3e4c8a64d2 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 17 Nov 2020 17:45:12 -0600 Subject: [PATCH 203/770] esp32s2: port_get_raw_ticks: Use a more efficient, monotonic routine While trying to debug #3572, I noticed that I would frequently break in the midst of gettimeofday and that the routine get_adjusted_boot_time had to take and release locks. Furthermore, we don't want "adjusted" boot time, which could go forwards or backwards depending on the adjustment (such as setting the clock used by gettimeofday() to the network time) --- ports/esp32s2/supervisor/port.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 47d0c7f463e48..876ad739d6937 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -191,14 +191,14 @@ uint32_t port_get_saved_word(void) { } uint64_t port_get_raw_ticks(uint8_t* subticks) { - struct timeval tv_now; - gettimeofday(&tv_now, NULL); - // convert usec back to ticks - uint64_t all_subticks = (uint64_t)(tv_now.tv_usec * 2) / 71; + // Convert microseconds to subticks of 1/32768 seconds + // 32768/1000000 = 64/15625 in lowest terms + // this arithmetic overflows after 570 years + int64_t all_subticks = esp_timer_get_time() * 512 / 15625; if (subticks != NULL) { *subticks = all_subticks % 32; } - return (uint64_t)tv_now.tv_sec * 1024L + all_subticks / 32; + return all_subticks / 32; } // Enable 1/1024 second tick. From 8ae7b996278f379b6d40b2d3cf9729b5be53abd9 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Mon, 16 Nov 2020 23:32:22 +0000 Subject: [PATCH 204/770] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (848 of 848 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 491868979555a..4cf204ae81c22 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-10 15:30+0530\n" -"PO-Revision-Date: 2020-11-08 10:26+0000\n" +"PO-Revision-Date: 2020-11-18 00:28+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.3.2\n" +"X-Generator: Weblate 4.4-dev\n" #: main.c msgid "" @@ -447,7 +447,7 @@ msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Bit depth must be from 1 to 6 inclusive, not %d" -msgstr "" +msgstr "A profundidade dos bits deve ser de 1 até 6 inclusive, porém não %d" #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." @@ -1025,7 +1025,7 @@ msgstr "O tamanho do buffer está incorreto" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" -msgstr "" +msgstr "A inicialização falhou devido à falta de memória" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" @@ -3705,7 +3705,7 @@ msgstr "os vetores devem ter os mesmos comprimentos" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" -msgstr "" +msgstr "o watchdog não foi inicializado" #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" From ff987e7496152c3175608570d90f36753b4c4670 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 18 Nov 2020 12:16:14 +0530 Subject: [PATCH 205/770] add timer peripheral --- ports/esp32s2/Makefile | 1 + ports/esp32s2/peripherals/timer.c | 73 +++++++++++++++++++++++++++++++ ports/esp32s2/peripherals/timer.h | 41 +++++++++++++++++ ports/esp32s2/supervisor/port.c | 23 ++++++---- 4 files changed, 129 insertions(+), 9 deletions(-) create mode 100644 ports/esp32s2/peripherals/timer.c create mode 100644 ports/esp32s2/peripherals/timer.h diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 55d6e91d44cb7..931e4d0639076 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -188,6 +188,7 @@ SRC_C += \ lib/utils/pyexec.c \ lib/utils/stdout_helpers.c \ lib/utils/sys_stdio_mphal.c \ + peripherals/timer.c \ peripherals/pcnt.c \ peripherals/pins.c \ peripherals/rmt.c \ diff --git a/ports/esp32s2/peripherals/timer.c b/ports/esp32s2/peripherals/timer.c new file mode 100644 index 0000000000000..3aee33dc50b9b --- /dev/null +++ b/ports/esp32s2/peripherals/timer.c @@ -0,0 +1,73 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * 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 "peripherals/timer.h" + +#define TIMER_FREE 1 +#define TIMER_BUSY 0 + +static uint8_t timer_state[2][2]; + +void peripherals_timer_reset(void) { + timer_index_t timer; + for (uint8_t i = 0; i < 2; i++) { + for (uint8_t j = 0; j < 2; j++) { + if (timer_state[i][j] == TIMER_BUSY) { + timer.idx = (timer_idx_t)j; + timer.group = (timer_group_t)i; + timer_state[i][j] = TIMER_FREE; + peripherals_timer_deinit(&timer); + } + } + } +} + +void peripherals_timer_init(const timer_config_t * config, timer_index_t * timer) { + // get free timer + for (uint8_t i = 0; i < 2; i++) { + for (uint8_t j = 0; j < 2; j++) { + if (timer_state[i][j] == TIMER_FREE) { + timer->idx = (timer_idx_t)j; + timer->group = (timer_group_t)i; + timer_state[i][j] = TIMER_BUSY; + goto init_timer; + } else if (i == 1 && j == 1) { + timer->idx = TIMER_MAX; + timer->group = TIMER_GROUP_MAX; + return; + } + } + } + +init_timer: + // initialize timer module + timer_init(timer->group, timer->idx, config); + timer_set_counter_value(timer->group, timer->idx, 0); +} + +void peripherals_timer_deinit(timer_index_t * timer) { + timer_deinit(timer->group, timer->idx); +} diff --git a/ports/esp32s2/peripherals/timer.h b/ports/esp32s2/peripherals/timer.h new file mode 100644 index 0000000000000..8c9ebd91c9c91 --- /dev/null +++ b/ports/esp32s2/peripherals/timer.h @@ -0,0 +1,41 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_PERIPHERALS_TIMER_HANDLER_H +#define MICROPY_INCLUDED_ESP32S2_PERIPHERALS_TIMER_HANDLER_H + +#include "driver/timer.h" + +typedef struct { + timer_idx_t idx; + timer_group_t group; +} timer_index_t; + +extern void peripherals_timer_init(const timer_config_t * config, timer_index_t * timer); +extern void peripherals_timer_deinit(timer_index_t * timer); +extern void peripherals_timer_reset(void); + +#endif // MICROPY_INCLUDED_ESP32S2_PERIPHERALS_TIMER_HANDLER_H diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index ef032c4a76f62..4bf792516de52 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -50,6 +50,7 @@ #include "peripherals/rmt.h" #include "peripherals/pcnt.h" +#include "peripherals/timer.h" #include "components/heap/include/esp_heap_caps.h" #include "components/soc/soc/esp32s2/include/soc/cache_memory.h" @@ -103,15 +104,6 @@ void reset_port(void) { analogout_reset(); #endif -#if CIRCUITPY_PULSEIO - esp32s2_peripherals_rmt_reset(); - pulsein_reset(); -#endif - -#if CIRCUITPY_PWMIO - pwmout_reset(); -#endif - #if CIRCUITPY_BUSIO i2c_reset(); spi_reset(); @@ -122,6 +114,19 @@ void reset_port(void) { peripherals_pcnt_reset(); #endif +#if CIRCUITPY_FREQUENCYIO + peripherals_timer_reset(); +#endif + +#if CIRCUITPY_PULSEIO + esp32s2_peripherals_rmt_reset(); + pulsein_reset(); +#endif + +#if CIRCUITPY_PWMIO + pwmout_reset(); +#endif + #if CIRCUITPY_RTC rtc_reset(); #endif From c457d373e18a5bcadec44e0815bea8b9beb30a97 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 18 Nov 2020 12:24:48 +0530 Subject: [PATCH 206/770] update init_timer & frequency calculation --- .../common-hal/frequencyio/FrequencyIn.c | 55 ++++++++++++------- .../common-hal/frequencyio/FrequencyIn.h | 5 +- 2 files changed, 38 insertions(+), 22 deletions(-) diff --git a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c index 20d744139d89c..12d612abb0ab7 100644 --- a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c +++ b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.c @@ -29,7 +29,7 @@ #include "py/runtime.h" static void IRAM_ATTR pcnt_overflow_handler(void *self_in) { - frequencyio_frequencyin_obj_t* self = self_in; + frequencyio_frequencyin_obj_t * self = self_in; // reset counter pcnt_counter_clear(self->unit); @@ -41,18 +41,26 @@ static void IRAM_ATTR pcnt_overflow_handler(void *self_in) { } static void IRAM_ATTR timer_interrupt_handler(void *self_in) { - frequencyio_frequencyin_obj_t* self = self_in; + frequencyio_frequencyin_obj_t * self = self_in; // get counter value int16_t count; pcnt_get_counter_value(self->unit, &count); - self->frequency = count / 2.0 / self->capture_period; + self->frequency = ((count / 2.0) + (self->multiplier * INT16_MAX / 4.0)) / (self->capture_period); + + // reset multiplier + self->multiplier = 0; // reset counter pcnt_counter_clear(self->unit); // reset interrupt - TIMERG0.int_clr.t0 = 1; - TIMERG0.hw_timer[0].config.alarm_en = 1; + timg_dev_t *device = self->timer.group ? &(TIMERG1) : &(TIMERG0); + if (self->timer.idx) { + device->int_clr.t1 = 1; + } else { + device->int_clr.t0 = 1; + } + device->hw_timer[self->timer.idx].config.alarm_en = 1; } static void init_pcnt(frequencyio_frequencyin_obj_t* self) { @@ -70,7 +78,7 @@ static void init_pcnt(frequencyio_frequencyin_obj_t* self) { .counter_l_lim = 0, }; - // Initialize PCNT unit + // initialize PCNT const int8_t unit = peripherals_pcnt_init(pcnt_config); if (unit == -1) { mp_raise_RuntimeError(translate("All PCNT units in use")); @@ -98,15 +106,22 @@ static void init_timer(frequencyio_frequencyin_obj_t* self) { .divider = 80 // 1 us per tick }; - // Initialize timer module - timer_init(TIMER_GROUP_0, TIMER_0, &config); - timer_set_counter_value(TIMER_GROUP_0, TIMER_0, 0); - timer_set_alarm_value(TIMER_GROUP_0, TIMER_0, self->capture_period * 1000000); - timer_isr_register(TIMER_GROUP_0, TIMER_0, timer_interrupt_handler, (void *)self, ESP_INTR_FLAG_IRAM, &self->handle); - timer_enable_intr(TIMER_GROUP_0, TIMER_0); + // initialize Timer + peripherals_timer_init(&config, &self->timer); + if (self->timer.idx == TIMER_MAX || self->timer.group == TIMER_GROUP_MAX) { + mp_raise_RuntimeError(translate("All timers in use")); + } + + timer_idx_t idx = self->timer.idx; + timer_group_t group = self->timer.group; + + // enable timer interrupt + timer_set_alarm_value(group, idx, self->capture_period * 1000000); + timer_isr_register(group, idx, timer_interrupt_handler, (void *)self, ESP_INTR_FLAG_IRAM, &self->handle); + timer_enable_intr(group, idx); - // Start timer - timer_start(TIMER_GROUP_0, TIMER_0); + // start timer + timer_start(self->timer.group, self->timer.idx); } void common_hal_frequencyio_frequencyin_construct(frequencyio_frequencyin_obj_t* self, @@ -137,7 +152,7 @@ void common_hal_frequencyio_frequencyin_deinit(frequencyio_frequencyin_obj_t* se } reset_pin_number(self->pin); peripherals_pcnt_deinit(&self->unit); - timer_deinit(TIMER_GROUP_0, TIMER_0); + peripherals_timer_deinit(&self->timer); if (self->handle) { esp_intr_free(self->handle); self->handle = NULL; @@ -145,23 +160,23 @@ void common_hal_frequencyio_frequencyin_deinit(frequencyio_frequencyin_obj_t* se } uint32_t common_hal_frequencyio_frequencyin_get_item(frequencyio_frequencyin_obj_t* self) { - return (self->frequency + (self->multiplier * INT16_MAX)); + return self->frequency; } void common_hal_frequencyio_frequencyin_pause(frequencyio_frequencyin_obj_t* self) { pcnt_counter_pause(self->unit); - timer_pause(TIMER_GROUP_0, TIMER_0); + timer_pause(self->timer.group, self->timer.idx); } void common_hal_frequencyio_frequencyin_resume(frequencyio_frequencyin_obj_t* self) { pcnt_counter_resume(self->unit); - timer_start(TIMER_GROUP_0, TIMER_0); + timer_start(self->timer.group, self->timer.idx); } void common_hal_frequencyio_frequencyin_clear(frequencyio_frequencyin_obj_t* self) { self->frequency = 0; pcnt_counter_clear(self->unit); - timer_set_counter_value(TIMER_GROUP_0, TIMER_0, 0); + timer_set_counter_value(self->timer.group, self->timer.idx, 0); } uint16_t common_hal_frequencyio_frequencyin_get_capture_period(frequencyio_frequencyin_obj_t *self) { @@ -174,5 +189,5 @@ void common_hal_frequencyio_frequencyin_set_capture_period(frequencyio_frequency } self->capture_period = capture_period; common_hal_frequencyio_frequencyin_clear(self); - timer_set_alarm_value(TIMER_GROUP_0, TIMER_0, capture_period * 1000000); + timer_set_alarm_value(self->timer.group, self->timer.idx, capture_period * 1000000); } diff --git a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.h b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.h index ce3bf8f2f9d15..cf9d2ae538433 100644 --- a/ports/esp32s2/common-hal/frequencyio/FrequencyIn.h +++ b/ports/esp32s2/common-hal/frequencyio/FrequencyIn.h @@ -28,16 +28,17 @@ #define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_FREQUENCYIO_FREQUENCYIN_H #include "py/obj.h" -#include "driver/timer.h" #include "peripherals/pcnt.h" +#include "peripherals/timer.h" typedef struct { mp_obj_base_t base; pcnt_unit_t unit; + timer_index_t timer; intr_handle_t handle; uint8_t pin; uint8_t multiplier; - uint16_t frequency; + uint32_t frequency; uint16_t capture_period; } frequencyio_frequencyin_obj_t; From bab41afce759916af15ab57645691336ea2bdd06 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 18 Nov 2020 12:34:56 +0530 Subject: [PATCH 207/770] ps2io implementation for esp32s2 --- ports/esp32s2/common-hal/ps2io/Ps2.c | 393 ++++++++++++++++++++++ ports/esp32s2/common-hal/ps2io/Ps2.h | 60 ++++ ports/esp32s2/common-hal/ps2io/__init__.c | 1 + ports/esp32s2/mpconfigport.mk | 4 + 4 files changed, 458 insertions(+) create mode 100644 ports/esp32s2/common-hal/ps2io/Ps2.c create mode 100644 ports/esp32s2/common-hal/ps2io/Ps2.h create mode 100644 ports/esp32s2/common-hal/ps2io/__init__.c diff --git a/ports/esp32s2/common-hal/ps2io/Ps2.c b/ports/esp32s2/common-hal/ps2io/Ps2.c new file mode 100644 index 0000000000000..2156a4247993d --- /dev/null +++ b/ports/esp32s2/common-hal/ps2io/Ps2.c @@ -0,0 +1,393 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "common-hal/ps2io/Ps2.h" + +#include "py/runtime.h" +#include "supervisor/port.h" +#include "shared-bindings/ps2io/Ps2.h" +#include "shared-bindings/microcontroller/__init__.h" + +#define STATE_IDLE 0 +#define STATE_RECV 1 +#define STATE_RECV_PARITY 2 +#define STATE_RECV_STOP 3 +#define STATE_RECV_ERR 10 + +#define ERROR_STARTBIT 0x01 +#define ERROR_TIMEOUT 0x02 +#define ERROR_PARITY 0x04 +#define ERROR_STOPBIT 0x08 +#define ERROR_BUFFER 0x10 + +#define ERROR_TX_CLKLO 0x100 +#define ERROR_TX_CLKHI 0x200 +#define ERROR_TX_ACKDATA 0x400 +#define ERROR_TX_ACKCLK 0x800 +#define ERROR_TX_RTS 0x1000 +#define ERROR_TX_NORESP 0x2000 + +static void IRAM_ATTR ps2_interrupt_handler(void *self_in); + +static void ps2_set_config(ps2io_ps2_obj_t* self) { + // turn on falling edge interrupt + gpio_set_intr_type(self->clk_pin, GPIO_INTR_NEGEDGE); + gpio_isr_register(ps2_interrupt_handler, (void *)self, ESP_INTR_FLAG_IRAM, &self->handle); + gpio_intr_enable(self->clk_pin); +} + +static void disable_interrupt(ps2io_ps2_obj_t* self) { + // turn off fallling edge interrupt + gpio_intr_disable(self->clk_pin); +} + +static void resume_interrupt(ps2io_ps2_obj_t* self) { + self->state = STATE_IDLE; + gpio_intr_enable(self->clk_pin); +} + +static void clk_hi(ps2io_ps2_obj_t* self) { + // external pull-up + gpio_set_direction(self->clk_pin, GPIO_MODE_INPUT); + gpio_pullup_dis(self->clk_pin); +} + +static bool wait_clk_lo(ps2io_ps2_obj_t* self, uint32_t us) { + clk_hi(self); + common_hal_mcu_delay_us(1); + while (gpio_get_level(self->clk_pin) && us) { + --us; + common_hal_mcu_delay_us(1); + } + return us; +} + +static bool wait_clk_hi(ps2io_ps2_obj_t* self, uint32_t us) { + clk_hi(self); + common_hal_mcu_delay_us(1); + while (!gpio_get_level(self->clk_pin) && us) { + --us; + common_hal_mcu_delay_us(1); + } + return us; +} + +static void clk_lo(ps2io_ps2_obj_t* self) { + gpio_pullup_dis(self->clk_pin); + gpio_set_direction(self->clk_pin, GPIO_MODE_OUTPUT); + gpio_set_level(self->clk_pin, 0); +} + +static void data_hi(ps2io_ps2_obj_t* self) { + // external pull-up + gpio_set_direction(self->data_pin, GPIO_MODE_INPUT); + gpio_pullup_dis(self->data_pin); +} + +static bool wait_data_lo(ps2io_ps2_obj_t* self, uint32_t us) { + data_hi(self); + common_hal_mcu_delay_us(1); + while (gpio_get_level(self->data_pin) && us) { + --us; + common_hal_mcu_delay_us(1); + } + return us; +} + +static bool wait_data_hi(ps2io_ps2_obj_t* self, uint32_t us) { + data_hi(self); + common_hal_mcu_delay_us(1); + while (!gpio_get_level(self->data_pin) && us) { + --us; + common_hal_mcu_delay_us(1); + } + return us; +} + +static void data_lo(ps2io_ps2_obj_t* self) { + gpio_pullup_dis(self->data_pin); + gpio_set_direction(self->data_pin, GPIO_MODE_OUTPUT); + gpio_set_level(self->data_pin, 0); +} + +static void idle(ps2io_ps2_obj_t* self) { + clk_hi(self); + data_hi(self); +} + +static void inhibit(ps2io_ps2_obj_t* self) { + clk_lo(self); + data_hi(self); +} + +static void delay_us(uint32_t t) { + common_hal_mcu_delay_us(t); +} + +static void IRAM_ATTR ps2_interrupt_handler(void *self_in) { + // Grab the current time first. + uint64_t current_tick = port_get_raw_ticks(NULL); + + ps2io_ps2_obj_t * self = self_in; + int data_bit = gpio_get_level(self->data_pin) ? 1 : 0; + + // test for timeout + if (self->state != STATE_IDLE) { + int64_t diff_ms = current_tick - self->last_raw_ticks; + if (diff_ms > 1) { // a.k.a. > 1.001ms + self->last_errors |= ERROR_TIMEOUT; + self->state = STATE_IDLE; + } + } + + self->last_raw_ticks = current_tick; + + if (self->state == STATE_IDLE) { + self->bits = 0; + self->parity = false; + self->bitcount = 0; + self->state = STATE_RECV; + if (data_bit) { + // start bit should be 0 + self->last_errors |= ERROR_STARTBIT; + self->state = STATE_RECV_ERR; + } else { + self->state = STATE_RECV; + } + + } else if (self->state == STATE_RECV) { + if (data_bit) { + self->bits |= data_bit << self->bitcount; + self->parity = !self->parity; + } + ++self->bitcount; + if (self->bitcount >= 8) { + self->state = STATE_RECV_PARITY; + } + + } else if (self->state == STATE_RECV_PARITY) { + ++self->bitcount; + if (data_bit) { + self->parity = !self->parity; + } + if (!self->parity) { + self->last_errors |= ERROR_PARITY; + self->state = STATE_RECV_ERR; + } else { + self->state = STATE_RECV_STOP; + } + + } else if (self->state == STATE_RECV_STOP) { + ++self->bitcount; + if (! data_bit) { + self->last_errors |= ERROR_STOPBIT; + } else if (self->waiting_cmd_response) { + self->cmd_response = self->bits; + self->waiting_cmd_response = false; + } else if (self->bufcount >= sizeof(self->buffer)) { + self->last_errors |= ERROR_BUFFER; + } else { + self->buffer[self->bufposw] = self->bits; + self->bufposw = (self->bufposw + 1) % sizeof(self->buffer); + self->bufcount++; + } + self->state = STATE_IDLE; + + } else if (self->state == STATE_RECV_ERR) { + // just count the bits until idle + if (++self->bitcount >= 10) { + self->state = STATE_IDLE; + } + } +} + +void common_hal_ps2io_ps2_construct(ps2io_ps2_obj_t* self, + const mcu_pin_obj_t* data_pin, const mcu_pin_obj_t* clk_pin) { + clk_hi(self); + data_hi(self); + + self->clk_pin = (gpio_num_t)clk_pin->number; + self->data_pin = (gpio_num_t)data_pin->number; + self->state = STATE_IDLE; + self->bufcount = 0; + self->bufposr = 0; + self->bufposw = 0; + self->waiting_cmd_response = false; + + claim_pin(clk_pin); + claim_pin(data_pin); + + // set config will enable the interrupt. + ps2_set_config(self); +} + +bool common_hal_ps2io_ps2_deinited(ps2io_ps2_obj_t* self) { + return self->clk_pin == GPIO_NUM_MAX; +} + +void common_hal_ps2io_ps2_deinit(ps2io_ps2_obj_t* self) { + if (common_hal_ps2io_ps2_deinited(self)) { + return; + } + if (self->handle) { + esp_intr_free(self->handle); + self->handle = NULL; + } + reset_pin_number(self->clk_pin); + reset_pin_number(self->data_pin); + self->clk_pin = GPIO_NUM_MAX; + self->data_pin = GPIO_NUM_MAX; +} + +uint16_t common_hal_ps2io_ps2_get_len(ps2io_ps2_obj_t* self) { + return self->bufcount; +} + +int16_t common_hal_ps2io_ps2_popleft(ps2io_ps2_obj_t* self) { + common_hal_mcu_disable_interrupts(); + if (self->bufcount <= 0) { + common_hal_mcu_enable_interrupts(); + return -1; + } + uint8_t b = self->buffer[self->bufposr]; + self->bufposr = (self->bufposr + 1) % sizeof(self->buffer); + self->bufcount -= 1; + common_hal_mcu_enable_interrupts(); + return b; +} + +uint16_t common_hal_ps2io_ps2_clear_errors(ps2io_ps2_obj_t* self) { + common_hal_mcu_disable_interrupts(); + uint16_t errors = self->last_errors; + self->last_errors = 0; + common_hal_mcu_enable_interrupts(); + return errors; +} + +// Based upon TMK implementation of PS/2 protocol +// https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/protocol/ps2_interrupt.c + +int16_t common_hal_ps2io_ps2_sendcmd(ps2io_ps2_obj_t* self, uint8_t b) { + disable_interrupt(self); + inhibit(self); + delay_us(100); + + /* RTS and start bit */ + data_lo(self); + clk_hi(self); + if (!wait_clk_lo(self, 10000)) { + self->last_errors |= ERROR_TX_RTS; + goto ERROR; + } + + bool parity = true; + for (uint8_t i = 0; i < 8; i++) { + delay_us(15); + if (b & (1 << i)) { + parity = !parity; + data_hi(self); + } else { + data_lo(self); + } + if (!wait_clk_hi(self, 50)) { + self->last_errors |= ERROR_TX_CLKHI; + goto ERROR; + } + if (!wait_clk_lo(self, 50)) { + self->last_errors |= ERROR_TX_CLKLO; + goto ERROR; + } + } + + delay_us(15); + if (parity) { + data_hi(self); + } else { + data_lo(self); + } + if (!wait_clk_hi(self, 50)) { + self->last_errors |= ERROR_TX_CLKHI; + goto ERROR; + } + if (!wait_clk_lo(self, 50)) { + self->last_errors |= ERROR_TX_CLKLO; + goto ERROR; + } + + /* Stop bit */ + delay_us(15); + data_hi(self); + + /* Ack */ + if (!wait_data_lo(self, 50)) { + self->last_errors |= ERROR_TX_ACKDATA; + goto ERROR; + } + if (!wait_clk_lo(self, 50)) { + self->last_errors |= ERROR_TX_ACKCLK; + goto ERROR; + } + + /* wait for idle state */ + if (!wait_clk_hi(self, 50)) { + self->last_errors |= ERROR_TX_ACKCLK; + goto ERROR; + } + if (!wait_data_hi(self, 50)) { + self->last_errors |= ERROR_TX_ACKDATA; + goto ERROR; + } + + /* Wait for response byte */ + self->waiting_cmd_response = true; + idle(self); + resume_interrupt(self); + + for (int i = 0; i < 25; ++i) { + delay_us(1000); + common_hal_mcu_disable_interrupts(); + bool has_response = !self->waiting_cmd_response; + uint8_t response = self->cmd_response; + common_hal_mcu_enable_interrupts(); + + if (has_response) { + return response; + } + } + + /* No response */ + common_hal_mcu_disable_interrupts(); + self->waiting_cmd_response = false; + self->last_errors |= ERROR_TX_NORESP; + common_hal_mcu_enable_interrupts(); + return -1; + + /* Other errors */ +ERROR: + idle(self); + resume_interrupt(self); + return -1; +} diff --git a/ports/esp32s2/common-hal/ps2io/Ps2.h b/ports/esp32s2/common-hal/ps2io/Ps2.h new file mode 100644 index 0000000000000..51ebde4487490 --- /dev/null +++ b/ports/esp32s2/common-hal/ps2io/Ps2.h @@ -0,0 +1,60 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PS2IO_PS2_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PS2IO_PS2_H + +#include "common-hal/microcontroller/Pin.h" + +#include "py/obj.h" +#include "driver/gpio.h" + +typedef struct { + mp_obj_base_t base; + gpio_num_t clk_pin; + gpio_num_t data_pin; + + uint8_t state; + uint64_t last_raw_ticks; + + uint16_t bits; + bool parity; + uint8_t bitcount; + + uint8_t buffer[16]; + uint8_t bufcount; + uint8_t bufposr; + uint8_t bufposw; + + uint16_t last_errors; + + bool waiting_cmd_response; + uint8_t cmd_response; + + intr_handle_t handle; +} ps2io_ps2_obj_t; + +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PS2IO_PS2_H diff --git a/ports/esp32s2/common-hal/ps2io/__init__.c b/ports/esp32s2/common-hal/ps2io/__init__.c new file mode 100644 index 0000000000000..ba4b4249f7330 --- /dev/null +++ b/ports/esp32s2/common-hal/ps2io/__init__.c @@ -0,0 +1 @@ +// No ps2io module functions. diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index 335d2caf7280a..26bb5161147ff 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -28,6 +28,10 @@ CIRCUITPY_WIFI = 1 CIRCUITPY_WATCHDOG ?= 1 CIRCUITPY_ESPIDF = 1 +ifndef CIRCUITPY_PS2IO +CIRCUITPY_PS2IO = 1 +endif + ifndef CIRCUITPY_TOUCHIO_USE_NATIVE CIRCUITPY_TOUCHIO_USE_NATIVE = 1 endif From 0d3e81f969adc6d8744e8e720ec4b01848a8fa6c Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 18 Nov 2020 22:22:42 +0530 Subject: [PATCH 208/770] update interrupt handling --- ports/esp32s2/common-hal/ps2io/Ps2.c | 13 +++++-------- ports/esp32s2/common-hal/ps2io/Ps2.h | 2 -- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/ports/esp32s2/common-hal/ps2io/Ps2.c b/ports/esp32s2/common-hal/ps2io/Ps2.c index 2156a4247993d..9c19ea950ee25 100644 --- a/ports/esp32s2/common-hal/ps2io/Ps2.c +++ b/ports/esp32s2/common-hal/ps2io/Ps2.c @@ -55,18 +55,18 @@ static void IRAM_ATTR ps2_interrupt_handler(void *self_in); static void ps2_set_config(ps2io_ps2_obj_t* self) { // turn on falling edge interrupt gpio_set_intr_type(self->clk_pin, GPIO_INTR_NEGEDGE); - gpio_isr_register(ps2_interrupt_handler, (void *)self, ESP_INTR_FLAG_IRAM, &self->handle); - gpio_intr_enable(self->clk_pin); + gpio_install_isr_service(ESP_INTR_FLAG_IRAM); + gpio_isr_handler_add(self->clk_pin, ps2_interrupt_handler, (void*)self); } static void disable_interrupt(ps2io_ps2_obj_t* self) { // turn off fallling edge interrupt - gpio_intr_disable(self->clk_pin); + gpio_isr_handler_remove(self->clk_pin); } static void resume_interrupt(ps2io_ps2_obj_t* self) { self->state = STATE_IDLE; - gpio_intr_enable(self->clk_pin); + gpio_isr_handler_add(self->clk_pin, ps2_interrupt_handler, (void*)self); } static void clk_hi(ps2io_ps2_obj_t* self) { @@ -252,10 +252,7 @@ void common_hal_ps2io_ps2_deinit(ps2io_ps2_obj_t* self) { if (common_hal_ps2io_ps2_deinited(self)) { return; } - if (self->handle) { - esp_intr_free(self->handle); - self->handle = NULL; - } + gpio_uninstall_isr_service(); reset_pin_number(self->clk_pin); reset_pin_number(self->data_pin); self->clk_pin = GPIO_NUM_MAX; diff --git a/ports/esp32s2/common-hal/ps2io/Ps2.h b/ports/esp32s2/common-hal/ps2io/Ps2.h index 51ebde4487490..eb93829b46c5e 100644 --- a/ports/esp32s2/common-hal/ps2io/Ps2.h +++ b/ports/esp32s2/common-hal/ps2io/Ps2.h @@ -53,8 +53,6 @@ typedef struct { bool waiting_cmd_response; uint8_t cmd_response; - - intr_handle_t handle; } ps2io_ps2_obj_t; #endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PS2IO_PS2_H From 83d790ad8f7838d70269d0f0add6de1199198227 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 18 Nov 2020 17:45:42 -0600 Subject: [PATCH 209/770] esp32s2: don't delete the event loop .. it seems to make the esp-idf grumpy. --- ports/esp32s2/common-hal/wifi/__init__.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/esp32s2/common-hal/wifi/__init__.c b/ports/esp32s2/common-hal/wifi/__init__.c index 2eb3719b4d8bc..1b244dd2ff802 100644 --- a/ports/esp32s2/common-hal/wifi/__init__.c +++ b/ports/esp32s2/common-hal/wifi/__init__.c @@ -143,7 +143,6 @@ void wifi_reset(void) { radio->handler_instance_got_ip)); ESP_ERROR_CHECK(esp_wifi_deinit()); esp_netif_destroy(radio->netif); - ESP_ERROR_CHECK(esp_event_loop_delete_default()); radio->netif = NULL; } From f61f8f999b5eeb8a545f5cea13b30ac5b3aeb04a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 18 Nov 2020 18:06:31 -0600 Subject: [PATCH 210/770] EPaperDisplay: add rotation property untested, because I don't want to mess my magtag demo up :) but it builds --- shared-bindings/displayio/EPaperDisplay.c | 24 +++++++++++++++++++++++ shared-bindings/displayio/EPaperDisplay.h | 2 ++ shared-module/displayio/EPaperDisplay.c | 23 ++++++++++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index ebff6400854a7..4f5c47acabcab 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -294,6 +294,29 @@ const mp_obj_property_t displayio_epaperdisplay_height_obj = { (mp_obj_t)&mp_const_none_obj}, }; +//| rotation: int +//| """The rotation of the display as an int in degrees.""" +//| +STATIC mp_obj_t displayio_epaperdisplay_obj_get_rotation(mp_obj_t self_in) { + displayio_epaperdisplay_obj_t *self = native_display(self_in); + return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_epaperdisplay_get_rotation(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_get_rotation_obj, displayio_epaperdisplay_obj_get_rotation); +STATIC mp_obj_t displayio_epaperdisplay_obj_set_rotation(mp_obj_t self_in, mp_obj_t value) { + displayio_epaperdisplay_obj_t *self = native_display(self_in); + common_hal_displayio_epaperdisplay_set_rotation(self, mp_obj_get_int(value)); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(displayio_epaperdisplay_set_rotation_obj, displayio_epaperdisplay_obj_set_rotation); + + +const mp_obj_property_t displayio_epaperdisplay_rotation_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&displayio_epaperdisplay_get_rotation_obj, + (mp_obj_t)&displayio_epaperdisplay_set_rotation_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + //| bus: _DisplayBus //| """The bus being used by the display""" //| @@ -317,6 +340,7 @@ STATIC const mp_rom_map_elem_t displayio_epaperdisplay_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_epaperdisplay_width_obj) }, { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_epaperdisplay_height_obj) }, + { MP_ROM_QSTR(MP_QSTR_rotation), MP_ROM_PTR(&displayio_epaperdisplay_rotation_obj) }, { MP_ROM_QSTR(MP_QSTR_bus), MP_ROM_PTR(&displayio_epaperdisplay_bus_obj) }, { MP_ROM_QSTR(MP_QSTR_busy), MP_ROM_PTR(&displayio_epaperdisplay_busy_obj) }, { MP_ROM_QSTR(MP_QSTR_time_to_refresh), MP_ROM_PTR(&displayio_epaperdisplay_time_to_refresh_obj) }, diff --git a/shared-bindings/displayio/EPaperDisplay.h b/shared-bindings/displayio/EPaperDisplay.h index f785203a41a44..14d4f6aa9a7b0 100644 --- a/shared-bindings/displayio/EPaperDisplay.h +++ b/shared-bindings/displayio/EPaperDisplay.h @@ -56,6 +56,8 @@ bool common_hal_displayio_epaperdisplay_get_busy(displayio_epaperdisplay_obj_t* uint16_t common_hal_displayio_epaperdisplay_get_width(displayio_epaperdisplay_obj_t* self); uint16_t common_hal_displayio_epaperdisplay_get_height(displayio_epaperdisplay_obj_t* self); +uint16_t common_hal_displayio_epaperdisplay_get_rotation(displayio_epaperdisplay_obj_t* self); +void common_hal_displayio_epaperdisplay_set_rotation(displayio_epaperdisplay_obj_t* self, int rotation); mp_obj_t common_hal_displayio_epaperdisplay_get_bus(displayio_epaperdisplay_obj_t* self); diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index 1b285b4b1dd1f..3fb37ff21916c 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -198,6 +198,29 @@ mp_obj_t common_hal_displayio_epaperdisplay_get_bus(displayio_epaperdisplay_obj_ return self->core.bus; } +void common_hal_displayio_epaperdisplay_set_rotation(displayio_epaperdisplay_obj_t* self, int rotation){ + bool transposed = (self->core.rotation == 90 || self->core.rotation == 270); + bool will_transposed = (rotation == 90 || rotation == 270); + if(transposed != will_transposed) { + int tmp = self->core.width; + self->core.width = self->core.height; + self->core.height = tmp; + } + displayio_display_core_set_rotation(&self->core, rotation); + if (self == &displays[0].epaper_display) { + supervisor_stop_terminal(); + supervisor_start_terminal(self->core.width, self->core.height); + } + if (self->core.current_group != NULL) { + displayio_group_update_transform(self->core.current_group, &self->core.transform); + } +} + +uint16_t common_hal_displayio_epaperdisplay_get_rotation(displayio_epaperdisplay_obj_t* self){ + return self->core.rotation; +} + + bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t* self, const displayio_area_t* area) { uint16_t buffer_size = 128; // In uint32_ts From 2463a6d6ac3fb53fa471c77bc585c8ef350d2b96 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 18 Nov 2020 16:28:21 -0800 Subject: [PATCH 211/770] Fix Palette grayscale for EInk. It needs to do the bitmasking that was only added to ColorConverter in #3611 --- shared-module/displayio/Palette.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shared-module/displayio/Palette.c b/shared-module/displayio/Palette.c index facb1fa732dfd..ba5ff665c9320 100644 --- a/shared-module/displayio/Palette.c +++ b/shared-module/displayio/Palette.c @@ -83,7 +83,8 @@ bool displayio_palette_get_color(displayio_palette_t *self, const _displayio_col uint8_t pixel_hue = self->colors[palette_index].hue; displayio_colorconverter_compute_tricolor(colorspace, pixel_hue, luma, color); } else if (colorspace->grayscale) { - *color = self->colors[palette_index].luma >> (8 - colorspace->depth); + size_t bitmask = (1 << colorspace->depth) - 1; + *color = (self->colors[palette_index].luma >> colorspace->grayscale_bit) & bitmask; } else { uint16_t packed = self->colors[palette_index].rgb565; if (colorspace->reverse_bytes_in_word) { From 081aec44290cdacc2a28cf8b5c01d34c3d681d93 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 18 Nov 2020 16:39:34 -0800 Subject: [PATCH 212/770] Retry connection when getting NOT_AUTHED I saw it once with a correct password. Retrying may still fail but at least it'll try first. --- ports/esp32s2/common-hal/wifi/__init__.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/esp32s2/common-hal/wifi/__init__.c b/ports/esp32s2/common-hal/wifi/__init__.c index 2eb3719b4d8bc..70f1d98cba0fc 100644 --- a/ports/esp32s2/common-hal/wifi/__init__.c +++ b/ports/esp32s2/common-hal/wifi/__init__.c @@ -59,6 +59,7 @@ static void event_handler(void* arg, esp_event_base_t event_base, ESP_EARLY_LOGW(TAG, "reason %d 0x%02x", reason, reason); if (radio->retries_left > 0 && (reason == WIFI_REASON_AUTH_EXPIRE || + reason == WIFI_REASON_NOT_AUTHED || reason == WIFI_REASON_ASSOC_EXPIRE || reason == WIFI_REASON_CONNECTION_FAIL || reason == WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT)) { From b98835a1d787f3d1e20eb29bf65ca8cf41d9abf0 Mon Sep 17 00:00:00 2001 From: hexthat Date: Wed, 18 Nov 2020 01:12:46 +0000 Subject: [PATCH 213/770] Translated using Weblate (Chinese (Pinyin)) Currently translated at 100.0% (848 of 848 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/ --- locale/zh_Latn_pinyin.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index dd44aab9396d1..e94ae8173ff99 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-10 15:30+0530\n" -"PO-Revision-Date: 2020-11-15 16:28+0000\n" +"PO-Revision-Date: 2020-11-19 01:28+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" "Language: zh_Latn_pinyin\n" @@ -1012,7 +1012,7 @@ msgstr "Huǎnchōng qū dàxiǎo bù zhèngquè" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" -msgstr "" +msgstr "yóu yú nèi cún bù zú, chū shǐ huà shī bài" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" @@ -3661,7 +3661,7 @@ msgstr "xiàngliàng bìxū jùyǒu xiāngtóng de chángdù" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" -msgstr "" +msgstr "wèi chū shǐ huà jiān shì qì" #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" From b9bec87f2930787cb1d2f3baea8284985a0062d5 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 18 Nov 2020 17:38:06 -0800 Subject: [PATCH 214/770] Update build board info. * Don't add full urls because they are too large. * Remove the unstable version when it starts with the current version. --- tools/build_board_info.py | 137 +++++++++++++++++++------------------- 1 file changed, 70 insertions(+), 67 deletions(-) diff --git a/tools/build_board_info.py b/tools/build_board_info.py index f83282ea9dca7..ce9d45fe2f9e6 100644 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -19,20 +19,24 @@ sys.path.append("adabot") import adabot.github_requests as github -SUPPORTED_PORTS = ["atmel-samd", "cxd56", "esp32s2", "litex", "mimxrt10xx", "nrf", "stm"] - -BIN = ('bin',) -UF2 = ('uf2',) -BIN_UF2 = ('bin', 'uf2') -HEX = ('hex',) -HEX_UF2 = ('hex', 'uf2') -SPK = ('spk',) -DFU = ('dfu',) -BIN_DFU = ('bin', 'dfu') - -# Example: -# https://downloads.circuitpython.org/bin/trinket_m0/en_US/adafruit-circuitpython-trinket_m0-en_US-5.0.0-rc.0.uf2 -DOWNLOAD_BASE_URL = "https://downloads.circuitpython.org/bin" +SUPPORTED_PORTS = [ + "atmel-samd", + "cxd56", + "esp32s2", + "litex", + "mimxrt10xx", + "nrf", + "stm", +] + +BIN = ("bin",) +UF2 = ("uf2",) +BIN_UF2 = ("bin", "uf2") +HEX = ("hex",) +HEX_UF2 = ("hex", "uf2") +SPK = ("spk",) +DFU = ("dfu",) +BIN_DFU = ("bin", "dfu") # Default extensions extension_by_port = { @@ -42,7 +46,7 @@ "cxd56": SPK, "mimxrt10xx": HEX_UF2, "litex": DFU, - "esp32s2": BIN_UF2 + "esp32s2": BIN_UF2, } # Per board overrides @@ -57,26 +61,28 @@ "feather_m0_rfm69": BIN_UF2, "feather_m0_rfm9x": BIN_UF2, "uchip": BIN_UF2, - # nRF52840 dev kits that may not have UF2 bootloaders, "makerdiary_nrf52840_mdk": HEX, "makerdiary_nrf52840_mdk_usb_dongle": HEX_UF2, "pca10056": BIN_UF2, "pca10059": BIN_UF2, "electronut_labs_blip": HEX, - # stm32 - "meowbit_v121": UF2 + "meowbit_v121": UF2, } aliases_by_board = { - "circuitplayground_express": ["circuitplayground_express_4h", "circuitplayground_express_digikey_pycon2019"], + "circuitplayground_express": [ + "circuitplayground_express_4h", + "circuitplayground_express_digikey_pycon2019", + ], "pybadge": ["edgebadge"], "pyportal": ["pyportal_pynt"], "gemma_m0": ["gemma_m0_pycon2018"], - "pewpew10": ["pewpew13"] + "pewpew10": ["pewpew13"], } + def get_languages(): languages = [] for f in os.scandir("../locale"): @@ -84,6 +90,7 @@ def get_languages(): languages.append(f.name[:-3]) return languages + def get_board_mapping(): boards = {} for port in SUPPORTED_PORTS: @@ -95,23 +102,30 @@ def get_board_mapping(): extensions = extension_by_port[port] extensions = extension_by_board.get(board_path.name, extensions) aliases = aliases_by_board.get(board_path.name, []) - boards[board_id] = {"port": port, - "extensions": extensions, - "download_count": 0, - "aliases": aliases} + boards[board_id] = { + "port": port, + "extensions": extensions, + "download_count": 0, + "aliases": aliases, + } for alias in aliases: - boards[alias] = {"port": port, - "extensions": extensions, - "download_count": 0, - "alias": True, - "aliases": []} + boards[alias] = { + "port": port, + "extensions": extensions, + "download_count": 0, + "alias": True, + "aliases": [], + } return boards + def get_version_info(): version = None sha = git("rev-parse", "--short", "HEAD").stdout.decode("utf-8") try: - version = git("describe", "--tags", "--exact-match").stdout.decode("utf-8").strip() + version = ( + git("describe", "--tags", "--exact-match").stdout.decode("utf-8").strip() + ) except sh.ErrorReturnCode_128: # No exact match pass @@ -120,10 +134,11 @@ def get_version_info(): sha = os.environ["GITHUB_SHA"] if not version: - version="{}-{}".format(date.today().strftime("%Y%m%d"), sha[:7]) + version = "{}-{}".format(date.today().strftime("%Y%m%d"), sha[:7]) return sha, version + def get_current_info(): response = github.get("/repos/adafruit/circuitpython-org/git/refs/heads/master") if not response.ok: @@ -131,7 +146,9 @@ def get_current_info(): raise RuntimeError("cannot get master sha") commit_sha = response.json()["object"]["sha"] - response = github.get("/repos/adafruit/circuitpython-org/contents/_data/files.json?ref=" + commit_sha) + response = github.get( + "/repos/adafruit/circuitpython-org/contents/_data/files.json?ref=" + commit_sha + ) if not response.ok: print(response.text) raise RuntimeError("cannot get previous files.json") @@ -145,6 +162,7 @@ def get_current_info(): current_info[info["id"]] = info return git_info, current_info + def create_pr(changes, updated, git_info, user): commit_sha, original_blob_sha = git_info branch_name = "new_release_" + changes["new_release"] @@ -158,7 +176,7 @@ def create_pr(changes, updated, git_info, user): updated_list.append(info) updated = json.dumps(updated_list, sort_keys=True, indent=1).encode("utf-8") + b"\n" - #print(updated.decode("utf-8")) + # print(updated.decode("utf-8")) pr_title = "Automated website update for release {}".format(changes["new_release"]) boards = "" if changes["new_boards"]: @@ -167,16 +185,13 @@ def create_pr(changes, updated, git_info, user): if changes["new_languages"]: languages = "New languages:\n* " + "\n* ".join(changes["new_languages"]) message = "Automated website update for release {} by Blinka.\n\n{}\n\n{}\n".format( - changes["new_release"], - boards, - languages + changes["new_release"], boards, languages ) - create_branch = { - "ref": "refs/heads/" + branch_name, - "sha": commit_sha - } - response = github.post("/repos/{}/circuitpython-org/git/refs".format(user), json=create_branch) + create_branch = {"ref": "refs/heads/" + branch_name, "sha": commit_sha} + response = github.post( + "/repos/{}/circuitpython-org/git/refs".format(user), json=create_branch + ) if not response.ok and response.json()["message"] != "Reference already exists": print("unable to create branch") print(response.text) @@ -186,10 +201,13 @@ def create_pr(changes, updated, git_info, user): "message": message, "content": base64.b64encode(updated).decode("utf-8"), "sha": original_blob_sha, - "branch": branch_name + "branch": branch_name, } - response = github.put("/repos/{}/circuitpython-org/contents/_data/files.json".format(user), json=update_file) + response = github.put( + "/repos/{}/circuitpython-org/contents/_data/files.json".format(user), + json=update_file, + ) if not response.ok: print("unable to post new file") print(response.text) @@ -199,7 +217,7 @@ def create_pr(changes, updated, git_info, user): "head": user + ":" + branch_name, "base": "master", "body": message, - "maintainer_can_modify": True + "maintainer_can_modify": True, } response = github.post("/repos/adafruit/circuitpython-org/pulls", json=pr_info) if not response.ok: @@ -220,17 +238,14 @@ def print_active_user(): print("Not logged in") return None + def generate_download_info(): boards = {} errors = [] new_tag = os.environ["RELEASE_TAG"] - changes = { - "new_release": new_tag, - "new_boards": [], - "new_languages": [] - } + changes = {"new_release": new_tag, "new_boards": [], "new_languages": []} user = print_active_user() @@ -254,8 +269,9 @@ def generate_download_info(): info = current_info[board] for version in info["versions"]: previous_releases.add(version["version"]) - previous_languages.update(version["files"].keys()) - if version["stable"] == new_stable: + if version["stable"] == new_stable or ( + new_stable and version["version"].startswith(this_version) + ): info["versions"].remove(version) board_mapping = get_board_mapping() @@ -272,29 +288,15 @@ def generate_download_info(): alias_info = board_mapping[alias] if alias not in current_info: changes["new_boards"].append(alias) - current_info[alias] = {"downloads": 0, - "versions": []} + current_info[alias] = {"downloads": 0, "versions": []} new_version = { "stable": new_stable, "version": new_tag, "modules": support_matrix.get(alias, "[]"), - "files": {}, "languages": languages, - "extensions": board_info["extensions"] + "extensions": board_info["extensions"], } - for language in languages: - files = [] - new_version["files"][language] = files - for extension in board_info["extensions"]: - files.append( - "{base_url}/{alias}/{language}/adafruit-circuitpython-{alias}-{language}-{tag}.{extension}" - .format( - base_url=DOWNLOAD_BASE_URL, - tag=new_tag, - alias=alias, - language=language, - extension=extension)) current_info[alias]["downloads"] = alias_info["download_count"] current_info[alias]["versions"].append(new_version) @@ -305,6 +307,7 @@ def generate_download_info(): else: print("No new release to update") + if __name__ == "__main__": if "RELEASE_TAG" in os.environ and os.environ["RELEASE_TAG"]: generate_download_info() From 9a642fc0490c22b60460bcca8dec3b0b93344d81 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 18 Nov 2020 20:37:26 -0600 Subject: [PATCH 215/770] samd21: Enable terse error reporting on resource constrained chip family This reclaims over 1kB of flash space by simplifying certain exception messages. e.g., it will no longer display the requested/actual length when a fixed list/tuple of N items is needed: if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { mp_raise_ValueError(translate("tuple/list has wrong length")); } else { mp_raise_ValueError_varg(translate("requested length %d but object has length %d"), (int)len, (int)seq_len); Other chip families including samd51 keep their current error reporting capabilities. --- ports/atmel-samd/mpconfigport.h | 1 + py/circuitpy_mpconfig.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/ports/atmel-samd/mpconfigport.h b/ports/atmel-samd/mpconfigport.h index ed10da9b9d4bc..3069def33ba61 100644 --- a/ports/atmel-samd/mpconfigport.h +++ b/ports/atmel-samd/mpconfigport.h @@ -42,6 +42,7 @@ #define CIRCUITPY_MCU_FAMILY samd21 #define MICROPY_PY_SYS_PLATFORM "Atmel SAMD21" #define SPI_FLASH_MAX_BAUDRATE 8000000 +#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE) #define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0) #define MICROPY_PY_FUNCTION_ATTRS (0) // MICROPY_PY_UJSON depends on MICROPY_PY_IO diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 85e152670a2f5..4c2e33be017be 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -64,7 +64,9 @@ #define MICROPY_ENABLE_FINALISER (1) #define MICROPY_ENABLE_GC (1) #define MICROPY_ENABLE_SOURCE_LINE (1) +#ifndef MICROPY_ERROR_REPORTING #define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL) +#endif #define MICROPY_FLOAT_HIGH_QUALITY_HASH (0) #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT) #define MICROPY_GC_ALLOC_THRESHOLD (0) From 682054a2169c108ad69e84acdb53fdd26405077e Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 18 Nov 2020 20:44:34 -0500 Subject: [PATCH 216/770] WIP: redo API; not compiled yet --- locale/circuitpython.pot | 8 +- ports/esp32s2/mpconfigport.mk | 3 - py/circuitpy_defns.mk | 22 +-- py/circuitpy_mpconfig.h | 32 ----- py/circuitpy_mpconfig.mk | 20 +-- .../{sleep => alarm}/ResetReason.c | 18 +-- .../{sleep => alarm}/ResetReason.h | 9 +- shared-bindings/alarm/__init__.c | 130 ++++++++++++++++++ shared-bindings/alarm/__init__.h | 35 +++++ shared-bindings/alarm/pin/PinAlarm.c | 116 ++++++++++++++++ .../Time.h => alarm/pin/PinAlarm.h} | 22 ++- shared-bindings/alarm/time/DurationAlarm.c | 91 ++++++++++++ shared-bindings/alarm/time/DurationAlarm.h | 34 +++++ shared-bindings/alarm_io/__init__.c | 53 ------- shared-bindings/alarm_io/__init__.h | 17 --- shared-bindings/alarm_time/Time.c | 76 ---------- shared-bindings/alarm_time/__init__.c | 76 ---------- shared-bindings/alarm_time/__init__.h | 15 -- shared-bindings/microcontroller/__init__.c | 1 - shared-bindings/sleep/__init__.c | 112 --------------- shared-bindings/sleep/__init__.h | 9 -- 21 files changed, 445 insertions(+), 454 deletions(-) rename shared-bindings/{sleep => alarm}/ResetReason.c (79%) rename shared-bindings/{sleep => alarm}/ResetReason.h (83%) create mode 100644 shared-bindings/alarm/__init__.c create mode 100644 shared-bindings/alarm/__init__.h create mode 100644 shared-bindings/alarm/pin/PinAlarm.c rename shared-bindings/{alarm_time/Time.h => alarm/pin/PinAlarm.h} (64%) create mode 100644 shared-bindings/alarm/time/DurationAlarm.c create mode 100644 shared-bindings/alarm/time/DurationAlarm.h delete mode 100644 shared-bindings/alarm_io/__init__.c delete mode 100644 shared-bindings/alarm_io/__init__.h delete mode 100644 shared-bindings/alarm_time/Time.c delete mode 100644 shared-bindings/alarm_time/__init__.c delete mode 100644 shared-bindings/alarm_time/__init__.h delete mode 100644 shared-bindings/sleep/__init__.c delete mode 100644 shared-bindings/sleep/__init__.h diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 14049eaef739b..daeb5c31234d8 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-11-04 21:18+0530\n" +"POT-Creation-Date: 2020-11-19 00:22-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -303,7 +303,8 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "" -#: ports/esp32s2/peripherals/pcnt_handler.c +#: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -3221,6 +3222,7 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -3328,7 +3330,7 @@ msgstr "" msgid "size is defined for ndarrays only" msgstr "" -#: shared-bindings/alarm_time/__init__.c shared-bindings/time/__init__.c +#: shared-bindings/time/__init__.c msgid "sleep length must be non-negative" msgstr "" diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index af1db2b2bf61b..dea5d4dc181c8 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -15,9 +15,6 @@ LONGINT_IMPL = MPZ # These modules are implemented in ports//common-hal: CIRCUITPY_FULL_BUILD = 1 CIRCUITPY_ALARM = 1 -CIRCUITPY_ALARM_IO = 1 -CIRCUITPY_ALARM_TIME = 1 -CIRCUITPY_ALARM_TOUCH = 1 CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_AUDIOIO = 0 CIRCUITPY_CANIO = 1 diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index d6c0f995ec15c..dd36c9457f65f 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -102,15 +102,6 @@ endif ifeq ($(CIRCUITPY_ALARM),1) SRC_PATTERNS += alarm/% endif -ifeq ($(CIRCUITPY_ALARM_IO),1) -SRC_PATTERNS += alarm_io/% -endif -ifeq ($(CIRCUITPY_ALARM_TIME),1) -SRC_PATTERNS += alarm_time/% -endif -ifeq ($(CIRCUITPY_ALARM_TOUCH),1) -SRC_PATTERNS += alarm_touch/% -endif ifeq ($(CIRCUITPY_ANALOGIO),1) SRC_PATTERNS += analogio/% endif @@ -247,9 +238,6 @@ endif ifeq ($(CIRCUITPY_SHARPDISPLAY),1) SRC_PATTERNS += sharpdisplay/% endif -ifeq ($(CIRCUITPY_SLEEP),1) -SRC_PATTERNS += sleep/% -endif ifeq ($(CIRCUITPY_SOCKETPOOL),1) SRC_PATTERNS += socketpool/% endif @@ -314,9 +302,9 @@ SRC_COMMON_HAL_ALL = \ _pew/PewPew.c \ _pew/__init__.c \ alarm/__init__.c \ - alarm_io/__init__.c \ - alarm_time/__init__.c \ - alarm_touch/__init__.c \ + alarm/pin/__init__.c \ + alarm/time/__init__.c \ + alarm/touch/__init__.c \ analogio/AnalogIn.c \ analogio/AnalogOut.c \ analogio/__init__.c \ @@ -372,8 +360,8 @@ SRC_COMMON_HAL_ALL = \ rtc/__init__.c \ sdioio/SDCard.c \ sdioio/__init__.c \ - sleep/__init__.c \ - sleep/ResetReason.c \ + sleepio/__init__.c \ + sleepio/ResetReason.c \ socketpool/__init__.c \ socketpool/SocketPool.c \ socketpool/Socket.c \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index b31cef8071756..b5e9faa26e594 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -250,27 +250,6 @@ extern const struct _mp_obj_module_t alarm_module; #define ALARM_MODULE #endif -#if CIRCUITPY_ALARM_IO -extern const struct _mp_obj_module_t alarm_io_module; -#define ALARM_IO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_alarm_io), (mp_obj_t)&alarm_io_module }, -#else -#define ALARM_IO_MODULE -#endif - -#if CIRCUITPY_ALARM_TIME -extern const struct _mp_obj_module_t alarm_time_module; -#define ALARM_TIME_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_alarm_time), (mp_obj_t)&alarm_time_module }, -#else -#define ALARM_TIME_MODULE -#endif - -#if CIRCUITPY_ALARM_TOUCH -extern const struct _mp_obj_module_t alarm_touch_module; -#define ALARM_TOUCH_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_alarm_touch), (mp_obj_t)&alarm_touch_module }, -#else -#define ALARM_TOUCH_MODULE -#endif - #if CIRCUITPY_ANALOGIO #define ANALOGIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_analogio), (mp_obj_t)&analogio_module }, extern const struct _mp_obj_module_t analogio_module; @@ -642,13 +621,6 @@ extern const struct _mp_obj_module_t sharpdisplay_module; #define SHARPDISPLAY_MODULE #endif -#if CIRCUITPY_SLEEP -extern const struct _mp_obj_module_t sleep_module; -#define SLEEP_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_sleep),(mp_obj_t)&sleep_module }, -#else -#define SLEEP_MODULE -#endif - #if CIRCUITPY_SOCKETPOOL extern const struct _mp_obj_module_t socketpool_module; #define SOCKETPOOL_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_socketpool), (mp_obj_t)&socketpool_module }, @@ -807,9 +779,6 @@ extern const struct _mp_obj_module_t wifi_module; #define MICROPY_PORT_BUILTIN_MODULES_STRONG_LINKS \ AESIO_MODULE \ ALARM_MODULE \ - ALARM_IO_MODULE \ - ALARM_TIME_MODULE \ - ALARM_TOUCH_MODULE \ ANALOGIO_MODULE \ AUDIOBUSIO_MODULE \ AUDIOCORE_MODULE \ @@ -862,7 +831,6 @@ extern const struct _mp_obj_module_t wifi_module; SDCARDIO_MODULE \ SDIOIO_MODULE \ SHARPDISPLAY_MODULE \ - SLEEP_MODULE \ SOCKETPOOL_MODULE \ SSL_MODULE \ STAGE_MODULE \ diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index c47e3755ba756..6192ee8a7afa6 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -39,18 +39,15 @@ CFLAGS += -DMICROPY_PY_ASYNC_AWAIT=$(MICROPY_PY_ASYNC_AWAIT) CIRCUITPY_AESIO ?= 0 CFLAGS += -DCIRCUITPY_AESIO=$(CIRCUITPY_AESIO) +# TODO: CIRCUITPY_ALARM will gradually be added to +# as many ports as possible +# so make this 1 or CIRCUITPY_FULL_BUILD eventually +CIRCUITPY_SLEEPIO ?= 0 +CFLAGS += -DCIRCUITPY_SLEEPIO=$(CIRCUITPY_SLEEPIO) + CIRCUITPY_ALARM ?= 0 CFLAGS += -DCIRCUITPY_ALARM=$(CIRCUITPY_ALARM) -CIRCUITPY_ALARM_IO ?= 0 -CFLAGS += -DCIRCUITPY_ALARM_IO=$(CIRCUITPY_ALARM_IO) - -CIRCUITPY_ALARM_TIME ?= 0 -CFLAGS += -DCIRCUITPY_ALARM_TIME=$(CIRCUITPY_ALARM_TIME) - -CIRCUITPY_ALARM_TOUCH ?= 0 -CFLAGS += -DCIRCUITPY_ALARM_TOUCH=$(CIRCUITPY_ALARM_TOUCH) - CIRCUITPY_ANALOGIO ?= 1 CFLAGS += -DCIRCUITPY_ANALOGIO=$(CIRCUITPY_ANALOGIO) @@ -221,11 +218,6 @@ CFLAGS += -DCIRCUITPY_SDIOIO=$(CIRCUITPY_SDIOIO) CIRCUITPY_SHARPDISPLAY ?= $(CIRCUITPY_FRAMEBUFFERIO) CFLAGS += -DCIRCUITPY_SHARPDISPLAY=$(CIRCUITPY_SHARPDISPLAY) -# TODO: CIRCUITPY_SLEEP will gradually be added to all ports -# even if it doesn't actually sleep, so make this 1 eventually. -CIRCUITPY_SLEEP ?= 0 -CFLAGS += -DCIRCUITPY_SLEEP=$(CIRCUITPY_SLEEP) - CIRCUITPY_SOCKETPOOL ?= $(CIRCUITPY_WIFI) CFLAGS += -DCIRCUITPY_SOCKETPOOL=$(CIRCUITPY_SOCKETPOOL) diff --git a/shared-bindings/sleep/ResetReason.c b/shared-bindings/alarm/ResetReason.c similarity index 79% rename from shared-bindings/sleep/ResetReason.c rename to shared-bindings/alarm/ResetReason.c index cce55a81a5295..456715a08ea4a 100644 --- a/shared-bindings/sleep/ResetReason.c +++ b/shared-bindings/alarm/ResetReason.c @@ -26,12 +26,12 @@ #include "py/enum.h" -#include "shared-bindings/sleep/ResetReason.h" +#include "shared-bindings/alarm/ResetReason.h" -MAKE_ENUM_VALUE(sleep_reset_reason_type, reset_reason, POWER_VALID, RESET_REASON_POWER_VALID); -MAKE_ENUM_VALUE(sleep_reset_reason_type, reset_reason, SOFTWARE, RESET_REASON_SOFTWARE); -MAKE_ENUM_VALUE(sleep_reset_reason_type, reset_reason, DEEP_SLEEP_ALARM, RESET_REASON_DEEP_SLEEP_ALARM); -MAKE_ENUM_VALUE(sleep_reset_reason_type, reset_reason, EXTERNAL, RESET_REASON_EXTERNAL); +MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, POWER_VALID, RESET_REASON_POWER_VALID); +MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, SOFTWARE, RESET_REASON_SOFTWARE); +MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, DEEP_SLEEP_ALARM, RESET_REASON_DEEP_SLEEP_ALARM); +MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, EXTERNAL, RESET_REASON_EXTERNAL); //| class ResetReason: //| """The reason the chip was last reset""" @@ -48,14 +48,14 @@ MAKE_ENUM_VALUE(sleep_reset_reason_type, reset_reason, EXTERNAL, RESET_REASON_EX //| EXTERNAL: object //| """The chip was reset by an external input such as a button.""" //| -MAKE_ENUM_MAP(sleep_reset_reason) { +MAKE_ENUM_MAP(alarm_reset_reason) { MAKE_ENUM_MAP_ENTRY(reset_reason, POWER_VALID), MAKE_ENUM_MAP_ENTRY(reset_reason, SOFTWARE), MAKE_ENUM_MAP_ENTRY(reset_reason, DEEP_SLEEP_ALARM), MAKE_ENUM_MAP_ENTRY(reset_reason, EXTERNAL), }; -STATIC MP_DEFINE_CONST_DICT(sleep_reset_reason_locals_dict, sleep_reset_reason_locals_table); +STATIC MP_DEFINE_CONST_DICT(alarm_reset_reason_locals_dict, alarm_reset_reason_locals_table); -MAKE_PRINTER(sleep, sleep_reset_reason); +MAKE_PRINTER(alarm, alarm_reset_reason); -MAKE_ENUM_TYPE(sleep, ResetReason, sleep_reset_reason); +MAKE_ENUM_TYPE(alarm, ResetReason, alarm_reset_reason); diff --git a/shared-bindings/sleep/ResetReason.h b/shared-bindings/alarm/ResetReason.h similarity index 83% rename from shared-bindings/sleep/ResetReason.h rename to shared-bindings/alarm/ResetReason.h index 2b312bb89783c..6fe7a4bd31865 100644 --- a/shared-bindings/sleep/ResetReason.h +++ b/shared-bindings/alarm/ResetReason.h @@ -24,13 +24,16 @@ * THE SOFTWARE. */ -#pragma once +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM__RESET_REASON__H +#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM__RESET_REASON__H typedef enum { RESET_REASON_POWER_APPLIED, RESET_REASON_SOFTWARE, RESET_REASON_DEEP_SLEEP_ALARM, RESET_REASON_BUTTON, -} sleep_reset_reason_t; +} alarm_reset_reason_t; -extern const mp_obj_type_t sleep_reset_reason_type; +extern const mp_obj_type_t alarm_reset_reason_type; + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM__RESET_REASON__H diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c new file mode 100644 index 0000000000000..20535e156b511 --- /dev/null +++ b/shared-bindings/alarm/__init__.c @@ -0,0 +1,130 @@ +//| """Power-saving light and deep sleep. Alarms can be set to wake up from sleep. +//| +//| The `alarm` module provides sleep related functionality. There are two supported levels of +//| sleep, light and deep. +//| +//| Light sleep leaves the CPU and RAM powered so that CircuitPython can resume where it left off +//| after being woken up. CircuitPython automatically goes into a light sleep when `time.sleep()` is +//| called. To light sleep until a non-time alarm use `alarm.sleep_until_alarm()`. Any active +//| peripherals, such as I2C, are left on. +//| +//| Deep sleep shuts down power to nearly all of the chip including the CPU and RAM. This can save +//| a more significant amount of power, but CircuitPython must start ``code.py`` from the beginning when woken +//| up. CircuitPython will enter deep sleep automatically when the current program exits without error +//| or calls `sys.exit(0)`. +//| If an error causes CircuitPython to exit, error LED error flashes will be done periodically. +//| An error includes an uncaught exception, or sys.exit called with a non-zero argumetn. +//| To set alarms for deep sleep use `alarm.reload_on_alarm()` they will apply to next deep sleep only.""" +//| + +//| wake_alarm: Alarm +//| """The most recent alarm to wake us up from a sleep (light or deep.)""" +//| + +//| reset_reason: ResetReason +//| """The reason the chip started up from reset state. This can may be power up or due to an alarm.""" +//| + +//| def sleep(alarm: Alarm, ...) -> Alarm: +//| """Performs a light sleep until woken by one of the alarms. The alarm that triggers the wake +//| is returned, and is also available as `alarm.wake_alarm` +//| ... +//| + +#include "py/obj.h" +#include "py/runtime.h" + +#include "shared-bindings/alarm/pin/__init__.h" +#include "shared-bindings/alarm/time/__init__.h" + +STATIC mp_obj_t alarm_sleep_until_alarm(size_t n_args, const mp_obj_t *args) { + // TODO +} +MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_sleep_until_alarm_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_sleep_until_alarm); + +//| def restart_on_alarm(alarm: Alarm, ...) -> None: +//| """Set one or more alarms to wake up from a deep sleep. +//| When awakened, ``code.py`` will restart from the beginning. +//| The last alarm to wake us up is available as `wake_alarm`. +//| """ +//| ... +//| +STATIC mp_obj_t alarm_restart_on_alarm(size_t n_args, const mp_obj_t *args) { + // TODO +} +MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_restart_on_alarm_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_restart_on_alarm); + +//| """The `alarm.pin` module contains alarm attributes and classes related to pins +//| """ +//| +mp_map_elem_t alarm_pin_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_pin) }, + + { MP_ROM_QSTR(MP_QSTR_PinAlarm), MP_ROM_PTR(&alarm_pin_pin_alarm_type) }, +}; + +STATIC MP_DEFINE_CONST_DICT(alarm_pin_globals, alarm_pin_globals_table); + +const mp_obj_module_t alarm_pin_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&alarm_pinn_globals, +}; + +//| """The `alarm.time` module contains alarm attributes and classes related to time-keeping. +//| """ +//| +mp_map_elem_t alarm_time_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_time) }, + + { MP_ROM_QSTR(MP_QSTR_DurationAlarm), MP_ROM_PTR(&alarm_time_duration_alarm_type) }, +}; + +STATIC MP_DEFINE_CONST_DICT(alarm_time_globals, alarm_time_globals_table); + +const mp_obj_module_t alarm_time_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&alarm_time_globals, +}; + +mp_map_elem_t alarm_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_alarm) }, + + // wake_alarm and reset_reason are mutable attributes. + { MP_ROM_QSTR(MP_QSTR_wake_alarm), mp_const_none }, + { MP_ROM_QSTR(MP_QSTR_reset_reason), mp_const_none }, + + { MP_ROM_QSTR(MP_QSTR_sleep_until_alarm), MP_ROM_PTR(&alarm_sleep_until_alarm_obj) }, + { MP_ROM_QSTR(MP_QSTR_restart_on_alarm), MP_ROM_PTR(&alarm_restart_on_alarm_obj) }, + + { MP_ROM_QSTR(MP_QSTR_pin), MP_ROM_PTR(&alarm_pin_module) }, + { MP_ROM_QSTR(MP_QSTR_time), MP_ROM_PTR(&alarm_time_module) } + +}; +STATIC MP_DEFINE_MUTABLE_DICT(alarm_module_globals, alarm_module_globals_table); + +// These are called from common_hal code to set the current wake alarm. +void common_hal_alarm_set_wake_alarm(mp_obj_t alarm) { + // Equivalent of: + // alarm.wake_alarm = alarm + mp_map_elem_t *elem = + mp_map_lookup(&alarm_module_globals_table, MP_ROM_QSTR(MP_QSTR_wake_alarm), MP_MAP_LOOKUP); + if (elem) { + elem->value = alarm; + } +} + +// These are called from common hal code to set the current wake alarm. +void common_hal_alarm_set_reset_reason(mp_obj_t reset_reason) { + // Equivalent of: + // alarm.reset_reason = reset_reason + mp_map_elem_t *elem = + mp_map_lookup(&alarm_module_globals_table, MP_ROM_QSTR(MP_QSTR_reset_reason), MP_MAP_LOOKUP); + if (elem) { + elem->value = reset_reason; + } +} + +const mp_obj_module_t alarm_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&alarm_module_globals, +}; diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h new file mode 100644 index 0000000000000..ce9cc79f40f41 --- /dev/null +++ b/shared-bindings/alarm/__init__.h @@ -0,0 +1,35 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Dan Halbert for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM___INIT___H + +#include "py/obj.h" + +extern void common_hal_alarm_set_wake_alarm(mp_obj_t alarm); +extern void common_hal_alarm_set_reset_reason(mp_obj_t reset_reason); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM___INIT___H diff --git a/shared-bindings/alarm/pin/PinAlarm.c b/shared-bindings/alarm/pin/PinAlarm.c new file mode 100644 index 0000000000000..1404fa3f41445 --- /dev/null +++ b/shared-bindings/alarm/pin/PinAlarm.c @@ -0,0 +1,116 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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 "shared-bindings/board/__init__.h" +#include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/microcontroller/Pin.h" + +#include "py/nlr.h" +#include "py/obj.h" +#include "py/runtime.h" +#include "supervisor/shared/translate.h" + +//| class PinAlarm: +//| """Trigger an alarm when a pin changes state. +//| +//| def __init__(self, pin: microcontroller.Pin, level: bool, *, edge: bool = False, pull: bool = False) -> None: +//| """Create an alarm triggered by a `~microcontroller.Pin` level. The alarm is not active +//| until it is listed in an `alarm`-enabling function, such as `alarm.sleep()` or +//| `alarm.wake_after_exit()`. + +//| :param ~microcontroller.Pin pin: The pin to monitor. On some ports, the choice of pin +//| may be limited due to hardware restrictions, particularly for deep-sleep alarms. +//| :param bool level: When active, trigger when the level is high (``True``) or low (``False``). +//| On some ports, multiple `PinAlarm` objects may need to have coordinated levels +//| for deep-sleep alarms +//| :param bool edge: If ``True``, trigger only when there is a transition to the specified +//| value of `level`. If ``True``, if the alarm becomes active when the pin level already +//| matches `level`, the alarm is not triggered: the pin must transition from ``not level`` +//| to ``level`` to trigger the alarm. On some ports, edge-triggering may not be available, +//| particularly for deep-sleep alarms. +//| :param bool pull: Enable a pull-up or pull-down which pulls the pin to level opposite +//| opposite that of `level`. For instance, if `level` is set to ``True``, setting `pull` +//| to ``True`` will enable a pull-down, to hold the pin low normally until an outside signal +//| pulls it high. +//| """ +//| ... +//| +STATIC mp_obj_t alarm_pin_pin_alarm_make_new(const mp_obj_type_t *type, + mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kw_args) { + alarm_pin_pin_alarm_obj_t *self = m_new_obj(alarm_pin_pin_alarm_obj_t); + self->base.type = &alarm_pin_pin_alarm_type; + enum { ARG_pin, ARG_level, ARG_edge, ARG_pull }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_pin, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_level, MP_ARG_REQUIRED | MP_ARG_BOOL }, + { MP_QSTR_edge, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, + { MP_QSTR_pull, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + const mcu_pin_obj_t* pin = validate_obj_is_free_pin(args[ARG_pin].u_obj); + + common_hal_alarm_pin_pin_pin_alarm_construct( + self, pin, args[ARG_level].u_bool, args[ARG_edge].u_bool, args[ARG_pull].u_bool); + + return MP_OBJ_FROM_PTR(self); +} + +//| def __eq__(self, other: object) -> bool: +//| """Two PinAlarm objects are equal if their durations are the same if their pin, +//| level, edge, and pull attributes are all the same.""" +//| ... +//| +STATIC mp_obj_t alarm_pin_pin_alarm_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) { + switch (op) { + case MP_BINARY_OP_EQUAL: + if (MP_OBJ_IS_TYPE(rhs_in, &alarm_pin_pin_alarm_type)) { + // Pins are singletons, so we can compare them directly. + return mp_obj_new_bool( + common_hal_pin_pin_alarm_get_pin(lhs_in) == common_hal_pin_pin_alarm_get_pin(rhs_in) && + common_hal_pin_pin_alarm_get_level(lhs_in) == common_hal_pin_pin_alarm_get_level(rhs_in) && + common_hal_pin_pin_alarm_get_edge(lhs_in) == common_hal_pin_pin_alarm_get_edge(rhs_in) && + common_hal_pin_pin_alarm_get_pull(lhs_in) == common_hal_pin_pin_alarm_get_pull(rhs_in)) + } + return mp_const_false; + + default: + return MP_OBJ_NULL; // op not supported + } +} + +STATIC const mp_rom_map_elem_t alarm_pin_pin_alarm_locals_dict_table[] = { +}; + +STATIC MP_DEFINE_CONST_DICT(alarm_pin_pin_alarm_locals, alarm_pin_pin_alarm_locals_dict); + +const mp_obj_type_t alarm_pin_pin_alarm_type = { + { &mp_type_type }, + .name = MP_QSTR_PinAlarm, + .make_new = alarm_pin_pin_alarm_make_new, + .locals_dict = (mp_obj_t)&alarm_pin_pin_alarm_locals, +}; diff --git a/shared-bindings/alarm_time/Time.h b/shared-bindings/alarm/pin/PinAlarm.h similarity index 64% rename from shared-bindings/alarm_time/Time.h rename to shared-bindings/alarm/pin/PinAlarm.h index 9962c26f258b1..e38c7f620cc3d 100644 --- a/shared-bindings/alarm_time/Time.h +++ b/shared-bindings/alarm/pin/PinAlarm.h @@ -1,9 +1,9 @@ /* - * This file is part of the Micro Python project, http://micropython.org/ + * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * - * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2020 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 @@ -24,19 +24,13 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_TIME_H -#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_TIME_H +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_PIN_PIN_ALARM_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_PIN_PIN_ALARM_H -#include "py/runtime.h" +#include "py/obj.h" -typedef struct { - mp_obj_base_t base; - uint64_t time_to_alarm; -} alarm_time_time_obj_t; +extern const mp_obj_type_t alarm_pin_pin_alarm_type; -extern const mp_obj_type_t alarm_time_time_type; +extern void common_hal_alarm_pin_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, const mcu_pin_obj_t *pin, bool level, bool edge, bool pull); -void common_hal_alarm_time_time_construct(alarm_time_time_obj_t* self, - uint64_t ticks_ms); - -#endif //MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_TIME_H +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_PIN_PIN_ALARM_H diff --git a/shared-bindings/alarm/time/DurationAlarm.c b/shared-bindings/alarm/time/DurationAlarm.c new file mode 100644 index 0000000000000..c30c7f326c11e --- /dev/null +++ b/shared-bindings/alarm/time/DurationAlarm.c @@ -0,0 +1,91 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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 "shared-bindings/board/__init__.h" +#include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/microcontroller/Pin.h" + +#include "py/nlr.h" +#include "py/obj.h" +#include "py/runtime.h" +#include "supervisor/shared/translate.h" + +//| class DurationAlarm: +//| """Trigger an alarm at a specified interval from now. +//| +//| def __init__(self, secs: float) -> None: +//| """Create an alarm that will be triggered in `secs` seconds **from the time +//| the alarm is created**. The alarm is not active until it is listed in an +//| `alarm`-enabling function, such as `alarm.sleep()` or +//| `alarm.wake_after_exit()`. But the interval starts immediately upon +//| instantiation. +//| """ +//| ... +//| +STATIC mp_obj_t alarm_time_duration_alarm_make_new(const mp_obj_type_t *type, + mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kw_args) { + mp_arg_check_num(n_args, kw_args, 1, 1, false); + + alarm_pin_duration_alarm_obj_t *self = m_new_obj(alarm_pin_duration_alarm_obj_t); + self->base.type = &alarm_pin_pin_alarm_type; + + mp_float_t secs = mp_obj_get_float(args[0]); + + common_hal_alarm_time_duration_alarm_construct(self, secs); + + return MP_OBJ_FROM_PTR(self); +} + +//| def __eq__(self, other: object) -> bool: +//| """Two DurationAlarm objects are equal if their durations are the same.""" +//| ... +//| +STATIC mp_obj_t alarm_time_duration_alarm_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) { + switch (op) { + case MP_BINARY_OP_EQUAL: + if (MP_OBJ_IS_TYPE(rhs_in, &alarm_time_duration_alarm_type)) { + return mp_obj_new_bool( + common_hal_alarm_time_duration_alarm_get_duration(lhs_in) == + common_hal_alarm_time_duration_alarm_get_duration(rhs_in)); + } + return mp_const_false; + + default: + return MP_OBJ_NULL; // op not supported + } +} + +STATIC const mp_rom_map_elem_t alarm_time_duration_alarm_locals_dict_table[] = { +}; + +STATIC MP_DEFINE_CONST_DICT(alarm_time_duration_alarm_locals_dict, alarm_time_duration_alarm_locals_dict_table); + +const mp_obj_type_t alarm_time_duration_alarm_type = { + { &mp_type_type }, + .name = MP_QSTR_DurationAlarm, + .make_new = alarm_time_duration_alarm_make_new, + .locals_dict = (mp_obj_t)&alarm_time_duration_alarm_locals, +}; diff --git a/shared-bindings/alarm/time/DurationAlarm.h b/shared-bindings/alarm/time/DurationAlarm.h new file mode 100644 index 0000000000000..1e4db6ac53f72 --- /dev/null +++ b/shared-bindings/alarm/time/DurationAlarm.h @@ -0,0 +1,34 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Dan Halbert for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_DURATION_ALARM_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_DURATION_ALARM_H + +#include "py/obj.h" + +extern const mp_obj_type_t alarm_time_duration_alarm_type; + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_DURATION_ALARM_H diff --git a/shared-bindings/alarm_io/__init__.c b/shared-bindings/alarm_io/__init__.c deleted file mode 100644 index 4e42f9a2e1606..0000000000000 --- a/shared-bindings/alarm_io/__init__.c +++ /dev/null @@ -1,53 +0,0 @@ -#include "py/obj.h" - -#include "shared-bindings/alarm_io/__init__.h" -#include "shared-bindings/microcontroller/Pin.h" - -//| """alarm_io module -//| -//| The `alarm_io` module implements deep sleep.""" - -STATIC mp_obj_t alarm_io_pin_state(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_level, ARG_pull }; - static const mp_arg_t allowed_args[] = { - { MP_QSTR_level, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, - { MP_QSTR_pull, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_bool = false} }, - }; - - mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - - mcu_pin_obj_t *pin = validate_obj_is_pin(pos_args[0]); - alarm_io_obj_t *self = m_new_obj(alarm_io_obj_t); - - self->base.type = &alarm_io_type; - self->gpio = pin->number; - self->level = args[ARG_level].u_int; - self->pull = args[ARG_pull].u_bool; - - return common_hal_alarm_io_pin_state(self); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(alarm_io_pin_state_obj, 1, alarm_io_pin_state); - -STATIC mp_obj_t alarm_io_disable(void) { - common_hal_alarm_io_disable(); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(alarm_io_disable_obj, alarm_io_disable); - -STATIC const mp_rom_map_elem_t alarm_io_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_alarm_io) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_PinState), MP_ROM_PTR(&alarm_io_pin_state_obj) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_Disable), MP_ROM_PTR(&alarm_io_disable_obj) }, -}; -STATIC MP_DEFINE_CONST_DICT(alarm_io_module_globals, alarm_io_module_globals_table); - -const mp_obj_module_t alarm_io_module = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t*)&alarm_io_module_globals, -}; - -const mp_obj_type_t alarm_io_type = { - { &mp_type_type }, - .name = MP_QSTR_ioAlarm, -}; diff --git a/shared-bindings/alarm_io/__init__.h b/shared-bindings/alarm_io/__init__.h deleted file mode 100644 index 0a53497c01f3e..0000000000000 --- a/shared-bindings/alarm_io/__init__.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_IO___INIT___H -#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_IO___INIT___H - -#include "py/runtime.h" - -typedef struct { - mp_obj_base_t base; - uint8_t gpio, level; - bool pull; -} alarm_io_obj_t; - -extern const mp_obj_type_t alarm_io_type; - -extern mp_obj_t common_hal_alarm_io_pin_state (alarm_io_obj_t *self_in); -extern void common_hal_alarm_io_disable (void); - -#endif //MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_IO___INIT___H diff --git a/shared-bindings/alarm_time/Time.c b/shared-bindings/alarm_time/Time.c deleted file mode 100644 index 904bf522e22f5..0000000000000 --- a/shared-bindings/alarm_time/Time.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2020 Scott Shawcroft - * - * 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 "py/obj.h" -#include "shared-bindings/alarm_time/__init__.h" - -//| """alarm_time module -//| -//| The `alarm_time` module implements deep sleep.""" - -STATIC mp_obj_t alarm_time_duration(mp_obj_t seconds_o) { - #if MICROPY_PY_BUILTINS_FLOAT - mp_float_t seconds = mp_obj_get_float(seconds_o); - mp_float_t msecs = 1000.0f * seconds + 0.5f; - #else - 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_alarm_time_duration(msecs); - - alarm_time_obj_t *self = m_new_obj(alarm_time_obj_t); - self->base.type = &alarm_time_type; - - return self; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(alarm_time_duration_obj, alarm_time_duration); - -STATIC mp_obj_t alarm_time_disable(void) { - common_hal_alarm_time_disable(); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(alarm_time_disable_obj, alarm_time_disable); - -STATIC const mp_rom_map_elem_t alarm_time_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_alarm_time) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_Duration), MP_ROM_PTR(&alarm_time_duration_obj) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_Disable), MP_ROM_PTR(&alarm_time_disable_obj) }, -}; -STATIC MP_DEFINE_CONST_DICT(alarm_time_module_globals, alarm_time_module_globals_table); - -const mp_obj_module_t alarm_time_module = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t*)&alarm_time_module_globals, -}; - -const mp_obj_type_t alarm_time_type = { - { &mp_type_type }, - .name = MP_QSTR_timeAlarm, -}; diff --git a/shared-bindings/alarm_time/__init__.c b/shared-bindings/alarm_time/__init__.c deleted file mode 100644 index 904bf522e22f5..0000000000000 --- a/shared-bindings/alarm_time/__init__.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2020 Scott Shawcroft - * - * 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 "py/obj.h" -#include "shared-bindings/alarm_time/__init__.h" - -//| """alarm_time module -//| -//| The `alarm_time` module implements deep sleep.""" - -STATIC mp_obj_t alarm_time_duration(mp_obj_t seconds_o) { - #if MICROPY_PY_BUILTINS_FLOAT - mp_float_t seconds = mp_obj_get_float(seconds_o); - mp_float_t msecs = 1000.0f * seconds + 0.5f; - #else - 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_alarm_time_duration(msecs); - - alarm_time_obj_t *self = m_new_obj(alarm_time_obj_t); - self->base.type = &alarm_time_type; - - return self; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(alarm_time_duration_obj, alarm_time_duration); - -STATIC mp_obj_t alarm_time_disable(void) { - common_hal_alarm_time_disable(); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(alarm_time_disable_obj, alarm_time_disable); - -STATIC const mp_rom_map_elem_t alarm_time_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_alarm_time) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_Duration), MP_ROM_PTR(&alarm_time_duration_obj) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_Disable), MP_ROM_PTR(&alarm_time_disable_obj) }, -}; -STATIC MP_DEFINE_CONST_DICT(alarm_time_module_globals, alarm_time_module_globals_table); - -const mp_obj_module_t alarm_time_module = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t*)&alarm_time_module_globals, -}; - -const mp_obj_type_t alarm_time_type = { - { &mp_type_type }, - .name = MP_QSTR_timeAlarm, -}; diff --git a/shared-bindings/alarm_time/__init__.h b/shared-bindings/alarm_time/__init__.h deleted file mode 100644 index a96383069339b..0000000000000 --- a/shared-bindings/alarm_time/__init__.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME___INIT___H -#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME___INIT___H - -#include "py/runtime.h" - -typedef struct { - mp_obj_base_t base; -} alarm_time_obj_t; - -extern const mp_obj_type_t alarm_time_type; - -extern void common_hal_alarm_time_duration (uint32_t); -extern void common_hal_alarm_time_disable (void); - -#endif //MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME___INIT___H diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index bbc1640f76146..bfeb812d67b25 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -160,7 +160,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_sleep_obj, mcu_sleep); //| //| .. module:: microcontroller.pin //| :synopsis: Microcontroller pin names -//| :platform: SAMD21 //| //| References to pins as named by the microcontroller""" //| diff --git a/shared-bindings/sleep/__init__.c b/shared-bindings/sleep/__init__.c deleted file mode 100644 index a714e002138be..0000000000000 --- a/shared-bindings/sleep/__init__.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2020 Scott Shawcroft - * - * 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 "shared-bindings/alarm/__init__.h" - -//| """Light and deep sleep used to save power -//| -//| The `sleep` module provides sleep related functionality. There are two supported levels of -//| sleep, light and deep. -//| -//| Light sleep leaves the CPU and RAM powered so that CircuitPython can resume where it left off -//| after being woken up. Light sleep is automatically done by CircuitPython when `time.sleep()` is -//| called. To light sleep until a non-time alarm use `sleep.sleep_until_alarm()`. Any active -//| peripherals, such as I2C, are left on. -//| -//| Deep sleep shuts down power to nearly all of the chip including the CPU and RAM. This can save -//| a more significant amount of power, but CircuitPython must start code.py from the beginning when woken -//| up. CircuitPython will enter deep sleep automatically when the current program exits without error -//| or calls `sys.exit(0)`. -//| If an error causes CircuitPython to exit, error LED error flashes will be done periodically. -//| An error includes an uncaught exception, or sys.exit called with a non-zero argumetn. -//| To set alarms for deep sleep use `sleep.restart_on_alarm()` they will apply to next deep sleep only.""" -//| - -//| wake_alarm: Alarm -//| """The most recent alarm to wake us up from a sleep (light or deep.)""" -//| - -//| reset_reason: ResetReason -//| """The reason the chip started up from reset state. This can may be power up or due to an alarm.""" -//| - -//| def sleep_until_alarm(alarm: Alarm, ...) -> Alarm: -//| """Performs a light sleep until woken by one of the alarms. The alarm that woke us up is -//| returned.""" -//| ... -//| - -STATIC mp_obj_t sleep_sleep_until_alarm(size_t n_args, const mp_obj_t *args) { -} -MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(sleep_sleep_until_alarm_obj, 1, MP_OBJ_FUN_ARGS_MAX, sleep_sleep_until_alarm); - -//| def restart_on_alarm(alarm: Alarm, ...) -> None: -//| """Set one or more alarms to wake up from a deep sleep. When awakened, ``code.py`` will restart -//| from the beginning. The last alarm to wake us up is available as `wake_alarm`. """ -//| ... -//| -STATIC mp_obj_t sleep_restart_on_alarm(size_t n_args, const mp_obj_t *args) { -} -MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(sleep_restart_on_alarm_obj, 1, MP_OBJ_FUN_ARGS_MAX, sleep_restart_on_alarm); - - -mp_map_elem_t sleep_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_sleep) }, - - { MP_ROM_QSTR(MP_QSTR_wake_alarm), mp_const_none }, - { MP_ROM_QSTR(MP_QSTR_reset_reason), mp_const_none }, - - { MP_ROM_QSTR(MP_QSTR_sleep_until_alarm), sleep_sleep_until_alarm_obj }, - { MP_ROM_QSTR(MP_QSTR_restart_on_alarm), sleep_restart_on_alarm_obj }, -}; -STATIC MP_DEFINE_MUTABLE_DICT(sleep_module_globals, sleep_module_globals_table); - -// These are called from common hal code to set the current wake alarm. -void common_hal_sleep_set_wake_alarm(mp_obj_t alarm) { - // Equivalent of: - // sleep.wake_alarm = alarm - mp_map_elem_t *elem = - mp_map_lookup(&sleep_module_globals_table, MP_ROM_QSTR(MP_QSTR_wake_alarm), MP_MAP_LOOKUP); - if (elem) { - elem->value = alarm; - } -} - -// These are called from common hal code to set the current wake alarm. -void common_hal_sleep_set_reset_reason(mp_obj_t reset_reason) { - // Equivalent of: - // sleep.reset_reason = reset_reason - mp_map_elem_t *elem = - mp_map_lookup(&sleep_module_globals_table, MP_ROM_QSTR(MP_QSTR_reset_reason), MP_MAP_LOOKUP); - if (elem) { - elem->value = reset_reason; - } -} - -const mp_obj_module_t sleep_module = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t*)&sleep_module_globals, -}; diff --git a/shared-bindings/sleep/__init__.h b/shared-bindings/sleep/__init__.h deleted file mode 100644 index cd23ba5e49e15..0000000000000 --- a/shared-bindings/sleep/__init__.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_SLEEP___INIT___H -#define MICROPY_INCLUDED_SHARED_BINDINGS_SLEEP___INIT___H - -#include "py/obj.h" - -extern mp_obj_t common_hal_sleep_get_wake_alarm(void); -extern sleep_reset_reason_t common_hal_sleep_get_reset_reason(void); - -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_SLEEPxs___INIT___H From b56645808c88cca22a42cb66ed7b3ddc8383436a Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 19 Nov 2020 11:44:22 +0530 Subject: [PATCH 217/770] fix crash on user code exit --- ports/esp32s2/common-hal/ps2io/Ps2.c | 6 ++++-- ports/esp32s2/common-hal/ps2io/Ps2.h | 2 ++ ports/esp32s2/supervisor/port.c | 5 +++++ shared-bindings/ps2io/Ps2.c | 5 +++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ports/esp32s2/common-hal/ps2io/Ps2.c b/ports/esp32s2/common-hal/ps2io/Ps2.c index 9c19ea950ee25..56199f4cbfb47 100644 --- a/ports/esp32s2/common-hal/ps2io/Ps2.c +++ b/ports/esp32s2/common-hal/ps2io/Ps2.c @@ -26,9 +26,7 @@ #include "common-hal/ps2io/Ps2.h" -#include "py/runtime.h" #include "supervisor/port.h" -#include "shared-bindings/ps2io/Ps2.h" #include "shared-bindings/microcontroller/__init__.h" #define STATE_IDLE 0 @@ -259,6 +257,10 @@ void common_hal_ps2io_ps2_deinit(ps2io_ps2_obj_t* self) { self->data_pin = GPIO_NUM_MAX; } +void ps2_reset(void) { + gpio_uninstall_isr_service(); +} + uint16_t common_hal_ps2io_ps2_get_len(ps2io_ps2_obj_t* self) { return self->bufcount; } diff --git a/ports/esp32s2/common-hal/ps2io/Ps2.h b/ports/esp32s2/common-hal/ps2io/Ps2.h index eb93829b46c5e..497952b250724 100644 --- a/ports/esp32s2/common-hal/ps2io/Ps2.h +++ b/ports/esp32s2/common-hal/ps2io/Ps2.h @@ -55,4 +55,6 @@ typedef struct { uint8_t cmd_response; } ps2io_ps2_obj_t; +void ps2_reset(void); + #endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PS2IO_PS2_H diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 47d0c7f463e48..f66a8511ad0a8 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -41,6 +41,7 @@ #include "common-hal/busio/I2C.h" #include "common-hal/busio/SPI.h" #include "common-hal/busio/UART.h" +#include "common-hal/ps2io/Ps2.h" #include "common-hal/pulseio/PulseIn.h" #include "common-hal/pwmio/PWMOut.h" #include "common-hal/watchdog/WatchDogTimer.h" @@ -104,6 +105,10 @@ void reset_port(void) { analogout_reset(); #endif +#if CIRCUITPY_PS2IO + ps2_reset(); +#endif + #if CIRCUITPY_PULSEIO esp32s2_peripherals_rmt_reset(); pulsein_reset(); diff --git a/shared-bindings/ps2io/Ps2.c b/shared-bindings/ps2io/Ps2.c index 0977e08ff79d4..07fa5cebb973f 100644 --- a/shared-bindings/ps2io/Ps2.c +++ b/shared-bindings/ps2io/Ps2.c @@ -116,8 +116,9 @@ STATIC void check_for_deinit(ps2io_ps2_obj_t *self) { //| ... //| STATIC mp_obj_t ps2io_ps2_obj___exit__(size_t n_args, const mp_obj_t *args) { - (void)n_args; - common_hal_ps2io_ps2_deinit(args[0]); + mp_check_self(MP_OBJ_IS_TYPE(args[0], &ps2io_ps2_type)); + ps2io_ps2_obj_t *self = MP_OBJ_TO_PTR(args[0]); + common_hal_ps2io_ps2_deinit(self); return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(ps2io_ps2___exit___obj, 4, 4, ps2io_ps2_obj___exit__); From 040eaa044344562ec1f9905d67b612ea2ec12949 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 19 Nov 2020 15:30:15 +0530 Subject: [PATCH 218/770] re-organize and clean-up --- ports/esp32s2/common-hal/ps2io/Ps2.c | 200 +++++++++++++-------------- 1 file changed, 100 insertions(+), 100 deletions(-) diff --git a/ports/esp32s2/common-hal/ps2io/Ps2.c b/ports/esp32s2/common-hal/ps2io/Ps2.c index 56199f4cbfb47..003f0d827eac2 100644 --- a/ports/esp32s2/common-hal/ps2io/Ps2.c +++ b/ports/esp32s2/common-hal/ps2io/Ps2.c @@ -48,103 +48,16 @@ #define ERROR_TX_RTS 0x1000 #define ERROR_TX_NORESP 0x2000 -static void IRAM_ATTR ps2_interrupt_handler(void *self_in); - -static void ps2_set_config(ps2io_ps2_obj_t* self) { - // turn on falling edge interrupt - gpio_set_intr_type(self->clk_pin, GPIO_INTR_NEGEDGE); - gpio_install_isr_service(ESP_INTR_FLAG_IRAM); - gpio_isr_handler_add(self->clk_pin, ps2_interrupt_handler, (void*)self); -} - -static void disable_interrupt(ps2io_ps2_obj_t* self) { - // turn off fallling edge interrupt - gpio_isr_handler_remove(self->clk_pin); -} - -static void resume_interrupt(ps2io_ps2_obj_t* self) { - self->state = STATE_IDLE; - gpio_isr_handler_add(self->clk_pin, ps2_interrupt_handler, (void*)self); -} - -static void clk_hi(ps2io_ps2_obj_t* self) { - // external pull-up - gpio_set_direction(self->clk_pin, GPIO_MODE_INPUT); - gpio_pullup_dis(self->clk_pin); -} - -static bool wait_clk_lo(ps2io_ps2_obj_t* self, uint32_t us) { - clk_hi(self); - common_hal_mcu_delay_us(1); - while (gpio_get_level(self->clk_pin) && us) { - --us; - common_hal_mcu_delay_us(1); - } - return us; -} - -static bool wait_clk_hi(ps2io_ps2_obj_t* self, uint32_t us) { - clk_hi(self); - common_hal_mcu_delay_us(1); - while (!gpio_get_level(self->clk_pin) && us) { - --us; - common_hal_mcu_delay_us(1); - } - return us; -} - -static void clk_lo(ps2io_ps2_obj_t* self) { - gpio_pullup_dis(self->clk_pin); - gpio_set_direction(self->clk_pin, GPIO_MODE_OUTPUT); - gpio_set_level(self->clk_pin, 0); -} - -static void data_hi(ps2io_ps2_obj_t* self) { - // external pull-up - gpio_set_direction(self->data_pin, GPIO_MODE_INPUT); - gpio_pullup_dis(self->data_pin); -} - -static bool wait_data_lo(ps2io_ps2_obj_t* self, uint32_t us) { - data_hi(self); - common_hal_mcu_delay_us(1); - while (gpio_get_level(self->data_pin) && us) { - --us; - common_hal_mcu_delay_us(1); - } - return us; -} - -static bool wait_data_hi(ps2io_ps2_obj_t* self, uint32_t us) { - data_hi(self); - common_hal_mcu_delay_us(1); - while (!gpio_get_level(self->data_pin) && us) { - --us; - common_hal_mcu_delay_us(1); - } - return us; -} - -static void data_lo(ps2io_ps2_obj_t* self) { - gpio_pullup_dis(self->data_pin); - gpio_set_direction(self->data_pin, GPIO_MODE_OUTPUT); - gpio_set_level(self->data_pin, 0); -} - -static void idle(ps2io_ps2_obj_t* self) { - clk_hi(self); - data_hi(self); -} - -static void inhibit(ps2io_ps2_obj_t* self) { - clk_lo(self); - data_hi(self); +void ps2_reset(void) { + gpio_uninstall_isr_service(); } static void delay_us(uint32_t t) { common_hal_mcu_delay_us(t); } +/* interrupt handling */ + static void IRAM_ATTR ps2_interrupt_handler(void *self_in) { // Grab the current time first. uint64_t current_tick = port_get_raw_ticks(NULL); @@ -222,11 +135,99 @@ static void IRAM_ATTR ps2_interrupt_handler(void *self_in) { } } -void common_hal_ps2io_ps2_construct(ps2io_ps2_obj_t* self, - const mcu_pin_obj_t* data_pin, const mcu_pin_obj_t* clk_pin) { +static void enable_interrupt(ps2io_ps2_obj_t* self) { + // turn on falling edge interrupt + gpio_install_isr_service(ESP_INTR_FLAG_IRAM); + gpio_set_intr_type(self->clk_pin, GPIO_INTR_NEGEDGE); + gpio_isr_handler_add(self->clk_pin, ps2_interrupt_handler, (void*)self); +} + +static void disable_interrupt(ps2io_ps2_obj_t* self) { + // turn off fallling edge interrupt + gpio_isr_handler_remove(self->clk_pin); +} + +static void resume_interrupt(ps2io_ps2_obj_t* self) { + self->state = STATE_IDLE; + gpio_isr_handler_add(self->clk_pin, ps2_interrupt_handler, (void*)self); +} + +/* gpio handling */ + +static void clk_hi(ps2io_ps2_obj_t* self) { + // external pull-up + gpio_set_direction(self->clk_pin, GPIO_MODE_INPUT); +} + +static bool wait_clk_lo(ps2io_ps2_obj_t* self, uint32_t us) { + clk_hi(self); + delay_us(1); + while (gpio_get_level(self->clk_pin) && us) { + --us; + delay_us(1); + } + return us; +} + +static bool wait_clk_hi(ps2io_ps2_obj_t* self, uint32_t us) { + clk_hi(self); + delay_us(1); + while (!gpio_get_level(self->clk_pin) && us) { + --us; + delay_us(1); + } + return us; +} + +static void clk_lo(ps2io_ps2_obj_t* self) { + gpio_set_direction(self->clk_pin, GPIO_MODE_OUTPUT); + gpio_set_level(self->clk_pin, 0); +} + +static void data_hi(ps2io_ps2_obj_t* self) { + // external pull-up + gpio_set_direction(self->data_pin, GPIO_MODE_INPUT); +} + +static bool wait_data_lo(ps2io_ps2_obj_t* self, uint32_t us) { + data_hi(self); + delay_us(1); + while (gpio_get_level(self->data_pin) && us) { + --us; + delay_us(1); + } + return us; +} + +static bool wait_data_hi(ps2io_ps2_obj_t* self, uint32_t us) { + data_hi(self); + delay_us(1); + while (!gpio_get_level(self->data_pin) && us) { + --us; + delay_us(1); + } + return us; +} + +static void data_lo(ps2io_ps2_obj_t* self) { + gpio_set_direction(self->data_pin, GPIO_MODE_OUTPUT); + gpio_set_level(self->data_pin, 0); +} + +static void idle(ps2io_ps2_obj_t* self) { clk_hi(self); data_hi(self); +} + +static void inhibit(ps2io_ps2_obj_t* self) { + clk_lo(self); + data_hi(self); +} + +/* ps2io module functions */ +void common_hal_ps2io_ps2_construct(ps2io_ps2_obj_t* self, + const mcu_pin_obj_t* data_pin, const mcu_pin_obj_t* clk_pin) { self->clk_pin = (gpio_num_t)clk_pin->number; self->data_pin = (gpio_num_t)data_pin->number; self->state = STATE_IDLE; @@ -235,11 +236,11 @@ void common_hal_ps2io_ps2_construct(ps2io_ps2_obj_t* self, self->bufposw = 0; self->waiting_cmd_response = false; + idle(self); + enable_interrupt(self); + claim_pin(clk_pin); claim_pin(data_pin); - - // set config will enable the interrupt. - ps2_set_config(self); } bool common_hal_ps2io_ps2_deinited(ps2io_ps2_obj_t* self) { @@ -257,10 +258,6 @@ void common_hal_ps2io_ps2_deinit(ps2io_ps2_obj_t* self) { self->data_pin = GPIO_NUM_MAX; } -void ps2_reset(void) { - gpio_uninstall_isr_service(); -} - uint16_t common_hal_ps2io_ps2_get_len(ps2io_ps2_obj_t* self) { return self->bufcount; } @@ -291,6 +288,8 @@ uint16_t common_hal_ps2io_ps2_clear_errors(ps2io_ps2_obj_t* self) { int16_t common_hal_ps2io_ps2_sendcmd(ps2io_ps2_obj_t* self, uint8_t b) { disable_interrupt(self); + + /* terminate a transmission if we have */ inhibit(self); delay_us(100); @@ -321,6 +320,7 @@ int16_t common_hal_ps2io_ps2_sendcmd(ps2io_ps2_obj_t* self, uint8_t b) { } } + /* Parity bit */ delay_us(15); if (parity) { data_hi(self); From 76d4824728c6dc99d9bfed48a41933fa48c8bbf7 Mon Sep 17 00:00:00 2001 From: Kamil Tomaszewski Date: Thu, 19 Nov 2020 15:04:52 +0100 Subject: [PATCH 219/770] spresense: Return fixed stack --- ports/cxd56/supervisor/port.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/cxd56/supervisor/port.c b/ports/cxd56/supervisor/port.c index 92d335cd5974b..086c2d198ec3a 100644 --- a/ports/cxd56/supervisor/port.c +++ b/ports/cxd56/supervisor/port.c @@ -98,8 +98,12 @@ void reset_to_bootloader(void) { } } +supervisor_allocation _fixed_stack; + supervisor_allocation* port_fixed_stack(void) { - return NULL; + _fixed_stack.ptr = port_stack_get_limit(); + _fixed_stack.length = (port_stack_get_top() - port_stack_get_limit()) * sizeof(uint32_t); + return &_fixed_stack; } uint32_t *port_stack_get_limit(void) { From dd108b755dc2bb886df14c9fcfcd4f09be61f2d4 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Nov 2020 11:36:02 -0600 Subject: [PATCH 220/770] esp32s2: initialize event loop ane netif only once deinitting these seems to cause problems. --- ports/esp32s2/common-hal/wifi/__init__.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/__init__.c b/ports/esp32s2/common-hal/wifi/__init__.c index 1b244dd2ff802..f53e68fc28c12 100644 --- a/ports/esp32s2/common-hal/wifi/__init__.c +++ b/ports/esp32s2/common-hal/wifi/__init__.c @@ -88,14 +88,17 @@ static void event_handler(void* arg, esp_event_base_t event_base, } } -static bool wifi_inited; +static bool wifi_inited, wifi_ever_inited; void common_hal_wifi_init(void) { wifi_inited = true; common_hal_wifi_radio_obj.base.type = &wifi_radio_type; - ESP_ERROR_CHECK(esp_netif_init()); - ESP_ERROR_CHECK(esp_event_loop_create_default()); + if (!wifi_ever_inited) { + ESP_ERROR_CHECK(esp_netif_init()); + ESP_ERROR_CHECK(esp_event_loop_create_default()); + } + wifi_ever_inited = true; wifi_radio_obj_t* self = &common_hal_wifi_radio_obj; self->netif = esp_netif_create_default_wifi_sta(); From 331aa6e59fd36b52afb4119068d0baa99c85ea3c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Nov 2020 11:43:18 -0600 Subject: [PATCH 221/770] displayio: When the display is tall, move blinka above the text This makes a more useful display on the portrait magtag, allowing 21 characters across instead of just 18. There are 20 full rows of text, instead of 21. The total number of characters increases slightly from 378 to 420. For comparison, the Commodore VIC 20 had 22 rows of 23 characters for a total of 506 characters. :-P --- supervisor/shared/display.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c index afb3f3a9a697a..a9ae25884239f 100644 --- a/supervisor/shared/display.c +++ b/supervisor/shared/display.c @@ -60,18 +60,21 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) { #if CIRCUITPY_TERMINALIO displayio_tilegrid_t* grid = &supervisor_terminal_text_grid; - uint16_t width_in_tiles = (width_px - blinka_bitmap.width) / grid->tile_width; + bool tall = height_px > width_px; + uint16_t terminal_width_px = tall ? width_px : width_px - blinka_bitmap.width; + uint16_t terminal_height_px = tall ? height_px - blinka_bitmap.height : height_px ; + uint16_t width_in_tiles = terminal_width_px / grid->tile_width; // determine scale based on h if (width_in_tiles < 80) { scale = 1; } - width_in_tiles = (width_px - blinka_bitmap.width * scale) / (grid->tile_width * scale); + width_in_tiles = terminal_width_px / (grid->tile_width * scale); if (width_in_tiles < 1) { width_in_tiles = 1; } - uint16_t height_in_tiles = height_px / (grid->tile_height * scale); - uint16_t remaining_pixels = height_px % (grid->tile_height * scale); + uint16_t height_in_tiles = terminal_height_px / (grid->tile_height * scale); + uint16_t remaining_pixels = tall ? 0 : terminal_height_px % (grid->tile_height * scale); if (height_in_tiles < 1 || remaining_pixels > 0) { height_in_tiles += 1; } @@ -91,7 +94,8 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) { if (tiles == NULL) { return; } - grid->y = 0; + grid->y = tall ? blinka_bitmap.height : 0; + grid->x = tall ? 0 : blinka_bitmap.width; grid->top_left_y = 0; if (remaining_pixels > 0) { grid->y -= (grid->tile_height - remaining_pixels); From bc9036f35370fcd0e4806c42dd47a8c6bb42a085 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Fri, 20 Nov 2020 00:15:30 +0530 Subject: [PATCH 222/770] use pointer to get nvs handle --- ports/esp32s2/common-hal/nvm/ByteArray.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/ports/esp32s2/common-hal/nvm/ByteArray.c b/ports/esp32s2/common-hal/nvm/ByteArray.c index d90f7fbdc2d82..9f8ced3ec554c 100644 --- a/ports/esp32s2/common-hal/nvm/ByteArray.c +++ b/ports/esp32s2/common-hal/nvm/ByteArray.c @@ -27,14 +27,13 @@ #include "common-hal/nvm/ByteArray.h" #include "py/runtime.h" - #include "nvs_flash.h" uint32_t common_hal_nvm_bytearray_get_length(nvm_bytearray_obj_t *self) { return self->len; } -static nvs_handle get_nvs_handle(void) { +static void get_nvs_handle(nvs_handle_t * nvs_handle) { // Initialize NVS esp_err_t err = nvs_flash_init(); if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) { @@ -46,32 +45,31 @@ static nvs_handle get_nvs_handle(void) { ESP_ERROR_CHECK(err); // Open NVS handle - nvs_handle nvs_handle; - if (nvs_open("CPY", NVS_READWRITE, &nvs_handle) != ESP_OK) { + if (nvs_open("CPY", NVS_READWRITE, nvs_handle) != ESP_OK) { mp_raise_RuntimeError(translate("NVS Error")); } - return nvs_handle; } bool common_hal_nvm_bytearray_set_bytes(nvm_bytearray_obj_t *self, uint32_t start_index, uint8_t* values, uint32_t len) { char index[9]; - sprintf(index, "%i", start_index - CIRCUITPY_INTERNAL_NVM_START_ADDR); + sprintf(index, "%i", start_index); // start nvs - nvs_handle handle = get_nvs_handle(); + nvs_handle_t handle; + get_nvs_handle(&handle); bool status = ((nvs_set_u8(handle, (const char *)index, *values) == ESP_OK) && (nvs_commit(handle) == ESP_OK)); // close nvs nvs_close(handle); return status; } -// NVM memory is memory mapped so reading it is easy. void common_hal_nvm_bytearray_get_bytes(nvm_bytearray_obj_t *self, uint32_t start_index, uint32_t len, uint8_t* values) { char index[9]; - sprintf(index, "%i", start_index - CIRCUITPY_INTERNAL_NVM_START_ADDR); + sprintf(index, "%i", start_index); // start nvs - nvs_handle handle = get_nvs_handle(); + nvs_handle_t handle; + get_nvs_handle(&handle); if (nvs_get_u8(handle, (const char *)index, values) != ESP_OK) { mp_raise_RuntimeError(translate("NVS Error")); } From a25b27520d077424219832d764e9e59da6759562 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Fri, 20 Nov 2020 00:22:00 +0530 Subject: [PATCH 223/770] update nvm implementation --- ports/esp32s2/common-hal/nvm/ByteArray.c | 40 ++++++++++++++++++++---- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/ports/esp32s2/common-hal/nvm/ByteArray.c b/ports/esp32s2/common-hal/nvm/ByteArray.c index 9f8ced3ec554c..e304dd83028f1 100644 --- a/ports/esp32s2/common-hal/nvm/ByteArray.c +++ b/ports/esp32s2/common-hal/nvm/ByteArray.c @@ -26,6 +26,8 @@ #include "common-hal/nvm/ByteArray.h" +#include + #include "py/runtime.h" #include "nvs_flash.h" @@ -53,26 +55,52 @@ static void get_nvs_handle(nvs_handle_t * nvs_handle) { bool common_hal_nvm_bytearray_set_bytes(nvm_bytearray_obj_t *self, uint32_t start_index, uint8_t* values, uint32_t len) { char index[9]; - sprintf(index, "%i", start_index); + + uint8_t buffer[len]; + memcpy(buffer, values, len); + // start nvs nvs_handle_t handle; get_nvs_handle(&handle); - bool status = ((nvs_set_u8(handle, (const char *)index, *values) == ESP_OK) && (nvs_commit(handle) == ESP_OK)); + + // stage flash changes + for (uint32_t i = 0; i < len; i++) { + sprintf(index, "%i", start_index + i); + if (nvs_set_u8(handle, (const char *)index, buffer[i]) != ESP_OK) { + return false; + } + } + + // commit flash changes + if (nvs_commit(handle) != ESP_OK) { + return false; + } + // close nvs nvs_close(handle); - return status; + return true; } void common_hal_nvm_bytearray_get_bytes(nvm_bytearray_obj_t *self, uint32_t start_index, uint32_t len, uint8_t* values) { char index[9]; - sprintf(index, "%i", start_index); + uint8_t buffer[len]; + // start nvs nvs_handle_t handle; get_nvs_handle(&handle); - if (nvs_get_u8(handle, (const char *)index, values) != ESP_OK) { - mp_raise_RuntimeError(translate("NVS Error")); + + // get from flash + for (uint32_t i = 0; i < len; i++) { + sprintf(index, "%i", start_index + i); + if (nvs_get_u8(handle, (const char *)index, &buffer[i]) != ESP_OK) { + mp_raise_RuntimeError(translate("NVS Error")); + } } + + // set into values + memcpy(values, buffer, len); + // close nvs nvs_close(handle); } From 649c9305364f10ea1dc43179e768ec968d0b9ed5 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 19 Nov 2020 15:43:39 -0500 Subject: [PATCH 224/770] wip --- main.c | 18 ++++--- ports/esp32s2/common-hal/alarm/pin/PinAlarm.c | 52 +++++++++++++++++++ ports/esp32s2/common-hal/alarm/pin/PinAlarm.h | 36 +++++++++++++ .../{alarm_io => alarm/pin}/__init__.c | 0 .../common-hal/alarm/time/DurationAlarm.c | 48 +++++++++++++++++ .../common-hal/alarm/time/DurationAlarm.h | 34 ++++++++++++ .../esp32s2/common-hal/alarm_time/__init__.c | 13 ----- py/circuitpy_defns.mk | 5 +- py/circuitpy_mpconfig.mk | 3 -- shared-bindings/alarm/ResetReason.c | 24 ++++++--- shared-bindings/alarm/ResetReason.h | 8 ++- shared-bindings/alarm/pin/PinAlarm.c | 12 +++-- shared-bindings/alarm/pin/PinAlarm.h | 5 ++ shared-bindings/alarm/time/DurationAlarm.h | 6 +++ supervisor/shared/rgb_led_status.c | 7 +-- supervisor/shared/rgb_led_status.h | 2 +- supervisor/shared/safe_mode.c | 9 +++- 17 files changed, 234 insertions(+), 48 deletions(-) create mode 100644 ports/esp32s2/common-hal/alarm/pin/PinAlarm.c create mode 100644 ports/esp32s2/common-hal/alarm/pin/PinAlarm.h rename ports/esp32s2/common-hal/{alarm_io => alarm/pin}/__init__.c (100%) create mode 100644 ports/esp32s2/common-hal/alarm/time/DurationAlarm.c create mode 100644 ports/esp32s2/common-hal/alarm/time/DurationAlarm.h delete mode 100644 ports/esp32s2/common-hal/alarm_time/__init__.c diff --git a/main.c b/main.c index a200b6264143e..251cb00a3fa44 100755 --- a/main.c +++ b/main.c @@ -63,6 +63,10 @@ #include "boards/board.h" +#if CIRCUITPY_ALARM +#include "shared-bindings/alarm/__init__.h" +#endif + #if CIRCUITPY_DISPLAYIO #include "shared-module/displayio/__init__.h" #endif @@ -88,10 +92,6 @@ #include "common-hal/canio/CAN.h" #endif -#if CIRCUITPY_SLEEP -#include "shared-bindings/sleep/__init__.h" -#endif - void do_str(const char *src, mp_parse_input_kind_t input_kind) { mp_lexer_t *lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, src, strlen(src), 0); if (lex == NULL) { @@ -320,7 +320,7 @@ bool run_code_py(safe_mode_t safe_mode) { #endif rgb_status_animation_t animation; bool ok = result->return_code != PYEXEC_EXCEPTION; - #if CIRCUITPY_SLEEP + #if CIRCUITPY_ALARM // If USB isn't enumerated then deep sleep. if (ok && !supervisor_workflow_active() && supervisor_ticks_ms64() > CIRCUITPY_USB_ENUMERATION_DELAY * 1024) { common_hal_sleep_deep_sleep(); @@ -361,7 +361,7 @@ bool run_code_py(safe_mode_t safe_mode) { #endif bool animation_done = tick_rgb_status_animation(&animation); if (animation_done && supervisor_workflow_active()) { - #if CIRCUITPY_SLEEP + #if CIRCUITPY_ALARM int64_t remaining_enumeration_wait = CIRCUITPY_USB_ENUMERATION_DELAY * 1024 - supervisor_ticks_ms64(); // If USB isn't enumerated then deep sleep after our waiting period. if (ok && remaining_enumeration_wait < 0) { @@ -423,9 +423,13 @@ void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) { if (!skip_boot_output) { // Wait 1.5 seconds before opening CIRCUITPY_BOOT_OUTPUT_FILE for write, // in case power is momentary or will fail shortly due to, say a low, battery. - if (common_hal_sleep_get_reset_reason() == RESET_REASON_POWER_VALID) { +#if CIRCUITPY_ALARM + if (common_hal_sleep_get_reset_reason() == RESET_REASON_POWER_ON) { +#endif mp_hal_delay_ms(1500); +#if CIRCUITPY_ALARM } +#endif // USB isn't up, so we can write the file. filesystem_set_internal_writable_by_usb(false); diff --git a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c new file mode 100644 index 0000000000000..12114066658d2 --- /dev/null +++ b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c @@ -0,0 +1,52 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 @microDev1 (GitHub) + * Copyright (c) 2020 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 "esp_sleep.h" + +#include "shared-bindings/alarm/time/DurationAlarm.h" + +void common_hal_alarm_pin_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, mcu_pin_obj_t *pin, bool level, bool edge, bool pull) { + self->pin = pin; + self->level = level; + self->edge = edge; + self->pull = pull; + +mcu_pin_obj_t *common_hal_alarm_pin_pin_alarm_get_pin(alarm_pin_pin_alarm_obj_t *self) { + return self->pin; +} + +bool common_hal_alarm_pin_pin_alarm_get_level(alarm_pin_pin_alarm_obj_t *self) { + return self->level; +} + +bool common_hal_alarm_pin_pin_alarm_get_edge(alarm_pin_pin_alarm_obj_t *self) { + return self->edge; +} + +bool common_hal_alarm_pin_pin_alarm_get_pull(alarm_pin_pin_alarm_obj_t *self) { + return self->pull; +} diff --git a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h new file mode 100644 index 0000000000000..52739185848f4 --- /dev/null +++ b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h @@ -0,0 +1,36 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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 "py/obj.h" + +typedef struct { + mp_obj_base_t base; + mcu_pin_obj_t *pin; + bool level; + bool edge; + bool pull; +} alarm_pin_pin_alarm_obj_t; diff --git a/ports/esp32s2/common-hal/alarm_io/__init__.c b/ports/esp32s2/common-hal/alarm/pin/__init__.c similarity index 100% rename from ports/esp32s2/common-hal/alarm_io/__init__.c rename to ports/esp32s2/common-hal/alarm/pin/__init__.c diff --git a/ports/esp32s2/common-hal/alarm/time/DurationAlarm.c b/ports/esp32s2/common-hal/alarm/time/DurationAlarm.c new file mode 100644 index 0000000000000..bf1a6cc421f16 --- /dev/null +++ b/ports/esp32s2/common-hal/alarm/time/DurationAlarm.c @@ -0,0 +1,48 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 @microDev1 (GitHub) + * Copyright (c) 2020 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 "esp_sleep.h" + +#include "shared-bindings/alarm/time/DurationAlarm.h" + +void common_hal_alarm_time_duration_alarm_construct(alarm_time_duration_alarm_obj_t *self, mp_float_t duration) { + self->duration = duration; +} + +mp_float_t common_hal_alarm_time_duration_alarm_get_duration(alarm_time_duration_alarm_obj_t *self) { + return self->duration; +} +void common_hal_alarm_time_duration_alarm_enable(alarm_time_duration_alarm_obj_t *self) + if (esp_sleep_enable_timer_wakeup((uint64_t) (self->duration * 1000000)) == ESP_ERR_INVALID_ARG) { + mp_raise_ValueError(translate("duration out of range")); + } +} + +void common_hal_alarm_time_duration_alarm_disable (alarm_time_duration_alarm_obj_t *self) { + (void) self; + esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_TIMER); +} diff --git a/ports/esp32s2/common-hal/alarm/time/DurationAlarm.h b/ports/esp32s2/common-hal/alarm/time/DurationAlarm.h new file mode 100644 index 0000000000000..3e81cbac2fc50 --- /dev/null +++ b/ports/esp32s2/common-hal/alarm/time/DurationAlarm.h @@ -0,0 +1,34 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 @microDev1 (GitHub) + * Copyright (c) 2020 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 "py/obj.h" + +typedef struct { + mp_obj_base_t base; + mp_float_t duration; // seconds +} alarm_time_duration_alarm_obj_t; diff --git a/ports/esp32s2/common-hal/alarm_time/__init__.c b/ports/esp32s2/common-hal/alarm_time/__init__.c deleted file mode 100644 index 252b6e107cdb5..0000000000000 --- a/ports/esp32s2/common-hal/alarm_time/__init__.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "esp_sleep.h" - -#include "shared-bindings/alarm_time/__init__.h" - -void common_hal_alarm_time_duration (uint32_t ms) { - if (esp_sleep_enable_timer_wakeup((ms) * 1000) == ESP_ERR_INVALID_ARG) { - mp_raise_ValueError(translate("time out of range")); - } -} - -void common_hal_alarm_time_disable (void) { - esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_TIMER); -} diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index dd36c9457f65f..dbde1a34d6555 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -302,9 +302,8 @@ SRC_COMMON_HAL_ALL = \ _pew/PewPew.c \ _pew/__init__.c \ alarm/__init__.c \ - alarm/pin/__init__.c \ - alarm/time/__init__.c \ - alarm/touch/__init__.c \ + alarm/pin/PinAlarm.c \ + alarm/time/DurationAlarm.c \ analogio/AnalogIn.c \ analogio/AnalogOut.c \ analogio/__init__.c \ diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 6192ee8a7afa6..6d555a44b479a 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -42,9 +42,6 @@ CFLAGS += -DCIRCUITPY_AESIO=$(CIRCUITPY_AESIO) # TODO: CIRCUITPY_ALARM will gradually be added to # as many ports as possible # so make this 1 or CIRCUITPY_FULL_BUILD eventually -CIRCUITPY_SLEEPIO ?= 0 -CFLAGS += -DCIRCUITPY_SLEEPIO=$(CIRCUITPY_SLEEPIO) - CIRCUITPY_ALARM ?= 0 CFLAGS += -DCIRCUITPY_ALARM=$(CIRCUITPY_ALARM) diff --git a/shared-bindings/alarm/ResetReason.c b/shared-bindings/alarm/ResetReason.c index 456715a08ea4a..c46b2ba8f101d 100644 --- a/shared-bindings/alarm/ResetReason.c +++ b/shared-bindings/alarm/ResetReason.c @@ -28,7 +28,7 @@ #include "shared-bindings/alarm/ResetReason.h" -MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, POWER_VALID, RESET_REASON_POWER_VALID); +MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, POWER_VALID, RESET_REASON_POWER_ON); MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, SOFTWARE, RESET_REASON_SOFTWARE); MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, DEEP_SLEEP_ALARM, RESET_REASON_DEEP_SLEEP_ALARM); MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, EXTERNAL, RESET_REASON_EXTERNAL); @@ -36,23 +36,31 @@ MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, EXTERNAL, RESET_REASON_EX //| class ResetReason: //| """The reason the chip was last reset""" //| -//| POWER_VALID: object -//| """The chip was reset and started once power levels were valid.""" +//| POWER_ON: object +//| """The chip was started from power off.""" +//| +//| BROWNOUT: object +//| """The chip was reset due to voltage brownout.""" //| //| SOFTWARE: object //| """The chip was reset from software.""" //| //| DEEP_SLEEP_ALARM: object -//| """The chip was reset for deep sleep and started by an alarm.""" +//| """The chip was reset for deep sleep and restarted by an alarm.""" +//| +//| RESET_PIN: object +//| """The chip was reset by a signal on its reset pin. The pin might be connected to a reset buton.""" //| -//| EXTERNAL: object -//| """The chip was reset by an external input such as a button.""" +//| WATCHDOG: object +//| """The chip was reset by its watchdog timer.""" //| MAKE_ENUM_MAP(alarm_reset_reason) { - MAKE_ENUM_MAP_ENTRY(reset_reason, POWER_VALID), + MAKE_ENUM_MAP_ENTRY(reset_reason, POWER_ON), + MAKE_ENUM_MAP_ENTRY(reset_reason, BROWNOUT), MAKE_ENUM_MAP_ENTRY(reset_reason, SOFTWARE), MAKE_ENUM_MAP_ENTRY(reset_reason, DEEP_SLEEP_ALARM), - MAKE_ENUM_MAP_ENTRY(reset_reason, EXTERNAL), + MAKE_ENUM_MAP_ENTRY(reset_reason, RESET_PIN), + MAKE_ENUM_MAP_ENTRY(reset_reason, WATCHDOG), }; STATIC MP_DEFINE_CONST_DICT(alarm_reset_reason_locals_dict, alarm_reset_reason_locals_table); diff --git a/shared-bindings/alarm/ResetReason.h b/shared-bindings/alarm/ResetReason.h index 6fe7a4bd31865..0325ba8e33405 100644 --- a/shared-bindings/alarm/ResetReason.h +++ b/shared-bindings/alarm/ResetReason.h @@ -28,12 +28,16 @@ #define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM__RESET_REASON__H typedef enum { - RESET_REASON_POWER_APPLIED, + RESET_REASON_POWER_ON, + RESET_REASON_BROWNOUT, RESET_REASON_SOFTWARE, RESET_REASON_DEEP_SLEEP_ALARM, - RESET_REASON_BUTTON, + RESET_REASON_RESET_PIN, + RESET_REASON_WATCHDOG, } alarm_reset_reason_t; extern const mp_obj_type_t alarm_reset_reason_type; +extern alarm_reset_reason_t common_hal_alarm_get_reset_reason(void); + #endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM__RESET_REASON__H diff --git a/shared-bindings/alarm/pin/PinAlarm.c b/shared-bindings/alarm/pin/PinAlarm.c index 1404fa3f41445..0146a3a1ad115 100644 --- a/shared-bindings/alarm/pin/PinAlarm.c +++ b/shared-bindings/alarm/pin/PinAlarm.c @@ -91,10 +91,14 @@ STATIC mp_obj_t alarm_pin_pin_alarm_binary_op(mp_binary_op_t op, mp_obj_t lhs_in if (MP_OBJ_IS_TYPE(rhs_in, &alarm_pin_pin_alarm_type)) { // Pins are singletons, so we can compare them directly. return mp_obj_new_bool( - common_hal_pin_pin_alarm_get_pin(lhs_in) == common_hal_pin_pin_alarm_get_pin(rhs_in) && - common_hal_pin_pin_alarm_get_level(lhs_in) == common_hal_pin_pin_alarm_get_level(rhs_in) && - common_hal_pin_pin_alarm_get_edge(lhs_in) == common_hal_pin_pin_alarm_get_edge(rhs_in) && - common_hal_pin_pin_alarm_get_pull(lhs_in) == common_hal_pin_pin_alarm_get_pull(rhs_in)) + common_hal_alarm_pin_pin_alarm_get_pin(lhs_in) == + common_hal_alarm_pin_pin_alarm_get_pin(rhs_in) && + common_hal_alarm_pin_pin_alarm_get_level(lhs_in) == + common_hal_alarm_pin_pin_alarm_get_level(rhs_in) && + common_hal_alarm_pin_pin_alarm_get_edge(lhs_in) == + common_hal_alarm_pin_pin_alarm_get_edge(rhs_in) && + common_hal_alarm_pin_pin_alarm_get_pull(lhs_in) == + common_hal_alarm_pin_pin_alarm_get_pull(rhs_in)); } return mp_const_false; diff --git a/shared-bindings/alarm/pin/PinAlarm.h b/shared-bindings/alarm/pin/PinAlarm.h index e38c7f620cc3d..b7c553ad5db2a 100644 --- a/shared-bindings/alarm/pin/PinAlarm.h +++ b/shared-bindings/alarm/pin/PinAlarm.h @@ -28,9 +28,14 @@ #define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_PIN_PIN_ALARM_H #include "py/obj.h" +#include "common-hal/microcontroller/Pin.h" extern const mp_obj_type_t alarm_pin_pin_alarm_type; extern void common_hal_alarm_pin_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, const mcu_pin_obj_t *pin, bool level, bool edge, bool pull); +extern mcu_pin_obj_t *common_hal_alarm_pin_pin_alarm_get_pin(alarm_pin_pin_alarm_obj_t *self); +extern bool common_hal_alarm_pin_pin_alarm_get_level(alarm_pin_pin_alarm_obj_t *self); +extern bool common_hal_alarm_pin_pin_alarm_get_edge(alarm_pin_pin_alarm_obj_t *self); +extern bool common_hal_alarm_pin_pin_alarm_get_pull(alarm_pin_pin_alarm_obj_t *self); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_PIN_PIN_ALARM_H diff --git a/shared-bindings/alarm/time/DurationAlarm.h b/shared-bindings/alarm/time/DurationAlarm.h index 1e4db6ac53f72..f6ab4f975c3db 100644 --- a/shared-bindings/alarm/time/DurationAlarm.h +++ b/shared-bindings/alarm/time/DurationAlarm.h @@ -31,4 +31,10 @@ extern const mp_obj_type_t alarm_time_duration_alarm_type; +extern void common_hal_alarm_time_duration_alarm_construct(alarm_time_duration_alarm_obj_t *self, mp_float_t duration); +extern mp_float_t common_hal_alarm_time_duration_alarm_get_duration(alarm_time_duration_alarm_obj_t *self); + +extern void common_hal_alarm_time_duration_alarm_enable(alarm_time_duration_alarm_obj_t *self); +extern void common_hal_alarm_time_duration_alarm_disable (alarm_time_duration_alarm_obj_t *self); + #endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_DURATION_ALARM_H diff --git a/supervisor/shared/rgb_led_status.c b/supervisor/shared/rgb_led_status.c index bff74a1f0e86b..c3d33ad3ea309 100644 --- a/supervisor/shared/rgb_led_status.c +++ b/supervisor/shared/rgb_led_status.c @@ -367,7 +367,6 @@ void prep_rgb_status_animation(const pyexec_result_t* result, status->found_main = found_main; status->total_exception_cycle = 0; status->ok = result->return_code != PYEXEC_EXCEPTION; - status->cycles = 0; if (status->ok) { // If this isn't an exception, skip exception sorting and handling return; @@ -419,9 +418,8 @@ bool tick_rgb_status_animation(rgb_status_animation_t* status) { // All is good. Ramp ALL_DONE up and down. if (tick_diff > ALL_GOOD_CYCLE_MS) { status->pattern_start = supervisor_ticks_ms32(); - status->cycles++; new_status_color(BLACK); - return status->cycles; + return true; } uint16_t brightness = tick_diff * 255 / (ALL_GOOD_CYCLE_MS / 2); @@ -436,8 +434,7 @@ bool tick_rgb_status_animation(rgb_status_animation_t* status) { } else { if (tick_diff > status->total_exception_cycle) { status->pattern_start = supervisor_ticks_ms32(); - status->cycles++; - return; + return true; } // First flash the file color. if (tick_diff < EXCEPTION_TYPE_LENGTH_MS) { diff --git a/supervisor/shared/rgb_led_status.h b/supervisor/shared/rgb_led_status.h index e4e1981a21ff4..84c97796a44aa 100644 --- a/supervisor/shared/rgb_led_status.h +++ b/supervisor/shared/rgb_led_status.h @@ -76,6 +76,6 @@ void prep_rgb_status_animation(const pyexec_result_t* result, bool found_main, safe_mode_t safe_mode, rgb_status_animation_t* status); -void tick_rgb_status_animation(rgb_status_animation_t* status); +bool tick_rgb_status_animation(rgb_status_animation_t* status); #endif // MICROPY_INCLUDED_SUPERVISOR_RGB_LED_STATUS_H diff --git a/supervisor/shared/safe_mode.c b/supervisor/shared/safe_mode.c index 905a0c408f34b..7630010d034e0 100644 --- a/supervisor/shared/safe_mode.c +++ b/supervisor/shared/safe_mode.c @@ -29,6 +29,9 @@ #include "mphalport.h" #include "shared-bindings/digitalio/DigitalInOut.h" +#if CIRCUITPY_ALARM +#include "shared-bindings/alarm/ResetReason.h" +#endif #include "supervisor/serial.h" #include "supervisor/shared/rgb_led_colors.h" @@ -52,10 +55,12 @@ safe_mode_t wait_for_safe_mode_reset(void) { current_safe_mode = safe_mode; return safe_mode; } - if (common_hal_sleep_get_reset_reason() != RESET_REASON_POWER_VALID && - common_hal_sleep_get_reset_reason() != RESET_REASON_BUTTON) { +#if CIRCUITPY_ALARM + if (common_hal_alarm_get_reset_reason() != RESET_REASON_POWER_ON && + common_hal_alarm_get_reset_reason() != RESET_REASON_RESET_PIN) { return NO_SAFE_MODE; } +#endif port_set_saved_word(SAFE_MODE_DATA_GUARD | (MANUAL_SAFE_MODE << 8)); // Wait for a while to allow for reset. temp_status_color(SAFE_MODE); From 0556f9f851f0bd5fdb392b925af1076affbf5e00 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Nov 2020 15:12:56 -0600 Subject: [PATCH 225/770] Revert "samd21: Enable terse error reporting on resource constrained chip family" This reverts commit 9a642fc0490c22b60460bcca8dec3b0b93344d81. --- ports/atmel-samd/mpconfigport.h | 1 - py/circuitpy_mpconfig.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/ports/atmel-samd/mpconfigport.h b/ports/atmel-samd/mpconfigport.h index 3069def33ba61..ed10da9b9d4bc 100644 --- a/ports/atmel-samd/mpconfigport.h +++ b/ports/atmel-samd/mpconfigport.h @@ -42,7 +42,6 @@ #define CIRCUITPY_MCU_FAMILY samd21 #define MICROPY_PY_SYS_PLATFORM "Atmel SAMD21" #define SPI_FLASH_MAX_BAUDRATE 8000000 -#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE) #define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0) #define MICROPY_PY_FUNCTION_ATTRS (0) // MICROPY_PY_UJSON depends on MICROPY_PY_IO diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 4c2e33be017be..85e152670a2f5 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -64,9 +64,7 @@ #define MICROPY_ENABLE_FINALISER (1) #define MICROPY_ENABLE_GC (1) #define MICROPY_ENABLE_SOURCE_LINE (1) -#ifndef MICROPY_ERROR_REPORTING #define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL) -#endif #define MICROPY_FLOAT_HIGH_QUALITY_HASH (0) #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT) #define MICROPY_GC_ALLOC_THRESHOLD (0) From d5f6748d1bea832c6f483ca8b0095e776eaca2df Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Nov 2020 16:12:53 -0600 Subject: [PATCH 226/770] Use mp_raise instead of nlr_raise(new_exception) where possible This saves a bit of code space --- extmod/machine_mem.c | 2 +- extmod/moduheapq.c | 2 +- extmod/vfs_posix_file.c | 2 +- py/bc.c | 4 ++-- py/objstr.c | 6 ++---- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/extmod/machine_mem.c b/extmod/machine_mem.c index 6c6e110631bbd..8944c3a6665d1 100644 --- a/extmod/machine_mem.c +++ b/extmod/machine_mem.c @@ -21,7 +21,7 @@ STATIC uintptr_t machine_mem_get_addr(mp_obj_t addr_o, uint align) { uintptr_t addr = mp_obj_int_get_truncated(addr_o); if ((addr & (align - 1)) != 0) { - nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, translate("address %08x is not aligned to %d bytes"), addr, align)); + mp_raise_ValueError_varg(translate("address %08x is not aligned to %d bytes"), addr, align); } return addr; } diff --git a/extmod/moduheapq.c b/extmod/moduheapq.c index bc4b97ff5be46..50fe6c0513d86 100644 --- a/extmod/moduheapq.c +++ b/extmod/moduheapq.c @@ -62,7 +62,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_uheapq_heappush_obj, mod_uheapq_heappush); STATIC mp_obj_t mod_uheapq_heappop(mp_obj_t heap_in) { mp_obj_list_t *heap = get_heap(heap_in); if (heap->len == 0) { - nlr_raise(mp_obj_new_exception_msg(&mp_type_IndexError, translate("empty heap"))); + mp_raise_IndexError(translate("empty heap")); } mp_obj_t item = heap->items[0]; heap->len -= 1; diff --git a/extmod/vfs_posix_file.c b/extmod/vfs_posix_file.c index 3f887785e72df..593b8d6a29a52 100644 --- a/extmod/vfs_posix_file.c +++ b/extmod/vfs_posix_file.c @@ -24,7 +24,7 @@ typedef struct _mp_obj_vfs_posix_file_t { #ifdef MICROPY_CPYTHON_COMPAT STATIC void check_fd_is_open(const mp_obj_vfs_posix_file_t *o) { if (o->fd < 0) { - nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, translate("I/O operation on closed file"))); + mp_raise_ValueError(translate("I/O operation on closed file")); } } #else diff --git a/py/bc.c b/py/bc.c index 64067133856b0..01131cb4c02b1 100644 --- a/py/bc.c +++ b/py/bc.c @@ -214,8 +214,8 @@ void mp_setup_code_state(mp_code_state_t *code_state, size_t n_args, size_t n_kw #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("unexpected keyword argument")); #else - nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, - translate("unexpected keyword argument '%q'"), MP_OBJ_QSTR_VALUE(wanted_arg_name))); + mp_raise_TypeError_varg( + translate("unexpected keyword argument '%q'"), MP_OBJ_QSTR_VALUE(wanted_arg_name)); #endif } mp_obj_dict_store(dict, kwargs[2 * i], kwargs[2 * i + 1]); diff --git a/py/objstr.c b/py/objstr.c index edb562df27bdf..6a03f5fc3e419 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -2134,10 +2134,8 @@ STATIC NORETURN void bad_implicit_conversion(mp_obj_t self_in) { mp_raise_TypeError(translate("can't convert to str implicitly")); } else { const qstr src_name = mp_obj_get_type_qstr(self_in); - nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, - translate("can't convert '%q' object to %q implicitly"), - src_name, src_name == MP_QSTR_str ? MP_QSTR_bytes : MP_QSTR_str)); - } + mp_raise_TypeError_varg(translate("can't convert '%q' object to %q implicitly"), + src_name, src_name == MP_QSTR_str ? MP_QSTR_bytes : MP_QSTR_str); } // use this if you will anyway convert the string to a qstr From c06fc8e02dc7c17e827e3fe736dc7226d7819452 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Nov 2020 16:13:54 -0600 Subject: [PATCH 227/770] Introduce, use mp_raise_arg1 This raises an exception with a given object value. Saves a bit of code size. --- extmod/modure.c | 6 +++--- extmod/moduzlib.c | 2 +- ports/unix/modjni.c | 4 ++-- py/modsys.c | 2 +- py/objdict.c | 6 +++--- py/objset.c | 2 +- py/objstr.c | 2 +- py/pystack.c | 4 ++-- py/runtime.c | 8 ++++++-- py/runtime.h | 1 + 10 files changed, 21 insertions(+), 16 deletions(-) diff --git a/extmod/modure.c b/extmod/modure.c index a20f3ee4297c8..bb54bc732f5b5 100644 --- a/extmod/modure.c +++ b/extmod/modure.c @@ -43,7 +43,7 @@ STATIC mp_obj_t match_group(mp_obj_t self_in, mp_obj_t no_in) { mp_obj_match_t *self = MP_OBJ_TO_PTR(self_in); mp_int_t no = mp_obj_get_int(no_in); if (no < 0 || no >= self->num_matches) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_IndexError, no_in)); + mp_raise_arg1(&mp_type_IndexError, no_in); } const char *start = self->caps[no * 2]; @@ -82,7 +82,7 @@ STATIC void match_span_helper(size_t n_args, const mp_obj_t *args, mp_obj_t span if (n_args == 2) { no = mp_obj_get_int(args[1]); if (no < 0 || no >= self->num_matches) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_IndexError, args[1])); + mp_raise_arg1(&mp_type_IndexError, args[1]); } } @@ -326,7 +326,7 @@ STATIC mp_obj_t re_sub_helper(mp_obj_t self_in, size_t n_args, const mp_obj_t *a } if (match_no >= (unsigned int)match->num_matches) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_IndexError, MP_OBJ_NEW_SMALL_INT(match_no))); + mp_raise_arg1(&mp_type_IndexError, MP_OBJ_NEW_SMALL_INT(match_no)); } const char *start_match = match->caps[match_no * 2]; diff --git a/extmod/moduzlib.c b/extmod/moduzlib.c index 8422e7598335d..b344f96429409 100644 --- a/extmod/moduzlib.c +++ b/extmod/moduzlib.c @@ -179,7 +179,7 @@ STATIC mp_obj_t mod_uzlib_decompress(size_t n_args, const mp_obj_t *args) { return res; error: - nlr_raise(mp_obj_new_exception_arg1(&mp_type_ValueError, MP_OBJ_NEW_SMALL_INT(st))); + mp_raise_arg1(&mp_type_ValueError, MP_OBJ_NEW_SMALL_INT(st)); } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_uzlib_decompress_obj, 1, 3, mod_uzlib_decompress); diff --git a/ports/unix/modjni.c b/ports/unix/modjni.c index 8ec5ae54d939b..82d1ccd559426 100644 --- a/ports/unix/modjni.c +++ b/ports/unix/modjni.c @@ -102,9 +102,9 @@ STATIC void check_exception(void) { mp_obj_t py_e = new_jobject(exc); JJ1(ExceptionClear); if (JJ(IsInstanceOf, exc, IndexException_class)) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_IndexError, py_e)); + mp_raise_arg1(&mp_type_IndexError, py_e); } - nlr_raise(mp_obj_new_exception_arg1(&mp_type_Exception, py_e)); + mp_raise_arg1(&mp_type_Exception, py_e); } } diff --git a/py/modsys.c b/py/modsys.c index a1d2cf831c789..31f28a36faec9 100644 --- a/py/modsys.c +++ b/py/modsys.c @@ -96,7 +96,7 @@ STATIC mp_obj_t mp_sys_exit(size_t n_args, const mp_obj_t *args) { if (n_args == 0) { exc = mp_obj_new_exception(&mp_type_SystemExit); } else { - exc = mp_obj_new_exception_arg1(&mp_type_SystemExit, args[0]); + mp_raise_arg1(&mp_type_SystemExit, args[0]); } nlr_raise(exc); } diff --git a/py/objdict.c b/py/objdict.c index 63fd86f357791..098aec5d2f22a 100644 --- a/py/objdict.c +++ b/py/objdict.c @@ -169,7 +169,7 @@ mp_obj_t mp_obj_dict_get(mp_obj_t self_in, mp_obj_t index) { mp_obj_dict_t *self = MP_OBJ_TO_PTR(self_in); mp_map_elem_t *elem = mp_map_lookup(&self->map, index, MP_MAP_LOOKUP); if (elem == NULL) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_KeyError, index)); + mp_raise_arg1(&mp_type_KeyError, index); } else { return elem->value; } @@ -185,7 +185,7 @@ STATIC mp_obj_t dict_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) { mp_obj_dict_t *self = MP_OBJ_TO_PTR(self_in); mp_map_elem_t *elem = mp_map_lookup(&self->map, index, MP_MAP_LOOKUP); if (elem == NULL) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_KeyError, index)); + mp_raise_arg1(&mp_type_KeyError, index); } else { return elem->value; } @@ -272,7 +272,7 @@ STATIC mp_obj_t dict_get_helper(size_t n_args, const mp_obj_t *args, mp_map_look if (elem == NULL || elem->value == MP_OBJ_NULL) { if (n_args == 2) { if (lookup_kind == MP_MAP_LOOKUP_REMOVE_IF_FOUND) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_KeyError, args[1])); + mp_raise_arg1(&mp_type_KeyError, args[1]); } else { value = mp_const_none; } diff --git a/py/objset.c b/py/objset.c index 45b5c1260640c..c5d54aede5c32 100644 --- a/py/objset.c +++ b/py/objset.c @@ -378,7 +378,7 @@ STATIC mp_obj_t set_remove(mp_obj_t self_in, mp_obj_t item) { check_set(self_in); mp_obj_set_t *self = MP_OBJ_TO_PTR(self_in); if (mp_set_lookup(&self->set, item, MP_MAP_LOOKUP_REMOVE_IF_FOUND) == MP_OBJ_NULL) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_KeyError, item)); + mp_raise_arg1(&mp_type_KeyError, item); } return mp_const_none; } diff --git a/py/objstr.c b/py/objstr.c index 6a03f5fc3e419..34ccab86d6136 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -1087,7 +1087,7 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar field_name = lookup; mp_map_elem_t *key_elem = mp_map_lookup(kwargs, field_q, MP_MAP_LOOKUP); if (key_elem == NULL) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_KeyError, field_q)); + mp_raise_arg1(&mp_type_KeyError, field_q); } arg = key_elem->value; } diff --git a/py/pystack.c b/py/pystack.c index f79ea92101a82..0def75b109a05 100644 --- a/py/pystack.c +++ b/py/pystack.c @@ -43,8 +43,8 @@ void *mp_pystack_alloc(size_t n_bytes) { #endif if (MP_STATE_THREAD(pystack_cur) + n_bytes > MP_STATE_THREAD(pystack_end)) { // out of memory in the pystack - nlr_raise(mp_obj_new_exception_arg1(&mp_type_RuntimeError, - MP_OBJ_NEW_QSTR(MP_QSTR_pystack_space_exhausted))); + mp_raise_arg1(&mp_type_RuntimeError, + MP_OBJ_NEW_QSTR(MP_QSTR_pystack_space_exhausted)); } void *ptr = MP_STATE_THREAD(pystack_cur); MP_STATE_THREAD(pystack_cur) += n_bytes; diff --git a/py/runtime.c b/py/runtime.c index e63e2337d9416..3745e16e301f7 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -1514,6 +1514,10 @@ NORETURN void m_malloc_fail(size_t num_bytes) { translate("memory allocation failed, allocating %u bytes"), (uint)num_bytes); } +NORETURN void mp_raise_arg1(const mp_obj_type_t *exc_type, mp_obj_t arg) { + nlr_raise(mp_obj_new_exception_arg1(exc_type, arg)); +} + NORETURN void mp_raise_msg(const mp_obj_type_t *exc_type, const compressed_string_t *msg) { if (msg == NULL) { nlr_raise(mp_obj_new_exception(exc_type)); @@ -1580,7 +1584,7 @@ NORETURN void mp_raise_TypeError_varg(const compressed_string_t *fmt, ...) { } NORETURN void mp_raise_OSError(int errno_) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(errno_))); + mp_raise_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(errno_)); } NORETURN void mp_raise_OSError_msg(const compressed_string_t *msg) { @@ -1607,7 +1611,7 @@ NORETURN void mp_raise_ConnectionError(const compressed_string_t *msg) { } NORETURN void mp_raise_BrokenPipeError(void) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_BrokenPipeError, MP_OBJ_NEW_SMALL_INT(MP_EPIPE))); + mp_raise_arg1(&mp_type_BrokenPipeError, MP_OBJ_NEW_SMALL_INT(MP_EPIPE)); } NORETURN void mp_raise_NotImplementedError(const compressed_string_t *msg) { diff --git a/py/runtime.h b/py/runtime.h index ad7d0feaba410..5e8fda35c1857 100644 --- a/py/runtime.h +++ b/py/runtime.h @@ -150,6 +150,7 @@ mp_obj_t mp_import_name(qstr name, mp_obj_t fromlist, mp_obj_t level); mp_obj_t mp_import_from(mp_obj_t module, qstr name); void mp_import_all(mp_obj_t module); +NORETURN void mp_raise_arg1(const mp_obj_type_t *exc_type, mp_obj_t arg); NORETURN void mp_raise_msg(const mp_obj_type_t *exc_type, const compressed_string_t *msg); NORETURN void mp_raise_msg_varg(const mp_obj_type_t *exc_type, const compressed_string_t *fmt, ...); NORETURN void mp_raise_msg_vlist(const mp_obj_type_t *exc_type, const compressed_string_t *fmt, va_list argptr); From b2b8520880e9d458adbd279a34b831f8d6b68d40 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Nov 2020 16:18:52 -0600 Subject: [PATCH 228/770] Always use preprocessor for MICROPY_ERROR_REPORTING This ensures that only the translate("") alternative that will be used is seen after preprocessing. Improves the quality of the Huffman encoding and reduces binary size slightly. Also makes one "enhanced" error message only occur when ERROR_REPORTING_DETAILED: Instead of the word-for-word python3 error message "Type object has no attribute '%q'", the message will be "'type' object has no attribute '%q'". Also reduces binary size. (that's rolled into this commit as it was right next to a change to use the preprocessor for MICROPY_ERROR_REPORTING) Note that the odd semicolon after "value_error:" in parsenum.c is necessary due to a detail of the C grammar, in which a declaration cannot follow a label directly. --- py/argcheck.c | 18 ++++---- py/builtinimport.c | 12 +++--- py/compile.c | 12 +++--- py/modbuiltins.c | 6 +-- py/modsys.c | 4 +- py/obj.c | 66 ++++++++++++++-------------- py/objnamedtuple.c | 20 ++++----- py/objstr.c | 105 +++++++++++++++++++++++---------------------- py/objtype.c | 24 +++++------ py/parsenum.c | 10 ++--- py/runtime.c | 76 ++++++++++++++++---------------- 11 files changed, 178 insertions(+), 175 deletions(-) diff --git a/py/argcheck.c b/py/argcheck.c index 9341c02a6c285..af5c81bf37a38 100644 --- a/py/argcheck.c +++ b/py/argcheck.c @@ -99,12 +99,12 @@ void mp_arg_parse_all(size_t n_pos, const mp_obj_t *pos, mp_map_t *kws, size_t n mp_map_elem_t *kw = mp_map_lookup(kws, MP_OBJ_NEW_QSTR(allowed[i].qst), MP_MAP_LOOKUP); if (kw == NULL) { if (allowed[i].flags & MP_ARG_REQUIRED) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_arg_error_terse_mismatch(); - } else { + #else mp_raise_TypeError_varg( translate("'%q' argument required"), allowed[i].qst); - } + #endif } out_vals[i] = allowed[i].defval; continue; @@ -124,20 +124,20 @@ void mp_arg_parse_all(size_t n_pos, const mp_obj_t *pos, mp_map_t *kws, size_t n } if (pos_found < n_pos) { extra_positional: - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_arg_error_terse_mismatch(); - } else { + #else // TODO better error message mp_raise_TypeError(translate("extra positional arguments given")); - } + #endif } if (kws_found < kws->used) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_arg_error_terse_mismatch(); - } else { + #else // TODO better error message mp_raise_TypeError(translate("extra keyword arguments given")); - } + #endif } } diff --git a/py/builtinimport.c b/py/builtinimport.c index 47ffab5196cce..c4768cc777b41 100644 --- a/py/builtinimport.c +++ b/py/builtinimport.c @@ -426,12 +426,12 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) { mp_module_call_init(mod_name, module_obj); } else { // couldn't find the file, so fail - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_ImportError(translate("module not found")); - } else { + #else mp_raise_msg_varg(&mp_type_ImportError, translate("no module named '%q'"), mod_name); - } + #endif } } else { // found the file, so get the module @@ -538,12 +538,12 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) { #endif // Couldn't find the module, so fail - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_msg(&mp_type_ImportError, translate("module not found")); - } else { + #else nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ImportError, translate("no module named '%q'"), module_name_qstr)); - } + #endif } #endif // MICROPY_ENABLE_EXTERNAL_IMPORT diff --git a/py/compile.c b/py/compile.c index 04bcf5bc1454c..b4d81ed4451ee 100644 --- a/py/compile.c +++ b/py/compile.c @@ -2486,21 +2486,21 @@ STATIC void compile_atom_brace(compiler_t *comp, mp_parse_node_struct_t *pns) { compile_node(comp, pn_i); if (is_dict) { if (!is_key_value) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE compile_syntax_error(comp, (mp_parse_node_t)pns, translate("invalid syntax")); - } else { + #else compile_syntax_error(comp, (mp_parse_node_t)pns, translate("expecting key:value for dict")); - } + #endif return; } EMIT(store_map); } else { if (is_key_value) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE compile_syntax_error(comp, (mp_parse_node_t)pns, translate("invalid syntax")); - } else { + #else compile_syntax_error(comp, (mp_parse_node_t)pns, translate("expecting just a value for set")); - } + #endif return; } } diff --git a/py/modbuiltins.c b/py/modbuiltins.c index 41e1d4e488f6d..fe3c366eec50a 100644 --- a/py/modbuiltins.c +++ b/py/modbuiltins.c @@ -346,12 +346,12 @@ STATIC mp_obj_t mp_builtin_ord(mp_obj_t o_in) { } } - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("ord expects a character")); - } else { + #else mp_raise_TypeError_varg( translate("ord() expected a character, but string of length %d found"), (int)len); - } + #endif } MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_ord_obj, mp_builtin_ord); diff --git a/py/modsys.c b/py/modsys.c index 31f28a36faec9..81628683d8e5f 100644 --- a/py/modsys.c +++ b/py/modsys.c @@ -92,13 +92,11 @@ STATIC const MP_DEFINE_STR_OBJ(platform_obj, MICROPY_PY_SYS_PLATFORM); // exit([retval]): raise SystemExit, with optional argument given to the exception STATIC mp_obj_t mp_sys_exit(size_t n_args, const mp_obj_t *args) { - mp_obj_t exc; if (n_args == 0) { - exc = mp_obj_new_exception(&mp_type_SystemExit); + nlr_raise(mp_obj_new_exception(&mp_type_SystemExit)); } else { mp_raise_arg1(&mp_type_SystemExit, args[0]); } - nlr_raise(exc); } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_sys_exit_obj, 0, 1, mp_sys_exit); diff --git a/py/obj.c b/py/obj.c index 315e816e0b042..d8e34746cad71 100644 --- a/py/obj.c +++ b/py/obj.c @@ -262,12 +262,12 @@ mp_int_t mp_obj_get_int(mp_const_obj_t arg) { } else if (MP_OBJ_IS_TYPE(arg, &mp_type_int)) { return mp_obj_int_get_checked(arg); } else { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError_varg(translate("can't convert to %q"), MP_QSTR_int); - } else { + #else mp_raise_TypeError_varg( translate("can't convert %q to %q"), mp_obj_get_type_qstr(arg), MP_QSTR_int); - } + #endif } } @@ -325,12 +325,12 @@ mp_float_t mp_obj_get_float(mp_obj_t arg) { mp_float_t val; if (!mp_obj_get_float_maybe(arg, &val)) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError_varg(translate("can't convert to %q"), MP_QSTR_float); - } else { + #else mp_raise_TypeError_varg( translate("can't convert %q to %q"), mp_obj_get_type_qstr(arg), MP_QSTR_float); - } + #endif } return val; @@ -358,12 +358,12 @@ void mp_obj_get_complex(mp_obj_t arg, mp_float_t *real, mp_float_t *imag) { } else if (MP_OBJ_IS_TYPE(arg, &mp_type_complex)) { mp_obj_complex_get(arg, real, imag); } else { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError_varg(translate("can't convert to %q"), MP_QSTR_complex); - } else { + #else mp_raise_TypeError_varg( translate("can't convert %q to %q"), mp_obj_get_type_qstr(arg), MP_QSTR_complex); - } + #endif } } #endif @@ -376,12 +376,12 @@ void mp_obj_get_array(mp_obj_t o, size_t *len, mp_obj_t **items) { } else if (MP_OBJ_IS_TYPE(o, &mp_type_list)) { mp_obj_list_get(o, len, items); } else { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("expected tuple/list")); - } else { + #else mp_raise_TypeError_varg( translate("object '%q' is not a tuple or list"), mp_obj_get_type_qstr(o)); - } + #endif } } @@ -390,12 +390,12 @@ void mp_obj_get_array_fixed_n(mp_obj_t o, size_t len, mp_obj_t **items) { size_t seq_len; mp_obj_get_array(o, &seq_len, items); if (seq_len != len) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_ValueError(translate("tuple/list has wrong length")); - } else { + #else mp_raise_ValueError_varg(translate("requested length %d but object has length %d"), (int)len, (int)seq_len); - } + #endif } } @@ -405,13 +405,13 @@ size_t mp_get_index(const mp_obj_type_t *type, size_t len, mp_obj_t index, bool if (MP_OBJ_IS_SMALL_INT(index)) { i = MP_OBJ_SMALL_INT_VALUE(index); } else if (!mp_obj_get_int_maybe(index, &i)) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("indices must be integers")); - } else { + #else mp_raise_TypeError_varg( translate("%q indices must be integers, not %q"), type->name, mp_obj_get_type_qstr(index)); - } + #endif } if (i < 0) { @@ -425,12 +425,12 @@ size_t mp_get_index(const mp_obj_type_t *type, size_t len, mp_obj_t index, bool } } else { if (i < 0 || (mp_uint_t)i >= len) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_IndexError(translate("index out of range")); - } else { + #else mp_raise_msg_varg(&mp_type_IndexError, translate("%q index out of range"), type->name); - } + #endif } } @@ -460,12 +460,12 @@ mp_obj_t mp_obj_id(mp_obj_t o_in) { mp_obj_t mp_obj_len(mp_obj_t o_in) { mp_obj_t len = mp_obj_len_maybe(o_in); if (len == MP_OBJ_NULL) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("object has no len")); - } else { + #else mp_raise_TypeError_varg( translate("object of type '%q' has no len()"), mp_obj_get_type_qstr(o_in)); - } + #endif } else { return len; } @@ -503,26 +503,26 @@ mp_obj_t mp_obj_subscr(mp_obj_t base, mp_obj_t index, mp_obj_t value) { } } if (value == MP_OBJ_NULL) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("object does not support item deletion")); - } else { + #else mp_raise_TypeError_varg( translate("'%q' object does not support item deletion"), mp_obj_get_type_qstr(base)); - } + #endif } else if (value == MP_OBJ_SENTINEL) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("object is not subscriptable")); - } else { + #else mp_raise_TypeError_varg( translate("'%q' object is not subscriptable"), mp_obj_get_type_qstr(base)); - } + #endif } else { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("object does not support item assignment")); - } else { + #else mp_raise_TypeError_varg( translate("'%q' object does not support item assignment"), mp_obj_get_type_qstr(base)); - } + #endif } } diff --git a/py/objnamedtuple.c b/py/objnamedtuple.c index ab2f2f3c00ba6..8b595da571606 100644 --- a/py/objnamedtuple.c +++ b/py/objnamedtuple.c @@ -102,17 +102,17 @@ mp_obj_t namedtuple_make_new(const mp_obj_type_t *type_in, size_t n_args, const n_kw = kw_args->used; } if (n_args + n_kw != num_fields) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_arg_error_terse_mismatch(); - } else if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_NORMAL) { + #elif MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_NORMAL mp_raise_TypeError_varg( translate("function takes %d positional arguments but %d were given"), num_fields, n_args + n_kw); - } else if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED) { + #else mp_raise_TypeError_varg( translate("%q() takes %d positional arguments but %d were given"), type->base.name, num_fields, n_args + n_kw); - } + #endif } // Create a tuple and set the type to this namedtuple @@ -128,20 +128,20 @@ mp_obj_t namedtuple_make_new(const mp_obj_type_t *type_in, size_t n_args, const qstr kw = mp_obj_str_get_qstr(kw_args->table[i].key); size_t id = mp_obj_namedtuple_find_field(type, kw); if (id == (size_t)-1) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_arg_error_terse_mismatch(); - } else { + #else mp_raise_TypeError_varg( translate("unexpected keyword argument '%q'"), kw); - } + #endif } if (tuple->items[id] != MP_OBJ_NULL) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_arg_error_terse_mismatch(); - } else { + #else mp_raise_TypeError_varg( translate("function got multiple values for argument '%q'"), kw); - } + #endif } tuple->items[id] = kw_args->table[i].value; } diff --git a/py/objstr.c b/py/objstr.c index 34ccab86d6136..1a59aeaecd31c 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -971,11 +971,11 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar vstr_add_byte(&vstr, '}'); continue; } - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError(translate("single '}' encountered in format string")); - } + #endif } if (*str != '{') { vstr_add_byte(&vstr, *str); @@ -1010,18 +1010,18 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar if (str < top && (*str == 'r' || *str == 's')) { conversion = *str++; } else { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_NORMAL) { + #elif MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_NORMAL mp_raise_ValueError(translate("bad conversion specifier")); - } else { + #else if (str >= top) { mp_raise_ValueError( translate("end of format while looking for conversion specifier")); } else { mp_raise_ValueError_varg(translate("unknown conversion specifier %c"), *str); } - } + #endif } } @@ -1047,18 +1047,18 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar } } if (str >= top) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError(translate("unmatched '{' in format")); - } + #endif } if (*str != '}') { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { - terse_str_format_value_error(); - } else { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE +:w + #else mp_raise_ValueError(translate("expected ':' after format specifier")); - } + #endif } mp_obj_t arg = mp_const_none; @@ -1067,12 +1067,12 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar int index = 0; if (MP_LIKELY(unichar_isdigit(*field_name))) { if (*arg_i > 0) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError( translate("can't switch from automatic field numbering to manual field specification")); - } + #endif } field_name = str_to_int(field_name, field_name_top, &index); if ((uint)index >= n_args - 1) { @@ -1096,12 +1096,12 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar } } else { if (*arg_i < 0) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError( translate("can't switch from manual field specification to automatic field numbering")); - } + #endif } if ((uint)*arg_i >= n_args - 1) { mp_raise_IndexError_varg(translate("%q index out of range"), MP_QSTR_tuple); @@ -1189,11 +1189,11 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar type = *s++; } if (*s) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError(translate("invalid format specifier")); - } + #endif } vstr_clear(&format_spec_vstr); } @@ -1210,19 +1210,19 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar if (flags & (PF_FLAG_SHOW_SIGN | PF_FLAG_SPACE_SIGN)) { if (type == 's') { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError(translate("sign not allowed in string format specifier")); - } + #endif } if (type == 'c') { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError( translate("sign not allowed with integer format specifier 'c'")); - } + #endif } } @@ -1276,13 +1276,13 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar break; default: - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError_varg( translate("unknown format code '%c' for object of type '%q'"), type, mp_obj_get_type_qstr(arg)); - } + #endif } } @@ -1348,24 +1348,24 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar #endif default: - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError_varg( translate("unknown format code '%c' for object of type '%q'"), type, mp_obj_get_type_qstr(arg)); - } + #endif } } else { // arg doesn't look like a number if (align == '=') { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError( translate("'=' alignment not allowed in string format specifier")); - } + #endif } switch (type) { @@ -1384,13 +1384,13 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar } default: - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError_varg( translate("unknown format code '%c' for object of type '%q'"), type, mp_obj_get_type_qstr(arg)); - } + #endif } } } @@ -1442,11 +1442,11 @@ STATIC mp_obj_t str_modulo_format(mp_obj_t pattern, size_t n_args, const mp_obj_ const byte *key = ++str; while (*str != ')') { if (str >= top) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError(translate("incomplete format key")); - } + #endif } ++str; } @@ -1500,11 +1500,11 @@ STATIC mp_obj_t str_modulo_format(mp_obj_t pattern, size_t n_args, const mp_obj_ if (str >= top) { incomplete_format: - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError(translate("incomplete format")); - } + #endif } // Tuple value lookup @@ -1587,13 +1587,13 @@ STATIC mp_obj_t str_modulo_format(mp_obj_t pattern, size_t n_args, const mp_obj_ break; default: - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE terse_str_format_value_error(); - } else { + #else mp_raise_ValueError_varg( translate("unsupported format character '%c' (0x%x) at index %d"), *str, *str, str - start_str); - } + #endif } } @@ -2130,12 +2130,13 @@ bool mp_obj_str_equal(mp_obj_t s1, mp_obj_t s2) { } STATIC NORETURN void bad_implicit_conversion(mp_obj_t self_in) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("can't convert to str implicitly")); - } else { + #else const qstr src_name = mp_obj_get_type_qstr(self_in); mp_raise_TypeError_varg(translate("can't convert '%q' object to %q implicitly"), src_name, src_name == MP_QSTR_str ? MP_QSTR_bytes : MP_QSTR_str); + #endif } // use this if you will anyway convert the string to a qstr diff --git a/py/objtype.c b/py/objtype.c index ccd014c335421..1254b015c9701 100644 --- a/py/objtype.c +++ b/py/objtype.c @@ -373,12 +373,12 @@ mp_obj_t mp_obj_instance_make_new(const mp_obj_type_t *self, size_t n_args, cons m_del(mp_obj_t, args2, 2 + n_args + 2 * n_kw); } if (init_ret != mp_const_none) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("__init__() should return None")); - } else { + #else mp_raise_TypeError_varg(translate("__init__() should return None, not '%q'"), mp_obj_get_type_qstr(init_ret)); - } + #endif } } @@ -888,12 +888,12 @@ mp_obj_t mp_obj_instance_call(mp_obj_t self_in, size_t n_args, size_t n_kw, cons mp_obj_t member[2] = {MP_OBJ_NULL, MP_OBJ_NULL}; mp_obj_t call = mp_obj_instance_get_call(self_in, member); if (call == MP_OBJ_NULL) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("object not callable")); - } else { + #else mp_raise_TypeError_varg(translate("'%q' object is not callable"), mp_obj_get_type_qstr(self_in)); - } + #endif } mp_obj_instance_t *self = MP_OBJ_TO_PTR(self_in); if (call == MP_OBJ_SENTINEL) { @@ -1024,11 +1024,11 @@ STATIC mp_obj_t type_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp mp_obj_type_t *self = MP_OBJ_TO_PTR(self_in); if (self->make_new == NULL) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("cannot create instance")); - } else { + #else mp_raise_TypeError_varg(translate("cannot create '%q' instances"), self->name); - } + #endif } // create a map directly from the given args array and make a new instance @@ -1134,12 +1134,12 @@ mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict) mp_obj_type_t *t = MP_OBJ_TO_PTR(bases_items[i]); // TODO: Verify with CPy, tested on function type if (t->make_new == NULL) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("type is not an acceptable base type")); - } else { + #else mp_raise_TypeError_varg( translate("type '%q' is not an acceptable base type"), t->name); - } + #endif } #if ENABLE_SPECIAL_ACCESSORS if (mp_obj_is_instance_type(t)) { diff --git a/py/parsenum.c b/py/parsenum.c index da63825e4b066..a72829b203905 100644 --- a/py/parsenum.c +++ b/py/parsenum.c @@ -145,16 +145,16 @@ mp_obj_t mp_parse_num_integer(const char *restrict str_, size_t len, int base, m goto have_ret_val; } -value_error: - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { +value_error: ; + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_obj_t exc = mp_obj_new_exception_msg(&mp_type_ValueError, translate("invalid syntax for integer")); raise_exc(exc, lex); - } else if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_NORMAL) { + #elif MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_NORMAL mp_obj_t exc = mp_obj_new_exception_msg_varg(&mp_type_ValueError, translate("invalid syntax for integer with base %d"), base); raise_exc(exc, lex); - } else { + #else vstr_t vstr; mp_print_t print; vstr_init_print(&vstr, 50, &print); @@ -163,7 +163,7 @@ mp_obj_t mp_parse_num_integer(const char *restrict str_, size_t len, int base, m mp_obj_t exc = mp_obj_new_exception_arg1(&mp_type_ValueError, mp_obj_new_str_from_vstr(&mp_type_str, &vstr)); raise_exc(exc, lex); - } + #endif } typedef enum { diff --git a/py/runtime.c b/py/runtime.c index 3745e16e301f7..a3acb954a6014 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -177,12 +177,12 @@ mp_obj_t mp_load_global(qstr qst) { #endif elem = mp_map_lookup((mp_map_t*)&mp_module_builtins_globals.map, MP_OBJ_NEW_QSTR(qst), MP_MAP_LOOKUP); if (elem == NULL) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_msg(&mp_type_NameError, translate("name not defined")); - } else { + #else nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_NameError, translate("name '%q' is not defined"), qst)); - } + #endif } } return elem->value; @@ -275,13 +275,13 @@ mp_obj_t mp_unary_op(mp_unary_op_t op, mp_obj_t arg) { return result; } } - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("unsupported type for operator")); - } else { + #else mp_raise_TypeError_varg( translate("unsupported type for %q: '%q'"), mp_unary_op_method_name[op], mp_obj_get_type_qstr(arg)); - } + #endif } } @@ -582,13 +582,13 @@ mp_obj_t PLACE_IN_ITCM(mp_binary_op)(mp_binary_op_t op, mp_obj_t lhs, mp_obj_t r } unsupported_op: - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("unsupported type for operator")); - } else { + #else mp_raise_TypeError_varg( translate("unsupported types for %q: '%q', '%q'"), mp_binary_op_method_name[op], mp_obj_get_type_qstr(lhs), mp_obj_get_type_qstr(rhs)); - } + #endif zero_division: mp_raise_msg(&mp_type_ZeroDivisionError, translate("division by zero")); @@ -624,11 +624,11 @@ mp_obj_t mp_call_function_n_kw(mp_obj_t fun_in, size_t n_args, size_t n_kw, cons return type->call(fun_in, n_args, n_kw, args); } - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("object not callable")); - } else { + #else mp_raise_TypeError_varg(translate("'%q' object is not callable"), mp_obj_get_type_qstr(fun_in)); - } + #endif } // args contains: fun self/NULL arg(0) ... arg(n_args-2) arg(n_args-1) kw_key(0) kw_val(0) ... kw_key(n_kw-1) kw_val(n_kw-1) @@ -852,19 +852,19 @@ void mp_unpack_sequence(mp_obj_t seq_in, size_t num, mp_obj_t *items) { return; too_short: - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_ValueError(translate("wrong number of values to unpack")); - } else { + #else mp_raise_ValueError_varg(translate("need more than %d values to unpack"), (int)seq_len); - } + #endif too_long: - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_ValueError(translate("wrong number of values to unpack")); - } else { + #else mp_raise_ValueError_varg(translate("too many values to unpack (expected %d)"), (int)num); - } + #endif } // unpacked items are stored in reverse order into the array pointed to by items @@ -916,12 +916,12 @@ void mp_unpack_ex(mp_obj_t seq_in, size_t num_in, mp_obj_t *items) { return; too_short: - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_ValueError(translate("wrong number of values to unpack")); - } else { + #else mp_raise_ValueError_varg(translate("need more than %d values to unpack"), (int)seq_len); - } + #endif } mp_obj_t mp_load_attr(mp_obj_t base, qstr attr) { @@ -1094,9 +1094,9 @@ void mp_load_method(mp_obj_t base, qstr attr, mp_obj_t *dest) { if (dest[0] == MP_OBJ_NULL) { // no attribute/method called attr - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_AttributeError(translate("no such attribute")); - } else { + #elif MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED // following CPython, we give a more detailed error message for type objects if (MP_OBJ_IS_TYPE(base, &mp_type_type)) { nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_AttributeError, @@ -1107,7 +1107,11 @@ void mp_load_method(mp_obj_t base, qstr attr, mp_obj_t *dest) { translate("'%q' object has no attribute '%q'"), mp_obj_get_type_qstr(base), attr)); } - } + #else + nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_AttributeError, + translate("'%q' object has no attribute '%q'"), + mp_obj_get_type_qstr(base), attr)); + #endif } } @@ -1168,13 +1172,13 @@ void mp_store_attr(mp_obj_t base, qstr attr, mp_obj_t value) { } #endif } - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_AttributeError(translate("no such attribute")); - } else { + #else nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_AttributeError, translate("'%q' object cannot assign attribute '%q'"), mp_obj_get_type_qstr(base), attr)); - } + #endif } mp_obj_t mp_getiter(mp_obj_t o_in, mp_obj_iter_buf_t *iter_buf) { @@ -1209,12 +1213,12 @@ mp_obj_t mp_getiter(mp_obj_t o_in, mp_obj_iter_buf_t *iter_buf) { } // object not iterable - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("object not iterable")); - } else { + #else mp_raise_TypeError_varg( translate("'%q' object is not iterable"), mp_obj_get_type_qstr(o_in)); - } + #endif } // may return MP_OBJ_STOP_ITERATION as an optimisation instead of raise StopIteration() @@ -1231,12 +1235,12 @@ mp_obj_t mp_iternext_allow_raise(mp_obj_t o_in) { // __next__ exists, call it and return its result return mp_call_method_n_kw(0, 0, dest); } else { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("object not an iterator")); - } else { + #else mp_raise_TypeError_varg(translate("'%q' object is not an iterator"), mp_obj_get_type_qstr(o_in)); - } + #endif } } } @@ -1267,12 +1271,12 @@ mp_obj_t mp_iternext(mp_obj_t o_in) { } } } else { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError(translate("object not an iterator")); - } else { + #else mp_raise_TypeError_varg(translate("'%q' object is not an iterator"), mp_obj_get_type_qstr(o_in)); - } + #endif } } } From aaca3eccf12d4b6ea6e294af81c8d19ad330be0c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Nov 2020 16:19:37 -0600 Subject: [PATCH 229/770] samd: PDMIn: Reduce code unrolling on samd21 only Instead of unrolling the code 16 times, unroll it 4 times and loop over it 4 times. This gives the same 16 iterations, but at an expense of less flash space. --- ports/atmel-samd/common-hal/audiobusio/PDMIn.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ports/atmel-samd/common-hal/audiobusio/PDMIn.c b/ports/atmel-samd/common-hal/audiobusio/PDMIn.c index 3c9ec05c25e09..8911aef2f1aca 100644 --- a/ports/atmel-samd/common-hal/audiobusio/PDMIn.c +++ b/ports/atmel-samd/common-hal/audiobusio/PDMIn.c @@ -337,7 +337,11 @@ const uint16_t sinc_filter [OVERSAMPLING] = { 94, 63, 39, 21, 9, 2, 0, 0 }; -#define REPEAT_16_TIMES(X) X X X X X X X X X X X X X X X X +#ifdef SAMD21 +#define REPEAT_16_TIMES(X) do { for(uint8_t j=0; j<4; j++) { X X X X } } while (0) +#else +#define REPEAT_16_TIMES(X) do { X X X X X X X X X X X X X X X X } while(0) +#endif static uint16_t filter_sample(uint32_t pdm_samples[4]) { uint16_t running_sum = 0; @@ -354,7 +358,7 @@ static uint16_t filter_sample(uint32_t pdm_samples[4]) { filter_ptr++; pdm_sample <<= 1; } - ) + ); } return running_sum; } From 982bce7259a9bbf7493f86258fc3395f31081648 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Nov 2020 16:23:35 -0600 Subject: [PATCH 230/770] py.mk: allow translation to be overriden in GNUmakefile I like to use local makefile overrides, in the file GNUmakefile (or, on case-sensitive systems, makefile) to set compilation choices. However, writing TRANSLATION := de_DE include Makefile did not work, because py.mk would override the TRANSLATION := specified in an earlier part of the makefiles (but not from the commandline). By using ?= instead of := the local makefile override works, but when TRANSLATION is not specified it continues to work as before. --- py/py.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/py.mk b/py/py.mk index acf5d127bce53..eeb3b8650fc23 100644 --- a/py/py.mk +++ b/py/py.mk @@ -7,7 +7,7 @@ HEADER_BUILD = $(BUILD)/genhdr # file containing qstr defs for the core Python bit PY_QSTR_DEFS = $(PY_SRC)/qstrdefs.h -TRANSLATION := en_US +TRANSLATION ?= en_US # If qstr autogeneration is not disabled we specify the output header # for all collected qstrings. From 17a8bafe0513c81565d25a6633808c639d5fa1f6 Mon Sep 17 00:00:00 2001 From: BennyE Date: Thu, 19 Nov 2020 23:39:48 +0100 Subject: [PATCH 231/770] Choose best AP in range if no channel/bssid given --- ports/esp32s2/common-hal/wifi/Radio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index 1945da207bce5..61c95dea824a6 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -142,6 +142,11 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t } else { config->sta.bssid_set = 0; } + // if channel and bssid both not set, do a full scan instead of fast scan + // this will ensure that the best AP is chosen automatically + if ((self->sta.bssid_set == 0) && (self->sta.channel == NULL)) { + config.scan_method = WIFI_ALL_CHANNEL_SCAN; + } esp_wifi_set_config(ESP_IF_WIFI_STA, config); self->starting_retries = 5; self->retries_left = 5; From 39e1f52e28c620db65d59f16a29d5476c4868901 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 19 Nov 2020 17:47:12 -0500 Subject: [PATCH 232/770] wip; not compiling yet --- main.c | 17 ++++-- ports/esp32s2/common-hal/alarm/__init__.c | 16 ++++++ shared-bindings/alarm/__init__.c | 17 ++++-- shared-bindings/alarm/__init__.h | 4 ++ shared-bindings/canio/BusState.c | 70 ----------------------- shared-bindings/canio/BusState.h | 33 ----------- shared-bindings/canio/__init__.c | 60 +++++++++++++++---- shared-bindings/canio/__init__.h | 6 ++ supervisor/shared/rgb_led_status.c | 1 + supervisor/shared/serial.c | 4 +- supervisor/shared/serial.h | 29 ---------- supervisor/shared/usb/usb.c | 4 +- supervisor/shared/workflow.c | 4 +- supervisor/shared/workflow.h | 2 + 14 files changed, 108 insertions(+), 159 deletions(-) delete mode 100644 shared-bindings/canio/BusState.c delete mode 100644 shared-bindings/canio/BusState.h delete mode 100644 supervisor/shared/serial.h diff --git a/main.c b/main.c index 251cb00a3fa44..30ceaeaa6d48b 100755 --- a/main.c +++ b/main.c @@ -56,6 +56,7 @@ #include "supervisor/shared/safe_mode.h" #include "supervisor/shared/status_leds.h" #include "supervisor/shared/stack.h" +#include "supervisor/shared/workflow.h" #include "supervisor/serial.h" #include "supervisor/usb.h" @@ -92,6 +93,12 @@ #include "common-hal/canio/CAN.h" #endif +// How long to wait for host to enumerate (secs). +#define CIRCUITPY_USB_ENUMERATION_DELAY 1 + +// How long to flash errors on the RGB status LED before going to sleep (secs) +#define CIRCUITPY_FLASH_ERROR_PERIOD 10 + void do_str(const char *src, mp_parse_input_kind_t input_kind) { mp_lexer_t *lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, src, strlen(src), 0); if (lex == NULL) { @@ -319,11 +326,11 @@ bool run_code_py(safe_mode_t safe_mode) { bool refreshed_epaper_display = false; #endif rgb_status_animation_t animation; - bool ok = result->return_code != PYEXEC_EXCEPTION; + bool ok = result.return_code != PYEXEC_EXCEPTION; #if CIRCUITPY_ALARM // If USB isn't enumerated then deep sleep. if (ok && !supervisor_workflow_active() && supervisor_ticks_ms64() > CIRCUITPY_USB_ENUMERATION_DELAY * 1024) { - common_hal_sleep_deep_sleep(); + common_hal_mcu_deep_sleep(); } #endif // Show the animation every N seconds. @@ -365,8 +372,8 @@ bool run_code_py(safe_mode_t safe_mode) { int64_t remaining_enumeration_wait = CIRCUITPY_USB_ENUMERATION_DELAY * 1024 - supervisor_ticks_ms64(); // If USB isn't enumerated then deep sleep after our waiting period. if (ok && remaining_enumeration_wait < 0) { - common_hal_sleep_deep_sleep(); - return; // Doesn't actually get here. + common_hal_mcu_deep_sleep(); + return false; // Doesn't actually get here. } #endif // Wake up every so often to flash the error code. @@ -424,7 +431,7 @@ void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) { // Wait 1.5 seconds before opening CIRCUITPY_BOOT_OUTPUT_FILE for write, // in case power is momentary or will fail shortly due to, say a low, battery. #if CIRCUITPY_ALARM - if (common_hal_sleep_get_reset_reason() == RESET_REASON_POWER_ON) { + if (common_hal_alarm_get_reset_reason() == RESET_REASON_POWER_ON) { #endif mp_hal_delay_ms(1500); #if CIRCUITPY_ALARM diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index 552ad4452bf46..e8cb7b882efc0 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -35,6 +35,22 @@ void common_hal_alarm_disable_all(void) { esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL); } +mp_obj_t common_hal_alarm_get_reset_reason(void) { + switch (esp_sleep_get_wakeup_cause()) { + case ESP_SLEEP_WAKEUP_TIMER: + return RESET_REASON_DEEP_SLEEP_ALARM; + case ESP_SLEEP_WAKEUP_EXT0: + return RESET_REASON_DEEP_SLEEP_ALARM; + case ESP_SLEEP_WAKEUP_TOUCHPAD: + //TODO: implement TouchIO + case ESP_SLEEP_WAKEUP_UNDEFINED: + default: + return mp_const_none; + break; + } +} + + mp_obj_t common_hal_alarm_get_wake_alarm(void) { switch (esp_sleep_get_wakeup_cause()) { case ESP_SLEEP_WAKEUP_TIMER: ; diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 20535e156b511..ecbf7fe04ff6e 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -34,11 +34,9 @@ #include "py/obj.h" #include "py/runtime.h" -#include "shared-bindings/alarm/pin/__init__.h" -#include "shared-bindings/alarm/time/__init__.h" - STATIC mp_obj_t alarm_sleep_until_alarm(size_t n_args, const mp_obj_t *args) { // TODO + return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_sleep_until_alarm_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_sleep_until_alarm); @@ -51,6 +49,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_sleep_until_alarm_obj, 1, MP_OBJ_FUN_A //| STATIC mp_obj_t alarm_restart_on_alarm(size_t n_args, const mp_obj_t *args) { // TODO + return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_restart_on_alarm_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_restart_on_alarm); @@ -102,7 +101,6 @@ mp_map_elem_t alarm_module_globals_table[] = { }; STATIC MP_DEFINE_MUTABLE_DICT(alarm_module_globals, alarm_module_globals_table); -// These are called from common_hal code to set the current wake alarm. void common_hal_alarm_set_wake_alarm(mp_obj_t alarm) { // Equivalent of: // alarm.wake_alarm = alarm @@ -113,7 +111,16 @@ void common_hal_alarm_set_wake_alarm(mp_obj_t alarm) { } } -// These are called from common hal code to set the current wake alarm. +alarm_reset_reason_t common_hal_alarm_get_reset_reason(void) { + mp_map_elem_t *elem = + mp_map_lookup(&alarm_module_globals_table, MP_ROM_QSTR(MP_QSTR_reset_reason), MP_MAP_LOOKUP); + if (elem) { + return elem->value; + } else { + return mp_const_none; + } +} + void common_hal_alarm_set_reset_reason(mp_obj_t reset_reason) { // Equivalent of: // alarm.reset_reason = reset_reason diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h index ce9cc79f40f41..a0ee76e53b0b4 100644 --- a/shared-bindings/alarm/__init__.h +++ b/shared-bindings/alarm/__init__.h @@ -29,7 +29,11 @@ #include "py/obj.h" +#include "shared-bindings/alarm/ResetReason.h" + extern void common_hal_alarm_set_wake_alarm(mp_obj_t alarm); + +extern alarm_reset_reason_t common_hal_alarm_get_reset_reason(void); extern void common_hal_alarm_set_reset_reason(mp_obj_t reset_reason); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM___INIT___H diff --git a/shared-bindings/canio/BusState.c b/shared-bindings/canio/BusState.c deleted file mode 100644 index e0501b8d83948..0000000000000 --- a/shared-bindings/canio/BusState.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2020 Jeff Epler 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 "py/enum.h" - -#include "shared-bindings/canio/BusState.h" - -MAKE_ENUM_VALUE(canio_bus_state_type, bus_state, ERROR_ACTIVE, BUS_STATE_ERROR_ACTIVE); -MAKE_ENUM_VALUE(canio_bus_state_type, bus_state, ERROR_PASSIVE, BUS_STATE_ERROR_PASSIVE); -MAKE_ENUM_VALUE(canio_bus_state_type, bus_state, ERROR_WARNING, BUS_STATE_ERROR_WARNING); -MAKE_ENUM_VALUE(canio_bus_state_type, bus_state, BUS_OFF, BUS_STATE_OFF); - -//| class BusState: -//| """The state of the CAN bus""" -//| -//| ERROR_ACTIVE: object -//| """The bus is in the normal (active) state""" -//| -//| ERROR_WARNING: object -//| """The bus is in the normal (active) state, but a moderate number of errors have occurred recently. -//| -//| NOTE: Not all implementations may use ERROR_WARNING. Do not rely on seeing ERROR_WARNING before ERROR_PASSIVE.""" -//| -//| ERROR_PASSIVE: object -//| """The bus is in the passive state due to the number of errors that have occurred recently. -//| -//| This device will acknowledge packets it receives, but cannot transmit messages. -//| If additional errors occur, this device may progress to BUS_OFF. -//| If it successfully acknowledges other packets on the bus, it can return to ERROR_WARNING or ERROR_ACTIVE and transmit packets. -//| """ -//| -//| BUS_OFF: object -//| """The bus has turned off due to the number of errors that have -//| occurred recently. It must be restarted before it will send or receive -//| packets. This device will neither send or acknowledge packets on the bus.""" -//| -MAKE_ENUM_MAP(canio_bus_state) { - MAKE_ENUM_MAP_ENTRY(bus_state, ERROR_ACTIVE), - MAKE_ENUM_MAP_ENTRY(bus_state, ERROR_PASSIVE), - MAKE_ENUM_MAP_ENTRY(bus_state, ERROR_WARNING), - MAKE_ENUM_MAP_ENTRY(bus_state, BUS_OFF), -}; -STATIC MP_DEFINE_CONST_DICT(canio_bus_state_locals_dict, canio_bus_state_locals_table); - -MAKE_PRINTER(canio, canio_bus_state); - -MAKE_ENUM_TYPE(canio, BusState, canio_bus_state); diff --git a/shared-bindings/canio/BusState.h b/shared-bindings/canio/BusState.h deleted file mode 100644 index e24eba92c11a3..0000000000000 --- a/shared-bindings/canio/BusState.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2020 Jeff Epler 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. - */ - -#pragma once - -typedef enum { - BUS_STATE_ERROR_ACTIVE, BUS_STATE_ERROR_PASSIVE, BUS_STATE_ERROR_WARNING, BUS_STATE_OFF -} canio_bus_state_t; - -extern const mp_obj_type_t canio_bus_state_type; diff --git a/shared-bindings/canio/__init__.c b/shared-bindings/canio/__init__.c index 451a68c9eb7d7..f29d3ab8ac5df 100644 --- a/shared-bindings/canio/__init__.c +++ b/shared-bindings/canio/__init__.c @@ -24,16 +24,6 @@ * THE SOFTWARE. */ -#include "py/obj.h" - -#include "shared-bindings/canio/__init__.h" - -#include "shared-bindings/canio/BusState.h" -#include "shared-bindings/canio/CAN.h" -#include "shared-bindings/canio/Match.h" -#include "shared-bindings/canio/Message.h" -#include "shared-bindings/canio/Listener.h" - //| """CAN bus access //| //| The `canio` module contains low level classes to support the CAN bus @@ -67,6 +57,56 @@ //| """ //| +#include "py/obj.h" +#include "py/enum.h" + +#include "shared-bindings/canio/__init__.h" +#include "shared-bindings/canio/CAN.h" +#include "shared-bindings/canio/Match.h" +#include "shared-bindings/canio/Message.h" +#include "shared-bindings/canio/Listener.h" + +MAKE_ENUM_VALUE(canio_bus_state_type, bus_state, ERROR_ACTIVE, BUS_STATE_ERROR_ACTIVE); +MAKE_ENUM_VALUE(canio_bus_state_type, bus_state, ERROR_PASSIVE, BUS_STATE_ERROR_PASSIVE); +MAKE_ENUM_VALUE(canio_bus_state_type, bus_state, ERROR_WARNING, BUS_STATE_ERROR_WARNING); +MAKE_ENUM_VALUE(canio_bus_state_type, bus_state, BUS_OFF, BUS_STATE_OFF); + +//| class BusState: +//| """The state of the CAN bus""" +//| +//| ERROR_ACTIVE: object +//| """The bus is in the normal (active) state""" +//| +//| ERROR_WARNING: object +//| """The bus is in the normal (active) state, but a moderate number of errors have occurred recently. +//| +//| NOTE: Not all implementations may use ERROR_WARNING. Do not rely on seeing ERROR_WARNING before ERROR_PASSIVE.""" +//| +//| ERROR_PASSIVE: object +//| """The bus is in the passive state due to the number of errors that have occurred recently. +//| +//| This device will acknowledge packets it receives, but cannot transmit messages. +//| If additional errors occur, this device may progress to BUS_OFF. +//| If it successfully acknowledges other packets on the bus, it can return to ERROR_WARNING or ERROR_ACTIVE and transmit packets. +//| """ +//| +//| BUS_OFF: object +//| """The bus has turned off due to the number of errors that have +//| occurred recently. It must be restarted before it will send or receive +//| packets. This device will neither send or acknowledge packets on the bus.""" +//| +MAKE_ENUM_MAP(canio_bus_state) { + MAKE_ENUM_MAP_ENTRY(bus_state, ERROR_ACTIVE), + MAKE_ENUM_MAP_ENTRY(bus_state, ERROR_PASSIVE), + MAKE_ENUM_MAP_ENTRY(bus_state, ERROR_WARNING), + MAKE_ENUM_MAP_ENTRY(bus_state, BUS_OFF), +}; +STATIC MP_DEFINE_CONST_DICT(canio_bus_state_locals_dict, canio_bus_state_locals_table); + +MAKE_PRINTER(canio, canio_bus_state); + +MAKE_ENUM_TYPE(canio, BusState, canio_bus_state); + STATIC const mp_rom_map_elem_t canio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_BusState), MP_ROM_PTR(&canio_bus_state_type) }, { MP_ROM_QSTR(MP_QSTR_CAN), MP_ROM_PTR(&canio_can_type) }, diff --git a/shared-bindings/canio/__init__.h b/shared-bindings/canio/__init__.h index 20b6638cd8ff2..e24eba92c11a3 100644 --- a/shared-bindings/canio/__init__.h +++ b/shared-bindings/canio/__init__.h @@ -25,3 +25,9 @@ */ #pragma once + +typedef enum { + BUS_STATE_ERROR_ACTIVE, BUS_STATE_ERROR_PASSIVE, BUS_STATE_ERROR_WARNING, BUS_STATE_OFF +} canio_bus_state_t; + +extern const mp_obj_type_t canio_bus_state_type; diff --git a/supervisor/shared/rgb_led_status.c b/supervisor/shared/rgb_led_status.c index c3d33ad3ea309..006bb1b34c83c 100644 --- a/supervisor/shared/rgb_led_status.c +++ b/supervisor/shared/rgb_led_status.c @@ -483,4 +483,5 @@ bool tick_rgb_status_animation(rgb_status_animation_t* status) { } } #endif + return false; // Animation is not finished. } diff --git a/supervisor/shared/serial.c b/supervisor/shared/serial.c index 7383cc2282fc1..303f89e7521ab 100644 --- a/supervisor/shared/serial.c +++ b/supervisor/shared/serial.c @@ -69,9 +69,7 @@ bool serial_connected(void) { #if defined(DEBUG_UART_TX) && defined(DEBUG_UART_RX) return true; #else - // True if DTR is asserted, and the USB connection is up. - // tud_cdc_get_line_state(): bit 0 is DTR, bit 1 is RTS - return (tud_cdc_get_line_state() & 1) && tud_ready(); + return tud_cdc_connected(); #endif } diff --git a/supervisor/shared/serial.h b/supervisor/shared/serial.h deleted file mode 100644 index 84f92c337ca96..0000000000000 --- a/supervisor/shared/serial.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2020 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. - */ - -#pragma once - -extern volatile bool _serial_connected; diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c index 8a425c990797a..3d76e7000ac75 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -31,6 +31,7 @@ #include "supervisor/port.h" #include "supervisor/serial.h" #include "supervisor/usb.h" +#include "supervisor/shared/workflow.h" #include "lib/utils/interrupt_char.h" #include "lib/mp-readline/readline.h" @@ -118,7 +119,6 @@ void tud_umount_cb(void) { // remote_wakeup_en : if host allows us to perform remote wakeup // USB Specs: Within 7ms, device must draw an average current less than 2.5 mA from bus void tud_suspend_cb(bool remote_wakeup_en) { - _serial_connected = false; _workflow_active = false; } @@ -132,8 +132,6 @@ void tud_resume_cb(void) { void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts) { (void) itf; // interface ID, not used - _serial_connected = dtr; - // DTR = false is counted as disconnected if ( !dtr ) { diff --git a/supervisor/shared/workflow.c b/supervisor/shared/workflow.c index adcffb319acb1..cd19d3aa25f4e 100644 --- a/supervisor/shared/workflow.c +++ b/supervisor/shared/workflow.c @@ -24,9 +24,11 @@ * THE SOFTWARE. */ +#include + // Set by the shared USB code. volatile bool _workflow_active; -bool workflow_active(void) { +bool supervisor_workflow_active(void) { return _workflow_active; } diff --git a/supervisor/shared/workflow.h b/supervisor/shared/workflow.h index 4a138332a7861..2968961f48556 100644 --- a/supervisor/shared/workflow.h +++ b/supervisor/shared/workflow.h @@ -27,3 +27,5 @@ #pragma once extern volatile bool _workflow_active; + +extern bool supervisor_workflow_active(void); From 6760cdf678061abeaf2627e5903c8601eee6fc66 Mon Sep 17 00:00:00 2001 From: BennyE Date: Fri, 20 Nov 2020 00:11:17 +0100 Subject: [PATCH 233/770] Let connect() choose strongest AP if channel and BSSID are not given --- ports/esp32s2/common-hal/wifi/Radio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index 61c95dea824a6..bcbca0ec7cee9 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -142,10 +142,10 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t } else { config->sta.bssid_set = 0; } - // if channel and bssid both not set, do a full scan instead of fast scan - // this will ensure that the best AP is chosen automatically - if ((self->sta.bssid_set == 0) && (self->sta.channel == NULL)) { - config.scan_method = WIFI_ALL_CHANNEL_SCAN; + // If channel is 0 (default/unset) and BSSID is not given, do a full scan instead of fast scan + // This will ensure that the best AP in range is chosen automatically + if ((config->sta.bssid_set == 0) && (config->sta.channel == 0)) { + config->sta.scan_method = WIFI_ALL_CHANNEL_SCAN; } esp_wifi_set_config(ESP_IF_WIFI_STA, config); self->starting_retries = 5; From 123210a989eae73fb60146d707f7ba890f8311ee Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 19 Nov 2020 17:13:24 -0800 Subject: [PATCH 234/770] Speed up JSON parsing with readinto Get a chunk of data from readinto instead of a single byte. This speeds up the parsing by reducing the number of function calls. Fixes #3703 --- extmod/modujson.c | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/extmod/modujson.c b/extmod/modujson.c index 431b5e0cf18b5..515606b70a0f5 100644 --- a/extmod/modujson.c +++ b/extmod/modujson.c @@ -57,6 +57,8 @@ typedef struct _ujson_stream_t { int errcode; mp_obj_t python_readinto[2 + 1]; mp_obj_array_t bytearray_obj; + size_t start; + size_t end; byte cur; } ujson_stream_t; @@ -77,28 +79,43 @@ STATIC byte ujson_stream_next(ujson_stream_t *s) { return s->cur; } +// We read from an object's `readinto` method in chunks larger than the json +// parser needs to reduce the number of function calls done. + +#define CIRCUITPY_JSON_READ_CHUNK_SIZE 64 + STATIC mp_uint_t ujson_python_readinto(mp_obj_t obj, void *buf, mp_uint_t size, int *errcode) { ujson_stream_t* s = obj; - s->bytearray_obj.items = buf; - s->bytearray_obj.len = size; - *errcode = 0; - mp_obj_t ret = mp_call_method_n_kw(1, 0, s->python_readinto); - if (ret == mp_const_none) { - *errcode = MP_EAGAIN; - return MP_STREAM_ERROR; + + if (s->start == s->end) { + *errcode = 0; + mp_obj_t ret = mp_call_method_n_kw(1, 0, s->python_readinto); + if (ret == mp_const_none) { + *errcode = MP_EAGAIN; + return MP_STREAM_ERROR; + } + s->start = 0; + s->end = mp_obj_get_int(ret); } - return mp_obj_get_int(ret); + + *((uint8_t *)buf) = ((uint8_t*) s->bytearray_obj.items)[s->start]; + s->start++; + return 1; } STATIC mp_obj_t _mod_ujson_load(mp_obj_t stream_obj, bool return_first_json) { const mp_stream_p_t *stream_p = mp_proto_get(MP_QSTR_protocol_stream, stream_obj); ujson_stream_t s; + uint8_t character_buffer[CIRCUITPY_JSON_READ_CHUNK_SIZE]; if (stream_p == NULL) { + s.start = 0; + s.end = 0; mp_load_method(stream_obj, MP_QSTR_readinto, s.python_readinto); s.bytearray_obj.base.type = &mp_type_bytearray; s.bytearray_obj.typecode = BYTEARRAY_TYPECODE; + s.bytearray_obj.len = CIRCUITPY_JSON_READ_CHUNK_SIZE; s.bytearray_obj.free = 0; - // len and items are set at read time + s.bytearray_obj.items = character_buffer; s.python_readinto[2] = MP_OBJ_FROM_PTR(&s.bytearray_obj); s.stream_obj = &s; s.read = ujson_python_readinto; From 2773f534c946df46da5ba87c0968b5e4912a6b2b Mon Sep 17 00:00:00 2001 From: BennyE Date: Fri, 20 Nov 2020 09:40:32 +0100 Subject: [PATCH 235/770] Update ports/esp32s2/common-hal/wifi/Radio.c adding suggested changes --- ports/esp32s2/common-hal/wifi/Radio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index bcbca0ec7cee9..f7c431a56bcb4 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -146,6 +146,8 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t // This will ensure that the best AP in range is chosen automatically if ((config->sta.bssid_set == 0) && (config->sta.channel == 0)) { config->sta.scan_method = WIFI_ALL_CHANNEL_SCAN; + } else { + config->sta.scan_method = WIFI_FAST_SCAN; } esp_wifi_set_config(ESP_IF_WIFI_STA, config); self->starting_retries = 5; From 0a06530d52524c76a026ed843165fa79a0526c1b Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Fri, 20 Nov 2020 15:06:57 -0500 Subject: [PATCH 236/770] adding CP-Sapling --- ports/atmel-samd/boards/CP_Sapling_m0/board.c | 40 +++++++++++++ .../boards/CP_Sapling_m0/mpconfigboard.h | 57 +++++++++++++++++++ .../boards/CP_Sapling_m0/mpconfigboard.mk | 24 ++++++++ ports/atmel-samd/boards/CP_Sapling_m0/pins.c | 38 +++++++++++++ 4 files changed, 159 insertions(+) create mode 100644 ports/atmel-samd/boards/CP_Sapling_m0/board.c create mode 100644 ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.h create mode 100644 ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.mk create mode 100644 ports/atmel-samd/boards/CP_Sapling_m0/pins.c diff --git a/ports/atmel-samd/boards/CP_Sapling_m0/board.c b/ports/atmel-samd/boards/CP_Sapling_m0/board.c new file mode 100644 index 0000000000000..b745bd9060fa5 --- /dev/null +++ b/ports/atmel-samd/boards/CP_Sapling_m0/board.c @@ -0,0 +1,40 @@ +/* + * 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 "common-hal/microcontroller/Pin.h" +#include "supervisor/shared/board.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/CP_Sapling_m0/mpconfigboard.h b/ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.h new file mode 100644 index 0000000000000..c67f022eb884e --- /dev/null +++ b/ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.h @@ -0,0 +1,57 @@ +#define MICROPY_HW_BOARD_NAME "CP Sapling M0" +#define MICROPY_HW_MCU_NAME "samd21e18" + +#define MICROPY_HW_NEOPIXEL (&pin_PA15) + +#define MICROPY_PORT_A (0) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) + +#define IGNORE_PIN_PA02 1 +#define IGNORE_PIN_PA03 1 +#define IGNORE_PIN_PA04 1 +#define IGNORE_PIN_PA05 1 +#define IGNORE_PIN_PA06 1 +#define IGNORE_PIN_PA07 1 +#define IGNORE_PIN_PA12 1 +#define IGNORE_PIN_PA13 1 +#define IGNORE_PIN_PA14 1 +#define IGNORE_PIN_PA20 1 +#define IGNORE_PIN_PA21 1 +// USB is always used internally so skip the pin objects for it. +#define IGNORE_PIN_PA24 1 +#define IGNORE_PIN_PA25 1 +#define IGNORE_PIN_PA27 1 +#define IGNORE_PIN_PA28 1 +#define IGNORE_PIN_PA30 1 +#define IGNORE_PIN_PA31 1 +#define IGNORE_PIN_PB01 1 +#define IGNORE_PIN_PB02 1 +#define IGNORE_PIN_PB03 1 +#define IGNORE_PIN_PB04 1 +#define IGNORE_PIN_PB05 1 +#define IGNORE_PIN_PB06 1 +#define IGNORE_PIN_PB07 1 +#define IGNORE_PIN_PB08 1 +#define IGNORE_PIN_PB09 1 +#define IGNORE_PIN_PB10 1 +#define IGNORE_PIN_PB11 1 +#define IGNORE_PIN_PB12 1 +#define IGNORE_PIN_PB13 1 +#define IGNORE_PIN_PB14 1 +#define IGNORE_PIN_PB15 1 +#define IGNORE_PIN_PB16 1 +#define IGNORE_PIN_PB17 1 +#define IGNORE_PIN_PB22 1 +#define IGNORE_PIN_PB23 1 +#define IGNORE_PIN_PB30 1 +#define IGNORE_PIN_PB31 1 +#define IGNORE_PIN_PB00 1 + +#define DEFAULT_I2C_BUS_SCL (&pin_PA09) +#define DEFAULT_I2C_BUS_SDA (&pin_PA08) + +#define DEFAULT_SPI_BUS_SS (&pin_PA22) +#define DEFAULT_SPI_BUS_SCK (&pin_PA19) +#define DEFAULT_SPI_BUS_MOSI (&pin_PA18) +#define DEFAULT_SPI_BUS_MISO (&pin_PA17) diff --git a/ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.mk b/ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.mk new file mode 100644 index 0000000000000..861a0a5f7d875 --- /dev/null +++ b/ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.mk @@ -0,0 +1,24 @@ +USB_VID = 0x1209 +USB_PID = 0x4DDD +USB_PRODUCT = "CP Sapling" +USB_MANUFACTURER = "Oak Development Technologies" + +CHIP_VARIANT = SAMD21E18A +CHIP_FAMILY = samd21 + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = NONE +CIRCUITPY_FULL_BUILD = 0 + +SUPEROPT_GC = 0 + +CFLAGS_BOARD = --param max-inline-insns-auto=15 +ifeq ($(TRANSLATION), zh_Latn_pinyin) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +endif +ifeq ($(TRANSLATION), de_DE) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +SUPEROPT_VM = 0 +endif diff --git a/ports/atmel-samd/boards/CP_Sapling_m0/pins.c b/ports/atmel-samd/boards/CP_Sapling_m0/pins.c new file mode 100644 index 0000000000000..ccffe2b3a180c --- /dev/null +++ b/ports/atmel-samd/boards/CP_Sapling_m0/pins.c @@ -0,0 +1,38 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA08) }, + + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA00) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA00) }, + + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA01) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA01) }, + + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA09) }, + + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_SS), MP_ROM_PTR(&pin_PA22) }, + + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA19) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA17) }, + + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA18) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA15) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); From b69bbfa3d6dbbe86216f4ea72df54cfd24612fe0 Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Fri, 20 Nov 2020 15:17:44 -0500 Subject: [PATCH 237/770] fixed issues with trailing whitespace check --- ports/atmel-samd/boards/CP_Sapling_m0/board.c | 2 +- ports/atmel-samd/boards/CP_Sapling_m0/pins.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/atmel-samd/boards/CP_Sapling_m0/board.c b/ports/atmel-samd/boards/CP_Sapling_m0/board.c index b745bd9060fa5..ce563667622f6 100644 --- a/ports/atmel-samd/boards/CP_Sapling_m0/board.c +++ b/ports/atmel-samd/boards/CP_Sapling_m0/board.c @@ -29,7 +29,7 @@ #include "supervisor/shared/board.h" #include "hal/include/hal_gpio.h" -void board_init(void) { +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/CP_Sapling_m0/pins.c b/ports/atmel-samd/boards/CP_Sapling_m0/pins.c index ccffe2b3a180c..d527aaddcb558 100644 --- a/ports/atmel-samd/boards/CP_Sapling_m0/pins.c +++ b/ports/atmel-samd/boards/CP_Sapling_m0/pins.c @@ -7,7 +7,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA00) }, { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA00) }, - + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA01) }, { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA01) }, @@ -31,7 +31,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA18) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA15) }, - + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, }; From 29e91424d483f0b427957be1c859f7f758f6fbea Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Fri, 20 Nov 2020 15:29:35 -0500 Subject: [PATCH 238/770] removing cp sapling temporarily to read --- ports/atmel-samd/boards/CP_Sapling_m0/board.c | 40 ------------- .../boards/CP_Sapling_m0/mpconfigboard.h | 57 ------------------- .../boards/CP_Sapling_m0/mpconfigboard.mk | 24 -------- ports/atmel-samd/boards/CP_Sapling_m0/pins.c | 38 ------------- 4 files changed, 159 deletions(-) delete mode 100644 ports/atmel-samd/boards/CP_Sapling_m0/board.c delete mode 100644 ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.h delete mode 100644 ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.mk delete mode 100644 ports/atmel-samd/boards/CP_Sapling_m0/pins.c diff --git a/ports/atmel-samd/boards/CP_Sapling_m0/board.c b/ports/atmel-samd/boards/CP_Sapling_m0/board.c deleted file mode 100644 index ce563667622f6..0000000000000 --- a/ports/atmel-samd/boards/CP_Sapling_m0/board.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 "common-hal/microcontroller/Pin.h" -#include "supervisor/shared/board.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/CP_Sapling_m0/mpconfigboard.h b/ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.h deleted file mode 100644 index c67f022eb884e..0000000000000 --- a/ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.h +++ /dev/null @@ -1,57 +0,0 @@ -#define MICROPY_HW_BOARD_NAME "CP Sapling M0" -#define MICROPY_HW_MCU_NAME "samd21e18" - -#define MICROPY_HW_NEOPIXEL (&pin_PA15) - -#define MICROPY_PORT_A (0) -#define MICROPY_PORT_B (0) -#define MICROPY_PORT_C (0) - -#define IGNORE_PIN_PA02 1 -#define IGNORE_PIN_PA03 1 -#define IGNORE_PIN_PA04 1 -#define IGNORE_PIN_PA05 1 -#define IGNORE_PIN_PA06 1 -#define IGNORE_PIN_PA07 1 -#define IGNORE_PIN_PA12 1 -#define IGNORE_PIN_PA13 1 -#define IGNORE_PIN_PA14 1 -#define IGNORE_PIN_PA20 1 -#define IGNORE_PIN_PA21 1 -// USB is always used internally so skip the pin objects for it. -#define IGNORE_PIN_PA24 1 -#define IGNORE_PIN_PA25 1 -#define IGNORE_PIN_PA27 1 -#define IGNORE_PIN_PA28 1 -#define IGNORE_PIN_PA30 1 -#define IGNORE_PIN_PA31 1 -#define IGNORE_PIN_PB01 1 -#define IGNORE_PIN_PB02 1 -#define IGNORE_PIN_PB03 1 -#define IGNORE_PIN_PB04 1 -#define IGNORE_PIN_PB05 1 -#define IGNORE_PIN_PB06 1 -#define IGNORE_PIN_PB07 1 -#define IGNORE_PIN_PB08 1 -#define IGNORE_PIN_PB09 1 -#define IGNORE_PIN_PB10 1 -#define IGNORE_PIN_PB11 1 -#define IGNORE_PIN_PB12 1 -#define IGNORE_PIN_PB13 1 -#define IGNORE_PIN_PB14 1 -#define IGNORE_PIN_PB15 1 -#define IGNORE_PIN_PB16 1 -#define IGNORE_PIN_PB17 1 -#define IGNORE_PIN_PB22 1 -#define IGNORE_PIN_PB23 1 -#define IGNORE_PIN_PB30 1 -#define IGNORE_PIN_PB31 1 -#define IGNORE_PIN_PB00 1 - -#define DEFAULT_I2C_BUS_SCL (&pin_PA09) -#define DEFAULT_I2C_BUS_SDA (&pin_PA08) - -#define DEFAULT_SPI_BUS_SS (&pin_PA22) -#define DEFAULT_SPI_BUS_SCK (&pin_PA19) -#define DEFAULT_SPI_BUS_MOSI (&pin_PA18) -#define DEFAULT_SPI_BUS_MISO (&pin_PA17) diff --git a/ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.mk b/ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.mk deleted file mode 100644 index 861a0a5f7d875..0000000000000 --- a/ports/atmel-samd/boards/CP_Sapling_m0/mpconfigboard.mk +++ /dev/null @@ -1,24 +0,0 @@ -USB_VID = 0x1209 -USB_PID = 0x4DDD -USB_PRODUCT = "CP Sapling" -USB_MANUFACTURER = "Oak Development Technologies" - -CHIP_VARIANT = SAMD21E18A -CHIP_FAMILY = samd21 - -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = NONE -CIRCUITPY_FULL_BUILD = 0 - -SUPEROPT_GC = 0 - -CFLAGS_BOARD = --param max-inline-insns-auto=15 -ifeq ($(TRANSLATION), zh_Latn_pinyin) -RELEASE_NEEDS_CLEAN_BUILD = 1 -CFLAGS_INLINE_LIMIT = 35 -endif -ifeq ($(TRANSLATION), de_DE) -RELEASE_NEEDS_CLEAN_BUILD = 1 -CFLAGS_INLINE_LIMIT = 35 -SUPEROPT_VM = 0 -endif diff --git a/ports/atmel-samd/boards/CP_Sapling_m0/pins.c b/ports/atmel-samd/boards/CP_Sapling_m0/pins.c deleted file mode 100644 index d527aaddcb558..0000000000000 --- a/ports/atmel-samd/boards/CP_Sapling_m0/pins.c +++ /dev/null @@ -1,38 +0,0 @@ -#include "shared-bindings/board/__init__.h" - -STATIC const mp_rom_map_elem_t board_global_dict_table[] = { - - { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA08) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA08) }, - - { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA00) }, - { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA00) }, - - { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA01) }, - { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA01) }, - - { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA09) }, - - { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA22) }, - { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA22) }, - { MP_ROM_QSTR(MP_QSTR_SS), MP_ROM_PTR(&pin_PA22) }, - - { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA19) }, - { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA19) }, - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA19) }, - - { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA17) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA17) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA17) }, - - { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA18) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA18) }, - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA18) }, - - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA15) }, - - { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, - { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, -}; -MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); From c4f4cdd8c15ef54ed05533b3f4c9d28bf9f9c46f Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Fri, 20 Nov 2020 15:31:49 -0500 Subject: [PATCH 239/770] readding cp_sapling directory --- ports/atmel-samd/boards/cp_sapling_m0/board.c | 40 +++++++++++++ .../boards/cp_sapling_m0/mpconfigboard.h | 57 +++++++++++++++++++ .../boards/cp_sapling_m0/mpconfigboard.mk | 24 ++++++++ ports/atmel-samd/boards/cp_sapling_m0/pins.c | 38 +++++++++++++ 4 files changed, 159 insertions(+) create mode 100644 ports/atmel-samd/boards/cp_sapling_m0/board.c create mode 100644 ports/atmel-samd/boards/cp_sapling_m0/mpconfigboard.h create mode 100644 ports/atmel-samd/boards/cp_sapling_m0/mpconfigboard.mk create mode 100644 ports/atmel-samd/boards/cp_sapling_m0/pins.c diff --git a/ports/atmel-samd/boards/cp_sapling_m0/board.c b/ports/atmel-samd/boards/cp_sapling_m0/board.c new file mode 100644 index 0000000000000..b745bd9060fa5 --- /dev/null +++ b/ports/atmel-samd/boards/cp_sapling_m0/board.c @@ -0,0 +1,40 @@ +/* + * 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 "common-hal/microcontroller/Pin.h" +#include "supervisor/shared/board.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/cp_sapling_m0/mpconfigboard.h b/ports/atmel-samd/boards/cp_sapling_m0/mpconfigboard.h new file mode 100644 index 0000000000000..c67f022eb884e --- /dev/null +++ b/ports/atmel-samd/boards/cp_sapling_m0/mpconfigboard.h @@ -0,0 +1,57 @@ +#define MICROPY_HW_BOARD_NAME "CP Sapling M0" +#define MICROPY_HW_MCU_NAME "samd21e18" + +#define MICROPY_HW_NEOPIXEL (&pin_PA15) + +#define MICROPY_PORT_A (0) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) + +#define IGNORE_PIN_PA02 1 +#define IGNORE_PIN_PA03 1 +#define IGNORE_PIN_PA04 1 +#define IGNORE_PIN_PA05 1 +#define IGNORE_PIN_PA06 1 +#define IGNORE_PIN_PA07 1 +#define IGNORE_PIN_PA12 1 +#define IGNORE_PIN_PA13 1 +#define IGNORE_PIN_PA14 1 +#define IGNORE_PIN_PA20 1 +#define IGNORE_PIN_PA21 1 +// USB is always used internally so skip the pin objects for it. +#define IGNORE_PIN_PA24 1 +#define IGNORE_PIN_PA25 1 +#define IGNORE_PIN_PA27 1 +#define IGNORE_PIN_PA28 1 +#define IGNORE_PIN_PA30 1 +#define IGNORE_PIN_PA31 1 +#define IGNORE_PIN_PB01 1 +#define IGNORE_PIN_PB02 1 +#define IGNORE_PIN_PB03 1 +#define IGNORE_PIN_PB04 1 +#define IGNORE_PIN_PB05 1 +#define IGNORE_PIN_PB06 1 +#define IGNORE_PIN_PB07 1 +#define IGNORE_PIN_PB08 1 +#define IGNORE_PIN_PB09 1 +#define IGNORE_PIN_PB10 1 +#define IGNORE_PIN_PB11 1 +#define IGNORE_PIN_PB12 1 +#define IGNORE_PIN_PB13 1 +#define IGNORE_PIN_PB14 1 +#define IGNORE_PIN_PB15 1 +#define IGNORE_PIN_PB16 1 +#define IGNORE_PIN_PB17 1 +#define IGNORE_PIN_PB22 1 +#define IGNORE_PIN_PB23 1 +#define IGNORE_PIN_PB30 1 +#define IGNORE_PIN_PB31 1 +#define IGNORE_PIN_PB00 1 + +#define DEFAULT_I2C_BUS_SCL (&pin_PA09) +#define DEFAULT_I2C_BUS_SDA (&pin_PA08) + +#define DEFAULT_SPI_BUS_SS (&pin_PA22) +#define DEFAULT_SPI_BUS_SCK (&pin_PA19) +#define DEFAULT_SPI_BUS_MOSI (&pin_PA18) +#define DEFAULT_SPI_BUS_MISO (&pin_PA17) diff --git a/ports/atmel-samd/boards/cp_sapling_m0/mpconfigboard.mk b/ports/atmel-samd/boards/cp_sapling_m0/mpconfigboard.mk new file mode 100644 index 0000000000000..861a0a5f7d875 --- /dev/null +++ b/ports/atmel-samd/boards/cp_sapling_m0/mpconfigboard.mk @@ -0,0 +1,24 @@ +USB_VID = 0x1209 +USB_PID = 0x4DDD +USB_PRODUCT = "CP Sapling" +USB_MANUFACTURER = "Oak Development Technologies" + +CHIP_VARIANT = SAMD21E18A +CHIP_FAMILY = samd21 + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = NONE +CIRCUITPY_FULL_BUILD = 0 + +SUPEROPT_GC = 0 + +CFLAGS_BOARD = --param max-inline-insns-auto=15 +ifeq ($(TRANSLATION), zh_Latn_pinyin) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +endif +ifeq ($(TRANSLATION), de_DE) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +SUPEROPT_VM = 0 +endif diff --git a/ports/atmel-samd/boards/cp_sapling_m0/pins.c b/ports/atmel-samd/boards/cp_sapling_m0/pins.c new file mode 100644 index 0000000000000..ccffe2b3a180c --- /dev/null +++ b/ports/atmel-samd/boards/cp_sapling_m0/pins.c @@ -0,0 +1,38 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA08) }, + + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA00) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA00) }, + + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA01) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA01) }, + + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA09) }, + + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_SS), MP_ROM_PTR(&pin_PA22) }, + + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA19) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA17) }, + + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA18) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA15) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); From 1c92b1bf61cb0625a6ff7114623cd1cfdc6d5d75 Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Fri, 20 Nov 2020 15:35:52 -0500 Subject: [PATCH 240/770] forgot to run pre-commit local --- ports/atmel-samd/boards/cp_sapling_m0/board.c | 2 +- ports/atmel-samd/boards/cp_sapling_m0/pins.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/atmel-samd/boards/cp_sapling_m0/board.c b/ports/atmel-samd/boards/cp_sapling_m0/board.c index b745bd9060fa5..ce563667622f6 100644 --- a/ports/atmel-samd/boards/cp_sapling_m0/board.c +++ b/ports/atmel-samd/boards/cp_sapling_m0/board.c @@ -29,7 +29,7 @@ #include "supervisor/shared/board.h" #include "hal/include/hal_gpio.h" -void board_init(void) { +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/cp_sapling_m0/pins.c b/ports/atmel-samd/boards/cp_sapling_m0/pins.c index ccffe2b3a180c..d527aaddcb558 100644 --- a/ports/atmel-samd/boards/cp_sapling_m0/pins.c +++ b/ports/atmel-samd/boards/cp_sapling_m0/pins.c @@ -7,7 +7,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA00) }, { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA00) }, - + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA01) }, { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA01) }, @@ -31,7 +31,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA18) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA15) }, - + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, }; From b34e36d1db127f84f4448f015406fa835cde48da Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Fri, 20 Nov 2020 15:44:53 -0500 Subject: [PATCH 241/770] fixing build.yml --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f3e728a05cbd8..fa60332112bcc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -197,6 +197,7 @@ jobs: - "circuitplayground_express_crickit" - "circuitplayground_express_displayio" - "clue_nrf52840_express" + - "cp_sapling_m0" - "cp32-m4" - "datalore_ip_m4" - "datum_distance" From 0fb075ab7e55b9cb7b84ece6a0247fd0b73dedb2 Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Fri, 20 Nov 2020 16:15:50 -0500 Subject: [PATCH 242/770] changed tab to spaces in build.yml, passes local pre-commit --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fa60332112bcc..4d04e3f93b2f1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -197,7 +197,7 @@ jobs: - "circuitplayground_express_crickit" - "circuitplayground_express_displayio" - "clue_nrf52840_express" - - "cp_sapling_m0" + - "cp_sapling_m0" - "cp32-m4" - "datalore_ip_m4" - "datum_distance" From 8301dcada00bdc63ac70de39ec5a0bdb6ae502ba Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Fri, 20 Nov 2020 16:26:33 -0500 Subject: [PATCH 243/770] I need to revisit the alphabet... --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4d04e3f93b2f1..8e72a4021915f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -197,8 +197,8 @@ jobs: - "circuitplayground_express_crickit" - "circuitplayground_express_displayio" - "clue_nrf52840_express" - - "cp_sapling_m0" - "cp32-m4" + - "cp_sapling_m0" - "datalore_ip_m4" - "datum_distance" - "datum_imu" From f25ac45534c6bc00c4eb0d5aedb8fcdbb673a310 Mon Sep 17 00:00:00 2001 From: Noel Gaetan Date: Thu, 19 Nov 2020 17:19:09 +0000 Subject: [PATCH 244/770] Translated using Weblate (French) Currently translated at 100.0% (848 of 848 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index a15bbb8d50fee..b58ca6560b50c 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-10 15:30+0530\n" -"PO-Revision-Date: 2020-11-15 16:28+0000\n" -"Last-Translator: Antonin ENFRUN \n" +"PO-Revision-Date: 2020-11-20 22:28+0000\n" +"Last-Translator: Noel Gaetan \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" @@ -1027,7 +1027,7 @@ msgstr "Taille de tampon incorrecte" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" -msgstr "" +msgstr "L'initialisation a échoué par manque de mémoire" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" @@ -3715,7 +3715,7 @@ msgstr "les vecteurs doivent avoir la même longueur" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" -msgstr "" +msgstr "chien de garde non initialisé" #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" From 7b5e826b18d8777e5dcc994ea41b29e099cc9fa1 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Thu, 19 Nov 2020 22:11:10 +0000 Subject: [PATCH 245/770] Translated using Weblate (Swedish) Currently translated at 100.0% (848 of 848 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 55e6368ae5654..cc6fe8ad00003 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-10 15:30+0530\n" -"PO-Revision-Date: 2020-11-15 16:28+0000\n" +"PO-Revision-Date: 2020-11-20 22:28+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -1014,7 +1014,7 @@ msgstr "Fel buffertstorlek" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" -msgstr "" +msgstr "Initieringen misslyckades på grund av minnesbrist" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" @@ -3672,7 +3672,7 @@ msgstr "vektorer måste ha samma längd" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" -msgstr "" +msgstr "watchdog är inte initierad" #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" From e4c66990e27779f43f4901d431b6c61f8da85f51 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 20 Nov 2020 23:33:39 -0500 Subject: [PATCH 246/770] compiles --- ports/esp32s2/common-hal/alarm/__init__.c | 38 +++++++++------- ports/esp32s2/common-hal/alarm/pin/PinAlarm.c | 8 ++-- ports/esp32s2/common-hal/alarm/pin/PinAlarm.h | 2 +- .../common-hal/alarm/time/DurationAlarm.c | 5 ++- py/circuitpy_defns.mk | 11 +++-- py/enum.h | 4 +- py/genlast.py | 4 +- shared-bindings/alarm/ResetReason.c | 12 ++++- shared-bindings/alarm/ResetReason.h | 8 +++- shared-bindings/alarm/__init__.c | 45 +++++++++---------- shared-bindings/alarm/pin/PinAlarm.c | 11 ++--- shared-bindings/alarm/pin/PinAlarm.h | 5 ++- shared-bindings/alarm/time/DurationAlarm.c | 15 ++++--- shared-bindings/alarm/time/DurationAlarm.h | 2 + supervisor/shared/safe_mode.c | 1 + 15 files changed, 98 insertions(+), 73 deletions(-) diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index e8cb7b882efc0..d2ac3981efb47 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -26,8 +26,8 @@ */ #include "shared-bindings/alarm/__init__.h" -#include "shared-bindings/alarm_io/__init__.h" -#include "shared-bindings/alarm_time/__init__.h" +#include "shared-bindings/alarm/pin/PinAlarm.h" +#include "shared-bindings/alarm/time/DurationAlarm.h" #include "esp_sleep.h" @@ -35,41 +35,47 @@ void common_hal_alarm_disable_all(void) { esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL); } -mp_obj_t common_hal_alarm_get_reset_reason(void) { +alarm_reset_reason_t common_hal_alarm_get_reset_reason(void) { switch (esp_sleep_get_wakeup_cause()) { case ESP_SLEEP_WAKEUP_TIMER: return RESET_REASON_DEEP_SLEEP_ALARM; + case ESP_SLEEP_WAKEUP_EXT0: return RESET_REASON_DEEP_SLEEP_ALARM; + case ESP_SLEEP_WAKEUP_TOUCHPAD: //TODO: implement TouchIO case ESP_SLEEP_WAKEUP_UNDEFINED: default: - return mp_const_none; - break; + return RESET_REASON_INVALID; } } mp_obj_t common_hal_alarm_get_wake_alarm(void) { switch (esp_sleep_get_wakeup_cause()) { - case ESP_SLEEP_WAKEUP_TIMER: ; - //Wake up from timer. - alarm_time_obj_t *timer = m_new_obj(alarm_time_obj_t); - timer->base.type = &alarm_time_type; + case ESP_SLEEP_WAKEUP_TIMER: { + // Wake up from timer. + alarm_time_duration_alarm_obj_t *timer = m_new_obj(alarm_time_duration_alarm_obj_t); + timer->base.type = &alarm_time_duration_alarm_type; return timer; - case ESP_SLEEP_WAKEUP_EXT0: ; - //Wake up from GPIO - alarm_io_obj_t *ext0 = m_new_obj(alarm_io_obj_t); - ext0->base.type = &alarm_io_type; + } + + case ESP_SLEEP_WAKEUP_EXT0: { + // Wake up from GPIO + alarm_pin_pin_alarm_obj_t *ext0 = m_new_obj(alarm_pin_pin_alarm_obj_t); + ext0->base.type = &alarm_pin_pin_alarm_type; return ext0; + } + case ESP_SLEEP_WAKEUP_TOUCHPAD: - //TODO: implement TouchIO - //Wake up from touch on pad, esp_sleep_get_touchpad_wakeup_status() + // TODO: implement TouchIO + // Wake up from touch on pad, esp_sleep_get_touchpad_wakeup_status() break; + case ESP_SLEEP_WAKEUP_UNDEFINED: default: - //Not a deep sleep reset + // Not a deep sleep reset. break; } return mp_const_none; diff --git a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c index 12114066658d2..6ac3d05f87124 100644 --- a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +++ b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c @@ -27,15 +27,17 @@ #include "esp_sleep.h" -#include "shared-bindings/alarm/time/DurationAlarm.h" +#include "shared-bindings/alarm/pin/PinAlarm.h" +#include "shared-bindings/microcontroller/Pin.h" -void common_hal_alarm_pin_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, mcu_pin_obj_t *pin, bool level, bool edge, bool pull) { +void common_hal_alarm_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, const mcu_pin_obj_t *pin, bool level, bool edge, bool pull) { self->pin = pin; self->level = level; self->edge = edge; self->pull = pull; +} -mcu_pin_obj_t *common_hal_alarm_pin_pin_alarm_get_pin(alarm_pin_pin_alarm_obj_t *self) { +const mcu_pin_obj_t *common_hal_alarm_pin_pin_alarm_get_pin(alarm_pin_pin_alarm_obj_t *self) { return self->pin; } diff --git a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h index 52739185848f4..c6a760b96afe6 100644 --- a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h +++ b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h @@ -29,7 +29,7 @@ typedef struct { mp_obj_base_t base; - mcu_pin_obj_t *pin; + const mcu_pin_obj_t *pin; bool level; bool edge; bool pull; diff --git a/ports/esp32s2/common-hal/alarm/time/DurationAlarm.c b/ports/esp32s2/common-hal/alarm/time/DurationAlarm.c index bf1a6cc421f16..80bf4244e392f 100644 --- a/ports/esp32s2/common-hal/alarm/time/DurationAlarm.c +++ b/ports/esp32s2/common-hal/alarm/time/DurationAlarm.c @@ -27,6 +27,8 @@ #include "esp_sleep.h" +#include "py/runtime.h" + #include "shared-bindings/alarm/time/DurationAlarm.h" void common_hal_alarm_time_duration_alarm_construct(alarm_time_duration_alarm_obj_t *self, mp_float_t duration) { @@ -36,7 +38,8 @@ void common_hal_alarm_time_duration_alarm_construct(alarm_time_duration_alarm_ob mp_float_t common_hal_alarm_time_duration_alarm_get_duration(alarm_time_duration_alarm_obj_t *self) { return self->duration; } -void common_hal_alarm_time_duration_alarm_enable(alarm_time_duration_alarm_obj_t *self) + +void common_hal_alarm_time_duration_alarm_enable(alarm_time_duration_alarm_obj_t *self) { if (esp_sleep_enable_timer_wakeup((uint64_t) (self->duration * 1000000)) == ESP_ERR_INVALID_ARG) { mp_raise_ValueError(translate("duration out of range")); } diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index dbde1a34d6555..d788a5411c558 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -359,8 +359,6 @@ SRC_COMMON_HAL_ALL = \ rtc/__init__.c \ sdioio/SDCard.c \ sdioio/__init__.c \ - sleepio/__init__.c \ - sleepio/ResetReason.c \ socketpool/__init__.c \ socketpool/SocketPool.c \ socketpool/Socket.c \ @@ -395,9 +393,10 @@ $(filter $(SRC_PATTERNS), \ _bleio/Address.c \ _bleio/Attribute.c \ _bleio/ScanEntry.c \ - canio/Match.c \ _eve/__init__.c \ + alarm/ResetReason.c \ camera/ImageFormat.c \ + canio/Match.c \ digitalio/Direction.c \ digitalio/DriveMode.c \ digitalio/Pull.c \ @@ -414,9 +413,6 @@ SRC_SHARED_MODULE_ALL = \ _bleio/Attribute.c \ _bleio/ScanEntry.c \ _bleio/ScanResults.c \ - canio/Match.c \ - canio/Message.c \ - canio/RemoteTransmissionRequest.c \ _eve/__init__.c \ _pixelbuf/PixelBuf.c \ _pixelbuf/__init__.c \ @@ -441,6 +437,9 @@ SRC_SHARED_MODULE_ALL = \ bitbangio/__init__.c \ board/__init__.c \ busio/OneWire.c \ + canio/Match.c \ + canio/Message.c \ + canio/RemoteTransmissionRequest.c \ displayio/Bitmap.c \ displayio/ColorConverter.c \ displayio/Display.c \ diff --git a/py/enum.h b/py/enum.h index 1c38ae5ae6686..708678eb699b2 100644 --- a/py/enum.h +++ b/py/enum.h @@ -35,12 +35,12 @@ typedef struct { } cp_enum_obj_t; #define MAKE_ENUM_VALUE(type, prefix, name, value) \ - STATIC const cp_enum_obj_t prefix ## _ ## name ## _obj = { \ + const cp_enum_obj_t prefix ## _ ## name ## _obj = { \ { &type }, value, MP_QSTR_ ## name, \ } #define MAKE_ENUM_MAP(name) \ - STATIC const mp_rom_map_elem_t name ## _locals_table[] = + const mp_rom_map_elem_t name ## _locals_table[] = #define MAKE_ENUM_MAP_ENTRY(prefix, name) \ { MP_ROM_QSTR(MP_QSTR_ ## name), MP_ROM_PTR(&prefix ## _ ## name ## _obj) } diff --git a/py/genlast.py b/py/genlast.py index 1df2a2482509b..5b195d23e4265 100644 --- a/py/genlast.py +++ b/py/genlast.py @@ -47,7 +47,9 @@ def preprocess(command, output_dir, fn): print(e, file=sys.stderr) def maybe_preprocess(command, output_dir, fn): - if subprocess.call(["grep", "-lqE", "(MP_QSTR|translate)", fn]) == 0: + # Preprocess the source file if it contains "MP_QSTR", "translate", + # or if it uses enum.h (which generates "MP_QSTR" strings. + if subprocess.call(["grep", "-lqE", r"(MP_QSTR|translate|enum\.h)", fn]) == 0: preprocess(command, output_dir, fn) if __name__ == '__main__': diff --git a/shared-bindings/alarm/ResetReason.c b/shared-bindings/alarm/ResetReason.c index c46b2ba8f101d..086562fc9c969 100644 --- a/shared-bindings/alarm/ResetReason.c +++ b/shared-bindings/alarm/ResetReason.c @@ -24,18 +24,25 @@ * THE SOFTWARE. */ +#include "py/obj.h" #include "py/enum.h" #include "shared-bindings/alarm/ResetReason.h" -MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, POWER_VALID, RESET_REASON_POWER_ON); +MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, INVALID, RESET_REASON_INVALID); +MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, POWER_ON, RESET_REASON_POWER_ON); +MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, BROWNOUT, RESET_REASON_BROWNOUT); MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, SOFTWARE, RESET_REASON_SOFTWARE); MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, DEEP_SLEEP_ALARM, RESET_REASON_DEEP_SLEEP_ALARM); -MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, EXTERNAL, RESET_REASON_EXTERNAL); +MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, RESET_PIN, RESET_REASON_RESET_PIN); +MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, WATCHDOG, RESET_REASON_WATCHDOG); //| class ResetReason: //| """The reason the chip was last reset""" //| +//| INVALID: object +//| """Invalid reason: indicates an internal error.""" +//| //| POWER_ON: object //| """The chip was started from power off.""" //| @@ -55,6 +62,7 @@ MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, EXTERNAL, RESET_REASON_EX //| """The chip was reset by its watchdog timer.""" //| MAKE_ENUM_MAP(alarm_reset_reason) { + MAKE_ENUM_MAP_ENTRY(reset_reason, INVALID), MAKE_ENUM_MAP_ENTRY(reset_reason, POWER_ON), MAKE_ENUM_MAP_ENTRY(reset_reason, BROWNOUT), MAKE_ENUM_MAP_ENTRY(reset_reason, SOFTWARE), diff --git a/shared-bindings/alarm/ResetReason.h b/shared-bindings/alarm/ResetReason.h index 0325ba8e33405..2d6b8bc0c31da 100644 --- a/shared-bindings/alarm/ResetReason.h +++ b/shared-bindings/alarm/ResetReason.h @@ -27,7 +27,11 @@ #ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM__RESET_REASON__H #define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM__RESET_REASON__H +#include "py/obj.h" +#include "py/enum.h" + typedef enum { + RESET_REASON_INVALID, RESET_REASON_POWER_ON, RESET_REASON_BROWNOUT, RESET_REASON_SOFTWARE, @@ -36,8 +40,8 @@ typedef enum { RESET_REASON_WATCHDOG, } alarm_reset_reason_t; -extern const mp_obj_type_t alarm_reset_reason_type; +extern const cp_enum_obj_t reset_reason_INVALID_obj; -extern alarm_reset_reason_t common_hal_alarm_get_reset_reason(void); +extern const mp_obj_type_t alarm_reset_reason_type; #endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM__RESET_REASON__H diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index ecbf7fe04ff6e..771c8ff9bff0c 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -34,6 +34,11 @@ #include "py/obj.h" #include "py/runtime.h" +#include "shared-bindings/alarm/__init__.h" +#include "shared-bindings/alarm/ResetReason.h" +#include "shared-bindings/alarm/pin/PinAlarm.h" +#include "shared-bindings/alarm/time/DurationAlarm.h" + STATIC mp_obj_t alarm_sleep_until_alarm(size_t n_args, const mp_obj_t *args) { // TODO return mp_const_none; @@ -56,47 +61,47 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_restart_on_alarm_obj, 1, MP_OBJ_FUN_AR //| """The `alarm.pin` module contains alarm attributes and classes related to pins //| """ //| -mp_map_elem_t alarm_pin_globals_table[] = { +STATIC const mp_map_elem_t alarm_pin_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_pin) }, - { MP_ROM_QSTR(MP_QSTR_PinAlarm), MP_ROM_PTR(&alarm_pin_pin_alarm_type) }, + { MP_ROM_QSTR(MP_QSTR_PinAlarm), MP_OBJ_FROM_PTR(&alarm_pin_pin_alarm_type) }, }; STATIC MP_DEFINE_CONST_DICT(alarm_pin_globals, alarm_pin_globals_table); -const mp_obj_module_t alarm_pin_module = { +STATIC const mp_obj_module_t alarm_pin_module = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t*)&alarm_pinn_globals, + .globals = (mp_obj_dict_t*)&alarm_pin_globals, }; //| """The `alarm.time` module contains alarm attributes and classes related to time-keeping. //| """ //| -mp_map_elem_t alarm_time_globals_table[] = { +STATIC const mp_map_elem_t alarm_time_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_time) }, - { MP_ROM_QSTR(MP_QSTR_DurationAlarm), MP_ROM_PTR(&alarm_time_duration_alarm_type) }, + { MP_ROM_QSTR(MP_QSTR_DurationAlarm), MP_OBJ_FROM_PTR(&alarm_time_duration_alarm_type) }, }; STATIC MP_DEFINE_CONST_DICT(alarm_time_globals, alarm_time_globals_table); -const mp_obj_module_t alarm_time_module = { +STATIC const mp_obj_module_t alarm_time_module = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t*)&alarm_time_globals, }; -mp_map_elem_t alarm_module_globals_table[] = { +STATIC mp_map_elem_t alarm_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_alarm) }, // wake_alarm and reset_reason are mutable attributes. { MP_ROM_QSTR(MP_QSTR_wake_alarm), mp_const_none }, - { MP_ROM_QSTR(MP_QSTR_reset_reason), mp_const_none }, + { MP_ROM_QSTR(MP_QSTR_reset_reason), MP_OBJ_FROM_PTR(&reset_reason_INVALID_obj) }, - { MP_ROM_QSTR(MP_QSTR_sleep_until_alarm), MP_ROM_PTR(&alarm_sleep_until_alarm_obj) }, - { MP_ROM_QSTR(MP_QSTR_restart_on_alarm), MP_ROM_PTR(&alarm_restart_on_alarm_obj) }, + { MP_ROM_QSTR(MP_QSTR_sleep_until_alarm), MP_OBJ_FROM_PTR(&alarm_sleep_until_alarm_obj) }, + { MP_ROM_QSTR(MP_QSTR_restart_on_alarm), MP_OBJ_FROM_PTR(&alarm_restart_on_alarm_obj) }, - { MP_ROM_QSTR(MP_QSTR_pin), MP_ROM_PTR(&alarm_pin_module) }, - { MP_ROM_QSTR(MP_QSTR_time), MP_ROM_PTR(&alarm_time_module) } + { MP_ROM_QSTR(MP_QSTR_pin), MP_OBJ_FROM_PTR(&alarm_pin_module) }, + { MP_ROM_QSTR(MP_QSTR_time), MP_OBJ_FROM_PTR(&alarm_time_module) } }; STATIC MP_DEFINE_MUTABLE_DICT(alarm_module_globals, alarm_module_globals_table); @@ -105,27 +110,17 @@ void common_hal_alarm_set_wake_alarm(mp_obj_t alarm) { // Equivalent of: // alarm.wake_alarm = alarm mp_map_elem_t *elem = - mp_map_lookup(&alarm_module_globals_table, MP_ROM_QSTR(MP_QSTR_wake_alarm), MP_MAP_LOOKUP); + mp_map_lookup(&alarm_module_globals.map, MP_ROM_QSTR(MP_QSTR_wake_alarm), MP_MAP_LOOKUP); if (elem) { elem->value = alarm; } } -alarm_reset_reason_t common_hal_alarm_get_reset_reason(void) { - mp_map_elem_t *elem = - mp_map_lookup(&alarm_module_globals_table, MP_ROM_QSTR(MP_QSTR_reset_reason), MP_MAP_LOOKUP); - if (elem) { - return elem->value; - } else { - return mp_const_none; - } -} - void common_hal_alarm_set_reset_reason(mp_obj_t reset_reason) { // Equivalent of: // alarm.reset_reason = reset_reason mp_map_elem_t *elem = - mp_map_lookup(&alarm_module_globals_table, MP_ROM_QSTR(MP_QSTR_reset_reason), MP_MAP_LOOKUP); + mp_map_lookup(&alarm_module_globals.map, MP_ROM_QSTR(MP_QSTR_reset_reason), MP_MAP_LOOKUP); if (elem) { elem->value = reset_reason; } diff --git a/shared-bindings/alarm/pin/PinAlarm.c b/shared-bindings/alarm/pin/PinAlarm.c index 0146a3a1ad115..fef1face76ce3 100644 --- a/shared-bindings/alarm/pin/PinAlarm.c +++ b/shared-bindings/alarm/pin/PinAlarm.c @@ -27,6 +27,7 @@ #include "shared-bindings/board/__init__.h" #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/alarm/pin/PinAlarm.h" #include "py/nlr.h" #include "py/obj.h" @@ -58,8 +59,7 @@ //| """ //| ... //| -STATIC mp_obj_t alarm_pin_pin_alarm_make_new(const mp_obj_type_t *type, - mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kw_args) { +STATIC mp_obj_t alarm_pin_pin_alarm_make_new(const mp_obj_type_t *type, mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { alarm_pin_pin_alarm_obj_t *self = m_new_obj(alarm_pin_pin_alarm_obj_t); self->base.type = &alarm_pin_pin_alarm_type; enum { ARG_pin, ARG_level, ARG_edge, ARG_pull }; @@ -74,7 +74,7 @@ STATIC mp_obj_t alarm_pin_pin_alarm_make_new(const mp_obj_type_t *type, const mcu_pin_obj_t* pin = validate_obj_is_free_pin(args[ARG_pin].u_obj); - common_hal_alarm_pin_pin_pin_alarm_construct( + common_hal_alarm_pin_pin_alarm_construct( self, pin, args[ARG_level].u_bool, args[ARG_edge].u_bool, args[ARG_pull].u_bool); return MP_OBJ_FROM_PTR(self); @@ -110,11 +110,12 @@ STATIC mp_obj_t alarm_pin_pin_alarm_binary_op(mp_binary_op_t op, mp_obj_t lhs_in STATIC const mp_rom_map_elem_t alarm_pin_pin_alarm_locals_dict_table[] = { }; -STATIC MP_DEFINE_CONST_DICT(alarm_pin_pin_alarm_locals, alarm_pin_pin_alarm_locals_dict); +STATIC MP_DEFINE_CONST_DICT(alarm_pin_pin_alarm_locals_dict, alarm_pin_pin_alarm_locals_dict_table); const mp_obj_type_t alarm_pin_pin_alarm_type = { { &mp_type_type }, .name = MP_QSTR_PinAlarm, .make_new = alarm_pin_pin_alarm_make_new, - .locals_dict = (mp_obj_t)&alarm_pin_pin_alarm_locals, + .binary_op = alarm_pin_pin_alarm_binary_op, + .locals_dict = (mp_obj_t)&alarm_pin_pin_alarm_locals_dict, }; diff --git a/shared-bindings/alarm/pin/PinAlarm.h b/shared-bindings/alarm/pin/PinAlarm.h index b7c553ad5db2a..978ceaad56d69 100644 --- a/shared-bindings/alarm/pin/PinAlarm.h +++ b/shared-bindings/alarm/pin/PinAlarm.h @@ -29,11 +29,12 @@ #include "py/obj.h" #include "common-hal/microcontroller/Pin.h" +#include "common-hal/alarm/pin/PinAlarm.h" extern const mp_obj_type_t alarm_pin_pin_alarm_type; -extern void common_hal_alarm_pin_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, const mcu_pin_obj_t *pin, bool level, bool edge, bool pull); -extern mcu_pin_obj_t *common_hal_alarm_pin_pin_alarm_get_pin(alarm_pin_pin_alarm_obj_t *self); +extern void common_hal_alarm_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, const mcu_pin_obj_t *pin, bool level, bool edge, bool pull); +extern const mcu_pin_obj_t *common_hal_alarm_pin_pin_alarm_get_pin(alarm_pin_pin_alarm_obj_t *self); extern bool common_hal_alarm_pin_pin_alarm_get_level(alarm_pin_pin_alarm_obj_t *self); extern bool common_hal_alarm_pin_pin_alarm_get_edge(alarm_pin_pin_alarm_obj_t *self); extern bool common_hal_alarm_pin_pin_alarm_get_pull(alarm_pin_pin_alarm_obj_t *self); diff --git a/shared-bindings/alarm/time/DurationAlarm.c b/shared-bindings/alarm/time/DurationAlarm.c index c30c7f326c11e..5fb232f4ae560 100644 --- a/shared-bindings/alarm/time/DurationAlarm.c +++ b/shared-bindings/alarm/time/DurationAlarm.c @@ -26,7 +26,7 @@ #include "shared-bindings/board/__init__.h" #include "shared-bindings/microcontroller/__init__.h" -#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/alarm/time/DurationAlarm.h" #include "py/nlr.h" #include "py/obj.h" @@ -49,8 +49,8 @@ STATIC mp_obj_t alarm_time_duration_alarm_make_new(const mp_obj_type_t *type, mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kw_args) { mp_arg_check_num(n_args, kw_args, 1, 1, false); - alarm_pin_duration_alarm_obj_t *self = m_new_obj(alarm_pin_duration_alarm_obj_t); - self->base.type = &alarm_pin_pin_alarm_type; + alarm_time_duration_alarm_obj_t *self = m_new_obj(alarm_time_duration_alarm_obj_t); + self->base.type = &alarm_time_duration_alarm_type; mp_float_t secs = mp_obj_get_float(args[0]); @@ -60,7 +60,7 @@ STATIC mp_obj_t alarm_time_duration_alarm_make_new(const mp_obj_type_t *type, } //| def __eq__(self, other: object) -> bool: -//| """Two DurationAlarm objects are equal if their durations are the same.""" +//| """Two DurationAlarm objects are equal if their durations differ by less than a millisecond.""" //| ... //| STATIC mp_obj_t alarm_time_duration_alarm_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) { @@ -68,8 +68,8 @@ STATIC mp_obj_t alarm_time_duration_alarm_binary_op(mp_binary_op_t op, mp_obj_t case MP_BINARY_OP_EQUAL: if (MP_OBJ_IS_TYPE(rhs_in, &alarm_time_duration_alarm_type)) { return mp_obj_new_bool( - common_hal_alarm_time_duration_alarm_get_duration(lhs_in) == - common_hal_alarm_time_duration_alarm_get_duration(rhs_in)); + abs(common_hal_alarm_time_duration_alarm_get_duration(lhs_in) - + common_hal_alarm_time_duration_alarm_get_duration(rhs_in)) < 0.001f); } return mp_const_false; @@ -87,5 +87,6 @@ const mp_obj_type_t alarm_time_duration_alarm_type = { { &mp_type_type }, .name = MP_QSTR_DurationAlarm, .make_new = alarm_time_duration_alarm_make_new, - .locals_dict = (mp_obj_t)&alarm_time_duration_alarm_locals, + .binary_op = alarm_time_duration_alarm_binary_op, + .locals_dict = (mp_obj_t)&alarm_time_duration_alarm_locals_dict, }; diff --git a/shared-bindings/alarm/time/DurationAlarm.h b/shared-bindings/alarm/time/DurationAlarm.h index f6ab4f975c3db..87f5d9390ca6a 100644 --- a/shared-bindings/alarm/time/DurationAlarm.h +++ b/shared-bindings/alarm/time/DurationAlarm.h @@ -29,6 +29,8 @@ #include "py/obj.h" +#include "common-hal/alarm/time/DurationAlarm.h" + extern const mp_obj_type_t alarm_time_duration_alarm_type; extern void common_hal_alarm_time_duration_alarm_construct(alarm_time_duration_alarm_obj_t *self, mp_float_t duration); diff --git a/supervisor/shared/safe_mode.c b/supervisor/shared/safe_mode.c index 7630010d034e0..ee8af2c2ca3c0 100644 --- a/supervisor/shared/safe_mode.c +++ b/supervisor/shared/safe_mode.c @@ -30,6 +30,7 @@ #include "shared-bindings/digitalio/DigitalInOut.h" #if CIRCUITPY_ALARM +#include "shared-bindings/alarm/__init__.h" #include "shared-bindings/alarm/ResetReason.h" #endif From 75559f35ccc946dfd292e25671919e5d5b3bd7a6 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sat, 21 Nov 2020 23:29:52 -0500 Subject: [PATCH 247/770] wip: ResetReason to microcontroller.cpu --- locale/circuitpython.pot | 18 ++--- main.c | 9 +-- .../common-hal/microcontroller/Processor.c | 5 ++ .../common-hal/microcontroller/__init__.c | 4 - .../common-hal/microcontroller/Processor.c | 5 ++ .../common-hal/microcontroller/__init__.c | 4 - ports/esp32s2/common-hal/alarm/__init__.c | 17 ----- .../common-hal/microcontroller/Processor.c | 23 +++++- .../common-hal/microcontroller/__init__.c | 4 - .../common-hal/microcontroller/Processor.c | 8 +- .../common-hal/microcontroller/__init__.c | 4 - .../common-hal/microcontroller/Processor.c | 5 ++ .../common-hal/microcontroller/__init__.c | 4 - .../common-hal/microcontroller/Processor.c | 8 +- .../nrf/common-hal/microcontroller/__init__.c | 4 - .../common-hal/microcontroller/Processor.c | 9 ++- .../stm/common-hal/microcontroller/__init__.c | 4 - py/circuitpy_defns.mk | 2 +- shared-bindings/_typing/__init__.pyi | 11 ++- shared-bindings/alarm/__init__.c | 74 +++++++++++-------- shared-bindings/alarm/__init__.h | 6 +- shared-bindings/alarm/pin/PinAlarm.c | 28 +++---- shared-bindings/alarm/time/DurationAlarm.c | 11 ++- shared-bindings/microcontroller/Processor.c | 18 +++++ shared-bindings/microcontroller/Processor.h | 3 +- .../{alarm => microcontroller}/ResetReason.c | 41 +++++----- .../{alarm => microcontroller}/ResetReason.h | 18 +++-- shared-bindings/microcontroller/__init__.c | 9 --- shared-bindings/microcontroller/__init__.h | 4 +- shared-bindings/supervisor/RunReason.c | 38 +++++----- shared-bindings/supervisor/RunReason.h | 4 +- shared-bindings/supervisor/Runtime.c | 10 +-- supervisor/shared/safe_mode.c | 14 ++-- 33 files changed, 220 insertions(+), 206 deletions(-) rename shared-bindings/{alarm => microcontroller}/ResetReason.c (54%) rename shared-bindings/{alarm => microcontroller}/ResetReason.h (71%) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 969f3f36fb426..1dae9547a3493 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-11-19 00:28-0500\n" +"POT-Creation-Date: 2020-11-21 12:36-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -990,7 +990,7 @@ msgstr "" msgid "I2SOut not available" msgstr "" -#: ports/esp32s2/common-hal/alarm_io/__init__.c +#: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" msgstr "" @@ -2449,6 +2449,10 @@ msgstr "" msgid "division by zero" msgstr "" +#: ports/esp32s2/common-hal/alarm/time/DurationAlarm.c +msgid "duration out of range" +msgstr "" + #: py/objdeque.c msgid "empty" msgstr "" @@ -2809,7 +2813,7 @@ msgstr "" msgid "invalid syntax for number" msgstr "" -#: ports/esp32s2/common-hal/alarm_io/__init__.c +#: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "io must be rtc io" msgstr "" @@ -3434,10 +3438,6 @@ msgstr "" msgid "threshold must be in the range 0-65536" msgstr "" -#: ports/esp32s2/common-hal/alarm_time/__init__.c -msgid "time out of range" -msgstr "" - #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" @@ -3484,7 +3484,7 @@ msgstr "" msgid "trapz is defined for 1D arrays of equal length" msgstr "" -#: ports/esp32s2/common-hal/alarm_io/__init__.c +#: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "trigger level must be 0 or 1" msgstr "" @@ -3630,7 +3630,7 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" -#: ports/esp32s2/common-hal/alarm_io/__init__.c +#: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "wakeup conflict" msgstr "" diff --git a/main.c b/main.c index 30ceaeaa6d48b..8938d714af870 100755 --- a/main.c +++ b/main.c @@ -330,7 +330,7 @@ bool run_code_py(safe_mode_t safe_mode) { #if CIRCUITPY_ALARM // If USB isn't enumerated then deep sleep. if (ok && !supervisor_workflow_active() && supervisor_ticks_ms64() > CIRCUITPY_USB_ENUMERATION_DELAY * 1024) { - common_hal_mcu_deep_sleep(); + common_hal_alarm_restart_on_alarm(0, NULL); } #endif // Show the animation every N seconds. @@ -430,14 +430,9 @@ void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) { if (!skip_boot_output) { // Wait 1.5 seconds before opening CIRCUITPY_BOOT_OUTPUT_FILE for write, // in case power is momentary or will fail shortly due to, say a low, battery. -#if CIRCUITPY_ALARM - if (common_hal_alarm_get_reset_reason() == RESET_REASON_POWER_ON) { -#endif + if (common_hal_mcu_processor_get_reset_reason() == RESET_REASON_POWER_ON) { mp_hal_delay_ms(1500); -#if CIRCUITPY_ALARM } -#endif - // USB isn't up, so we can write the file. filesystem_set_internal_writable_by_usb(false); f_open(fs, boot_output_file, CIRCUITPY_BOOT_OUTPUT_FILE, FA_WRITE | FA_CREATE_ALWAYS); diff --git a/ports/atmel-samd/common-hal/microcontroller/Processor.c b/ports/atmel-samd/common-hal/microcontroller/Processor.c index ba8daf3fb0e1a..9955212657ea7 100644 --- a/ports/atmel-samd/common-hal/microcontroller/Processor.c +++ b/ports/atmel-samd/common-hal/microcontroller/Processor.c @@ -65,6 +65,7 @@ #include "py/mphal.h" #include "common-hal/microcontroller/Processor.h" +#include "shared-bindings/microcontroller/ResetReason.h" #include "samd/adc.h" @@ -349,3 +350,7 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { } } } + +mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) { + return RESET_REASON_POWER_ON; +} diff --git a/ports/atmel-samd/common-hal/microcontroller/__init__.c b/ports/atmel-samd/common-hal/microcontroller/__init__.c index ca39f28386cdd..50a1ec038e931 100644 --- a/ports/atmel-samd/common-hal/microcontroller/__init__.c +++ b/ports/atmel-samd/common-hal/microcontroller/__init__.c @@ -84,10 +84,6 @@ void common_hal_mcu_reset(void) { reset(); } -void common_hal_mcu_deep_sleep(void) { - //deep sleep call here -} - // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/ports/cxd56/common-hal/microcontroller/Processor.c b/ports/cxd56/common-hal/microcontroller/Processor.c index 1eddbb01de251..bd778e80dd582 100644 --- a/ports/cxd56/common-hal/microcontroller/Processor.c +++ b/ports/cxd56/common-hal/microcontroller/Processor.c @@ -31,6 +31,7 @@ // For NAN: remove when not needed. #include #include "py/mphal.h" +#include "shared-bindings/microcontroller/ResetReason.h" uint32_t common_hal_mcu_processor_get_frequency(void) { return cxd56_get_cpu_baseclk(); @@ -47,3 +48,7 @@ float common_hal_mcu_processor_get_voltage(void) { void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { boardctl(BOARDIOC_UNIQUEID, (uintptr_t) raw_id); } + +mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) { + return RESET_REASON_POWER_ON; +} diff --git a/ports/cxd56/common-hal/microcontroller/__init__.c b/ports/cxd56/common-hal/microcontroller/__init__.c index 57140dec7041f..7aa3b839d7801 100644 --- a/ports/cxd56/common-hal/microcontroller/__init__.c +++ b/ports/cxd56/common-hal/microcontroller/__init__.c @@ -81,10 +81,6 @@ void common_hal_mcu_reset(void) { boardctl(BOARDIOC_RESET, 0); } -void common_hal_mcu_deep_sleep(void) { - //deep sleep call here -} - STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_UART2_RXD), MP_ROM_PTR(&pin_UART2_RXD) }, { MP_ROM_QSTR(MP_QSTR_UART2_TXD), MP_ROM_PTR(&pin_UART2_TXD) }, diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index d2ac3981efb47..e335345508b55 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -35,23 +35,6 @@ void common_hal_alarm_disable_all(void) { esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL); } -alarm_reset_reason_t common_hal_alarm_get_reset_reason(void) { - switch (esp_sleep_get_wakeup_cause()) { - case ESP_SLEEP_WAKEUP_TIMER: - return RESET_REASON_DEEP_SLEEP_ALARM; - - case ESP_SLEEP_WAKEUP_EXT0: - return RESET_REASON_DEEP_SLEEP_ALARM; - - case ESP_SLEEP_WAKEUP_TOUCHPAD: - //TODO: implement TouchIO - case ESP_SLEEP_WAKEUP_UNDEFINED: - default: - return RESET_REASON_INVALID; - } -} - - mp_obj_t common_hal_alarm_get_wake_alarm(void) { switch (esp_sleep_get_wakeup_cause()) { case ESP_SLEEP_WAKEUP_TIMER: { diff --git a/ports/esp32s2/common-hal/microcontroller/Processor.c b/ports/esp32s2/common-hal/microcontroller/Processor.c index b815216012973..bd625dc6e2921 100644 --- a/ports/esp32s2/common-hal/microcontroller/Processor.c +++ b/ports/esp32s2/common-hal/microcontroller/Processor.c @@ -28,8 +28,9 @@ #include #include -#include "common-hal/microcontroller/Processor.h" #include "py/runtime.h" + +#include "common-hal/microcontroller/Processor.h" #include "supervisor/shared/translate.h" #include "soc/efuse_reg.h" @@ -74,3 +75,23 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { *ptr-- = swap_nibbles(mac_address_part & 0xff); mac_address_part >>= 8; *ptr-- = swap_nibbles(mac_address_part & 0xff); } + +mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) { + switch (esp_sleep_get_wakeup_cause()) { + case ESP_SLEEP_WAKEUP_TIMER: + return RESET_REASON_DEEP_SLEEP_ALARM; + + case ESP_SLEEP_WAKEUP_EXT0: + return RESET_REASON_DEEP_SLEEP_ALARM; + + case ESP_SLEEP_WAKEUP_TOUCHPAD: + //TODO: implement TouchIO + case ESP_SLEEP_WAKEUP_UNDEFINED: + default: + return RESET_REASON_POWER_APPLIED; + } +} + +mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) { + return RESET_REASON_POWER_ON; +} diff --git a/ports/esp32s2/common-hal/microcontroller/__init__.c b/ports/esp32s2/common-hal/microcontroller/__init__.c index 79cb938939257..3056c65655153 100644 --- a/ports/esp32s2/common-hal/microcontroller/__init__.c +++ b/ports/esp32s2/common-hal/microcontroller/__init__.c @@ -79,10 +79,6 @@ void common_hal_mcu_reset(void) { while(1); } -void common_hal_mcu_deep_sleep(void) { - esp_deep_sleep_start(); -} - // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/ports/litex/common-hal/microcontroller/Processor.c b/ports/litex/common-hal/microcontroller/Processor.c index 9d2b05aadeab0..013a7ca035b92 100644 --- a/ports/litex/common-hal/microcontroller/Processor.c +++ b/ports/litex/common-hal/microcontroller/Processor.c @@ -26,8 +26,10 @@ */ #include -#include "common-hal/microcontroller/Processor.h" #include "py/runtime.h" + +#include "common-hal/microcontroller/Processor.h" +#include "shared-bindings/microcontroller/ResetReason.h" #include "supervisor/shared/translate.h" #include "csr.h" @@ -62,3 +64,7 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { raw_id[13] = csr_readl(CSR_VERSION_SEED_ADDR + 8); raw_id[14] = csr_readl(CSR_VERSION_SEED_ADDR + 12); } + +mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) { + return RESET_REASON_POWER_ON; +} diff --git a/ports/litex/common-hal/microcontroller/__init__.c b/ports/litex/common-hal/microcontroller/__init__.c index e6f50ed5a6abe..3c91661144b81 100644 --- a/ports/litex/common-hal/microcontroller/__init__.c +++ b/ports/litex/common-hal/microcontroller/__init__.c @@ -89,10 +89,6 @@ void common_hal_mcu_reset(void) { while(1); } -void common_hal_mcu_deep_sleep(void) { - //deep sleep call here -} - // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/ports/mimxrt10xx/common-hal/microcontroller/Processor.c b/ports/mimxrt10xx/common-hal/microcontroller/Processor.c index f3a578014ea48..28fe67db7cbab 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/Processor.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/Processor.c @@ -28,6 +28,7 @@ #include #include "common-hal/microcontroller/Processor.h" +#include "shared-bindings/microcontroller/ResetReason.h" #include "fsl_tempmon.h" #include "fsl_ocotp.h" @@ -70,3 +71,7 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { } OCOTP_Deinit(OCOTP); } + +mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) { + return RESET_REASON_POWER_ON; +} diff --git a/ports/mimxrt10xx/common-hal/microcontroller/__init__.c b/ports/mimxrt10xx/common-hal/microcontroller/__init__.c index 0329ced69b5d9..6a8537e2da17b 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/__init__.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/__init__.c @@ -86,10 +86,6 @@ void common_hal_mcu_reset(void) { NVIC_SystemReset(); } -void common_hal_mcu_deep_sleep(void) { - //deep sleep call here -} - // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/ports/nrf/common-hal/microcontroller/Processor.c b/ports/nrf/common-hal/microcontroller/Processor.c index 03d9c4d3f059a..e2695139c5fa6 100644 --- a/ports/nrf/common-hal/microcontroller/Processor.c +++ b/ports/nrf/common-hal/microcontroller/Processor.c @@ -24,8 +24,10 @@ * THE SOFTWARE. */ -#include "common-hal/microcontroller/Processor.h" #include "py/runtime.h" + +#include "common-hal/microcontroller/Processor.h" +#include "shared-bindings/microcontroller/ResetReason.h" #include "supervisor/shared/translate.h" #include "nrfx_saadc.h" @@ -119,3 +121,7 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { ((uint32_t*) raw_id)[i] = NRF_FICR->DEVICEID[i]; } } + +mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) { + return RESET_REASON_POWER_ON; +} diff --git a/ports/nrf/common-hal/microcontroller/__init__.c b/ports/nrf/common-hal/microcontroller/__init__.c index 9911896bff751..06aac9409dc1f 100644 --- a/ports/nrf/common-hal/microcontroller/__init__.c +++ b/ports/nrf/common-hal/microcontroller/__init__.c @@ -95,10 +95,6 @@ void common_hal_mcu_reset(void) { reset_cpu(); } -void common_hal_mcu_deep_sleep(void) { - //deep sleep call here -} - // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/ports/stm/common-hal/microcontroller/Processor.c b/ports/stm/common-hal/microcontroller/Processor.c index 8dc968b36a730..d77d287a9e201 100644 --- a/ports/stm/common-hal/microcontroller/Processor.c +++ b/ports/stm/common-hal/microcontroller/Processor.c @@ -25,9 +25,12 @@ */ #include -#include "common-hal/microcontroller/Processor.h" #include "py/runtime.h" + +#include "common-hal/microcontroller/Processor.h" +#include "shared-bindings/microcontroller/ResetReason.h" #include "supervisor/shared/translate.h" + #include STM32_HAL_H #if CPY_STM32F4 @@ -138,3 +141,7 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { } #endif } + +mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) { + return RESET_REASON_POWER_ON; +} diff --git a/ports/stm/common-hal/microcontroller/__init__.c b/ports/stm/common-hal/microcontroller/__init__.c index bc81b0e4f5e90..a827399ccb05f 100644 --- a/ports/stm/common-hal/microcontroller/__init__.c +++ b/ports/stm/common-hal/microcontroller/__init__.c @@ -81,10 +81,6 @@ void common_hal_mcu_reset(void) { NVIC_SystemReset(); } -void common_hal_mcu_deep_sleep(void) { - //deep sleep call here -} - // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index d788a5411c558..2731f2ae8d701 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -394,7 +394,6 @@ $(filter $(SRC_PATTERNS), \ _bleio/Attribute.c \ _bleio/ScanEntry.c \ _eve/__init__.c \ - alarm/ResetReason.c \ camera/ImageFormat.c \ canio/Match.c \ digitalio/Direction.c \ @@ -402,6 +401,7 @@ $(filter $(SRC_PATTERNS), \ digitalio/Pull.c \ fontio/Glyph.c \ math/__init__.c \ + microcontroller/ResetReason.c \ microcontroller/RunMode.c \ ) diff --git a/shared-bindings/_typing/__init__.pyi b/shared-bindings/_typing/__init__.pyi index 3b3f18cb9b427..02839ab4773f8 100644 --- a/shared-bindings/_typing/__init__.pyi +++ b/shared-bindings/_typing/__init__.pyi @@ -54,13 +54,12 @@ FrameBuffer = Union[rgbmatrix.RGBMatrix] """ Alarm = Union[ - alarm_time.Time, alarm_pin.PinLevel, alarm_touch.PinTouch + alarm.pin.PinAlarm, alarm.time.DurationAlarm ] -"""Classes that implement the audiosample protocol +"""Classes that implement alarms for sleeping and asynchronous notification. - - `alarm_time.Time` - - `alarm_pin.PinLevel` - - `alarm_touch.PinTouch` + - `alarm.pin.PinAlarm` + - `alarm.time.DurationAlarm` - You can play use these alarms to wake from light or deep sleep. + You can use these alarms to wake from light or deep sleep. """ diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 771c8ff9bff0c..934544216458b 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -1,3 +1,37 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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 "py/obj.h" +#include "py/runtime.h" + +#include "shared-bindings/alarm/__init__.h" +#include "shared-bindings/alarm/ResetReason.h" +#include "shared-bindings/alarm/pin/PinAlarm.h" +#include "shared-bindings/alarm/time/DurationAlarm.h" + //| """Power-saving light and deep sleep. Alarms can be set to wake up from sleep. //| //| The `alarm` module provides sleep related functionality. There are two supported levels of @@ -11,54 +45,43 @@ //| Deep sleep shuts down power to nearly all of the chip including the CPU and RAM. This can save //| a more significant amount of power, but CircuitPython must start ``code.py`` from the beginning when woken //| up. CircuitPython will enter deep sleep automatically when the current program exits without error -//| or calls `sys.exit(0)`. +//| or calls ``sys.exit(0)``. //| If an error causes CircuitPython to exit, error LED error flashes will be done periodically. //| An error includes an uncaught exception, or sys.exit called with a non-zero argumetn. -//| To set alarms for deep sleep use `alarm.reload_on_alarm()` they will apply to next deep sleep only.""" +//| To set alarms for deep sleep use `alarm.restart_on_alarm()` they will apply to next deep sleep only.""" //| - //| wake_alarm: Alarm //| """The most recent alarm to wake us up from a sleep (light or deep.)""" //| -//| reset_reason: ResetReason -//| """The reason the chip started up from reset state. This can may be power up or due to an alarm.""" -//| - -//| def sleep(alarm: Alarm, ...) -> Alarm: +//| def sleep_until_alarm(*alarms: Alarm) -> Alarm: //| """Performs a light sleep until woken by one of the alarms. The alarm that triggers the wake //| is returned, and is also available as `alarm.wake_alarm` +//| """ //| ... //| - -#include "py/obj.h" -#include "py/runtime.h" - -#include "shared-bindings/alarm/__init__.h" -#include "shared-bindings/alarm/ResetReason.h" -#include "shared-bindings/alarm/pin/PinAlarm.h" -#include "shared-bindings/alarm/time/DurationAlarm.h" - STATIC mp_obj_t alarm_sleep_until_alarm(size_t n_args, const mp_obj_t *args) { // TODO + common_hal_alarm_sleep_until_alarm(size_t n_args, const mp_obj_t *args); return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_sleep_until_alarm_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_sleep_until_alarm); -//| def restart_on_alarm(alarm: Alarm, ...) -> None: +//| def restart_on_alarm(*alarms: Alarm) -> None: //| """Set one or more alarms to wake up from a deep sleep. //| When awakened, ``code.py`` will restart from the beginning. -//| The last alarm to wake us up is available as `wake_alarm`. +//| The last alarm to wake us up is available as `alarm.wake_alarm`. //| """ //| ... //| STATIC mp_obj_t alarm_restart_on_alarm(size_t n_args, const mp_obj_t *args) { // TODO + common_hal_alarm_restart_on_alarm(size_t n_args, const mp_obj_t *args); return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_restart_on_alarm_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_restart_on_alarm); -//| """The `alarm.pin` module contains alarm attributes and classes related to pins +//| """The `alarm.pin` module contains alarm attributes and classes related to pins. //| """ //| STATIC const mp_map_elem_t alarm_pin_globals_table[] = { @@ -95,7 +118,6 @@ STATIC mp_map_elem_t alarm_module_globals_table[] = { // wake_alarm and reset_reason are mutable attributes. { MP_ROM_QSTR(MP_QSTR_wake_alarm), mp_const_none }, - { MP_ROM_QSTR(MP_QSTR_reset_reason), MP_OBJ_FROM_PTR(&reset_reason_INVALID_obj) }, { MP_ROM_QSTR(MP_QSTR_sleep_until_alarm), MP_OBJ_FROM_PTR(&alarm_sleep_until_alarm_obj) }, { MP_ROM_QSTR(MP_QSTR_restart_on_alarm), MP_OBJ_FROM_PTR(&alarm_restart_on_alarm_obj) }, @@ -116,16 +138,6 @@ void common_hal_alarm_set_wake_alarm(mp_obj_t alarm) { } } -void common_hal_alarm_set_reset_reason(mp_obj_t reset_reason) { - // Equivalent of: - // alarm.reset_reason = reset_reason - mp_map_elem_t *elem = - mp_map_lookup(&alarm_module_globals.map, MP_ROM_QSTR(MP_QSTR_reset_reason), MP_MAP_LOOKUP); - if (elem) { - elem->value = reset_reason; - } -} - const mp_obj_module_t alarm_module = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t*)&alarm_module_globals, diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h index a0ee76e53b0b4..29be8716c58e4 100644 --- a/shared-bindings/alarm/__init__.h +++ b/shared-bindings/alarm/__init__.h @@ -29,11 +29,9 @@ #include "py/obj.h" -#include "shared-bindings/alarm/ResetReason.h" - extern void common_hal_alarm_set_wake_alarm(mp_obj_t alarm); -extern alarm_reset_reason_t common_hal_alarm_get_reset_reason(void); -extern void common_hal_alarm_set_reset_reason(mp_obj_t reset_reason); +extern mp_obj_t common_hal_alarm_restart_on_alarm(size_t n_alarms, const mp_obj_t *alarms); +extern mp_obj_t alarm_sleep_until_alarm(size_t n_alarms, const mp_obj_t *alarms); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM___INIT___H diff --git a/shared-bindings/alarm/pin/PinAlarm.c b/shared-bindings/alarm/pin/PinAlarm.c index fef1face76ce3..835a5be5ce888 100644 --- a/shared-bindings/alarm/pin/PinAlarm.c +++ b/shared-bindings/alarm/pin/PinAlarm.c @@ -35,27 +35,27 @@ #include "supervisor/shared/translate.h" //| class PinAlarm: -//| """Trigger an alarm when a pin changes state. +//| """Trigger an alarm when a pin changes state.""" //| //| def __init__(self, pin: microcontroller.Pin, level: bool, *, edge: bool = False, pull: bool = False) -> None: //| """Create an alarm triggered by a `~microcontroller.Pin` level. The alarm is not active -//| until it is listed in an `alarm`-enabling function, such as `alarm.sleep()` or -//| `alarm.wake_after_exit()`. - +//| until it is listed in an `alarm`-enabling function, such as `alarm.sleep_until_alarm()` or +//| `alarm.restart_on_alarm()`. +//| //| :param ~microcontroller.Pin pin: The pin to monitor. On some ports, the choice of pin -//| may be limited due to hardware restrictions, particularly for deep-sleep alarms. +//| may be limited due to hardware restrictions, particularly for deep-sleep alarms. //| :param bool level: When active, trigger when the level is high (``True``) or low (``False``). -//| On some ports, multiple `PinAlarm` objects may need to have coordinated levels -//| for deep-sleep alarms +//| On some ports, multiple `PinAlarm` objects may need to have coordinated levels +//| for deep-sleep alarms. //| :param bool edge: If ``True``, trigger only when there is a transition to the specified -//| value of `level`. If ``True``, if the alarm becomes active when the pin level already -//| matches `level`, the alarm is not triggered: the pin must transition from ``not level`` -//| to ``level`` to trigger the alarm. On some ports, edge-triggering may not be available, -//| particularly for deep-sleep alarms. +//| value of `level`. If ``True``, if the alarm becomes active when the pin level already +//| matches `level`, the alarm is not triggered: the pin must transition from ``not level`` +//| to ``level`` to trigger the alarm. On some ports, edge-triggering may not be available, +//| particularly for deep-sleep alarms. //| :param bool pull: Enable a pull-up or pull-down which pulls the pin to level opposite -//| opposite that of `level`. For instance, if `level` is set to ``True``, setting `pull` -//| to ``True`` will enable a pull-down, to hold the pin low normally until an outside signal -//| pulls it high. +//| opposite that of `level`. For instance, if `level` is set to ``True``, setting `pull` +//| to ``True`` will enable a pull-down, to hold the pin low normally until an outside signal +//| pulls it high. //| """ //| ... //| diff --git a/shared-bindings/alarm/time/DurationAlarm.c b/shared-bindings/alarm/time/DurationAlarm.c index 5fb232f4ae560..c105bbebf7bda 100644 --- a/shared-bindings/alarm/time/DurationAlarm.c +++ b/shared-bindings/alarm/time/DurationAlarm.c @@ -34,14 +34,13 @@ #include "supervisor/shared/translate.h" //| class DurationAlarm: -//| """Trigger an alarm at a specified interval from now. +//| """Trigger an alarm at a specified interval from now.""" //| //| def __init__(self, secs: float) -> None: -//| """Create an alarm that will be triggered in `secs` seconds **from the time -//| the alarm is created**. The alarm is not active until it is listed in an -//| `alarm`-enabling function, such as `alarm.sleep()` or -//| `alarm.wake_after_exit()`. But the interval starts immediately upon -//| instantiation. +//| """Create an alarm that will be triggered in `secs` seconds from the time +//| sleep starts. The alarm is not active until it is listed in an +//| `alarm`-enabling function, such as `alarm.sleep_until_alarm()` or +//| `alarm.restart_on_alarm()`. //| """ //| ... //| diff --git a/shared-bindings/microcontroller/Processor.c b/shared-bindings/microcontroller/Processor.c index 8c703891d7cb0..b0ab842f4c24b 100644 --- a/shared-bindings/microcontroller/Processor.c +++ b/shared-bindings/microcontroller/Processor.c @@ -67,6 +67,23 @@ const mp_obj_property_t mcu_processor_frequency_obj = { }, }; +//| reset_reason: `microcontroller.ResetReason` +//| """The reason the microcontroller started up from reset state.""" +//| +STATIC mp_obj_t mcu_processor_get_reset_reason(mp_obj_t self) { + return cp_enum_find(&mcu_reset_reason_type, common_hal_mcu_processor_get_reset_reason()); +} + +MP_DEFINE_CONST_FUN_OBJ_1(mcu_processor_get_reset_reason_obj, mcu_processor_get_reset_reason); + +const mp_obj_property_t mcu_reset_reason_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&mcu_processor_get_reason_reason_obj, // getter + (mp_obj_t)&mp_const_none_obj, // no setter + (mp_obj_t)&mp_const_none_obj, // no deleter + }, +}; + //| temperature: Optional[float] //| """The on-chip temperature, in Celsius, as a float. (read-only) //| @@ -128,6 +145,7 @@ const mp_obj_property_t mcu_processor_voltage_obj = { STATIC const mp_rom_map_elem_t mcu_processor_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_frequency), MP_ROM_PTR(&mcu_processor_frequency_obj) }, + { MP_ROM_QSTR(MP_QSTR_reset_reason), MP_ROM_PTR(&mcu_processor_reset_reason_obj) }, { MP_ROM_QSTR(MP_QSTR_temperature), MP_ROM_PTR(&mcu_processor_temperature_obj) }, { MP_ROM_QSTR(MP_QSTR_uid), MP_ROM_PTR(&mcu_processor_uid_obj) }, { MP_ROM_QSTR(MP_QSTR_voltage), MP_ROM_PTR(&mcu_processor_voltage_obj) }, diff --git a/shared-bindings/microcontroller/Processor.h b/shared-bindings/microcontroller/Processor.h index 0f520f940c0f4..a842e06f323b7 100644 --- a/shared-bindings/microcontroller/Processor.h +++ b/shared-bindings/microcontroller/Processor.h @@ -29,11 +29,12 @@ #include "py/obj.h" -#include "common-hal/microcontroller/Processor.h" +#include "shared-bindings/microcontroller/ResetReason.h" extern const mp_obj_type_t mcu_processor_type; uint32_t common_hal_mcu_processor_get_frequency(void); +mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void); float common_hal_mcu_processor_get_temperature(void); void common_hal_mcu_processor_get_uid(uint8_t raw_id[]); float common_hal_mcu_processor_get_voltage(void); diff --git a/shared-bindings/alarm/ResetReason.c b/shared-bindings/microcontroller/ResetReason.c similarity index 54% rename from shared-bindings/alarm/ResetReason.c rename to shared-bindings/microcontroller/ResetReason.c index 086562fc9c969..151fcf315955e 100644 --- a/shared-bindings/alarm/ResetReason.c +++ b/shared-bindings/microcontroller/ResetReason.c @@ -27,42 +27,37 @@ #include "py/obj.h" #include "py/enum.h" -#include "shared-bindings/alarm/ResetReason.h" +#include "shared-bindings/microcontroller/ResetReason.h" -MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, INVALID, RESET_REASON_INVALID); -MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, POWER_ON, RESET_REASON_POWER_ON); -MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, BROWNOUT, RESET_REASON_BROWNOUT); -MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, SOFTWARE, RESET_REASON_SOFTWARE); -MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, DEEP_SLEEP_ALARM, RESET_REASON_DEEP_SLEEP_ALARM); -MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, RESET_PIN, RESET_REASON_RESET_PIN); -MAKE_ENUM_VALUE(alarm_reset_reason_type, reset_reason, WATCHDOG, RESET_REASON_WATCHDOG); +MAKE_ENUM_VALUE(mcu_reset_reason_type, reset_reason, POWER_ON, RESET_REASON_POWER_ON); +MAKE_ENUM_VALUE(mcu_reset_reason_type, reset_reason, BROWNOUT, RESET_REASON_BROWNOUT); +MAKE_ENUM_VALUE(mcu_reset_reason_type, reset_reason, SOFTWARE, RESET_REASON_SOFTWARE); +MAKE_ENUM_VALUE(mcu_reset_reason_type, reset_reason, DEEP_SLEEP_ALARM, RESET_REASON_DEEP_SLEEP_ALARM); +MAKE_ENUM_VALUE(mcu_reset_reason_type, reset_reason, RESET_PIN, RESET_REASON_RESET_PIN); +MAKE_ENUM_VALUE(mcu_reset_reason_type, reset_reason, WATCHDOG, RESET_REASON_WATCHDOG); //| class ResetReason: -//| """The reason the chip was last reset""" -//| -//| INVALID: object -//| """Invalid reason: indicates an internal error.""" +//| """The reason the microntroller was last reset""" //| //| POWER_ON: object -//| """The chip was started from power off.""" +//| """The microntroller was started from power off.""" //| //| BROWNOUT: object -//| """The chip was reset due to voltage brownout.""" +//| """The microntroller was reset due to too low a voltage.""" //| //| SOFTWARE: object -//| """The chip was reset from software.""" +//| """The microntroller was reset from software.""" //| //| DEEP_SLEEP_ALARM: object -//| """The chip was reset for deep sleep and restarted by an alarm.""" +//| """The microntroller was reset for deep sleep and restarted by an alarm.""" //| //| RESET_PIN: object -//| """The chip was reset by a signal on its reset pin. The pin might be connected to a reset buton.""" +//| """The microntroller was reset by a signal on its reset pin. The pin might be connected to a reset button.""" //| //| WATCHDOG: object -//| """The chip was reset by its watchdog timer.""" +//| """The chip microcontroller reset by its watchdog timer.""" //| -MAKE_ENUM_MAP(alarm_reset_reason) { - MAKE_ENUM_MAP_ENTRY(reset_reason, INVALID), +MAKE_ENUM_MAP(mcu_reset_reason) { MAKE_ENUM_MAP_ENTRY(reset_reason, POWER_ON), MAKE_ENUM_MAP_ENTRY(reset_reason, BROWNOUT), MAKE_ENUM_MAP_ENTRY(reset_reason, SOFTWARE), @@ -70,8 +65,8 @@ MAKE_ENUM_MAP(alarm_reset_reason) { MAKE_ENUM_MAP_ENTRY(reset_reason, RESET_PIN), MAKE_ENUM_MAP_ENTRY(reset_reason, WATCHDOG), }; -STATIC MP_DEFINE_CONST_DICT(alarm_reset_reason_locals_dict, alarm_reset_reason_locals_table); +STATIC MP_DEFINE_CONST_DICT(mcu_reset_reason_locals_dict, mcu_reset_reason_locals_table); -MAKE_PRINTER(alarm, alarm_reset_reason); +MAKE_PRINTER(alarm, mcu_reset_reason); -MAKE_ENUM_TYPE(alarm, ResetReason, alarm_reset_reason); +MAKE_ENUM_TYPE(alarm, ResetReason, mcu_reset_reason); diff --git a/shared-bindings/alarm/ResetReason.h b/shared-bindings/microcontroller/ResetReason.h similarity index 71% rename from shared-bindings/alarm/ResetReason.h rename to shared-bindings/microcontroller/ResetReason.h index 2d6b8bc0c31da..df1abf266e449 100644 --- a/shared-bindings/alarm/ResetReason.h +++ b/shared-bindings/microcontroller/ResetReason.h @@ -24,24 +24,28 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM__RESET_REASON__H -#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM__RESET_REASON__H +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_MCU__RESET_REASON__H +#define MICROPY_INCLUDED_SHARED_BINDINGS_MCU__RESET_REASON__H #include "py/obj.h" #include "py/enum.h" typedef enum { - RESET_REASON_INVALID, RESET_REASON_POWER_ON, RESET_REASON_BROWNOUT, RESET_REASON_SOFTWARE, RESET_REASON_DEEP_SLEEP_ALARM, RESET_REASON_RESET_PIN, RESET_REASON_WATCHDOG, -} alarm_reset_reason_t; +} mcu_reset_reason_t; -extern const cp_enum_obj_t reset_reason_INVALID_obj; +extern const cp_enum_obj_t reset_reason_POWER_ON_obj; +extern const cp_enum_obj_t reset_reason_BROWNOUT_obj; +extern const cp_enum_obj_t reset_reason_SOFTWARE_obj; +extern const cp_enum_obj_t reset_reason_DEEP_SLEEP_ALARM_obj; +extern const cp_enum_obj_t reset_reason_RESET_PIN_obj; +extern const cp_enum_obj_t reset_reason_WATCHDOG_obj; -extern const mp_obj_type_t alarm_reset_reason_type; +extern const mp_obj_type_t mcu_reset_reason_type; -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM__RESET_REASON__H +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_MCU__RESET_REASON__H diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index bfeb812d67b25..d09cf8f445fcc 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -135,13 +135,6 @@ STATIC mp_obj_t mcu_reset(void) { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_reset_obj, mcu_reset); -STATIC mp_obj_t mcu_sleep(void) { - common_hal_mcu_deep_sleep(); - // We won't actually get here because mcu is going into sleep. - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_sleep_obj, mcu_sleep); - //| nvm: Optional[ByteArray] //| """Available non-volatile memory. //| This object is the sole instance of `nvm.ByteArray` when available or ``None`` otherwise. @@ -176,8 +169,6 @@ STATIC const mp_rom_map_elem_t mcu_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_enable_interrupts), MP_ROM_PTR(&mcu_enable_interrupts_obj) }, { MP_ROM_QSTR(MP_QSTR_on_next_reset), MP_ROM_PTR(&mcu_on_next_reset_obj) }, { MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&mcu_reset_obj) }, - //ToDo: Remove MP_QSTR_sleep when sleep on code.py exit implemented. - { MP_ROM_QSTR(MP_QSTR_sleep), MP_ROM_PTR(&mcu_sleep_obj) }, #if CIRCUITPY_INTERNAL_NVM_SIZE > 0 { MP_ROM_QSTR(MP_QSTR_nvm), MP_ROM_PTR(&common_hal_mcu_nvm_obj) }, #else diff --git a/shared-bindings/microcontroller/__init__.h b/shared-bindings/microcontroller/__init__.h index f5bcfaa08a5f1..ac71de4247f2a 100644 --- a/shared-bindings/microcontroller/__init__.h +++ b/shared-bindings/microcontroller/__init__.h @@ -32,7 +32,7 @@ #include "py/mpconfig.h" #include "common-hal/microcontroller/Processor.h" - +#include "shared-bindings/microcontroller/ResetReason.h" #include "shared-bindings/microcontroller/RunMode.h" extern void common_hal_mcu_delay_us(uint32_t); @@ -43,8 +43,6 @@ extern void common_hal_mcu_enable_interrupts(void); extern void common_hal_mcu_on_next_reset(mcu_runmode_t runmode); extern void common_hal_mcu_reset(void); -extern void common_hal_mcu_deep_sleep(void); - extern const mp_obj_dict_t mcu_pin_globals; extern const mcu_processor_obj_t common_hal_mcu_processor_obj; diff --git a/shared-bindings/supervisor/RunReason.c b/shared-bindings/supervisor/RunReason.c index 5233cf959b19e..ee08f6d71b591 100644 --- a/shared-bindings/supervisor/RunReason.c +++ b/shared-bindings/supervisor/RunReason.c @@ -28,35 +28,35 @@ #include "shared-bindings/supervisor/RunReason.h" -MAKE_ENUM_VALUE(canio_bus_state_type, run_reason, ERROR_ACTIVE, RUN_REASON_STARTUP); -MAKE_ENUM_VALUE(canio_bus_state_type, bus_state, ERROR_PASSIVE, RUN_REASON_AUTORELOAD); -MAKE_ENUM_VALUE(canio_bus_state_type, bus_state, ERROR_WARNING, RUN_REASON_SUPERVISOR_RELOAD); -MAKE_ENUM_VALUE(canio_bus_state_type, bus_state, BUS_OFF, RUN_REASON_RELOAD_HOTKEY); +MAKE_ENUM_VALUE(supervisor_run_reason_type, run_reason, STARTUP, RUN_REASON_STARTUP); +MAKE_ENUM_VALUE(supervisor_run_reason_type, run_reason, AUTORELOAD, RUN_REASON_AUTORELOAD); +MAKE_ENUM_VALUE(supervisor_run_reason_type, run_reason, SUPERVISOR_RELOAD, RUN_REASON_SUPERVISOR_RELOAD); +MAKE_ENUM_VALUE(supervisor_run_reason_type, run_reason, REPL_RELOAD, RUN_REASON_REPL_RELOAD); //| class RunReason: -//| """The state of the CAN bus""" +//| """The reason that CircuitPython started running.""" //| //| STARTUP: object -//| """The first VM was run after the microcontroller started up. See `microcontroller.start_reason` -//| for more detail why the microcontroller was started.""" +//| """CircuitPython started the microcontroller started up. See `microcontroller.cpu.reset_reason` +//| for more detail on why the microcontroller was started.""" //| //| AUTORELOAD: object -//| """The VM was run due to a USB write to the filesystem.""" +//| """CircuitPython restarted due to a USB write to the filesystem.""" //| //| SUPERVISOR_RELOAD: object -//| """The VM was run due to a call to `supervisor.reload()`.""" +//| """CircuitPython restarted due to a call to `supervisor.reload()`.""" //| -//| RELOAD_HOTKEY: object -//| """The VM was run due CTRL-D.""" +//| REPL_RELOAD: object +//| """CircuitPython started due to the user typing CTRL-D in the REPL.""" //| -MAKE_ENUM_MAP(canio_bus_state) { - MAKE_ENUM_MAP_ENTRY(bus_state, ERROR_ACTIVE), - MAKE_ENUM_MAP_ENTRY(bus_state, ERROR_PASSIVE), - MAKE_ENUM_MAP_ENTRY(bus_state, ERROR_WARNING), - MAKE_ENUM_MAP_ENTRY(bus_state, BUS_OFF), +MAKE_ENUM_MAP(run_reason) { + MAKE_ENUM_MAP_ENTRY(run_reason, STARTUP), + MAKE_ENUM_MAP_ENTRY(run_reason, AUTORELOAD), + MAKE_ENUM_MAP_ENTRY(run_reason, SUPERVISOR_RELOAD), + MAKE_ENUM_MAP_ENTRY(run_reason, REPL_RELOAD), }; -STATIC MP_DEFINE_CONST_DICT(canio_bus_state_locals_dict, canio_bus_state_locals_table); +STATIC MP_DEFINE_CONST_DICT(supervisor_run_reason_locals_dict, supervisor_run_reason_locals_table); -MAKE_PRINTER(canio, canio_bus_state); +MAKE_PRINTER(supervisor, supervisor_run_reason); -MAKE_ENUM_TYPE(canio, BusState, canio_bus_state); +MAKE_ENUM_TYPE(supervisor, RunReason, supervisor_run_reason); diff --git a/shared-bindings/supervisor/RunReason.h b/shared-bindings/supervisor/RunReason.h index f9aaacae634bf..934c72fd8cfc0 100644 --- a/shared-bindings/supervisor/RunReason.h +++ b/shared-bindings/supervisor/RunReason.h @@ -30,7 +30,7 @@ typedef enum { RUN_REASON_STARTUP, RUN_REASON_AUTORELOAD, RUN_REASON_SUPERVISOR_RELOAD, - RUN_REASON_RELOAD_HOTKEY + RUN_REASON_REPL_RELOAD, } supervisor_run_reason_t; -extern const mp_obj_type_t canio_bus_state_type; +extern const mp_obj_type_t supervisor_run_reason_type; diff --git a/shared-bindings/supervisor/Runtime.c b/shared-bindings/supervisor/Runtime.c index f9db38c9b5636..6500dadd59947 100755 --- a/shared-bindings/supervisor/Runtime.c +++ b/shared-bindings/supervisor/Runtime.c @@ -91,15 +91,11 @@ const mp_obj_property_t supervisor_serial_bytes_available_obj = { //| run_reason: RunReason -//| """Returns why the Python VM was run this time.""" +//| """Returns why CircuitPython started running this particular time. //| STATIC mp_obj_t supervisor_get_run_reason(mp_obj_t self) { - if (!common_hal_get_serial_bytes_available()) { - return mp_const_false; - } - else { - return mp_const_true; - } + mp_raise_NotImplementedError(NULL); + return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_1(supervisor_get_run_reason_obj, supervisor_get_run_reason); diff --git a/supervisor/shared/safe_mode.c b/supervisor/shared/safe_mode.c index ee8af2c2ca3c0..9032e4045180c 100644 --- a/supervisor/shared/safe_mode.c +++ b/supervisor/shared/safe_mode.c @@ -29,10 +29,8 @@ #include "mphalport.h" #include "shared-bindings/digitalio/DigitalInOut.h" -#if CIRCUITPY_ALARM -#include "shared-bindings/alarm/__init__.h" -#include "shared-bindings/alarm/ResetReason.h" -#endif +#include "shared-bindings/microcontroller/Processor.h" +#include "shared-bindings/microcontroller/ResetReason.h" #include "supervisor/serial.h" #include "supervisor/shared/rgb_led_colors.h" @@ -56,12 +54,12 @@ safe_mode_t wait_for_safe_mode_reset(void) { current_safe_mode = safe_mode; return safe_mode; } -#if CIRCUITPY_ALARM - if (common_hal_alarm_get_reset_reason() != RESET_REASON_POWER_ON && - common_hal_alarm_get_reset_reason() != RESET_REASON_RESET_PIN) { + + const mcu_reset_reason_t reset_reason = common_hal_mcu_processor_get_reset_reason(); + if (reset_reason != RESET_REASON_POWER_ON && + reset_reason != RESET_REASON_RESET_PIN) { return NO_SAFE_MODE; } -#endif port_set_saved_word(SAFE_MODE_DATA_GUARD | (MANUAL_SAFE_MODE << 8)); // Wait for a while to allow for reset. temp_status_color(SAFE_MODE); From 0b858440b0d64ede9e340de4862684c8be2b5b2b Mon Sep 17 00:00:00 2001 From: jgillick Date: Sun, 22 Nov 2020 01:15:05 -0800 Subject: [PATCH 248/770] Fix formatting. --- ports/stm/common-hal/microcontroller/Pin.c | 174 +++++++++------------ 1 file changed, 77 insertions(+), 97 deletions(-) diff --git a/ports/stm/common-hal/microcontroller/Pin.c b/ports/stm/common-hal/microcontroller/Pin.c index 547ac87ae1d03..4b68d205bf9aa 100644 --- a/ports/stm/common-hal/microcontroller/Pin.c +++ b/ports/stm/common-hal/microcontroller/Pin.c @@ -41,170 +41,150 @@ bool apa102_mosi_in_use; #endif #if defined(TFBGA216) -GPIO_TypeDef *ports[] = {GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG, GPIOH, GPIOI, GPIOJ, GPIOK}; + GPIO_TypeDef * ports[] = {GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG, GPIOH, GPIOI, GPIOJ, GPIOK}; #elif defined(LQFP144) -GPIO_TypeDef *ports[] = {GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG}; + GPIO_TypeDef * ports[] = {GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG}; #elif defined(LQFP100_f4) || (LQFP100_x7) -GPIO_TypeDef *ports[] = {GPIOA, GPIOB, GPIOC, GPIOD, GPIOE}; + GPIO_TypeDef * ports[] = {GPIOA, GPIOB, GPIOC, GPIOD, GPIOE}; #elif defined(LQFP64) -GPIO_TypeDef *ports[] = {GPIOA, GPIOB, GPIOC, GPIOD}; + GPIO_TypeDef * ports[] = {GPIOA, GPIOB, GPIOC, GPIOD}; #elif defined(UFQFPN48) -GPIO_TypeDef *ports[] = {GPIOA, GPIOB, GPIOC}; + GPIO_TypeDef * ports[] = {GPIOA, GPIOB, GPIOC}; #endif + #define GPIO_PORT_COUNT (MP_ARRAY_SIZE(ports)) STATIC uint16_t claimed_pins[GPIO_PORT_COUNT]; STATIC uint16_t __ALIGNED(4) never_reset_pins[GPIO_PORT_COUNT]; -void reset_all_pins(void) -{ +void reset_all_pins(void) { // Reset claimed pins - for (uint8_t i = 0; i < GPIO_PORT_COUNT; i++) - { + for (uint8_t i = 0; i < GPIO_PORT_COUNT; i++) { claimed_pins[i] = never_reset_pins[i]; } - for (uint8_t i = 0; i < GPIO_PORT_COUNT; i++) - { + for (uint8_t i = 0; i < GPIO_PORT_COUNT; i++) { HAL_GPIO_DeInit(ports[i], ~never_reset_pins[i]); } -#ifdef MICROPY_HW_NEOPIXEL + #ifdef MICROPY_HW_NEOPIXEL neopixel_in_use = false; -#endif -#ifdef MICROPY_HW_APA102_MOSI - apa102_sck_in_use = false; - apa102_mosi_in_use = false; -#endif + #endif + #ifdef MICROPY_HW_APA102_MOSI + apa102_sck_in_use = false; + apa102_mosi_in_use = false; + #endif } // Mark pin as free and return it to a quiescent state. -void reset_pin_number(uint8_t pin_port, uint8_t pin_number) -{ - if (pin_number == NO_PIN) - { +void reset_pin_number(uint8_t pin_port, uint8_t pin_number) { + if ( pin_number == NO_PIN ) { return; } - if (pin_port == 0x0F) - { + if (pin_port == 0x0F) { return; } // Clear claimed bit & reset - claimed_pins[pin_port] &= ~(1 << pin_number); - never_reset_pins[pin_port] &= ~(1 << pin_number); - HAL_GPIO_DeInit(ports[pin_port], 1 << pin_number); + claimed_pins[pin_port] &= ~(1<port && pin_number == MICROPY_HW_NEOPIXEL->number) - { + #ifdef MICROPY_HW_NEOPIXEL + if (pin_port == MICROPY_HW_NEOPIXEL->port && pin_number == MICROPY_HW_NEOPIXEL->number) { neopixel_in_use = false; rgb_led_status_init(); return; } -#endif -#ifdef MICROPY_HW_APA102_MOSI - if ((pin_port == MICROPY_HW_APA102_MOSI->port && pin_number == MICROPY_HW_APA102_MOSI->number) || (pin_port == MICROPY_HW_APA102_SCK->port && pin_number == MICROPY_HW_APA102_MOSI->number)) - { - apa102_mosi_in_use = false; - apa102_sck_in_use = false; - rgb_led_status_init(); - return; - } -#endif + #endif + #ifdef MICROPY_HW_APA102_MOSI + if ((pin_port == MICROPY_HW_APA102_MOSI->port && pin_number == MICROPY_HW_APA102_MOSI->number) || (pin_port == MICROPY_HW_APA102_SCK->port && pin_number == MICROPY_HW_APA102_MOSI->number)) + { + apa102_mosi_in_use = false; + apa102_sck_in_use = false; + rgb_led_status_init(); + return; + } + #endif } -void never_reset_pin_number(uint8_t pin_port, uint8_t pin_number) -{ - if (pin_number == NO_PIN) - { +void never_reset_pin_number(uint8_t pin_port, uint8_t pin_number) { + if ( pin_number == NO_PIN ) { return; } - never_reset_pins[pin_port] |= 1 << pin_number; + never_reset_pins[pin_port] |= 1<port, pin->number); } -void common_hal_reset_pin(const mcu_pin_obj_t *pin) -{ +void common_hal_reset_pin(const mcu_pin_obj_t* pin) { reset_pin_number(pin->port, pin->number); } -void claim_pin(uint8_t pin_port, uint8_t pin_number) -{ +void claim_pin(uint8_t pin_port, uint8_t pin_number) { // Set bit in claimed_pins bitmask. - claimed_pins[pin_port] |= 1 << pin_number; + claimed_pins[pin_port] |= 1<port, pin->number); } -GPIO_TypeDef *pin_port(uint8_t pin_port) -{ +GPIO_TypeDef * pin_port(uint8_t pin_port) { return ports[pin_port]; } -uint16_t pin_mask(uint8_t pin_number) -{ - return 1 << pin_number; +uint16_t pin_mask(uint8_t pin_number) { + return 1<port * 16 + pin->number; } -void common_hal_mcu_pin_claim(const mcu_pin_obj_t *pin) -{ +void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin) { claim_pin(pin->port, pin->number); -#ifdef MICROPY_HW_NEOPIXEL - if (pin == MICROPY_HW_NEOPIXEL) - { + #ifdef MICROPY_HW_NEOPIXEL + if (pin == MICROPY_HW_NEOPIXEL) { neopixel_in_use = true; } -#endif -#ifdef MICROPY_HW_APA102_MOSI - if (pin == MICROPY_HW_APA102_MOSI) - { - apa102_mosi_in_use = true; - } - if (pin == MICROPY_HW_APA102_SCK) - { - apa102_sck_in_use = true; - } -#endif + #endif + #ifdef MICROPY_HW_APA102_MOSI + if (pin == MICROPY_HW_APA102_MOSI) + { + apa102_mosi_in_use = true; + } + if (pin == MICROPY_HW_APA102_SCK) + { + apa102_sck_in_use = true; + } + #endif } -void common_hal_mcu_pin_reset_number(uint8_t pin_no) -{ +void common_hal_mcu_pin_reset_number(uint8_t pin_no) { reset_pin_number(pin_no / 16, pin_no % 16); -} +} \ No newline at end of file From 381889f6bc025617fe85b248fae0f6b05ed50c01 Mon Sep 17 00:00:00 2001 From: jgillick Date: Sun, 22 Nov 2020 01:19:28 -0800 Subject: [PATCH 249/770] Cleanup --- .../boards/thunderpack_v12/mpconfigboard.h | 8 +- .../thunderpack_v12/stm32f4xx_hal_conf.h | 440 ------------------ ports/stm/common-hal/microcontroller/Pin.c | 52 +-- 3 files changed, 28 insertions(+), 472 deletions(-) delete mode 100644 ports/stm/boards/thunderpack_v12/stm32f4xx_hal_conf.h diff --git a/ports/stm/boards/thunderpack_v12/mpconfigboard.h b/ports/stm/boards/thunderpack_v12/mpconfigboard.h index 4c71b8aeb2ea6..426e0678da2da 100644 --- a/ports/stm/boards/thunderpack_v12/mpconfigboard.h +++ b/ports/stm/boards/thunderpack_v12/mpconfigboard.h @@ -30,10 +30,7 @@ #define CIRCUITPY_INTERNAL_NVM_SIZE (0x4000) #define CIRCUITPY_INTERNAL_NVM_START_ADDR (0x08010000) #define CIRCUITPY_INTERNAL_NVM_SECTOR FLASH_SECTOR_4 - -// Putting the entire flash sector in the NVM byte array buffer -// would take up too much RAM. This limits how much of the sector we use. -#define NVM_BYTEARRAY_BUFFER_SIZE 512 +#define NVM_BYTEARRAY_BUFFER_SIZE 512 // Flash config #define FLASH_SIZE (0x80000) @@ -47,7 +44,6 @@ #define SPI_FLASH_CS_PIN (&pin_PB12) // Status LEDs -#define MICROPY_HW_LED_STATUS (&pin_PA02) #define MICROPY_HW_APA102_MOSI (&pin_PB08) #define MICROPY_HW_APA102_SCK (&pin_PB00) @@ -58,4 +54,4 @@ // General config #define BOARD_OSC_DIV (24) #define BOARD_OVERWRITE_SWD (1) -#define BOARD_NO_VBUS_SENSE (1) \ No newline at end of file +#define BOARD_NO_VBUS_SENSE (1) diff --git a/ports/stm/boards/thunderpack_v12/stm32f4xx_hal_conf.h b/ports/stm/boards/thunderpack_v12/stm32f4xx_hal_conf.h deleted file mode 100644 index 5cb5634223585..0000000000000 --- a/ports/stm/boards/thunderpack_v12/stm32f4xx_hal_conf.h +++ /dev/null @@ -1,440 +0,0 @@ -/** - ****************************************************************************** - * @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 - * - *

© Copyright (c) 2017 STMicroelectronics. - * All rights reserved.

- * - * 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)24000000) /*!< 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/stm/common-hal/microcontroller/Pin.c b/ports/stm/common-hal/microcontroller/Pin.c index 4b68d205bf9aa..7d259e0521c28 100644 --- a/ports/stm/common-hal/microcontroller/Pin.c +++ b/ports/stm/common-hal/microcontroller/Pin.c @@ -71,8 +71,8 @@ void reset_all_pins(void) { neopixel_in_use = false; #endif #ifdef MICROPY_HW_APA102_MOSI - apa102_sck_in_use = false; - apa102_mosi_in_use = false; + apa102_sck_in_use = false; + apa102_mosi_in_use = false; #endif } @@ -98,13 +98,13 @@ void reset_pin_number(uint8_t pin_port, uint8_t pin_number) { } #endif #ifdef MICROPY_HW_APA102_MOSI - if ((pin_port == MICROPY_HW_APA102_MOSI->port && pin_number == MICROPY_HW_APA102_MOSI->number) || (pin_port == MICROPY_HW_APA102_SCK->port && pin_number == MICROPY_HW_APA102_MOSI->number)) - { - apa102_mosi_in_use = false; - apa102_sck_in_use = false; - rgb_led_status_init(); - return; - } + if ((pin_port == MICROPY_HW_APA102_MOSI->port && pin_number == MICROPY_HW_APA102_MOSI->number) || (pin_port == MICROPY_HW_APA102_SCK->port && pin_number == MICROPY_HW_APA102_MOSI->number)) + { + apa102_mosi_in_use = false; + apa102_sck_in_use = false; + rgb_led_status_init(); + return; + } #endif } @@ -141,14 +141,14 @@ bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) { } #endif #ifdef MICROPY_HW_APA102_MOSI - if (pin == MICROPY_HW_APA102_MOSI) - { - return !apa102_mosi_in_use; - } - if (pin == MICROPY_HW_APA102_SCK) - { - return !apa102_sck_in_use; - } + if (pin == MICROPY_HW_APA102_MOSI) + { + return !apa102_mosi_in_use; + } + if (pin == MICROPY_HW_APA102_SCK) + { + return !apa102_sck_in_use; + } #endif return pin_number_is_free(pin->port, pin->number); @@ -174,17 +174,17 @@ void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin) { } #endif #ifdef MICROPY_HW_APA102_MOSI - if (pin == MICROPY_HW_APA102_MOSI) - { - apa102_mosi_in_use = true; - } - if (pin == MICROPY_HW_APA102_SCK) - { - apa102_sck_in_use = true; - } + if (pin == MICROPY_HW_APA102_MOSI) + { + apa102_mosi_in_use = true; + } + if (pin == MICROPY_HW_APA102_SCK) + { + apa102_sck_in_use = true; + } #endif } void common_hal_mcu_pin_reset_number(uint8_t pin_no) { reset_pin_number(pin_no / 16, pin_no % 16); -} \ No newline at end of file +} From 56634eb00e524a6f51a44f4041cd73a04528fe47 Mon Sep 17 00:00:00 2001 From: jgillick Date: Sun, 22 Nov 2020 01:31:41 -0800 Subject: [PATCH 250/770] Rename thunderpack to v11 --- .github/workflows/build.yml | 3 ++- ports/stm/boards/{thunderpack => thunderpack_v11}/board.c | 0 .../boards/{thunderpack => thunderpack_v11}/mpconfigboard.h | 0 .../boards/{thunderpack => thunderpack_v11}/mpconfigboard.mk | 0 ports/stm/boards/{thunderpack => thunderpack_v11}/pins.c | 0 5 files changed, 2 insertions(+), 1 deletion(-) rename ports/stm/boards/{thunderpack => thunderpack_v11}/board.c (100%) rename ports/stm/boards/{thunderpack => thunderpack_v11}/mpconfigboard.h (100%) rename ports/stm/boards/{thunderpack => thunderpack_v11}/mpconfigboard.mk (100%) rename ports/stm/boards/{thunderpack => thunderpack_v11}/pins.c (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f3e728a05cbd8..c5762c4abacbf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -317,7 +317,8 @@ jobs: - "teensy40" - "teensy41" - "teknikio_bluebird" - - "thunderpack" + - "thunderpack_v11" + - "thunderpack_v12" - "tinkeringtech_scoutmakes_azul" - "trellis_m4_express" - "trinket_m0" diff --git a/ports/stm/boards/thunderpack/board.c b/ports/stm/boards/thunderpack_v11/board.c similarity index 100% rename from ports/stm/boards/thunderpack/board.c rename to ports/stm/boards/thunderpack_v11/board.c diff --git a/ports/stm/boards/thunderpack/mpconfigboard.h b/ports/stm/boards/thunderpack_v11/mpconfigboard.h similarity index 100% rename from ports/stm/boards/thunderpack/mpconfigboard.h rename to ports/stm/boards/thunderpack_v11/mpconfigboard.h diff --git a/ports/stm/boards/thunderpack/mpconfigboard.mk b/ports/stm/boards/thunderpack_v11/mpconfigboard.mk similarity index 100% rename from ports/stm/boards/thunderpack/mpconfigboard.mk rename to ports/stm/boards/thunderpack_v11/mpconfigboard.mk diff --git a/ports/stm/boards/thunderpack/pins.c b/ports/stm/boards/thunderpack_v11/pins.c similarity index 100% rename from ports/stm/boards/thunderpack/pins.c rename to ports/stm/boards/thunderpack_v11/pins.c From fe6e50b770f7dffda1d49c503362c59e674224c2 Mon Sep 17 00:00:00 2001 From: jgillick Date: Sun, 22 Nov 2020 01:49:23 -0800 Subject: [PATCH 251/770] Update USB_PID --- ports/stm/boards/thunderpack_v12/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/stm/boards/thunderpack_v12/mpconfigboard.mk b/ports/stm/boards/thunderpack_v12/mpconfigboard.mk index d11cfb750537d..7bfe2736730c9 100644 --- a/ports/stm/boards/thunderpack_v12/mpconfigboard.mk +++ b/ports/stm/boards/thunderpack_v12/mpconfigboard.mk @@ -1,5 +1,5 @@ USB_VID = 0x239A -USB_PID = 0x806A +USB_PID = 0x8071 USB_PRODUCT = "Thunderpack STM32F411" USB_MANUFACTURER = "Jeremy Gillick" USB_DEVICES = "CDC,MSC" From 048ca2a57003d6f122db57dfc93513222380cff0 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Sun, 22 Nov 2020 18:54:18 +0530 Subject: [PATCH 252/770] get multiple touchpad working --- ports/esp32s2/common-hal/touchio/TouchIn.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ports/esp32s2/common-hal/touchio/TouchIn.c b/ports/esp32s2/common-hal/touchio/TouchIn.c index b44234775e2b5..4589c46a79bb1 100644 --- a/ports/esp32s2/common-hal/touchio/TouchIn.c +++ b/ports/esp32s2/common-hal/touchio/TouchIn.c @@ -25,10 +25,12 @@ */ #include "shared-bindings/touchio/TouchIn.h" -#include "py/runtime.h" +#include "py/runtime.h" #include "driver/touch_pad.h" +bool touch_inited = false; + static uint16_t get_raw_reading(touchio_touchin_obj_t *self) { uint32_t touch_value; touch_pad_read_raw_data((touch_pad_t)self->pin->touch_channel, &touch_value); @@ -45,11 +47,14 @@ void common_hal_touchio_touchin_construct(touchio_touchin_obj_t* self, } claim_pin(pin); - touch_pad_init(); - touch_pad_config((touch_pad_t)pin->touch_channel); + if (!touch_inited) { + touch_pad_init(); + touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER); + touch_pad_fsm_start(); + touch_inited = true; + } - touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER); - touch_pad_fsm_start(); + touch_pad_config((touch_pad_t)pin->touch_channel); // wait for "raw data" to reset mp_hal_delay_ms(10); @@ -79,8 +84,7 @@ void common_hal_touchio_touchin_deinit(touchio_touchin_obj_t* self) { } bool common_hal_touchio_touchin_get_value(touchio_touchin_obj_t *self) { - uint16_t reading = get_raw_reading(self); - return reading > self->threshold; + return get_raw_reading(self) > self->threshold; } uint16_t common_hal_touchio_touchin_get_raw_value(touchio_touchin_obj_t *self) { From f3b5ca5f01058cb1d50be09838bc55b22d3aae69 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Sun, 22 Nov 2020 19:20:21 +0530 Subject: [PATCH 253/770] replace goto with conditional break --- ports/esp32s2/peripherals/timer.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/peripherals/timer.c b/ports/esp32s2/peripherals/timer.c index 3aee33dc50b9b..0ae1403874ff9 100644 --- a/ports/esp32s2/peripherals/timer.c +++ b/ports/esp32s2/peripherals/timer.c @@ -46,6 +46,8 @@ void peripherals_timer_reset(void) { } void peripherals_timer_init(const timer_config_t * config, timer_index_t * timer) { + bool break_loop = false; + // get free timer for (uint8_t i = 0; i < 2; i++) { for (uint8_t j = 0; j < 2; j++) { @@ -53,16 +55,17 @@ void peripherals_timer_init(const timer_config_t * config, timer_index_t * timer timer->idx = (timer_idx_t)j; timer->group = (timer_group_t)i; timer_state[i][j] = TIMER_BUSY; - goto init_timer; + break_loop = true; + break; } else if (i == 1 && j == 1) { timer->idx = TIMER_MAX; timer->group = TIMER_GROUP_MAX; return; } } + if (break_loop) {break;} } -init_timer: // initialize timer module timer_init(timer->group, timer->idx, config); timer_set_counter_value(timer->group, timer->idx, 0); From f62ea25331678cc400c6149bbe3102c371540c6e Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sun, 22 Nov 2020 19:08:27 -0500 Subject: [PATCH 254/770] ESP32S2: common_hal_mcu_delay_us() now calls mp_hal_delay_us() --- ports/esp32s2/common-hal/microcontroller/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/common-hal/microcontroller/__init__.c b/ports/esp32s2/common-hal/microcontroller/__init__.c index e5cfc7eef0544..dba12b88b2fbd 100644 --- a/ports/esp32s2/common-hal/microcontroller/__init__.c +++ b/ports/esp32s2/common-hal/microcontroller/__init__.c @@ -42,7 +42,7 @@ #include "freertos/FreeRTOS.h" void common_hal_mcu_delay_us(uint32_t delay) { - + mp_hal_delay_us(delay); } volatile uint32_t nesting_count = 0; From a0f1ec3c4a3dd52b11752e10d0dd31202e9c705f Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sun, 22 Nov 2020 19:10:09 -0500 Subject: [PATCH 255/770] wip --- main.c | 16 +++-- .../common-hal/microcontroller/__init__.c | 4 ++ .../common-hal/microcontroller/__init__.c | 4 ++ ports/esp32s2/common-hal/alarm/__init__.c | 43 ++++++++++++ ports/esp32s2/common-hal/alarm/pin/PinAlarm.c | 19 ++++-- ports/esp32s2/common-hal/alarm/pin/PinAlarm.h | 7 +- .../common-hal/microcontroller/Processor.c | 55 +++++++++++----- .../common-hal/microcontroller/Processor.h | 6 +- .../common-hal/microcontroller/__init__.c | 8 +++ ports/esp32s2/common-hal/rtc/RTC.h | 6 +- ports/esp32s2/common-hal/supervisor/Runtime.h | 6 +- .../supervisor/internal_flash_root_pointers.h | 6 +- .../common-hal/microcontroller/__init__.c | 4 ++ .../common-hal/microcontroller/__init__.c | 4 ++ .../mimxrt10xx/MIMXRT1011/periph.h | 6 +- .../mimxrt10xx/MIMXRT1062/periph.h | 6 +- .../nrf/common-hal/microcontroller/__init__.c | 4 ++ ports/nrf/common-hal/rgbmatrix/RGBMatrix.h | 4 +- .../stm/common-hal/microcontroller/__init__.c | 4 ++ ports/stm/common-hal/rgbmatrix/RGBMatrix.h | 4 +- shared-bindings/alarm/__init__.c | 60 +++++++++++------ shared-bindings/alarm/__init__.h | 7 +- shared-bindings/alarm/pin/PinAlarm.c | 66 +++++++------------ shared-bindings/alarm/pin/PinAlarm.h | 5 +- shared-bindings/audiopwmio/__init__.h | 6 +- shared-bindings/microcontroller/Processor.c | 4 +- shared-bindings/microcontroller/Processor.h | 1 + shared-bindings/microcontroller/ResetReason.c | 7 +- shared-bindings/microcontroller/ResetReason.h | 14 ++-- shared-bindings/microcontroller/__init__.c | 14 ++++ shared-bindings/microcontroller/__init__.h | 2 + shared-bindings/supervisor/RunReason.c | 8 +-- shared-bindings/supervisor/RunReason.h | 2 +- shared-bindings/supervisor/Runtime.c | 10 ++- shared-bindings/supervisor/Runtime.h | 3 + shared-bindings/supervisor/__init__.c | 1 + supervisor/shared/usb/usb.c | 4 -- supervisor/shared/workflow.c | 8 +-- 38 files changed, 287 insertions(+), 151 deletions(-) diff --git a/main.c b/main.c index 8938d714af870..f77bf41d84108 100755 --- a/main.c +++ b/main.c @@ -61,6 +61,8 @@ #include "supervisor/usb.h" #include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/microcontroller/Processor.h" +#include "shared-bindings/supervisor/Runtime.h" #include "boards/board.h" @@ -327,24 +329,27 @@ bool run_code_py(safe_mode_t safe_mode) { #endif rgb_status_animation_t animation; bool ok = result.return_code != PYEXEC_EXCEPTION; - #if CIRCUITPY_ALARM // If USB isn't enumerated then deep sleep. if (ok && !supervisor_workflow_active() && supervisor_ticks_ms64() > CIRCUITPY_USB_ENUMERATION_DELAY * 1024) { - common_hal_alarm_restart_on_alarm(0, NULL); + common_hal_mcu_deep_sleep(); } - #endif // Show the animation every N seconds. prep_rgb_status_animation(&result, found_main, safe_mode, &animation); while (true) { RUN_BACKGROUND_TASKS; if (reload_requested) { + supervisor_set_run_reason(RUN_REASON_AUTO_RELOAD); reload_requested = false; return true; } if (serial_connected() && serial_bytes_available()) { // Skip REPL if reload was requested. - return (serial_read() == CHAR_CTRL_D); + bool ctrl_d = serial_read() == CHAR_CTRL_D; + if (ctrl_d) { + supervisor_set_run_reason(RUN_REASON_REPL_RELOAD); + } + return (ctrl_d); } if (!serial_connected_before_animation && serial_connected()) { @@ -521,6 +526,9 @@ int __attribute__((used)) main(void) { reset_devices(); reset_board(); + // This is first time we are running CircuitPython after a reset or power-up. + supervisor_set_run_reason(RUN_REASON_STARTUP); + // If not in safe mode turn on autoreload by default but before boot.py in case it wants to change it. if (safe_mode == NO_SAFE_MODE) { autoreload_enable(); diff --git a/ports/atmel-samd/common-hal/microcontroller/__init__.c b/ports/atmel-samd/common-hal/microcontroller/__init__.c index 50a1ec038e931..ca39f28386cdd 100644 --- a/ports/atmel-samd/common-hal/microcontroller/__init__.c +++ b/ports/atmel-samd/common-hal/microcontroller/__init__.c @@ -84,6 +84,10 @@ void common_hal_mcu_reset(void) { reset(); } +void common_hal_mcu_deep_sleep(void) { + //deep sleep call here +} + // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/ports/cxd56/common-hal/microcontroller/__init__.c b/ports/cxd56/common-hal/microcontroller/__init__.c index 7aa3b839d7801..57140dec7041f 100644 --- a/ports/cxd56/common-hal/microcontroller/__init__.c +++ b/ports/cxd56/common-hal/microcontroller/__init__.c @@ -81,6 +81,10 @@ void common_hal_mcu_reset(void) { boardctl(BOARDIOC_RESET, 0); } +void common_hal_mcu_deep_sleep(void) { + //deep sleep call here +} + STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_UART2_RXD), MP_ROM_PTR(&pin_UART2_RXD) }, { MP_ROM_QSTR(MP_QSTR_UART2_TXD), MP_ROM_PTR(&pin_UART2_TXD) }, diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index e335345508b55..4a255c51cc840 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -25,12 +25,20 @@ * THE SOFTWARE. */ +#include "py/objtuple.h" + #include "shared-bindings/alarm/__init__.h" #include "shared-bindings/alarm/pin/PinAlarm.h" #include "shared-bindings/alarm/time/DurationAlarm.h" #include "esp_sleep.h" +STATIC mp_obj_tuple_t *_deep_sleep_alarms; + +void alarm_reset(void) { + _deep_sleep_alarms = &mp_const_empty_tuple; +} + void common_hal_alarm_disable_all(void) { esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL); } @@ -63,3 +71,38 @@ mp_obj_t common_hal_alarm_get_wake_alarm(void) { } return mp_const_none; } + +mp_obj_t common_hal_alarm_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms) { + mp_raise_NotImplementedError(NULL); +} + +void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms) { + bool time_alarm_set = false; + for (size_t i = 0; i < n_alarms; i++) { + if (MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pin_alarm_type)) { + mp_raise_NotImplementedError(translate("PinAlarm deep sleep not yet implemented")); + } + if (MP_OBJ_IS_TYPE(alarms[i], &alarm_time_duration_alarm_type)) { + if (time_alarm_set) { + mp_raise_ValueError(translate("Only one alarm.time alarm can be set.")); + } + time_alarm_set = true; + } + } + + _deep_sleep_alarms = mp_obj_new_tuple(n_alarms, alarms); +} + +void common_hal_deep_sleep_with_alarms(void) { + for (size_t i = 0; i < _deep_sleep_alarms.len; i++) { + mp_obj_t alarm = _deep_sleep_alarms.items[i] + if (MP_OBJ_IS_TYPE(alarm, &alarm_time_duration_alarm_type)) { + alarm_time_duration_alarm_obj_t *duration_alarm = MP_OBJ_TO_PTR(alarm); + esp_sleep_enable_timer_wakeup( + (uint64_t) (duration_alarm->duration * 1000000.0f)); + } + // TODO: handle pin alarms + } + + common_hal_mcu_deep_sleep(); +} diff --git a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c index 6ac3d05f87124..f26c8a179a97d 100644 --- a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +++ b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c @@ -30,19 +30,24 @@ #include "shared-bindings/alarm/pin/PinAlarm.h" #include "shared-bindings/microcontroller/Pin.h" -void common_hal_alarm_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, const mcu_pin_obj_t *pin, bool level, bool edge, bool pull) { - self->pin = pin; - self->level = level; +void common_hal_alarm_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, const mp_obj_t pins[], size_t num_pins, bool value, bool all_same_value, bool edge, bool pull) { + self->pins = mp_obj_new_tuple(num_pins, pins); + self->value = value; + self->all_same_value = all_same_value; self->edge = edge; self->pull = pull; } -const mcu_pin_obj_t *common_hal_alarm_pin_pin_alarm_get_pin(alarm_pin_pin_alarm_obj_t *self) { - return self->pin; +const mp_obj_tuple_t *common_hal_alarm_pin_pin_alarm_get_pins(alarm_pin_pin_alarm_obj_t *self) { + return self->pins; } -bool common_hal_alarm_pin_pin_alarm_get_level(alarm_pin_pin_alarm_obj_t *self) { - return self->level; +bool common_hal_alarm_pin_pin_alarm_get_value(alarm_pin_pin_alarm_obj_t *self) { + return self->value; +} + +bool common_hal_alarm_pin_pin_alarm_get_all_same_value(alarm_pin_pin_alarm_obj_t *self) { + return self->all_same_value; } bool common_hal_alarm_pin_pin_alarm_get_edge(alarm_pin_pin_alarm_obj_t *self) { diff --git a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h index c6a760b96afe6..d7e7e2552a610 100644 --- a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h +++ b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h @@ -24,13 +24,14 @@ * THE SOFTWARE. */ - #include "py/obj.h" +#include "py/objtuple.h" typedef struct { mp_obj_base_t base; - const mcu_pin_obj_t *pin; - bool level; + mp_obj_tuple_t *pins; + bool value; + bool all_same_value; bool edge; bool pull; } alarm_pin_pin_alarm_obj_t; diff --git a/ports/esp32s2/common-hal/microcontroller/Processor.c b/ports/esp32s2/common-hal/microcontroller/Processor.c index bd625dc6e2921..fffd1a1b191e1 100644 --- a/ports/esp32s2/common-hal/microcontroller/Processor.c +++ b/ports/esp32s2/common-hal/microcontroller/Processor.c @@ -31,8 +31,12 @@ #include "py/runtime.h" #include "common-hal/microcontroller/Processor.h" +#include "shared-bindings/microcontroller/ResetReason.h" #include "supervisor/shared/translate.h" +#include "esp_sleep.h" +#include "esp_system.h" + #include "soc/efuse_reg.h" #include "components/driver/esp32s2/include/driver/temp_sensor.h" @@ -77,21 +81,42 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { } mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) { - switch (esp_sleep_get_wakeup_cause()) { - case ESP_SLEEP_WAKEUP_TIMER: - return RESET_REASON_DEEP_SLEEP_ALARM; - - case ESP_SLEEP_WAKEUP_EXT0: - return RESET_REASON_DEEP_SLEEP_ALARM; - - case ESP_SLEEP_WAKEUP_TOUCHPAD: - //TODO: implement TouchIO - case ESP_SLEEP_WAKEUP_UNDEFINED: + switch (esp_reset_reason()) { + case ESP_RST_POWERON: + return RESET_REASON_POWER_ON; + + case ESP_RST_SW: + case ESP_RST_PANIC: + return RESET_REASON_SOFTWARE; + + case ESP_RST_INT_WDT: + case ESP_RST_TASK_WDT: + case ESP_RST_WDT: + return RESET_REASON_WATCHDOG; + + case ESP_RST_BROWNOUT: + return RESET_REASON_BROWNOUT; + + case ESP_RST_SDIO: + case ESP_RST_EXT: + return RESET_REASON_RESET_PIN; + + case ESP_RST_DEEPSLEEP: + switch (esp_sleep_get_wakeup_cause()) { + case ESP_SLEEP_WAKEUP_TIMER: + case ESP_SLEEP_WAKEUP_EXT0: + case ESP_SLEEP_WAKEUP_EXT1: + case ESP_SLEEP_WAKEUP_TOUCHPAD: + return RESET_REASON_DEEP_SLEEP_ALARM; + + case ESP_SLEEP_WAKEUP_UNDEFINED: + default: + return RESET_REASON_UNKNOWN; + } + + case ESP_RST_UNKNOWN: default: - return RESET_REASON_POWER_APPLIED; - } -} + return RESET_REASON_UNKNOWN; -mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) { - return RESET_REASON_POWER_ON; + } } diff --git a/ports/esp32s2/common-hal/microcontroller/Processor.h b/ports/esp32s2/common-hal/microcontroller/Processor.h index f6636b333c5a6..641a11d5553b4 100644 --- a/ports/esp32s2/common-hal/microcontroller/Processor.h +++ b/ports/esp32s2/common-hal/microcontroller/Processor.h @@ -24,8 +24,8 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_LITEX_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H -#define MICROPY_INCLUDED_LITEX_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H #define COMMON_HAL_MCU_PROCESSOR_UID_LENGTH 6 @@ -36,4 +36,4 @@ typedef struct { // Stores no state currently. } mcu_processor_obj_t; -#endif // MICROPY_INCLUDED_LITEX_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H diff --git a/ports/esp32s2/common-hal/microcontroller/__init__.c b/ports/esp32s2/common-hal/microcontroller/__init__.c index 3056c65655153..fdfbd65fad0db 100644 --- a/ports/esp32s2/common-hal/microcontroller/__init__.c +++ b/ports/esp32s2/common-hal/microcontroller/__init__.c @@ -79,6 +79,14 @@ void common_hal_mcu_reset(void) { while(1); } +void common_hal_mcu_deep_sleep(void) { + // Shut down wifi cleanly. + esp_wifi_stop(); + + // Does not return. + esp_deep_sleep_start(); +} + // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/ports/esp32s2/common-hal/rtc/RTC.h b/ports/esp32s2/common-hal/rtc/RTC.h index e51f1f7848ffa..233cde3fd2c52 100644 --- a/ports/esp32s2/common-hal/rtc/RTC.h +++ b/ports/esp32s2/common-hal/rtc/RTC.h @@ -24,11 +24,11 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_NRF_COMMON_HAL_RTC_RTC_H -#define MICROPY_INCLUDED_NRF_COMMON_HAL_RTC_RTC_H +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_RTC_RTC_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_RTC_RTC_H extern void rtc_init(void); extern void rtc_reset(void); extern void common_hal_rtc_init(void); -#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_RTC_RTC_H +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_RTC_RTC_H diff --git a/ports/esp32s2/common-hal/supervisor/Runtime.h b/ports/esp32s2/common-hal/supervisor/Runtime.h index d1fe246211bd5..840ce1bbb37fb 100644 --- a/ports/esp32s2/common-hal/supervisor/Runtime.h +++ b/ports/esp32s2/common-hal/supervisor/Runtime.h @@ -24,8 +24,8 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_LITEX_COMMON_HAL_SUPERVISOR_RUNTIME_H -#define MICROPY_INCLUDED_LITEX_COMMON_HAL_SUPERVISOR_RUNTIME_H +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_SUPERVISOR_RUNTIME_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_SUPERVISOR_RUNTIME_H #include "py/obj.h" @@ -34,4 +34,4 @@ typedef struct { // Stores no state currently. } super_runtime_obj_t; -#endif // MICROPY_INCLUDED_LITEX_COMMON_HAL_SUPERVISOR_RUNTIME_H +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_SUPERVISOR_RUNTIME_H diff --git a/ports/esp32s2/supervisor/internal_flash_root_pointers.h b/ports/esp32s2/supervisor/internal_flash_root_pointers.h index ae3e45e14c001..a9a8c2a22ee44 100644 --- a/ports/esp32s2/supervisor/internal_flash_root_pointers.h +++ b/ports/esp32s2/supervisor/internal_flash_root_pointers.h @@ -23,9 +23,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_LITEX_INTERNAL_FLASH_ROOT_POINTERS_H -#define MICROPY_INCLUDED_LITEX_INTERNAL_FLASH_ROOT_POINTERS_H +#ifndef MICROPY_INCLUDED_ESP32S2_INTERNAL_FLASH_ROOT_POINTERS_H +#define MICROPY_INCLUDED_ESP32S2_INTERNAL_FLASH_ROOT_POINTERS_H #define FLASH_ROOT_POINTERS -#endif // MICROPY_INCLUDED_LITEX_INTERNAL_FLASH_ROOT_POINTERS_H +#endif // MICROPY_INCLUDED_ESP32S2_INTERNAL_FLASH_ROOT_POINTERS_H diff --git a/ports/litex/common-hal/microcontroller/__init__.c b/ports/litex/common-hal/microcontroller/__init__.c index 3c91661144b81..e6f50ed5a6abe 100644 --- a/ports/litex/common-hal/microcontroller/__init__.c +++ b/ports/litex/common-hal/microcontroller/__init__.c @@ -89,6 +89,10 @@ void common_hal_mcu_reset(void) { while(1); } +void common_hal_mcu_deep_sleep(void) { + //deep sleep call here +} + // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/ports/mimxrt10xx/common-hal/microcontroller/__init__.c b/ports/mimxrt10xx/common-hal/microcontroller/__init__.c index 6a8537e2da17b..0329ced69b5d9 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/__init__.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/__init__.c @@ -86,6 +86,10 @@ void common_hal_mcu_reset(void) { NVIC_SystemReset(); } +void common_hal_mcu_deep_sleep(void) { + //deep sleep call here +} + // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h index c3f04a0490d86..c50d73294b262 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h @@ -24,8 +24,8 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1011_PERIPH_H -#define MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1011_PERIPH_H +#ifndef MICROPY_INCLUDED_MIMXRT10XX_MIMXRT1011_PERIPHERALS_MIMXRT1011_PERIPH_H +#define MICROPY_INCLUDED_MIMXRT10XX_MIMXRT1011_PERIPHERALS_MIMXRT1011_PERIPH_H extern LPI2C_Type *mcu_i2c_banks[2]; @@ -47,4 +47,4 @@ extern const mcu_periph_obj_t mcu_uart_cts_list[4]; extern const mcu_pwm_obj_t mcu_pwm_list[20]; -#endif // MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1011_PERIP_H +#endif // MICROPY_INCLUDED_MIMXRT10XX_MIMXRT1011_PERIPHERALS_MIMXRT1011_PERIPH_H diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h index 4f6ab6261e360..067c05d0d0b7d 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h @@ -24,8 +24,8 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1011_PERIPH_H -#define MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1011_PERIPH_H +#ifndef MICROPY_INCLUDED_MIMXRT10XX_MIMXRT1062_PERIPHERALS_MIMXRT1011_PERIPH_H +#define MICROPY_INCLUDED_MIMXRT10XX_MIMXRT1062_PERIPHERALS_MIMXRT1011_PERIPH_H extern LPI2C_Type *mcu_i2c_banks[4]; @@ -47,4 +47,4 @@ extern const mcu_periph_obj_t mcu_uart_cts_list[9]; extern const mcu_pwm_obj_t mcu_pwm_list[67]; -#endif // MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1011_PERIPH_H +#endif // MICROPY_INCLUDED_MIMXRT10XX_MIMXRT1062_PERIPHERALS_MIMXRT1011_PERIPH_H diff --git a/ports/nrf/common-hal/microcontroller/__init__.c b/ports/nrf/common-hal/microcontroller/__init__.c index 06aac9409dc1f..9911896bff751 100644 --- a/ports/nrf/common-hal/microcontroller/__init__.c +++ b/ports/nrf/common-hal/microcontroller/__init__.c @@ -95,6 +95,10 @@ void common_hal_mcu_reset(void) { reset_cpu(); } +void common_hal_mcu_deep_sleep(void) { + //deep sleep call here +} + // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/ports/nrf/common-hal/rgbmatrix/RGBMatrix.h b/ports/nrf/common-hal/rgbmatrix/RGBMatrix.h index 48de4dcb212db..24d86f1779f68 100644 --- a/ports/nrf/common-hal/rgbmatrix/RGBMatrix.h +++ b/ports/nrf/common-hal/rgbmatrix/RGBMatrix.h @@ -24,8 +24,8 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_RGBMATRIX_RGBMATRIX_H -#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_RGBMATRIX_RGBMATRIX_H +#ifndef MICROPY_INCLUDED_NRF_COMMON_HAL_RGBMATRIX_RGBMATRIX_H +#define MICROPY_INCLUDED_NRF_COMMON_HAL_RGBMATRIX_RGBMATRIX_H void *common_hal_rgbmatrix_timer_allocate(void); void common_hal_rgbmatrix_timer_enable(void*); diff --git a/ports/stm/common-hal/microcontroller/__init__.c b/ports/stm/common-hal/microcontroller/__init__.c index a827399ccb05f..bc81b0e4f5e90 100644 --- a/ports/stm/common-hal/microcontroller/__init__.c +++ b/ports/stm/common-hal/microcontroller/__init__.c @@ -81,6 +81,10 @@ void common_hal_mcu_reset(void) { NVIC_SystemReset(); } +void common_hal_mcu_deep_sleep(void) { + //deep sleep call here +} + // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/ports/stm/common-hal/rgbmatrix/RGBMatrix.h b/ports/stm/common-hal/rgbmatrix/RGBMatrix.h index 48de4dcb212db..323878d20270c 100644 --- a/ports/stm/common-hal/rgbmatrix/RGBMatrix.h +++ b/ports/stm/common-hal/rgbmatrix/RGBMatrix.h @@ -24,8 +24,8 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_RGBMATRIX_RGBMATRIX_H -#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_RGBMATRIX_RGBMATRIX_H +#ifndef MICROPY_INCLUDED_STM_COMMON_HAL_RGBMATRIX_RGBMATRIX_H +#define MICROPY_INCLUDED_STM_COMMON_HAL_RGBMATRIX_RGBMATRIX_H void *common_hal_rgbmatrix_timer_allocate(void); void common_hal_rgbmatrix_timer_enable(void*); diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 934544216458b..22b2e7f6abff0 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -28,7 +28,6 @@ #include "py/runtime.h" #include "shared-bindings/alarm/__init__.h" -#include "shared-bindings/alarm/ResetReason.h" #include "shared-bindings/alarm/pin/PinAlarm.h" #include "shared-bindings/alarm/time/DurationAlarm.h" @@ -44,42 +43,61 @@ //| //| Deep sleep shuts down power to nearly all of the chip including the CPU and RAM. This can save //| a more significant amount of power, but CircuitPython must start ``code.py`` from the beginning when woken -//| up. CircuitPython will enter deep sleep automatically when the current program exits without error -//| or calls ``sys.exit(0)``. -//| If an error causes CircuitPython to exit, error LED error flashes will be done periodically. -//| An error includes an uncaught exception, or sys.exit called with a non-zero argumetn. +//| up. If the board is not actively connected to a host computer (usually via USB), +//| CircuitPython will enter deep sleep automatically when the current program finishes its last statement +//| or calls ``sys.exit()``. +//| If the board is connected, the board will not enter deep sleep unless `supervisor.exit_and_deep_sleep()` +//| is called explicitly. +//| +//| An error includes an uncaught exception, or sys.exit() called with a non-zero argument +//| //| To set alarms for deep sleep use `alarm.restart_on_alarm()` they will apply to next deep sleep only.""" //| //| wake_alarm: Alarm //| """The most recent alarm to wake us up from a sleep (light or deep.)""" //| -//| def sleep_until_alarm(*alarms: Alarm) -> Alarm: -//| """Performs a light sleep until woken by one of the alarms. The alarm that triggers the wake +void validate_objs_are_alarms(size_t n_args, const mp_obj_t *objs) { + for (size_t i = 0; i < n_args; i++) { + if (MP_OBJ_IS_TYPE(objs[i], &alarm_pin_pin_alarm_type) || + MP_OBJ_IS_TYPE(objs[i], &alarm_time_duration_alarm_type)) { + continue; + } + mp_raise_TypeError_varg(translate("Expected an alarm")); + } +} + +//| def sleep_until_alarms(*alarms: Alarm) -> Alarm: +//| """Performs a light sleep until woken by one of the alarms. The alarm caused the wake-up //| is returned, and is also available as `alarm.wake_alarm` //| """ //| ... //| -STATIC mp_obj_t alarm_sleep_until_alarm(size_t n_args, const mp_obj_t *args) { - // TODO - common_hal_alarm_sleep_until_alarm(size_t n_args, const mp_obj_t *args); +STATIC mp_obj_t alarm_sleep_until_alarms(size_t n_args, const mp_obj_t *args) { + validate_objs_are_alarms(n_args, args); + common_hal_alarm_sleep_until_alarms(n_args, args); return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_sleep_until_alarm_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_sleep_until_alarm); +MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_sleep_until_alarms_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_sleep_until_alarms); -//| def restart_on_alarm(*alarms: Alarm) -> None: +//| def set_deep_sleep_alarms(*alarms: Alarm) -> None: //| """Set one or more alarms to wake up from a deep sleep. -//| When awakened, ``code.py`` will restart from the beginning. -//| The last alarm to wake us up is available as `alarm.wake_alarm`. +//| +//| When awakened, the microcontroller will restart and run ``boot.py`` and ``code.py`` +//| from the beginning. +//| +//| The alarm that caused the wake-up is available as `alarm.wake_alarm`. +//| +//| If you call this routine more than once, only the last set of alarms given will be used. //| """ //| ... //| -STATIC mp_obj_t alarm_restart_on_alarm(size_t n_args, const mp_obj_t *args) { - // TODO - common_hal_alarm_restart_on_alarm(size_t n_args, const mp_obj_t *args); +STATIC mp_obj_t alarm_set_deep_sleep_alarms(size_t n_args, const mp_obj_t *args) { + validate_objs_are_alarms(n_args, args); + common_hal_alarm_set_deep_sleep_alarms(n_args, args); return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_restart_on_alarm_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_restart_on_alarm); +MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_set_deep_sleep_alarms_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_set_deep_sleep_alarms); //| """The `alarm.pin` module contains alarm attributes and classes related to pins. //| """ @@ -116,11 +134,11 @@ STATIC const mp_obj_module_t alarm_time_module = { STATIC mp_map_elem_t alarm_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_alarm) }, - // wake_alarm and reset_reason are mutable attributes. + // wake_alarm is a mutable attribute. { MP_ROM_QSTR(MP_QSTR_wake_alarm), mp_const_none }, - { MP_ROM_QSTR(MP_QSTR_sleep_until_alarm), MP_OBJ_FROM_PTR(&alarm_sleep_until_alarm_obj) }, - { MP_ROM_QSTR(MP_QSTR_restart_on_alarm), MP_OBJ_FROM_PTR(&alarm_restart_on_alarm_obj) }, + { MP_ROM_QSTR(MP_QSTR_sleep_until_alarms), MP_OBJ_FROM_PTR(&alarm_sleep_until_alarms_obj) }, + { MP_ROM_QSTR(MP_QSTR_set_deep_sleep_alarms), MP_OBJ_FROM_PTR(&alarm_set_deep_sleep_alarms_obj) }, { MP_ROM_QSTR(MP_QSTR_pin), MP_OBJ_FROM_PTR(&alarm_pin_module) }, { MP_ROM_QSTR(MP_QSTR_time), MP_OBJ_FROM_PTR(&alarm_time_module) } diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h index 29be8716c58e4..4df12175d470c 100644 --- a/shared-bindings/alarm/__init__.h +++ b/shared-bindings/alarm/__init__.h @@ -29,9 +29,10 @@ #include "py/obj.h" -extern void common_hal_alarm_set_wake_alarm(mp_obj_t alarm); +extern mp_obj_t common_hal_alarm_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms); +extern mp_obj_t common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms); -extern mp_obj_t common_hal_alarm_restart_on_alarm(size_t n_alarms, const mp_obj_t *alarms); -extern mp_obj_t alarm_sleep_until_alarm(size_t n_alarms, const mp_obj_t *alarms); +// Used by wake-up code. +extern void common_hal_alarm_set_wake_alarm(mp_obj_t alarm); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM___INIT___H diff --git a/shared-bindings/alarm/pin/PinAlarm.c b/shared-bindings/alarm/pin/PinAlarm.c index 835a5be5ce888..a2d2e0ab7a78e 100644 --- a/shared-bindings/alarm/pin/PinAlarm.c +++ b/shared-bindings/alarm/pin/PinAlarm.c @@ -37,23 +37,25 @@ //| class PinAlarm: //| """Trigger an alarm when a pin changes state.""" //| -//| def __init__(self, pin: microcontroller.Pin, level: bool, *, edge: bool = False, pull: bool = False) -> None: +//| def __init__(self, *pins: microcontroller.Pin, value: bool, all_same_value: bool = False, edge: bool = False, pull: bool = False) -> None: //| """Create an alarm triggered by a `~microcontroller.Pin` level. The alarm is not active //| until it is listed in an `alarm`-enabling function, such as `alarm.sleep_until_alarm()` or //| `alarm.restart_on_alarm()`. //| -//| :param ~microcontroller.Pin pin: The pin to monitor. On some ports, the choice of pin +//| :param pins: The pins to monitor. On some ports, the choice of pins //| may be limited due to hardware restrictions, particularly for deep-sleep alarms. -//| :param bool level: When active, trigger when the level is high (``True``) or low (``False``). -//| On some ports, multiple `PinAlarm` objects may need to have coordinated levels +//| :param bool value: When active, trigger when the pin value is high (``True``) or low (``False``). +//| On some ports, multiple `PinAlarm` objects may need to have coordinated values //| for deep-sleep alarms. +//| :param bool all_same_value: If ``True``, all pins listed must be at `value` to trigger the alarm. +//| If ``False``, any one of the pins going to `value` will trigger the alarm. //| :param bool edge: If ``True``, trigger only when there is a transition to the specified -//| value of `level`. If ``True``, if the alarm becomes active when the pin level already -//| matches `level`, the alarm is not triggered: the pin must transition from ``not level`` -//| to ``level`` to trigger the alarm. On some ports, edge-triggering may not be available, +//| value of `value`. If ``True``, if the alarm becomes active when the pin value already +//| matches `value`, the alarm is not triggered: the pin must transition from ``not value`` +//| to ``value`` to trigger the alarm. On some ports, edge-triggering may not be available, //| particularly for deep-sleep alarms. -//| :param bool pull: Enable a pull-up or pull-down which pulls the pin to level opposite -//| opposite that of `level`. For instance, if `level` is set to ``True``, setting `pull` +//| :param bool pull: Enable a pull-up or pull-down which pulls the pin to value opposite +//| opposite that of `value`. For instance, if `value` is set to ``True``, setting `pull` //| to ``True`` will enable a pull-down, to hold the pin low normally until an outside signal //| pulls it high. //| """ @@ -62,51 +64,30 @@ STATIC mp_obj_t alarm_pin_pin_alarm_make_new(const mp_obj_type_t *type, mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { alarm_pin_pin_alarm_obj_t *self = m_new_obj(alarm_pin_pin_alarm_obj_t); self->base.type = &alarm_pin_pin_alarm_type; - enum { ARG_pin, ARG_level, ARG_edge, ARG_pull }; + enum { ARG_value, ARG_all_same_value, ARG_edge, ARG_pull }; static const mp_arg_t allowed_args[] = { - { MP_QSTR_pin, MP_ARG_REQUIRED | MP_ARG_OBJ }, - { MP_QSTR_level, MP_ARG_REQUIRED | MP_ARG_BOOL }, + { MP_QSTR_value, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_BOOL }, + { MP_QSTR_all_same_value, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, { MP_QSTR_edge, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, { MP_QSTR_pull, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + mp_arg_parse_all(0, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - const mcu_pin_obj_t* pin = validate_obj_is_free_pin(args[ARG_pin].u_obj); + for (size_t i = 0; i < n_args; i ++) { + validate_obj_is_free_pin(pos_args[i]); + } common_hal_alarm_pin_pin_alarm_construct( - self, pin, args[ARG_level].u_bool, args[ARG_edge].u_bool, args[ARG_pull].u_bool); + self, pos_args, n_args, + args[ARG_value].u_bool, + args[ARG_all_same_value].u_bool, + args[ARG_edge].u_bool, + args[ARG_pull].u_bool); return MP_OBJ_FROM_PTR(self); } -//| def __eq__(self, other: object) -> bool: -//| """Two PinAlarm objects are equal if their durations are the same if their pin, -//| level, edge, and pull attributes are all the same.""" -//| ... -//| -STATIC mp_obj_t alarm_pin_pin_alarm_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) { - switch (op) { - case MP_BINARY_OP_EQUAL: - if (MP_OBJ_IS_TYPE(rhs_in, &alarm_pin_pin_alarm_type)) { - // Pins are singletons, so we can compare them directly. - return mp_obj_new_bool( - common_hal_alarm_pin_pin_alarm_get_pin(lhs_in) == - common_hal_alarm_pin_pin_alarm_get_pin(rhs_in) && - common_hal_alarm_pin_pin_alarm_get_level(lhs_in) == - common_hal_alarm_pin_pin_alarm_get_level(rhs_in) && - common_hal_alarm_pin_pin_alarm_get_edge(lhs_in) == - common_hal_alarm_pin_pin_alarm_get_edge(rhs_in) && - common_hal_alarm_pin_pin_alarm_get_pull(lhs_in) == - common_hal_alarm_pin_pin_alarm_get_pull(rhs_in)); - } - return mp_const_false; - - default: - return MP_OBJ_NULL; // op not supported - } -} - STATIC const mp_rom_map_elem_t alarm_pin_pin_alarm_locals_dict_table[] = { }; @@ -116,6 +97,5 @@ const mp_obj_type_t alarm_pin_pin_alarm_type = { { &mp_type_type }, .name = MP_QSTR_PinAlarm, .make_new = alarm_pin_pin_alarm_make_new, - .binary_op = alarm_pin_pin_alarm_binary_op, .locals_dict = (mp_obj_t)&alarm_pin_pin_alarm_locals_dict, }; diff --git a/shared-bindings/alarm/pin/PinAlarm.h b/shared-bindings/alarm/pin/PinAlarm.h index 978ceaad56d69..bbf3018b5d807 100644 --- a/shared-bindings/alarm/pin/PinAlarm.h +++ b/shared-bindings/alarm/pin/PinAlarm.h @@ -28,13 +28,14 @@ #define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_PIN_PIN_ALARM_H #include "py/obj.h" +#include "py/objtuple.h" #include "common-hal/microcontroller/Pin.h" #include "common-hal/alarm/pin/PinAlarm.h" extern const mp_obj_type_t alarm_pin_pin_alarm_type; -extern void common_hal_alarm_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, const mcu_pin_obj_t *pin, bool level, bool edge, bool pull); -extern const mcu_pin_obj_t *common_hal_alarm_pin_pin_alarm_get_pin(alarm_pin_pin_alarm_obj_t *self); +void common_hal_alarm_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, const mp_obj_t pins[], size_t num_pins, bool value, bool all_same_value, bool edge, bool pull); +extern const mp_obj_tuple_t *common_hal_alarm_pin_pin_alarm_get_pins(alarm_pin_pin_alarm_obj_t *self); extern bool common_hal_alarm_pin_pin_alarm_get_level(alarm_pin_pin_alarm_obj_t *self); extern bool common_hal_alarm_pin_pin_alarm_get_edge(alarm_pin_pin_alarm_obj_t *self); extern bool common_hal_alarm_pin_pin_alarm_get_pull(alarm_pin_pin_alarm_obj_t *self); diff --git a/shared-bindings/audiopwmio/__init__.h b/shared-bindings/audiopwmio/__init__.h index e4b7067d118e2..d7956d31e6b44 100644 --- a/shared-bindings/audiopwmio/__init__.h +++ b/shared-bindings/audiopwmio/__init__.h @@ -24,11 +24,11 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_AUDIOIO___INIT___H -#define MICROPY_INCLUDED_SHARED_BINDINGS_AUDIOIO___INIT___H +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_AUDIOPWMIO___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_AUDIOPWMIO___INIT___H #include "py/obj.h" // Nothing now. -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_AUDIOIO___INIT___H +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_AUDIOPWMIO___INIT___H diff --git a/shared-bindings/microcontroller/Processor.c b/shared-bindings/microcontroller/Processor.c index b0ab842f4c24b..ea43688213213 100644 --- a/shared-bindings/microcontroller/Processor.c +++ b/shared-bindings/microcontroller/Processor.c @@ -76,9 +76,9 @@ STATIC mp_obj_t mcu_processor_get_reset_reason(mp_obj_t self) { MP_DEFINE_CONST_FUN_OBJ_1(mcu_processor_get_reset_reason_obj, mcu_processor_get_reset_reason); -const mp_obj_property_t mcu_reset_reason_obj = { +const mp_obj_property_t mcu_processor_reset_reason_obj = { .base.type = &mp_type_property, - .proxy = {(mp_obj_t)&mcu_processor_get_reason_reason_obj, // getter + .proxy = {(mp_obj_t)&mcu_processor_get_reset_reason_obj, // getter (mp_obj_t)&mp_const_none_obj, // no setter (mp_obj_t)&mp_const_none_obj, // no deleter }, diff --git a/shared-bindings/microcontroller/Processor.h b/shared-bindings/microcontroller/Processor.h index a842e06f323b7..98d4790876d91 100644 --- a/shared-bindings/microcontroller/Processor.h +++ b/shared-bindings/microcontroller/Processor.h @@ -29,6 +29,7 @@ #include "py/obj.h" +#include "common-hal/microcontroller/Processor.h" #include "shared-bindings/microcontroller/ResetReason.h" extern const mp_obj_type_t mcu_processor_type; diff --git a/shared-bindings/microcontroller/ResetReason.c b/shared-bindings/microcontroller/ResetReason.c index 151fcf315955e..61891934ae516 100644 --- a/shared-bindings/microcontroller/ResetReason.c +++ b/shared-bindings/microcontroller/ResetReason.c @@ -35,6 +35,7 @@ MAKE_ENUM_VALUE(mcu_reset_reason_type, reset_reason, SOFTWARE, RESET_REASON_SOFT MAKE_ENUM_VALUE(mcu_reset_reason_type, reset_reason, DEEP_SLEEP_ALARM, RESET_REASON_DEEP_SLEEP_ALARM); MAKE_ENUM_VALUE(mcu_reset_reason_type, reset_reason, RESET_PIN, RESET_REASON_RESET_PIN); MAKE_ENUM_VALUE(mcu_reset_reason_type, reset_reason, WATCHDOG, RESET_REASON_WATCHDOG); +MAKE_ENUM_VALUE(mcu_reset_reason_type, reset_reason, UNKNOWN, RESET_REASON_UNKNOWN); //| class ResetReason: //| """The reason the microntroller was last reset""" @@ -55,7 +56,10 @@ MAKE_ENUM_VALUE(mcu_reset_reason_type, reset_reason, WATCHDOG, RESET_REASON_WATC //| """The microntroller was reset by a signal on its reset pin. The pin might be connected to a reset button.""" //| //| WATCHDOG: object -//| """The chip microcontroller reset by its watchdog timer.""" +//| """The microcontroller was reset by its watchdog timer.""" +//| +//| UNKNOWN: object +//| """The microntroller restarted for an unknown reason.""" //| MAKE_ENUM_MAP(mcu_reset_reason) { MAKE_ENUM_MAP_ENTRY(reset_reason, POWER_ON), @@ -64,6 +68,7 @@ MAKE_ENUM_MAP(mcu_reset_reason) { MAKE_ENUM_MAP_ENTRY(reset_reason, DEEP_SLEEP_ALARM), MAKE_ENUM_MAP_ENTRY(reset_reason, RESET_PIN), MAKE_ENUM_MAP_ENTRY(reset_reason, WATCHDOG), + MAKE_ENUM_MAP_ENTRY(reset_reason, UNKNOWN), }; STATIC MP_DEFINE_CONST_DICT(mcu_reset_reason_locals_dict, mcu_reset_reason_locals_table); diff --git a/shared-bindings/microcontroller/ResetReason.h b/shared-bindings/microcontroller/ResetReason.h index df1abf266e449..8ed5e4831596d 100644 --- a/shared-bindings/microcontroller/ResetReason.h +++ b/shared-bindings/microcontroller/ResetReason.h @@ -24,8 +24,8 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_MCU__RESET_REASON__H -#define MICROPY_INCLUDED_SHARED_BINDINGS_MCU__RESET_REASON__H +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_MCU_RESET_REASON__H +#define MICROPY_INCLUDED_SHARED_BINDINGS_MCU_RESET_REASON__H #include "py/obj.h" #include "py/enum.h" @@ -37,15 +37,9 @@ typedef enum { RESET_REASON_DEEP_SLEEP_ALARM, RESET_REASON_RESET_PIN, RESET_REASON_WATCHDOG, + RESET_REASON_UNKNOWN, } mcu_reset_reason_t; -extern const cp_enum_obj_t reset_reason_POWER_ON_obj; -extern const cp_enum_obj_t reset_reason_BROWNOUT_obj; -extern const cp_enum_obj_t reset_reason_SOFTWARE_obj; -extern const cp_enum_obj_t reset_reason_DEEP_SLEEP_ALARM_obj; -extern const cp_enum_obj_t reset_reason_RESET_PIN_obj; -extern const cp_enum_obj_t reset_reason_WATCHDOG_obj; - extern const mp_obj_type_t mcu_reset_reason_type; -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_MCU__RESET_REASON__H +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_MCU_RESET_REASON__H diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index d09cf8f445fcc..d6ce323c58992 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -56,6 +56,19 @@ //| This object is the sole instance of `microcontroller.Processor`.""" //| +//| def deep_sleep() -> None: +//| Go into deep sleep. If the board is connected via USB, disconnect USB first. +//| +//| The board will awake from deep sleep only if the reset button is pressed +//| or it is awoken by an alarm set by `alarm.set_deep_sleep_alarms()`. +//| ... +//| +STATIC mp_obj_t mcu_deep_sleep(void){ + + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_0(mcu_deep_sleep_obj, mcu_deep_sleep); + //| def delay_us(delay: int) -> None: //| """Dedicated delay method used for very short delays. **Do not** do long delays //| because this stops all other functions from completing. Think of this as an empty @@ -164,6 +177,7 @@ const mp_obj_module_t mcu_pin_module = { STATIC const mp_rom_map_elem_t mcu_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_microcontroller) }, { MP_ROM_QSTR(MP_QSTR_cpu), MP_ROM_PTR(&common_hal_mcu_processor_obj) }, + { MP_ROM_QSTR(MP_QSTR_deep_sleep), MP_ROM_PTR(&mcu_deep_sleep_obj) }, { MP_ROM_QSTR(MP_QSTR_delay_us), MP_ROM_PTR(&mcu_delay_us_obj) }, { MP_ROM_QSTR(MP_QSTR_disable_interrupts), MP_ROM_PTR(&mcu_disable_interrupts_obj) }, { MP_ROM_QSTR(MP_QSTR_enable_interrupts), MP_ROM_PTR(&mcu_enable_interrupts_obj) }, diff --git a/shared-bindings/microcontroller/__init__.h b/shared-bindings/microcontroller/__init__.h index ac71de4247f2a..c6ccccea727f5 100644 --- a/shared-bindings/microcontroller/__init__.h +++ b/shared-bindings/microcontroller/__init__.h @@ -43,6 +43,8 @@ extern void common_hal_mcu_enable_interrupts(void); extern void common_hal_mcu_on_next_reset(mcu_runmode_t runmode); extern void common_hal_mcu_reset(void); +extern void common_hal_mcu_deep_sleep(void); + extern const mp_obj_dict_t mcu_pin_globals; extern const mcu_processor_obj_t common_hal_mcu_processor_obj; diff --git a/shared-bindings/supervisor/RunReason.c b/shared-bindings/supervisor/RunReason.c index ee08f6d71b591..7e7a74d2f4460 100644 --- a/shared-bindings/supervisor/RunReason.c +++ b/shared-bindings/supervisor/RunReason.c @@ -29,7 +29,7 @@ #include "shared-bindings/supervisor/RunReason.h" MAKE_ENUM_VALUE(supervisor_run_reason_type, run_reason, STARTUP, RUN_REASON_STARTUP); -MAKE_ENUM_VALUE(supervisor_run_reason_type, run_reason, AUTORELOAD, RUN_REASON_AUTORELOAD); +MAKE_ENUM_VALUE(supervisor_run_reason_type, run_reason, AUTORELOAD, RUN_REASON_AUTO_RELOAD); MAKE_ENUM_VALUE(supervisor_run_reason_type, run_reason, SUPERVISOR_RELOAD, RUN_REASON_SUPERVISOR_RELOAD); MAKE_ENUM_VALUE(supervisor_run_reason_type, run_reason, REPL_RELOAD, RUN_REASON_REPL_RELOAD); @@ -40,8 +40,8 @@ MAKE_ENUM_VALUE(supervisor_run_reason_type, run_reason, REPL_RELOAD, RUN_REASON_ //| """CircuitPython started the microcontroller started up. See `microcontroller.cpu.reset_reason` //| for more detail on why the microcontroller was started.""" //| -//| AUTORELOAD: object -//| """CircuitPython restarted due to a USB write to the filesystem.""" +//| AUTO_RELOAD: object +//| """CircuitPython restarted due to an external write to the filesystem.""" //| //| SUPERVISOR_RELOAD: object //| """CircuitPython restarted due to a call to `supervisor.reload()`.""" @@ -51,7 +51,7 @@ MAKE_ENUM_VALUE(supervisor_run_reason_type, run_reason, REPL_RELOAD, RUN_REASON_ //| MAKE_ENUM_MAP(run_reason) { MAKE_ENUM_MAP_ENTRY(run_reason, STARTUP), - MAKE_ENUM_MAP_ENTRY(run_reason, AUTORELOAD), + MAKE_ENUM_MAP_ENTRY(run_reason, AUTO_RELOAD), MAKE_ENUM_MAP_ENTRY(run_reason, SUPERVISOR_RELOAD), MAKE_ENUM_MAP_ENTRY(run_reason, REPL_RELOAD), }; diff --git a/shared-bindings/supervisor/RunReason.h b/shared-bindings/supervisor/RunReason.h index 934c72fd8cfc0..391e6d3064759 100644 --- a/shared-bindings/supervisor/RunReason.h +++ b/shared-bindings/supervisor/RunReason.h @@ -28,7 +28,7 @@ typedef enum { RUN_REASON_STARTUP, - RUN_REASON_AUTORELOAD, + RUN_REASON_AUTO_RELOAD, RUN_REASON_SUPERVISOR_RELOAD, RUN_REASON_REPL_RELOAD, } supervisor_run_reason_t; diff --git a/shared-bindings/supervisor/Runtime.c b/shared-bindings/supervisor/Runtime.c index 6500dadd59947..67193e051ed1c 100755 --- a/shared-bindings/supervisor/Runtime.c +++ b/shared-bindings/supervisor/Runtime.c @@ -25,9 +25,13 @@ */ #include +#include "py/enum.h" #include "py/objproperty.h" +#include "shared-bindings/supervisor/RunReason.h" #include "shared-bindings/supervisor/Runtime.h" +STATIC supervisor_run_reason_t _run_reason; + //TODO: add USB, REPL to description once they're operational //| class Runtime: //| """Current status of runtime objects. @@ -94,8 +98,7 @@ const mp_obj_property_t supervisor_serial_bytes_available_obj = { //| """Returns why CircuitPython started running this particular time. //| STATIC mp_obj_t supervisor_get_run_reason(mp_obj_t self) { - mp_raise_NotImplementedError(NULL); - return mp_const_none; + return cp_enum_find(&supervisor_run_reason_type, _run_reason); } MP_DEFINE_CONST_FUN_OBJ_1(supervisor_get_run_reason_obj, supervisor_get_run_reason); @@ -106,6 +109,9 @@ const mp_obj_property_t supervisor_run_reason_obj = { (mp_obj_t)&mp_const_none_obj}, }; +void supervisor_set_run_reason(supervisor_run_reason_t run_reason) { + _run_reason = run_reason; +} STATIC const mp_rom_map_elem_t supervisor_runtime_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_serial_connected), MP_ROM_PTR(&supervisor_serial_connected_obj) }, diff --git a/shared-bindings/supervisor/Runtime.h b/shared-bindings/supervisor/Runtime.h index 2dc59c3ab6a43..51ed7604df7b8 100755 --- a/shared-bindings/supervisor/Runtime.h +++ b/shared-bindings/supervisor/Runtime.h @@ -30,9 +30,12 @@ #include #include "py/obj.h" +#include "shared-bindings/supervisor/RunReason.h" extern const mp_obj_type_t supervisor_runtime_type; +void supervisor_set_run_reason(supervisor_run_reason_t run_reason); + bool common_hal_get_serial_connected(void); bool common_hal_get_serial_bytes_available(void); diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c index bc6fdbff5a1d2..4d2d6db3093ba 100644 --- a/shared-bindings/supervisor/__init__.c +++ b/shared-bindings/supervisor/__init__.c @@ -88,6 +88,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(supervisor_set_rgb_status_brightness_obj, supervisor_s //| STATIC mp_obj_t supervisor_reload(void) { reload_requested = true; + supervisor_set_run_reason(RUN_REASON_SUPERVISOR_RELOAD); mp_raise_reload_exception(); return mp_const_none; } diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c index 3d76e7000ac75..ff08ade18a1ce 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -106,25 +106,21 @@ void usb_irq_handler(void) { // Invoked when device is mounted void tud_mount_cb(void) { usb_msc_mount(); - _workflow_active = true; } // Invoked when device is unmounted void tud_umount_cb(void) { usb_msc_umount(); - _workflow_active = false; } // Invoked when usb bus is suspended // remote_wakeup_en : if host allows us to perform remote wakeup // USB Specs: Within 7ms, device must draw an average current less than 2.5 mA from bus void tud_suspend_cb(bool remote_wakeup_en) { - _workflow_active = false; } // Invoked when usb bus is resumed void tud_resume_cb(void) { - _workflow_active = true; } // Invoked when cdc when line state changed e.g connected/disconnected diff --git a/supervisor/shared/workflow.c b/supervisor/shared/workflow.c index cd19d3aa25f4e..41af22eb70626 100644 --- a/supervisor/shared/workflow.c +++ b/supervisor/shared/workflow.c @@ -25,10 +25,10 @@ */ #include - -// Set by the shared USB code. -volatile bool _workflow_active; +#include "tusb.h" bool supervisor_workflow_active(void) { - return _workflow_active; + // Eventually there might be other non-USB workflows, such as BLE. + // tud_ready() checks for usb mounted and not suspended. + return tud_ready(); } From 661c20dd180343a3a5c7a52e63875888218422ba Mon Sep 17 00:00:00 2001 From: jgillick Date: Sun, 22 Nov 2020 18:25:37 -0800 Subject: [PATCH 256/770] Create a new linker script with more space for the firmware. --- ports/stm/boards/STM32F411_nvm_flash.ld | 29 +++++++++++++++++++ .../boards/thunderpack_v12/mpconfigboard.h | 12 ++++---- .../boards/thunderpack_v12/mpconfigboard.mk | 2 +- ports/stm/supervisor/internal_flash.h | 4 +++ 4 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 ports/stm/boards/STM32F411_nvm_flash.ld diff --git a/ports/stm/boards/STM32F411_nvm_flash.ld b/ports/stm/boards/STM32F411_nvm_flash.ld new file mode 100644 index 0000000000000..ced739765d686 --- /dev/null +++ b/ports/stm/boards/STM32F411_nvm_flash.ld @@ -0,0 +1,29 @@ +/* + GNU linker script for STM32F411 with nvm and an external flash chip, and reserves + more space for the CircuitPython firmware and less for the filesystem + (since the filesystem will be on the external flash chip). +*/ + +/* Specify the memory areas */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K /* entire flash */ + FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */ + FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 32K /* sectors 1,2 are 16K */ + FLASH_NVM (rwx) : ORIGIN = 0x0800C000, LENGTH = 16K /* sector 3 is 16K */ + FLASH_FIRMWARE (rx) : ORIGIN = 0x08010000, LENGTH = 448K /* sector 4 is 64K, sectors 5,6,7 are 128K */ + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K +} + +/* produce a link error if there is not this amount of RAM for these sections */ +_minimum_stack_size = 24K; +_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); diff --git a/ports/stm/boards/thunderpack_v12/mpconfigboard.h b/ports/stm/boards/thunderpack_v12/mpconfigboard.h index 426e0678da2da..773ca297e500c 100644 --- a/ports/stm/boards/thunderpack_v12/mpconfigboard.h +++ b/ports/stm/boards/thunderpack_v12/mpconfigboard.h @@ -28,14 +28,16 @@ // Non-volatile memory config #define CIRCUITPY_INTERNAL_NVM_SIZE (0x4000) -#define CIRCUITPY_INTERNAL_NVM_START_ADDR (0x08010000) -#define CIRCUITPY_INTERNAL_NVM_SECTOR FLASH_SECTOR_4 +#define CIRCUITPY_INTERNAL_NVM_START_ADDR (0x0800C000) +#define CIRCUITPY_INTERNAL_NVM_SECTOR FLASH_SECTOR_3 #define NVM_BYTEARRAY_BUFFER_SIZE 512 // Flash config -#define FLASH_SIZE (0x80000) -#define FLASH_PAGE_SIZE (0x4000) -#define BOARD_FLASH_SIZE (FLASH_SIZE - CIRCUITPY_INTERNAL_NVM_SIZE- 0x2000 - 0xC000) +#define FLASH_SIZE (0x80000) +#define FLASH_PAGE_SIZE (0x4000) +#define BOARD_FLASH_SIZE (FLASH_SIZE - CIRCUITPY_INTERNAL_NVM_SIZE- 0x2000 - 0xC000) +#define INTERNAL_FLASH_FILESYSTEM_SIZE 0x8000 +#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08004000 // On-board flash #define SPI_FLASH_MOSI_PIN (&pin_PB15) diff --git a/ports/stm/boards/thunderpack_v12/mpconfigboard.mk b/ports/stm/boards/thunderpack_v12/mpconfigboard.mk index 7bfe2736730c9..744565e69bbdd 100644 --- a/ports/stm/boards/thunderpack_v12/mpconfigboard.mk +++ b/ports/stm/boards/thunderpack_v12/mpconfigboard.mk @@ -17,4 +17,4 @@ MCU_VARIANT = STM32F411xE MCU_PACKAGE = UFQFPN48 LD_COMMON = boards/common_nvm.ld -LD_FILE = boards/STM32F411_nvm.ld +LD_FILE = boards/STM32F411_nvm_flash.ld diff --git a/ports/stm/supervisor/internal_flash.h b/ports/stm/supervisor/internal_flash.h index ad5cba62d8fc3..5746deac84164 100644 --- a/ports/stm/supervisor/internal_flash.h +++ b/ports/stm/supervisor/internal_flash.h @@ -41,9 +41,13 @@ #ifdef STM32F411xE #define STM32_FLASH_SIZE 0x80000 //512KiB +#ifndef INTERNAL_FLASH_FILESYSTEM_SIZE #define INTERNAL_FLASH_FILESYSTEM_SIZE 0xC000 //48KiB +#endif +#ifndef INTERNAL_FLASH_FILESYSTEM_START_ADDR #define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08004000 #endif +#endif #ifdef STM32F412Zx #define STM32_FLASH_SIZE 0x100000 //1MB From 3abee9b2563f0203f3d9521631499008708bb407 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sun, 22 Nov 2020 21:52:37 -0500 Subject: [PATCH 257/770] compiles; maybe ready to test, or almost --- ports/esp32s2/common-hal/alarm/__init__.c | 8 +++-- ports/esp32s2/common-hal/alarm/__init__.h | 32 +++++++++++++++++++ .../common-hal/microcontroller/__init__.c | 1 + shared-bindings/alarm/__init__.h | 2 +- 4 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 ports/esp32s2/common-hal/alarm/__init__.h diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index 4a255c51cc840..0ea476d860e05 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -26,17 +26,19 @@ */ #include "py/objtuple.h" +#include "py/runtime.h" #include "shared-bindings/alarm/__init__.h" #include "shared-bindings/alarm/pin/PinAlarm.h" #include "shared-bindings/alarm/time/DurationAlarm.h" +#include "shared-bindings/microcontroller/__init__.h" #include "esp_sleep.h" STATIC mp_obj_tuple_t *_deep_sleep_alarms; void alarm_reset(void) { - _deep_sleep_alarms = &mp_const_empty_tuple; + _deep_sleep_alarms = mp_const_empty_tuple; } void common_hal_alarm_disable_all(void) { @@ -94,8 +96,8 @@ void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *ala } void common_hal_deep_sleep_with_alarms(void) { - for (size_t i = 0; i < _deep_sleep_alarms.len; i++) { - mp_obj_t alarm = _deep_sleep_alarms.items[i] + for (size_t i = 0; i < _deep_sleep_alarms->len; i++) { + mp_obj_t alarm = _deep_sleep_alarms->items[i]; if (MP_OBJ_IS_TYPE(alarm, &alarm_time_duration_alarm_type)) { alarm_time_duration_alarm_obj_t *duration_alarm = MP_OBJ_TO_PTR(alarm); esp_sleep_enable_timer_wakeup( diff --git a/ports/esp32s2/common-hal/alarm/__init__.h b/ports/esp32s2/common-hal/alarm/__init__.h new file mode 100644 index 0000000000000..5678a0e7f1e9d --- /dev/null +++ b/ports/esp32s2/common-hal/alarm/__init__.h @@ -0,0 +1,32 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Dan Halbert for Adafruit Industries. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ALARM__INIT__H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ALARM__INIT__H + +void alarm_reset(void); + +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ALARM__INIT__H diff --git a/ports/esp32s2/common-hal/microcontroller/__init__.c b/ports/esp32s2/common-hal/microcontroller/__init__.c index 9d87e4536f0d9..59eb1afcc0737 100644 --- a/ports/esp32s2/common-hal/microcontroller/__init__.c +++ b/ports/esp32s2/common-hal/microcontroller/__init__.c @@ -42,6 +42,7 @@ #include "freertos/FreeRTOS.h" #include "esp_sleep.h" +#include "esp_wifi.h" void common_hal_mcu_delay_us(uint32_t delay) { mp_hal_delay_us(delay); diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h index 4df12175d470c..c74dfbe5c3c0b 100644 --- a/shared-bindings/alarm/__init__.h +++ b/shared-bindings/alarm/__init__.h @@ -30,7 +30,7 @@ #include "py/obj.h" extern mp_obj_t common_hal_alarm_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms); -extern mp_obj_t common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms); +extern void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms); // Used by wake-up code. extern void common_hal_alarm_set_wake_alarm(mp_obj_t alarm); From 5351a93c70fcacc50a154edac0a6d6d1028296e0 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 23 Nov 2020 13:39:14 +0700 Subject: [PATCH 258/770] update tinyusb to fix cdc connection race issue is fixed in https://github.com/hathach/tinyusb/pull/557 --- lib/tinyusb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tinyusb b/lib/tinyusb index 8b2c822557504..b870d932e5e1c 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit 8b2c82255750488232eae72f3d5dcbacfd6227f3 +Subproject commit b870d932e5e1c6ece4227a5d49cc71e53a744149 From 4c5e7520f5950f831ea18866f49645c507d0f811 Mon Sep 17 00:00:00 2001 From: jgillick Date: Mon, 23 Nov 2020 00:25:41 -0800 Subject: [PATCH 259/770] Fix NVM by clearing FLASH_FLAG_PGPERR --- .../boards/thunderpack_v11/mpconfigboard.h | 2 +- .../boards/thunderpack_v12/mpconfigboard.h | 26 +++++++++---------- .../boards/thunderpack_v12/mpconfigboard.mk | 1 + ports/stm/common-hal/microcontroller/Pin.c | 15 ++++++----- ports/stm/common-hal/nvm/ByteArray.c | 2 +- ports/stm/supervisor/internal_flash.h | 4 +-- 6 files changed, 26 insertions(+), 24 deletions(-) diff --git a/ports/stm/boards/thunderpack_v11/mpconfigboard.h b/ports/stm/boards/thunderpack_v11/mpconfigboard.h index c2649e255584a..7d4a8dff32966 100644 --- a/ports/stm/boards/thunderpack_v11/mpconfigboard.h +++ b/ports/stm/boards/thunderpack_v11/mpconfigboard.h @@ -23,7 +23,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#define MICROPY_HW_BOARD_NAME "THUNDERPACK" +#define MICROPY_HW_BOARD_NAME "THUNDERPACK_v11" #define MICROPY_HW_MCU_NAME "STM32F411CE" // Non-volatile memory config diff --git a/ports/stm/boards/thunderpack_v12/mpconfigboard.h b/ports/stm/boards/thunderpack_v12/mpconfigboard.h index 773ca297e500c..57486da280765 100644 --- a/ports/stm/boards/thunderpack_v12/mpconfigboard.h +++ b/ports/stm/boards/thunderpack_v12/mpconfigboard.h @@ -27,17 +27,16 @@ #define MICROPY_HW_MCU_NAME "STM32F411CE" // Non-volatile memory config -#define CIRCUITPY_INTERNAL_NVM_SIZE (0x4000) -#define CIRCUITPY_INTERNAL_NVM_START_ADDR (0x0800C000) -#define CIRCUITPY_INTERNAL_NVM_SECTOR FLASH_SECTOR_3 -#define NVM_BYTEARRAY_BUFFER_SIZE 512 +#define CIRCUITPY_INTERNAL_NVM_SIZE (0x4000) +#define CIRCUITPY_INTERNAL_NVM_START_ADDR (0x0800C000) +#define CIRCUITPY_INTERNAL_NVM_SECTOR FLASH_SECTOR_3 +#define NVM_BYTEARRAY_BUFFER_SIZE 512 // Flash config -#define FLASH_SIZE (0x80000) -#define FLASH_PAGE_SIZE (0x4000) -#define BOARD_FLASH_SIZE (FLASH_SIZE - CIRCUITPY_INTERNAL_NVM_SIZE- 0x2000 - 0xC000) +#define FLASH_SIZE (0x80000) +#define FLASH_PAGE_SIZE (0x4000) +#define BOARD_FLASH_SIZE (FLASH_SIZE - CIRCUITPY_INTERNAL_NVM_SIZE- 0x2000 - 0xC000) #define INTERNAL_FLASH_FILESYSTEM_SIZE 0x8000 -#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08004000 // On-board flash #define SPI_FLASH_MOSI_PIN (&pin_PB15) @@ -45,15 +44,14 @@ #define SPI_FLASH_SCK_PIN (&pin_PB13) #define SPI_FLASH_CS_PIN (&pin_PB12) +#define HSE_VALUE ((uint32_t)24000000U) +#define BOARD_OVERWRITE_SWD (1) +#define BOARD_NO_VBUS_SENSE (1) +#define BOARD_HAS_LOW_SPEED_CRYSTAL (0) + // Status LEDs #define MICROPY_HW_APA102_MOSI (&pin_PB08) #define MICROPY_HW_APA102_SCK (&pin_PB00) - // I2C #define DEFAULT_I2C_BUS_SCL (&pin_PB06) #define DEFAULT_I2C_BUS_SDA (&pin_PB07) - -// General config -#define BOARD_OSC_DIV (24) -#define BOARD_OVERWRITE_SWD (1) -#define BOARD_NO_VBUS_SENSE (1) diff --git a/ports/stm/boards/thunderpack_v12/mpconfigboard.mk b/ports/stm/boards/thunderpack_v12/mpconfigboard.mk index 744565e69bbdd..d0bc22680f978 100644 --- a/ports/stm/boards/thunderpack_v12/mpconfigboard.mk +++ b/ports/stm/boards/thunderpack_v12/mpconfigboard.mk @@ -11,6 +11,7 @@ EXTERNAL_FLASH_DEVICE_COUNT = 1 EXTERNAL_FLASH_DEVICES = GD25Q16C CIRCUITPY_NVM = 1 +CIRCUITPY_BLEIO_HCI = 0 MCU_SERIES = F4 MCU_VARIANT = STM32F411xE diff --git a/ports/stm/common-hal/microcontroller/Pin.c b/ports/stm/common-hal/microcontroller/Pin.c index 7d259e0521c28..0e333c71cff3c 100644 --- a/ports/stm/common-hal/microcontroller/Pin.c +++ b/ports/stm/common-hal/microcontroller/Pin.c @@ -35,7 +35,7 @@ #ifdef MICROPY_HW_NEOPIXEL bool neopixel_in_use; #endif -#ifdef MICROPY_HW_APA102_MOSI +#if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) bool apa102_sck_in_use; bool apa102_mosi_in_use; #endif @@ -70,7 +70,7 @@ void reset_all_pins(void) { #ifdef MICROPY_HW_NEOPIXEL neopixel_in_use = false; #endif - #ifdef MICROPY_HW_APA102_MOSI + #if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) apa102_sck_in_use = false; apa102_mosi_in_use = false; #endif @@ -97,8 +97,11 @@ void reset_pin_number(uint8_t pin_port, uint8_t pin_number) { return; } #endif - #ifdef MICROPY_HW_APA102_MOSI - if ((pin_port == MICROPY_HW_APA102_MOSI->port && pin_number == MICROPY_HW_APA102_MOSI->number) || (pin_port == MICROPY_HW_APA102_SCK->port && pin_number == MICROPY_HW_APA102_MOSI->number)) + #if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) + if ( + (pin_port == MICROPY_HW_APA102_MOSI->port && pin_number == MICROPY_HW_APA102_MOSI->number) + || (pin_port == MICROPY_HW_APA102_SCK->port && pin_number == MICROPY_HW_APA102_MOSI->number) + ) { apa102_mosi_in_use = false; apa102_sck_in_use = false; @@ -140,7 +143,7 @@ bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) { return !neopixel_in_use; } #endif - #ifdef MICROPY_HW_APA102_MOSI + #if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) if (pin == MICROPY_HW_APA102_MOSI) { return !apa102_mosi_in_use; @@ -173,7 +176,7 @@ void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin) { neopixel_in_use = true; } #endif - #ifdef MICROPY_HW_APA102_MOSI + #if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) if (pin == MICROPY_HW_APA102_MOSI) { apa102_mosi_in_use = true; diff --git a/ports/stm/common-hal/nvm/ByteArray.c b/ports/stm/common-hal/nvm/ByteArray.c index 462d3aa9de255..b7a1ff0351e19 100644 --- a/ports/stm/common-hal/nvm/ByteArray.c +++ b/ports/stm/common-hal/nvm/ByteArray.c @@ -48,7 +48,7 @@ bool common_hal_nvm_bytearray_set_bytes(nvm_bytearray_obj_t *self, // Erase flash sector HAL_FLASH_Unlock(); - __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGSERR ); + __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR ); FLASH_Erase_Sector(CIRCUITPY_INTERNAL_NVM_SECTOR, VOLTAGE_RANGE_3); // Write bytes to flash diff --git a/ports/stm/supervisor/internal_flash.h b/ports/stm/supervisor/internal_flash.h index 5746deac84164..19ae03e0b3dd0 100644 --- a/ports/stm/supervisor/internal_flash.h +++ b/ports/stm/supervisor/internal_flash.h @@ -42,10 +42,10 @@ #ifdef STM32F411xE #define STM32_FLASH_SIZE 0x80000 //512KiB #ifndef INTERNAL_FLASH_FILESYSTEM_SIZE -#define INTERNAL_FLASH_FILESYSTEM_SIZE 0xC000 //48KiB + #define INTERNAL_FLASH_FILESYSTEM_SIZE 0xC000 //48KiB #endif #ifndef INTERNAL_FLASH_FILESYSTEM_START_ADDR -#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08004000 + #define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08004000 #endif #endif From 9d8be648eec70c36b3a461c4ff45064357d11693 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 15 Nov 2020 11:48:53 -0600 Subject: [PATCH 260/770] ulab: Update to release tag 1.1.0 Disable certain classes of diagnostic when building ulab. We should submit patches upstream to (A) fix these errors and (B) upgrade their CI so that the problems are caught before we want to integrate with CircuitPython, but not right now. --- extmod/ulab | 2 +- locale/circuitpython.pot | 147 +++++++++++++++++++++++++++------------ py/py.mk | 2 +- 3 files changed, 106 insertions(+), 45 deletions(-) diff --git a/extmod/ulab b/extmod/ulab index 8242b84753355..aa7e741530df4 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit 8242b84753355433b61230ab6631c06e5ac77f35 +Subproject commit aa7e741530df471d206a4a321823a37a913a0eb8 diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index ec232615d13e5..c184d693134c1 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-11-10 15:30+0530\n" +"POT-Creation-Date: 2020-11-23 10:10-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -855,6 +855,10 @@ msgstr "" msgid "FFT is defined for ndarrays only" msgstr "" +#: extmod/ulab/code/fft/fft.c +msgid "FFT is implemented for linear arrays only" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" msgstr "" @@ -1951,7 +1955,7 @@ msgstr "" msgid "WARNING: Your code filename has two extensions\n" msgstr "" -#: shared-bindings/watchdog/WatchDogTimer.c +#: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" @@ -2030,10 +2034,6 @@ msgstr "" msgid "addresses is empty" msgstr "" -#: extmod/ulab/code/vector/vectorise.c -msgid "arctan2 is implemented for scalars and ndarrays only" -msgstr "" - #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "" @@ -2042,6 +2042,10 @@ msgstr "" msgid "argsort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "argsort is not implemented for flattened arrays" +msgstr "" + #: py/runtime.c msgid "argument has wrong type" msgstr "" @@ -2059,14 +2063,22 @@ msgstr "" msgid "argument should be a '%q' not a '%q'" msgstr "" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c msgid "arguments must be ndarrays" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array and index length must be equal" +msgstr "" + #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "attempt to get (arg)min/(arg)max of empty sequence" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" msgstr "" @@ -2076,15 +2088,15 @@ msgid "attributes not supported yet" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, None, or 1" +msgid "axis is out of bounds" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, or 1" +msgid "axis must be None, or an integer" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be None, 0, or 1" +msgid "axis too long" msgstr "" #: py/builtinevex.c @@ -2288,6 +2300,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "" +#: extmod/ulab/code/ndarray_operators.c +msgid "cannot cast output with casting rule" +msgstr "" + #: py/objtype.c msgid "cannot create '%q' instances" msgstr "" @@ -2304,10 +2320,6 @@ msgstr "" msgid "cannot perform relative import" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "cannot reshape array (incompatible input/output shape)" -msgstr "" - #: py/emitnative.c msgid "casting" msgstr "" @@ -2380,10 +2392,6 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "could not broadast input array from shape" -msgstr "" - #: extmod/ulab/code/poly/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -2392,6 +2400,10 @@ msgstr "" msgid "couldn't determine SD card version" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "cross is defined for 1D arrays of length 3" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" msgstr "" @@ -2400,10 +2412,6 @@ msgstr "" msgid "data must be of equal length" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "ddof must be smaller than length of data set" -msgstr "" - #: py/parsenum.c msgid "decimal numbers not supported" msgstr "" @@ -2433,6 +2441,10 @@ msgstr "" msgid "diff argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "differentiation order out of range" +msgstr "" + #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c msgid "division by zero" @@ -2548,6 +2560,10 @@ msgstr "" msgid "first argument must be a function" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "first argument must be a tuple of ndarrays" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" msgstr "" @@ -2601,8 +2617,8 @@ msgstr "" msgid "function has the same sign at the ends of interval" msgstr "" -#: extmod/ulab/code/compare/compare.c -msgid "function is implemented for scalars and ndarrays only" +#: extmod/ulab/code/ndarray.c +msgid "function is defined for ndarrays only" msgstr "" #: py/argcheck.c @@ -2672,6 +2688,7 @@ msgstr "" msgid "index is out of bounds" msgstr "" +#: extmod/ulab/code/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "" @@ -2696,6 +2713,10 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "input and output shapes are not compatible" +msgstr "" + #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" msgstr "" @@ -2704,6 +2725,10 @@ msgstr "" msgid "input array length must be power of 2" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "input arrays are not compatible" +msgstr "" + #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" msgstr "" @@ -2716,6 +2741,22 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/user/user.c +msgid "input must be a dense ndarray" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input must be a tensor of rank 2" +msgstr "" + +#: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c +msgid "input must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "input must be one-dimensional" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" msgstr "" @@ -2728,6 +2769,10 @@ msgstr "" msgid "input vectors must be of equal length" msgstr "" +#: extmod/ulab/code/poly/poly.c +msgid "inputs are not iterable" +msgstr "" + #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" msgstr "" @@ -2896,6 +2941,10 @@ msgstr "" msgid "max_length must be > 0" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "maximum number of dimensions is 4" +msgstr "" + #: py/runtime.c msgid "maximum recursion depth exceeded" msgstr "" @@ -2945,10 +2994,6 @@ msgstr "" msgid "must use keyword argument for key function" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "n must be between 0, and 9" -msgstr "" - #: py/runtime.c msgid "name '%q' is not defined" msgstr "" @@ -3031,6 +3076,10 @@ msgstr "" msgid "non-keyword arg after keyword arg" msgstr "" +#: extmod/ulab/code/linalg/linalg.c +msgid "norm is defined for 1D and 2D arrays" +msgstr "" + #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "" @@ -3043,10 +3092,6 @@ msgstr "" msgid "not enough arguments for format string" msgstr "" -#: extmod/ulab/code/poly/poly.c -msgid "number of arguments must be 2, or 3" -msgstr "" - #: extmod/ulab/code/ulab_create.c msgid "number of points must be at least 2" msgstr "" @@ -3099,6 +3144,10 @@ msgstr "" msgid "odd-length string" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "offset is too large" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" @@ -3121,6 +3170,14 @@ msgstr "" msgid "operands could not be broadcast together" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "operation is implemented for 1D Boolean arrays only" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "operation is not implemented for flattened array" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "" @@ -3255,6 +3312,10 @@ msgstr "" msgid "requested length %d but object has length %d" msgstr "" +#: extmod/ulab/code/ndarray_operators.c +msgid "results cannot be cast to specified type" +msgstr "" + #: py/compile.c msgid "return annotation must be an identifier" msgstr "" @@ -3273,8 +3334,8 @@ msgstr "" msgid "rgb_pins[%d] is not on the same port as clock" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "right hand side must be an ndarray, or a scalar" +#: extmod/ulab/code/numerical/numerical.c +msgid "roll argument must be an ndarray" msgstr "" #: py/objstr.c @@ -3300,7 +3361,7 @@ msgid "script compilation not supported" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "shape must be a 2-tuple" +msgid "shape must be a tuple" msgstr "" #: py/objstr.c @@ -3343,10 +3404,6 @@ msgstr "" msgid "sort argument must be an ndarray" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "sorted axis can't be longer than 65535" -msgstr "" - #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" @@ -3452,6 +3509,10 @@ msgstr "" msgid "timestamp out of range for platform time_t" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "tobytes can be invoked for dense arrays only" +msgstr "" + #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "" @@ -3627,12 +3688,12 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "wrong argument type" +#: extmod/ulab/code/numerical/numerical.c +msgid "wrong axis index" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "wrong index type" +#: extmod/ulab/code/ulab_create.c +msgid "wrong axis specified" msgstr "" #: extmod/ulab/code/vector/vectorise.c diff --git a/py/py.mk b/py/py.mk index acf5d127bce53..eb3ba27acbd63 100644 --- a/py/py.mk +++ b/py/py.mk @@ -109,7 +109,7 @@ ifeq ($(CIRCUITPY_ULAB),1) SRC_MOD += $(patsubst $(TOP)/%,%,$(wildcard $(TOP)/extmod/ulab/code/*.c)) SRC_MOD += $(patsubst $(TOP)/%,%,$(wildcard $(TOP)/extmod/ulab/code/*/*.c)) CFLAGS_MOD += -DCIRCUITPY_ULAB=1 -DMODULE_ULAB_ENABLED=1 -$(BUILD)/extmod/ulab/code/%.o: CFLAGS += -Wno-float-equal -Wno-sign-compare -DCIRCUITPY +$(BUILD)/extmod/ulab/code/%.o: CFLAGS += -Wno-missing-declarations -Wno-missing-prototypes -Wno-unused-parameter -Wno-float-equal -Wno-sign-compare -Wno-cast-align -Wno-shadow -DCIRCUITPY endif # External modules written in C. From 70e978f48b587620bb1407d9717f0a8fc3d4cf26 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 16 Nov 2020 16:57:01 -0600 Subject: [PATCH 261/770] stm: disable ulab on two resource-constrained boards --- ports/stm/boards/meowbit_v121/mpconfigboard.mk | 2 ++ ports/stm/boards/thunderpack/mpconfigboard.mk | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ports/stm/boards/meowbit_v121/mpconfigboard.mk b/ports/stm/boards/meowbit_v121/mpconfigboard.mk index c416700e3c73a..86b0cb5ab4241 100644 --- a/ports/stm/boards/meowbit_v121/mpconfigboard.mk +++ b/ports/stm/boards/meowbit_v121/mpconfigboard.mk @@ -20,3 +20,5 @@ LD_COMMON = boards/common_default.ld LD_FILE = boards/STM32F401xe_boot.ld # For debugging - also comment BOOTLOADER_OFFSET and BOARD_VTOR_DEFER # LD_FILE = boards/STM32F401xe_fs.ld + +CIRCUITPY_ULAB = 0 diff --git a/ports/stm/boards/thunderpack/mpconfigboard.mk b/ports/stm/boards/thunderpack/mpconfigboard.mk index d303582e0edf6..8f645068d7bb8 100644 --- a/ports/stm/boards/thunderpack/mpconfigboard.mk +++ b/ports/stm/boards/thunderpack/mpconfigboard.mk @@ -15,3 +15,5 @@ MCU_PACKAGE = UFQFPN48 LD_COMMON = boards/common_nvm.ld LD_FILE = boards/STM32F411_nvm.ld + +CIRCUITPY_ULAB = 0 From 368fa88312c14d1a74f44b7539fb00c7ef8754f8 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 23 Nov 2020 12:14:58 -0800 Subject: [PATCH 262/770] Ignore size parameter --- extmod/modujson.c | 1 + 1 file changed, 1 insertion(+) diff --git a/extmod/modujson.c b/extmod/modujson.c index 515606b70a0f5..3bb4b33017d60 100644 --- a/extmod/modujson.c +++ b/extmod/modujson.c @@ -85,6 +85,7 @@ STATIC byte ujson_stream_next(ujson_stream_t *s) { #define CIRCUITPY_JSON_READ_CHUNK_SIZE 64 STATIC mp_uint_t ujson_python_readinto(mp_obj_t obj, void *buf, mp_uint_t size, int *errcode) { + (void) size; // Ignore size because we know it's always 1. ujson_stream_t* s = obj; if (s->start == s->end) { From efda9124374dcbffb4f8a58d227e439d34ca7760 Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Mon, 23 Nov 2020 15:53:28 -0500 Subject: [PATCH 263/770] Add pin names from silk --- ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c index 40c9e91e4d0d7..f1ce4b8c612b5 100644 --- a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c +++ b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c @@ -16,11 +16,16 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_EPD_CS), MP_ROM_PTR(&pin_GPIO8) }, { MP_ROM_QSTR(MP_QSTR_BUTTON_A), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, { MP_ROM_QSTR(MP_QSTR_BUTTON_B), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, { MP_ROM_QSTR(MP_QSTR_BUTTON_C), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, { MP_ROM_QSTR(MP_QSTR_BUTTON_D), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, { MP_ROM_QSTR(MP_QSTR_LIGHT), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO3) }, { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_GPIO4) }, @@ -36,6 +41,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO21) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO1) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, From 3730862362e914cc92b6977cb5d809856467f8f9 Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Mon, 23 Nov 2020 15:56:36 -0500 Subject: [PATCH 264/770] Update to match silk rev 1 --- ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c index f1ce4b8c612b5..6c2dc1151af2c 100644 --- a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c +++ b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c @@ -41,7 +41,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO21) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO1) }, - { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, From 7928a0d45419181d3f29c809aa0c3c87e58359e3 Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Mon, 23 Nov 2020 16:02:45 -0500 Subject: [PATCH 265/770] Blank lines to group aliases. --- ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c index 6c2dc1151af2c..0cefb6dfbc2d9 100644 --- a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c +++ b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c @@ -17,10 +17,13 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_BUTTON_A), MP_ROM_PTR(&pin_GPIO15) }, { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_B), MP_ROM_PTR(&pin_GPIO14) }, { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_C), MP_ROM_PTR(&pin_GPIO12) }, { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_D), MP_ROM_PTR(&pin_GPIO11) }, { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, From bb064d719898568183ee9ee2b3c27c3ce5f211ff Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 24 Nov 2020 00:17:56 +0100 Subject: [PATCH 266/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 147 +++++++++++++++++++-------- locale/cs.po | 147 +++++++++++++++++++-------- locale/de_DE.po | 207 ++++++++++++++++++++++++++++---------- locale/el.po | 147 +++++++++++++++++++-------- locale/es.po | 206 ++++++++++++++++++++++++++++---------- locale/fil.po | 147 +++++++++++++++++++-------- locale/fr.po | 211 +++++++++++++++++++++++++++++---------- locale/hi.po | 147 +++++++++++++++++++-------- locale/it_IT.po | 147 +++++++++++++++++++-------- locale/ja.po | 196 ++++++++++++++++++++++++++---------- locale/ko.po | 147 +++++++++++++++++++-------- locale/nl.po | 205 +++++++++++++++++++++++++++---------- locale/pl.po | 160 ++++++++++++++++++++--------- locale/pt_BR.po | 210 ++++++++++++++++++++++++++++---------- locale/sv.po | 208 ++++++++++++++++++++++++++++---------- locale/zh_Latn_pinyin.po | 208 ++++++++++++++++++++++++++++---------- 16 files changed, 2083 insertions(+), 757 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index d6672b1e401cf..782e846e9946e 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-10 15:30+0530\n" +"POT-Creation-Date: 2020-11-23 10:10-0600\n" "PO-Revision-Date: 2020-10-10 23:51+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -873,6 +873,10 @@ msgstr "Penyebaran yang diperluas dengan respon pindai tidak didukung." msgid "FFT is defined for ndarrays only" msgstr "FFT didefinisikan hanya untuk ndarrays" +#: extmod/ulab/code/fft/fft.c +msgid "FFT is implemented for linear arrays only" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" msgstr "" @@ -1991,7 +1995,7 @@ msgstr "" msgid "WARNING: Your code filename has two extensions\n" msgstr "PERINGATAN: Nama file kode anda mempunyai dua ekstensi\n" -#: shared-bindings/watchdog/WatchDogTimer.c +#: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" @@ -2076,10 +2080,6 @@ msgstr "" msgid "addresses is empty" msgstr "" -#: extmod/ulab/code/vector/vectorise.c -msgid "arctan2 is implemented for scalars and ndarrays only" -msgstr "" - #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "" @@ -2088,6 +2088,10 @@ msgstr "" msgid "argsort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "argsort is not implemented for flattened arrays" +msgstr "" + #: py/runtime.c msgid "argument has wrong type" msgstr "" @@ -2105,14 +2109,22 @@ msgstr "argumen num/types tidak cocok" msgid "argument should be a '%q' not a '%q'" msgstr "" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c msgid "arguments must be ndarrays" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array and index length must be equal" +msgstr "" + #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "attempt to get (arg)min/(arg)max of empty sequence" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" msgstr "" @@ -2122,15 +2134,15 @@ msgid "attributes not supported yet" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, None, or 1" +msgid "axis is out of bounds" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, or 1" +msgid "axis must be None, or an integer" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be None, 0, or 1" +msgid "axis too long" msgstr "" #: py/builtinevex.c @@ -2335,6 +2347,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "" +#: extmod/ulab/code/ndarray_operators.c +msgid "cannot cast output with casting rule" +msgstr "" + #: py/objtype.c msgid "cannot create '%q' instances" msgstr "" @@ -2351,10 +2367,6 @@ msgstr "" msgid "cannot perform relative import" msgstr "tidak dapat melakukan relative import" -#: extmod/ulab/code/ndarray.c -msgid "cannot reshape array (incompatible input/output shape)" -msgstr "" - #: py/emitnative.c msgid "casting" msgstr "" @@ -2427,10 +2439,6 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "could not broadast input array from shape" -msgstr "" - #: extmod/ulab/code/poly/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -2439,6 +2447,10 @@ msgstr "" msgid "couldn't determine SD card version" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "cross is defined for 1D arrays of length 3" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" msgstr "" @@ -2447,10 +2459,6 @@ msgstr "" msgid "data must be of equal length" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "ddof must be smaller than length of data set" -msgstr "" - #: py/parsenum.c msgid "decimal numbers not supported" msgstr "" @@ -2480,6 +2488,10 @@ msgstr "" msgid "diff argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "differentiation order out of range" +msgstr "" + #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c msgid "division by zero" @@ -2595,6 +2607,10 @@ msgstr "" msgid "first argument must be a function" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "first argument must be a tuple of ndarrays" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" msgstr "" @@ -2648,8 +2664,8 @@ msgstr "fungsi mendapatkan nilai ganda untuk argumen '%q'" msgid "function has the same sign at the ends of interval" msgstr "" -#: extmod/ulab/code/compare/compare.c -msgid "function is implemented for scalars and ndarrays only" +#: extmod/ulab/code/ndarray.c +msgid "function is defined for ndarrays only" msgstr "" #: py/argcheck.c @@ -2719,6 +2735,7 @@ msgstr "lapisan (padding) tidak benar" msgid "index is out of bounds" msgstr "" +#: extmod/ulab/code/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "index keluar dari jangkauan" @@ -2743,6 +2760,10 @@ msgstr "" msgid "inline assembler must be a function" msgstr "inline assembler harus sebuah fungsi" +#: extmod/ulab/code/ndarray.c +msgid "input and output shapes are not compatible" +msgstr "" + #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" msgstr "" @@ -2751,6 +2772,10 @@ msgstr "" msgid "input array length must be power of 2" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "input arrays are not compatible" +msgstr "" + #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" msgstr "" @@ -2763,6 +2788,22 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/user/user.c +msgid "input must be a dense ndarray" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input must be a tensor of rank 2" +msgstr "" + +#: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c +msgid "input must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "input must be one-dimensional" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" msgstr "" @@ -2775,6 +2816,10 @@ msgstr "" msgid "input vectors must be of equal length" msgstr "" +#: extmod/ulab/code/poly/poly.c +msgid "inputs are not iterable" +msgstr "" + #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" msgstr "" @@ -2943,6 +2988,10 @@ msgstr "" msgid "max_length must be > 0" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "maximum number of dimensions is 4" +msgstr "" + #: py/runtime.c msgid "maximum recursion depth exceeded" msgstr "" @@ -2992,10 +3041,6 @@ msgstr "" msgid "must use keyword argument for key function" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "n must be between 0, and 9" -msgstr "" - #: py/runtime.c msgid "name '%q' is not defined" msgstr "" @@ -3078,6 +3123,10 @@ msgstr "non-keyword arg setelah */**" msgid "non-keyword arg after keyword arg" msgstr "non-keyword arg setelah keyword arg" +#: extmod/ulab/code/linalg/linalg.c +msgid "norm is defined for 1D and 2D arrays" +msgstr "" + #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "" @@ -3090,10 +3139,6 @@ msgstr "" msgid "not enough arguments for format string" msgstr "" -#: extmod/ulab/code/poly/poly.c -msgid "number of arguments must be 2, or 3" -msgstr "" - #: extmod/ulab/code/ulab_create.c msgid "number of points must be at least 2" msgstr "" @@ -3146,6 +3191,10 @@ msgstr "" msgid "odd-length string" msgstr "panjang data string memiliki keganjilan (odd-length)" +#: extmod/ulab/code/ulab_create.c +msgid "offset is too large" +msgstr "" + #: py/objstr.c py/objstrunicode.c #, fuzzy msgid "offset out of bounds" @@ -3169,6 +3218,14 @@ msgstr "" msgid "operands could not be broadcast together" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "operation is implemented for 1D Boolean arrays only" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "operation is not implemented for flattened array" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "" @@ -3303,6 +3360,10 @@ msgstr "relative import" msgid "requested length %d but object has length %d" msgstr "" +#: extmod/ulab/code/ndarray_operators.c +msgid "results cannot be cast to specified type" +msgstr "" + #: py/compile.c msgid "return annotation must be an identifier" msgstr "anotasi return harus sebuah identifier" @@ -3321,8 +3382,8 @@ msgstr "" msgid "rgb_pins[%d] is not on the same port as clock" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "right hand side must be an ndarray, or a scalar" +#: extmod/ulab/code/numerical/numerical.c +msgid "roll argument must be an ndarray" msgstr "" #: py/objstr.c @@ -3348,7 +3409,7 @@ msgid "script compilation not supported" msgstr "kompilasi script tidak didukung" #: extmod/ulab/code/ndarray.c -msgid "shape must be a 2-tuple" +msgid "shape must be a tuple" msgstr "" #: py/objstr.c @@ -3391,10 +3452,6 @@ msgstr "memulai ulang software(soft reboot)\n" msgid "sort argument must be an ndarray" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "sorted axis can't be longer than 65535" -msgstr "" - #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" @@ -3501,6 +3558,10 @@ msgstr "" msgid "timestamp out of range for platform time_t" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "tobytes can be invoked for dense arrays only" +msgstr "" + #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "" @@ -3676,12 +3737,12 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "wrong argument type" +#: extmod/ulab/code/numerical/numerical.c +msgid "wrong axis index" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "wrong index type" +#: extmod/ulab/code/ulab_create.c +msgid "wrong axis specified" msgstr "" #: extmod/ulab/code/vector/vectorise.c diff --git a/locale/cs.po b/locale/cs.po index bde3a20b87198..6eb69fb6723ea 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-10 15:30+0530\n" +"POT-Creation-Date: 2020-11-23 10:10-0600\n" "PO-Revision-Date: 2020-05-24 03:22+0000\n" "Last-Translator: dronecz \n" "Language-Team: LANGUAGE \n" @@ -859,6 +859,10 @@ msgstr "" msgid "FFT is defined for ndarrays only" msgstr "" +#: extmod/ulab/code/fft/fft.c +msgid "FFT is implemented for linear arrays only" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" msgstr "" @@ -1955,7 +1959,7 @@ msgstr "" msgid "WARNING: Your code filename has two extensions\n" msgstr "" -#: shared-bindings/watchdog/WatchDogTimer.c +#: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" @@ -2034,10 +2038,6 @@ msgstr "" msgid "addresses is empty" msgstr "" -#: extmod/ulab/code/vector/vectorise.c -msgid "arctan2 is implemented for scalars and ndarrays only" -msgstr "" - #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "" @@ -2046,6 +2046,10 @@ msgstr "" msgid "argsort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "argsort is not implemented for flattened arrays" +msgstr "" + #: py/runtime.c msgid "argument has wrong type" msgstr "" @@ -2063,14 +2067,22 @@ msgstr "" msgid "argument should be a '%q' not a '%q'" msgstr "" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c msgid "arguments must be ndarrays" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array and index length must be equal" +msgstr "" + #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "attempt to get (arg)min/(arg)max of empty sequence" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" msgstr "" @@ -2080,15 +2092,15 @@ msgid "attributes not supported yet" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, None, or 1" +msgid "axis is out of bounds" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, or 1" +msgid "axis must be None, or an integer" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be None, 0, or 1" +msgid "axis too long" msgstr "" #: py/builtinevex.c @@ -2292,6 +2304,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "" +#: extmod/ulab/code/ndarray_operators.c +msgid "cannot cast output with casting rule" +msgstr "" + #: py/objtype.c msgid "cannot create '%q' instances" msgstr "" @@ -2308,10 +2324,6 @@ msgstr "" msgid "cannot perform relative import" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "cannot reshape array (incompatible input/output shape)" -msgstr "" - #: py/emitnative.c msgid "casting" msgstr "" @@ -2384,10 +2396,6 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "could not broadast input array from shape" -msgstr "" - #: extmod/ulab/code/poly/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -2396,6 +2404,10 @@ msgstr "" msgid "couldn't determine SD card version" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "cross is defined for 1D arrays of length 3" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" msgstr "" @@ -2404,10 +2416,6 @@ msgstr "" msgid "data must be of equal length" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "ddof must be smaller than length of data set" -msgstr "" - #: py/parsenum.c msgid "decimal numbers not supported" msgstr "" @@ -2437,6 +2445,10 @@ msgstr "" msgid "diff argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "differentiation order out of range" +msgstr "" + #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c msgid "division by zero" @@ -2552,6 +2564,10 @@ msgstr "" msgid "first argument must be a function" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "first argument must be a tuple of ndarrays" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" msgstr "" @@ -2605,8 +2621,8 @@ msgstr "" msgid "function has the same sign at the ends of interval" msgstr "" -#: extmod/ulab/code/compare/compare.c -msgid "function is implemented for scalars and ndarrays only" +#: extmod/ulab/code/ndarray.c +msgid "function is defined for ndarrays only" msgstr "" #: py/argcheck.c @@ -2676,6 +2692,7 @@ msgstr "" msgid "index is out of bounds" msgstr "" +#: extmod/ulab/code/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "" @@ -2700,6 +2717,10 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "input and output shapes are not compatible" +msgstr "" + #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" msgstr "" @@ -2708,6 +2729,10 @@ msgstr "" msgid "input array length must be power of 2" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "input arrays are not compatible" +msgstr "" + #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" msgstr "" @@ -2720,6 +2745,22 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/user/user.c +msgid "input must be a dense ndarray" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input must be a tensor of rank 2" +msgstr "" + +#: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c +msgid "input must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "input must be one-dimensional" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" msgstr "" @@ -2732,6 +2773,10 @@ msgstr "" msgid "input vectors must be of equal length" msgstr "" +#: extmod/ulab/code/poly/poly.c +msgid "inputs are not iterable" +msgstr "" + #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" msgstr "" @@ -2900,6 +2945,10 @@ msgstr "" msgid "max_length must be > 0" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "maximum number of dimensions is 4" +msgstr "" + #: py/runtime.c msgid "maximum recursion depth exceeded" msgstr "" @@ -2949,10 +2998,6 @@ msgstr "" msgid "must use keyword argument for key function" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "n must be between 0, and 9" -msgstr "" - #: py/runtime.c msgid "name '%q' is not defined" msgstr "" @@ -3035,6 +3080,10 @@ msgstr "" msgid "non-keyword arg after keyword arg" msgstr "" +#: extmod/ulab/code/linalg/linalg.c +msgid "norm is defined for 1D and 2D arrays" +msgstr "" + #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "" @@ -3047,10 +3096,6 @@ msgstr "" msgid "not enough arguments for format string" msgstr "" -#: extmod/ulab/code/poly/poly.c -msgid "number of arguments must be 2, or 3" -msgstr "" - #: extmod/ulab/code/ulab_create.c msgid "number of points must be at least 2" msgstr "" @@ -3103,6 +3148,10 @@ msgstr "" msgid "odd-length string" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "offset is too large" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" @@ -3125,6 +3174,14 @@ msgstr "" msgid "operands could not be broadcast together" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "operation is implemented for 1D Boolean arrays only" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "operation is not implemented for flattened array" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "" @@ -3259,6 +3316,10 @@ msgstr "" msgid "requested length %d but object has length %d" msgstr "" +#: extmod/ulab/code/ndarray_operators.c +msgid "results cannot be cast to specified type" +msgstr "" + #: py/compile.c msgid "return annotation must be an identifier" msgstr "" @@ -3277,8 +3338,8 @@ msgstr "" msgid "rgb_pins[%d] is not on the same port as clock" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "right hand side must be an ndarray, or a scalar" +#: extmod/ulab/code/numerical/numerical.c +msgid "roll argument must be an ndarray" msgstr "" #: py/objstr.c @@ -3304,7 +3365,7 @@ msgid "script compilation not supported" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "shape must be a 2-tuple" +msgid "shape must be a tuple" msgstr "" #: py/objstr.c @@ -3347,10 +3408,6 @@ msgstr "" msgid "sort argument must be an ndarray" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "sorted axis can't be longer than 65535" -msgstr "" - #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" @@ -3456,6 +3513,10 @@ msgstr "" msgid "timestamp out of range for platform time_t" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "tobytes can be invoked for dense arrays only" +msgstr "" + #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "" @@ -3631,12 +3692,12 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "wrong argument type" +#: extmod/ulab/code/numerical/numerical.c +msgid "wrong axis index" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "wrong index type" +#: extmod/ulab/code/ulab_create.c +msgid "wrong axis specified" msgstr "" #: extmod/ulab/code/vector/vectorise.c diff --git a/locale/de_DE.po b/locale/de_DE.po index dabc486595283..f103339109ed7 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-10 15:30+0530\n" +"POT-Creation-Date: 2020-11-23 10:10-0600\n" "PO-Revision-Date: 2020-06-16 18:24+0000\n" "Last-Translator: Andreas Buchen \n" "Language: de_DE\n" @@ -870,6 +870,10 @@ msgstr "" msgid "FFT is defined for ndarrays only" msgstr "FFT ist nur für ndarrays definiert" +#: extmod/ulab/code/fft/fft.c +msgid "FFT is implemented for linear arrays only" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" msgstr "SSL Handshake fehlgeschlagen" @@ -2004,7 +2008,7 @@ msgid "WARNING: Your code filename has two extensions\n" msgstr "" "WARNUNG: Der Dateiname deines Programms hat zwei Dateityperweiterungen\n" -#: shared-bindings/watchdog/WatchDogTimer.c +#: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" @@ -2093,10 +2097,6 @@ msgstr "Adresse außerhalb der Grenzen" msgid "addresses is empty" msgstr "adresses ist leer" -#: extmod/ulab/code/vector/vectorise.c -msgid "arctan2 is implemented for scalars and ndarrays only" -msgstr "arctan2 ist nur für Skalare und ndarrays implementiert" - #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "arg ist eine leere Sequenz" @@ -2105,6 +2105,10 @@ msgstr "arg ist eine leere Sequenz" msgid "argsort argument must be an ndarray" msgstr "Das Argument argsort muss ein ndarray sein" +#: extmod/ulab/code/numerical/numerical.c +msgid "argsort is not implemented for flattened arrays" +msgstr "" + #: py/runtime.c msgid "argument has wrong type" msgstr "Argument hat falschen Typ" @@ -2122,14 +2126,22 @@ msgstr "Anzahl/Typen der Argumente passen nicht" msgid "argument should be a '%q' not a '%q'" msgstr "Argument sollte '%q' sein, nicht '%q'" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c msgid "arguments must be ndarrays" msgstr "Argumente müssen ndarrays sein" +#: extmod/ulab/code/ndarray.c +msgid "array and index length must be equal" +msgstr "" + #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "Array/Bytes auf der rechten Seite erforderlich" +#: extmod/ulab/code/numerical/numerical.c +msgid "attempt to get (arg)min/(arg)max of empty sequence" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" msgstr "Sie haben versucht argmin/argmax von einer leeren Sequenz zu bekommen" @@ -2139,16 +2151,16 @@ msgid "attributes not supported yet" msgstr "Attribute werden noch nicht unterstützt" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, None, or 1" -msgstr "Die Achse muss -1, 0, Keine oder 1 sein" +msgid "axis is out of bounds" +msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, or 1" -msgstr "Die Achse muss -1, 0 oder 1 sein" +msgid "axis must be None, or an integer" +msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be None, 0, or 1" -msgstr "Die Achse muss None, 0 oder 1 sein" +msgid "axis too long" +msgstr "" #: py/builtinevex.c msgid "bad compile mode" @@ -2359,6 +2371,10 @@ msgstr "" "kann nicht von der manuellen Feldspezifikation zur automatischen " "Feldnummerierung wechseln" +#: extmod/ulab/code/ndarray_operators.c +msgid "cannot cast output with casting rule" +msgstr "" + #: py/objtype.c msgid "cannot create '%q' instances" msgstr "Kann '%q' Instanzen nicht erstellen" @@ -2375,11 +2391,6 @@ msgstr "Name %q kann nicht importiert werden" msgid "cannot perform relative import" msgstr "kann keinen relativen Import durchführen" -#: extmod/ulab/code/ndarray.c -msgid "cannot reshape array (incompatible input/output shape)" -msgstr "" -"Array kann nicht umgeformt werden (inkompatible Eingabe- / Ausgabeform)" - #: py/emitnative.c msgid "casting" msgstr "Umwandlung (cast)" @@ -2454,10 +2465,6 @@ msgstr "Convolve-Argumente müssen ndarrays sein" msgid "convolve arguments must not be empty" msgstr "Convolve Argumente dürfen nicht leer sein" -#: extmod/ulab/code/ndarray.c -msgid "could not broadast input array from shape" -msgstr "Eingabearray konnte nicht aus der Form übertragen werden" - #: extmod/ulab/code/poly/poly.c msgid "could not invert Vandermonde matrix" msgstr "Vandermonde-Matrix konnte nicht invertiert werden" @@ -2466,6 +2473,10 @@ msgstr "Vandermonde-Matrix konnte nicht invertiert werden" msgid "couldn't determine SD card version" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "cross is defined for 1D arrays of length 3" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" msgstr "" @@ -2474,10 +2485,6 @@ msgstr "" msgid "data must be of equal length" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "ddof must be smaller than length of data set" -msgstr "ddof muss kleiner als die Länge des Datensatzes sein" - #: py/parsenum.c msgid "decimal numbers not supported" msgstr "Dezimalzahlen nicht unterstützt" @@ -2509,6 +2516,10 @@ msgstr "Die Wörterbuch-Aktualisierungssequenz hat eine falsche Länge" msgid "diff argument must be an ndarray" msgstr "diff Argument muss ein ndarray sein" +#: extmod/ulab/code/numerical/numerical.c +msgid "differentiation order out of range" +msgstr "" + #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c msgid "division by zero" @@ -2624,6 +2635,10 @@ msgstr "" msgid "first argument must be a function" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "first argument must be a tuple of ndarrays" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" msgstr "Das erste Argument muss iterierbar sein" @@ -2677,9 +2692,9 @@ msgstr "Funktion hat mehrere Werte für Argument '%q'" msgid "function has the same sign at the ends of interval" msgstr "" -#: extmod/ulab/code/compare/compare.c -msgid "function is implemented for scalars and ndarrays only" -msgstr "Die Funktion ist nur für Skalare und Ndarrays implementiert" +#: extmod/ulab/code/ndarray.c +msgid "function is defined for ndarrays only" +msgstr "" #: py/argcheck.c #, c-format @@ -2749,6 +2764,7 @@ msgstr "padding ist inkorrekt" msgid "index is out of bounds" msgstr "Index ist außerhalb der Grenzen" +#: extmod/ulab/code/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "index außerhalb der Reichweite" @@ -2773,6 +2789,10 @@ msgstr "Länge von initial_value ist falsch" msgid "inline assembler must be a function" msgstr "inline assembler muss eine function sein" +#: extmod/ulab/code/ndarray.c +msgid "input and output shapes are not compatible" +msgstr "" + #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" msgstr "Das Eingabeargument muss eine Ganzzahl oder ein 2-Tupel sein" @@ -2781,6 +2801,10 @@ msgstr "Das Eingabeargument muss eine Ganzzahl oder ein 2-Tupel sein" msgid "input array length must be power of 2" msgstr "Die Länge des Eingabearrays muss eine Potenz von 2 sein" +#: extmod/ulab/code/ulab_create.c +msgid "input arrays are not compatible" +msgstr "" + #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" msgstr "Eingabedaten müssen iterierbar sein" @@ -2793,6 +2817,22 @@ msgstr "Eingabematrix ist asymmetrisch" msgid "input matrix is singular" msgstr "Eingabematrix ist singulär" +#: extmod/ulab/code/user/user.c +msgid "input must be a dense ndarray" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input must be a tensor of rank 2" +msgstr "" + +#: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c +msgid "input must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "input must be one-dimensional" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" msgstr "Die Eingabe muss eine quadratische Matrix sein" @@ -2805,6 +2845,10 @@ msgstr "Die Eingabe muss Tupel, Liste, Bereich oder Ndarray sein" msgid "input vectors must be of equal length" msgstr "Eingabevektoren müssen gleich lang sein" +#: extmod/ulab/code/poly/poly.c +msgid "inputs are not iterable" +msgstr "" + #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" msgstr "int() arg 2 muss >= 2 und <= 36 sein" @@ -2979,6 +3023,10 @@ msgstr "max_length muss 0-%d sein, wenn fixed_length %s ist" msgid "max_length must be > 0" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "maximum number of dimensions is 4" +msgstr "" + #: py/runtime.c msgid "maximum recursion depth exceeded" msgstr "maximale Rekursionstiefe überschritten" @@ -3028,10 +3076,6 @@ msgstr "muss ein Objekt verursachen (raise)" msgid "must use keyword argument for key function" msgstr "muss Schlüsselwortargument für key function verwenden" -#: extmod/ulab/code/numerical/numerical.c -msgid "n must be between 0, and 9" -msgstr "n muss zwischen 0 und 9 liegen" - #: py/runtime.c msgid "name '%q' is not defined" msgstr "Name '%q' ist nirgends definiert worden (Schreibweise kontrollieren)" @@ -3114,6 +3158,10 @@ msgstr "Nicht-Schlüsselwort arg nach * / **" msgid "non-keyword arg after keyword arg" msgstr "Nicht-Schlüsselwort Argument nach Schlüsselwort Argument" +#: extmod/ulab/code/linalg/linalg.c +msgid "norm is defined for 1D and 2D arrays" +msgstr "" + #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "keine 128-bit UUID" @@ -3127,10 +3175,6 @@ msgstr "" msgid "not enough arguments for format string" msgstr "Nicht genügend Argumente für den Formatierungs-String" -#: extmod/ulab/code/poly/poly.c -msgid "number of arguments must be 2, or 3" -msgstr "Die Anzahl der Argumente muss 2 oder 3 sein" - #: extmod/ulab/code/ulab_create.c msgid "number of points must be at least 2" msgstr "Die Anzahl der Punkte muss mindestens 2 betragen" @@ -3183,6 +3227,10 @@ msgstr "Objekt mit Pufferprotokoll (buffer protocol) erforderlich" msgid "odd-length string" msgstr "String mit ungerader Länge" +#: extmod/ulab/code/ulab_create.c +msgid "offset is too large" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "offset außerhalb der Grenzen" @@ -3206,6 +3254,14 @@ msgstr "" msgid "operands could not be broadcast together" msgstr "Operanden konnten nicht zusammen gesendet werden" +#: extmod/ulab/code/ndarray.c +msgid "operation is implemented for 1D Boolean arrays only" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "operation is not implemented for flattened array" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "Die Operation ist für ndarrays nicht implementiert" @@ -3342,6 +3398,10 @@ msgstr "relativer Import" msgid "requested length %d but object has length %d" msgstr "die ersuchte Länge ist %d, aber das Objekt hat eine Länge von %d" +#: extmod/ulab/code/ndarray_operators.c +msgid "results cannot be cast to specified type" +msgstr "" + #: py/compile.c msgid "return annotation must be an identifier" msgstr "Rückgabewert-Beschreibung muss ein Identifier sein" @@ -3360,9 +3420,9 @@ msgstr "rgb_pins[%d] dupliziert eine andere Pinbelegung" msgid "rgb_pins[%d] is not on the same port as clock" msgstr "rgb_pins [%d] befindet sich nicht am selben Port wie clock" -#: extmod/ulab/code/ndarray.c -msgid "right hand side must be an ndarray, or a scalar" -msgstr "Die rechte Seite muss ein Ndarray oder ein Skalar sein" +#: extmod/ulab/code/numerical/numerical.c +msgid "roll argument must be an ndarray" +msgstr "" #: py/objstr.c msgid "rsplit(None,n)" @@ -3389,8 +3449,8 @@ msgid "script compilation not supported" msgstr "kompilieren von Skripten nicht unterstützt" #: extmod/ulab/code/ndarray.c -msgid "shape must be a 2-tuple" -msgstr "Form muss ein 2-Tupel sein" +msgid "shape must be a tuple" +msgstr "" #: py/objstr.c msgid "sign not allowed in string format specifier" @@ -3432,10 +3492,6 @@ msgstr "weicher reboot\n" msgid "sort argument must be an ndarray" msgstr "sortierungs Argument muss ein ndarray sein" -#: extmod/ulab/code/numerical/numerical.c -msgid "sorted axis can't be longer than 65535" -msgstr "" - #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" @@ -3542,6 +3598,10 @@ msgstr "Zeitlimit beim warten auf v2 Karte" msgid "timestamp out of range for platform time_t" msgstr "Zeitstempel außerhalb des Bereichs für Plattform time_t" +#: extmod/ulab/code/ndarray.c +msgid "tobytes can be invoked for dense arrays only" +msgstr "" + #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "zu viele Argumente mit dem angegebenen Format" @@ -3721,13 +3781,13 @@ msgstr "" msgid "window must be <= interval" msgstr "Fenster muss <= Intervall sein" -#: extmod/ulab/code/linalg/linalg.c -msgid "wrong argument type" -msgstr "falscher Argumenttyp" +#: extmod/ulab/code/numerical/numerical.c +msgid "wrong axis index" +msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "wrong index type" -msgstr "falscher Indextyp" +#: extmod/ulab/code/ulab_create.c +msgid "wrong axis specified" +msgstr "" #: extmod/ulab/code/vector/vectorise.c msgid "wrong input type" @@ -3777,6 +3837,49 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "arctan2 is implemented for scalars and ndarrays only" +#~ msgstr "arctan2 ist nur für Skalare und ndarrays implementiert" + +#~ msgid "axis must be -1, 0, None, or 1" +#~ msgstr "Die Achse muss -1, 0, Keine oder 1 sein" + +#~ msgid "axis must be -1, 0, or 1" +#~ msgstr "Die Achse muss -1, 0 oder 1 sein" + +#~ msgid "axis must be None, 0, or 1" +#~ msgstr "Die Achse muss None, 0 oder 1 sein" + +#~ msgid "cannot reshape array (incompatible input/output shape)" +#~ msgstr "" +#~ "Array kann nicht umgeformt werden (inkompatible Eingabe- / Ausgabeform)" + +#~ msgid "could not broadast input array from shape" +#~ msgstr "Eingabearray konnte nicht aus der Form übertragen werden" + +#~ msgid "ddof must be smaller than length of data set" +#~ msgstr "ddof muss kleiner als die Länge des Datensatzes sein" + +#~ msgid "function is implemented for scalars and ndarrays only" +#~ msgstr "Die Funktion ist nur für Skalare und Ndarrays implementiert" + +#~ msgid "n must be between 0, and 9" +#~ msgstr "n muss zwischen 0 und 9 liegen" + +#~ msgid "number of arguments must be 2, or 3" +#~ msgstr "Die Anzahl der Argumente muss 2 oder 3 sein" + +#~ msgid "right hand side must be an ndarray, or a scalar" +#~ msgstr "Die rechte Seite muss ein Ndarray oder ein Skalar sein" + +#~ msgid "shape must be a 2-tuple" +#~ msgstr "Form muss ein 2-Tupel sein" + +#~ msgid "wrong argument type" +#~ msgstr "falscher Argumenttyp" + +#~ msgid "wrong index type" +#~ msgstr "falscher Indextyp" + #~ msgid "" #~ "\n" #~ "To exit, please reset the board without " diff --git a/locale/el.po b/locale/el.po index 0d35c20cebc07..85bf0ab44fa39 100644 --- a/locale/el.po +++ b/locale/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-10 15:30+0530\n" +"POT-Creation-Date: 2020-11-23 10:10-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -854,6 +854,10 @@ msgstr "" msgid "FFT is defined for ndarrays only" msgstr "" +#: extmod/ulab/code/fft/fft.c +msgid "FFT is implemented for linear arrays only" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" msgstr "" @@ -1950,7 +1954,7 @@ msgstr "" msgid "WARNING: Your code filename has two extensions\n" msgstr "" -#: shared-bindings/watchdog/WatchDogTimer.c +#: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" @@ -2029,10 +2033,6 @@ msgstr "" msgid "addresses is empty" msgstr "" -#: extmod/ulab/code/vector/vectorise.c -msgid "arctan2 is implemented for scalars and ndarrays only" -msgstr "" - #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "" @@ -2041,6 +2041,10 @@ msgstr "" msgid "argsort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "argsort is not implemented for flattened arrays" +msgstr "" + #: py/runtime.c msgid "argument has wrong type" msgstr "" @@ -2058,14 +2062,22 @@ msgstr "" msgid "argument should be a '%q' not a '%q'" msgstr "" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c msgid "arguments must be ndarrays" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array and index length must be equal" +msgstr "" + #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "attempt to get (arg)min/(arg)max of empty sequence" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" msgstr "" @@ -2075,15 +2087,15 @@ msgid "attributes not supported yet" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, None, or 1" +msgid "axis is out of bounds" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, or 1" +msgid "axis must be None, or an integer" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be None, 0, or 1" +msgid "axis too long" msgstr "" #: py/builtinevex.c @@ -2287,6 +2299,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "" +#: extmod/ulab/code/ndarray_operators.c +msgid "cannot cast output with casting rule" +msgstr "" + #: py/objtype.c msgid "cannot create '%q' instances" msgstr "" @@ -2303,10 +2319,6 @@ msgstr "" msgid "cannot perform relative import" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "cannot reshape array (incompatible input/output shape)" -msgstr "" - #: py/emitnative.c msgid "casting" msgstr "" @@ -2379,10 +2391,6 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "could not broadast input array from shape" -msgstr "" - #: extmod/ulab/code/poly/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -2391,6 +2399,10 @@ msgstr "" msgid "couldn't determine SD card version" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "cross is defined for 1D arrays of length 3" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" msgstr "" @@ -2399,10 +2411,6 @@ msgstr "" msgid "data must be of equal length" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "ddof must be smaller than length of data set" -msgstr "" - #: py/parsenum.c msgid "decimal numbers not supported" msgstr "" @@ -2432,6 +2440,10 @@ msgstr "" msgid "diff argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "differentiation order out of range" +msgstr "" + #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c msgid "division by zero" @@ -2547,6 +2559,10 @@ msgstr "" msgid "first argument must be a function" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "first argument must be a tuple of ndarrays" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" msgstr "" @@ -2600,8 +2616,8 @@ msgstr "" msgid "function has the same sign at the ends of interval" msgstr "" -#: extmod/ulab/code/compare/compare.c -msgid "function is implemented for scalars and ndarrays only" +#: extmod/ulab/code/ndarray.c +msgid "function is defined for ndarrays only" msgstr "" #: py/argcheck.c @@ -2671,6 +2687,7 @@ msgstr "" msgid "index is out of bounds" msgstr "" +#: extmod/ulab/code/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "" @@ -2695,6 +2712,10 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "input and output shapes are not compatible" +msgstr "" + #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" msgstr "" @@ -2703,6 +2724,10 @@ msgstr "" msgid "input array length must be power of 2" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "input arrays are not compatible" +msgstr "" + #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" msgstr "" @@ -2715,6 +2740,22 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/user/user.c +msgid "input must be a dense ndarray" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input must be a tensor of rank 2" +msgstr "" + +#: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c +msgid "input must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "input must be one-dimensional" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" msgstr "" @@ -2727,6 +2768,10 @@ msgstr "" msgid "input vectors must be of equal length" msgstr "" +#: extmod/ulab/code/poly/poly.c +msgid "inputs are not iterable" +msgstr "" + #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" msgstr "" @@ -2895,6 +2940,10 @@ msgstr "" msgid "max_length must be > 0" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "maximum number of dimensions is 4" +msgstr "" + #: py/runtime.c msgid "maximum recursion depth exceeded" msgstr "" @@ -2944,10 +2993,6 @@ msgstr "" msgid "must use keyword argument for key function" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "n must be between 0, and 9" -msgstr "" - #: py/runtime.c msgid "name '%q' is not defined" msgstr "" @@ -3030,6 +3075,10 @@ msgstr "" msgid "non-keyword arg after keyword arg" msgstr "" +#: extmod/ulab/code/linalg/linalg.c +msgid "norm is defined for 1D and 2D arrays" +msgstr "" + #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "" @@ -3042,10 +3091,6 @@ msgstr "" msgid "not enough arguments for format string" msgstr "" -#: extmod/ulab/code/poly/poly.c -msgid "number of arguments must be 2, or 3" -msgstr "" - #: extmod/ulab/code/ulab_create.c msgid "number of points must be at least 2" msgstr "" @@ -3098,6 +3143,10 @@ msgstr "" msgid "odd-length string" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "offset is too large" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" @@ -3120,6 +3169,14 @@ msgstr "" msgid "operands could not be broadcast together" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "operation is implemented for 1D Boolean arrays only" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "operation is not implemented for flattened array" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "" @@ -3254,6 +3311,10 @@ msgstr "" msgid "requested length %d but object has length %d" msgstr "" +#: extmod/ulab/code/ndarray_operators.c +msgid "results cannot be cast to specified type" +msgstr "" + #: py/compile.c msgid "return annotation must be an identifier" msgstr "" @@ -3272,8 +3333,8 @@ msgstr "" msgid "rgb_pins[%d] is not on the same port as clock" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "right hand side must be an ndarray, or a scalar" +#: extmod/ulab/code/numerical/numerical.c +msgid "roll argument must be an ndarray" msgstr "" #: py/objstr.c @@ -3299,7 +3360,7 @@ msgid "script compilation not supported" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "shape must be a 2-tuple" +msgid "shape must be a tuple" msgstr "" #: py/objstr.c @@ -3342,10 +3403,6 @@ msgstr "" msgid "sort argument must be an ndarray" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "sorted axis can't be longer than 65535" -msgstr "" - #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" @@ -3451,6 +3508,10 @@ msgstr "" msgid "timestamp out of range for platform time_t" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "tobytes can be invoked for dense arrays only" +msgstr "" + #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "" @@ -3626,12 +3687,12 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "wrong argument type" +#: extmod/ulab/code/numerical/numerical.c +msgid "wrong axis index" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "wrong index type" +#: extmod/ulab/code/ulab_create.c +msgid "wrong axis specified" msgstr "" #: extmod/ulab/code/vector/vectorise.c diff --git a/locale/es.po b/locale/es.po index bdb4b68a5d7f0..538a2944e6fa0 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-11-10 15:30+0530\n" +"POT-Creation-Date: 2020-11-23 10:10-0600\n" "PO-Revision-Date: 2020-11-15 16:28+0000\n" "Last-Translator: RubenD \n" "Language-Team: \n" @@ -874,6 +874,10 @@ msgstr "No se admiten anuncios extendidos con respuesta de escaneo." msgid "FFT is defined for ndarrays only" msgstr "FFT se define solo para ndarrays" +#: extmod/ulab/code/fft/fft.c +msgid "FFT is implemented for linear arrays only" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" msgstr "Fallo en saludo SSL" @@ -2004,7 +2008,7 @@ msgstr "Tiempo de espera agotado para lectura de voltaje" msgid "WARNING: Your code filename has two extensions\n" msgstr "ADVERTENCIA: El nombre de archivo de tu código tiene dos extensiones\n" -#: shared-bindings/watchdog/WatchDogTimer.c +#: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" "WatchDogTimer no se puede desinicializar luego de definirse en modo RESET" @@ -2092,10 +2096,6 @@ msgstr "address fuera de límites" msgid "addresses is empty" msgstr "addresses esta vacío" -#: extmod/ulab/code/vector/vectorise.c -msgid "arctan2 is implemented for scalars and ndarrays only" -msgstr "arctan2 se encuentra implementado solo para escalares y ndarrays" - #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "argumento es una secuencia vacía" @@ -2104,6 +2104,10 @@ msgstr "argumento es una secuencia vacía" msgid "argsort argument must be an ndarray" msgstr "El argumento para argsort debe ser un ndarray" +#: extmod/ulab/code/numerical/numerical.c +msgid "argsort is not implemented for flattened arrays" +msgstr "" + #: py/runtime.c msgid "argument has wrong type" msgstr "el argumento tiene un tipo erroneo" @@ -2121,14 +2125,22 @@ msgstr "argumento número/tipos no coinciden" msgid "argument should be a '%q' not a '%q'" msgstr "argumento deberia ser un '%q' no un '%q'" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c msgid "arguments must be ndarrays" msgstr "argumentos deben ser ndarrays" +#: extmod/ulab/code/ndarray.c +msgid "array and index length must be equal" +msgstr "" + #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "array/bytes requeridos en el lado derecho" +#: extmod/ulab/code/numerical/numerical.c +msgid "attempt to get (arg)min/(arg)max of empty sequence" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" msgstr "se trató de traer argmin/argmax de una secuencia vacía" @@ -2138,16 +2150,16 @@ msgid "attributes not supported yet" msgstr "atributos aún no soportados" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, None, or 1" -msgstr "eje debe ser -1, 0, None o 1" +msgid "axis is out of bounds" +msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, or 1" -msgstr "eje debe ser -1, 0, o 1" +msgid "axis must be None, or an integer" +msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be None, 0, or 1" -msgstr "eje debe ser None, 0, o 1" +msgid "axis too long" +msgstr "" #: py/builtinevex.c msgid "bad compile mode" @@ -2355,6 +2367,10 @@ msgstr "" "no se puede cambiar de especificación de campo manual a numeración " "automática de campos" +#: extmod/ulab/code/ndarray_operators.c +msgid "cannot cast output with casting rule" +msgstr "" + #: py/objtype.c msgid "cannot create '%q' instances" msgstr "no se pueden crear '%q' instancias" @@ -2371,10 +2387,6 @@ msgstr "no se puede importar name '%q'" msgid "cannot perform relative import" msgstr "no se puedo realizar importación relativa" -#: extmod/ulab/code/ndarray.c -msgid "cannot reshape array (incompatible input/output shape)" -msgstr "no se puede reformar el arreglo (forma de entrada/salida incompatible)" - #: py/emitnative.c msgid "casting" msgstr "convirtiendo tipo" @@ -2447,10 +2459,6 @@ msgstr "los argumentos para convolve deben ser ndarrays" msgid "convolve arguments must not be empty" msgstr "los argumentos para convolve no deben estar vacíos" -#: extmod/ulab/code/ndarray.c -msgid "could not broadast input array from shape" -msgstr "no se pudo anunciar la matriz de entrada desde la forma" - #: extmod/ulab/code/poly/poly.c msgid "could not invert Vandermonde matrix" msgstr "no se pudo invertir la matriz de Vandermonde" @@ -2459,6 +2467,10 @@ msgstr "no se pudo invertir la matriz de Vandermonde" msgid "couldn't determine SD card version" msgstr "no se pudo determinar la versión de la tarjeta SD" +#: extmod/ulab/code/numerical/numerical.c +msgid "cross is defined for 1D arrays of length 3" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" msgstr "los datos deben permitir iteración" @@ -2467,10 +2479,6 @@ msgstr "los datos deben permitir iteración" msgid "data must be of equal length" msgstr "los datos deben ser de igual tamaño" -#: extmod/ulab/code/numerical/numerical.c -msgid "ddof must be smaller than length of data set" -msgstr "ddof debe ser menor que la longitud del conjunto de datos" - #: py/parsenum.c msgid "decimal numbers not supported" msgstr "números decimales no soportados" @@ -2502,6 +2510,10 @@ msgstr "la secuencia de actualizacion del dict tiene una longitud incorrecta" msgid "diff argument must be an ndarray" msgstr "El argumento diff debe ser un ndarray" +#: extmod/ulab/code/numerical/numerical.c +msgid "differentiation order out of range" +msgstr "" + #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c msgid "division by zero" @@ -2617,6 +2629,10 @@ msgstr "se debe poder llamar al primer argumento" msgid "first argument must be a function" msgstr "el primer argumento debe ser una función" +#: extmod/ulab/code/ulab_create.c +msgid "first argument must be a tuple of ndarrays" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" msgstr "el primer argumento debe permitir iteración" @@ -2670,9 +2686,9 @@ msgstr "la función tiene múltiples valores para el argumento '%q'" msgid "function has the same sign at the ends of interval" msgstr "la función tiene el mismo signo a extremos del intervalo" -#: extmod/ulab/code/compare/compare.c -msgid "function is implemented for scalars and ndarrays only" -msgstr "la función está implementada solo para escalares y ndarrays" +#: extmod/ulab/code/ndarray.c +msgid "function is defined for ndarrays only" +msgstr "" #: py/argcheck.c #, c-format @@ -2741,6 +2757,7 @@ msgstr "relleno (padding) incorrecto" msgid "index is out of bounds" msgstr "el índice está fuera de límites" +#: extmod/ulab/code/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "index fuera de rango" @@ -2765,6 +2782,10 @@ msgstr "el tamaño de initial_value es incorrecto" msgid "inline assembler must be a function" msgstr "ensamblador en línea debe ser una función" +#: extmod/ulab/code/ndarray.c +msgid "input and output shapes are not compatible" +msgstr "" + #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" msgstr "el argumento de entrada debe ser un entero o una tupla de par" @@ -2773,6 +2794,10 @@ msgstr "el argumento de entrada debe ser un entero o una tupla de par" msgid "input array length must be power of 2" msgstr "el tamaño del arreglo de entrada debe ser potencia de 2" +#: extmod/ulab/code/ulab_create.c +msgid "input arrays are not compatible" +msgstr "" + #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" msgstr "los datos de entrada deben permitir iteración" @@ -2785,6 +2810,22 @@ msgstr "la matriz de entrada es asimétrica" msgid "input matrix is singular" msgstr "la matriz de entrada es singular" +#: extmod/ulab/code/user/user.c +msgid "input must be a dense ndarray" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input must be a tensor of rank 2" +msgstr "" + +#: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c +msgid "input must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "input must be one-dimensional" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" msgstr "la entrada debe ser una matriz cuadrada" @@ -2797,6 +2838,10 @@ msgstr "la entrada debe ser una tupla, lista, rango o ndarray" msgid "input vectors must be of equal length" msgstr "los vectores de entrada deben ser de igual tamaño" +#: extmod/ulab/code/poly/poly.c +msgid "inputs are not iterable" +msgstr "" + #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" msgstr "int() arg 2 debe ser >= 2 y <= 36" @@ -2968,6 +3013,10 @@ msgstr "max_length debe ser 0-%d cuando fixed_length es %s" msgid "max_length must be > 0" msgstr "max_lenght debe ser > 0" +#: extmod/ulab/code/ndarray.c +msgid "maximum number of dimensions is 4" +msgstr "" + #: py/runtime.c msgid "maximum recursion depth exceeded" msgstr "profundidad máxima de recursión excedida" @@ -3017,10 +3066,6 @@ msgstr "debe hacer un raise de un objeto" msgid "must use keyword argument for key function" msgstr "debe utilizar argumento de palabra clave para la función clave" -#: extmod/ulab/code/numerical/numerical.c -msgid "n must be between 0, and 9" -msgstr "n debe estar entre 0 y 9" - #: py/runtime.c msgid "name '%q' is not defined" msgstr "name '%q' no esta definido" @@ -3105,6 +3150,10 @@ msgstr "" "no deberia estar/tener agumento por palabra clave despues de argumento por " "palabra clave" +#: extmod/ulab/code/linalg/linalg.c +msgid "norm is defined for 1D and 2D arrays" +msgstr "" + #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "no es 128-bit UUID" @@ -3118,10 +3167,6 @@ msgstr "" msgid "not enough arguments for format string" msgstr "no suficientes argumentos para format string" -#: extmod/ulab/code/poly/poly.c -msgid "number of arguments must be 2, or 3" -msgstr "el número de argumentos debe ser 2 o 3" - #: extmod/ulab/code/ulab_create.c msgid "number of points must be at least 2" msgstr "el número de puntos debe ser al menos 2" @@ -3174,6 +3219,10 @@ msgstr "objeto con protocolo de buffer requerido" msgid "odd-length string" msgstr "string de longitud impar" +#: extmod/ulab/code/ulab_create.c +msgid "offset is too large" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "offset fuera de límites" @@ -3196,6 +3245,14 @@ msgstr "solo se admiten segmentos con step=1 (alias None)" msgid "operands could not be broadcast together" msgstr "los operandos no se pueden transmitir juntos" +#: extmod/ulab/code/ndarray.c +msgid "operation is implemented for 1D Boolean arrays only" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "operation is not implemented for flattened array" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "la operación no está implementada para ndarrays" @@ -3330,6 +3387,10 @@ msgstr "import relativo" msgid "requested length %d but object has length %d" msgstr "longitud solicitada %d pero el objeto tiene longitud %d" +#: extmod/ulab/code/ndarray_operators.c +msgid "results cannot be cast to specified type" +msgstr "" + #: py/compile.c msgid "return annotation must be an identifier" msgstr "la anotación de retorno debe ser un identificador" @@ -3348,9 +3409,9 @@ msgstr "rgb_pins[%d] duplica otra asignación de pin" msgid "rgb_pins[%d] is not on the same port as clock" msgstr "rgb_pins[%d] no está en el mismo puerto que el reloj" -#: extmod/ulab/code/ndarray.c -msgid "right hand side must be an ndarray, or a scalar" -msgstr "el lado derecho debe ser un ndarray o escalar" +#: extmod/ulab/code/numerical/numerical.c +msgid "roll argument must be an ndarray" +msgstr "" #: py/objstr.c msgid "rsplit(None,n)" @@ -3377,8 +3438,8 @@ msgid "script compilation not supported" msgstr "script de compilación no soportado" #: extmod/ulab/code/ndarray.c -msgid "shape must be a 2-tuple" -msgstr "la forma debe ser una tupla de 2" +msgid "shape must be a tuple" +msgstr "" #: py/objstr.c msgid "sign not allowed in string format specifier" @@ -3420,10 +3481,6 @@ msgstr "reinicio suave\n" msgid "sort argument must be an ndarray" msgstr "argumento de ordenado debe ser un ndarray" -#: extmod/ulab/code/numerical/numerical.c -msgid "sorted axis can't be longer than 65535" -msgstr "" - #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "el arreglo sos debe de forma (n_section, 6)" @@ -3530,6 +3587,10 @@ msgstr "tiempo de espera agotado esperando a tarjeta v2" msgid "timestamp out of range for platform time_t" msgstr "timestamp fuera de rango para plataform time_t" +#: extmod/ulab/code/ndarray.c +msgid "tobytes can be invoked for dense arrays only" +msgstr "" + #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "demasiados argumentos provistos con el formato dado" @@ -3705,13 +3766,13 @@ msgstr "el ancho debe ser mayor que cero" msgid "window must be <= interval" msgstr "la ventana debe ser <= intervalo" -#: extmod/ulab/code/linalg/linalg.c -msgid "wrong argument type" -msgstr "tipo de argumento incorrecto" +#: extmod/ulab/code/numerical/numerical.c +msgid "wrong axis index" +msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "wrong index type" -msgstr "tipo de índice incorrecto" +#: extmod/ulab/code/ulab_create.c +msgid "wrong axis specified" +msgstr "" #: extmod/ulab/code/vector/vectorise.c msgid "wrong input type" @@ -3761,6 +3822,49 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "arctan2 is implemented for scalars and ndarrays only" +#~ msgstr "arctan2 se encuentra implementado solo para escalares y ndarrays" + +#~ msgid "axis must be -1, 0, None, or 1" +#~ msgstr "eje debe ser -1, 0, None o 1" + +#~ msgid "axis must be -1, 0, or 1" +#~ msgstr "eje debe ser -1, 0, o 1" + +#~ msgid "axis must be None, 0, or 1" +#~ msgstr "eje debe ser None, 0, o 1" + +#~ msgid "cannot reshape array (incompatible input/output shape)" +#~ msgstr "" +#~ "no se puede reformar el arreglo (forma de entrada/salida incompatible)" + +#~ msgid "could not broadast input array from shape" +#~ msgstr "no se pudo anunciar la matriz de entrada desde la forma" + +#~ msgid "ddof must be smaller than length of data set" +#~ msgstr "ddof debe ser menor que la longitud del conjunto de datos" + +#~ msgid "function is implemented for scalars and ndarrays only" +#~ msgstr "la función está implementada solo para escalares y ndarrays" + +#~ msgid "n must be between 0, and 9" +#~ msgstr "n debe estar entre 0 y 9" + +#~ msgid "number of arguments must be 2, or 3" +#~ msgstr "el número de argumentos debe ser 2 o 3" + +#~ msgid "right hand side must be an ndarray, or a scalar" +#~ msgstr "el lado derecho debe ser un ndarray o escalar" + +#~ msgid "shape must be a 2-tuple" +#~ msgstr "la forma debe ser una tupla de 2" + +#~ msgid "wrong argument type" +#~ msgstr "tipo de argumento incorrecto" + +#~ msgid "wrong index type" +#~ msgstr "tipo de índice incorrecto" + #~ msgid "specify size or data, but not both" #~ msgstr "especifique o tamaño o datos, pero no ambos" diff --git a/locale/fil.po b/locale/fil.po index c74e13c6c825a..86178a9a14374 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-10 15:30+0530\n" +"POT-Creation-Date: 2020-11-23 10:10-0600\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -867,6 +867,10 @@ msgstr "" msgid "FFT is defined for ndarrays only" msgstr "" +#: extmod/ulab/code/fft/fft.c +msgid "FFT is implemented for linear arrays only" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" msgstr "" @@ -1976,7 +1980,7 @@ msgstr "" msgid "WARNING: Your code filename has two extensions\n" msgstr "BABALA: Ang pangalan ng file ay may dalawang extension\n" -#: shared-bindings/watchdog/WatchDogTimer.c +#: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" @@ -2061,10 +2065,6 @@ msgstr "wala sa sakop ang address" msgid "addresses is empty" msgstr "walang laman ang address" -#: extmod/ulab/code/vector/vectorise.c -msgid "arctan2 is implemented for scalars and ndarrays only" -msgstr "" - #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "arg ay walang laman na sequence" @@ -2073,6 +2073,10 @@ msgstr "arg ay walang laman na sequence" msgid "argsort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "argsort is not implemented for flattened arrays" +msgstr "" + #: py/runtime.c msgid "argument has wrong type" msgstr "may maling type ang argument" @@ -2090,14 +2094,22 @@ msgstr "hindi tugma ang argument num/types" msgid "argument should be a '%q' not a '%q'" msgstr "argument ay dapat na '%q' hindi '%q'" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c msgid "arguments must be ndarrays" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array and index length must be equal" +msgstr "" + #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "array/bytes kinakailangan sa kanang bahagi" +#: extmod/ulab/code/numerical/numerical.c +msgid "attempt to get (arg)min/(arg)max of empty sequence" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" msgstr "" @@ -2107,15 +2119,15 @@ msgid "attributes not supported yet" msgstr "attributes hindi sinusuportahan" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, None, or 1" +msgid "axis is out of bounds" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, or 1" +msgid "axis must be None, or an integer" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be None, 0, or 1" +msgid "axis too long" msgstr "" #: py/builtinevex.c @@ -2326,6 +2338,10 @@ msgstr "" "hindi mapalitan ang manual field specification sa awtomatikong field " "numbering" +#: extmod/ulab/code/ndarray_operators.c +msgid "cannot cast output with casting rule" +msgstr "" + #: py/objtype.c msgid "cannot create '%q' instances" msgstr "hindi magawa '%q' instances" @@ -2342,10 +2358,6 @@ msgstr "hindi ma-import ang name %q" msgid "cannot perform relative import" msgstr "hindi maaring isagawa ang relative import" -#: extmod/ulab/code/ndarray.c -msgid "cannot reshape array (incompatible input/output shape)" -msgstr "" - #: py/emitnative.c msgid "casting" msgstr "casting" @@ -2418,10 +2430,6 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "could not broadast input array from shape" -msgstr "" - #: extmod/ulab/code/poly/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -2430,6 +2438,10 @@ msgstr "" msgid "couldn't determine SD card version" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "cross is defined for 1D arrays of length 3" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" msgstr "" @@ -2438,10 +2450,6 @@ msgstr "" msgid "data must be of equal length" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "ddof must be smaller than length of data set" -msgstr "" - #: py/parsenum.c msgid "decimal numbers not supported" msgstr "decimal numbers hindi sinusuportahan" @@ -2475,6 +2483,10 @@ msgstr "may mali sa haba ng dict update sequence" msgid "diff argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "differentiation order out of range" +msgstr "" + #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c msgid "division by zero" @@ -2591,6 +2603,10 @@ msgstr "" msgid "first argument must be a function" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "first argument must be a tuple of ndarrays" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" msgstr "" @@ -2644,8 +2660,8 @@ msgstr "ang function ay nakakuha ng maraming values para sa argument '%q'" msgid "function has the same sign at the ends of interval" msgstr "" -#: extmod/ulab/code/compare/compare.c -msgid "function is implemented for scalars and ndarrays only" +#: extmod/ulab/code/ndarray.c +msgid "function is defined for ndarrays only" msgstr "" #: py/argcheck.c @@ -2716,6 +2732,7 @@ msgstr "mali ang padding" msgid "index is out of bounds" msgstr "" +#: extmod/ulab/code/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "index wala sa sakop" @@ -2740,6 +2757,10 @@ msgstr "" msgid "inline assembler must be a function" msgstr "inline assembler ay dapat na function" +#: extmod/ulab/code/ndarray.c +msgid "input and output shapes are not compatible" +msgstr "" + #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" msgstr "" @@ -2748,6 +2769,10 @@ msgstr "" msgid "input array length must be power of 2" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "input arrays are not compatible" +msgstr "" + #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" msgstr "" @@ -2760,6 +2785,22 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/user/user.c +msgid "input must be a dense ndarray" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input must be a tensor of rank 2" +msgstr "" + +#: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c +msgid "input must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "input must be one-dimensional" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" msgstr "" @@ -2772,6 +2813,10 @@ msgstr "" msgid "input vectors must be of equal length" msgstr "" +#: extmod/ulab/code/poly/poly.c +msgid "inputs are not iterable" +msgstr "" + #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" msgstr "int() arg 2 ay dapat >=2 at <= 36" @@ -2944,6 +2989,10 @@ msgstr "" msgid "max_length must be > 0" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "maximum number of dimensions is 4" +msgstr "" + #: py/runtime.c msgid "maximum recursion depth exceeded" msgstr "lumagpas ang maximum recursion depth" @@ -2993,10 +3042,6 @@ msgstr "dapat itaas ang isang object" msgid "must use keyword argument for key function" msgstr "dapat gumamit ng keyword argument para sa key function" -#: extmod/ulab/code/numerical/numerical.c -msgid "n must be between 0, and 9" -msgstr "" - #: py/runtime.c msgid "name '%q' is not defined" msgstr "name '%q' ay hindi defined" @@ -3079,6 +3124,10 @@ msgstr "non-keyword arg sa huli ng */**" msgid "non-keyword arg after keyword arg" msgstr "non-keyword arg sa huli ng keyword arg" +#: extmod/ulab/code/linalg/linalg.c +msgid "norm is defined for 1D and 2D arrays" +msgstr "" + #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "" @@ -3091,10 +3140,6 @@ msgstr "hindi lahat ng arguments na i-convert habang string formatting" msgid "not enough arguments for format string" msgstr "kulang sa arguments para sa format string" -#: extmod/ulab/code/poly/poly.c -msgid "number of arguments must be 2, or 3" -msgstr "" - #: extmod/ulab/code/ulab_create.c msgid "number of points must be at least 2" msgstr "" @@ -3147,6 +3192,10 @@ msgstr "object na may buffer protocol kinakailangan" msgid "odd-length string" msgstr "odd-length string" +#: extmod/ulab/code/ulab_create.c +msgid "offset is too large" +msgstr "" + #: py/objstr.c py/objstrunicode.c #, fuzzy msgid "offset out of bounds" @@ -3170,6 +3219,14 @@ msgstr "ang mga slices lamang na may hakbang = 1 (aka None) ang sinusuportahan" msgid "operands could not be broadcast together" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "operation is implemented for 1D Boolean arrays only" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "operation is not implemented for flattened array" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "" @@ -3305,6 +3362,10 @@ msgstr "relative import" msgid "requested length %d but object has length %d" msgstr "hiniling ang haba %d ngunit may haba ang object na %d" +#: extmod/ulab/code/ndarray_operators.c +msgid "results cannot be cast to specified type" +msgstr "" + #: py/compile.c msgid "return annotation must be an identifier" msgstr "return annotation ay dapat na identifier" @@ -3323,8 +3384,8 @@ msgstr "" msgid "rgb_pins[%d] is not on the same port as clock" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "right hand side must be an ndarray, or a scalar" +#: extmod/ulab/code/numerical/numerical.c +msgid "roll argument must be an ndarray" msgstr "" #: py/objstr.c @@ -3352,7 +3413,7 @@ msgid "script compilation not supported" msgstr "script kompilasyon hindi supportado" #: extmod/ulab/code/ndarray.c -msgid "shape must be a 2-tuple" +msgid "shape must be a tuple" msgstr "" #: py/objstr.c @@ -3395,10 +3456,6 @@ msgstr "malambot na reboot\n" msgid "sort argument must be an ndarray" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "sorted axis can't be longer than 65535" -msgstr "" - #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" @@ -3506,6 +3563,10 @@ msgstr "" msgid "timestamp out of range for platform time_t" msgstr "wala sa sakop ng timestamp ang platform time_t" +#: extmod/ulab/code/ndarray.c +msgid "tobytes can be invoked for dense arrays only" +msgstr "" + #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "masyadong maraming mga argumento na ibinigay sa ibinigay na format" @@ -3681,12 +3742,12 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "wrong argument type" +#: extmod/ulab/code/numerical/numerical.c +msgid "wrong axis index" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "wrong index type" +#: extmod/ulab/code/ulab_create.c +msgid "wrong axis specified" msgstr "" #: extmod/ulab/code/vector/vectorise.c diff --git a/locale/fr.po b/locale/fr.po index b58ca6560b50c..17e6e905d1c1c 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-10 15:30+0530\n" +"POT-Creation-Date: 2020-11-23 10:10-0600\n" "PO-Revision-Date: 2020-11-20 22:28+0000\n" "Last-Translator: Noel Gaetan \n" "Language: fr\n" @@ -879,6 +879,10 @@ msgstr "" msgid "FFT is defined for ndarrays only" msgstr "La FFT est définie pour les ndarrays uniquement" +#: extmod/ulab/code/fft/fft.c +msgid "FFT is implemented for linear arrays only" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" msgstr "Échec du handshake SSL" @@ -2014,7 +2018,7 @@ msgstr "La lecture de la tension a expiré" msgid "WARNING: Your code filename has two extensions\n" msgstr "ATTENTION : le nom de fichier de votre code a deux extensions\n" -#: shared-bindings/watchdog/WatchDogTimer.c +#: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" "WatchDogTimer ne peut pas être désinitialisé une fois que le mode est réglé " @@ -2102,10 +2106,6 @@ msgstr "adresse hors limites" msgid "addresses is empty" msgstr "adresses vides" -#: extmod/ulab/code/vector/vectorise.c -msgid "arctan2 is implemented for scalars and ndarrays only" -msgstr "arctan2 est implémenté uniquement pour les scalaires et les ndarrays" - #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "l'argument est une séquence vide" @@ -2114,6 +2114,10 @@ msgstr "l'argument est une séquence vide" msgid "argsort argument must be an ndarray" msgstr "L'argument argsort doit être un ndarray" +#: extmod/ulab/code/numerical/numerical.c +msgid "argsort is not implemented for flattened arrays" +msgstr "" + #: py/runtime.c msgid "argument has wrong type" msgstr "l'argument est d'un mauvais type" @@ -2131,14 +2135,22 @@ msgstr "argument num/types ne correspond pas" msgid "argument should be a '%q' not a '%q'" msgstr "l'argument devrait être un(e) '%q', pas '%q'" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c msgid "arguments must be ndarrays" msgstr "les arguments doivent être des ndarrays" +#: extmod/ulab/code/ndarray.c +msgid "array and index length must be equal" +msgstr "" + #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "tableau/octets requis à droite" +#: extmod/ulab/code/numerical/numerical.c +msgid "attempt to get (arg)min/(arg)max of empty sequence" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" msgstr "tenter d'obtenir argmin / argmax d'une séquence vide" @@ -2148,16 +2160,16 @@ msgid "attributes not supported yet" msgstr "attribut pas encore supporté" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, None, or 1" -msgstr "l'axe doit être -1, 0, None ou 1" +msgid "axis is out of bounds" +msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, or 1" -msgstr "l'axe doit être -1, 0 ou 1" +msgid "axis must be None, or an integer" +msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be None, 0, or 1" -msgstr "l'axe doit être None, 0 ou 1" +msgid "axis too long" +msgstr "" #: py/builtinevex.c msgid "bad compile mode" @@ -2369,6 +2381,10 @@ msgstr "" "impossible de passer d'une spécification manuelle des champs à une " "énumération auto" +#: extmod/ulab/code/ndarray_operators.c +msgid "cannot cast output with casting rule" +msgstr "" + #: py/objtype.c msgid "cannot create '%q' instances" msgstr "ne peut pas créer une instance de '%q'" @@ -2385,11 +2401,6 @@ msgstr "ne peut pas importer le nom %q" msgid "cannot perform relative import" msgstr "ne peut pas réaliser un import relatif" -#: extmod/ulab/code/ndarray.c -msgid "cannot reshape array (incompatible input/output shape)" -msgstr "" -"ne peut pas remodeler le tableau (forme d'entrée / sortie incompatible)" - #: py/emitnative.c msgid "casting" msgstr "typage" @@ -2464,10 +2475,6 @@ msgstr "les arguments convolve doivent être des ndarrays" msgid "convolve arguments must not be empty" msgstr "les arguments convolve ne doivent pas être vides" -#: extmod/ulab/code/ndarray.c -msgid "could not broadast input array from shape" -msgstr "n'a pas pu diffuser le tableau d'entrée à partir de la forme" - #: extmod/ulab/code/poly/poly.c msgid "could not invert Vandermonde matrix" msgstr "n'a pas pu inverser la matrice Vandermonde" @@ -2476,6 +2483,10 @@ msgstr "n'a pas pu inverser la matrice Vandermonde" msgid "couldn't determine SD card version" msgstr "impossible de déterminer la version de la carte SD" +#: extmod/ulab/code/numerical/numerical.c +msgid "cross is defined for 1D arrays of length 3" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" msgstr "les données doivent être les objets iterables" @@ -2484,10 +2495,6 @@ msgstr "les données doivent être les objets iterables" msgid "data must be of equal length" msgstr "les données doivent être de longueur égale" -#: extmod/ulab/code/numerical/numerical.c -msgid "ddof must be smaller than length of data set" -msgstr "ddof doit être inférieur à la longueur de l'ensemble de données" - #: py/parsenum.c msgid "decimal numbers not supported" msgstr "nombres décimaux non supportés" @@ -2519,6 +2526,10 @@ msgstr "la séquence de mise à jour de dict a une mauvaise longueur" msgid "diff argument must be an ndarray" msgstr "l'argument diff doit être un ndarray" +#: extmod/ulab/code/numerical/numerical.c +msgid "differentiation order out of range" +msgstr "" + #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c msgid "division by zero" @@ -2636,6 +2647,10 @@ msgstr "le premier argument doit être un appelable" msgid "first argument must be a function" msgstr "le premier argument doit être une fonction" +#: extmod/ulab/code/ulab_create.c +msgid "first argument must be a tuple of ndarrays" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" msgstr "le premier argument doit être un itérable" @@ -2689,10 +2704,9 @@ msgstr "la fonction a reçu plusieurs valeurs pour l'argument '%q'" msgid "function has the same sign at the ends of interval" msgstr "la fonction a le même signe aux extrémités de l’intervalle" -#: extmod/ulab/code/compare/compare.c -msgid "function is implemented for scalars and ndarrays only" +#: extmod/ulab/code/ndarray.c +msgid "function is defined for ndarrays only" msgstr "" -"la fonction est implémentée pour les scalaires et les ndarrays uniquement" #: py/argcheck.c #, c-format @@ -2761,6 +2775,7 @@ msgstr "espacement incorrect" msgid "index is out of bounds" msgstr "l'index est hors limites" +#: extmod/ulab/code/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "index hors gamme" @@ -2786,6 +2801,10 @@ msgstr "la longueur de initial_value est incorrecte" msgid "inline assembler must be a function" msgstr "l'assembleur doit être une fonction" +#: extmod/ulab/code/ndarray.c +msgid "input and output shapes are not compatible" +msgstr "" + #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" msgstr "l'argument d'entrée doit être un entier ou un tuple 2" @@ -2794,6 +2813,10 @@ msgstr "l'argument d'entrée doit être un entier ou un tuple 2" msgid "input array length must be power of 2" msgstr "la longueur du tableau d'entrée doit être une puissance de 2" +#: extmod/ulab/code/ulab_create.c +msgid "input arrays are not compatible" +msgstr "" + #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" msgstr "les données d'entrée doivent être un itérable" @@ -2806,6 +2829,22 @@ msgstr "la matrice d'entrée est asymétrique" msgid "input matrix is singular" msgstr "la matrice d'entrée est singulière" +#: extmod/ulab/code/user/user.c +msgid "input must be a dense ndarray" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input must be a tensor of rank 2" +msgstr "" + +#: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c +msgid "input must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "input must be one-dimensional" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" msgstr "l'entrée doit être une matrice carrée" @@ -2818,6 +2857,10 @@ msgstr "l'entrée doit être tuple, list, range ou ndarray" msgid "input vectors must be of equal length" msgstr "les vecteurs d'entrée doivent être de longueur égale" +#: extmod/ulab/code/poly/poly.c +msgid "inputs are not iterable" +msgstr "" + #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" msgstr "l'argument 2 de int() doit être >=2 et <=36" @@ -2990,6 +3033,10 @@ msgstr "max_length doit être 0-%d lorsque fixed_length est %s" msgid "max_length must be > 0" msgstr "max_length doit être > 0" +#: extmod/ulab/code/ndarray.c +msgid "maximum number of dimensions is 4" +msgstr "" + #: py/runtime.c msgid "maximum recursion depth exceeded" msgstr "profondeur maximale de récursivité dépassée" @@ -3039,10 +3086,6 @@ msgstr "doit lever un objet" msgid "must use keyword argument for key function" msgstr "doit utiliser un argument nommé pour une fonction key" -#: extmod/ulab/code/numerical/numerical.c -msgid "n must be between 0, and 9" -msgstr "n doit être compris entre 0 et 9" - #: py/runtime.c msgid "name '%q' is not defined" msgstr "nom '%q' non défini" @@ -3126,6 +3169,10 @@ msgstr "argument non-nommé après */**" msgid "non-keyword arg after keyword arg" msgstr "argument non-nommé après argument nommé" +#: extmod/ulab/code/linalg/linalg.c +msgid "norm is defined for 1D and 2D arrays" +msgstr "" + #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "n'est pas un UUID 128 bits" @@ -3139,10 +3186,6 @@ msgstr "" msgid "not enough arguments for format string" msgstr "pas assez d'arguments pour la chaîne de format" -#: extmod/ulab/code/poly/poly.c -msgid "number of arguments must be 2, or 3" -msgstr "le nombre d'arguments doit être 2 ou 3" - #: extmod/ulab/code/ulab_create.c msgid "number of points must be at least 2" msgstr "le nombre de points doit être d'au moins 2" @@ -3195,6 +3238,10 @@ msgstr "un objet avec un protocole de tampon est nécessaire" msgid "odd-length string" msgstr "chaîne de longueur impaire" +#: extmod/ulab/code/ulab_create.c +msgid "offset is too large" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "décalage hors limites" @@ -3217,6 +3264,14 @@ msgstr "seules les tranches avec 'step=1' (cad None) sont supportées" msgid "operands could not be broadcast together" msgstr "les opérandes ne pouvaient pas être diffusés ensemble" +#: extmod/ulab/code/ndarray.c +msgid "operation is implemented for 1D Boolean arrays only" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "operation is not implemented for flattened array" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "l'opération n'est pas implémentée sur les ndarrays" @@ -3354,6 +3409,10 @@ msgstr "import relatif" msgid "requested length %d but object has length %d" msgstr "la longueur requise est %d mais l'objet est long de %d" +#: extmod/ulab/code/ndarray_operators.c +msgid "results cannot be cast to specified type" +msgstr "" + #: py/compile.c msgid "return annotation must be an identifier" msgstr "l'annotation de return doit être un identifiant" @@ -3372,9 +3431,9 @@ msgstr "rgb_pins[%d] duplique une autre affectation de broches" msgid "rgb_pins[%d] is not on the same port as clock" msgstr "rgb_pins[%d] n'est pas sur le même port que l'horloge" -#: extmod/ulab/code/ndarray.c -msgid "right hand side must be an ndarray, or a scalar" -msgstr "le côté droit doit être un ndarray ou un scalaire" +#: extmod/ulab/code/numerical/numerical.c +msgid "roll argument must be an ndarray" +msgstr "" #: py/objstr.c msgid "rsplit(None,n)" @@ -3401,8 +3460,8 @@ msgid "script compilation not supported" msgstr "compilation de script non supportée" #: extmod/ulab/code/ndarray.c -msgid "shape must be a 2-tuple" -msgstr "la forme doit être un tuple 2" +msgid "shape must be a tuple" +msgstr "" #: py/objstr.c msgid "sign not allowed in string format specifier" @@ -3444,10 +3503,6 @@ msgstr "redémarrage logiciel\n" msgid "sort argument must be an ndarray" msgstr "l'argument de «sort» doit être un ndarray" -#: extmod/ulab/code/numerical/numerical.c -msgid "sorted axis can't be longer than 65535" -msgstr "sorted axis ne peut pas dépasser 65535" - #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "le tableau sos doit être de forme (n_section, 6)" @@ -3554,6 +3609,10 @@ msgstr "Délai d’expiration dépassé en attendant une carte v2" msgid "timestamp out of range for platform time_t" msgstr "'timestamp' hors bornes pour 'time_t' de la plateforme" +#: extmod/ulab/code/ndarray.c +msgid "tobytes can be invoked for dense arrays only" +msgstr "" + #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "trop d'arguments fournis avec ce format" @@ -3729,13 +3788,13 @@ msgstr "width doit être plus grand que zero" msgid "window must be <= interval" msgstr "la fenêtre doit être <= intervalle" -#: extmod/ulab/code/linalg/linalg.c -msgid "wrong argument type" -msgstr "type d'argument incorrect" +#: extmod/ulab/code/numerical/numerical.c +msgid "wrong axis index" +msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "wrong index type" -msgstr "type d'index incorrect" +#: extmod/ulab/code/ulab_create.c +msgid "wrong axis specified" +msgstr "" #: extmod/ulab/code/vector/vectorise.c msgid "wrong input type" @@ -3785,6 +3844,54 @@ msgstr "zi doit être de type float" msgid "zi must be of shape (n_section, 2)" msgstr "zi doit être de forme (n_section, 2)" +#~ msgid "arctan2 is implemented for scalars and ndarrays only" +#~ msgstr "" +#~ "arctan2 est implémenté uniquement pour les scalaires et les ndarrays" + +#~ msgid "axis must be -1, 0, None, or 1" +#~ msgstr "l'axe doit être -1, 0, None ou 1" + +#~ msgid "axis must be -1, 0, or 1" +#~ msgstr "l'axe doit être -1, 0 ou 1" + +#~ msgid "axis must be None, 0, or 1" +#~ msgstr "l'axe doit être None, 0 ou 1" + +#~ msgid "cannot reshape array (incompatible input/output shape)" +#~ msgstr "" +#~ "ne peut pas remodeler le tableau (forme d'entrée / sortie incompatible)" + +#~ msgid "could not broadast input array from shape" +#~ msgstr "n'a pas pu diffuser le tableau d'entrée à partir de la forme" + +#~ msgid "ddof must be smaller than length of data set" +#~ msgstr "ddof doit être inférieur à la longueur de l'ensemble de données" + +#~ msgid "function is implemented for scalars and ndarrays only" +#~ msgstr "" +#~ "la fonction est implémentée pour les scalaires et les ndarrays uniquement" + +#~ msgid "n must be between 0, and 9" +#~ msgstr "n doit être compris entre 0 et 9" + +#~ msgid "number of arguments must be 2, or 3" +#~ msgstr "le nombre d'arguments doit être 2 ou 3" + +#~ msgid "right hand side must be an ndarray, or a scalar" +#~ msgstr "le côté droit doit être un ndarray ou un scalaire" + +#~ msgid "shape must be a 2-tuple" +#~ msgstr "la forme doit être un tuple 2" + +#~ msgid "sorted axis can't be longer than 65535" +#~ msgstr "sorted axis ne peut pas dépasser 65535" + +#~ msgid "wrong argument type" +#~ msgstr "type d'argument incorrect" + +#~ msgid "wrong index type" +#~ msgstr "type d'index incorrect" + #~ msgid "Must provide SCK pin" #~ msgstr "Vous devez fournir un code PIN SCK" diff --git a/locale/hi.po b/locale/hi.po index 6c49e1f01f6fd..3b006f1989681 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-10 15:30+0530\n" +"POT-Creation-Date: 2020-11-23 10:10-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -854,6 +854,10 @@ msgstr "" msgid "FFT is defined for ndarrays only" msgstr "" +#: extmod/ulab/code/fft/fft.c +msgid "FFT is implemented for linear arrays only" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" msgstr "" @@ -1950,7 +1954,7 @@ msgstr "" msgid "WARNING: Your code filename has two extensions\n" msgstr "" -#: shared-bindings/watchdog/WatchDogTimer.c +#: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" @@ -2029,10 +2033,6 @@ msgstr "" msgid "addresses is empty" msgstr "" -#: extmod/ulab/code/vector/vectorise.c -msgid "arctan2 is implemented for scalars and ndarrays only" -msgstr "" - #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "" @@ -2041,6 +2041,10 @@ msgstr "" msgid "argsort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "argsort is not implemented for flattened arrays" +msgstr "" + #: py/runtime.c msgid "argument has wrong type" msgstr "" @@ -2058,14 +2062,22 @@ msgstr "" msgid "argument should be a '%q' not a '%q'" msgstr "" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c msgid "arguments must be ndarrays" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array and index length must be equal" +msgstr "" + #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "attempt to get (arg)min/(arg)max of empty sequence" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" msgstr "" @@ -2075,15 +2087,15 @@ msgid "attributes not supported yet" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, None, or 1" +msgid "axis is out of bounds" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, or 1" +msgid "axis must be None, or an integer" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be None, 0, or 1" +msgid "axis too long" msgstr "" #: py/builtinevex.c @@ -2287,6 +2299,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "" +#: extmod/ulab/code/ndarray_operators.c +msgid "cannot cast output with casting rule" +msgstr "" + #: py/objtype.c msgid "cannot create '%q' instances" msgstr "" @@ -2303,10 +2319,6 @@ msgstr "" msgid "cannot perform relative import" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "cannot reshape array (incompatible input/output shape)" -msgstr "" - #: py/emitnative.c msgid "casting" msgstr "" @@ -2379,10 +2391,6 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "could not broadast input array from shape" -msgstr "" - #: extmod/ulab/code/poly/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -2391,6 +2399,10 @@ msgstr "" msgid "couldn't determine SD card version" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "cross is defined for 1D arrays of length 3" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" msgstr "" @@ -2399,10 +2411,6 @@ msgstr "" msgid "data must be of equal length" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "ddof must be smaller than length of data set" -msgstr "" - #: py/parsenum.c msgid "decimal numbers not supported" msgstr "" @@ -2432,6 +2440,10 @@ msgstr "" msgid "diff argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "differentiation order out of range" +msgstr "" + #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c msgid "division by zero" @@ -2547,6 +2559,10 @@ msgstr "" msgid "first argument must be a function" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "first argument must be a tuple of ndarrays" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" msgstr "" @@ -2600,8 +2616,8 @@ msgstr "" msgid "function has the same sign at the ends of interval" msgstr "" -#: extmod/ulab/code/compare/compare.c -msgid "function is implemented for scalars and ndarrays only" +#: extmod/ulab/code/ndarray.c +msgid "function is defined for ndarrays only" msgstr "" #: py/argcheck.c @@ -2671,6 +2687,7 @@ msgstr "" msgid "index is out of bounds" msgstr "" +#: extmod/ulab/code/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "" @@ -2695,6 +2712,10 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "input and output shapes are not compatible" +msgstr "" + #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" msgstr "" @@ -2703,6 +2724,10 @@ msgstr "" msgid "input array length must be power of 2" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "input arrays are not compatible" +msgstr "" + #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" msgstr "" @@ -2715,6 +2740,22 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/user/user.c +msgid "input must be a dense ndarray" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input must be a tensor of rank 2" +msgstr "" + +#: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c +msgid "input must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "input must be one-dimensional" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" msgstr "" @@ -2727,6 +2768,10 @@ msgstr "" msgid "input vectors must be of equal length" msgstr "" +#: extmod/ulab/code/poly/poly.c +msgid "inputs are not iterable" +msgstr "" + #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" msgstr "" @@ -2895,6 +2940,10 @@ msgstr "" msgid "max_length must be > 0" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "maximum number of dimensions is 4" +msgstr "" + #: py/runtime.c msgid "maximum recursion depth exceeded" msgstr "" @@ -2944,10 +2993,6 @@ msgstr "" msgid "must use keyword argument for key function" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "n must be between 0, and 9" -msgstr "" - #: py/runtime.c msgid "name '%q' is not defined" msgstr "" @@ -3030,6 +3075,10 @@ msgstr "" msgid "non-keyword arg after keyword arg" msgstr "" +#: extmod/ulab/code/linalg/linalg.c +msgid "norm is defined for 1D and 2D arrays" +msgstr "" + #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "" @@ -3042,10 +3091,6 @@ msgstr "" msgid "not enough arguments for format string" msgstr "" -#: extmod/ulab/code/poly/poly.c -msgid "number of arguments must be 2, or 3" -msgstr "" - #: extmod/ulab/code/ulab_create.c msgid "number of points must be at least 2" msgstr "" @@ -3098,6 +3143,10 @@ msgstr "" msgid "odd-length string" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "offset is too large" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" @@ -3120,6 +3169,14 @@ msgstr "" msgid "operands could not be broadcast together" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "operation is implemented for 1D Boolean arrays only" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "operation is not implemented for flattened array" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "" @@ -3254,6 +3311,10 @@ msgstr "" msgid "requested length %d but object has length %d" msgstr "" +#: extmod/ulab/code/ndarray_operators.c +msgid "results cannot be cast to specified type" +msgstr "" + #: py/compile.c msgid "return annotation must be an identifier" msgstr "" @@ -3272,8 +3333,8 @@ msgstr "" msgid "rgb_pins[%d] is not on the same port as clock" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "right hand side must be an ndarray, or a scalar" +#: extmod/ulab/code/numerical/numerical.c +msgid "roll argument must be an ndarray" msgstr "" #: py/objstr.c @@ -3299,7 +3360,7 @@ msgid "script compilation not supported" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "shape must be a 2-tuple" +msgid "shape must be a tuple" msgstr "" #: py/objstr.c @@ -3342,10 +3403,6 @@ msgstr "" msgid "sort argument must be an ndarray" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "sorted axis can't be longer than 65535" -msgstr "" - #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" @@ -3451,6 +3508,10 @@ msgstr "" msgid "timestamp out of range for platform time_t" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "tobytes can be invoked for dense arrays only" +msgstr "" + #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "" @@ -3626,12 +3687,12 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "wrong argument type" +#: extmod/ulab/code/numerical/numerical.c +msgid "wrong axis index" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "wrong index type" +#: extmod/ulab/code/ulab_create.c +msgid "wrong axis specified" msgstr "" #: extmod/ulab/code/vector/vectorise.c diff --git a/locale/it_IT.po b/locale/it_IT.po index fc0f0167525fe..652bc56fd5a7f 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-10 15:30+0530\n" +"POT-Creation-Date: 2020-11-23 10:10-0600\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -867,6 +867,10 @@ msgstr "" msgid "FFT is defined for ndarrays only" msgstr "" +#: extmod/ulab/code/fft/fft.c +msgid "FFT is implemented for linear arrays only" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" msgstr "" @@ -1985,7 +1989,7 @@ msgstr "" msgid "WARNING: Your code filename has two extensions\n" msgstr "ATTENZIONE: Il nome del sorgente ha due estensioni\n" -#: shared-bindings/watchdog/WatchDogTimer.c +#: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" @@ -2064,10 +2068,6 @@ msgstr "indirizzo fuori limite" msgid "addresses is empty" msgstr "gli indirizzi sono vuoti" -#: extmod/ulab/code/vector/vectorise.c -msgid "arctan2 is implemented for scalars and ndarrays only" -msgstr "" - #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "l'argomento è una sequenza vuota" @@ -2076,6 +2076,10 @@ msgstr "l'argomento è una sequenza vuota" msgid "argsort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "argsort is not implemented for flattened arrays" +msgstr "" + #: py/runtime.c msgid "argument has wrong type" msgstr "il tipo dell'argomento è errato" @@ -2093,14 +2097,22 @@ msgstr "discrepanza di numero/tipo di argomenti" msgid "argument should be a '%q' not a '%q'" msgstr "l'argomento dovrebbe essere un '%q' e non un '%q'" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c msgid "arguments must be ndarrays" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array and index length must be equal" +msgstr "" + #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "attempt to get (arg)min/(arg)max of empty sequence" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" msgstr "" @@ -2110,15 +2122,15 @@ msgid "attributes not supported yet" msgstr "attributi non ancora supportati" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, None, or 1" +msgid "axis is out of bounds" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, or 1" +msgid "axis must be None, or an integer" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be None, 0, or 1" +msgid "axis too long" msgstr "" #: py/builtinevex.c @@ -2326,6 +2338,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "" +#: extmod/ulab/code/ndarray_operators.c +msgid "cannot cast output with casting rule" +msgstr "" + #: py/objtype.c msgid "cannot create '%q' instances" msgstr "creare '%q' istanze" @@ -2342,10 +2358,6 @@ msgstr "impossibile imporate il nome %q" msgid "cannot perform relative import" msgstr "impossibile effettuare l'importazione relativa" -#: extmod/ulab/code/ndarray.c -msgid "cannot reshape array (incompatible input/output shape)" -msgstr "" - #: py/emitnative.c msgid "casting" msgstr "casting" @@ -2420,10 +2432,6 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "could not broadast input array from shape" -msgstr "" - #: extmod/ulab/code/poly/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -2432,6 +2440,10 @@ msgstr "" msgid "couldn't determine SD card version" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "cross is defined for 1D arrays of length 3" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" msgstr "" @@ -2440,10 +2452,6 @@ msgstr "" msgid "data must be of equal length" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "ddof must be smaller than length of data set" -msgstr "" - #: py/parsenum.c msgid "decimal numbers not supported" msgstr "numeri decimali non supportati" @@ -2476,6 +2484,10 @@ msgstr "sequanza di aggiornamento del dizionario ha la lunghezza errata" msgid "diff argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "differentiation order out of range" +msgstr "" + #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c msgid "division by zero" @@ -2592,6 +2604,10 @@ msgstr "" msgid "first argument must be a function" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "first argument must be a tuple of ndarrays" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" msgstr "" @@ -2645,8 +2661,8 @@ msgstr "la funzione ha ricevuto valori multipli per l'argomento '%q'" msgid "function has the same sign at the ends of interval" msgstr "" -#: extmod/ulab/code/compare/compare.c -msgid "function is implemented for scalars and ndarrays only" +#: extmod/ulab/code/ndarray.c +msgid "function is defined for ndarrays only" msgstr "" #: py/argcheck.c @@ -2717,6 +2733,7 @@ msgstr "padding incorretto" msgid "index is out of bounds" msgstr "" +#: extmod/ulab/code/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "indice fuori intervallo" @@ -2741,6 +2758,10 @@ msgstr "" msgid "inline assembler must be a function" msgstr "inline assembler deve essere una funzione" +#: extmod/ulab/code/ndarray.c +msgid "input and output shapes are not compatible" +msgstr "" + #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" msgstr "" @@ -2749,6 +2770,10 @@ msgstr "" msgid "input array length must be power of 2" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "input arrays are not compatible" +msgstr "" + #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" msgstr "" @@ -2761,6 +2786,22 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/user/user.c +msgid "input must be a dense ndarray" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input must be a tensor of rank 2" +msgstr "" + +#: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c +msgid "input must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "input must be one-dimensional" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" msgstr "" @@ -2773,6 +2814,10 @@ msgstr "" msgid "input vectors must be of equal length" msgstr "" +#: extmod/ulab/code/poly/poly.c +msgid "inputs are not iterable" +msgstr "" + #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" msgstr "il secondo argomanto di int() deve essere >= 2 e <= 36" @@ -2946,6 +2991,10 @@ msgstr "" msgid "max_length must be > 0" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "maximum number of dimensions is 4" +msgstr "" + #: py/runtime.c msgid "maximum recursion depth exceeded" msgstr "profondità massima di ricorsione superata" @@ -2995,10 +3044,6 @@ msgstr "deve lanciare un oggetto" msgid "must use keyword argument for key function" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "n must be between 0, and 9" -msgstr "" - #: py/runtime.c msgid "name '%q' is not defined" msgstr "nome '%q'non definito" @@ -3082,6 +3127,10 @@ msgstr "argomento non nominato dopo */**" msgid "non-keyword arg after keyword arg" msgstr "argomento non nominato seguito da argomento nominato" +#: extmod/ulab/code/linalg/linalg.c +msgid "norm is defined for 1D and 2D arrays" +msgstr "" + #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "" @@ -3096,10 +3145,6 @@ msgstr "" msgid "not enough arguments for format string" msgstr "argomenti non sufficienti per la stringa di formattazione" -#: extmod/ulab/code/poly/poly.c -msgid "number of arguments must be 2, or 3" -msgstr "" - #: extmod/ulab/code/ulab_create.c msgid "number of points must be at least 2" msgstr "" @@ -3152,6 +3197,10 @@ msgstr "" msgid "odd-length string" msgstr "stringa di lunghezza dispari" +#: extmod/ulab/code/ulab_create.c +msgid "offset is too large" +msgstr "" + #: py/objstr.c py/objstrunicode.c #, fuzzy msgid "offset out of bounds" @@ -3175,6 +3224,14 @@ msgstr "solo slice con step=1 (aka None) sono supportate" msgid "operands could not be broadcast together" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "operation is implemented for 1D Boolean arrays only" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "operation is not implemented for flattened array" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "" @@ -3312,6 +3369,10 @@ msgstr "importazione relativa" msgid "requested length %d but object has length %d" msgstr "lunghezza %d richiesta ma l'oggetto ha lunghezza %d" +#: extmod/ulab/code/ndarray_operators.c +msgid "results cannot be cast to specified type" +msgstr "" + #: py/compile.c msgid "return annotation must be an identifier" msgstr "" @@ -3330,8 +3391,8 @@ msgstr "" msgid "rgb_pins[%d] is not on the same port as clock" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "right hand side must be an ndarray, or a scalar" +#: extmod/ulab/code/numerical/numerical.c +msgid "roll argument must be an ndarray" msgstr "" #: py/objstr.c @@ -3359,7 +3420,7 @@ msgid "script compilation not supported" msgstr "compilazione dello scrip non suportata" #: extmod/ulab/code/ndarray.c -msgid "shape must be a 2-tuple" +msgid "shape must be a tuple" msgstr "" #: py/objstr.c @@ -3402,10 +3463,6 @@ msgstr "soft reboot\n" msgid "sort argument must be an ndarray" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "sorted axis can't be longer than 65535" -msgstr "" - #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" @@ -3513,6 +3570,10 @@ msgstr "" msgid "timestamp out of range for platform time_t" msgstr "timestamp è fuori intervallo per il time_t della piattaforma" +#: extmod/ulab/code/ndarray.c +msgid "tobytes can be invoked for dense arrays only" +msgstr "" + #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "troppi argomenti forniti con il formato specificato" @@ -3688,12 +3749,12 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "wrong argument type" +#: extmod/ulab/code/numerical/numerical.c +msgid "wrong axis index" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "wrong index type" +#: extmod/ulab/code/ulab_create.c +msgid "wrong axis specified" msgstr "" #: extmod/ulab/code/vector/vectorise.c diff --git a/locale/ja.po b/locale/ja.po index f3dfc6c900e2d..26025c19e4629 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-10 15:30+0530\n" +"POT-Creation-Date: 2020-11-23 10:10-0600\n" "PO-Revision-Date: 2020-11-12 22:51+0000\n" "Last-Translator: sporeball \n" "Language-Team: none\n" @@ -867,6 +867,10 @@ msgstr "" msgid "FFT is defined for ndarrays only" msgstr "FFTはndarrayでのみ使えます" +#: extmod/ulab/code/fft/fft.c +msgid "FFT is implemented for linear arrays only" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" msgstr "" @@ -1975,7 +1979,7 @@ msgstr "電圧読み取りがタイムアウト" msgid "WARNING: Your code filename has two extensions\n" msgstr "" -#: shared-bindings/watchdog/WatchDogTimer.c +#: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" @@ -2054,10 +2058,6 @@ msgstr "アドレスが範囲外" msgid "addresses is empty" msgstr "" -#: extmod/ulab/code/vector/vectorise.c -msgid "arctan2 is implemented for scalars and ndarrays only" -msgstr "" - #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "" @@ -2066,6 +2066,10 @@ msgstr "" msgid "argsort argument must be an ndarray" msgstr "argsortの引数はndarrayでなければなりません" +#: extmod/ulab/code/numerical/numerical.c +msgid "argsort is not implemented for flattened arrays" +msgstr "" + #: py/runtime.c msgid "argument has wrong type" msgstr "" @@ -2083,14 +2087,22 @@ msgstr "" msgid "argument should be a '%q' not a '%q'" msgstr "引数には '%q' が必要('%q' ではなく)" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c msgid "arguments must be ndarrays" msgstr "引数はndarrayでなければなりません" +#: extmod/ulab/code/ndarray.c +msgid "array and index length must be equal" +msgstr "" + #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "右辺にはarray/bytesが必要" +#: extmod/ulab/code/numerical/numerical.c +msgid "attempt to get (arg)min/(arg)max of empty sequence" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" msgstr "" @@ -2100,16 +2112,16 @@ msgid "attributes not supported yet" msgstr "属性は未対応です" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, None, or 1" -msgstr "axisは -1, 0, 1, None のいずれかでなければなりません" +msgid "axis is out of bounds" +msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, or 1" -msgstr "axisは -1, 0, 1 のいずれかでなければなりません" +msgid "axis must be None, or an integer" +msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be None, 0, or 1" -msgstr "axisは None, 0, 1 のいずれか" +msgid "axis too long" +msgstr "" #: py/builtinevex.c msgid "bad compile mode" @@ -2312,6 +2324,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "手動と自動のフィールド指定は混在できません" +#: extmod/ulab/code/ndarray_operators.c +msgid "cannot cast output with casting rule" +msgstr "" + #: py/objtype.c msgid "cannot create '%q' instances" msgstr "" @@ -2328,10 +2344,6 @@ msgstr "" msgid "cannot perform relative import" msgstr "相対インポートはできません" -#: extmod/ulab/code/ndarray.c -msgid "cannot reshape array (incompatible input/output shape)" -msgstr "入力/出力シェイプが互換でなくreshapeできません" - #: py/emitnative.c msgid "casting" msgstr "" @@ -2406,10 +2418,6 @@ msgstr "convolve引数はndarrayでなければなりません" msgid "convolve arguments must not be empty" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "could not broadast input array from shape" -msgstr "" - #: extmod/ulab/code/poly/poly.c msgid "could not invert Vandermonde matrix" msgstr "ヴァンデルモンド行列の逆行列を求められません" @@ -2418,6 +2426,10 @@ msgstr "ヴァンデルモンド行列の逆行列を求められません" msgid "couldn't determine SD card version" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "cross is defined for 1D arrays of length 3" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" msgstr "dataはイテレート可能でなければなりません" @@ -2426,10 +2438,6 @@ msgstr "dataはイテレート可能でなければなりません" msgid "data must be of equal length" msgstr "dataは同じ長さでなければなりません" -#: extmod/ulab/code/numerical/numerical.c -msgid "ddof must be smaller than length of data set" -msgstr "" - #: py/parsenum.c msgid "decimal numbers not supported" msgstr "" @@ -2461,6 +2469,10 @@ msgstr "" msgid "diff argument must be an ndarray" msgstr "引数はndarrayでなければなりません" +#: extmod/ulab/code/numerical/numerical.c +msgid "differentiation order out of range" +msgstr "" + #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c msgid "division by zero" @@ -2576,6 +2588,10 @@ msgstr "1つ目の引数は呼び出し可能でなければなりません" msgid "first argument must be a function" msgstr "1つ目の引数は関数でなければなりません" +#: extmod/ulab/code/ulab_create.c +msgid "first argument must be a tuple of ndarrays" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" msgstr "1つ目の引数はイテレート可能でなければなりません" @@ -2629,9 +2645,9 @@ msgstr "" msgid "function has the same sign at the ends of interval" msgstr "" -#: extmod/ulab/code/compare/compare.c -msgid "function is implemented for scalars and ndarrays only" -msgstr "スカラ値およびndarrayのみを受け取ります" +#: extmod/ulab/code/ndarray.c +msgid "function is defined for ndarrays only" +msgstr "" #: py/argcheck.c #, c-format @@ -2700,6 +2716,7 @@ msgstr "" msgid "index is out of bounds" msgstr "" +#: extmod/ulab/code/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "インデクスが範囲外" @@ -2725,6 +2742,10 @@ msgstr "" msgid "inline assembler must be a function" msgstr "インラインアセンブラは関数でなければなりません" +#: extmod/ulab/code/ndarray.c +msgid "input and output shapes are not compatible" +msgstr "" + #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" msgstr "" @@ -2733,6 +2754,10 @@ msgstr "" msgid "input array length must be power of 2" msgstr "入力array長は2の累乗でなければなりません" +#: extmod/ulab/code/ulab_create.c +msgid "input arrays are not compatible" +msgstr "" + #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" msgstr "" @@ -2745,6 +2770,22 @@ msgstr "入力行列が非対称" msgid "input matrix is singular" msgstr "入力が非正則行列" +#: extmod/ulab/code/user/user.c +msgid "input must be a dense ndarray" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input must be a tensor of rank 2" +msgstr "" + +#: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c +msgid "input must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "input must be one-dimensional" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" msgstr "入力は正方行列でなければなりません" @@ -2757,6 +2798,10 @@ msgstr "入力はtuple, list, range, ndarrayでなければなりません" msgid "input vectors must be of equal length" msgstr "" +#: extmod/ulab/code/poly/poly.c +msgid "inputs are not iterable" +msgstr "" + #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" msgstr "int()の第2引数は2以上36以下でなければなりません" @@ -2925,6 +2970,10 @@ msgstr "" msgid "max_length must be > 0" msgstr "max_lengthは0より大きくなければなりません" +#: extmod/ulab/code/ndarray.c +msgid "maximum number of dimensions is 4" +msgstr "" + #: py/runtime.c msgid "maximum recursion depth exceeded" msgstr "最大の再帰深度を超えました" @@ -2974,10 +3023,6 @@ msgstr "" msgid "must use keyword argument for key function" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "n must be between 0, and 9" -msgstr "nは0から9まで" - #: py/runtime.c msgid "name '%q' is not defined" msgstr "名前 '%q' は定義されていません" @@ -3060,6 +3105,10 @@ msgstr "*/** の後に非キーワード引数は置けません" msgid "non-keyword arg after keyword arg" msgstr "キーワード引数の後に非キーワード引数は置けません" +#: extmod/ulab/code/linalg/linalg.c +msgid "norm is defined for 1D and 2D arrays" +msgstr "" + #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "128ビットのUUIDではありません" @@ -3072,10 +3121,6 @@ msgstr "文字列書式化で全ての引数が使われていません" msgid "not enough arguments for format string" msgstr "書式化文字列への引数が足りません" -#: extmod/ulab/code/poly/poly.c -msgid "number of arguments must be 2, or 3" -msgstr "引数は2個または3個でなければなりません" - #: extmod/ulab/code/ulab_create.c msgid "number of points must be at least 2" msgstr "" @@ -3128,6 +3173,10 @@ msgstr "" msgid "odd-length string" msgstr "奇数長の文字列" +#: extmod/ulab/code/ulab_create.c +msgid "offset is too large" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" @@ -3150,6 +3199,14 @@ msgstr "" msgid "operands could not be broadcast together" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "operation is implemented for 1D Boolean arrays only" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "operation is not implemented for flattened array" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "この演算はndarray上で実装されていません" @@ -3286,6 +3343,10 @@ msgstr "相対インポート" msgid "requested length %d but object has length %d" msgstr "必要な長さは%dですがオブジェクトの長さは%d" +#: extmod/ulab/code/ndarray_operators.c +msgid "results cannot be cast to specified type" +msgstr "" + #: py/compile.c msgid "return annotation must be an identifier" msgstr "戻り値のアノテーションは識別子でなければなりません" @@ -3304,9 +3365,9 @@ msgstr "" msgid "rgb_pins[%d] is not on the same port as clock" msgstr "rgb_pins[%d]はクロックと同じポートではありません" -#: extmod/ulab/code/ndarray.c -msgid "right hand side must be an ndarray, or a scalar" -msgstr "右辺は ndarray またはスカラ値でなければなりません" +#: extmod/ulab/code/numerical/numerical.c +msgid "roll argument must be an ndarray" +msgstr "" #: py/objstr.c msgid "rsplit(None,n)" @@ -3332,8 +3393,8 @@ msgid "script compilation not supported" msgstr "スクリプトのコンパイルは非対応" #: extmod/ulab/code/ndarray.c -msgid "shape must be a 2-tuple" -msgstr "shapeは2値のタプルでなければなりません" +msgid "shape must be a tuple" +msgstr "" #: py/objstr.c msgid "sign not allowed in string format specifier" @@ -3375,10 +3436,6 @@ msgstr "ソフトリブート\n" msgid "sort argument must be an ndarray" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "sorted axis can't be longer than 65535" -msgstr "" - #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" @@ -3484,6 +3541,10 @@ msgstr "v2カードの待機がタイムアウトしました" msgid "timestamp out of range for platform time_t" msgstr "timestampがプラットフォームのtime_tの範囲外" +#: extmod/ulab/code/ndarray.c +msgid "tobytes can be invoked for dense arrays only" +msgstr "" + #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "指定された書式に対して引数が多すぎます" @@ -3659,13 +3720,13 @@ msgstr "" msgid "window must be <= interval" msgstr "windowはinterval以下でなければなりません" -#: extmod/ulab/code/linalg/linalg.c -msgid "wrong argument type" -msgstr "引数の型が不正" +#: extmod/ulab/code/numerical/numerical.c +msgid "wrong axis index" +msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "wrong index type" -msgstr "インデクスの型が不正" +#: extmod/ulab/code/ulab_create.c +msgid "wrong axis specified" +msgstr "" #: extmod/ulab/code/vector/vectorise.c msgid "wrong input type" @@ -3715,6 +3776,39 @@ msgstr "ziはfloat値でなければなりません" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "axis must be -1, 0, None, or 1" +#~ msgstr "axisは -1, 0, 1, None のいずれかでなければなりません" + +#~ msgid "axis must be -1, 0, or 1" +#~ msgstr "axisは -1, 0, 1 のいずれかでなければなりません" + +#~ msgid "axis must be None, 0, or 1" +#~ msgstr "axisは None, 0, 1 のいずれか" + +#~ msgid "cannot reshape array (incompatible input/output shape)" +#~ msgstr "入力/出力シェイプが互換でなくreshapeできません" + +#~ msgid "function is implemented for scalars and ndarrays only" +#~ msgstr "スカラ値およびndarrayのみを受け取ります" + +#~ msgid "n must be between 0, and 9" +#~ msgstr "nは0から9まで" + +#~ msgid "number of arguments must be 2, or 3" +#~ msgstr "引数は2個または3個でなければなりません" + +#~ msgid "right hand side must be an ndarray, or a scalar" +#~ msgstr "右辺は ndarray またはスカラ値でなければなりません" + +#~ msgid "shape must be a 2-tuple" +#~ msgstr "shapeは2値のタプルでなければなりません" + +#~ msgid "wrong argument type" +#~ msgstr "引数の型が不正" + +#~ msgid "wrong index type" +#~ msgstr "インデクスの型が不正" + #~ msgid "Must provide SCK pin" #~ msgstr "SCKピンが必要" diff --git a/locale/ko.po b/locale/ko.po index bfa49ab70c597..a7967210d3a7a 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-10 15:30+0530\n" +"POT-Creation-Date: 2020-11-23 10:10-0600\n" "PO-Revision-Date: 2020-10-05 12:12+0000\n" "Last-Translator: Michal Čihař \n" "Language-Team: LANGUAGE \n" @@ -859,6 +859,10 @@ msgstr "" msgid "FFT is defined for ndarrays only" msgstr "" +#: extmod/ulab/code/fft/fft.c +msgid "FFT is implemented for linear arrays only" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" msgstr "" @@ -1956,7 +1960,7 @@ msgstr "" msgid "WARNING: Your code filename has two extensions\n" msgstr "" -#: shared-bindings/watchdog/WatchDogTimer.c +#: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" @@ -2035,10 +2039,6 @@ msgstr "" msgid "addresses is empty" msgstr "" -#: extmod/ulab/code/vector/vectorise.c -msgid "arctan2 is implemented for scalars and ndarrays only" -msgstr "" - #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "" @@ -2047,6 +2047,10 @@ msgstr "" msgid "argsort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "argsort is not implemented for flattened arrays" +msgstr "" + #: py/runtime.c msgid "argument has wrong type" msgstr "" @@ -2064,14 +2068,22 @@ msgstr "" msgid "argument should be a '%q' not a '%q'" msgstr "" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c msgid "arguments must be ndarrays" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array and index length must be equal" +msgstr "" + #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "attempt to get (arg)min/(arg)max of empty sequence" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" msgstr "" @@ -2081,15 +2093,15 @@ msgid "attributes not supported yet" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, None, or 1" +msgid "axis is out of bounds" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, or 1" +msgid "axis must be None, or an integer" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be None, 0, or 1" +msgid "axis too long" msgstr "" #: py/builtinevex.c @@ -2293,6 +2305,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "" +#: extmod/ulab/code/ndarray_operators.c +msgid "cannot cast output with casting rule" +msgstr "" + #: py/objtype.c msgid "cannot create '%q' instances" msgstr "" @@ -2309,10 +2325,6 @@ msgstr "" msgid "cannot perform relative import" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "cannot reshape array (incompatible input/output shape)" -msgstr "" - #: py/emitnative.c msgid "casting" msgstr "" @@ -2385,10 +2397,6 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "could not broadast input array from shape" -msgstr "" - #: extmod/ulab/code/poly/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -2397,6 +2405,10 @@ msgstr "" msgid "couldn't determine SD card version" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "cross is defined for 1D arrays of length 3" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" msgstr "" @@ -2405,10 +2417,6 @@ msgstr "" msgid "data must be of equal length" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "ddof must be smaller than length of data set" -msgstr "" - #: py/parsenum.c msgid "decimal numbers not supported" msgstr "" @@ -2438,6 +2446,10 @@ msgstr "" msgid "diff argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "differentiation order out of range" +msgstr "" + #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c msgid "division by zero" @@ -2553,6 +2565,10 @@ msgstr "" msgid "first argument must be a function" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "first argument must be a tuple of ndarrays" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" msgstr "" @@ -2606,8 +2622,8 @@ msgstr "" msgid "function has the same sign at the ends of interval" msgstr "" -#: extmod/ulab/code/compare/compare.c -msgid "function is implemented for scalars and ndarrays only" +#: extmod/ulab/code/ndarray.c +msgid "function is defined for ndarrays only" msgstr "" #: py/argcheck.c @@ -2677,6 +2693,7 @@ msgstr "" msgid "index is out of bounds" msgstr "" +#: extmod/ulab/code/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "" @@ -2701,6 +2718,10 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "input and output shapes are not compatible" +msgstr "" + #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" msgstr "" @@ -2709,6 +2730,10 @@ msgstr "" msgid "input array length must be power of 2" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "input arrays are not compatible" +msgstr "" + #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" msgstr "" @@ -2721,6 +2746,22 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/user/user.c +msgid "input must be a dense ndarray" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input must be a tensor of rank 2" +msgstr "" + +#: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c +msgid "input must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "input must be one-dimensional" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" msgstr "" @@ -2733,6 +2774,10 @@ msgstr "" msgid "input vectors must be of equal length" msgstr "" +#: extmod/ulab/code/poly/poly.c +msgid "inputs are not iterable" +msgstr "" + #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" msgstr "" @@ -2901,6 +2946,10 @@ msgstr "" msgid "max_length must be > 0" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "maximum number of dimensions is 4" +msgstr "" + #: py/runtime.c msgid "maximum recursion depth exceeded" msgstr "" @@ -2950,10 +2999,6 @@ msgstr "" msgid "must use keyword argument for key function" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "n must be between 0, and 9" -msgstr "" - #: py/runtime.c msgid "name '%q' is not defined" msgstr "" @@ -3036,6 +3081,10 @@ msgstr "" msgid "non-keyword arg after keyword arg" msgstr "" +#: extmod/ulab/code/linalg/linalg.c +msgid "norm is defined for 1D and 2D arrays" +msgstr "" + #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "" @@ -3048,10 +3097,6 @@ msgstr "" msgid "not enough arguments for format string" msgstr "" -#: extmod/ulab/code/poly/poly.c -msgid "number of arguments must be 2, or 3" -msgstr "" - #: extmod/ulab/code/ulab_create.c msgid "number of points must be at least 2" msgstr "" @@ -3104,6 +3149,10 @@ msgstr "" msgid "odd-length string" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "offset is too large" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" @@ -3126,6 +3175,14 @@ msgstr "" msgid "operands could not be broadcast together" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "operation is implemented for 1D Boolean arrays only" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "operation is not implemented for flattened array" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "" @@ -3260,6 +3317,10 @@ msgstr "" msgid "requested length %d but object has length %d" msgstr "" +#: extmod/ulab/code/ndarray_operators.c +msgid "results cannot be cast to specified type" +msgstr "" + #: py/compile.c msgid "return annotation must be an identifier" msgstr "" @@ -3278,8 +3339,8 @@ msgstr "" msgid "rgb_pins[%d] is not on the same port as clock" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "right hand side must be an ndarray, or a scalar" +#: extmod/ulab/code/numerical/numerical.c +msgid "roll argument must be an ndarray" msgstr "" #: py/objstr.c @@ -3305,7 +3366,7 @@ msgid "script compilation not supported" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "shape must be a 2-tuple" +msgid "shape must be a tuple" msgstr "" #: py/objstr.c @@ -3348,10 +3409,6 @@ msgstr "" msgid "sort argument must be an ndarray" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "sorted axis can't be longer than 65535" -msgstr "" - #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" @@ -3457,6 +3514,10 @@ msgstr "" msgid "timestamp out of range for platform time_t" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "tobytes can be invoked for dense arrays only" +msgstr "" + #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "" @@ -3632,12 +3693,12 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "wrong argument type" +#: extmod/ulab/code/numerical/numerical.c +msgid "wrong axis index" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "wrong index type" +#: extmod/ulab/code/ulab_create.c +msgid "wrong axis specified" msgstr "" #: extmod/ulab/code/vector/vectorise.c diff --git a/locale/nl.po b/locale/nl.po index 7625cdb26bfdb..f9847fd81f8df 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-10 15:30+0530\n" +"POT-Creation-Date: 2020-11-23 10:10-0600\n" "PO-Revision-Date: 2020-10-27 16:47+0000\n" "Last-Translator: Jelle Jager \n" "Language-Team: none\n" @@ -867,6 +867,10 @@ msgstr "Extended advertisements met scan antwoord niet ondersteund." msgid "FFT is defined for ndarrays only" msgstr "FFT alleen voor ndarrays gedefineerd" +#: extmod/ulab/code/fft/fft.c +msgid "FFT is implemented for linear arrays only" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" msgstr "SSL handdruk mislukt" @@ -1997,7 +2001,7 @@ msgstr "Voltage lees time-out" msgid "WARNING: Your code filename has two extensions\n" msgstr "WAARSCHUWING: De bestandsnaam van de code heeft twee extensies\n" -#: shared-bindings/watchdog/WatchDogTimer.c +#: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" "WatchDogTimer kan niet worden gedeïnitialiseerd zodra de modus in ingesteld " @@ -2085,10 +2089,6 @@ msgstr "adres buiten bereik" msgid "addresses is empty" msgstr "adressen zijn leeg" -#: extmod/ulab/code/vector/vectorise.c -msgid "arctan2 is implemented for scalars and ndarrays only" -msgstr "arctan2 is alleen geïmplementeerd voor scalars en ndarrays" - #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "arg is een lege sequentie" @@ -2097,6 +2097,10 @@ msgstr "arg is een lege sequentie" msgid "argsort argument must be an ndarray" msgstr "argsort argument moet een ndarray zijn" +#: extmod/ulab/code/numerical/numerical.c +msgid "argsort is not implemented for flattened arrays" +msgstr "" + #: py/runtime.c msgid "argument has wrong type" msgstr "argument heeft onjuist type" @@ -2114,14 +2118,22 @@ msgstr "argument num/typen komen niet overeen" msgid "argument should be a '%q' not a '%q'" msgstr "argument moet een '%q' zijn en niet een '%q'" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c msgid "arguments must be ndarrays" msgstr "argumenten moeten ndarrays zijn" +#: extmod/ulab/code/ndarray.c +msgid "array and index length must be equal" +msgstr "" + #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "array/bytes vereist aan de rechterkant" +#: extmod/ulab/code/numerical/numerical.c +msgid "attempt to get (arg)min/(arg)max of empty sequence" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" msgstr "poging om argmin/argmax van een lege sequentie te krijgen" @@ -2131,16 +2143,16 @@ msgid "attributes not supported yet" msgstr "attributen nog niet ondersteund" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, None, or 1" -msgstr "as moet -1, 0, None, of 1 zijn" +msgid "axis is out of bounds" +msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, or 1" -msgstr "as moet -1, 0, of 1 zijn" +msgid "axis must be None, or an integer" +msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be None, 0, or 1" -msgstr "as moet None, 0, of 1 zijn" +msgid "axis too long" +msgstr "" #: py/builtinevex.c msgid "bad compile mode" @@ -2344,6 +2356,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "kan niet schakelen tussen handmatige en automatische veld specificatie" +#: extmod/ulab/code/ndarray_operators.c +msgid "cannot cast output with casting rule" +msgstr "" + #: py/objtype.c msgid "cannot create '%q' instances" msgstr "kan geen instanties van '%q' creëren" @@ -2360,10 +2376,6 @@ msgstr "kan naam %q niet importeren" msgid "cannot perform relative import" msgstr "kan geen relatieve import uitvoeren" -#: extmod/ulab/code/ndarray.c -msgid "cannot reshape array (incompatible input/output shape)" -msgstr "kan de array niet hervormen (niet verenigbare input/output vorm)" - #: py/emitnative.c msgid "casting" msgstr "casting" @@ -2437,10 +2449,6 @@ msgstr "convolutie argumenten moeten ndarrays zijn" msgid "convolve arguments must not be empty" msgstr "convolutie argumenten mogen niet leeg zijn" -#: extmod/ulab/code/ndarray.c -msgid "could not broadast input array from shape" -msgstr "kon de invoerarray niet vanuit vorm uitzenden" - #: extmod/ulab/code/poly/poly.c msgid "could not invert Vandermonde matrix" msgstr "kon de Vandermonde matrix niet omkeren" @@ -2449,6 +2457,10 @@ msgstr "kon de Vandermonde matrix niet omkeren" msgid "couldn't determine SD card version" msgstr "kon SD kaart versie niet bepalen" +#: extmod/ulab/code/numerical/numerical.c +msgid "cross is defined for 1D arrays of length 3" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" msgstr "data moet itereerbaar zijn" @@ -2457,10 +2469,6 @@ msgstr "data moet itereerbaar zijn" msgid "data must be of equal length" msgstr "data moet van gelijke lengte zijn" -#: extmod/ulab/code/numerical/numerical.c -msgid "ddof must be smaller than length of data set" -msgstr "ddof kleiner dan de lengte van de data set" - #: py/parsenum.c msgid "decimal numbers not supported" msgstr "decimale getallen zijn niet ondersteund" @@ -2492,6 +2500,10 @@ msgstr "dict update sequence heeft de verkeerde lengte" msgid "diff argument must be an ndarray" msgstr "diff argument moet een ndarray zijn" +#: extmod/ulab/code/numerical/numerical.c +msgid "differentiation order out of range" +msgstr "" + #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c msgid "division by zero" @@ -2607,6 +2619,10 @@ msgstr "eerste argument moet een aanroepbare (callable) zijn" msgid "first argument must be a function" msgstr "eerste argument moet een functie zijn" +#: extmod/ulab/code/ulab_create.c +msgid "first argument must be a tuple of ndarrays" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" msgstr "eerst argument moet een iterabel zijn" @@ -2660,9 +2676,9 @@ msgstr "functie kreeg meedere waarden voor argument '%q'" msgid "function has the same sign at the ends of interval" msgstr "functie heeft hetzelfde teken aan beide uiteinden van het interval" -#: extmod/ulab/code/compare/compare.c -msgid "function is implemented for scalars and ndarrays only" -msgstr "funtie is alleen geïmplementeerd voor scalars en ndarrays" +#: extmod/ulab/code/ndarray.c +msgid "function is defined for ndarrays only" +msgstr "" #: py/argcheck.c #, c-format @@ -2732,6 +2748,7 @@ msgstr "vulling (padding) is onjuist" msgid "index is out of bounds" msgstr "index is buiten bereik" +#: extmod/ulab/code/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "index is buiten bereik" @@ -2756,6 +2773,10 @@ msgstr "lengte van initial_value is onjuist" msgid "inline assembler must be a function" msgstr "inline assembler moet een functie zijn" +#: extmod/ulab/code/ndarray.c +msgid "input and output shapes are not compatible" +msgstr "" + #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" msgstr "invoerargument moet een integer of 2-tuple zijn" @@ -2764,6 +2785,10 @@ msgstr "invoerargument moet een integer of 2-tuple zijn" msgid "input array length must be power of 2" msgstr "invoer array lengte moet een macht van 2 zijn" +#: extmod/ulab/code/ulab_create.c +msgid "input arrays are not compatible" +msgstr "" + #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" msgstr "invoerdata moet itereerbaar zijn" @@ -2776,6 +2801,22 @@ msgstr "invoermatrix is asymmetrisch" msgid "input matrix is singular" msgstr "invoermatrix is singulier" +#: extmod/ulab/code/user/user.c +msgid "input must be a dense ndarray" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input must be a tensor of rank 2" +msgstr "" + +#: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c +msgid "input must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "input must be one-dimensional" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" msgstr "invoer moet een vierkante matrix zijn" @@ -2788,6 +2829,10 @@ msgstr "invoer moet een tuple, lijst, bereik of ndarray zijn" msgid "input vectors must be of equal length" msgstr "invoervectors moeten van gelijke lengte zijn" +#: extmod/ulab/code/poly/poly.c +msgid "inputs are not iterable" +msgstr "" + #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" msgstr "int() argument 2 moet >=2 en <= 36 zijn" @@ -2959,6 +3004,10 @@ msgstr "max_length moet 0-%d zijn als fixed_length %s is" msgid "max_length must be > 0" msgstr "max_length moet >0 zijn" +#: extmod/ulab/code/ndarray.c +msgid "maximum number of dimensions is 4" +msgstr "" + #: py/runtime.c msgid "maximum recursion depth exceeded" msgstr "maximale recursiediepte overschreden" @@ -3008,10 +3057,6 @@ msgstr "moet een object oproepen (raise)" msgid "must use keyword argument for key function" msgstr "voor sleutelfunctie moet een trefwoordargument gebruikt worden" -#: extmod/ulab/code/numerical/numerical.c -msgid "n must be between 0, and 9" -msgstr "n moet tussen 0 en 9 liggen" - #: py/runtime.c msgid "name '%q' is not defined" msgstr "naam '%q' is niet gedefinieerd" @@ -3094,6 +3139,10 @@ msgstr "niet-trefwoord argument na */**" msgid "non-keyword arg after keyword arg" msgstr "niet-trefwoord argument na trefwoord argument" +#: extmod/ulab/code/linalg/linalg.c +msgid "norm is defined for 1D and 2D arrays" +msgstr "" + #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "geen 128-bit UUID" @@ -3106,10 +3155,6 @@ msgstr "niet alle argumenten omgezet bij formattering van string" msgid "not enough arguments for format string" msgstr "niet genoeg argumenten om string te formatteren" -#: extmod/ulab/code/poly/poly.c -msgid "number of arguments must be 2, or 3" -msgstr "aantal argumenten moet 2 of 3 zijn" - #: extmod/ulab/code/ulab_create.c msgid "number of points must be at least 2" msgstr "aantal punten moet minimaal 2 zijn" @@ -3162,6 +3207,10 @@ msgstr "object met buffer protocol vereist" msgid "odd-length string" msgstr "string met oneven lengte" +#: extmod/ulab/code/ulab_create.c +msgid "offset is too large" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "offset buiten bereik" @@ -3184,6 +3233,14 @@ msgstr "alleen segmenten met step=1 (ook wel None) worden ondersteund" msgid "operands could not be broadcast together" msgstr "operands konden niet samen verzonden worden" +#: extmod/ulab/code/ndarray.c +msgid "operation is implemented for 1D Boolean arrays only" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "operation is not implemented for flattened array" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "bewerking is voor ndarrays niet geïmplementeerd" @@ -3319,6 +3376,10 @@ msgstr "relatieve import" msgid "requested length %d but object has length %d" msgstr "gevraagde lengte is %d maar object heeft lengte %d" +#: extmod/ulab/code/ndarray_operators.c +msgid "results cannot be cast to specified type" +msgstr "" + #: py/compile.c msgid "return annotation must be an identifier" msgstr "return annotatie moet een identifier zijn" @@ -3337,9 +3398,9 @@ msgstr "rgb_pins[%d] is hetzelfde als een andere pintoewijzing" msgid "rgb_pins[%d] is not on the same port as clock" msgstr "rgb_pins[%d] bevindt zich niet op dezelfde poort als klok" -#: extmod/ulab/code/ndarray.c -msgid "right hand side must be an ndarray, or a scalar" -msgstr "de rechterkant moet een ndarray of scalar zijn" +#: extmod/ulab/code/numerical/numerical.c +msgid "roll argument must be an ndarray" +msgstr "" #: py/objstr.c msgid "rsplit(None,n)" @@ -3366,8 +3427,8 @@ msgid "script compilation not supported" msgstr "scriptcompilatie wordt niet ondersteund" #: extmod/ulab/code/ndarray.c -msgid "shape must be a 2-tuple" -msgstr "vorm moet een 2-tuple zijn" +msgid "shape must be a tuple" +msgstr "" #: py/objstr.c msgid "sign not allowed in string format specifier" @@ -3409,10 +3470,6 @@ msgstr "zachte herstart\n" msgid "sort argument must be an ndarray" msgstr "sorteerargument moet een ndarray zijn" -#: extmod/ulab/code/numerical/numerical.c -msgid "sorted axis can't be longer than 65535" -msgstr "" - #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "sos array moet vorm (n_section, 6) hebben" @@ -3518,6 +3575,10 @@ msgstr "timeout bij wachten op v2 kaart" msgid "timestamp out of range for platform time_t" msgstr "timestamp buiten bereik voor platform time_t" +#: extmod/ulab/code/ndarray.c +msgid "tobytes can be invoked for dense arrays only" +msgstr "" + #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "te veel argumenten opgegeven bij dit formaat" @@ -3693,13 +3754,13 @@ msgstr "breedte moet groter dan nul zijn" msgid "window must be <= interval" msgstr "window moet <= interval zijn" -#: extmod/ulab/code/linalg/linalg.c -msgid "wrong argument type" -msgstr "onjuist argumenttype" +#: extmod/ulab/code/numerical/numerical.c +msgid "wrong axis index" +msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "wrong index type" -msgstr "onjuist indextype" +#: extmod/ulab/code/ulab_create.c +msgid "wrong axis specified" +msgstr "" #: extmod/ulab/code/vector/vectorise.c msgid "wrong input type" @@ -3749,6 +3810,48 @@ msgstr "zi moet van type float zijn" msgid "zi must be of shape (n_section, 2)" msgstr "zi moet vorm (n_section, 2) hebben" +#~ msgid "arctan2 is implemented for scalars and ndarrays only" +#~ msgstr "arctan2 is alleen geïmplementeerd voor scalars en ndarrays" + +#~ msgid "axis must be -1, 0, None, or 1" +#~ msgstr "as moet -1, 0, None, of 1 zijn" + +#~ msgid "axis must be -1, 0, or 1" +#~ msgstr "as moet -1, 0, of 1 zijn" + +#~ msgid "axis must be None, 0, or 1" +#~ msgstr "as moet None, 0, of 1 zijn" + +#~ msgid "cannot reshape array (incompatible input/output shape)" +#~ msgstr "kan de array niet hervormen (niet verenigbare input/output vorm)" + +#~ msgid "could not broadast input array from shape" +#~ msgstr "kon de invoerarray niet vanuit vorm uitzenden" + +#~ msgid "ddof must be smaller than length of data set" +#~ msgstr "ddof kleiner dan de lengte van de data set" + +#~ msgid "function is implemented for scalars and ndarrays only" +#~ msgstr "funtie is alleen geïmplementeerd voor scalars en ndarrays" + +#~ msgid "n must be between 0, and 9" +#~ msgstr "n moet tussen 0 en 9 liggen" + +#~ msgid "number of arguments must be 2, or 3" +#~ msgstr "aantal argumenten moet 2 of 3 zijn" + +#~ msgid "right hand side must be an ndarray, or a scalar" +#~ msgstr "de rechterkant moet een ndarray of scalar zijn" + +#~ msgid "shape must be a 2-tuple" +#~ msgstr "vorm moet een 2-tuple zijn" + +#~ msgid "wrong argument type" +#~ msgstr "onjuist argumenttype" + +#~ msgid "wrong index type" +#~ msgstr "onjuist indextype" + #~ msgid "Must provide SCK pin" #~ msgstr "SCK pin moet opgegeven worden" diff --git a/locale/pl.po b/locale/pl.po index f04887e6824d3..1873af488f455 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-10 15:30+0530\n" +"POT-Creation-Date: 2020-11-23 10:10-0600\n" "PO-Revision-Date: 2020-11-11 19:13+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" @@ -867,6 +867,10 @@ msgstr "" msgid "FFT is defined for ndarrays only" msgstr "" +#: extmod/ulab/code/fft/fft.c +msgid "FFT is implemented for linear arrays only" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" msgstr "" @@ -1966,7 +1970,7 @@ msgstr "" msgid "WARNING: Your code filename has two extensions\n" msgstr "UWAGA: Nazwa pliku ma dwa rozszerzenia\n" -#: shared-bindings/watchdog/WatchDogTimer.c +#: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" @@ -2051,10 +2055,6 @@ msgstr "adres poza zakresem" msgid "addresses is empty" msgstr "adres jest pusty" -#: extmod/ulab/code/vector/vectorise.c -msgid "arctan2 is implemented for scalars and ndarrays only" -msgstr "" - #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "arg jest puste" @@ -2063,6 +2063,10 @@ msgstr "arg jest puste" msgid "argsort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "argsort is not implemented for flattened arrays" +msgstr "" + #: py/runtime.c msgid "argument has wrong type" msgstr "argument ma zły typ" @@ -2080,14 +2084,22 @@ msgstr "zła liczba lub typ argumentów" msgid "argument should be a '%q' not a '%q'" msgstr "argument powinien być '%q' a nie '%q'" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c msgid "arguments must be ndarrays" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array and index length must be equal" +msgstr "" + #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "tablica/bytes wymagane po prawej stronie" +#: extmod/ulab/code/numerical/numerical.c +msgid "attempt to get (arg)min/(arg)max of empty sequence" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" msgstr "" @@ -2097,15 +2109,15 @@ msgid "attributes not supported yet" msgstr "atrybuty nie są jeszcze obsługiwane" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, None, or 1" +msgid "axis is out of bounds" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, or 1" +msgid "axis must be None, or an integer" msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be None, 0, or 1" +msgid "axis too long" msgstr "" #: py/builtinevex.c @@ -2309,6 +2321,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "nie można zmienić z ręcznego numerowaniu pól do automatycznego" +#: extmod/ulab/code/ndarray_operators.c +msgid "cannot cast output with casting rule" +msgstr "" + #: py/objtype.c msgid "cannot create '%q' instances" msgstr "nie można tworzyć instancji '%q'" @@ -2325,10 +2341,6 @@ msgstr "nie można zaimportować nazwy %q" msgid "cannot perform relative import" msgstr "nie można wykonać relatywnego importu" -#: extmod/ulab/code/ndarray.c -msgid "cannot reshape array (incompatible input/output shape)" -msgstr "" - #: py/emitnative.c msgid "casting" msgstr "rzutowanie" @@ -2401,10 +2413,6 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "could not broadast input array from shape" -msgstr "" - #: extmod/ulab/code/poly/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -2413,6 +2421,10 @@ msgstr "" msgid "couldn't determine SD card version" msgstr "nie można określić wersji karty SD" +#: extmod/ulab/code/numerical/numerical.c +msgid "cross is defined for 1D arrays of length 3" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" msgstr "" @@ -2421,10 +2433,6 @@ msgstr "" msgid "data must be of equal length" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "ddof must be smaller than length of data set" -msgstr "" - #: py/parsenum.c msgid "decimal numbers not supported" msgstr "liczby dziesiętne nieobsługiwane" @@ -2455,6 +2463,10 @@ msgstr "sekwencja ma złą długość" msgid "diff argument must be an ndarray" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "differentiation order out of range" +msgstr "" + #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c msgid "division by zero" @@ -2570,6 +2582,10 @@ msgstr "" msgid "first argument must be a function" msgstr "pierwszy argument musi być funkcją" +#: extmod/ulab/code/ulab_create.c +msgid "first argument must be a tuple of ndarrays" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" msgstr "pierwszy argument musi być iterowalny" @@ -2623,8 +2639,8 @@ msgstr "funkcja dostała wiele wartości dla argumentu '%q'" msgid "function has the same sign at the ends of interval" msgstr "" -#: extmod/ulab/code/compare/compare.c -msgid "function is implemented for scalars and ndarrays only" +#: extmod/ulab/code/ndarray.c +msgid "function is defined for ndarrays only" msgstr "" #: py/argcheck.c @@ -2694,6 +2710,7 @@ msgstr "złe wypełnienie" msgid "index is out of bounds" msgstr "indeks jest poza zakresem" +#: extmod/ulab/code/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "indeks poza zakresem" @@ -2718,6 +2735,10 @@ msgstr "długość initial_value jest nieprawidłowa" msgid "inline assembler must be a function" msgstr "wtrącony asembler musi być funkcją" +#: extmod/ulab/code/ndarray.c +msgid "input and output shapes are not compatible" +msgstr "" + #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" msgstr "" @@ -2726,6 +2747,10 @@ msgstr "" msgid "input array length must be power of 2" msgstr "długość tablicy wejściowej musi być potęgą 2" +#: extmod/ulab/code/ulab_create.c +msgid "input arrays are not compatible" +msgstr "" + #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" msgstr "" @@ -2738,6 +2763,22 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/user/user.c +msgid "input must be a dense ndarray" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input must be a tensor of rank 2" +msgstr "" + +#: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c +msgid "input must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "input must be one-dimensional" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" msgstr "wejście musi być macierzą kwadratową" @@ -2750,6 +2791,10 @@ msgstr "" msgid "input vectors must be of equal length" msgstr "wektory wejściowe muszą być równej długości" +#: extmod/ulab/code/poly/poly.c +msgid "inputs are not iterable" +msgstr "" + #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" msgstr "argument 2 do int() busi być pomiędzy 2 a 36" @@ -2918,6 +2963,10 @@ msgstr "" msgid "max_length must be > 0" msgstr "max_length musi być > 0" +#: extmod/ulab/code/ndarray.c +msgid "maximum number of dimensions is 4" +msgstr "" + #: py/runtime.c msgid "maximum recursion depth exceeded" msgstr "przekroczono dozwoloną głębokość rekurencji" @@ -2967,10 +3016,6 @@ msgstr "wyjątek musi być obiektem" msgid "must use keyword argument for key function" msgstr "funkcja key musi być podana jako argument nazwany" -#: extmod/ulab/code/numerical/numerical.c -msgid "n must be between 0, and 9" -msgstr "" - #: py/runtime.c msgid "name '%q' is not defined" msgstr "nazwa '%q' niezdefiniowana" @@ -3053,6 +3098,10 @@ msgstr "argument nienazwany po */**" msgid "non-keyword arg after keyword arg" msgstr "argument nienazwany po nazwanym" +#: extmod/ulab/code/linalg/linalg.c +msgid "norm is defined for 1D and 2D arrays" +msgstr "" + #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "to nie jest 128-bitowy UUID" @@ -3065,10 +3114,6 @@ msgstr "nie wszystkie argumenty wykorzystane w formatowaniu" msgid "not enough arguments for format string" msgstr "nie dość argumentów przy formatowaniu" -#: extmod/ulab/code/poly/poly.c -msgid "number of arguments must be 2, or 3" -msgstr "liczba argumentów musi wynosić 2 lub 3" - #: extmod/ulab/code/ulab_create.c msgid "number of points must be at least 2" msgstr "liczba punktów musi wynosić co najmniej 2" @@ -3121,6 +3166,10 @@ msgstr "wymagany obiekt z protokołem buforu" msgid "odd-length string" msgstr "łańcuch o nieparzystej długości" +#: extmod/ulab/code/ulab_create.c +msgid "offset is too large" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "offset poza zakresem" @@ -3143,6 +3192,14 @@ msgstr "tylko fragmenty ze step=1 (lub None) są wspierane" msgid "operands could not be broadcast together" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "operation is implemented for 1D Boolean arrays only" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "operation is not implemented for flattened array" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "" @@ -3278,6 +3335,10 @@ msgstr "relatywny import" msgid "requested length %d but object has length %d" msgstr "zażądano długości %d ale obiekt ma długość %d" +#: extmod/ulab/code/ndarray_operators.c +msgid "results cannot be cast to specified type" +msgstr "" + #: py/compile.c msgid "return annotation must be an identifier" msgstr "anotacja wartości musi być identyfikatorem" @@ -3296,8 +3357,8 @@ msgstr "" msgid "rgb_pins[%d] is not on the same port as clock" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "right hand side must be an ndarray, or a scalar" +#: extmod/ulab/code/numerical/numerical.c +msgid "roll argument must be an ndarray" msgstr "" #: py/objstr.c @@ -3324,7 +3385,7 @@ msgid "script compilation not supported" msgstr "kompilowanie skryptów nieobsługiwane" #: extmod/ulab/code/ndarray.c -msgid "shape must be a 2-tuple" +msgid "shape must be a tuple" msgstr "" #: py/objstr.c @@ -3367,10 +3428,6 @@ msgstr "programowy reset\n" msgid "sort argument must be an ndarray" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "sorted axis can't be longer than 65535" -msgstr "" - #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "" @@ -3476,6 +3533,10 @@ msgstr "" msgid "timestamp out of range for platform time_t" msgstr "timestamp poza zakresem dla time_t na tej platformie" +#: extmod/ulab/code/ndarray.c +msgid "tobytes can be invoked for dense arrays only" +msgstr "" + #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "zbyt wiele argumentów podanych dla tego formatu" @@ -3651,13 +3712,13 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "wrong argument type" -msgstr "zły typ argumentu" +#: extmod/ulab/code/numerical/numerical.c +msgid "wrong axis index" +msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "wrong index type" -msgstr "zły typ indeksu" +#: extmod/ulab/code/ulab_create.c +msgid "wrong axis specified" +msgstr "" #: extmod/ulab/code/vector/vectorise.c msgid "wrong input type" @@ -3707,6 +3768,15 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "number of arguments must be 2, or 3" +#~ msgstr "liczba argumentów musi wynosić 2 lub 3" + +#~ msgid "wrong argument type" +#~ msgstr "zły typ argumentu" + +#~ msgid "wrong index type" +#~ msgstr "zły typ indeksu" + #~ msgid "Must provide SCK pin" #~ msgstr "Należy podać pin SCK" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 4cf204ae81c22..baa125f1d16cd 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-10 15:30+0530\n" +"POT-Creation-Date: 2020-11-23 10:10-0600\n" "PO-Revision-Date: 2020-11-18 00:28+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -876,6 +876,10 @@ msgstr "Anúncios estendidos não compatíveis com a resposta da varredura." msgid "FFT is defined for ndarrays only" msgstr "O FFT é definido apenas para ndarrays" +#: extmod/ulab/code/fft/fft.c +msgid "FFT is implemented for linear arrays only" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" msgstr "Houve uma falha no handshake do SSL" @@ -2011,7 +2015,7 @@ msgstr "O tempo limite de leitura da tensão expirou" msgid "WARNING: Your code filename has two extensions\n" msgstr "AVISO: Seu arquivo de código tem duas extensões\n" -#: shared-bindings/watchdog/WatchDogTimer.c +#: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" "O WatchDogTimer não pode ser não-inicializado uma vez que o modo é definido " @@ -2100,10 +2104,6 @@ msgstr "endereço fora dos limites" msgid "addresses is empty" msgstr "os endereços estão vazios" -#: extmod/ulab/code/vector/vectorise.c -msgid "arctan2 is implemented for scalars and ndarrays only" -msgstr "O arctan2 está implementado apenas para escalares e ndarrays" - #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "o arg é uma sequência vazia" @@ -2112,6 +2112,10 @@ msgstr "o arg é uma sequência vazia" msgid "argsort argument must be an ndarray" msgstr "O argumento argsort deve ser um ndarray" +#: extmod/ulab/code/numerical/numerical.c +msgid "argsort is not implemented for flattened arrays" +msgstr "" + #: py/runtime.c msgid "argument has wrong type" msgstr "argumento tem tipo errado" @@ -2129,14 +2133,22 @@ msgstr "o argumento num/tipos não combinam" msgid "argument should be a '%q' not a '%q'" msgstr "o argumento deve ser um '%q' e não um '%q'" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c msgid "arguments must be ndarrays" msgstr "os argumentos devem ser ndarrays" +#: extmod/ulab/code/ndarray.c +msgid "array and index length must be equal" +msgstr "" + #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "matriz/bytes são necessários no lado direito" +#: extmod/ulab/code/numerical/numerical.c +msgid "attempt to get (arg)min/(arg)max of empty sequence" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" msgstr "tente obter argmin/argmax de uma sequência vazia" @@ -2146,16 +2158,16 @@ msgid "attributes not supported yet" msgstr "atributos ainda não suportados" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, None, or 1" -msgstr "o eixo deve ser -1, 0, Nenhum ou 1" +msgid "axis is out of bounds" +msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, or 1" -msgstr "o eixo deve ser -1, 0 ou 1" +msgid "axis must be None, or an integer" +msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be None, 0, or 1" -msgstr "o eixo deve ser Nenhum, 0 ou 1" +msgid "axis too long" +msgstr "" #: py/builtinevex.c msgid "bad compile mode" @@ -2362,6 +2374,10 @@ msgid "" msgstr "" "não é possível alternar da especificação de campo manual para a automática" +#: extmod/ulab/code/ndarray_operators.c +msgid "cannot cast output with casting rule" +msgstr "" + #: py/objtype.c msgid "cannot create '%q' instances" msgstr "não é possível criar instâncias '%q'" @@ -2378,11 +2394,6 @@ msgstr "não pode importar nome %q" msgid "cannot perform relative import" msgstr "não pode executar a importação relativa" -#: extmod/ulab/code/ndarray.c -msgid "cannot reshape array (incompatible input/output shape)" -msgstr "" -"não é possível remodelar a matriz (formato de entrada/saída incompatível)" - #: py/emitnative.c msgid "casting" msgstr "fundição" @@ -2457,10 +2468,6 @@ msgstr "os argumentos convolutivos devem ser ndarrays" msgid "convolve arguments must not be empty" msgstr "os argumentos convolutivos não devem estar vazios" -#: extmod/ulab/code/ndarray.c -msgid "could not broadast input array from shape" -msgstr "não foi possível transmitir a matriz da entrada a partir da forma" - #: extmod/ulab/code/poly/poly.c msgid "could not invert Vandermonde matrix" msgstr "não foi possível inverter a matriz Vandermonde" @@ -2469,6 +2476,10 @@ msgstr "não foi possível inverter a matriz Vandermonde" msgid "couldn't determine SD card version" msgstr "não foi possível determinar a versão do cartão SD" +#: extmod/ulab/code/numerical/numerical.c +msgid "cross is defined for 1D arrays of length 3" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" msgstr "os dados devem ser iteráveis" @@ -2477,10 +2488,6 @@ msgstr "os dados devem ser iteráveis" msgid "data must be of equal length" msgstr "os dados devem ser de igual comprimento" -#: extmod/ulab/code/numerical/numerical.c -msgid "ddof must be smaller than length of data set" -msgstr "O ddof deve ser menor que o comprimento do conjunto dos dados" - #: py/parsenum.c msgid "decimal numbers not supported" msgstr "os números decimais não são compatíveis" @@ -2513,6 +2520,10 @@ msgstr "sequência da atualização dict tem o comprimento errado" msgid "diff argument must be an ndarray" msgstr "O argumento diff deve ser um ndarray" +#: extmod/ulab/code/numerical/numerical.c +msgid "differentiation order out of range" +msgstr "" + #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c msgid "division by zero" @@ -2628,6 +2639,10 @@ msgstr "o primeiro argumento deve ser chamável" msgid "first argument must be a function" msgstr "o primeiro argumento deve ser uma função" +#: extmod/ulab/code/ulab_create.c +msgid "first argument must be a tuple of ndarrays" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" msgstr "o primeiro argumento deve ser um iterável" @@ -2681,9 +2696,9 @@ msgstr "A função obteve vários valores para o argumento '%q'" msgid "function has the same sign at the ends of interval" msgstr "a função tem o mesmo sinal nas extremidades do intervalo" -#: extmod/ulab/code/compare/compare.c -msgid "function is implemented for scalars and ndarrays only" -msgstr "A função foi implementada apenas para escalares e ndarrays" +#: extmod/ulab/code/ndarray.c +msgid "function is defined for ndarrays only" +msgstr "" #: py/argcheck.c #, c-format @@ -2752,6 +2767,7 @@ msgstr "preenchimento incorreto" msgid "index is out of bounds" msgstr "o índice está fora dos limites" +#: extmod/ulab/code/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "Índice fora do intervalo" @@ -2776,6 +2792,10 @@ msgstr "O comprimento do initial_value está errado" msgid "inline assembler must be a function" msgstr "o assembler em linha deve ser uma função" +#: extmod/ulab/code/ndarray.c +msgid "input and output shapes are not compatible" +msgstr "" + #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" msgstr "o argumento da entrada deve ser um número inteiro ou uma tupla de 2" @@ -2784,6 +2804,10 @@ msgstr "o argumento da entrada deve ser um número inteiro ou uma tupla de 2" msgid "input array length must be power of 2" msgstr "comprimento da matriz da entrada deve ter potência de 2" +#: extmod/ulab/code/ulab_create.c +msgid "input arrays are not compatible" +msgstr "" + #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" msgstr "os dados da entrada devem ser iteráveis" @@ -2796,6 +2820,22 @@ msgstr "a matriz da entrada é assimétrica" msgid "input matrix is singular" msgstr "a matriz da entrada é singular" +#: extmod/ulab/code/user/user.c +msgid "input must be a dense ndarray" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input must be a tensor of rank 2" +msgstr "" + +#: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c +msgid "input must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "input must be one-dimensional" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" msgstr "a entrada deve ser uma matriz quadrada" @@ -2808,6 +2848,10 @@ msgstr "A entrada deve ser tupla, lista, intervalo ou matriz" msgid "input vectors must be of equal length" msgstr "os vetores da entrada devem ter o mesmo comprimento" +#: extmod/ulab/code/poly/poly.c +msgid "inputs are not iterable" +msgstr "" + #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" msgstr "int() arg 2 deve ser >= 2 e <= 36" @@ -2979,6 +3023,10 @@ msgstr "o max_length deve ser 0-%d quando Fixed_length for %s" msgid "max_length must be > 0" msgstr "max_length deve ser > 0" +#: extmod/ulab/code/ndarray.c +msgid "maximum number of dimensions is 4" +msgstr "" + #: py/runtime.c msgid "maximum recursion depth exceeded" msgstr "a recursão máxima da profundidade foi excedida" @@ -3030,10 +3078,6 @@ msgstr "deve levantar um objeto" msgid "must use keyword argument for key function" msgstr "deve usar o argumento da palavra-chave para a função da chave" -#: extmod/ulab/code/numerical/numerical.c -msgid "n must be between 0, and 9" -msgstr "n deve estar entre 0 e 9" - #: py/runtime.c msgid "name '%q' is not defined" msgstr "o nome '%q' não está definido" @@ -3116,6 +3160,10 @@ msgstr "um arg sem palavra-chave após */ **" msgid "non-keyword arg after keyword arg" msgstr "um arg não-palavra-chave após a palavra-chave arg" +#: extmod/ulab/code/linalg/linalg.c +msgid "norm is defined for 1D and 2D arrays" +msgstr "" + #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "não é um UUID com 128 bits" @@ -3128,10 +3176,6 @@ msgstr "nem todos os argumentos são convertidos durante a formatação da strin msgid "not enough arguments for format string" msgstr "argumentos insuficientes para o formato da string" -#: extmod/ulab/code/poly/poly.c -msgid "number of arguments must be 2, or 3" -msgstr "a quantidade dos argumentos deve ser 2 ou 3" - #: extmod/ulab/code/ulab_create.c msgid "number of points must be at least 2" msgstr "a quantidade dos pontos deve ser pelo menos 2" @@ -3184,6 +3228,10 @@ msgstr "é necessário objeto com protocolo do buffer" msgid "odd-length string" msgstr "sequência com comprimento ímpar" +#: extmod/ulab/code/ulab_create.c +msgid "offset is too large" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "desvio fora dos limites" @@ -3207,6 +3255,14 @@ msgstr "" msgid "operands could not be broadcast together" msgstr "os operandos não puderam ser transmitidos juntos" +#: extmod/ulab/code/ndarray.c +msgid "operation is implemented for 1D Boolean arrays only" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "operation is not implemented for flattened array" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "a operação não foi implementada nos ndarrays" @@ -3345,6 +3401,10 @@ msgstr "importação relativa" msgid "requested length %d but object has length %d" msgstr "o comprimento solicitado %d, porém o objeto tem comprimento %d" +#: extmod/ulab/code/ndarray_operators.c +msgid "results cannot be cast to specified type" +msgstr "" + #: py/compile.c msgid "return annotation must be an identifier" msgstr "a anotação do retorno deve ser um identificador" @@ -3363,9 +3423,9 @@ msgstr "rgb_pins[%d] duplica outra atribuição dos pinos" msgid "rgb_pins[%d] is not on the same port as clock" msgstr "rgb_pins[%d] não está na mesma porta que o clock" -#: extmod/ulab/code/ndarray.c -msgid "right hand side must be an ndarray, or a scalar" -msgstr "o lado direito deve ser um ndarray ou um escalar" +#: extmod/ulab/code/numerical/numerical.c +msgid "roll argument must be an ndarray" +msgstr "" #: py/objstr.c msgid "rsplit(None,n)" @@ -3392,8 +3452,8 @@ msgid "script compilation not supported" msgstr "compilação de script não suportada" #: extmod/ulab/code/ndarray.c -msgid "shape must be a 2-tuple" -msgstr "a forma deve ser uma tupla de 2" +msgid "shape must be a tuple" +msgstr "" #: py/objstr.c msgid "sign not allowed in string format specifier" @@ -3435,10 +3495,6 @@ msgstr "reinicialização soft\n" msgid "sort argument must be an ndarray" msgstr "o argumento da classificação deve ser um ndarray" -#: extmod/ulab/code/numerical/numerical.c -msgid "sorted axis can't be longer than 65535" -msgstr "o eixo ordenado não pode ser maior do que 65535" - #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "o sos da matriz deve estar na forma (n_section, 6)" @@ -3544,6 +3600,10 @@ msgstr "o tempo limite na espera pelo cartão v2" msgid "timestamp out of range for platform time_t" msgstr "timestamp fora do intervalo para a plataforma time_t" +#: extmod/ulab/code/ndarray.c +msgid "tobytes can be invoked for dense arrays only" +msgstr "" + #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "Muitos argumentos fornecidos com o formato dado" @@ -3719,13 +3779,13 @@ msgstr "a largura deve ser maior que zero" msgid "window must be <= interval" msgstr "a janela deve ser <= intervalo" -#: extmod/ulab/code/linalg/linalg.c -msgid "wrong argument type" -msgstr "tipo do argumento errado" +#: extmod/ulab/code/numerical/numerical.c +msgid "wrong axis index" +msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "wrong index type" -msgstr "tipo do índice errado" +#: extmod/ulab/code/ulab_create.c +msgid "wrong axis specified" +msgstr "" #: extmod/ulab/code/vector/vectorise.c msgid "wrong input type" @@ -3775,6 +3835,52 @@ msgstr "zi deve ser de um tipo float" msgid "zi must be of shape (n_section, 2)" msgstr "zi deve estar na forma (n_section, 2)" +#~ msgid "arctan2 is implemented for scalars and ndarrays only" +#~ msgstr "O arctan2 está implementado apenas para escalares e ndarrays" + +#~ msgid "axis must be -1, 0, None, or 1" +#~ msgstr "o eixo deve ser -1, 0, Nenhum ou 1" + +#~ msgid "axis must be -1, 0, or 1" +#~ msgstr "o eixo deve ser -1, 0 ou 1" + +#~ msgid "axis must be None, 0, or 1" +#~ msgstr "o eixo deve ser Nenhum, 0 ou 1" + +#~ msgid "cannot reshape array (incompatible input/output shape)" +#~ msgstr "" +#~ "não é possível remodelar a matriz (formato de entrada/saída incompatível)" + +#~ msgid "could not broadast input array from shape" +#~ msgstr "não foi possível transmitir a matriz da entrada a partir da forma" + +#~ msgid "ddof must be smaller than length of data set" +#~ msgstr "O ddof deve ser menor que o comprimento do conjunto dos dados" + +#~ msgid "function is implemented for scalars and ndarrays only" +#~ msgstr "A função foi implementada apenas para escalares e ndarrays" + +#~ msgid "n must be between 0, and 9" +#~ msgstr "n deve estar entre 0 e 9" + +#~ msgid "number of arguments must be 2, or 3" +#~ msgstr "a quantidade dos argumentos deve ser 2 ou 3" + +#~ msgid "right hand side must be an ndarray, or a scalar" +#~ msgstr "o lado direito deve ser um ndarray ou um escalar" + +#~ msgid "shape must be a 2-tuple" +#~ msgstr "a forma deve ser uma tupla de 2" + +#~ msgid "sorted axis can't be longer than 65535" +#~ msgstr "o eixo ordenado não pode ser maior do que 65535" + +#~ msgid "wrong argument type" +#~ msgstr "tipo do argumento errado" + +#~ msgid "wrong index type" +#~ msgstr "tipo do índice errado" + #~ msgid "specify size or data, but not both" #~ msgstr "defina o tamanho ou os dados, porém não ambos" diff --git a/locale/sv.po b/locale/sv.po index cc6fe8ad00003..02847044fb56d 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-10 15:30+0530\n" +"POT-Creation-Date: 2020-11-23 10:10-0600\n" "PO-Revision-Date: 2020-11-20 22:28+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -867,6 +867,10 @@ msgstr "Utökad annonsering i kombination med skanningssvar stöds inte." msgid "FFT is defined for ndarrays only" msgstr "FFT är enbart definierade för ndarrays" +#: extmod/ulab/code/fft/fft.c +msgid "FFT is implemented for linear arrays only" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" msgstr "Misslyckad SSL-handskakning" @@ -1993,7 +1997,7 @@ msgstr "Avläsning av spänning tog för lång tid" msgid "WARNING: Your code filename has two extensions\n" msgstr "VARNING: Ditt filnamn för kod har två tillägg\n" -#: shared-bindings/watchdog/WatchDogTimer.c +#: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "WatchDogTimer kan inte avinitialiseras när läget är inställt på RESET" @@ -2078,10 +2082,6 @@ msgstr "adress utanför gränsen" msgid "addresses is empty" msgstr "adresserna är tomma" -#: extmod/ulab/code/vector/vectorise.c -msgid "arctan2 is implemented for scalars and ndarrays only" -msgstr "arctan2 är enbart implementerad för scalar och ndarray" - #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "arg är en tom sekvens" @@ -2090,6 +2090,10 @@ msgstr "arg är en tom sekvens" msgid "argsort argument must be an ndarray" msgstr "argumentet argsort måste vara en ndarray" +#: extmod/ulab/code/numerical/numerical.c +msgid "argsort is not implemented for flattened arrays" +msgstr "" + #: py/runtime.c msgid "argument has wrong type" msgstr "argumentet har fel typ" @@ -2107,14 +2111,22 @@ msgstr "argument antal/typ matchar inte" msgid "argument should be a '%q' not a '%q'" msgstr "argumentet skall vara en '%q', inte en '%q'" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c msgid "arguments must be ndarrays" msgstr "argumenten måste vara ndarray" +#: extmod/ulab/code/ndarray.c +msgid "array and index length must be equal" +msgstr "" + #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "array/bytes krävs på höger sida" +#: extmod/ulab/code/numerical/numerical.c +msgid "attempt to get (arg)min/(arg)max of empty sequence" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" msgstr "försök att få argmin/argmax för en tom sekvens" @@ -2124,16 +2136,16 @@ msgid "attributes not supported yet" msgstr "attribut stöds inte än" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, None, or 1" -msgstr "axis ska vara -1, 0, None eller 1" +msgid "axis is out of bounds" +msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, or 1" -msgstr "axis ska vara -1, 0 eller 1" +msgid "axis must be None, or an integer" +msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be None, 0, or 1" -msgstr "axis ska vara None, 0, eller 1" +msgid "axis too long" +msgstr "" #: py/builtinevex.c msgid "bad compile mode" @@ -2338,6 +2350,10 @@ msgid "" msgstr "" "kan inte byta från manuell fältspecifikation till automatisk fältnumrering" +#: extmod/ulab/code/ndarray_operators.c +msgid "cannot cast output with casting rule" +msgstr "" + #: py/objtype.c msgid "cannot create '%q' instances" msgstr "kan inte skapa instanser av '%q'" @@ -2354,10 +2370,6 @@ msgstr "kan inte importera namn %q" msgid "cannot perform relative import" msgstr "kan inte utföra relativ import" -#: extmod/ulab/code/ndarray.c -msgid "cannot reshape array (incompatible input/output shape)" -msgstr "kan inte omforma matris (inkompatibel indata-/utdataform)" - #: py/emitnative.c msgid "casting" msgstr "casting inte implementerad" @@ -2430,10 +2442,6 @@ msgstr "Argumenten convolve måste vara ndarray:er" msgid "convolve arguments must not be empty" msgstr "Argumenten convolve kan inte vara tomma" -#: extmod/ulab/code/ndarray.c -msgid "could not broadast input array from shape" -msgstr "Kan inte sända indatamatris från form" - #: extmod/ulab/code/poly/poly.c msgid "could not invert Vandermonde matrix" msgstr "kan inte invertera Vandermonde-matris" @@ -2442,6 +2450,10 @@ msgstr "kan inte invertera Vandermonde-matris" msgid "couldn't determine SD card version" msgstr "kan inte avgöra SD-kortversion" +#: extmod/ulab/code/numerical/numerical.c +msgid "cross is defined for 1D arrays of length 3" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" msgstr "data måste vara itererbar" @@ -2450,10 +2462,6 @@ msgstr "data måste vara itererbar" msgid "data must be of equal length" msgstr "data måste vara av samma längd" -#: extmod/ulab/code/numerical/numerical.c -msgid "ddof must be smaller than length of data set" -msgstr "ddof måste vara mindre än längden på datauppsättningen" - #: py/parsenum.c msgid "decimal numbers not supported" msgstr "decimaltal stöds inte" @@ -2486,6 +2494,10 @@ msgstr "uppdateringssekvensen för dict har fel längd" msgid "diff argument must be an ndarray" msgstr "argumentet diff måste vara en ndarray" +#: extmod/ulab/code/numerical/numerical.c +msgid "differentiation order out of range" +msgstr "" + #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c msgid "division by zero" @@ -2601,6 +2613,10 @@ msgstr "första argumentet måste vara en callable" msgid "first argument must be a function" msgstr "första argumentet måste vara en funktion" +#: extmod/ulab/code/ulab_create.c +msgid "first argument must be a tuple of ndarrays" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" msgstr "första argumentet måste vara en iterable" @@ -2654,9 +2670,9 @@ msgstr "funktionen fick flera värden för argumentet '%q'" msgid "function has the same sign at the ends of interval" msgstr "funktionen har samma teckenvärden vid slutet av intervall" -#: extmod/ulab/code/compare/compare.c -msgid "function is implemented for scalars and ndarrays only" -msgstr "funktionen är endast implementerad för scalar och ndarray" +#: extmod/ulab/code/ndarray.c +msgid "function is defined for ndarrays only" +msgstr "" #: py/argcheck.c #, c-format @@ -2725,6 +2741,7 @@ msgstr "felaktig utfyllnad" msgid "index is out of bounds" msgstr "index är utanför gränserna" +#: extmod/ulab/code/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "index utanför intervallet" @@ -2749,6 +2766,10 @@ msgstr "initial_value-längd är fel" msgid "inline assembler must be a function" msgstr "inline assembler måste vara en funktion" +#: extmod/ulab/code/ndarray.c +msgid "input and output shapes are not compatible" +msgstr "" + #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" msgstr "indataargumentet måste vara ett heltal eller en 2-tupel" @@ -2757,6 +2778,10 @@ msgstr "indataargumentet måste vara ett heltal eller en 2-tupel" msgid "input array length must be power of 2" msgstr "indataarraylängden måste vara en multipel av 2" +#: extmod/ulab/code/ulab_create.c +msgid "input arrays are not compatible" +msgstr "" + #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" msgstr "indata måste vara en iterable" @@ -2769,6 +2794,22 @@ msgstr "indatamatrisen är asymmetrisk" msgid "input matrix is singular" msgstr "indatamatrisen är singulär" +#: extmod/ulab/code/user/user.c +msgid "input must be a dense ndarray" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input must be a tensor of rank 2" +msgstr "" + +#: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c +msgid "input must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "input must be one-dimensional" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" msgstr "indata måste vara kvadratmatris" @@ -2781,6 +2822,10 @@ msgstr "indata måste vara tupel, lista, range, eller ndarray" msgid "input vectors must be of equal length" msgstr "indatavektorer måste ha samma längd" +#: extmod/ulab/code/poly/poly.c +msgid "inputs are not iterable" +msgstr "" + #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" msgstr "int() arg 2 måste vara >= 2 och <= 36" @@ -2952,6 +2997,10 @@ msgstr "max_length måste vara 0-%d när fixed_length är %s" msgid "max_length must be > 0" msgstr "max_length måste vara > 0" +#: extmod/ulab/code/ndarray.c +msgid "maximum number of dimensions is 4" +msgstr "" + #: py/runtime.c msgid "maximum recursion depth exceeded" msgstr "maximal rekursionsdjup överskriden" @@ -3001,10 +3050,6 @@ msgstr "måste ge ett objekt" msgid "must use keyword argument for key function" msgstr "måste använda nyckelordsargument för nyckelfunktion" -#: extmod/ulab/code/numerical/numerical.c -msgid "n must be between 0, and 9" -msgstr "n måste vara mellan 0 och 9" - #: py/runtime.c msgid "name '%q' is not defined" msgstr "namnet '%q' är inte definierat" @@ -3087,6 +3132,10 @@ msgstr "icke nyckelord arg efter * / **" msgid "non-keyword arg after keyword arg" msgstr "icke nyckelord arg efter nyckelord arg" +#: extmod/ulab/code/linalg/linalg.c +msgid "norm is defined for 1D and 2D arrays" +msgstr "" + #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "inte en 128-bitars UUID" @@ -3099,10 +3148,6 @@ msgstr "inte alla argument omvandlade under strängformatering" msgid "not enough arguments for format string" msgstr "inte tillräckligt med argument för formatsträng" -#: extmod/ulab/code/poly/poly.c -msgid "number of arguments must be 2, or 3" -msgstr "antal argument måste vara 2 eller 3" - #: extmod/ulab/code/ulab_create.c msgid "number of points must be at least 2" msgstr "antal punkter måste vara minst 2" @@ -3155,6 +3200,10 @@ msgstr "objekt med buffertprotokoll krävs" msgid "odd-length string" msgstr "sträng har udda längd" +#: extmod/ulab/code/ulab_create.c +msgid "offset is too large" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "offset utanför gränserna" @@ -3177,6 +3226,14 @@ msgstr "endast segment med steg=1 (aka Ingen) stöds" msgid "operands could not be broadcast together" msgstr "operander kan inte sändas tillsammans" +#: extmod/ulab/code/ndarray.c +msgid "operation is implemented for 1D Boolean arrays only" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "operation is not implemented for flattened array" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "åtgärden är inte implementerad för ndarray:er" @@ -3312,6 +3369,10 @@ msgstr "relativ import" msgid "requested length %d but object has length %d" msgstr "begärd längd %d men objektet har längden %d" +#: extmod/ulab/code/ndarray_operators.c +msgid "results cannot be cast to specified type" +msgstr "" + #: py/compile.c msgid "return annotation must be an identifier" msgstr "retur-annotation måste vara en identifierare" @@ -3330,9 +3391,9 @@ msgstr "rgb_pins[%d] duplicerar en annan pinntilldelning" msgid "rgb_pins[%d] is not on the same port as clock" msgstr "rgb_pins[%d] är inte på samma port som en klocka" -#: extmod/ulab/code/ndarray.c -msgid "right hand side must be an ndarray, or a scalar" -msgstr "höger sida måste vara en ndarray, eller en scalar" +#: extmod/ulab/code/numerical/numerical.c +msgid "roll argument must be an ndarray" +msgstr "" #: py/objstr.c msgid "rsplit(None,n)" @@ -3359,8 +3420,8 @@ msgid "script compilation not supported" msgstr "skriptkompilering stöds inte" #: extmod/ulab/code/ndarray.c -msgid "shape must be a 2-tuple" -msgstr "shape måste vara en 2-tupel" +msgid "shape must be a tuple" +msgstr "" #: py/objstr.c msgid "sign not allowed in string format specifier" @@ -3402,10 +3463,6 @@ msgstr "mjuk omstart\n" msgid "sort argument must be an ndarray" msgstr "argumentet sort måste vara en ndarray" -#: extmod/ulab/code/numerical/numerical.c -msgid "sorted axis can't be longer than 65535" -msgstr "sorterad axel kan inte vara längre än 65535" - #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "sos array måste ha form (n_section, 6)" @@ -3511,6 +3568,10 @@ msgstr "timeout för v2-kort" msgid "timestamp out of range for platform time_t" msgstr "timestamp utom räckvidd för plattformens \"time_t\"" +#: extmod/ulab/code/ndarray.c +msgid "tobytes can be invoked for dense arrays only" +msgstr "" + #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "för många argument för det givna formatet" @@ -3686,13 +3747,13 @@ msgstr "width måste vara större än noll" msgid "window must be <= interval" msgstr "window måste vara <= interval" -#: extmod/ulab/code/linalg/linalg.c -msgid "wrong argument type" -msgstr "fel typ av argument" +#: extmod/ulab/code/numerical/numerical.c +msgid "wrong axis index" +msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "wrong index type" -msgstr "fel indextyp" +#: extmod/ulab/code/ulab_create.c +msgid "wrong axis specified" +msgstr "" #: extmod/ulab/code/vector/vectorise.c msgid "wrong input type" @@ -3742,6 +3803,51 @@ msgstr "zi måste vara av typ float" msgid "zi must be of shape (n_section, 2)" msgstr "zi måste vara i formen (n_section, 2)" +#~ msgid "arctan2 is implemented for scalars and ndarrays only" +#~ msgstr "arctan2 är enbart implementerad för scalar och ndarray" + +#~ msgid "axis must be -1, 0, None, or 1" +#~ msgstr "axis ska vara -1, 0, None eller 1" + +#~ msgid "axis must be -1, 0, or 1" +#~ msgstr "axis ska vara -1, 0 eller 1" + +#~ msgid "axis must be None, 0, or 1" +#~ msgstr "axis ska vara None, 0, eller 1" + +#~ msgid "cannot reshape array (incompatible input/output shape)" +#~ msgstr "kan inte omforma matris (inkompatibel indata-/utdataform)" + +#~ msgid "could not broadast input array from shape" +#~ msgstr "Kan inte sända indatamatris från form" + +#~ msgid "ddof must be smaller than length of data set" +#~ msgstr "ddof måste vara mindre än längden på datauppsättningen" + +#~ msgid "function is implemented for scalars and ndarrays only" +#~ msgstr "funktionen är endast implementerad för scalar och ndarray" + +#~ msgid "n must be between 0, and 9" +#~ msgstr "n måste vara mellan 0 och 9" + +#~ msgid "number of arguments must be 2, or 3" +#~ msgstr "antal argument måste vara 2 eller 3" + +#~ msgid "right hand side must be an ndarray, or a scalar" +#~ msgstr "höger sida måste vara en ndarray, eller en scalar" + +#~ msgid "shape must be a 2-tuple" +#~ msgstr "shape måste vara en 2-tupel" + +#~ msgid "sorted axis can't be longer than 65535" +#~ msgstr "sorterad axel kan inte vara längre än 65535" + +#~ msgid "wrong argument type" +#~ msgstr "fel typ av argument" + +#~ msgid "wrong index type" +#~ msgstr "fel indextyp" + #~ msgid "specify size or data, but not both" #~ msgstr "ange storlek eller data, men inte båda" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index e94ae8173ff99..134efec9034a8 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-10 15:30+0530\n" +"POT-Creation-Date: 2020-11-23 10:10-0600\n" "PO-Revision-Date: 2020-11-19 01:28+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -865,6 +865,10 @@ msgstr "Bù zhīchí dài yǒu sǎomiáo xiǎngyìng de kuòzhǎn guǎngbò." msgid "FFT is defined for ndarrays only" msgstr "FFT jǐn wéi ndarrays dìng yì" +#: extmod/ulab/code/fft/fft.c +msgid "FFT is implemented for linear arrays only" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" msgstr "SSL wòshǒu shībài" @@ -1984,7 +1988,7 @@ msgstr "Diànyā dòu qǔ chāoshí" msgid "WARNING: Your code filename has two extensions\n" msgstr "Jǐnggào: Nǐ de dàimǎ wénjiàn míng yǒu liǎng gè kuòzhǎn míng\n" -#: shared-bindings/watchdog/WatchDogTimer.c +#: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "Yīdàn jiāng móshì shèzhì wèi RESET, jiù wúfǎ chūshǐhuà WatchDog Timer" @@ -2070,10 +2074,6 @@ msgstr "dìzhǐ chāochū biānjiè" msgid "addresses is empty" msgstr "dìzhǐ wèi kōng" -#: extmod/ulab/code/vector/vectorise.c -msgid "arctan2 is implemented for scalars and ndarrays only" -msgstr "arctan2 jǐn zhēnduì biāoliàng hé ndarray shíxiàn" - #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "cānshù shì yīgè kōng de xùliè" @@ -2082,6 +2082,10 @@ msgstr "cānshù shì yīgè kōng de xùliè" msgid "argsort argument must be an ndarray" msgstr "argsort cānshù bìxū shì ndarray" +#: extmod/ulab/code/numerical/numerical.c +msgid "argsort is not implemented for flattened arrays" +msgstr "" + #: py/runtime.c msgid "argument has wrong type" msgstr "cānshù lèixíng cuòwù" @@ -2099,14 +2103,22 @@ msgstr "cānshù biānhào/lèixíng bù pǐpèi" msgid "argument should be a '%q' not a '%q'" msgstr "cānshù yīnggāi shì '%q', 'bùshì '%q'" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c msgid "arguments must be ndarrays" msgstr "cānshù bìxū shì ndarrays" +#: extmod/ulab/code/ndarray.c +msgid "array and index length must be equal" +msgstr "" + #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "yòu cè xūyào shùzǔ/zì jié" +#: extmod/ulab/code/numerical/numerical.c +msgid "attempt to get (arg)min/(arg)max of empty sequence" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" msgstr "chángshì huòqǔ kōng xùliè de argmin/ argmax" @@ -2116,16 +2128,16 @@ msgid "attributes not supported yet" msgstr "shǔxìng shàngwèi zhīchí" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, None, or 1" -msgstr "zhóu bìxū wèi-1,0, wú huò 1" +msgid "axis is out of bounds" +msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be -1, 0, or 1" -msgstr "zhóu bìxū wèi-1,0 huò 1" +msgid "axis must be None, or an integer" +msgstr "" #: extmod/ulab/code/numerical/numerical.c -msgid "axis must be None, 0, or 1" -msgstr "zhóu bìxū wèi None,0 huò 1" +msgid "axis too long" +msgstr "" #: py/builtinevex.c msgid "bad compile mode" @@ -2328,6 +2340,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "wúfǎ cóng shǒudòng zìduàn guīgé qiēhuàn dào zìdòng zìduàn biānhào" +#: extmod/ulab/code/ndarray_operators.c +msgid "cannot cast output with casting rule" +msgstr "" + #: py/objtype.c msgid "cannot create '%q' instances" msgstr "wúfǎ chuàngjiàn '%q' ' shílì" @@ -2344,10 +2360,6 @@ msgstr "wúfǎ dǎorù míngchēng %q" msgid "cannot perform relative import" msgstr "wúfǎ zhíxíng xiāngguān dǎorù" -#: extmod/ulab/code/ndarray.c -msgid "cannot reshape array (incompatible input/output shape)" -msgstr "wúfǎ zhěngxíng shùzǔ (bù jiānróng de shūrù/shūchū xíngzhuàng)" - #: py/emitnative.c msgid "casting" msgstr "tóuyǐng" @@ -2423,10 +2435,6 @@ msgstr "juàn jī cānshù bìxū shì ndarrays" msgid "convolve arguments must not be empty" msgstr "juàn jī cān shǔ bùnéng wéi kōng" -#: extmod/ulab/code/ndarray.c -msgid "could not broadast input array from shape" -msgstr "wúfǎ guǎngbò xíngzhuàng de shūrù shùzǔ" - #: extmod/ulab/code/poly/poly.c msgid "could not invert Vandermonde matrix" msgstr "wúfǎ fǎn zhuǎn fàndéméng dé jǔzhèn" @@ -2435,6 +2443,10 @@ msgstr "wúfǎ fǎn zhuǎn fàndéméng dé jǔzhèn" msgid "couldn't determine SD card version" msgstr "wúfǎ quèdìng SD kǎ bǎnběn" +#: extmod/ulab/code/numerical/numerical.c +msgid "cross is defined for 1D arrays of length 3" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" msgstr "shùjù bìxū shì kě diédài de" @@ -2443,10 +2455,6 @@ msgstr "shùjù bìxū shì kě diédài de" msgid "data must be of equal length" msgstr "shùjù chángdù bìxū xiāngděng" -#: extmod/ulab/code/numerical/numerical.c -msgid "ddof must be smaller than length of data set" -msgstr "ddof bìxū xiǎoyú shùjù jí de chángdù" - #: py/parsenum.c msgid "decimal numbers not supported" msgstr "bù zhīchí xiǎoshù shù" @@ -2478,6 +2486,10 @@ msgstr "yǔfǎ gēngxīn xùliè de chángdù cuòwù" msgid "diff argument must be an ndarray" msgstr "bùtóng de cānshù bìxū shì ndarray" +#: extmod/ulab/code/numerical/numerical.c +msgid "differentiation order out of range" +msgstr "" + #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c msgid "division by zero" @@ -2593,6 +2605,10 @@ msgstr "dì yī gè cānshù bìxū shì kě tiáo yòng de" msgid "first argument must be a function" msgstr "dì yīgè cānshù bìxū shì yī gè hánshù" +#: extmod/ulab/code/ulab_create.c +msgid "first argument must be a tuple of ndarrays" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" msgstr "dì yī gè cānshù bìxū shì kě diédài de" @@ -2646,9 +2662,9 @@ msgstr "hánshù huòdé cānshù '%q' de duōchóng zhí" msgid "function has the same sign at the ends of interval" msgstr "hánshù zài jiàngé mòwěi jùyǒu xiāngtóng de fúhào" -#: extmod/ulab/code/compare/compare.c -msgid "function is implemented for scalars and ndarrays only" -msgstr "gāi hánshù jǐn zhēnduì biāoliàng hé ndarray shíxiàn" +#: extmod/ulab/code/ndarray.c +msgid "function is defined for ndarrays only" +msgstr "" #: py/argcheck.c #, c-format @@ -2717,6 +2733,7 @@ msgstr "bù zhèngquè de tiánchōng" msgid "index is out of bounds" msgstr "suǒyǐn chāochū fànwéi" +#: extmod/ulab/code/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "suǒyǐn chāochū fànwéi" @@ -2741,6 +2758,10 @@ msgstr "Initial_value chángdù cuòwù" msgid "inline assembler must be a function" msgstr "nèi lián jíhé bìxū shì yīgè hánshù" +#: extmod/ulab/code/ndarray.c +msgid "input and output shapes are not compatible" +msgstr "" + #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" msgstr "shūrù cānshù bìxū shì zhěngshù huò 2 yuán zǔ" @@ -2749,6 +2770,10 @@ msgstr "shūrù cānshù bìxū shì zhěngshù huò 2 yuán zǔ" msgid "input array length must be power of 2" msgstr "shūrù shùzǔ de chángdù bìxū shì 2 de mì" +#: extmod/ulab/code/ulab_create.c +msgid "input arrays are not compatible" +msgstr "" + #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" msgstr "shūrù shùjù bìxū shì kě diédài de" @@ -2761,6 +2786,22 @@ msgstr "shūrù jǔzhèn bù duìchèn" msgid "input matrix is singular" msgstr "shūrù jǔzhèn shì qíyì de" +#: extmod/ulab/code/user/user.c +msgid "input must be a dense ndarray" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input must be a tensor of rank 2" +msgstr "" + +#: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c +msgid "input must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "input must be one-dimensional" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" msgstr "shūrù bìxū wèi fāng jǔzhèn" @@ -2773,6 +2814,10 @@ msgstr "shūrù bìxū shì yuán zǔ, lièbiǎo, fànwéi huò ndarray" msgid "input vectors must be of equal length" msgstr "shūrù xiàngliàng de chángdù bìxū xiāngděng" +#: extmod/ulab/code/poly/poly.c +msgid "inputs are not iterable" +msgstr "" + #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" msgstr "zhěngshù() cānshù 2 bìxū > = 2 qiě <= 36" @@ -2942,6 +2987,10 @@ msgstr "Dāng gùdìng chángdù wèi %s shí, zuìdà chángdù bìxū wèi 0-% msgid "max_length must be > 0" msgstr "Max_length bìxū > 0" +#: extmod/ulab/code/ndarray.c +msgid "maximum number of dimensions is 4" +msgstr "" + #: py/runtime.c msgid "maximum recursion depth exceeded" msgstr "chāochū zuìdà dìguī shēndù" @@ -2991,10 +3040,6 @@ msgstr "bìxū tíchū duìxiàng" msgid "must use keyword argument for key function" msgstr "bìxū shǐyòng guānjiàn cí cānshù" -#: extmod/ulab/code/numerical/numerical.c -msgid "n must be between 0, and 9" -msgstr "n bìxū jiè yú 0 dào 9 zhī jiān" - #: py/runtime.c msgid "name '%q' is not defined" msgstr "míngchēng '%q' wèi dìngyì" @@ -3077,6 +3122,10 @@ msgstr "zài */** zhīhòu fēi guānjiàn cí cānshù" msgid "non-keyword arg after keyword arg" msgstr "guānjiàn zì cānshù zhīhòu de fēi guānjiàn zì cānshù" +#: extmod/ulab/code/linalg/linalg.c +msgid "norm is defined for 1D and 2D arrays" +msgstr "" + #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "bùshì 128 wèi UUID" @@ -3089,10 +3138,6 @@ msgstr "bùshì zì chuàn géshì huà guòchéng zhōng zhuǎnhuàn de suǒyǒ msgid "not enough arguments for format string" msgstr "géshì zìfú chuàn cān shǔ bùzú" -#: extmod/ulab/code/poly/poly.c -msgid "number of arguments must be 2, or 3" -msgstr "cānshù shùliàng bìxū wèi 2 huò 3" - #: extmod/ulab/code/ulab_create.c msgid "number of points must be at least 2" msgstr "diǎnshù bìxū zhìshǎo wèi 2" @@ -3145,6 +3190,10 @@ msgstr "xūyào huǎnchōng qū xiéyì de duìxiàng" msgid "odd-length string" msgstr "jīshù zìfú chuàn" +#: extmod/ulab/code/ulab_create.c +msgid "offset is too large" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "piānlí biānjiè" @@ -3167,6 +3216,14 @@ msgstr "jǐn zhīchí bù zhǎng = 1(jí wú) de qiēpiàn" msgid "operands could not be broadcast together" msgstr "cāozuò shǔ bùnéng yīqǐ guǎngbò" +#: extmod/ulab/code/ndarray.c +msgid "operation is implemented for 1D Boolean arrays only" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "operation is not implemented for flattened array" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "cāozuò wèi zài ndarrays shàng shíxiàn" @@ -3301,6 +3358,10 @@ msgstr "xiāngduì dǎorù" msgid "requested length %d but object has length %d" msgstr "qǐngqiú chángdù %d dàn duìxiàng chángdù %d" +#: extmod/ulab/code/ndarray_operators.c +msgid "results cannot be cast to specified type" +msgstr "" + #: py/compile.c msgid "return annotation must be an identifier" msgstr "fǎnhuí zhùshì bìxū shì biāozhì fú" @@ -3319,9 +3380,9 @@ msgstr "rgb_pins[%d] fùzhì lìng yīgè yǐn jiǎo fēnpèi" msgid "rgb_pins[%d] is not on the same port as clock" msgstr "rgb_pins[%d] yǔ shízhōng bùzài tóng yīgè duānkǒu shàng" -#: extmod/ulab/code/ndarray.c -msgid "right hand side must be an ndarray, or a scalar" -msgstr "yòubiān bìxū shì ndarray huò biāoliàng" +#: extmod/ulab/code/numerical/numerical.c +msgid "roll argument must be an ndarray" +msgstr "" #: py/objstr.c msgid "rsplit(None,n)" @@ -3348,8 +3409,8 @@ msgid "script compilation not supported" msgstr "bù zhīchí jiǎoběn biānyì" #: extmod/ulab/code/ndarray.c -msgid "shape must be a 2-tuple" -msgstr "xíngzhuàng bìxū shì 2 yuán zǔ" +msgid "shape must be a tuple" +msgstr "" #: py/objstr.c msgid "sign not allowed in string format specifier" @@ -3391,10 +3452,6 @@ msgstr "ruǎn chóngqǐ\n" msgid "sort argument must be an ndarray" msgstr "páixù cānshù bìxū shì ndarray" -#: extmod/ulab/code/numerical/numerical.c -msgid "sorted axis can't be longer than 65535" -msgstr "pái xù zhóu bù néng chāo guò 65535" - #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" msgstr "sos shùzǔ de xíngzhuàng bìxū wèi (n_section, 6)" @@ -3500,6 +3557,10 @@ msgstr "děngdài v2 kǎ chāoshí" msgid "timestamp out of range for platform time_t" msgstr "time_t shíjiān chuō chāochū píngtái fànwéi" +#: extmod/ulab/code/ndarray.c +msgid "tobytes can be invoked for dense arrays only" +msgstr "" + #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "tígōng jǐ dìng géshì de cānshù tài duō" @@ -3675,13 +3736,13 @@ msgstr "kuāndù bìxū dàyú líng" msgid "window must be <= interval" msgstr "Chuāngkǒu bìxū shì <= jiàngé" -#: extmod/ulab/code/linalg/linalg.c -msgid "wrong argument type" -msgstr "cuòwù de cānshù lèixíng" +#: extmod/ulab/code/numerical/numerical.c +msgid "wrong axis index" +msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "wrong index type" -msgstr "cuòwù de suǒyǐn lèixíng" +#: extmod/ulab/code/ulab_create.c +msgid "wrong axis specified" +msgstr "" #: extmod/ulab/code/vector/vectorise.c msgid "wrong input type" @@ -3731,6 +3792,51 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "arctan2 is implemented for scalars and ndarrays only" +#~ msgstr "arctan2 jǐn zhēnduì biāoliàng hé ndarray shíxiàn" + +#~ msgid "axis must be -1, 0, None, or 1" +#~ msgstr "zhóu bìxū wèi-1,0, wú huò 1" + +#~ msgid "axis must be -1, 0, or 1" +#~ msgstr "zhóu bìxū wèi-1,0 huò 1" + +#~ msgid "axis must be None, 0, or 1" +#~ msgstr "zhóu bìxū wèi None,0 huò 1" + +#~ msgid "cannot reshape array (incompatible input/output shape)" +#~ msgstr "wúfǎ zhěngxíng shùzǔ (bù jiānróng de shūrù/shūchū xíngzhuàng)" + +#~ msgid "could not broadast input array from shape" +#~ msgstr "wúfǎ guǎngbò xíngzhuàng de shūrù shùzǔ" + +#~ msgid "ddof must be smaller than length of data set" +#~ msgstr "ddof bìxū xiǎoyú shùjù jí de chángdù" + +#~ msgid "function is implemented for scalars and ndarrays only" +#~ msgstr "gāi hánshù jǐn zhēnduì biāoliàng hé ndarray shíxiàn" + +#~ msgid "n must be between 0, and 9" +#~ msgstr "n bìxū jiè yú 0 dào 9 zhī jiān" + +#~ msgid "number of arguments must be 2, or 3" +#~ msgstr "cānshù shùliàng bìxū wèi 2 huò 3" + +#~ msgid "right hand side must be an ndarray, or a scalar" +#~ msgstr "yòubiān bìxū shì ndarray huò biāoliàng" + +#~ msgid "shape must be a 2-tuple" +#~ msgstr "xíngzhuàng bìxū shì 2 yuán zǔ" + +#~ msgid "sorted axis can't be longer than 65535" +#~ msgstr "pái xù zhóu bù néng chāo guò 65535" + +#~ msgid "wrong argument type" +#~ msgstr "cuòwù de cānshù lèixíng" + +#~ msgid "wrong index type" +#~ msgstr "cuòwù de suǒyǐn lèixíng" + #~ msgid "Must provide SCK pin" #~ msgstr "bì xū tí gòng SCK yǐn jiǎo" From 1c9f33a372dd1fcb55625abbf2fc14a2ac5764ae Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Mon, 23 Nov 2020 19:01:30 -0500 Subject: [PATCH 267/770] Replace reset with mux change --- ports/esp32s2/common-hal/microcontroller/Pin.c | 4 ++-- ports/esp32s2/esp-idf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index 72db5da471048..961f77f33cb04 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -63,7 +63,7 @@ void reset_pin_number(gpio_num_t pin_number) { never_reset_pins[pin_number / 32] &= ~(1 << pin_number % 32); in_use[pin_number / 32] &= ~(1 << pin_number % 32); - gpio_reset_pin(pin_number); + gpio_matrix_out(pin_number, 0x100, 0, 0); #ifdef MICROPY_HW_NEOPIXEL if (pin_number == MICROPY_HW_NEOPIXEL->number) { @@ -85,7 +85,7 @@ void reset_all_pins(void) { (never_reset_pins[i / 32] & (1 << i % 32)) != 0) { continue; } - gpio_reset_pin(i); + gpio_matrix_out(i, 0x100, 0, 0); } in_use[0] = 0; in_use[1] = 0; diff --git a/ports/esp32s2/esp-idf b/ports/esp32s2/esp-idf index d06744f5efc38..8bc19ba893e55 160000 --- a/ports/esp32s2/esp-idf +++ b/ports/esp32s2/esp-idf @@ -1 +1 @@ -Subproject commit d06744f5efc382c61cbad8758107cec308feef09 +Subproject commit 8bc19ba893e5544d571a753d82b44a84799b94b1 From 2635132ce590a44e79dbee8230fe92dbba8e3667 Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Mon, 23 Nov 2020 19:21:12 -0500 Subject: [PATCH 268/770] adding 'haxpress' kind of build for CP Sapling for use with SPI Flash --- .../boards/cp_sapling_m0_spiflash/board.c | 40 ++++++++++++ .../cp_sapling_m0_spiflash/mpconfigboard.h | 62 +++++++++++++++++++ .../cp_sapling_m0_spiflash/mpconfigboard.mk | 33 ++++++++++ .../boards/cp_sapling_m0_spiflash/pins.c | 38 ++++++++++++ .../atmel-samd/boards/icy-tree-sof-m0/board.c | 44 +++++++++++++ .../boards/icy-tree-sof-m0/mpconfigboard.h | 55 ++++++++++++++++ .../boards/icy-tree-sof-m0/mpconfigboard.mk | 24 +++++++ .../atmel-samd/boards/icy-tree-sof-m0/pins.c | 49 +++++++++++++++ 8 files changed, 345 insertions(+) create mode 100644 ports/atmel-samd/boards/cp_sapling_m0_spiflash/board.c create mode 100644 ports/atmel-samd/boards/cp_sapling_m0_spiflash/mpconfigboard.h create mode 100644 ports/atmel-samd/boards/cp_sapling_m0_spiflash/mpconfigboard.mk create mode 100644 ports/atmel-samd/boards/cp_sapling_m0_spiflash/pins.c create mode 100644 ports/atmel-samd/boards/icy-tree-sof-m0/board.c create mode 100644 ports/atmel-samd/boards/icy-tree-sof-m0/mpconfigboard.h create mode 100644 ports/atmel-samd/boards/icy-tree-sof-m0/mpconfigboard.mk create mode 100644 ports/atmel-samd/boards/icy-tree-sof-m0/pins.c diff --git a/ports/atmel-samd/boards/cp_sapling_m0_spiflash/board.c b/ports/atmel-samd/boards/cp_sapling_m0_spiflash/board.c new file mode 100644 index 0000000000000..ce563667622f6 --- /dev/null +++ b/ports/atmel-samd/boards/cp_sapling_m0_spiflash/board.c @@ -0,0 +1,40 @@ +/* + * 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 "common-hal/microcontroller/Pin.h" +#include "supervisor/shared/board.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/cp_sapling_m0_spiflash/mpconfigboard.h b/ports/atmel-samd/boards/cp_sapling_m0_spiflash/mpconfigboard.h new file mode 100644 index 0000000000000..a129566d2da0f --- /dev/null +++ b/ports/atmel-samd/boards/cp_sapling_m0_spiflash/mpconfigboard.h @@ -0,0 +1,62 @@ +#define MICROPY_HW_BOARD_NAME "CP Sapling M0" +#define MICROPY_HW_MCU_NAME "samd21e18" + +#define MICROPY_HW_NEOPIXEL (&pin_PA15) + +#define MICROPY_PORT_A (0) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) + +#define SPI_FLASH_MOSI_PIN &pin_PA18 +#define SPI_FLASH_MISO_PIN &pin_PA17 +#define SPI_FLASH_SCK_PIN &pin_PA19 +#define SPI_FLASH_CS_PIN &pin_PA22 + +#define IGNORE_PIN_PA02 1 +#define IGNORE_PIN_PA03 1 +#define IGNORE_PIN_PA04 1 +#define IGNORE_PIN_PA05 1 +#define IGNORE_PIN_PA06 1 +#define IGNORE_PIN_PA07 1 +#define IGNORE_PIN_PA12 1 +#define IGNORE_PIN_PA13 1 +#define IGNORE_PIN_PA14 1 +#define IGNORE_PIN_PA20 1 +#define IGNORE_PIN_PA21 1 +// USB is always used internally so skip the pin objects for it. +#define IGNORE_PIN_PA24 1 +#define IGNORE_PIN_PA25 1 +#define IGNORE_PIN_PA27 1 +#define IGNORE_PIN_PA28 1 +#define IGNORE_PIN_PA30 1 +#define IGNORE_PIN_PA31 1 +#define IGNORE_PIN_PB01 1 +#define IGNORE_PIN_PB02 1 +#define IGNORE_PIN_PB03 1 +#define IGNORE_PIN_PB04 1 +#define IGNORE_PIN_PB05 1 +#define IGNORE_PIN_PB06 1 +#define IGNORE_PIN_PB07 1 +#define IGNORE_PIN_PB08 1 +#define IGNORE_PIN_PB09 1 +#define IGNORE_PIN_PB10 1 +#define IGNORE_PIN_PB11 1 +#define IGNORE_PIN_PB12 1 +#define IGNORE_PIN_PB13 1 +#define IGNORE_PIN_PB14 1 +#define IGNORE_PIN_PB15 1 +#define IGNORE_PIN_PB16 1 +#define IGNORE_PIN_PB17 1 +#define IGNORE_PIN_PB22 1 +#define IGNORE_PIN_PB23 1 +#define IGNORE_PIN_PB30 1 +#define IGNORE_PIN_PB31 1 +#define IGNORE_PIN_PB00 1 + +#define DEFAULT_I2C_BUS_SCL (&pin_PA09) +#define DEFAULT_I2C_BUS_SDA (&pin_PA08) + +#define DEFAULT_SPI_BUS_SS (&pin_PA22) +#define DEFAULT_SPI_BUS_SCK (&pin_PA19) +#define DEFAULT_SPI_BUS_MOSI (&pin_PA18) +#define DEFAULT_SPI_BUS_MISO (&pin_PA17) diff --git a/ports/atmel-samd/boards/cp_sapling_m0_spiflash/mpconfigboard.mk b/ports/atmel-samd/boards/cp_sapling_m0_spiflash/mpconfigboard.mk new file mode 100644 index 0000000000000..c81209db3b1ff --- /dev/null +++ b/ports/atmel-samd/boards/cp_sapling_m0_spiflash/mpconfigboard.mk @@ -0,0 +1,33 @@ +USB_VID = 0x1209 +USB_PID = 0x4DDD +USB_PRODUCT = "CP Sapling" +USB_MANUFACTURER = "Oak Development Technologies" + +CHIP_VARIANT = SAMD21E18A +CHIP_FAMILY = samd21 + +INTERNAL_FLASH_FILESYSTEM = 0 +LONGINT_IMPL = MPZ +SPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICE_COUNT = 1 +EXTERNAL_FLASH_DEVICES = AT25DF081A + +CIRCUITPY_AUDIOIO = 0 +CIRCUITPY_AUDIOBUSIO = 0 +CIRCUITPY_BITBANGIO = 0 +CIRCUITPY_COUNTIO = 0 +CIRCUITPY_FREQUENCYIO = 0 +CIRCUITPY_I2CPERIPHERAL = 0 + +SUPEROPT_GC = 0 + +CFLAGS_BOARD = --param max-inline-insns-auto=15 +ifeq ($(TRANSLATION), zh_Latn_pinyin) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +endif +ifeq ($(TRANSLATION), de_DE) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +SUPEROPT_VM = 0 +endif diff --git a/ports/atmel-samd/boards/cp_sapling_m0_spiflash/pins.c b/ports/atmel-samd/boards/cp_sapling_m0_spiflash/pins.c new file mode 100644 index 0000000000000..d527aaddcb558 --- /dev/null +++ b/ports/atmel-samd/boards/cp_sapling_m0_spiflash/pins.c @@ -0,0 +1,38 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA08) }, + + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA00) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA00) }, + + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA01) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA01) }, + + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA09) }, + + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_SS), MP_ROM_PTR(&pin_PA22) }, + + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA19) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA17) }, + + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA18) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA15) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); diff --git a/ports/atmel-samd/boards/icy-tree-sof-m0/board.c b/ports/atmel-samd/boards/icy-tree-sof-m0/board.c new file mode 100644 index 0000000000000..1a65a561f7c7d --- /dev/null +++ b/ports/atmel-samd/boards/icy-tree-sof-m0/board.c @@ -0,0 +1,44 @@ +/* + * 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 "common-hal/microcontroller/Pin.h" +#include "supervisor/shared/board.h" +#include "hal/include/hal_gpio.h" + +void board_init(void) { + gpio_set_pin_function(PIN_PA15, GPIO_PIN_FUNCTION_OFF); + gpio_set_pin_direction(PIN_PA15, GPIO_DIRECTION_OUT); + gpio_set_pin_level(PIN_PA15, true); // Turn on neopixel by default + never_reset_pin_number(PIN_PA15); +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} diff --git a/ports/atmel-samd/boards/icy-tree-sof-m0/mpconfigboard.h b/ports/atmel-samd/boards/icy-tree-sof-m0/mpconfigboard.h new file mode 100644 index 0000000000000..713d2c03eb271 --- /dev/null +++ b/ports/atmel-samd/boards/icy-tree-sof-m0/mpconfigboard.h @@ -0,0 +1,55 @@ +#define MICROPY_HW_BOARD_NAME "Adafruit QT Py M0" +#define MICROPY_HW_MCU_NAME "samd21e18" + +#define MICROPY_HW_NEOPIXEL (&pin_PA18) + +#define MICROPY_PORT_A (0) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) + +#define IGNORE_PIN_PA00 1 +#define IGNORE_PIN_PA01 1 +#define IGNORE_PIN_PA12 1 +#define IGNORE_PIN_PA13 1 +#define IGNORE_PIN_PA14 1 +#define IGNORE_PIN_PA20 1 +#define IGNORE_PIN_PA21 1 +// USB is always used internally so skip the pin objects for it. +#define IGNORE_PIN_PA24 1 +#define IGNORE_PIN_PA25 1 +#define IGNORE_PIN_PA27 1 +#define IGNORE_PIN_PA28 1 +#define IGNORE_PIN_PA30 1 +#define IGNORE_PIN_PA31 1 +#define IGNORE_PIN_PB01 1 +#define IGNORE_PIN_PB02 1 +#define IGNORE_PIN_PB03 1 +#define IGNORE_PIN_PB04 1 +#define IGNORE_PIN_PB05 1 +#define IGNORE_PIN_PB06 1 +#define IGNORE_PIN_PB07 1 +#define IGNORE_PIN_PB08 1 +#define IGNORE_PIN_PB09 1 +#define IGNORE_PIN_PB10 1 +#define IGNORE_PIN_PB11 1 +#define IGNORE_PIN_PB12 1 +#define IGNORE_PIN_PB13 1 +#define IGNORE_PIN_PB14 1 +#define IGNORE_PIN_PB15 1 +#define IGNORE_PIN_PB16 1 +#define IGNORE_PIN_PB17 1 +#define IGNORE_PIN_PB22 1 +#define IGNORE_PIN_PB23 1 +#define IGNORE_PIN_PB30 1 +#define IGNORE_PIN_PB31 1 +#define IGNORE_PIN_PB00 1 + +#define DEFAULT_I2C_BUS_SCL (&pin_PA17) +#define DEFAULT_I2C_BUS_SDA (&pin_PA16) + +#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) diff --git a/ports/atmel-samd/boards/icy-tree-sof-m0/mpconfigboard.mk b/ports/atmel-samd/boards/icy-tree-sof-m0/mpconfigboard.mk new file mode 100644 index 0000000000000..964cbe643ad86 --- /dev/null +++ b/ports/atmel-samd/boards/icy-tree-sof-m0/mpconfigboard.mk @@ -0,0 +1,24 @@ +USB_VID = 0x239A +USB_PID = 0x80CC +USB_PRODUCT = "QT Py M0" +USB_MANUFACTURER = "Adafruit Industries LLC" + +CHIP_VARIANT = SAMD21E18A +CHIP_FAMILY = samd21 + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = NONE +CIRCUITPY_FULL_BUILD = 0 + +SUPEROPT_GC = 0 + +CFLAGS_BOARD = --param max-inline-insns-auto=15 +ifeq ($(TRANSLATION), zh_Latn_pinyin) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +endif +ifeq ($(TRANSLATION), de_DE) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +SUPEROPT_VM = 0 +endif diff --git a/ports/atmel-samd/boards/icy-tree-sof-m0/pins.c b/ports/atmel-samd/boards/icy-tree-sof-m0/pins.c new file mode 100644 index 0000000000000..636c48bffc7b9 --- /dev/null +++ b/ports/atmel-samd/boards/icy-tree-sof-m0/pins.c @@ -0,0 +1,49 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA03) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA03) }, + + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA04) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA04) }, + + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA05) }, + + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA16) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA16) }, + + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA17) }, + + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA06) }, + + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA07) }, + + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA11) }, + + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA09) }, + + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA10) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_PA15) }, + + { 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); From 0e628caa6f0697ee8747df50c6ad3bfd9a76e4f6 Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Mon, 23 Nov 2020 19:23:22 -0500 Subject: [PATCH 269/770] forgot the build.yml files --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8e72a4021915f..06cc49923d189 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -199,6 +199,7 @@ jobs: - "clue_nrf52840_express" - "cp32-m4" - "cp_sapling_m0" + - "cp_sapling_m0_spiflash" - "datalore_ip_m4" - "datum_distance" - "datum_imu" From e5cee989771f6c79b91e8c3a039d167bf7022fa4 Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Mon, 23 Nov 2020 19:31:06 -0500 Subject: [PATCH 270/770] removing icy tree files/directory --- .../atmel-samd/boards/icy-tree-sof-m0/board.c | 44 --------------- .../boards/icy-tree-sof-m0/mpconfigboard.h | 55 ------------------- .../boards/icy-tree-sof-m0/mpconfigboard.mk | 24 -------- .../atmel-samd/boards/icy-tree-sof-m0/pins.c | 49 ----------------- 4 files changed, 172 deletions(-) delete mode 100644 ports/atmel-samd/boards/icy-tree-sof-m0/board.c delete mode 100644 ports/atmel-samd/boards/icy-tree-sof-m0/mpconfigboard.h delete mode 100644 ports/atmel-samd/boards/icy-tree-sof-m0/mpconfigboard.mk delete mode 100644 ports/atmel-samd/boards/icy-tree-sof-m0/pins.c diff --git a/ports/atmel-samd/boards/icy-tree-sof-m0/board.c b/ports/atmel-samd/boards/icy-tree-sof-m0/board.c deleted file mode 100644 index 1a65a561f7c7d..0000000000000 --- a/ports/atmel-samd/boards/icy-tree-sof-m0/board.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 "common-hal/microcontroller/Pin.h" -#include "supervisor/shared/board.h" -#include "hal/include/hal_gpio.h" - -void board_init(void) { - gpio_set_pin_function(PIN_PA15, GPIO_PIN_FUNCTION_OFF); - gpio_set_pin_direction(PIN_PA15, GPIO_DIRECTION_OUT); - gpio_set_pin_level(PIN_PA15, true); // Turn on neopixel by default - never_reset_pin_number(PIN_PA15); -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} diff --git a/ports/atmel-samd/boards/icy-tree-sof-m0/mpconfigboard.h b/ports/atmel-samd/boards/icy-tree-sof-m0/mpconfigboard.h deleted file mode 100644 index 713d2c03eb271..0000000000000 --- a/ports/atmel-samd/boards/icy-tree-sof-m0/mpconfigboard.h +++ /dev/null @@ -1,55 +0,0 @@ -#define MICROPY_HW_BOARD_NAME "Adafruit QT Py M0" -#define MICROPY_HW_MCU_NAME "samd21e18" - -#define MICROPY_HW_NEOPIXEL (&pin_PA18) - -#define MICROPY_PORT_A (0) -#define MICROPY_PORT_B (0) -#define MICROPY_PORT_C (0) - -#define IGNORE_PIN_PA00 1 -#define IGNORE_PIN_PA01 1 -#define IGNORE_PIN_PA12 1 -#define IGNORE_PIN_PA13 1 -#define IGNORE_PIN_PA14 1 -#define IGNORE_PIN_PA20 1 -#define IGNORE_PIN_PA21 1 -// USB is always used internally so skip the pin objects for it. -#define IGNORE_PIN_PA24 1 -#define IGNORE_PIN_PA25 1 -#define IGNORE_PIN_PA27 1 -#define IGNORE_PIN_PA28 1 -#define IGNORE_PIN_PA30 1 -#define IGNORE_PIN_PA31 1 -#define IGNORE_PIN_PB01 1 -#define IGNORE_PIN_PB02 1 -#define IGNORE_PIN_PB03 1 -#define IGNORE_PIN_PB04 1 -#define IGNORE_PIN_PB05 1 -#define IGNORE_PIN_PB06 1 -#define IGNORE_PIN_PB07 1 -#define IGNORE_PIN_PB08 1 -#define IGNORE_PIN_PB09 1 -#define IGNORE_PIN_PB10 1 -#define IGNORE_PIN_PB11 1 -#define IGNORE_PIN_PB12 1 -#define IGNORE_PIN_PB13 1 -#define IGNORE_PIN_PB14 1 -#define IGNORE_PIN_PB15 1 -#define IGNORE_PIN_PB16 1 -#define IGNORE_PIN_PB17 1 -#define IGNORE_PIN_PB22 1 -#define IGNORE_PIN_PB23 1 -#define IGNORE_PIN_PB30 1 -#define IGNORE_PIN_PB31 1 -#define IGNORE_PIN_PB00 1 - -#define DEFAULT_I2C_BUS_SCL (&pin_PA17) -#define DEFAULT_I2C_BUS_SDA (&pin_PA16) - -#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) diff --git a/ports/atmel-samd/boards/icy-tree-sof-m0/mpconfigboard.mk b/ports/atmel-samd/boards/icy-tree-sof-m0/mpconfigboard.mk deleted file mode 100644 index 964cbe643ad86..0000000000000 --- a/ports/atmel-samd/boards/icy-tree-sof-m0/mpconfigboard.mk +++ /dev/null @@ -1,24 +0,0 @@ -USB_VID = 0x239A -USB_PID = 0x80CC -USB_PRODUCT = "QT Py M0" -USB_MANUFACTURER = "Adafruit Industries LLC" - -CHIP_VARIANT = SAMD21E18A -CHIP_FAMILY = samd21 - -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = NONE -CIRCUITPY_FULL_BUILD = 0 - -SUPEROPT_GC = 0 - -CFLAGS_BOARD = --param max-inline-insns-auto=15 -ifeq ($(TRANSLATION), zh_Latn_pinyin) -RELEASE_NEEDS_CLEAN_BUILD = 1 -CFLAGS_INLINE_LIMIT = 35 -endif -ifeq ($(TRANSLATION), de_DE) -RELEASE_NEEDS_CLEAN_BUILD = 1 -CFLAGS_INLINE_LIMIT = 35 -SUPEROPT_VM = 0 -endif diff --git a/ports/atmel-samd/boards/icy-tree-sof-m0/pins.c b/ports/atmel-samd/boards/icy-tree-sof-m0/pins.c deleted file mode 100644 index 636c48bffc7b9..0000000000000 --- a/ports/atmel-samd/boards/icy-tree-sof-m0/pins.c +++ /dev/null @@ -1,49 +0,0 @@ -#include "shared-bindings/board/__init__.h" - -STATIC const mp_rom_map_elem_t board_global_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA02) }, - { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, - - { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA03) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA03) }, - - { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA04) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA04) }, - - { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA05) }, - { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA05) }, - - { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA16) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA16) }, - - { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA17) }, - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA17) }, - - { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA06) }, - - { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA07) }, - { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PA07) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA07) }, - - { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA11) }, - { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PA11) }, - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA11) }, - - { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA09) }, - - { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA10) }, - { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_PA10) }, - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA10) }, - - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA18) }, - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_PA15) }, - - { 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); From 7a45afc54919162df342fab421ed113ff1771d01 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 23 Nov 2020 22:44:53 -0500 Subject: [PATCH 271/770] working, but need to avoid deep sleeping too fast before USB ready --- main.c | 104 ++++++++++-------- ports/esp32s2/Makefile | 4 +- ports/esp32s2/common-hal/alarm/__init__.c | 4 +- .../common-hal/microcontroller/__init__.c | 4 +- py/circuitpy_defns.mk | 1 + shared-bindings/alarm/__init__.h | 3 + shared-bindings/microcontroller/__init__.c | 14 --- shared-bindings/microcontroller/__init__.h | 2 +- shared-bindings/supervisor/RunReason.c | 4 +- shared-bindings/supervisor/Runtime.c | 3 + shared-bindings/supervisor/__init__.c | 51 ++++++++- supervisor/shared/workflow.c | 26 +++++ supervisor/shared/workflow.h | 8 +- 13 files changed, 153 insertions(+), 75 deletions(-) diff --git a/main.c b/main.c index f77bf41d84108..b2e527ddeff95 100755 --- a/main.c +++ b/main.c @@ -47,17 +47,17 @@ #include "mpconfigboard.h" #include "supervisor/background_callback.h" #include "supervisor/cpu.h" +#include "supervisor/filesystem.h" #include "supervisor/memory.h" #include "supervisor/port.h" -#include "supervisor/filesystem.h" +#include "supervisor/serial.h" #include "supervisor/shared/autoreload.h" -#include "supervisor/shared/translate.h" #include "supervisor/shared/rgb_led_status.h" #include "supervisor/shared/safe_mode.h" -#include "supervisor/shared/status_leds.h" #include "supervisor/shared/stack.h" +#include "supervisor/shared/status_leds.h" +#include "supervisor/shared/translate.h" #include "supervisor/shared/workflow.h" -#include "supervisor/serial.h" #include "supervisor/usb.h" #include "shared-bindings/microcontroller/__init__.h" @@ -66,6 +66,8 @@ #include "boards/board.h" +#include "esp_log.h" + #if CIRCUITPY_ALARM #include "shared-bindings/alarm/__init__.h" #endif @@ -101,26 +103,6 @@ // How long to flash errors on the RGB status LED before going to sleep (secs) #define CIRCUITPY_FLASH_ERROR_PERIOD 10 -void do_str(const char *src, mp_parse_input_kind_t input_kind) { - mp_lexer_t *lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, src, strlen(src), 0); - if (lex == NULL) { - //printf("MemoryError: lexer could not allocate memory\n"); - return; - } - - nlr_buf_t nlr; - if (nlr_push(&nlr) == 0) { - qstr source_name = lex->source_name; - mp_parse_tree_t parse_tree = mp_parse(lex, input_kind); - mp_obj_t module_fun = mp_compile(&parse_tree, source_name, MP_EMIT_OPT_NONE, true); - mp_call_function_0(module_fun); - nlr_pop(); - } else { - // uncaught exception - mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val); - } -} - #if MICROPY_ENABLE_PYSTACK static size_t PLACE_IN_DTCM_BSS(_pystack[CIRCUITPY_PYSTACK_SIZE / sizeof(size_t)]); #endif @@ -131,9 +113,13 @@ static void reset_devices(void) { #endif } -void start_mp(supervisor_allocation* heap) { +STATIC void start_mp(supervisor_allocation* heap) { reset_status_led(); autoreload_stop(); + supervisor_workflow_reset(); +#if CIRCUITPY_ALARM + alarm_reset(); +#endif // Stack limit should be less than real stack size, so we have a chance // to recover from limit hit. (Limit is measured in bytes.) @@ -182,7 +168,7 @@ void start_mp(supervisor_allocation* heap) { #endif } -void stop_mp(void) { +STATIC void stop_mp(void) { #if CIRCUITPY_NETWORK network_module_deinit(); #endif @@ -207,7 +193,7 @@ void stop_mp(void) { // Look for the first file that exists in the list of filenames, using mp_import_stat(). // Return its index. If no file found, return -1. -const char* first_existing_file_in_list(const char * const * filenames) { +STATIC const char* first_existing_file_in_list(const char * const * filenames) { for (int i = 0; filenames[i] != (char*)""; i++) { mp_import_stat_t stat = mp_import_stat(filenames[i]); if (stat == MP_IMPORT_STAT_FILE) { @@ -217,7 +203,7 @@ const char* first_existing_file_in_list(const char * const * filenames) { return NULL; } -bool maybe_run_list(const char * const * filenames, pyexec_result_t* exec_result) { +STATIC bool maybe_run_list(const char * const * filenames, pyexec_result_t* exec_result) { const char* filename = first_existing_file_in_list(filenames); if (filename == NULL) { return false; @@ -231,7 +217,7 @@ bool maybe_run_list(const char * const * filenames, pyexec_result_t* exec_result return true; } -void cleanup_after_vm(supervisor_allocation* heap) { +STATIC void cleanup_after_vm(supervisor_allocation* heap) { // Reset port-independent devices, like CIRCUITPY_BLEIO_HCI. reset_devices(); // Turn off the display and flush the fileystem before the heap disappears. @@ -260,7 +246,7 @@ void cleanup_after_vm(supervisor_allocation* heap) { reset_status_led(); } -void print_code_py_status_message(safe_mode_t safe_mode) { +STATIC void print_code_py_status_message(safe_mode_t safe_mode) { if (autoreload_is_enabled()) { serial_write_compressed(translate("Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.\n")); } else { @@ -272,7 +258,7 @@ void print_code_py_status_message(safe_mode_t safe_mode) { } } -bool run_code_py(safe_mode_t safe_mode) { +STATIC bool run_code_py(safe_mode_t safe_mode) { bool serial_connected_at_start = serial_connected(); #if CIRCUITPY_AUTORELOAD_DELAY_MS > 0 if (serial_connected_at_start) { @@ -318,6 +304,8 @@ bool run_code_py(safe_mode_t safe_mode) { } } + // Program has finished running. + // Display a different completion message if the user has no USB attached (cannot save files) if (!serial_connected_at_start) { serial_write_compressed(translate("\nCode done running. Waiting for reload.\n")); @@ -329,11 +317,26 @@ bool run_code_py(safe_mode_t safe_mode) { #endif rgb_status_animation_t animation; bool ok = result.return_code != PYEXEC_EXCEPTION; - // If USB isn't enumerated then deep sleep. - if (ok && !supervisor_workflow_active() && supervisor_ticks_ms64() > CIRCUITPY_USB_ENUMERATION_DELAY * 1024) { - common_hal_mcu_deep_sleep(); - } - // Show the animation every N seconds. + + ESP_LOGI("main", "common_hal_alarm_enable_deep_sleep_alarms()"); + // Decide whether to deep sleep. + #if CIRCUITPY_ALARM + // Enable pin or time alarms before sleeping. + common_hal_alarm_enable_deep_sleep_alarms(); + #endif + + // Normally we won't deep sleep if there was an error or if we are connected to a host + // but either of those can be enabled. + // *********DON'T SLEEP IF USB HASN'T HAD TIME TO ENUMERATE. + bool will_deep_sleep = + (ok || supervisor_workflow_get_allow_deep_sleep_on_error()) && + (!supervisor_workflow_active() || supervisor_workflow_get_allow_deep_sleep_when_connected()); + + ESP_LOGI("main", "ok %d", will_deep_sleep); + ESP_LOGI("main", "...on_error() %d", supervisor_workflow_get_allow_deep_sleep_on_error()); + ESP_LOGI("main", "supervisor_workflow_active() %d", supervisor_workflow_active()); + ESP_LOGI("main", "...when_connected() %d", supervisor_workflow_get_allow_deep_sleep_when_connected()); + will_deep_sleep = false; prep_rgb_status_animation(&result, found_main, safe_mode, &animation); while (true) { RUN_BACKGROUND_TASKS; @@ -356,9 +359,12 @@ bool run_code_py(safe_mode_t safe_mode) { if (!serial_connected_at_start) { print_code_py_status_message(safe_mode); } - print_safe_mode_message(safe_mode); - serial_write("\n"); - serial_write_compressed(translate("Press any key to enter the REPL. Use CTRL-D to reload.")); + // We won't be going into the REPL if we're going to sleep. + if (!will_deep_sleep) { + print_safe_mode_message(safe_mode); + serial_write("\n"); + serial_write_compressed(translate("Press any key to enter the REPL. Use CTRL-D to reload.")); + } } if (serial_connected_before_animation && !serial_connected()) { serial_connected_at_start = false; @@ -371,16 +377,22 @@ bool run_code_py(safe_mode_t safe_mode) { refreshed_epaper_display = maybe_refresh_epaperdisplay(); } #endif - bool animation_done = tick_rgb_status_animation(&animation); - if (animation_done && supervisor_workflow_active()) { - #if CIRCUITPY_ALARM + + bool animation_done = false; + if (will_deep_sleep && ok) { + // Skip animation if everything is OK. + animation_done = true; + } else { + animation_done = tick_rgb_status_animation(&animation); + } + // Do an error animation only once before deep-sleeping. + if (animation_done && will_deep_sleep) { int64_t remaining_enumeration_wait = CIRCUITPY_USB_ENUMERATION_DELAY * 1024 - supervisor_ticks_ms64(); // If USB isn't enumerated then deep sleep after our waiting period. if (ok && remaining_enumeration_wait < 0) { common_hal_mcu_deep_sleep(); - return false; // Doesn't actually get here. + // Does not return. } - #endif // Wake up every so often to flash the error code. if (!ok) { port_interrupt_after_ticks(CIRCUITPY_FLASH_ERROR_PERIOD * 1024); @@ -394,7 +406,7 @@ bool run_code_py(safe_mode_t safe_mode) { FIL* boot_output_file; -void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) { +STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) { // If not in safe mode, run boot before initing USB and capture output in a // file. if (filesystem_present() && safe_mode == NO_SAFE_MODE && MP_STATE_VM(vfs_mount_table) != NULL) { @@ -473,7 +485,7 @@ void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) { } } -int run_repl(void) { +STATIC int run_repl(void) { int exit_code = PYEXEC_FORCED_EXIT; stack_resize(); filesystem_flush(); diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 55d6e91d44cb7..794df0dabad08 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -332,10 +332,10 @@ $(BUILD)/firmware.uf2: $(BUILD)/circuitpython-firmware.bin $(Q)$(PYTHON3) $(TOP)/tools/uf2/utils/uf2conv.py -f 0xbfdd4eee -b 0x0000 -c -o $@ $^ flash: $(BUILD)/firmware.bin - esptool.py --chip esp32s2 -p $(PORT) --no-stub -b 460800 --before=default_reset --after=hard_reset write_flash $(FLASH_FLAGS) 0x0000 $^ + esptool.py --chip esp32s2 -p $(PORT) --no-stub -b 460800 --before=default_reset --after=no_reset write_flash $(FLASH_FLAGS) 0x0000 $^ flash-circuitpython-only: $(BUILD)/circuitpython-firmware.bin - esptool.py --chip esp32s2 -p $(PORT) --no-stub -b 460800 --before=default_reset --after=hard_reset write_flash $(FLASH_FLAGS) 0x10000 $^ + esptool.py --chip esp32s2 -p $(PORT) --no-stub -b 460800 --before=default_reset --after=no_reset write_flash $(FLASH_FLAGS) 0x10000 $^ include $(TOP)/py/mkrules.mk diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index 0ea476d860e05..87276bdaf0bae 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -95,7 +95,7 @@ void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *ala _deep_sleep_alarms = mp_obj_new_tuple(n_alarms, alarms); } -void common_hal_deep_sleep_with_alarms(void) { +void common_hal_alarm_enable_deep_sleep_alarms(void) { for (size_t i = 0; i < _deep_sleep_alarms->len; i++) { mp_obj_t alarm = _deep_sleep_alarms->items[i]; if (MP_OBJ_IS_TYPE(alarm, &alarm_time_duration_alarm_type)) { @@ -105,6 +105,4 @@ void common_hal_deep_sleep_with_alarms(void) { } // TODO: handle pin alarms } - - common_hal_mcu_deep_sleep(); } diff --git a/ports/esp32s2/common-hal/microcontroller/__init__.c b/ports/esp32s2/common-hal/microcontroller/__init__.c index 59eb1afcc0737..5aa0ff8edac11 100644 --- a/ports/esp32s2/common-hal/microcontroller/__init__.c +++ b/ports/esp32s2/common-hal/microcontroller/__init__.c @@ -80,11 +80,9 @@ void common_hal_mcu_reset(void) { while(1); } -void common_hal_mcu_deep_sleep(void) { +void NORETURN common_hal_mcu_deep_sleep(void) { // Shut down wifi cleanly. esp_wifi_stop(); - - // Does not return. esp_deep_sleep_start(); } diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 2731f2ae8d701..27466282a8930 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -403,6 +403,7 @@ $(filter $(SRC_PATTERNS), \ math/__init__.c \ microcontroller/ResetReason.c \ microcontroller/RunMode.c \ + supervisor/RunReason.c \ ) SRC_BINDINGS_ENUMS += \ diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h index c74dfbe5c3c0b..d8d6812c908dd 100644 --- a/shared-bindings/alarm/__init__.h +++ b/shared-bindings/alarm/__init__.h @@ -29,7 +29,10 @@ #include "py/obj.h" +#include "common-hal/alarm/__init__.h" + extern mp_obj_t common_hal_alarm_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms); +extern void common_hal_alarm_enable_deep_sleep_alarms(void); extern void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms); // Used by wake-up code. diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index d6ce323c58992..d09cf8f445fcc 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -56,19 +56,6 @@ //| This object is the sole instance of `microcontroller.Processor`.""" //| -//| def deep_sleep() -> None: -//| Go into deep sleep. If the board is connected via USB, disconnect USB first. -//| -//| The board will awake from deep sleep only if the reset button is pressed -//| or it is awoken by an alarm set by `alarm.set_deep_sleep_alarms()`. -//| ... -//| -STATIC mp_obj_t mcu_deep_sleep(void){ - - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_0(mcu_deep_sleep_obj, mcu_deep_sleep); - //| def delay_us(delay: int) -> None: //| """Dedicated delay method used for very short delays. **Do not** do long delays //| because this stops all other functions from completing. Think of this as an empty @@ -177,7 +164,6 @@ const mp_obj_module_t mcu_pin_module = { STATIC const mp_rom_map_elem_t mcu_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_microcontroller) }, { MP_ROM_QSTR(MP_QSTR_cpu), MP_ROM_PTR(&common_hal_mcu_processor_obj) }, - { MP_ROM_QSTR(MP_QSTR_deep_sleep), MP_ROM_PTR(&mcu_deep_sleep_obj) }, { MP_ROM_QSTR(MP_QSTR_delay_us), MP_ROM_PTR(&mcu_delay_us_obj) }, { MP_ROM_QSTR(MP_QSTR_disable_interrupts), MP_ROM_PTR(&mcu_disable_interrupts_obj) }, { MP_ROM_QSTR(MP_QSTR_enable_interrupts), MP_ROM_PTR(&mcu_enable_interrupts_obj) }, diff --git a/shared-bindings/microcontroller/__init__.h b/shared-bindings/microcontroller/__init__.h index c6ccccea727f5..87284fc2e55fa 100644 --- a/shared-bindings/microcontroller/__init__.h +++ b/shared-bindings/microcontroller/__init__.h @@ -43,7 +43,7 @@ extern void common_hal_mcu_enable_interrupts(void); extern void common_hal_mcu_on_next_reset(mcu_runmode_t runmode); extern void common_hal_mcu_reset(void); -extern void common_hal_mcu_deep_sleep(void); +extern void NORETURN common_hal_mcu_deep_sleep(void); extern const mp_obj_dict_t mcu_pin_globals; diff --git a/shared-bindings/supervisor/RunReason.c b/shared-bindings/supervisor/RunReason.c index 7e7a74d2f4460..73f62fed6db38 100644 --- a/shared-bindings/supervisor/RunReason.c +++ b/shared-bindings/supervisor/RunReason.c @@ -29,7 +29,7 @@ #include "shared-bindings/supervisor/RunReason.h" MAKE_ENUM_VALUE(supervisor_run_reason_type, run_reason, STARTUP, RUN_REASON_STARTUP); -MAKE_ENUM_VALUE(supervisor_run_reason_type, run_reason, AUTORELOAD, RUN_REASON_AUTO_RELOAD); +MAKE_ENUM_VALUE(supervisor_run_reason_type, run_reason, AUTO_RELOAD, RUN_REASON_AUTO_RELOAD); MAKE_ENUM_VALUE(supervisor_run_reason_type, run_reason, SUPERVISOR_RELOAD, RUN_REASON_SUPERVISOR_RELOAD); MAKE_ENUM_VALUE(supervisor_run_reason_type, run_reason, REPL_RELOAD, RUN_REASON_REPL_RELOAD); @@ -49,7 +49,7 @@ MAKE_ENUM_VALUE(supervisor_run_reason_type, run_reason, REPL_RELOAD, RUN_REASON_ //| REPL_RELOAD: object //| """CircuitPython started due to the user typing CTRL-D in the REPL.""" //| -MAKE_ENUM_MAP(run_reason) { +MAKE_ENUM_MAP(supervisor_run_reason) { MAKE_ENUM_MAP_ENTRY(run_reason, STARTUP), MAKE_ENUM_MAP_ENTRY(run_reason, AUTO_RELOAD), MAKE_ENUM_MAP_ENTRY(run_reason, SUPERVISOR_RELOAD), diff --git a/shared-bindings/supervisor/Runtime.c b/shared-bindings/supervisor/Runtime.c index 67193e051ed1c..1a283b35c00da 100755 --- a/shared-bindings/supervisor/Runtime.c +++ b/shared-bindings/supervisor/Runtime.c @@ -25,8 +25,11 @@ */ #include +#include "py/obj.h" #include "py/enum.h" +#include "py/runtime.h" #include "py/objproperty.h" + #include "shared-bindings/supervisor/RunReason.h" #include "shared-bindings/supervisor/Runtime.h" diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c index 4d2d6db3093ba..c13b19e48e9ff 100644 --- a/shared-bindings/supervisor/__init__.c +++ b/shared-bindings/supervisor/__init__.c @@ -32,7 +32,9 @@ #include "supervisor/shared/rgb_led_status.h" #include "supervisor/shared/stack.h" #include "supervisor/shared/translate.h" +#include "supervisor/shared/workflow.h" +#include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/supervisor/__init__.h" #include "shared-bindings/supervisor/Runtime.h" @@ -45,6 +47,47 @@ //| This object is the sole instance of `supervisor.Runtime`.""" //| +//| def allow_deep_sleep(*, when_connected: bool = False, on_error: bool = False): +//| """Configure when CircuitPython can go into deep sleep. Deep sleep can occur +//| after a program has finished running or when `supervisor.deep_sleep_now()` is called. +//| +//| :param bool when_connected: If ``True``, CircuitPython will go into deep sleep +//| when a program finishes, even if it is connected to a host computer over USB or other means. +//| It will disconnect from the host before sleeping. +//| If ``False``, deep sleep will not be entered if connected. +//| :param bool on_error: If ``True``, deep sleep will be entered if even a program +//| terminated due to an exception or fatal error. If ``False``, an error will cause +//| CircuitPython to stay awake, flashing error codes on the status RGB LED, if available. +//| ... +//| +STATIC mp_obj_t supervisor_allow_deep_sleep(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_when_connected, ARG_on_error }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_when_connected, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, + { MP_QSTR_on_error, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + supervisor_workflow_set_allow_deep_sleep_when_connected(args[ARG_when_connected].u_bool); + supervisor_workflow_set_allow_deep_sleep_on_error(args[ARG_on_error].u_bool); + + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_KW(supervisor_allow_deep_sleep_obj, 0, supervisor_allow_deep_sleep); + +//| def deep_sleep(): -> None +//| """Go into deep sleep mode immediately, if not connected to a host computer. +//| But if connected and `supervisor.runtime.allow_deep_sleep(when_connected=true)` +//| has not been called, simply restart. +//| + +STATIC mp_obj_t supervisor_deep_sleep(void) { + common_hal_mcu_deep_sleep(); +} +MP_DEFINE_CONST_FUN_OBJ_0(supervisor_deep_sleep_obj, supervisor_deep_sleep); + //| def enable_autoreload() -> None: //| """Enable autoreload based on USB file write activity.""" //| ... @@ -112,9 +155,11 @@ MP_DEFINE_CONST_FUN_OBJ_1(supervisor_set_next_stack_limit_obj, supervisor_set_ne STATIC const mp_rom_map_elem_t supervisor_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_supervisor) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_enable_autoreload), MP_ROM_PTR(&supervisor_enable_autoreload_obj) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_disable_autoreload), MP_ROM_PTR(&supervisor_disable_autoreload_obj) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_set_rgb_status_brightness), MP_ROM_PTR(&supervisor_set_rgb_status_brightness_obj) }, + { MP_ROM_QSTR(MP_QSTR_allow_deep_sleep), MP_ROM_PTR(&supervisor_allow_deep_sleep_obj) }, + { MP_ROM_QSTR(MP_QSTR_deep_sleep), MP_ROM_PTR(&supervisor_deep_sleep_obj) }, + { MP_ROM_QSTR(MP_QSTR_enable_autoreload), MP_ROM_PTR(&supervisor_enable_autoreload_obj) }, + { MP_ROM_QSTR(MP_QSTR_disable_autoreload), MP_ROM_PTR(&supervisor_disable_autoreload_obj) }, + { MP_ROM_QSTR(MP_QSTR_set_rgb_status_brightness), MP_ROM_PTR(&supervisor_set_rgb_status_brightness_obj) }, { MP_ROM_QSTR(MP_QSTR_runtime), MP_ROM_PTR(&common_hal_supervisor_runtime_obj) }, { MP_ROM_QSTR(MP_QSTR_reload), MP_ROM_PTR(&supervisor_reload_obj) }, { MP_ROM_QSTR(MP_QSTR_set_next_stack_limit), MP_ROM_PTR(&supervisor_set_next_stack_limit_obj) }, diff --git a/supervisor/shared/workflow.c b/supervisor/shared/workflow.c index 41af22eb70626..67d191172fb4c 100644 --- a/supervisor/shared/workflow.c +++ b/supervisor/shared/workflow.c @@ -25,10 +25,36 @@ */ #include +#include "py/mpconfig.h" #include "tusb.h" +STATIC bool _allow_deep_sleep_when_connected; +STATIC bool _allow_deep_sleep_on_error; + + +void supervisor_workflow_reset(void) { + _allow_deep_sleep_when_connected = false; + _allow_deep_sleep_on_error = false; +} + bool supervisor_workflow_active(void) { // Eventually there might be other non-USB workflows, such as BLE. // tud_ready() checks for usb mounted and not suspended. return tud_ready(); } + +bool supervisor_workflow_get_allow_deep_sleep_when_connected(void) { + return _allow_deep_sleep_when_connected; +} + +void supervisor_workflow_set_allow_deep_sleep_when_connected(bool allow) { + _allow_deep_sleep_when_connected = allow; +} + +bool supervisor_workflow_get_allow_deep_sleep_on_error(void) { + return _allow_deep_sleep_on_error; +} + +void supervisor_workflow_set_allow_deep_sleep_on_error(bool allow) { + _allow_deep_sleep_on_error = allow; +} diff --git a/supervisor/shared/workflow.h b/supervisor/shared/workflow.h index 2968961f48556..97584a1f466f5 100644 --- a/supervisor/shared/workflow.h +++ b/supervisor/shared/workflow.h @@ -26,6 +26,12 @@ #pragma once -extern volatile bool _workflow_active; +extern void supervisor_workflow_reset(void); extern bool supervisor_workflow_active(void); + +extern bool supervisor_workflow_get_allow_deep_sleep_when_connected(void); +extern void supervisor_workflow_set_allow_deep_sleep_when_connected(bool allow); + +extern bool supervisor_workflow_get_allow_deep_sleep_on_error(void); +extern void supervisor_workflow_set_allow_deep_sleep_on_error(bool allow); From 6ff24410ebe9e75456b9d5d64f37fbe019caf42c Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Tue, 24 Nov 2020 11:44:11 +0530 Subject: [PATCH 272/770] use values pointer directly --- ports/esp32s2/common-hal/nvm/ByteArray.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/ports/esp32s2/common-hal/nvm/ByteArray.c b/ports/esp32s2/common-hal/nvm/ByteArray.c index e304dd83028f1..71321e7e6536c 100644 --- a/ports/esp32s2/common-hal/nvm/ByteArray.c +++ b/ports/esp32s2/common-hal/nvm/ByteArray.c @@ -26,8 +26,6 @@ #include "common-hal/nvm/ByteArray.h" -#include - #include "py/runtime.h" #include "nvs_flash.h" @@ -56,9 +54,6 @@ bool common_hal_nvm_bytearray_set_bytes(nvm_bytearray_obj_t *self, uint32_t start_index, uint8_t* values, uint32_t len) { char index[9]; - uint8_t buffer[len]; - memcpy(buffer, values, len); - // start nvs nvs_handle_t handle; get_nvs_handle(&handle); @@ -66,7 +61,7 @@ bool common_hal_nvm_bytearray_set_bytes(nvm_bytearray_obj_t *self, // stage flash changes for (uint32_t i = 0; i < len; i++) { sprintf(index, "%i", start_index + i); - if (nvs_set_u8(handle, (const char *)index, buffer[i]) != ESP_OK) { + if (nvs_set_u8(handle, (const char *)index, values[i]) != ESP_OK) { return false; } } @@ -84,7 +79,6 @@ bool common_hal_nvm_bytearray_set_bytes(nvm_bytearray_obj_t *self, void common_hal_nvm_bytearray_get_bytes(nvm_bytearray_obj_t *self, uint32_t start_index, uint32_t len, uint8_t* values) { char index[9]; - uint8_t buffer[len]; // start nvs nvs_handle_t handle; @@ -93,14 +87,11 @@ void common_hal_nvm_bytearray_get_bytes(nvm_bytearray_obj_t *self, // get from flash for (uint32_t i = 0; i < len; i++) { sprintf(index, "%i", start_index + i); - if (nvs_get_u8(handle, (const char *)index, &buffer[i]) != ESP_OK) { + if (nvs_get_u8(handle, (const char *)index, &values[i]) != ESP_OK) { mp_raise_RuntimeError(translate("NVS Error")); } } - // set into values - memcpy(values, buffer, len); - // close nvs nvs_close(handle); } From f8499a468e79999decdf5002016bbfe99994f47b Mon Sep 17 00:00:00 2001 From: jgillick Date: Mon, 23 Nov 2020 22:56:38 -0800 Subject: [PATCH 273/770] Remove filesystem from linker script. --- .../{STM32F411_nvm_flash.ld => STM32F411_nvm_nofs.ld} | 10 ++++------ ports/stm/boards/thunderpack_v12/mpconfigboard.h | 4 ++-- ports/stm/boards/thunderpack_v12/mpconfigboard.mk | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) rename ports/stm/boards/{STM32F411_nvm_flash.ld => STM32F411_nvm_nofs.ld} (64%) diff --git a/ports/stm/boards/STM32F411_nvm_flash.ld b/ports/stm/boards/STM32F411_nvm_nofs.ld similarity index 64% rename from ports/stm/boards/STM32F411_nvm_flash.ld rename to ports/stm/boards/STM32F411_nvm_nofs.ld index ced739765d686..e4630518cd00a 100644 --- a/ports/stm/boards/STM32F411_nvm_flash.ld +++ b/ports/stm/boards/STM32F411_nvm_nofs.ld @@ -1,7 +1,6 @@ /* - GNU linker script for STM32F411 with nvm and an external flash chip, and reserves - more space for the CircuitPython firmware and less for the filesystem - (since the filesystem will be on the external flash chip). + GNU linker script for STM32F411 with nvm and an external flash chip. + No space is reserved for a filesystem. */ /* Specify the memory areas */ @@ -9,9 +8,8 @@ MEMORY { FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K /* entire flash */ FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */ - FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 32K /* sectors 1,2 are 16K */ - FLASH_NVM (rwx) : ORIGIN = 0x0800C000, LENGTH = 16K /* sector 3 is 16K */ - FLASH_FIRMWARE (rx) : ORIGIN = 0x08010000, LENGTH = 448K /* sector 4 is 64K, sectors 5,6,7 are 128K */ + FLASH_NVM (rwx) : ORIGIN = 0x08004000, LENGTH = 16K /* sector 1 is 16K */ + FLASH_FIRMWARE (rx) : ORIGIN = 0x08008000, LENGTH = 480K /* sector 2,3 is 16k, sector 4 is 64K, sectors 5,6,7 are 128K */ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K } diff --git a/ports/stm/boards/thunderpack_v12/mpconfigboard.h b/ports/stm/boards/thunderpack_v12/mpconfigboard.h index 57486da280765..fb5f389a370a6 100644 --- a/ports/stm/boards/thunderpack_v12/mpconfigboard.h +++ b/ports/stm/boards/thunderpack_v12/mpconfigboard.h @@ -28,8 +28,8 @@ // Non-volatile memory config #define CIRCUITPY_INTERNAL_NVM_SIZE (0x4000) -#define CIRCUITPY_INTERNAL_NVM_START_ADDR (0x0800C000) -#define CIRCUITPY_INTERNAL_NVM_SECTOR FLASH_SECTOR_3 +#define CIRCUITPY_INTERNAL_NVM_START_ADDR (0x08004000) +#define CIRCUITPY_INTERNAL_NVM_SECTOR FLASH_SECTOR_1 #define NVM_BYTEARRAY_BUFFER_SIZE 512 // Flash config diff --git a/ports/stm/boards/thunderpack_v12/mpconfigboard.mk b/ports/stm/boards/thunderpack_v12/mpconfigboard.mk index d0bc22680f978..a2e1da1011253 100644 --- a/ports/stm/boards/thunderpack_v12/mpconfigboard.mk +++ b/ports/stm/boards/thunderpack_v12/mpconfigboard.mk @@ -18,4 +18,4 @@ MCU_VARIANT = STM32F411xE MCU_PACKAGE = UFQFPN48 LD_COMMON = boards/common_nvm.ld -LD_FILE = boards/STM32F411_nvm_flash.ld +LD_FILE = boards/STM32F411_nvm_nofs.ld From 686edcef3f392ce96ae86bd66e91b6c93f2f986f Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Tue, 24 Nov 2020 07:41:32 -0500 Subject: [PATCH 274/770] fixing PID issues with CI Test (whoops) --- .../atmel-samd/boards/cp_sapling_m0_spiflash/mpconfigboard.h | 2 +- .../atmel-samd/boards/cp_sapling_m0_spiflash/mpconfigboard.mk | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/atmel-samd/boards/cp_sapling_m0_spiflash/mpconfigboard.h b/ports/atmel-samd/boards/cp_sapling_m0_spiflash/mpconfigboard.h index a129566d2da0f..9c69c48026902 100644 --- a/ports/atmel-samd/boards/cp_sapling_m0_spiflash/mpconfigboard.h +++ b/ports/atmel-samd/boards/cp_sapling_m0_spiflash/mpconfigboard.h @@ -1,4 +1,4 @@ -#define MICROPY_HW_BOARD_NAME "CP Sapling M0" +#define MICROPY_HW_BOARD_NAME "CP Sapling M0 w/ SPI Flash" #define MICROPY_HW_MCU_NAME "samd21e18" #define MICROPY_HW_NEOPIXEL (&pin_PA15) diff --git a/ports/atmel-samd/boards/cp_sapling_m0_spiflash/mpconfigboard.mk b/ports/atmel-samd/boards/cp_sapling_m0_spiflash/mpconfigboard.mk index c81209db3b1ff..99e13f7910a77 100644 --- a/ports/atmel-samd/boards/cp_sapling_m0_spiflash/mpconfigboard.mk +++ b/ports/atmel-samd/boards/cp_sapling_m0_spiflash/mpconfigboard.mk @@ -1,6 +1,6 @@ USB_VID = 0x1209 -USB_PID = 0x4DDD -USB_PRODUCT = "CP Sapling" +USB_PID = 0x4DDE +USB_PRODUCT = "CP Sapling M0 w/ SPI Flash" USB_MANUFACTURER = "Oak Development Technologies" CHIP_VARIANT = SAMD21E18A From bafa0501d17eb55726a8decfe19d6f055190d6b1 Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 24 Nov 2020 22:06:59 +0700 Subject: [PATCH 275/770] update to have tud_connected() --- lib/tinyusb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tinyusb b/lib/tinyusb index b870d932e5e1c..218b80e63ab6f 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit b870d932e5e1c6ece4227a5d49cc71e53a744149 +Subproject commit 218b80e63ab6ff87c1851e403f08b3d716d68f5e From ba6e15b0700093933826c054ea44d45993751036 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Tue, 24 Nov 2020 11:32:18 -0500 Subject: [PATCH 276/770] Fix stubs --- shared-bindings/socketpool/Socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/socketpool/Socket.c b/shared-bindings/socketpool/Socket.c index 99e2c8fccbd3b..0e6968d5f47f7 100644 --- a/shared-bindings/socketpool/Socket.c +++ b/shared-bindings/socketpool/Socket.c @@ -276,7 +276,7 @@ STATIC mp_obj_t socketpool_socket_recv_into(size_t n_args, const mp_obj_t *args) } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socketpool_socket_recv_into_obj, 2, 3, socketpool_socket_recv_into); -//| def sendto(self, bytes: ReadableBuffer, address: tuple) -> int: +//| def sendto(self, bytes: ReadableBuffer, address: Tuple[str, int]) -> int: //| """Send some bytes to a specific address. //| Suits sockets of type SOCK_DGRAM //| @@ -308,7 +308,7 @@ STATIC mp_obj_t socketpool_socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_ } STATIC MP_DEFINE_CONST_FUN_OBJ_3(socketpool_socket_sendto_obj, socketpool_socket_sendto); -//| def recvfrom_into(self, buffer) -> Tuple[int, tuple]: +//| def recvfrom_into(self, buffer: WriteableBuffer) -> Tuple[int, Tuple[str, int]]: //| """Reads some bytes from a remote address. //| //| Returns a tuple containing From 1553a647ca84f221fbadf1202844b91500d3ae9e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 24 Nov 2020 10:53:37 -0600 Subject: [PATCH 277/770] build: Update to gcc10 preview --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 046598a6e26a9..c032b1b8a3687 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -341,8 +341,8 @@ jobs: run: | sudo apt-get install -y gettext pip install requests sh click setuptools awscli - wget https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 - sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 + wget --no-verbose https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q2/gcc-arm-none-eabi-10-2020-q2-preview-x86_64-linux.tar.bz2 + sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-10-2020-q2-preview-x86_64-linux.tar.bz2 - name: Versions run: | gcc --version From 1031fe299254e0b46afa9d500fd298e2382f2183 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Tue, 24 Nov 2020 14:46:43 -0500 Subject: [PATCH 278/770] correct submodule --- ports/esp32s2/esp-idf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/esp-idf b/ports/esp32s2/esp-idf index 8bc19ba893e55..d06744f5efc38 160000 --- a/ports/esp32s2/esp-idf +++ b/ports/esp32s2/esp-idf @@ -1 +1 @@ -Subproject commit 8bc19ba893e5544d571a753d82b44a84799b94b1 +Subproject commit d06744f5efc382c61cbad8758107cec308feef09 From 0c5e0954dbf2c725cadf12260e56f51a967f9e50 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Tue, 24 Nov 2020 14:51:06 -0500 Subject: [PATCH 279/770] Add closed socket identification --- ports/esp32s2/common-hal/socketpool/Socket.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/esp32s2/common-hal/socketpool/Socket.c b/ports/esp32s2/common-hal/socketpool/Socket.c index 937d199f21c8a..1e22193330613 100644 --- a/ports/esp32s2/common-hal/socketpool/Socket.c +++ b/ports/esp32s2/common-hal/socketpool/Socket.c @@ -187,6 +187,7 @@ void common_hal_socketpool_socket_close(socketpool_socket_obj_t* self) { if (self->num >= 0) { lwip_shutdown(self->num, 0); lwip_close(self->num); + self->num = -1; } } From e83c481f0fbf6d1ed052b7bba12163e80d64ad4a Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Tue, 24 Nov 2020 15:40:27 -0500 Subject: [PATCH 280/770] translations --- locale/circuitpython.pot | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index c184d693134c1..034fc2ab24408 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-11-23 10:10-0600\n" +"POT-Creation-Date: 2020-11-24 15:40-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -297,6 +297,7 @@ msgid "All I2C peripherals are in use" msgstr "" #: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -333,6 +334,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/neopixel_write/__init__.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c #: ports/esp32s2/common-hal/pulseio/PulseOut.c @@ -1086,6 +1088,7 @@ msgid "Invalid byteorder string" msgstr "" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "" @@ -1412,14 +1415,14 @@ msgstr "" msgid "Only 8 or 16 bit mono with " msgstr "" -#: ports/esp32s2/common-hal/socketpool/SocketPool.c -msgid "Only IPv4 SOCK_STREAM sockets supported" -msgstr "" - #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" +#: ports/esp32s2/common-hal/socketpool/SocketPool.c +msgid "Only IPv4 sockets supported" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" From 59458a9013786f79c78a36ce5d6298f16fdd6a1a Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Tue, 24 Nov 2020 16:46:11 -0500 Subject: [PATCH 281/770] Add pin claiming to SPI construct --- ports/esp32s2/common-hal/busio/SPI.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ports/esp32s2/common-hal/busio/SPI.c b/ports/esp32s2/common-hal/busio/SPI.c index 490419f34a9f3..da738bbfdde93 100644 --- a/ports/esp32s2/common-hal/busio/SPI.c +++ b/ports/esp32s2/common-hal/busio/SPI.c @@ -204,6 +204,14 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, // hal->dummy_bits = 0; // hal->addr = 0; + claim_pin(self->clock_pin); + if (self->MOSI_pin != NULL) { + claim_pin(self->MOSI_pin); + } + if (self->MISO_pin != NULL) { + claim_pin(self->MISO_pin); + } + hal->io_mode = SPI_LL_IO_MODE_NORMAL; common_hal_busio_spi_configure(self, 250000, 0, 0, 8); From 966e0b256c6b75fb6a4d8a4debceb9b5dbf902b2 Mon Sep 17 00:00:00 2001 From: Antonin ENFRUN Date: Tue, 24 Nov 2020 17:19:41 +0000 Subject: [PATCH 282/770] Translated using Weblate (French) Currently translated at 98.2% (848 of 863 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index 17e6e905d1c1c..87c79cde9a4bd 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-23 10:10-0600\n" -"PO-Revision-Date: 2020-11-20 22:28+0000\n" -"Last-Translator: Noel Gaetan \n" +"PO-Revision-Date: 2020-11-24 22:45+0000\n" +"Last-Translator: Antonin ENFRUN \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" @@ -881,7 +881,7 @@ msgstr "La FFT est définie pour les ndarrays uniquement" #: extmod/ulab/code/fft/fft.c msgid "FFT is implemented for linear arrays only" -msgstr "" +msgstr "FFT n'est implémenté que pour les tableaux linéaires" #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" @@ -2116,7 +2116,7 @@ msgstr "L'argument argsort doit être un ndarray" #: extmod/ulab/code/numerical/numerical.c msgid "argsort is not implemented for flattened arrays" -msgstr "" +msgstr "argsort n'est pas mis en œuvre pour les tableaux aplatis" #: py/runtime.c msgid "argument has wrong type" @@ -2141,7 +2141,7 @@ msgstr "les arguments doivent être des ndarrays" #: extmod/ulab/code/ndarray.c msgid "array and index length must be equal" -msgstr "" +msgstr "la longueur du tableau et de l'index doit être égale" #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2149,7 +2149,7 @@ msgstr "tableau/octets requis à droite" #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" -msgstr "" +msgstr "tentative d’obtenir (arg)min/(arg)max d'une séquence vide" #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" @@ -2161,15 +2161,15 @@ msgstr "attribut pas encore supporté" #: extmod/ulab/code/numerical/numerical.c msgid "axis is out of bounds" -msgstr "" +msgstr "axis est hors limites" #: extmod/ulab/code/numerical/numerical.c msgid "axis must be None, or an integer" -msgstr "" +msgstr "axis doit être None ou un entier" #: extmod/ulab/code/numerical/numerical.c msgid "axis too long" -msgstr "" +msgstr "axis trop long" #: py/builtinevex.c msgid "bad compile mode" @@ -2485,7 +2485,7 @@ msgstr "impossible de déterminer la version de la carte SD" #: extmod/ulab/code/numerical/numerical.c msgid "cross is defined for 1D arrays of length 3" -msgstr "" +msgstr "cross est défini pour les tableaux 1D de longueur 3" #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" @@ -2528,7 +2528,7 @@ msgstr "l'argument diff doit être un ndarray" #: extmod/ulab/code/numerical/numerical.c msgid "differentiation order out of range" -msgstr "" +msgstr "differentiation order hors plage" #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c @@ -2649,7 +2649,7 @@ msgstr "le premier argument doit être une fonction" #: extmod/ulab/code/ulab_create.c msgid "first argument must be a tuple of ndarrays" -msgstr "" +msgstr "le premier argument doit être un tuple de ndarrays" #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" @@ -2706,7 +2706,7 @@ msgstr "la fonction a le même signe aux extrémités de l’intervalle" #: extmod/ulab/code/ndarray.c msgid "function is defined for ndarrays only" -msgstr "" +msgstr "La fonction n'est définie que pour les ndarrays" #: py/argcheck.c #, c-format @@ -2803,7 +2803,7 @@ msgstr "l'assembleur doit être une fonction" #: extmod/ulab/code/ndarray.c msgid "input and output shapes are not compatible" -msgstr "" +msgstr "les formes d'entrée et de sortie ne sont pas compatibles" #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" @@ -2815,7 +2815,7 @@ msgstr "la longueur du tableau d'entrée doit être une puissance de 2" #: extmod/ulab/code/ulab_create.c msgid "input arrays are not compatible" -msgstr "" +msgstr "les tableaux d'entrée ne sont pas compatibles" #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" @@ -2831,11 +2831,11 @@ msgstr "la matrice d'entrée est singulière" #: extmod/ulab/code/user/user.c msgid "input must be a dense ndarray" -msgstr "" +msgstr "l'entrée doit être un tableau dense" #: extmod/ulab/code/ulab_create.c msgid "input must be a tensor of rank 2" -msgstr "" +msgstr "l'entrée doit être un tenseur de rang 2" #: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c msgid "input must be an ndarray" From 241d9207578cbab3584349cd37327efe9910f36c Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Tue, 24 Nov 2020 04:06:38 +0000 Subject: [PATCH 283/770] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (863 of 863 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 62 ++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index baa125f1d16cd..028dad31c1acc 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-23 10:10-0600\n" -"PO-Revision-Date: 2020-11-18 00:28+0000\n" +"PO-Revision-Date: 2020-11-24 22:45+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -878,7 +878,7 @@ msgstr "O FFT é definido apenas para ndarrays" #: extmod/ulab/code/fft/fft.c msgid "FFT is implemented for linear arrays only" -msgstr "" +msgstr "O FFT é implementado apenas para matrizes lineares" #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" @@ -2114,7 +2114,7 @@ msgstr "O argumento argsort deve ser um ndarray" #: extmod/ulab/code/numerical/numerical.c msgid "argsort is not implemented for flattened arrays" -msgstr "" +msgstr "argsort não é implementado para matrizes achatadas" #: py/runtime.c msgid "argument has wrong type" @@ -2139,7 +2139,7 @@ msgstr "os argumentos devem ser ndarrays" #: extmod/ulab/code/ndarray.c msgid "array and index length must be equal" -msgstr "" +msgstr "a matriz e comprimento do índice devem ser iguais" #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2147,7 +2147,7 @@ msgstr "matriz/bytes são necessários no lado direito" #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" -msgstr "" +msgstr "tentativa de obter (arg)min/(arg)max da sequência vazia" #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" @@ -2159,15 +2159,15 @@ msgstr "atributos ainda não suportados" #: extmod/ulab/code/numerical/numerical.c msgid "axis is out of bounds" -msgstr "" +msgstr "o eixo está fora dos limites" #: extmod/ulab/code/numerical/numerical.c msgid "axis must be None, or an integer" -msgstr "" +msgstr "eixo deve ser Nenhum ou um número inteiro" #: extmod/ulab/code/numerical/numerical.c msgid "axis too long" -msgstr "" +msgstr "o eixo é muito longo" #: py/builtinevex.c msgid "bad compile mode" @@ -2376,7 +2376,7 @@ msgstr "" #: extmod/ulab/code/ndarray_operators.c msgid "cannot cast output with casting rule" -msgstr "" +msgstr "não pode lançar a saída com a regra de fundição" #: py/objtype.c msgid "cannot create '%q' instances" @@ -2478,7 +2478,7 @@ msgstr "não foi possível determinar a versão do cartão SD" #: extmod/ulab/code/numerical/numerical.c msgid "cross is defined for 1D arrays of length 3" -msgstr "" +msgstr "a cruz é definida para matrizes 1D de comprimento 3" #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" @@ -2522,7 +2522,7 @@ msgstr "O argumento diff deve ser um ndarray" #: extmod/ulab/code/numerical/numerical.c msgid "differentiation order out of range" -msgstr "" +msgstr "ordem de diferenciação fora do alcance" #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c @@ -2641,7 +2641,7 @@ msgstr "o primeiro argumento deve ser uma função" #: extmod/ulab/code/ulab_create.c msgid "first argument must be a tuple of ndarrays" -msgstr "" +msgstr "o primeiro argumento deve ser um tuple de ndarrays" #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" @@ -2698,7 +2698,7 @@ msgstr "a função tem o mesmo sinal nas extremidades do intervalo" #: extmod/ulab/code/ndarray.c msgid "function is defined for ndarrays only" -msgstr "" +msgstr "A função é definida apenas para ndarrays" #: py/argcheck.c #, c-format @@ -2794,7 +2794,7 @@ msgstr "o assembler em linha deve ser uma função" #: extmod/ulab/code/ndarray.c msgid "input and output shapes are not compatible" -msgstr "" +msgstr "as formas de entrada e saída não são compatíveis" #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" @@ -2806,7 +2806,7 @@ msgstr "comprimento da matriz da entrada deve ter potência de 2" #: extmod/ulab/code/ulab_create.c msgid "input arrays are not compatible" -msgstr "" +msgstr "as matrizes da entrada não são compatíveis" #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" @@ -2822,19 +2822,19 @@ msgstr "a matriz da entrada é singular" #: extmod/ulab/code/user/user.c msgid "input must be a dense ndarray" -msgstr "" +msgstr "a entrada deve ser um ndarray denso" #: extmod/ulab/code/ulab_create.c msgid "input must be a tensor of rank 2" -msgstr "" +msgstr "a entrada dos dados deve ser um tensor de nível 2" #: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c msgid "input must be an ndarray" -msgstr "" +msgstr "a entrada deve ser um ndarray" #: extmod/ulab/code/filter/filter.c msgid "input must be one-dimensional" -msgstr "" +msgstr "a entrada deve ser unidimensional" #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" @@ -2850,7 +2850,7 @@ msgstr "os vetores da entrada devem ter o mesmo comprimento" #: extmod/ulab/code/poly/poly.c msgid "inputs are not iterable" -msgstr "" +msgstr "as entradas não são iteráveis" #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" @@ -3025,7 +3025,7 @@ msgstr "max_length deve ser > 0" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" -msgstr "" +msgstr "O número máximo de dimensões são 4" #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3162,7 +3162,7 @@ msgstr "um arg não-palavra-chave após a palavra-chave arg" #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" -msgstr "" +msgstr "a norma é definida para matrizes 1D e 2D" #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" @@ -3230,7 +3230,7 @@ msgstr "sequência com comprimento ímpar" #: extmod/ulab/code/ulab_create.c msgid "offset is too large" -msgstr "" +msgstr "o offset é muito grande" #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" @@ -3257,11 +3257,11 @@ msgstr "os operandos não puderam ser transmitidos juntos" #: extmod/ulab/code/ndarray.c msgid "operation is implemented for 1D Boolean arrays only" -msgstr "" +msgstr "A operação é implementada apenas para matrizes booleanas 1D" #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented for flattened array" -msgstr "" +msgstr "a operação não é implementada para a matriz achatada" #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" @@ -3403,7 +3403,7 @@ msgstr "o comprimento solicitado %d, porém o objeto tem comprimento %d" #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" -msgstr "" +msgstr "os resultados não podem ser lançados para um determinado tipo" #: py/compile.c msgid "return annotation must be an identifier" @@ -3425,7 +3425,7 @@ msgstr "rgb_pins[%d] não está na mesma porta que o clock" #: extmod/ulab/code/numerical/numerical.c msgid "roll argument must be an ndarray" -msgstr "" +msgstr "argumento de enrolar deve ser um ndarray" #: py/objstr.c msgid "rsplit(None,n)" @@ -3453,7 +3453,7 @@ msgstr "compilação de script não suportada" #: extmod/ulab/code/ndarray.c msgid "shape must be a tuple" -msgstr "" +msgstr "a forma deve ser uma tupla" #: py/objstr.c msgid "sign not allowed in string format specifier" @@ -3602,7 +3602,7 @@ msgstr "timestamp fora do intervalo para a plataforma time_t" #: extmod/ulab/code/ndarray.c msgid "tobytes can be invoked for dense arrays only" -msgstr "" +msgstr "os tobytes podem ser invocados apenas nas matrizes densas" #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" @@ -3781,11 +3781,11 @@ msgstr "a janela deve ser <= intervalo" #: extmod/ulab/code/numerical/numerical.c msgid "wrong axis index" -msgstr "" +msgstr "índice do eixo errado" #: extmod/ulab/code/ulab_create.c msgid "wrong axis specified" -msgstr "" +msgstr "um eixo errado foi definido" #: extmod/ulab/code/vector/vectorise.c msgid "wrong input type" From ff7bab12aa0fb131b8056cd1b20b1e17bba8306a Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 24 Nov 2020 23:45:47 +0100 Subject: [PATCH 284/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 6 +++++- locale/cs.po | 6 +++++- locale/de_DE.po | 6 +++++- locale/el.po | 6 +++++- locale/es.po | 6 +++++- locale/fil.po | 6 +++++- locale/fr.po | 6 +++++- locale/hi.po | 6 +++++- locale/it_IT.po | 6 +++++- locale/ja.po | 6 +++++- locale/ko.po | 6 +++++- locale/nl.po | 6 +++++- locale/pl.po | 6 +++++- locale/pt_BR.po | 6 +++++- locale/sv.po | 6 +++++- locale/zh_Latn_pinyin.po | 6 +++++- 16 files changed, 80 insertions(+), 16 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 782e846e9946e..cf23970d88cff 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-23 10:10-0600\n" +"POT-Creation-Date: 2020-11-11 16:30+0530\n" "PO-Revision-Date: 2020-10-10 23:51+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -1283,6 +1283,10 @@ msgstr "Harus menyediakan pin MISO atau MOSI" msgid "Must use a multiple of 6 rgb pins, not %d" msgstr "Harus menggunakan kelipatan 6 pin rgb, bukan %d" +#: ports/esp32s2/common-hal/nvm/ByteArray.c +msgid "NVS Error" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "Nama terlalu panjang" diff --git a/locale/cs.po b/locale/cs.po index 6eb69fb6723ea..3249792e7038b 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-23 10:10-0600\n" +"POT-Creation-Date: 2020-11-11 16:30+0530\n" "PO-Revision-Date: 2020-05-24 03:22+0000\n" "Last-Translator: dronecz \n" "Language-Team: LANGUAGE \n" @@ -1266,6 +1266,10 @@ msgstr "" msgid "Must use a multiple of 6 rgb pins, not %d" msgstr "" +#: ports/esp32s2/common-hal/nvm/ByteArray.c +msgid "NVS Error" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index f103339109ed7..3b6bc8e217335 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-23 10:10-0600\n" +"POT-Creation-Date: 2020-11-11 16:30+0530\n" "PO-Revision-Date: 2020-06-16 18:24+0000\n" "Last-Translator: Andreas Buchen \n" "Language: de_DE\n" @@ -1285,6 +1285,10 @@ msgstr "Muss MISO- oder MOSI-Pin bereitstellen" msgid "Must use a multiple of 6 rgb pins, not %d" msgstr "Muss ein Vielfaches von 6 RGB-Pins verwenden, nicht %d" +#: ports/esp32s2/common-hal/nvm/ByteArray.c +msgid "NVS Error" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "Name zu lang" diff --git a/locale/el.po b/locale/el.po index 85bf0ab44fa39..71f6e6102b2b8 100644 --- a/locale/el.po +++ b/locale/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-23 10:10-0600\n" +"POT-Creation-Date: 2020-11-11 16:30+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -1261,6 +1261,10 @@ msgstr "" msgid "Must use a multiple of 6 rgb pins, not %d" msgstr "" +#: ports/esp32s2/common-hal/nvm/ByteArray.c +msgid "NVS Error" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "" diff --git a/locale/es.po b/locale/es.po index 538a2944e6fa0..b0314ae1984f9 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-11-23 10:10-0600\n" +"POT-Creation-Date: 2020-11-11 16:30+0530\n" "PO-Revision-Date: 2020-11-15 16:28+0000\n" "Last-Translator: RubenD \n" "Language-Team: \n" @@ -1284,6 +1284,10 @@ msgstr "Debe proporcionar un pin MISO o MOSI" msgid "Must use a multiple of 6 rgb pins, not %d" msgstr "Debe usar un múltiplo de 6 pines rgb, no %d" +#: ports/esp32s2/common-hal/nvm/ByteArray.c +msgid "NVS Error" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "Nombre muy largo" diff --git a/locale/fil.po b/locale/fil.po index 86178a9a14374..50067c6d4fe4c 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-23 10:10-0600\n" +"POT-Creation-Date: 2020-11-11 16:30+0530\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -1276,6 +1276,10 @@ msgstr "" msgid "Must use a multiple of 6 rgb pins, not %d" msgstr "" +#: ports/esp32s2/common-hal/nvm/ByteArray.c +msgid "NVS Error" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index 87c79cde9a4bd..359595c723d41 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-23 10:10-0600\n" +"POT-Creation-Date: 2020-11-11 16:30+0530\n" "PO-Revision-Date: 2020-11-24 22:45+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" @@ -1289,6 +1289,10 @@ msgstr "Doit fournir une broche MISO ou MOSI" msgid "Must use a multiple of 6 rgb pins, not %d" msgstr "Doit utiliser un multiple de 6 broches RVB, pas %d" +#: ports/esp32s2/common-hal/nvm/ByteArray.c +msgid "NVS Error" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "Nom trop long" diff --git a/locale/hi.po b/locale/hi.po index 3b006f1989681..de77cec46b74e 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-23 10:10-0600\n" +"POT-Creation-Date: 2020-11-11 16:30+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -1261,6 +1261,10 @@ msgstr "" msgid "Must use a multiple of 6 rgb pins, not %d" msgstr "" +#: ports/esp32s2/common-hal/nvm/ByteArray.c +msgid "NVS Error" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 652bc56fd5a7f..15c83cd53af9d 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-23 10:10-0600\n" +"POT-Creation-Date: 2020-11-11 16:30+0530\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -1280,6 +1280,10 @@ msgstr "" msgid "Must use a multiple of 6 rgb pins, not %d" msgstr "" +#: ports/esp32s2/common-hal/nvm/ByteArray.c +msgid "NVS Error" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "" diff --git a/locale/ja.po b/locale/ja.po index 26025c19e4629..0132783026532 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-23 10:10-0600\n" +"POT-Creation-Date: 2020-11-11 16:30+0530\n" "PO-Revision-Date: 2020-11-12 22:51+0000\n" "Last-Translator: sporeball \n" "Language-Team: none\n" @@ -1276,6 +1276,10 @@ msgstr "MISOピンまたはMOSIピンが必要" msgid "Must use a multiple of 6 rgb pins, not %d" msgstr "%d個でなく6の倍数個のrgbピンを使ってください" +#: ports/esp32s2/common-hal/nvm/ByteArray.c +msgid "NVS Error" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "名前が長すぎます" diff --git a/locale/ko.po b/locale/ko.po index a7967210d3a7a..fc08bdeaaceed 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-23 10:10-0600\n" +"POT-Creation-Date: 2020-11-11 16:30+0530\n" "PO-Revision-Date: 2020-10-05 12:12+0000\n" "Last-Translator: Michal Čihař \n" "Language-Team: LANGUAGE \n" @@ -1266,6 +1266,10 @@ msgstr "" msgid "Must use a multiple of 6 rgb pins, not %d" msgstr "" +#: ports/esp32s2/common-hal/nvm/ByteArray.c +msgid "NVS Error" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index f9847fd81f8df..ee7a3fd545ce0 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-23 10:10-0600\n" +"POT-Creation-Date: 2020-11-11 16:30+0530\n" "PO-Revision-Date: 2020-10-27 16:47+0000\n" "Last-Translator: Jelle Jager \n" "Language-Team: none\n" @@ -1278,6 +1278,10 @@ msgstr "MISO of MOSI moeten worden gegeven" msgid "Must use a multiple of 6 rgb pins, not %d" msgstr "Een meervoud van 6 rgb pinnen moet worden gebruikt, niet %d" +#: ports/esp32s2/common-hal/nvm/ByteArray.c +msgid "NVS Error" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "Naam te lang" diff --git a/locale/pl.po b/locale/pl.po index 1873af488f455..4d8c9d84cc60b 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-23 10:10-0600\n" +"POT-Creation-Date: 2020-11-11 16:30+0530\n" "PO-Revision-Date: 2020-11-11 19:13+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" @@ -1277,6 +1277,10 @@ msgstr "Należy podać pin MISO lub MOSI" msgid "Must use a multiple of 6 rgb pins, not %d" msgstr "" +#: ports/esp32s2/common-hal/nvm/ByteArray.c +msgid "NVS Error" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "Za długa nazwa" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 028dad31c1acc..5d8ac39f3b2ac 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-23 10:10-0600\n" +"POT-Creation-Date: 2020-11-11 16:30+0530\n" "PO-Revision-Date: 2020-11-24 22:45+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -1287,6 +1287,10 @@ msgstr "Deve informar os pinos MISO ou MOSI" msgid "Must use a multiple of 6 rgb pins, not %d" msgstr "Deve utilizar um múltiplo de 6 pinos rgb, não %d" +#: ports/esp32s2/common-hal/nvm/ByteArray.c +msgid "NVS Error" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "Nome muito longo" diff --git a/locale/sv.po b/locale/sv.po index 02847044fb56d..db05a557aeaa4 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-23 10:10-0600\n" +"POT-Creation-Date: 2020-11-11 16:30+0530\n" "PO-Revision-Date: 2020-11-20 22:28+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -1277,6 +1277,10 @@ msgstr "Måste ange MISO- eller MOSI-pinne" msgid "Must use a multiple of 6 rgb pins, not %d" msgstr "Måste använda ett multipel av 6 rgb-pinnar, inte %d" +#: ports/esp32s2/common-hal/nvm/ByteArray.c +msgid "NVS Error" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "Name är för långt" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 134efec9034a8..2f0673a7d0526 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-23 10:10-0600\n" +"POT-Creation-Date: 2020-11-11 16:30+0530\n" "PO-Revision-Date: 2020-11-19 01:28+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -1274,6 +1274,10 @@ msgstr "Bìxū tígōng MISO huò MOSI yǐn jiǎo" msgid "Must use a multiple of 6 rgb pins, not %d" msgstr "bì xū shǐ yòng 6 RGB yǐn jiǎo de bèi shù, ér bù shì %d" +#: ports/esp32s2/common-hal/nvm/ByteArray.c +msgid "NVS Error" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "Míngchēng tài zhǎng" From c451b22255706989f58cfd88be486e5117979a28 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 24 Nov 2020 10:26:47 -0600 Subject: [PATCH 285/770] Disable 3-arg pow() function on m0 boards `pow(a, b, c)` can compute `(a ** b) % c` efficiently (in time and memory). This can be useful for extremely specific applications, like implementing the RSA cryptosystem. For typical uses of CircuitPython, this is not an important feature. A survey of the bundle and learn system didn't find any uses. Disable it on M0 builds so that we can fit in needed upgrades to the USB stack. --- ports/atmel-samd/mpconfigport.mk | 4 ++++ py/circuitpy_mpconfig.h | 2 +- py/circuitpy_mpconfig.mk | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ports/atmel-samd/mpconfigport.mk b/ports/atmel-samd/mpconfigport.mk index 1929e146d3c9d..17e3995bf5c23 100644 --- a/ports/atmel-samd/mpconfigport.mk +++ b/ports/atmel-samd/mpconfigport.mk @@ -29,6 +29,10 @@ ifndef CIRCUITPY_AUDIOMP3 CIRCUITPY_AUDIOMP3 = 0 endif +ifndef CIRCUITPY_BUILTINS_POW3 +CIRCUITPY_BUILTINS_POW3 = 0 +endif + ifndef CIRCUITPY_FREQUENCYIO CIRCUITPY_FREQUENCYIO = 0 endif diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 85e152670a2f5..28fd4095c4621 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -184,7 +184,7 @@ typedef long mp_off_t; // Turning off FULL_BUILD removes some functionality to reduce flash size on tiny SAMD21s #define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (CIRCUITPY_FULL_BUILD) #define MICROPY_CPYTHON_COMPAT (CIRCUITPY_FULL_BUILD) -#define MICROPY_PY_BUILTINS_POW3 (CIRCUITPY_FULL_BUILD) +#define MICROPY_PY_BUILTINS_POW3 (CIRCUITPY_BUILTINS_POW3) #define MICROPY_COMP_FSTRING_LITERAL (MICROPY_CPYTHON_COMPAT) #define MICROPY_MODULE_WEAK_LINKS (0) #define MICROPY_PY_ALL_SPECIAL_METHODS (CIRCUITPY_FULL_BUILD) diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index a6aabec33d18f..08e77371800e1 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -90,6 +90,9 @@ CFLAGS += -DCIRCUITPY_BLEIO=$(CIRCUITPY_BLEIO) CIRCUITPY_BOARD ?= 1 CFLAGS += -DCIRCUITPY_BOARD=$(CIRCUITPY_BOARD) +CIRCUITPY_BUILTINS_POW3 ?= $(CIRCUITPY_FULL_BUILD) +CFLAGS += -DCIRCUITPY_BUILTINS_POW3=$(CIRCUITPY_BUILTINS_POW3) + CIRCUITPY_BUSIO ?= 1 CFLAGS += -DCIRCUITPY_BUSIO=$(CIRCUITPY_BUSIO) From 4ca50982b75678ad38c234202fbc1904df32cf57 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Tue, 24 Nov 2020 23:15:25 +0000 Subject: [PATCH 286/770] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (864 of 864 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 5d8ac39f3b2ac..49ac502e29b1a 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-11 16:30+0530\n" -"PO-Revision-Date: 2020-11-24 22:45+0000\n" +"PO-Revision-Date: 2020-11-24 23:22+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -1289,7 +1289,7 @@ msgstr "Deve utilizar um múltiplo de 6 pinos rgb, não %d" #: ports/esp32s2/common-hal/nvm/ByteArray.c msgid "NVS Error" -msgstr "" +msgstr "Erro NVS" #: py/parse.c msgid "Name too long" From be44c16e253c7694930419974dc1dcdb5258fe23 Mon Sep 17 00:00:00 2001 From: Mitsuharu Aoyama Date: Tue, 24 Nov 2020 23:45:29 +0000 Subject: [PATCH 287/770] Translated using Weblate (Japanese) Currently translated at 69.0% (597 of 864 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ja/ --- locale/ja.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/ja.po b/locale/ja.po index 0132783026532..d0322be773c53 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-11 16:30+0530\n" -"PO-Revision-Date: 2020-11-12 22:51+0000\n" -"Last-Translator: sporeball \n" +"PO-Revision-Date: 2020-11-25 01:11+0000\n" +"Last-Translator: Mitsuharu Aoyama \n" "Language-Team: none\n" "Language: ja\n" "MIME-Version: 1.0\n" @@ -182,7 +182,7 @@ msgstr "" #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects an integer" -msgstr "" +msgstr "'%s' には整数が必要" #: py/emitinlinethumb.c #, c-format From fc344bc818f8172ff36ee646459d7d060a51289a Mon Sep 17 00:00:00 2001 From: James Bowman Date: Tue, 24 Nov 2020 17:26:39 -0800 Subject: [PATCH 288/770] Fix opcode typo in VertexFormat() --- shared-module/_eve/__init__.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-module/_eve/__init__.c b/shared-module/_eve/__init__.c index 0f1e12d9fdc42..d95c777dc4fd8 100644 --- a/shared-module/_eve/__init__.c +++ b/shared-module/_eve/__init__.c @@ -70,8 +70,8 @@ void common_hal__eve_Vertex2f(common_hal__eve_t *eve, mp_float_t x, mp_float_t y void common_hal__eve_VertexFormat(common_hal__eve_t *eve, uint32_t frac) { - C4(eve, ((27 << 24) | ((frac & 7)))); - eve->vscale = 1 << eve->vscale; + C4(eve, ((39 << 24) | ((frac & 7)))); + eve->vscale = 1 << frac; } From 4ac11c8d31311651b77d13bec0a765aa2439cfb2 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 24 Nov 2020 17:54:39 -0800 Subject: [PATCH 289/770] Update wifi.Radio.connect doc Now it includes bssid info. --- ports/esp32s2/common-hal/wifi/Radio.c | 4 ++-- shared-bindings/wifi/Radio.c | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index f7c431a56bcb4..bc987bc1c96d6 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -138,9 +138,9 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t if (bssid_len > 0){ memcpy(&config->sta.bssid, bssid, bssid_len); config->sta.bssid[bssid_len] = 0; - config->sta.bssid_set = 1; + config->sta.bssid_set = true; } else { - config->sta.bssid_set = 0; + config->sta.bssid_set = false; } // If channel is 0 (default/unset) and BSSID is not given, do a full scan instead of fast scan // This will ensure that the best AP in range is chosen automatically diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index e81e8793c4602..991abd4f12b69 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -142,9 +142,25 @@ const mp_obj_property_t wifi_radio_hostname_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def connect(self, ssid: ReadableBuffer, password: ReadableBuffer = b"", *, channel: Optional[int] = 0, timeout: Optional[float] = None) -> bool: +//| def connect(self, +//| ssid: ReadableBuffer, +//| password: ReadableBuffer = b"", +//| *, +//| channel: Optional[int] = 0, +//| bssid: Optional[ReadableBuffer] = b"", +//| timeout: Optional[float] = None) -> bool: //| """Connects to the given ssid and waits for an ip address. Reconnections are handled -//| automatically once one connection succeeds.""" +//| automatically once one connection succeeds. +//| +//| By default, this will scan all channels and connect to the access point (AP) with the +//| given ``ssid`` and greatest signal strength (rssi). +//| +//| If ``channel`` is given, the scan will begin with the given channel and connect to +//| the first AP with the given ``ssid``. This can speed up the connection time +//| significantly because a full scan doesn't occur. +//| +//| If ``bssid`` is given, the scan will start at the first channel or the one given and +//| connect to the AP with the given ``bssid`` and ``ssid``.""" //| ... //| STATIC mp_obj_t wifi_radio_connect(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { From 9a692c3222013efdbcedea95cadf29c0379ca17c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 24 Nov 2020 18:14:22 -0800 Subject: [PATCH 290/770] Exit faster on recv when TLS connection closed When a TLS connection is closed by the server it usually sends a notice. We see this incoming byte with lwip_ioctl and try to read it. The read returns 0 but we keep trying anyway. Now, we quit trying when we get zero back. If the connection was still alive it'd either read a byte or delay until a byte could be read. --- ports/esp32s2/common-hal/socketpool/Socket.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ports/esp32s2/common-hal/socketpool/Socket.c b/ports/esp32s2/common-hal/socketpool/Socket.c index 750415dc7b165..999d399902618 100644 --- a/ports/esp32s2/common-hal/socketpool/Socket.c +++ b/ports/esp32s2/common-hal/socketpool/Socket.c @@ -103,6 +103,11 @@ mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, } if (available > 0) { status = esp_tls_conn_read(self->tcp, (void*) buf + received, available); + if (status == 0) { + // Reading zero when something is available indicates a closed + // connection. (The available bytes could have been TLS internal.) + break; + } if (status > 0) { received += status; } From ca1a85c47f333b640188713f868a364d60bc75d5 Mon Sep 17 00:00:00 2001 From: arturo182 Date: Wed, 25 Nov 2020 03:34:01 +0100 Subject: [PATCH 291/770] displayio: Fix ColorConverter make_* methods --- shared-bindings/displayio/ColorConverter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/displayio/ColorConverter.c b/shared-bindings/displayio/ColorConverter.c index 0e6e9bfd9405b..88d3a1ba8feeb 100644 --- a/shared-bindings/displayio/ColorConverter.c +++ b/shared-bindings/displayio/ColorConverter.c @@ -116,7 +116,7 @@ const mp_obj_property_t displayio_colorconverter_dither_obj = { STATIC mp_obj_t displayio_colorconverter_make_transparent(mp_obj_t self_in, mp_obj_t transparent_color_obj) { displayio_colorconverter_t *self = MP_OBJ_TO_PTR(self_in); - mp_int_t transparent_color = mp_obj_get_int(&transparent_color); + mp_int_t transparent_color = mp_obj_get_int(transparent_color_obj); common_hal_displayio_colorconverter_make_transparent(self, transparent_color); return mp_const_none; } @@ -128,7 +128,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(displayio_colorconverter_make_transparent_obj, display STATIC mp_obj_t displayio_colorconverter_make_opaque(mp_obj_t self_in, mp_obj_t transparent_color_obj) { displayio_colorconverter_t *self = MP_OBJ_TO_PTR(self_in); - mp_int_t transparent_color = mp_obj_get_int(&transparent_color); + mp_int_t transparent_color = mp_obj_get_int(transparent_color_obj); common_hal_displayio_colorconverter_make_opaque(self, transparent_color); return mp_const_none; } From 0d9a0235a29fdf82725606cc7a1362d55da003a7 Mon Sep 17 00:00:00 2001 From: arturo182 Date: Wed, 25 Nov 2020 03:48:50 +0100 Subject: [PATCH 292/770] Update the requests frozen library --- frozen/Adafruit_CircuitPython_Requests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frozen/Adafruit_CircuitPython_Requests b/frozen/Adafruit_CircuitPython_Requests index 43017e30a1e77..531e8451522e3 160000 --- a/frozen/Adafruit_CircuitPython_Requests +++ b/frozen/Adafruit_CircuitPython_Requests @@ -1 +1 @@ -Subproject commit 43017e30a1e772b67ac68293a944e863c031e389 +Subproject commit 531e8451522e3bba3e571610e4ac70efcb0cae5a From f868cc5dd02319957500180541281f41ec0d0573 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 24 Nov 2020 23:36:59 -0500 Subject: [PATCH 293/770] some API renaming and bug fixes; fix docs --- main.c | 50 ++++++++++++--------- shared-bindings/alarm/__init__.c | 4 +- shared-bindings/alarm/pin/PinAlarm.c | 34 +++++++------- shared-bindings/alarm/time/DurationAlarm.c | 6 +-- shared-bindings/microcontroller/Processor.c | 4 +- shared-bindings/supervisor/RunReason.c | 2 +- shared-bindings/supervisor/Runtime.c | 2 +- shared-bindings/supervisor/__init__.c | 37 +++++++-------- 8 files changed, 73 insertions(+), 66 deletions(-) diff --git a/main.c b/main.c index b2e527ddeff95..10066bd92f91d 100755 --- a/main.c +++ b/main.c @@ -98,7 +98,7 @@ #endif // How long to wait for host to enumerate (secs). -#define CIRCUITPY_USB_ENUMERATION_DELAY 1 +#define CIRCUITPY_USB_ENUMERATION_DELAY 5 // How long to flash errors on the RGB status LED before going to sleep (secs) #define CIRCUITPY_FLASH_ERROR_PERIOD 10 @@ -319,26 +319,28 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { bool ok = result.return_code != PYEXEC_EXCEPTION; ESP_LOGI("main", "common_hal_alarm_enable_deep_sleep_alarms()"); - // Decide whether to deep sleep. #if CIRCUITPY_ALARM // Enable pin or time alarms before sleeping. common_hal_alarm_enable_deep_sleep_alarms(); #endif - // Normally we won't deep sleep if there was an error or if we are connected to a host - // but either of those can be enabled. - // *********DON'T SLEEP IF USB HASN'T HAD TIME TO ENUMERATE. - bool will_deep_sleep = - (ok || supervisor_workflow_get_allow_deep_sleep_on_error()) && - (!supervisor_workflow_active() || supervisor_workflow_get_allow_deep_sleep_when_connected()); - - ESP_LOGI("main", "ok %d", will_deep_sleep); - ESP_LOGI("main", "...on_error() %d", supervisor_workflow_get_allow_deep_sleep_on_error()); - ESP_LOGI("main", "supervisor_workflow_active() %d", supervisor_workflow_active()); - ESP_LOGI("main", "...when_connected() %d", supervisor_workflow_get_allow_deep_sleep_when_connected()); - will_deep_sleep = false; + prep_rgb_status_animation(&result, found_main, safe_mode, &animation); while (true) { + // Normally we won't deep sleep if there was an error or if we are connected to a host + // but either of those can be enabled. + // It's ok to deep sleep if we're not connected to a host, but we need to make sure + // we're giving enough time for USB enumeration to happen. + bool deep_sleep_allowed = + (ok || supervisor_workflow_get_allow_deep_sleep_on_error()) && + (!supervisor_workflow_active() || supervisor_workflow_get_allow_deep_sleep_when_connected()) && + (supervisor_ticks_ms64() > CIRCUITPY_USB_ENUMERATION_DELAY * 1024); + + ESP_LOGI("main", "ok %d", deep_sleep_allowed); + ESP_LOGI("main", "...on_error() %d", supervisor_workflow_get_allow_deep_sleep_on_error()); + ESP_LOGI("main", "supervisor_workflow_active() %d", supervisor_workflow_active()); + ESP_LOGI("main", "...when_connected() %d", supervisor_workflow_get_allow_deep_sleep_when_connected()); + ESP_LOGI("main", "supervisor_ticks_ms64() %lld", supervisor_ticks_ms64()); RUN_BACKGROUND_TASKS; if (reload_requested) { supervisor_set_run_reason(RUN_REASON_AUTO_RELOAD); @@ -360,7 +362,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { print_code_py_status_message(safe_mode); } // We won't be going into the REPL if we're going to sleep. - if (!will_deep_sleep) { + if (!deep_sleep_allowed) { print_safe_mode_message(safe_mode); serial_write("\n"); serial_write_compressed(translate("Press any key to enter the REPL. Use CTRL-D to reload.")); @@ -379,27 +381,31 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { #endif bool animation_done = false; - if (will_deep_sleep && ok) { + + if (deep_sleep_allowed && ok) { // Skip animation if everything is OK. animation_done = true; } else { animation_done = tick_rgb_status_animation(&animation); } // Do an error animation only once before deep-sleeping. - if (animation_done && will_deep_sleep) { - int64_t remaining_enumeration_wait = CIRCUITPY_USB_ENUMERATION_DELAY * 1024 - supervisor_ticks_ms64(); - // If USB isn't enumerated then deep sleep after our waiting period. - if (ok && remaining_enumeration_wait < 0) { + if (animation_done) { + if (deep_sleep_allowed) { common_hal_mcu_deep_sleep(); // Does not return. } + // Wake up every so often to flash the error code. if (!ok) { port_interrupt_after_ticks(CIRCUITPY_FLASH_ERROR_PERIOD * 1024); } else { - port_interrupt_after_ticks(remaining_enumeration_wait); + int64_t remaining_enumeration_wait = + CIRCUITPY_USB_ENUMERATION_DELAY * 1024 - supervisor_ticks_ms64(); + if (remaining_enumeration_wait > 0) { + port_interrupt_after_ticks(remaining_enumeration_wait); + } + port_sleep_until_interrupt(); } - port_sleep_until_interrupt(); } } } diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 22b2e7f6abff0..b6b86c8354ecb 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -38,7 +38,7 @@ //| //| Light sleep leaves the CPU and RAM powered so that CircuitPython can resume where it left off //| after being woken up. CircuitPython automatically goes into a light sleep when `time.sleep()` is -//| called. To light sleep until a non-time alarm use `alarm.sleep_until_alarm()`. Any active +//| called. To light sleep until a non-time alarm use `alarm.sleep_until_alarms()`. Any active //| peripherals, such as I2C, are left on. //| //| Deep sleep shuts down power to nearly all of the chip including the CPU and RAM. This can save @@ -51,7 +51,7 @@ //| //| An error includes an uncaught exception, or sys.exit() called with a non-zero argument //| -//| To set alarms for deep sleep use `alarm.restart_on_alarm()` they will apply to next deep sleep only.""" +//| To set alarms for deep sleep use `alarm.set_deep_sleep_alarms()` they will apply to next deep sleep only.""" //| //| wake_alarm: Alarm //| """The most recent alarm to wake us up from a sleep (light or deep.)""" diff --git a/shared-bindings/alarm/pin/PinAlarm.c b/shared-bindings/alarm/pin/PinAlarm.c index a2d2e0ab7a78e..bb48b93c4244d 100644 --- a/shared-bindings/alarm/pin/PinAlarm.c +++ b/shared-bindings/alarm/pin/PinAlarm.c @@ -38,26 +38,26 @@ //| """Trigger an alarm when a pin changes state.""" //| //| def __init__(self, *pins: microcontroller.Pin, value: bool, all_same_value: bool = False, edge: bool = False, pull: bool = False) -> None: -//| """Create an alarm triggered by a `~microcontroller.Pin` level. The alarm is not active -//| until it is listed in an `alarm`-enabling function, such as `alarm.sleep_until_alarm()` or -//| `alarm.restart_on_alarm()`. +//| """Create an alarm triggered by a `microcontroller.Pin` level. The alarm is not active +//| until it is listed in an `alarm`-enabling function, such as `alarm.sleep_until_alarms()` or +//| `alarm.set_deep_sleep_alarms()`. //| -//| :param pins: The pins to monitor. On some ports, the choice of pins -//| may be limited due to hardware restrictions, particularly for deep-sleep alarms. +//| :param microcontroller.Pin \*pins: The pins to monitor. On some ports, the choice of pins +//| may be limited due to hardware restrictions, particularly for deep-sleep alarms. //| :param bool value: When active, trigger when the pin value is high (``True``) or low (``False``). -//| On some ports, multiple `PinAlarm` objects may need to have coordinated values -//| for deep-sleep alarms. -//| :param bool all_same_value: If ``True``, all pins listed must be at `value` to trigger the alarm. -//| If ``False``, any one of the pins going to `value` will trigger the alarm. +//| On some ports, multiple `PinAlarm` objects may need to have coordinated values +//| for deep-sleep alarms. +//| :param bool all_same_value: If ``True``, all pins listed must be at ``value`` to trigger the alarm. +//| If ``False``, any one of the pins going to ``value`` will trigger the alarm. //| :param bool edge: If ``True``, trigger only when there is a transition to the specified -//| value of `value`. If ``True``, if the alarm becomes active when the pin value already -//| matches `value`, the alarm is not triggered: the pin must transition from ``not value`` -//| to ``value`` to trigger the alarm. On some ports, edge-triggering may not be available, -//| particularly for deep-sleep alarms. -//| :param bool pull: Enable a pull-up or pull-down which pulls the pin to value opposite -//| opposite that of `value`. For instance, if `value` is set to ``True``, setting `pull` -//| to ``True`` will enable a pull-down, to hold the pin low normally until an outside signal -//| pulls it high. +//| value of ``value``. If ``True``, if the alarm becomes active when the pin value already +//| matches ``value``, the alarm is not triggered: the pin must transition from ``not value`` +//| to ``value`` to trigger the alarm. On some ports, edge-triggering may not be available, +//| particularly for deep-sleep alarms. +//| :param bool pull: Enable a pull-up or pull-down which pulls the pin to the level opposite +//| opposite that of ``value``. For instance, if ``value`` is set to ``True``, setting ``pull`` +//| to ``True`` will enable a pull-down, to hold the pin low normally until an outside signal +//| pulls it high. //| """ //| ... //| diff --git a/shared-bindings/alarm/time/DurationAlarm.c b/shared-bindings/alarm/time/DurationAlarm.c index c105bbebf7bda..6831aba5db499 100644 --- a/shared-bindings/alarm/time/DurationAlarm.c +++ b/shared-bindings/alarm/time/DurationAlarm.c @@ -37,10 +37,10 @@ //| """Trigger an alarm at a specified interval from now.""" //| //| def __init__(self, secs: float) -> None: -//| """Create an alarm that will be triggered in `secs` seconds from the time +//| """Create an alarm that will be triggered in ``secs`` seconds from the time //| sleep starts. The alarm is not active until it is listed in an -//| `alarm`-enabling function, such as `alarm.sleep_until_alarm()` or -//| `alarm.restart_on_alarm()`. +//| `alarm`-enabling function, such as `alarm.sleep_until_alarms()` or +//| `alarm.set_deep_sleep_alarms()`. //| """ //| ... //| diff --git a/shared-bindings/microcontroller/Processor.c b/shared-bindings/microcontroller/Processor.c index ea43688213213..90cc02fe39073 100644 --- a/shared-bindings/microcontroller/Processor.c +++ b/shared-bindings/microcontroller/Processor.c @@ -67,8 +67,8 @@ const mp_obj_property_t mcu_processor_frequency_obj = { }, }; -//| reset_reason: `microcontroller.ResetReason` -//| """The reason the microcontroller started up from reset state.""" +//| reset_reason: microcontroller.ResetReason +//| """The reason the microcontroller started up from reset state.""" //| STATIC mp_obj_t mcu_processor_get_reset_reason(mp_obj_t self) { return cp_enum_find(&mcu_reset_reason_type, common_hal_mcu_processor_get_reset_reason()); diff --git a/shared-bindings/supervisor/RunReason.c b/shared-bindings/supervisor/RunReason.c index 73f62fed6db38..a2a5fe13efe94 100644 --- a/shared-bindings/supervisor/RunReason.c +++ b/shared-bindings/supervisor/RunReason.c @@ -37,7 +37,7 @@ MAKE_ENUM_VALUE(supervisor_run_reason_type, run_reason, REPL_RELOAD, RUN_REASON_ //| """The reason that CircuitPython started running.""" //| //| STARTUP: object -//| """CircuitPython started the microcontroller started up. See `microcontroller.cpu.reset_reason` +//| """CircuitPython started the microcontroller started up. See `microcontroller.Processor.reset_reason` //| for more detail on why the microcontroller was started.""" //| //| AUTO_RELOAD: object diff --git a/shared-bindings/supervisor/Runtime.c b/shared-bindings/supervisor/Runtime.c index 1a283b35c00da..8e0259a3b38f4 100755 --- a/shared-bindings/supervisor/Runtime.c +++ b/shared-bindings/supervisor/Runtime.c @@ -98,7 +98,7 @@ const mp_obj_property_t supervisor_serial_bytes_available_obj = { //| run_reason: RunReason -//| """Returns why CircuitPython started running this particular time. +//| """Returns why CircuitPython started running this particular time.""" //| STATIC mp_obj_t supervisor_get_run_reason(mp_obj_t self) { return cp_enum_find(&supervisor_run_reason_type, _run_reason); diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c index c13b19e48e9ff..9a7890a87d009 100644 --- a/shared-bindings/supervisor/__init__.c +++ b/shared-bindings/supervisor/__init__.c @@ -47,18 +47,19 @@ //| This object is the sole instance of `supervisor.Runtime`.""" //| -//| def allow_deep_sleep(*, when_connected: bool = False, on_error: bool = False): -//| """Configure when CircuitPython can go into deep sleep. Deep sleep can occur -//| after a program has finished running or when `supervisor.deep_sleep_now()` is called. +//| def allow_deep_sleep(*, when_connected: bool = False, on_error: bool = False) -> None: +//| """Configure when CircuitPython can go into deep sleep. Deep sleep can occur +//| after a program has finished running or when `supervisor.exit_and_deep_sleep()` is called. //| -//| :param bool when_connected: If ``True``, CircuitPython will go into deep sleep -//| when a program finishes, even if it is connected to a host computer over USB or other means. -//| It will disconnect from the host before sleeping. -//| If ``False``, deep sleep will not be entered if connected. -//| :param bool on_error: If ``True``, deep sleep will be entered if even a program -//| terminated due to an exception or fatal error. If ``False``, an error will cause -//| CircuitPython to stay awake, flashing error codes on the status RGB LED, if available. -//| ... +//| :param bool when_connected: If ``True``, CircuitPython will go into deep sleep +//| when a program finishes, even if it is connected to a host computer over USB or other means. +//| It will disconnect from the host before sleeping. +//| If ``False``, deep sleep will not be entered if connected. +//| :param bool on_error: If ``True``, deep sleep will be entered if even a program +//| terminated due to an exception or fatal error. If ``False``, an error will cause +//| CircuitPython to stay awake, flashing error codes on the status RGB LED, if available. +//| """ +//| ... //| STATIC mp_obj_t supervisor_allow_deep_sleep(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_when_connected, ARG_on_error }; @@ -77,16 +78,16 @@ STATIC mp_obj_t supervisor_allow_deep_sleep(size_t n_args, const mp_obj_t *pos_a } MP_DEFINE_CONST_FUN_OBJ_KW(supervisor_allow_deep_sleep_obj, 0, supervisor_allow_deep_sleep); -//| def deep_sleep(): -> None +//| def exit_and_deep_sleep() -> None: //| """Go into deep sleep mode immediately, if not connected to a host computer. -//| But if connected and `supervisor.runtime.allow_deep_sleep(when_connected=true)` -//| has not been called, simply restart. -//| +//| But if connected and ``supervisor.allow_deep_sleep(when_connected=true)`` +//| has not been called, simply restart.""" +//| ... -STATIC mp_obj_t supervisor_deep_sleep(void) { +STATIC mp_obj_t supervisor_exit_and_deep_sleep(void) { common_hal_mcu_deep_sleep(); } -MP_DEFINE_CONST_FUN_OBJ_0(supervisor_deep_sleep_obj, supervisor_deep_sleep); +MP_DEFINE_CONST_FUN_OBJ_0(supervisor_exit_and_deep_sleep_obj, supervisor_exit_and_deep_sleep); //| def enable_autoreload() -> None: //| """Enable autoreload based on USB file write activity.""" @@ -156,7 +157,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(supervisor_set_next_stack_limit_obj, supervisor_set_ne STATIC const mp_rom_map_elem_t supervisor_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_supervisor) }, { MP_ROM_QSTR(MP_QSTR_allow_deep_sleep), MP_ROM_PTR(&supervisor_allow_deep_sleep_obj) }, - { MP_ROM_QSTR(MP_QSTR_deep_sleep), MP_ROM_PTR(&supervisor_deep_sleep_obj) }, + { MP_ROM_QSTR(MP_QSTR_exit_and_deep_sleep), MP_ROM_PTR(&supervisor_exit_and_deep_sleep_obj) }, { MP_ROM_QSTR(MP_QSTR_enable_autoreload), MP_ROM_PTR(&supervisor_enable_autoreload_obj) }, { MP_ROM_QSTR(MP_QSTR_disable_autoreload), MP_ROM_PTR(&supervisor_disable_autoreload_obj) }, { MP_ROM_QSTR(MP_QSTR_set_rgb_status_brightness), MP_ROM_PTR(&supervisor_set_rgb_status_brightness_obj) }, From a854da35d33f1bc1673b4de08b2efa9f4823b805 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Wed, 25 Nov 2020 12:14:56 -0500 Subject: [PATCH 294/770] Fix masking issue causing pin claim problems --- ports/esp32s2/common-hal/microcontroller/Pin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index 3c2611efeba79..394a19e695b0a 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -96,7 +96,7 @@ void reset_all_pins(void) { } void claim_pin(const mcu_pin_obj_t* pin) { - in_use[pin->number / 32] |= (1 << pin->number % 32); + in_use[pin->number / 32] |= (1 << (pin->number % 32)); #ifdef MICROPY_HW_NEOPIXEL if (pin == MICROPY_HW_NEOPIXEL) { neopixel_in_use = true; @@ -116,7 +116,7 @@ bool pin_number_is_free(gpio_num_t pin_number) { #endif uint8_t offset = pin_number / 32; - uint8_t mask = 1 << pin_number % 32; + uint32_t mask = 1 << (pin_number % 32); return (never_reset_pins[offset] & mask) == 0 && (in_use[offset] & mask) == 0; } From 9dbea36eac9a78cf324bba8d32a5cb2c9940d411 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 25 Nov 2020 15:07:57 -0500 Subject: [PATCH 295/770] changed alarm.time API --- locale/circuitpython.pot | 29 +++--- main.c | 7 +- ports/esp32s2/common-hal/alarm/__init__.c | 33 +++++-- ports/esp32s2/common-hal/alarm/pin/PinAlarm.c | 3 +- .../{DurationAlarm.c => MonotonicTimeAlarm.c} | 22 +---- .../{DurationAlarm.h => MonotonicTimeAlarm.h} | 5 +- py/circuitpy_defns.mk | 2 +- py/obj.h | 1 + py/objfloat.c | 7 ++ shared-bindings/alarm/__init__.c | 10 +- shared-bindings/alarm/__init__.h | 2 +- shared-bindings/alarm/pin/PinAlarm.c | 37 +++++++- shared-bindings/alarm/pin/PinAlarm.h | 4 +- shared-bindings/alarm/time/DurationAlarm.c | 91 ------------------ .../alarm/time/MonotonicTimeAlarm.c | 93 +++++++++++++++++++ .../{DurationAlarm.h => MonotonicTimeAlarm.h} | 17 ++-- shared-bindings/time/__init__.c | 4 +- 17 files changed, 209 insertions(+), 158 deletions(-) rename ports/esp32s2/common-hal/alarm/time/{DurationAlarm.c => MonotonicTimeAlarm.c} (61%) rename ports/esp32s2/common-hal/alarm/time/{DurationAlarm.h => MonotonicTimeAlarm.h} (91%) delete mode 100644 shared-bindings/alarm/time/DurationAlarm.c create mode 100644 shared-bindings/alarm/time/MonotonicTimeAlarm.c rename shared-bindings/alarm/time/{DurationAlarm.h => MonotonicTimeAlarm.h} (63%) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 1dae9547a3493..b59a5f77e4683 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-11-21 12:36-0500\n" +"POT-Creation-Date: 2020-11-25 15:08-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,13 +17,6 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: main.c -msgid "" -"\n" -"\n" -"------ soft reboot ------\n" -msgstr "" - #: main.c msgid "" "\n" @@ -849,6 +842,10 @@ msgstr "" msgid "Expected an Address" msgstr "" +#: shared-bindings/alarm/__init__.c +msgid "Expected an alarm" +msgstr "" + #: shared-module/_pixelbuf/PixelBuf.c #, c-format msgid "Expected tuple of length %d, got %d" @@ -1440,6 +1437,10 @@ msgid "" "%d bpp given" msgstr "" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "Only one alarm.time alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "" @@ -1497,6 +1498,10 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "PinAlarm deep sleep not yet implemented" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -2449,10 +2454,6 @@ msgstr "" msgid "division by zero" msgstr "" -#: ports/esp32s2/common-hal/alarm/time/DurationAlarm.c -msgid "duration out of range" -msgstr "" - #: py/objdeque.c msgid "empty" msgstr "" @@ -3354,6 +3355,10 @@ msgstr "" msgid "small int overflow" msgstr "" +#: main.c +msgid "soft reboot\n" +msgstr "" + #: extmod/ulab/code/numerical/numerical.c msgid "sort argument must be an ndarray" msgstr "" diff --git a/main.c b/main.c index 10066bd92f91d..d52f8401859df 100755 --- a/main.c +++ b/main.c @@ -321,7 +321,9 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { ESP_LOGI("main", "common_hal_alarm_enable_deep_sleep_alarms()"); #if CIRCUITPY_ALARM // Enable pin or time alarms before sleeping. - common_hal_alarm_enable_deep_sleep_alarms(); + // If immediate_wake is true, then there's alarm that would trigger immediately, + // so don't sleep. + bool immediate_wake = !common_hal_alarm_enable_deep_sleep_alarms(); #endif @@ -332,6 +334,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { // It's ok to deep sleep if we're not connected to a host, but we need to make sure // we're giving enough time for USB enumeration to happen. bool deep_sleep_allowed = + !immediate_wake && (ok || supervisor_workflow_get_allow_deep_sleep_on_error()) && (!supervisor_workflow_active() || supervisor_workflow_get_allow_deep_sleep_when_connected()) && (supervisor_ticks_ms64() > CIRCUITPY_USB_ENUMERATION_DELAY * 1024); @@ -576,7 +579,7 @@ int __attribute__((used)) main(void) { } if (exit_code == PYEXEC_FORCED_EXIT) { if (!first_run) { - serial_write_compressed(translate("\n\n------ soft reboot ------\n")); + serial_write_compressed(translate("soft reboot\n")); } first_run = false; skip_repl = run_code_py(safe_mode); diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index 87276bdaf0bae..37d74c0be321b 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -25,13 +25,15 @@ * THE SOFTWARE. */ +#include "py/obj.h" #include "py/objtuple.h" #include "py/runtime.h" #include "shared-bindings/alarm/__init__.h" #include "shared-bindings/alarm/pin/PinAlarm.h" -#include "shared-bindings/alarm/time/DurationAlarm.h" +#include "shared-bindings/alarm/time/MonotonicTimeAlarm.h" #include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/time/__init__.h" #include "esp_sleep.h" @@ -49,8 +51,8 @@ mp_obj_t common_hal_alarm_get_wake_alarm(void) { switch (esp_sleep_get_wakeup_cause()) { case ESP_SLEEP_WAKEUP_TIMER: { // Wake up from timer. - alarm_time_duration_alarm_obj_t *timer = m_new_obj(alarm_time_duration_alarm_obj_t); - timer->base.type = &alarm_time_duration_alarm_type; + alarm_time_monotonic_time_alarm_obj_t *timer = m_new_obj(alarm_time_monotonic_time_alarm_obj_t); + timer->base.type = &alarm_time_monotonic_time_alarm_type; return timer; } @@ -84,7 +86,7 @@ void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *ala if (MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pin_alarm_type)) { mp_raise_NotImplementedError(translate("PinAlarm deep sleep not yet implemented")); } - if (MP_OBJ_IS_TYPE(alarms[i], &alarm_time_duration_alarm_type)) { + else if (MP_OBJ_IS_TYPE(alarms[i], &alarm_time_monotonic_time_alarm_type)) { if (time_alarm_set) { mp_raise_ValueError(translate("Only one alarm.time alarm can be set.")); } @@ -95,14 +97,25 @@ void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *ala _deep_sleep_alarms = mp_obj_new_tuple(n_alarms, alarms); } -void common_hal_alarm_enable_deep_sleep_alarms(void) { +// Return false if we should wake up immediately because a time alarm is in the past +// or otherwise already triggered. +bool common_hal_alarm_enable_deep_sleep_alarms(void) { for (size_t i = 0; i < _deep_sleep_alarms->len; i++) { mp_obj_t alarm = _deep_sleep_alarms->items[i]; - if (MP_OBJ_IS_TYPE(alarm, &alarm_time_duration_alarm_type)) { - alarm_time_duration_alarm_obj_t *duration_alarm = MP_OBJ_TO_PTR(alarm); - esp_sleep_enable_timer_wakeup( - (uint64_t) (duration_alarm->duration * 1000000.0f)); + if (MP_OBJ_IS_TYPE(alarm, &alarm_pin_pin_alarm_type)) { + // TODO: handle pin alarms + mp_raise_NotImplementedError(translate("PinAlarm deep sleep not yet implemented")); + } + else if (MP_OBJ_IS_TYPE(alarm, &alarm_time_monotonic_time_alarm_type)) { + alarm_time_monotonic_time_alarm_obj_t *monotonic_time_alarm = MP_OBJ_TO_PTR(alarm); + mp_float_t now = uint64_to_float(common_hal_time_monotonic()); + // Compute a relative time in the future from now. + mp_float_t duration_secs = now - monotonic_time_alarm->monotonic_time; + if (duration_secs <= 0.0f) { + return false; + } + esp_sleep_enable_timer_wakeup((uint64_t) (duration_secs * 1000000)); } - // TODO: handle pin alarms } + return true; } diff --git a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c index f26c8a179a97d..438d6885dc3af 100644 --- a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +++ b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c @@ -3,7 +3,6 @@ * * The MIT License (MIT) * - * Copyright (c) 2020 @microDev1 (GitHub) * Copyright (c) 2020 Dan Halbert for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -38,7 +37,7 @@ void common_hal_alarm_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, c self->pull = pull; } -const mp_obj_tuple_t *common_hal_alarm_pin_pin_alarm_get_pins(alarm_pin_pin_alarm_obj_t *self) { +mp_obj_tuple_t *common_hal_alarm_pin_pin_alarm_get_pins(alarm_pin_pin_alarm_obj_t *self) { return self->pins; } diff --git a/ports/esp32s2/common-hal/alarm/time/DurationAlarm.c b/ports/esp32s2/common-hal/alarm/time/MonotonicTimeAlarm.c similarity index 61% rename from ports/esp32s2/common-hal/alarm/time/DurationAlarm.c rename to ports/esp32s2/common-hal/alarm/time/MonotonicTimeAlarm.c index 80bf4244e392f..81864d99ed93a 100644 --- a/ports/esp32s2/common-hal/alarm/time/DurationAlarm.c +++ b/ports/esp32s2/common-hal/alarm/time/MonotonicTimeAlarm.c @@ -3,7 +3,6 @@ * * The MIT License (MIT) * - * Copyright (c) 2020 @microDev1 (GitHub) * Copyright (c) 2020 Dan Halbert for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -29,23 +28,12 @@ #include "py/runtime.h" -#include "shared-bindings/alarm/time/DurationAlarm.h" +#include "shared-bindings/alarm/time/MonotonicTimeAlarm.h" -void common_hal_alarm_time_duration_alarm_construct(alarm_time_duration_alarm_obj_t *self, mp_float_t duration) { - self->duration = duration; +void common_hal_alarm_time_monotonic_time_alarm_construct(alarm_time_monotonic_time_alarm_obj_t *self, mp_float_t monotonic_time) { + self->monotonic_time = monotonic_time; } -mp_float_t common_hal_alarm_time_duration_alarm_get_duration(alarm_time_duration_alarm_obj_t *self) { - return self->duration; -} - -void common_hal_alarm_time_duration_alarm_enable(alarm_time_duration_alarm_obj_t *self) { - if (esp_sleep_enable_timer_wakeup((uint64_t) (self->duration * 1000000)) == ESP_ERR_INVALID_ARG) { - mp_raise_ValueError(translate("duration out of range")); - } -} - -void common_hal_alarm_time_duration_alarm_disable (alarm_time_duration_alarm_obj_t *self) { - (void) self; - esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_TIMER); +mp_float_t common_hal_alarm_time_monotonic_time_alarm_get_monotonic_time(alarm_time_monotonic_time_alarm_obj_t *self) { + return self->monotonic_time; } diff --git a/ports/esp32s2/common-hal/alarm/time/DurationAlarm.h b/ports/esp32s2/common-hal/alarm/time/MonotonicTimeAlarm.h similarity index 91% rename from ports/esp32s2/common-hal/alarm/time/DurationAlarm.h rename to ports/esp32s2/common-hal/alarm/time/MonotonicTimeAlarm.h index 3e81cbac2fc50..5ff8294506e8a 100644 --- a/ports/esp32s2/common-hal/alarm/time/DurationAlarm.h +++ b/ports/esp32s2/common-hal/alarm/time/MonotonicTimeAlarm.h @@ -3,7 +3,6 @@ * * The MIT License (MIT) * - * Copyright (c) 2020 @microDev1 (GitHub) * Copyright (c) 2020 Dan Halbert for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -30,5 +29,5 @@ typedef struct { mp_obj_base_t base; - mp_float_t duration; // seconds -} alarm_time_duration_alarm_obj_t; + mp_float_t monotonic_time; // values compatible with time.monotonic_time() +} alarm_time_monotonic_time_alarm_obj_t; diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 27466282a8930..14b658df4a9df 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -303,7 +303,7 @@ SRC_COMMON_HAL_ALL = \ _pew/__init__.c \ alarm/__init__.c \ alarm/pin/PinAlarm.c \ - alarm/time/DurationAlarm.c \ + alarm/time/MonotonicTimeAlarm.c \ analogio/AnalogIn.c \ analogio/AnalogOut.c \ analogio/__init__.c \ diff --git a/py/obj.h b/py/obj.h index 805b26e487b4c..e055c975065ef 100644 --- a/py/obj.h +++ b/py/obj.h @@ -679,6 +679,7 @@ mp_obj_t mp_obj_new_bytearray_by_ref(size_t n, void *items); #if MICROPY_PY_BUILTINS_FLOAT mp_obj_t mp_obj_new_int_from_float(mp_float_t val); mp_obj_t mp_obj_new_complex(mp_float_t real, mp_float_t imag); +extern mp_float_t uint64_to_float(uint64_t ui64); #endif mp_obj_t mp_obj_new_exception(const mp_obj_type_t *exc_type); mp_obj_t mp_obj_new_exception_arg1(const mp_obj_type_t *exc_type, mp_obj_t arg); diff --git a/py/objfloat.c b/py/objfloat.c index 59f1eb2f69de7..80f10e816ec25 100644 --- a/py/objfloat.c +++ b/py/objfloat.c @@ -333,6 +333,13 @@ mp_obj_t mp_obj_float_binary_op(mp_binary_op_t op, mp_float_t lhs_val, mp_obj_t return mp_obj_new_float(lhs_val); } +// Convert a uint64_t to a 32-bit float without invoking the double-precision math routines, +// which are large. +mp_float_t uint64_to_float(uint64_t ui64) { + // 4294967296 = 2^32 + return (mp_float_t) ((uint32_t) (ui64 >> 32) * 4294967296.0f + (uint32_t) (ui64 & 0xffffffff)); +} + #pragma GCC diagnostic pop #endif // MICROPY_PY_BUILTINS_FLOAT diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index b6b86c8354ecb..a3ecdd2ba0c77 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -29,7 +29,7 @@ #include "shared-bindings/alarm/__init__.h" #include "shared-bindings/alarm/pin/PinAlarm.h" -#include "shared-bindings/alarm/time/DurationAlarm.h" +#include "shared-bindings/alarm/time/MonotonicTimeAlarm.h" //| """Power-saving light and deep sleep. Alarms can be set to wake up from sleep. //| @@ -60,7 +60,7 @@ void validate_objs_are_alarms(size_t n_args, const mp_obj_t *objs) { for (size_t i = 0; i < n_args; i++) { if (MP_OBJ_IS_TYPE(objs[i], &alarm_pin_pin_alarm_type) || - MP_OBJ_IS_TYPE(objs[i], &alarm_time_duration_alarm_type)) { + MP_OBJ_IS_TYPE(objs[i], &alarm_time_monotonic_time_alarm_type)) { continue; } mp_raise_TypeError_varg(translate("Expected an alarm")); @@ -86,7 +86,9 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_sleep_until_alarms_obj, 1, MP_OBJ_FUN_ //| When awakened, the microcontroller will restart and run ``boot.py`` and ``code.py`` //| from the beginning. //| -//| The alarm that caused the wake-up is available as `alarm.wake_alarm`. +//| An alarm equivalent to the one that caused the wake-up is available as `alarm.wake_alarm`. +//| Its type and/or attributes may not correspond exactly to the original alarm. +//| For time-base alarms, currently, an `alarm.time.MonotonicTimeAlarm()` is created. //| //| If you call this routine more than once, only the last set of alarms given will be used. //| """ @@ -121,7 +123,7 @@ STATIC const mp_obj_module_t alarm_pin_module = { STATIC const mp_map_elem_t alarm_time_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_time) }, - { MP_ROM_QSTR(MP_QSTR_DurationAlarm), MP_OBJ_FROM_PTR(&alarm_time_duration_alarm_type) }, + { MP_ROM_QSTR(MP_QSTR_MonotonicTimeAlarm), MP_OBJ_FROM_PTR(&alarm_time_monotonic_time_alarm_type) }, }; STATIC MP_DEFINE_CONST_DICT(alarm_time_globals, alarm_time_globals_table); diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h index d8d6812c908dd..0f084c78e8fec 100644 --- a/shared-bindings/alarm/__init__.h +++ b/shared-bindings/alarm/__init__.h @@ -32,7 +32,7 @@ #include "common-hal/alarm/__init__.h" extern mp_obj_t common_hal_alarm_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms); -extern void common_hal_alarm_enable_deep_sleep_alarms(void); +extern bool common_hal_alarm_enable_deep_sleep_alarms(void); extern void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms); // Used by wake-up code. diff --git a/shared-bindings/alarm/pin/PinAlarm.c b/shared-bindings/alarm/pin/PinAlarm.c index bb48b93c4244d..ff7b19ca1fd4f 100644 --- a/shared-bindings/alarm/pin/PinAlarm.c +++ b/shared-bindings/alarm/pin/PinAlarm.c @@ -31,6 +31,7 @@ #include "py/nlr.h" #include "py/obj.h" +#include "py/objproperty.h" #include "py/runtime.h" #include "supervisor/shared/translate.h" @@ -39,7 +40,7 @@ //| //| def __init__(self, *pins: microcontroller.Pin, value: bool, all_same_value: bool = False, edge: bool = False, pull: bool = False) -> None: //| """Create an alarm triggered by a `microcontroller.Pin` level. The alarm is not active -//| until it is listed in an `alarm`-enabling function, such as `alarm.sleep_until_alarms()` or +//| until it is passed to an `alarm`-enabling function, such as `alarm.sleep_until_alarms()` or //| `alarm.set_deep_sleep_alarms()`. //| //| :param microcontroller.Pin \*pins: The pins to monitor. On some ports, the choice of pins @@ -88,7 +89,41 @@ STATIC mp_obj_t alarm_pin_pin_alarm_make_new(const mp_obj_type_t *type, mp_uint_ return MP_OBJ_FROM_PTR(self); } +//| pins: Tuple[microcontroller.pin] +//| """The trigger pins.""" +//| +STATIC mp_obj_t alarm_pin_pin_alarm_obj_get_pins(mp_obj_t self_in) { + alarm_pin_pin_alarm_obj_t *self = MP_OBJ_TO_PTR(self_in); + return common_hal_alarm_pin_pin_alarm_get_pins(self); +} +MP_DEFINE_CONST_FUN_OBJ_1(alarm_pin_pin_alarm_get_pins_obj, alarm_pin_pin_alarm_obj_get_pins); + +const mp_obj_property_t alarm_pin_pin_alarm_pins_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&alarm_pin_pin_alarm_get_pins_obj, + (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +//| value: Tuple[microcontroller.pin] +//| """The value on which to trigger.""" +//| +STATIC mp_obj_t alarm_pin_pin_alarm_obj_get_value(mp_obj_t self_in) { + alarm_pin_pin_alarm_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_bool(common_hal_alarm_pin_pin_alarm_get_value(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(alarm_pin_pin_alarm_get_value_obj, alarm_pin_pin_alarm_obj_get_value); + +const mp_obj_property_t alarm_pin_pin_alarm_value_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&alarm_pin_pin_alarm_get_value_obj, + (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + STATIC const mp_rom_map_elem_t alarm_pin_pin_alarm_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_pins), MP_ROM_PTR(&alarm_pin_pin_alarm_pins_obj) }, + { MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&alarm_pin_pin_alarm_value_obj) }, }; STATIC MP_DEFINE_CONST_DICT(alarm_pin_pin_alarm_locals_dict, alarm_pin_pin_alarm_locals_dict_table); diff --git a/shared-bindings/alarm/pin/PinAlarm.h b/shared-bindings/alarm/pin/PinAlarm.h index bbf3018b5d807..cb69468124bf1 100644 --- a/shared-bindings/alarm/pin/PinAlarm.h +++ b/shared-bindings/alarm/pin/PinAlarm.h @@ -35,8 +35,8 @@ extern const mp_obj_type_t alarm_pin_pin_alarm_type; void common_hal_alarm_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, const mp_obj_t pins[], size_t num_pins, bool value, bool all_same_value, bool edge, bool pull); -extern const mp_obj_tuple_t *common_hal_alarm_pin_pin_alarm_get_pins(alarm_pin_pin_alarm_obj_t *self); -extern bool common_hal_alarm_pin_pin_alarm_get_level(alarm_pin_pin_alarm_obj_t *self); +extern mp_obj_tuple_t *common_hal_alarm_pin_pin_alarm_get_pins(alarm_pin_pin_alarm_obj_t *self); +extern bool common_hal_alarm_pin_pin_alarm_get_value(alarm_pin_pin_alarm_obj_t *self); extern bool common_hal_alarm_pin_pin_alarm_get_edge(alarm_pin_pin_alarm_obj_t *self); extern bool common_hal_alarm_pin_pin_alarm_get_pull(alarm_pin_pin_alarm_obj_t *self); diff --git a/shared-bindings/alarm/time/DurationAlarm.c b/shared-bindings/alarm/time/DurationAlarm.c deleted file mode 100644 index 6831aba5db499..0000000000000 --- a/shared-bindings/alarm/time/DurationAlarm.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2020 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 "shared-bindings/board/__init__.h" -#include "shared-bindings/microcontroller/__init__.h" -#include "shared-bindings/alarm/time/DurationAlarm.h" - -#include "py/nlr.h" -#include "py/obj.h" -#include "py/runtime.h" -#include "supervisor/shared/translate.h" - -//| class DurationAlarm: -//| """Trigger an alarm at a specified interval from now.""" -//| -//| def __init__(self, secs: float) -> None: -//| """Create an alarm that will be triggered in ``secs`` seconds from the time -//| sleep starts. The alarm is not active until it is listed in an -//| `alarm`-enabling function, such as `alarm.sleep_until_alarms()` or -//| `alarm.set_deep_sleep_alarms()`. -//| """ -//| ... -//| -STATIC mp_obj_t alarm_time_duration_alarm_make_new(const mp_obj_type_t *type, - mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kw_args) { - mp_arg_check_num(n_args, kw_args, 1, 1, false); - - alarm_time_duration_alarm_obj_t *self = m_new_obj(alarm_time_duration_alarm_obj_t); - self->base.type = &alarm_time_duration_alarm_type; - - mp_float_t secs = mp_obj_get_float(args[0]); - - common_hal_alarm_time_duration_alarm_construct(self, secs); - - return MP_OBJ_FROM_PTR(self); -} - -//| def __eq__(self, other: object) -> bool: -//| """Two DurationAlarm objects are equal if their durations differ by less than a millisecond.""" -//| ... -//| -STATIC mp_obj_t alarm_time_duration_alarm_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) { - switch (op) { - case MP_BINARY_OP_EQUAL: - if (MP_OBJ_IS_TYPE(rhs_in, &alarm_time_duration_alarm_type)) { - return mp_obj_new_bool( - abs(common_hal_alarm_time_duration_alarm_get_duration(lhs_in) - - common_hal_alarm_time_duration_alarm_get_duration(rhs_in)) < 0.001f); - } - return mp_const_false; - - default: - return MP_OBJ_NULL; // op not supported - } -} - -STATIC const mp_rom_map_elem_t alarm_time_duration_alarm_locals_dict_table[] = { -}; - -STATIC MP_DEFINE_CONST_DICT(alarm_time_duration_alarm_locals_dict, alarm_time_duration_alarm_locals_dict_table); - -const mp_obj_type_t alarm_time_duration_alarm_type = { - { &mp_type_type }, - .name = MP_QSTR_DurationAlarm, - .make_new = alarm_time_duration_alarm_make_new, - .binary_op = alarm_time_duration_alarm_binary_op, - .locals_dict = (mp_obj_t)&alarm_time_duration_alarm_locals_dict, -}; diff --git a/shared-bindings/alarm/time/MonotonicTimeAlarm.c b/shared-bindings/alarm/time/MonotonicTimeAlarm.c new file mode 100644 index 0000000000000..6ee411e883eb7 --- /dev/null +++ b/shared-bindings/alarm/time/MonotonicTimeAlarm.c @@ -0,0 +1,93 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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 "shared-bindings/board/__init__.h" +#include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/alarm/time/MonotonicTimeAlarm.h" + +#include "py/nlr.h" +#include "py/obj.h" +#include "py/objproperty.h" +#include "py/runtime.h" +#include "supervisor/shared/translate.h" + +//| class MonotonicTimeAlarm: +//| """Trigger an alarm when `time.monotonic()` reaches the given value.""" +//| +//| def __init__(self, monotonic_time: float) -> None: +//| """Create an alarm that will be triggered when `time.monotonic()` would equal +//| ``monotonic_time``. +//| The alarm is not active until it is passed to an +//| `alarm`-enabling function, such as `alarm.sleep_until_alarms()` or +//| `alarm.set_deep_sleep_alarms()`. +//| +//| If the given time is in the past when sleep occurs, the alarm will be triggered +//| immediately. +//| """ +//| ... +//| +STATIC mp_obj_t alarm_time_monotonic_time_alarm_make_new(const mp_obj_type_t *type, + mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kw_args) { + mp_arg_check_num(n_args, kw_args, 1, 1, false); + + alarm_time_monotonic_time_alarm_obj_t *self = m_new_obj(alarm_time_monotonic_time_alarm_obj_t); + self->base.type = &alarm_time_monotonic_time_alarm_type; + + mp_float_t secs = mp_obj_get_float(args[0]); + + common_hal_alarm_time_monotonic_time_alarm_construct(self, secs); + + return MP_OBJ_FROM_PTR(self); +} + +//| monotonic_time: float +//| """The time at which to trigger, based on the `time.monotonic()` clock.""" +//| +STATIC mp_obj_t alarm_time_monotonic_time_alarm_obj_get_monotonic_time(mp_obj_t self_in) { + alarm_time_monotonic_time_alarm_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_float(common_hal_alarm_time_monotonic_time_alarm_get_monotonic_time(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(alarm_time_monotonic_time_alarm_get_monotonic_time_obj, alarm_time_monotonic_time_alarm_obj_get_monotonic_time); + +const mp_obj_property_t alarm_time_monotonic_time_alarm_monotonic_time_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&alarm_time_monotonic_time_alarm_get_monotonic_time_obj, + (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +STATIC const mp_rom_map_elem_t alarm_time_monotonic_time_alarm_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_monotonic_time), MP_ROM_PTR(&alarm_time_monotonic_time_alarm_monotonic_time_obj) }, +}; + +STATIC MP_DEFINE_CONST_DICT(alarm_time_monotonic_time_alarm_locals_dict, alarm_time_monotonic_time_alarm_locals_dict_table); + +const mp_obj_type_t alarm_time_monotonic_time_alarm_type = { + { &mp_type_type }, + .name = MP_QSTR_TimeAlarm, + .make_new = alarm_time_monotonic_time_alarm_make_new, + .locals_dict = (mp_obj_t)&alarm_time_monotonic_time_alarm_locals_dict, +}; diff --git a/shared-bindings/alarm/time/DurationAlarm.h b/shared-bindings/alarm/time/MonotonicTimeAlarm.h similarity index 63% rename from shared-bindings/alarm/time/DurationAlarm.h rename to shared-bindings/alarm/time/MonotonicTimeAlarm.h index 87f5d9390ca6a..6eb2738ab514e 100644 --- a/shared-bindings/alarm/time/DurationAlarm.h +++ b/shared-bindings/alarm/time/MonotonicTimeAlarm.h @@ -24,19 +24,16 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_DURATION_ALARM_H -#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_DURATION_ALARM_H +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_MONOTONIC_TIME_ALARM_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_MONOTINIC_TIME_ALARM_H #include "py/obj.h" -#include "common-hal/alarm/time/DurationAlarm.h" +#include "common-hal/alarm/time/MonotonicTimeAlarm.h" -extern const mp_obj_type_t alarm_time_duration_alarm_type; +extern const mp_obj_type_t alarm_time_monotonic_time_alarm_type; -extern void common_hal_alarm_time_duration_alarm_construct(alarm_time_duration_alarm_obj_t *self, mp_float_t duration); -extern mp_float_t common_hal_alarm_time_duration_alarm_get_duration(alarm_time_duration_alarm_obj_t *self); +extern void common_hal_alarm_time_monotonic_time_alarm_construct(alarm_time_monotonic_time_alarm_obj_t *self, mp_float_t monotonic_time); +extern mp_float_t common_hal_alarm_time_monotonic_time_alarm_get_monotonic_time(alarm_time_monotonic_time_alarm_obj_t *self); -extern void common_hal_alarm_time_duration_alarm_enable(alarm_time_duration_alarm_obj_t *self); -extern void common_hal_alarm_time_duration_alarm_disable (alarm_time_duration_alarm_obj_t *self); - -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_DURATION_ALARM_H +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_MONOTONIC_TIME_ALARM_H diff --git a/shared-bindings/time/__init__.c b/shared-bindings/time/__init__.c index 44f82c62e7607..804d5ecd89e5f 100644 --- a/shared-bindings/time/__init__.c +++ b/shared-bindings/time/__init__.c @@ -51,9 +51,9 @@ //| ... //| STATIC mp_obj_t time_monotonic(void) { + // Returns ms ticks. uint64_t time64 = common_hal_time_monotonic(); - // 4294967296 = 2^32 - return mp_obj_new_float(((uint32_t) (time64 >> 32) * 4294967296.0f + (uint32_t) (time64 & 0xffffffff)) / 1000.0f); + return mp_obj_new_float(uint64_to_float(time64) / 1000.0f); } MP_DEFINE_CONST_FUN_OBJ_0(time_monotonic_obj, time_monotonic); From 715b09bff29fd10c5d0de87ed3ae98a0a78df62d Mon Sep 17 00:00:00 2001 From: Daniel Bravo Darriba Date: Thu, 26 Nov 2020 00:00:11 +0000 Subject: [PATCH 296/770] Translated using Weblate (German) Currently translated at 85.8% (742 of 864 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/de/ --- locale/de_DE.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/de_DE.po b/locale/de_DE.po index 3b6bc8e217335..56bf2867016d2 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -6,14 +6,14 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-11 16:30+0530\n" -"PO-Revision-Date: 2020-06-16 18:24+0000\n" -"Last-Translator: Andreas Buchen \n" +"PO-Revision-Date: 2020-11-26 03:11+0000\n" +"Last-Translator: Daniel Bravo Darriba \n" "Language: de_DE\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.1.1-dev\n" +"X-Generator: Weblate 4.4-dev\n" #: main.c msgid "" @@ -57,7 +57,7 @@ msgstr "%d Adress-Pins und %d rgb-Pins zeigen eine Höhe von %d, nicht von %d" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" -msgstr "" +msgstr "%q Fehler: %d" #: shared-bindings/microcontroller/Pin.c msgid "%q in use" From cb14a2a82477c771e0349fc155e4281bde7300aa Mon Sep 17 00:00:00 2001 From: Daniel Bravo Darriba Date: Wed, 25 Nov 2020 23:50:39 +0000 Subject: [PATCH 297/770] Translated using Weblate (Spanish) Currently translated at 100.0% (864 of 864 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 147 ++++++++++++++++++++++++++------------------------- 1 file changed, 74 insertions(+), 73 deletions(-) diff --git a/locale/es.po b/locale/es.po index b0314ae1984f9..db3a630c84f9d 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-11 16:30+0530\n" -"PO-Revision-Date: 2020-11-15 16:28+0000\n" -"Last-Translator: RubenD \n" +"PO-Revision-Date: 2020-11-26 03:11+0000\n" +"Last-Translator: Daniel Bravo Darriba \n" "Language-Team: \n" "Language: es\n" "MIME-Version: 1.0\n" @@ -437,7 +437,7 @@ msgstr "El periférico no maneja el Baudrate" #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" -msgstr "Por debajo de taza mínima de refrescamiento" +msgstr "Por debajo de la tasa mínima de refrescamiento" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must share a clock unit" @@ -498,7 +498,7 @@ msgstr "El buffer es muy pequeño" #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" -msgstr "La longitud del buffer %d es muy grande. Debe ser menor a %d" +msgstr "Longitud del buffer %d es demasiado grande. Tiene que ser menor a %d" #: ports/atmel-samd/common-hal/sdioio/SDCard.c #: ports/cxd56/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c @@ -520,7 +520,7 @@ msgstr "Buffer demasiado grande e incapaz de asignar" #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" -msgstr "Búfer muy corto por %d bytes" +msgstr "Búffer muy corto por %d bytes" #: ports/atmel-samd/common-hal/displayio/ParallelBus.c #: ports/nrf/common-hal/displayio/ParallelBus.c @@ -729,7 +729,7 @@ msgstr "No se puede definir la dirección" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Could not start PWM" -msgstr "No se pudo iniciar el PWM" +msgstr "No se pudo iniciar PWM" #: ports/stm/common-hal/busio/UART.c msgid "Could not start interrupt, RX busy" @@ -746,7 +746,7 @@ msgstr "No se pudo asignar el primer buffer" #: shared-module/audiomp3/MP3Decoder.c msgid "Couldn't allocate input buffer" -msgstr "No se pudo encontrar el búfer de entrada" +msgstr "No se pudo encontrar el buffer de entrada" #: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c #: shared-module/audiomp3/MP3Decoder.c @@ -876,7 +876,7 @@ msgstr "FFT se define solo para ndarrays" #: extmod/ulab/code/fft/fft.c msgid "FFT is implemented for linear arrays only" -msgstr "" +msgstr "FFT solo esta implementado para arrays lineales" #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" @@ -936,7 +936,7 @@ msgstr "No se puede liberar el mutex, err 0x%04x" #: supervisor/shared/safe_mode.c msgid "Failed to write internal flash." -msgstr "Error al escribir al flash interno." +msgstr "Error al escribir el flash interno." #: py/moduerrno.c msgid "File exists" @@ -975,7 +975,7 @@ msgstr "La función requiere lock" #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Group already used" -msgstr "El grupo ya está siendo utilizado" +msgstr "Grupo ya está siendo utilizado" #: shared-module/displayio/Group.c msgid "Group full" @@ -1001,7 +1001,7 @@ msgstr "Operación I/O en archivo cerrado" #: ports/stm/common-hal/busio/I2C.c msgid "I2C Init Error" -msgstr "Error de inicio de I2C" +msgstr "I2C Error de inicio" #: shared-bindings/audiobusio/I2SOut.c msgid "I2SOut not available" @@ -1026,7 +1026,7 @@ msgstr "Tamaño incorrecto del buffer" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" -msgstr "" +msgstr "Inicializacion fallida por falta de memoria" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" @@ -1286,7 +1286,7 @@ msgstr "Debe usar un múltiplo de 6 pines rgb, no %d" #: ports/esp32s2/common-hal/nvm/ByteArray.c msgid "NVS Error" -msgstr "" +msgstr "Error NVS" #: py/parse.c msgid "Name too long" @@ -1401,7 +1401,7 @@ msgstr "No hay temporizador disponible" #: supervisor/shared/safe_mode.c msgid "Nordic Soft Device failure assertion." -msgstr "fallo de aserción de dispositivo Nordic Soft." +msgstr "Fallo de aserción de dispositivo Nordic Soft." #: shared-bindings/ipaddress/IPv4Address.c shared-bindings/ipaddress/__init__.c msgid "Not a valid IP string" @@ -1497,7 +1497,7 @@ msgstr "" #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" -msgstr "ParallelBus no soportado aún" +msgstr "ParallelBus todavía no soportado" #: py/moduerrno.c msgid "Permission denied" @@ -1531,8 +1531,9 @@ msgid "" "bytes. If this cannot be avoided, pass allow_inefficient=True to the " "constructor" msgstr "" -"El pinout utiliza %d bytes por elemento, lo que consume más del ideal de %d " -"bytes. Si esto no se puede evitar, pase allow_inefficient=True al constructor" +"El pinout utiliza %d bytes por elemento, lo que consume más de los %d bytes " +"ideales. Si esto no se puede evitar, pase allow_inefficient=True al " +"constructor" #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" @@ -1563,7 +1564,7 @@ msgstr "" #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" -msgstr "El búfer de prefijo debe estar en el montículo" +msgstr "El prefijo del buffer debe estar en el heap" #: main.c msgid "Press any key to enter the REPL. Use CTRL-D to reload." @@ -1576,7 +1577,7 @@ msgstr "Pull no se usa cuando la dirección es output." #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" -msgstr "Error de desinicializado del RNG" +msgstr "Error de desinicialización de RNG" #: ports/stm/common-hal/os/__init__.c msgid "RNG Init Error" @@ -1585,7 +1586,7 @@ msgstr "Error de inicialización de RNG" #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "RS485 inversion specified when not in RS485 mode" -msgstr "Se especifica inversión de RS485 sin estar en modo RS485" +msgstr "Se especifica inversión de RS485 si no está en modo RS485" #: ports/cxd56/common-hal/rtc/RTC.c ports/esp32s2/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c @@ -1620,7 +1621,7 @@ msgstr "Objeto de solo-lectura" #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" -msgstr "Actualizando demasiado pronto" +msgstr "Refresco demasiado pronto" #: shared-bindings/canio/RemoteTransmissionRequest.c msgid "RemoteTransmissionRequests limited to 8 bytes" @@ -1680,7 +1681,7 @@ msgstr "Frecuencia de muestreo demasiado alta. Debe ser menor a %d" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Scan already in progess. Stop with stop_scan." -msgstr "Escaneo en progreso. Use stop_scan para detener." +msgstr "Escaneo en progreso. Usa stop_scan para detener." #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Selected CTS pin not valid" @@ -1720,7 +1721,7 @@ msgstr "SocketPool solo se puede usar con wifi.radio" #: shared-bindings/aesio/aes.c msgid "Source and destination buffers must be the same length" -msgstr "Los búferes de fuente y destino deben ser del mismo tamaño" +msgstr "Los buffers de fuente y destino deben ser del mismo tamaño" #: extmod/modure.c msgid "Splitting with sub-captures" @@ -1751,7 +1752,7 @@ msgid "" "The CircuitPython heap was corrupted because the stack was too small.\n" "Please increase the stack size if you know how, or if not:" msgstr "" -"El montículo de CircuitPython se dañó porque la pila era demasiado pequeña.\n" +"El heap de CircuitPython se dañó porque la pila era demasiado pequeña.\n" "Aumente el tamaño de la pila si sabe cómo, o si no:" #: supervisor/shared/safe_mode.c @@ -1759,8 +1760,8 @@ msgid "" "The `microcontroller` module was used to boot into safe mode. Press reset to " "exit safe mode.\n" msgstr "" -"El módulo de `microcontroller` fue utilizado para bootear en modo seguro. " -"Presione reset para salir del modo seguro.\n" +"El módulo de `microcontroller` fue utilizado para arrancar en modo seguro. " +"Presiona reset para salir del modo seguro.\n" #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" @@ -1772,10 +1773,10 @@ msgid "" "enough power for the whole circuit and press reset (after ejecting " "CIRCUITPY).\n" msgstr "" -"La alimentación de la microntroladora bajó. Asegúrate que tu fuente de " -"poder\n" -"pueda suplir suficiente energía para todo el circuito y presione reset " -"(luego de\n" +"La alimentación del microntrolador cayó. Asegúrate que tu fuente de " +"alimentación\n" +"pueda aportar suficiente energía para todo el circuito y presiona reset (" +"luego de\n" "expulsar CIRCUITPY)\n" #: shared-module/audiomixer/MixerVoice.c @@ -1954,7 +1955,7 @@ msgstr "Error de seguridad desconocido: 0x%04x" #: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Unknown soft device error: %04x" -msgstr "Error suave desconocido en dispositivo: %04x" +msgstr "Error leve desconocido en dispositivo: %04x" #: shared-bindings/_pixelbuf/PixelBuf.c #, c-format @@ -1967,7 +1968,7 @@ msgid "" "declined or ignored." msgstr "" "Problema no especificado. Puede ser que la señal de emparejamiento del otro " -"dispositivo fue declinada o ignorada." +"dispositivo fue denegada o ignorada." #: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c #: ports/esp32s2/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c @@ -2057,7 +2058,7 @@ msgstr "La clave de WiFi debe ser entre 8 y 63 caracteres" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" -msgstr "Escrituras no admitidas en la característica" +msgstr "Escrituras no admitidas en Characteristic" #: supervisor/shared/safe_mode.c msgid "You are in safe mode: something unanticipated happened.\n" @@ -2110,7 +2111,7 @@ msgstr "El argumento para argsort debe ser un ndarray" #: extmod/ulab/code/numerical/numerical.c msgid "argsort is not implemented for flattened arrays" -msgstr "" +msgstr "El argot no está implementado para arrays aplanados" #: py/runtime.c msgid "argument has wrong type" @@ -2135,7 +2136,7 @@ msgstr "argumentos deben ser ndarrays" #: extmod/ulab/code/ndarray.c msgid "array and index length must be equal" -msgstr "" +msgstr "Longitud del array e índice tienen que ser iguales" #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2143,11 +2144,11 @@ msgstr "array/bytes requeridos en el lado derecho" #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" -msgstr "" +msgstr "Intendo de obteber (arg)min/(arg)max de secuencia vacía" #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" -msgstr "se trató de traer argmin/argmax de una secuencia vacía" +msgstr "intento de obtener argmin/argmax de una secuencia vacía" #: py/objstr.c msgid "attributes not supported yet" @@ -2155,15 +2156,15 @@ msgstr "atributos aún no soportados" #: extmod/ulab/code/numerical/numerical.c msgid "axis is out of bounds" -msgstr "" +msgstr "Eje está fuera de sus límites" #: extmod/ulab/code/numerical/numerical.c msgid "axis must be None, or an integer" -msgstr "" +msgstr "Eje tiene que ser None, o un entero" #: extmod/ulab/code/numerical/numerical.c msgid "axis too long" -msgstr "" +msgstr "Eje demasiado largo" #: py/builtinevex.c msgid "bad compile mode" @@ -2373,7 +2374,7 @@ msgstr "" #: extmod/ulab/code/ndarray_operators.c msgid "cannot cast output with casting rule" -msgstr "" +msgstr "No se puede realizar cast de la salida sin una regla de cast" #: py/objtype.c msgid "cannot create '%q' instances" @@ -2409,7 +2410,7 @@ msgstr "El argumento de chr() no esta en el rango(256)" #: shared-module/vectorio/Circle.c msgid "circle can only be registered in one parent" -msgstr "circle solo puede ser registrado con un pariente" +msgstr "circulo solo puede ser registrado con un pariente" #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" @@ -2473,7 +2474,7 @@ msgstr "no se pudo determinar la versión de la tarjeta SD" #: extmod/ulab/code/numerical/numerical.c msgid "cross is defined for 1D arrays of length 3" -msgstr "" +msgstr "Cruce está definido para un array 1D de longitud 3" #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" @@ -2516,7 +2517,7 @@ msgstr "El argumento diff debe ser un ndarray" #: extmod/ulab/code/numerical/numerical.c msgid "differentiation order out of range" -msgstr "" +msgstr "Orden de diferenciación fuera de rango" #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c @@ -2635,11 +2636,11 @@ msgstr "el primer argumento debe ser una función" #: extmod/ulab/code/ulab_create.c msgid "first argument must be a tuple of ndarrays" -msgstr "" +msgstr "Primer argumento tiene que ser una tupla de ndarrays" #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" -msgstr "el primer argumento debe permitir iteración" +msgstr "el primer argumento debe ser un iterable" #: extmod/ulab/code/vector/vectorise.c msgid "first argument must be an ndarray" @@ -2659,7 +2660,7 @@ msgstr "el argumento invertido debe ser un ndarray" #: py/objint.c msgid "float too big" -msgstr "punto flotante muy grande" +msgstr "punto flotante demasiado grande" #: shared-bindings/_stage/Text.c msgid "font must be 2048 bytes long" @@ -2692,7 +2693,7 @@ msgstr "la función tiene el mismo signo a extremos del intervalo" #: extmod/ulab/code/ndarray.c msgid "function is defined for ndarrays only" -msgstr "" +msgstr "Función solo definida para ndarrays" #: py/argcheck.c #, c-format @@ -2788,7 +2789,7 @@ msgstr "ensamblador en línea debe ser una función" #: extmod/ulab/code/ndarray.c msgid "input and output shapes are not compatible" -msgstr "" +msgstr "Formas de entrada y salida no son compactibles" #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" @@ -2800,11 +2801,11 @@ msgstr "el tamaño del arreglo de entrada debe ser potencia de 2" #: extmod/ulab/code/ulab_create.c msgid "input arrays are not compatible" -msgstr "" +msgstr "Arrays de entrada no son compactibles" #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" -msgstr "los datos de entrada deben permitir iteración" +msgstr "los datos de entrada deben ser iterables" #: extmod/ulab/code/linalg/linalg.c msgid "input matrix is asymmetric" @@ -2816,19 +2817,19 @@ msgstr "la matriz de entrada es singular" #: extmod/ulab/code/user/user.c msgid "input must be a dense ndarray" -msgstr "" +msgstr "Entrada tiene que ser un ndarray denso" #: extmod/ulab/code/ulab_create.c msgid "input must be a tensor of rank 2" -msgstr "" +msgstr "Entrada tiene que ser un tensor de rango 2" #: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c msgid "input must be an ndarray" -msgstr "" +msgstr "Entrada tiene que ser un ndarray" #: extmod/ulab/code/filter/filter.c msgid "input must be one-dimensional" -msgstr "" +msgstr "Entrada tiene que ser unidimensional" #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" @@ -2844,7 +2845,7 @@ msgstr "los vectores de entrada deben ser de igual tamaño" #: extmod/ulab/code/poly/poly.c msgid "inputs are not iterable" -msgstr "" +msgstr "Entradas no son iterables" #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" @@ -2985,7 +2986,7 @@ msgstr "long int no soportado en esta compilación" #: ports/esp32s2/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" -msgstr "" +msgstr "Loopback + modo silencioso no están soportados por periférico" #: py/parse.c msgid "malformed f-string" @@ -3019,7 +3020,7 @@ msgstr "max_lenght debe ser > 0" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" -msgstr "" +msgstr "Máximo número de dimensiones es 4" #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3027,11 +3028,11 @@ msgstr "profundidad máxima de recursión excedida" #: extmod/ulab/code/approx/approx.c msgid "maxiter must be > 0" -msgstr "" +msgstr "maxiter tiene que ser > 0" #: extmod/ulab/code/approx/approx.c msgid "maxiter should be > 0" -msgstr "" +msgstr "maxiter debe ser > 0" #: py/runtime.c #, c-format @@ -3156,7 +3157,7 @@ msgstr "" #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" -msgstr "" +msgstr "norma está definida para arrays 1D y 2D" #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" @@ -3225,7 +3226,7 @@ msgstr "string de longitud impar" #: extmod/ulab/code/ulab_create.c msgid "offset is too large" -msgstr "" +msgstr "offset es demasiado grande" #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" @@ -3251,11 +3252,11 @@ msgstr "los operandos no se pueden transmitir juntos" #: extmod/ulab/code/ndarray.c msgid "operation is implemented for 1D Boolean arrays only" -msgstr "" +msgstr "operación solo está implementada para arrays booleanos de 1D" #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented for flattened array" -msgstr "" +msgstr "operación no está implementada para arrays aplanados" #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" @@ -3393,7 +3394,7 @@ msgstr "longitud solicitada %d pero el objeto tiene longitud %d" #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" -msgstr "" +msgstr "resultados no pueden aplicar cast a un tipo específico" #: py/compile.c msgid "return annotation must be an identifier" @@ -3415,7 +3416,7 @@ msgstr "rgb_pins[%d] no está en el mismo puerto que el reloj" #: extmod/ulab/code/numerical/numerical.c msgid "roll argument must be an ndarray" -msgstr "" +msgstr "Argumento enrolado tiene que ser un ndarray" #: py/objstr.c msgid "rsplit(None,n)" @@ -3443,7 +3444,7 @@ msgstr "script de compilación no soportado" #: extmod/ulab/code/ndarray.c msgid "shape must be a tuple" -msgstr "" +msgstr "forma tiene que ser una tupla" #: py/objstr.c msgid "sign not allowed in string format specifier" @@ -3593,7 +3594,7 @@ msgstr "timestamp fuera de rango para plataform time_t" #: extmod/ulab/code/ndarray.c msgid "tobytes can be invoked for dense arrays only" -msgstr "" +msgstr "tobytes solo pueden ser invocados por arrays densos" #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" @@ -3623,12 +3624,12 @@ msgstr "tupla/lista tiene una longitud incorrecta" #: ports/esp32s2/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" -msgstr "" +msgstr "twai_driver_install devolvió esp-idf error #%d" #: ports/esp32s2/common-hal/canio/CAN.c #, c-format msgid "twai_start returned esp-idf error #%d" -msgstr "" +msgstr "twai_start devolvió esp-idf error #%d" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -3756,7 +3757,7 @@ msgstr "los vectores deben tener el mismo tamaño" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" -msgstr "" +msgstr "watchdog no inicializado" #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" @@ -3772,11 +3773,11 @@ msgstr "la ventana debe ser <= intervalo" #: extmod/ulab/code/numerical/numerical.c msgid "wrong axis index" -msgstr "" +msgstr "indice de eje erróneo" #: extmod/ulab/code/ulab_create.c msgid "wrong axis specified" -msgstr "" +msgstr "eje especificado erróneo" #: extmod/ulab/code/vector/vectorise.c msgid "wrong input type" From 9c779c7ab79212c19e5533f8d096242fe282e980 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 26 Nov 2020 04:11:29 +0100 Subject: [PATCH 298/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 13 ++++++++----- locale/cs.po | 13 ++++++++----- locale/de_DE.po | 13 ++++++++----- locale/el.po | 13 ++++++++----- locale/es.po | 20 +++++++++++++------- locale/fil.po | 13 ++++++++----- locale/fr.po | 16 +++++++++++----- locale/hi.po | 13 ++++++++----- locale/it_IT.po | 13 ++++++++----- locale/ja.po | 13 ++++++++----- locale/ko.po | 13 ++++++++----- locale/nl.po | 16 +++++++++++----- locale/pl.po | 13 ++++++++----- locale/pt_BR.po | 16 +++++++++++----- locale/sv.po | 16 +++++++++++----- locale/zh_Latn_pinyin.po | 16 +++++++++++----- 16 files changed, 148 insertions(+), 82 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index cf23970d88cff..6073b6a462df6 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-11 16:30+0530\n" +"POT-Creation-Date: 2020-11-24 15:40-0500\n" "PO-Revision-Date: 2020-10-10 23:51+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -301,6 +301,7 @@ msgid "All I2C peripherals are in use" msgstr "Semua perangkat I2C sedang digunakan" #: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -337,6 +338,7 @@ msgstr "Semua timer untuk pin ini sedang digunakan" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/neopixel_write/__init__.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c #: ports/esp32s2/common-hal/pulseio/PulseOut.c @@ -1107,6 +1109,7 @@ msgid "Invalid byteorder string" msgstr "String byteorder tidak valid" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "Periode penangkapan tidak valid. Kisaran yang valid: 1 - 500" @@ -1439,14 +1442,14 @@ msgstr "Parity ganjil tidak didukung" msgid "Only 8 or 16 bit mono with " msgstr "Hanya 8 atau 16 bit mono dengan " -#: ports/esp32s2/common-hal/socketpool/SocketPool.c -msgid "Only IPv4 SOCK_STREAM sockets supported" -msgstr "" - #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" +#: ports/esp32s2/common-hal/socketpool/SocketPool.c +msgid "Only IPv4 sockets supported" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" diff --git a/locale/cs.po b/locale/cs.po index 3249792e7038b..a77a655a62973 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-11 16:30+0530\n" +"POT-Creation-Date: 2020-11-24 15:40-0500\n" "PO-Revision-Date: 2020-05-24 03:22+0000\n" "Last-Translator: dronecz \n" "Language-Team: LANGUAGE \n" @@ -301,6 +301,7 @@ msgid "All I2C peripherals are in use" msgstr "" #: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -337,6 +338,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/neopixel_write/__init__.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c #: ports/esp32s2/common-hal/pulseio/PulseOut.c @@ -1090,6 +1092,7 @@ msgid "Invalid byteorder string" msgstr "" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "" @@ -1420,14 +1423,14 @@ msgstr "" msgid "Only 8 or 16 bit mono with " msgstr "" -#: ports/esp32s2/common-hal/socketpool/SocketPool.c -msgid "Only IPv4 SOCK_STREAM sockets supported" -msgstr "" - #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" +#: ports/esp32s2/common-hal/socketpool/SocketPool.c +msgid "Only IPv4 sockets supported" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 56bf2867016d2..7dd79d9151c6a 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-11 16:30+0530\n" +"POT-Creation-Date: 2020-11-24 15:40-0500\n" "PO-Revision-Date: 2020-11-26 03:11+0000\n" "Last-Translator: Daniel Bravo Darriba \n" "Language: de_DE\n" @@ -300,6 +300,7 @@ msgid "All I2C peripherals are in use" msgstr "Alle I2C-Peripheriegeräte sind in Benutzung" #: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -336,6 +337,7 @@ msgstr "Alle timer für diesen Pin werden bereits benutzt" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/neopixel_write/__init__.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c #: ports/esp32s2/common-hal/pulseio/PulseOut.c @@ -1107,6 +1109,7 @@ msgid "Invalid byteorder string" msgstr "Ungültige Byteorder String" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "Ungültiger Aufnahmezeitraum. Gültiger Bereich: 1 - 500" @@ -1441,14 +1444,14 @@ msgstr "Eine ungerade Parität wird nicht unterstützt" msgid "Only 8 or 16 bit mono with " msgstr "Nur 8 oder 16 bit mono mit " -#: ports/esp32s2/common-hal/socketpool/SocketPool.c -msgid "Only IPv4 SOCK_STREAM sockets supported" -msgstr "" - #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" +#: ports/esp32s2/common-hal/socketpool/SocketPool.c +msgid "Only IPv4 sockets supported" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" diff --git a/locale/el.po b/locale/el.po index 71f6e6102b2b8..8d6dad828e4e5 100644 --- a/locale/el.po +++ b/locale/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-11 16:30+0530\n" +"POT-Creation-Date: 2020-11-24 15:40-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -296,6 +296,7 @@ msgid "All I2C peripherals are in use" msgstr "" #: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -332,6 +333,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/neopixel_write/__init__.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c #: ports/esp32s2/common-hal/pulseio/PulseOut.c @@ -1085,6 +1087,7 @@ msgid "Invalid byteorder string" msgstr "" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "" @@ -1415,14 +1418,14 @@ msgstr "" msgid "Only 8 or 16 bit mono with " msgstr "" -#: ports/esp32s2/common-hal/socketpool/SocketPool.c -msgid "Only IPv4 SOCK_STREAM sockets supported" -msgstr "" - #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" +#: ports/esp32s2/common-hal/socketpool/SocketPool.c +msgid "Only IPv4 sockets supported" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" diff --git a/locale/es.po b/locale/es.po index db3a630c84f9d..1a02843ed7455 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-11-11 16:30+0530\n" +"POT-Creation-Date: 2020-11-24 15:40-0500\n" "PO-Revision-Date: 2020-11-26 03:11+0000\n" "Last-Translator: Daniel Bravo Darriba \n" "Language-Team: \n" @@ -304,6 +304,7 @@ msgid "All I2C peripherals are in use" msgstr "Todos los periféricos I2C están siendo usados" #: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "Todas las unidades PCNT en uso" @@ -342,6 +343,7 @@ msgstr "Todos los timers para este pin están siendo utilizados" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/neopixel_write/__init__.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c #: ports/esp32s2/common-hal/pulseio/PulseOut.c @@ -1108,6 +1110,7 @@ msgid "Invalid byteorder string" msgstr "Cadena de byteorder inválida" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "Inválido periodo de captura. Rango válido: 1 - 500" @@ -1440,14 +1443,14 @@ msgstr "Paridad impar no soportada" msgid "Only 8 or 16 bit mono with " msgstr "Solo mono de 8 ó 16 bit con " -#: ports/esp32s2/common-hal/socketpool/SocketPool.c -msgid "Only IPv4 SOCK_STREAM sockets supported" -msgstr "Solo hay capacidad para enchufes IPv4 SOCK_STREAM" - #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "Solo hay capacidad para direcciones IPv4" +#: ports/esp32s2/common-hal/socketpool/SocketPool.c +msgid "Only IPv4 sockets supported" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -1775,8 +1778,8 @@ msgid "" msgstr "" "La alimentación del microntrolador cayó. Asegúrate que tu fuente de " "alimentación\n" -"pueda aportar suficiente energía para todo el circuito y presiona reset (" -"luego de\n" +"pueda aportar suficiente energía para todo el circuito y presiona reset " +"(luego de\n" "expulsar CIRCUITPY)\n" #: shared-module/audiomixer/MixerVoice.c @@ -3827,6 +3830,9 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "Only IPv4 SOCK_STREAM sockets supported" +#~ msgstr "Solo hay capacidad para enchufes IPv4 SOCK_STREAM" + #~ msgid "arctan2 is implemented for scalars and ndarrays only" #~ msgstr "arctan2 se encuentra implementado solo para escalares y ndarrays" diff --git a/locale/fil.po b/locale/fil.po index 50067c6d4fe4c..9178623a29852 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-11 16:30+0530\n" +"POT-Creation-Date: 2020-11-24 15:40-0500\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -298,6 +298,7 @@ msgid "All I2C peripherals are in use" msgstr "Lahat ng I2C peripherals ginagamit" #: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -335,6 +336,7 @@ msgstr "Lahat ng timers para sa pin na ito ay ginagamit" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/neopixel_write/__init__.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c #: ports/esp32s2/common-hal/pulseio/PulseOut.c @@ -1100,6 +1102,7 @@ msgid "Invalid byteorder string" msgstr "" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "" @@ -1433,14 +1436,14 @@ msgstr "Odd na parity ay hindi supportado" msgid "Only 8 or 16 bit mono with " msgstr "Tanging 8 o 16 na bit mono na may " -#: ports/esp32s2/common-hal/socketpool/SocketPool.c -msgid "Only IPv4 SOCK_STREAM sockets supported" -msgstr "" - #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" +#: ports/esp32s2/common-hal/socketpool/SocketPool.c +msgid "Only IPv4 sockets supported" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" diff --git a/locale/fr.po b/locale/fr.po index 359595c723d41..bb9b6ea98d1cb 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-11 16:30+0530\n" +"POT-Creation-Date: 2020-11-24 15:40-0500\n" "PO-Revision-Date: 2020-11-24 22:45+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" @@ -305,6 +305,7 @@ msgid "All I2C peripherals are in use" msgstr "Tous les périphériques I2C sont utilisés" #: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "Toutes les unités PCNT sont utilisées" @@ -341,6 +342,7 @@ msgstr "Tous les timers pour cette broche sont utilisés" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/neopixel_write/__init__.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c #: ports/esp32s2/common-hal/pulseio/PulseOut.c @@ -1113,6 +1115,7 @@ msgid "Invalid byteorder string" msgstr "Chaîne d'octets non valide" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "Période de capture invalide. Gamme valide : 1 à 500" @@ -1445,14 +1448,14 @@ msgstr "Parité impaire non supportée" msgid "Only 8 or 16 bit mono with " msgstr "Uniquement 8 ou 16 bit mono avec " -#: ports/esp32s2/common-hal/socketpool/SocketPool.c -msgid "Only IPv4 SOCK_STREAM sockets supported" -msgstr "Seules les sockets IPv4 SOCK_STREAM sont prises en charge" - #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "Seules les adresses IPv4 sont prises en charge" +#: ports/esp32s2/common-hal/socketpool/SocketPool.c +msgid "Only IPv4 sockets supported" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -3848,6 +3851,9 @@ msgstr "zi doit être de type float" msgid "zi must be of shape (n_section, 2)" msgstr "zi doit être de forme (n_section, 2)" +#~ msgid "Only IPv4 SOCK_STREAM sockets supported" +#~ msgstr "Seules les sockets IPv4 SOCK_STREAM sont prises en charge" + #~ msgid "arctan2 is implemented for scalars and ndarrays only" #~ msgstr "" #~ "arctan2 est implémenté uniquement pour les scalaires et les ndarrays" diff --git a/locale/hi.po b/locale/hi.po index de77cec46b74e..025664069ddd9 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-11 16:30+0530\n" +"POT-Creation-Date: 2020-11-24 15:40-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -296,6 +296,7 @@ msgid "All I2C peripherals are in use" msgstr "" #: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -332,6 +333,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/neopixel_write/__init__.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c #: ports/esp32s2/common-hal/pulseio/PulseOut.c @@ -1085,6 +1087,7 @@ msgid "Invalid byteorder string" msgstr "" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "" @@ -1415,14 +1418,14 @@ msgstr "" msgid "Only 8 or 16 bit mono with " msgstr "" -#: ports/esp32s2/common-hal/socketpool/SocketPool.c -msgid "Only IPv4 SOCK_STREAM sockets supported" -msgstr "" - #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" +#: ports/esp32s2/common-hal/socketpool/SocketPool.c +msgid "Only IPv4 sockets supported" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 15c83cd53af9d..bb77d71cc353a 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-11 16:30+0530\n" +"POT-Creation-Date: 2020-11-24 15:40-0500\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -297,6 +297,7 @@ msgid "All I2C peripherals are in use" msgstr "Tutte le periferiche I2C sono in uso" #: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -334,6 +335,7 @@ msgstr "Tutti i timer per questo pin sono in uso" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/neopixel_write/__init__.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c #: ports/esp32s2/common-hal/pulseio/PulseOut.c @@ -1101,6 +1103,7 @@ msgid "Invalid byteorder string" msgstr "" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "periodo di cattura invalido. Zona valida: 1 - 500" @@ -1438,14 +1441,14 @@ msgstr "operazione I2C non supportata" msgid "Only 8 or 16 bit mono with " msgstr "" -#: ports/esp32s2/common-hal/socketpool/SocketPool.c -msgid "Only IPv4 SOCK_STREAM sockets supported" -msgstr "" - #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" +#: ports/esp32s2/common-hal/socketpool/SocketPool.c +msgid "Only IPv4 sockets supported" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" diff --git a/locale/ja.po b/locale/ja.po index d0322be773c53..2076bbabfdc55 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-11 16:30+0530\n" +"POT-Creation-Date: 2020-11-24 15:40-0500\n" "PO-Revision-Date: 2020-11-25 01:11+0000\n" "Last-Translator: Mitsuharu Aoyama \n" "Language-Team: none\n" @@ -303,6 +303,7 @@ msgid "All I2C peripherals are in use" msgstr "全てのI2C周辺機器が使用中" #: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -339,6 +340,7 @@ msgstr "このピン用の全てのタイマが使用中" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/neopixel_write/__init__.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c #: ports/esp32s2/common-hal/pulseio/PulseOut.c @@ -1100,6 +1102,7 @@ msgid "Invalid byteorder string" msgstr "不正なバイトオーダー文字列" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "不正なキャプチャ周期。有効な周期は1-500" @@ -1432,14 +1435,14 @@ msgstr "奇数パリティには対応していません" msgid "Only 8 or 16 bit mono with " msgstr "8または16ビットの " -#: ports/esp32s2/common-hal/socketpool/SocketPool.c -msgid "Only IPv4 SOCK_STREAM sockets supported" -msgstr "" - #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" +#: ports/esp32s2/common-hal/socketpool/SocketPool.c +msgid "Only IPv4 sockets supported" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" diff --git a/locale/ko.po b/locale/ko.po index fc08bdeaaceed..9e6cbb0c2a9c1 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-11 16:30+0530\n" +"POT-Creation-Date: 2020-11-24 15:40-0500\n" "PO-Revision-Date: 2020-10-05 12:12+0000\n" "Last-Translator: Michal Čihař \n" "Language-Team: LANGUAGE \n" @@ -299,6 +299,7 @@ msgid "All I2C peripherals are in use" msgstr "사용중인 모든 I2C주변 기기" #: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -335,6 +336,7 @@ msgstr "핀의 모든 타이머가 사용 중입니다" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/neopixel_write/__init__.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c #: ports/esp32s2/common-hal/pulseio/PulseOut.c @@ -1090,6 +1092,7 @@ msgid "Invalid byteorder string" msgstr "" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "" @@ -1420,14 +1423,14 @@ msgstr "" msgid "Only 8 or 16 bit mono with " msgstr "" -#: ports/esp32s2/common-hal/socketpool/SocketPool.c -msgid "Only IPv4 SOCK_STREAM sockets supported" -msgstr "" - #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" +#: ports/esp32s2/common-hal/socketpool/SocketPool.c +msgid "Only IPv4 sockets supported" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" diff --git a/locale/nl.po b/locale/nl.po index ee7a3fd545ce0..41a3ace76bd00 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-11 16:30+0530\n" +"POT-Creation-Date: 2020-11-24 15:40-0500\n" "PO-Revision-Date: 2020-10-27 16:47+0000\n" "Last-Translator: Jelle Jager \n" "Language-Team: none\n" @@ -301,6 +301,7 @@ msgid "All I2C peripherals are in use" msgstr "Alle I2C peripherals zijn in gebruik" #: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -337,6 +338,7 @@ msgstr "Alle timers voor deze pin zijn in gebruik" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/neopixel_write/__init__.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c #: ports/esp32s2/common-hal/pulseio/PulseOut.c @@ -1102,6 +1104,7 @@ msgid "Invalid byteorder string" msgstr "Ongeldige byteorder string" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "Ongeldige vastlegging periode. Geldig bereik: 1 - 500" @@ -1434,14 +1437,14 @@ msgstr "Oneven pariteit is niet ondersteund" msgid "Only 8 or 16 bit mono with " msgstr "Alleen 8 of 16 bit mono met " -#: ports/esp32s2/common-hal/socketpool/SocketPool.c -msgid "Only IPv4 SOCK_STREAM sockets supported" -msgstr "Alleen IPv4 SOCK_STREAM sockets worden ondersteund" - #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "Alleen IPv4 adressen worden ondersteund" +#: ports/esp32s2/common-hal/socketpool/SocketPool.c +msgid "Only IPv4 sockets supported" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -3814,6 +3817,9 @@ msgstr "zi moet van type float zijn" msgid "zi must be of shape (n_section, 2)" msgstr "zi moet vorm (n_section, 2) hebben" +#~ msgid "Only IPv4 SOCK_STREAM sockets supported" +#~ msgstr "Alleen IPv4 SOCK_STREAM sockets worden ondersteund" + #~ msgid "arctan2 is implemented for scalars and ndarrays only" #~ msgstr "arctan2 is alleen geïmplementeerd voor scalars en ndarrays" diff --git a/locale/pl.po b/locale/pl.po index 4d8c9d84cc60b..5fbe727efada0 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-11 16:30+0530\n" +"POT-Creation-Date: 2020-11-24 15:40-0500\n" "PO-Revision-Date: 2020-11-11 19:13+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" @@ -303,6 +303,7 @@ msgid "All I2C peripherals are in use" msgstr "Wszystkie peryferia I2C w użyciu" #: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -339,6 +340,7 @@ msgstr "Wszystkie timery tej nóżki w użyciu" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/neopixel_write/__init__.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c #: ports/esp32s2/common-hal/pulseio/PulseOut.c @@ -1100,6 +1102,7 @@ msgid "Invalid byteorder string" msgstr "" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "Zły okres. Poprawny zakres to: 1 - 500" @@ -1431,14 +1434,14 @@ msgstr "Nieparzysta parzystość nie jest wspierana" msgid "Only 8 or 16 bit mono with " msgstr "Tylko 8 lub 16 bitów mono z " -#: ports/esp32s2/common-hal/socketpool/SocketPool.c -msgid "Only IPv4 SOCK_STREAM sockets supported" -msgstr "" - #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" +#: ports/esp32s2/common-hal/socketpool/SocketPool.c +msgid "Only IPv4 sockets supported" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 49ac502e29b1a..8f899a12c46b4 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-11 16:30+0530\n" +"POT-Creation-Date: 2020-11-24 15:40-0500\n" "PO-Revision-Date: 2020-11-24 23:22+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -305,6 +305,7 @@ msgid "All I2C peripherals are in use" msgstr "Todos os periféricos I2C estão em uso" #: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "Todas as unidades PCNT estão em uso" @@ -341,6 +342,7 @@ msgstr "Todos os temporizadores para este pino estão em uso" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/neopixel_write/__init__.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c #: ports/esp32s2/common-hal/pulseio/PulseOut.c @@ -1111,6 +1113,7 @@ msgid "Invalid byteorder string" msgstr "A cadeia de bytes é inválida" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "O período de captura é inválido. O intervalo válido é: 1 - 500" @@ -1442,14 +1445,14 @@ msgstr "A paridade ímpar não é compatível" msgid "Only 8 or 16 bit mono with " msgstr "Apenas mono com 8 ou 16 bits com " -#: ports/esp32s2/common-hal/socketpool/SocketPool.c -msgid "Only IPv4 SOCK_STREAM sockets supported" -msgstr "São suportados apenas soquetes IPv4 SOCK_STREAM" - #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "Somente os endereços IPv4 são suportados" +#: ports/esp32s2/common-hal/socketpool/SocketPool.c +msgid "Only IPv4 sockets supported" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -3839,6 +3842,9 @@ msgstr "zi deve ser de um tipo float" msgid "zi must be of shape (n_section, 2)" msgstr "zi deve estar na forma (n_section, 2)" +#~ msgid "Only IPv4 SOCK_STREAM sockets supported" +#~ msgstr "São suportados apenas soquetes IPv4 SOCK_STREAM" + #~ msgid "arctan2 is implemented for scalars and ndarrays only" #~ msgstr "O arctan2 está implementado apenas para escalares e ndarrays" diff --git a/locale/sv.po b/locale/sv.po index db05a557aeaa4..66c1f345a2329 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-11 16:30+0530\n" +"POT-Creation-Date: 2020-11-24 15:40-0500\n" "PO-Revision-Date: 2020-11-20 22:28+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -301,6 +301,7 @@ msgid "All I2C peripherals are in use" msgstr "All I2C-kringutrustning används" #: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "Alla PCNT-enheter används" @@ -337,6 +338,7 @@ msgstr "Alla timers för denna pinne är i bruk" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/neopixel_write/__init__.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c #: ports/esp32s2/common-hal/pulseio/PulseOut.c @@ -1100,6 +1102,7 @@ msgid "Invalid byteorder string" msgstr "Ogiltig byteorder-sträng" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "Ogiltig inspelningsperiod. Giltigt intervall: 1 - 500" @@ -1433,14 +1436,14 @@ msgstr "Udda paritet stöds inte" msgid "Only 8 or 16 bit mono with " msgstr "Endast 8 eller 16 bitars mono med " -#: ports/esp32s2/common-hal/socketpool/SocketPool.c -msgid "Only IPv4 SOCK_STREAM sockets supported" -msgstr "Endast IPv4 SOCK_STREAM sockets stöds" - #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "Endast IPv4-adresser stöds" +#: ports/esp32s2/common-hal/socketpool/SocketPool.c +msgid "Only IPv4 sockets supported" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -3807,6 +3810,9 @@ msgstr "zi måste vara av typ float" msgid "zi must be of shape (n_section, 2)" msgstr "zi måste vara i formen (n_section, 2)" +#~ msgid "Only IPv4 SOCK_STREAM sockets supported" +#~ msgstr "Endast IPv4 SOCK_STREAM sockets stöds" + #~ msgid "arctan2 is implemented for scalars and ndarrays only" #~ msgstr "arctan2 är enbart implementerad för scalar och ndarray" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 2f0673a7d0526..7a08bc6e8c1e8 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-11 16:30+0530\n" +"POT-Creation-Date: 2020-11-24 15:40-0500\n" "PO-Revision-Date: 2020-11-19 01:28+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -303,6 +303,7 @@ msgid "All I2C peripherals are in use" msgstr "Suǒyǒu I2C wàiwéi qì zhèngzài shǐyòng" #: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "suǒ yǒu zhèng zài shǐ yòng zhōng de PCNT dān yuán" @@ -339,6 +340,7 @@ msgstr "Cǐ yǐn jiǎo de suǒyǒu jìshí qì zhèngzài shǐyòng" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/neopixel_write/__init__.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c #: ports/esp32s2/common-hal/pulseio/PulseOut.c @@ -1098,6 +1100,7 @@ msgid "Invalid byteorder string" msgstr "Wúxiào de zì jié shùnxù zìfú chuàn" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "Wúxiào de bǔhuò zhōuqí. Yǒuxiào fànwéi: 1-500" @@ -1429,14 +1432,14 @@ msgstr "Bù zhīchí jīshù" msgid "Only 8 or 16 bit mono with " msgstr "Zhǐyǒu 8 huò 16 wèi dānwèi " -#: ports/esp32s2/common-hal/socketpool/SocketPool.c -msgid "Only IPv4 SOCK_STREAM sockets supported" -msgstr "Jǐn zhīchí IPv4 SOCK_STREAM tào jiē zì" - #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "Jǐn zhīchí IPv4 dìzhǐ" +#: ports/esp32s2/common-hal/socketpool/SocketPool.c +msgid "Only IPv4 sockets supported" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -3796,6 +3799,9 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "Only IPv4 SOCK_STREAM sockets supported" +#~ msgstr "Jǐn zhīchí IPv4 SOCK_STREAM tào jiē zì" + #~ msgid "arctan2 is implemented for scalars and ndarrays only" #~ msgstr "arctan2 jǐn zhēnduì biāoliàng hé ndarray shíxiàn" From 6af48bb24cc12a9547aef8d18d56acf8e0f5695d Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 26 Nov 2020 11:22:44 +0530 Subject: [PATCH 299/770] reset touchin on every vm run --- ports/esp32s2/common-hal/touchio/TouchIn.c | 8 +++++++- ports/esp32s2/supervisor/port.c | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/common-hal/touchio/TouchIn.c b/ports/esp32s2/common-hal/touchio/TouchIn.c index 4589c46a79bb1..b27cbcf86d67a 100644 --- a/ports/esp32s2/common-hal/touchio/TouchIn.c +++ b/ports/esp32s2/common-hal/touchio/TouchIn.c @@ -31,6 +31,13 @@ bool touch_inited = false; +void touchin_reset(void) { + if (touch_inited) { + touch_pad_deinit(); + touch_inited = false; + } +} + static uint16_t get_raw_reading(touchio_touchin_obj_t *self) { uint32_t touch_value; touch_pad_read_raw_data((touch_pad_t)self->pin->touch_channel, &touch_value); @@ -78,7 +85,6 @@ void common_hal_touchio_touchin_deinit(touchio_touchin_obj_t* self) { if (common_hal_touchio_touchin_deinited(self)) { return; } - touch_pad_deinit(); reset_pin_number(self->pin->touch_channel); self->pin = NULL; } diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 876ad739d6937..e2defc5af3903 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -43,6 +43,7 @@ #include "common-hal/busio/UART.h" #include "common-hal/pulseio/PulseIn.h" #include "common-hal/pwmio/PWMOut.h" +#include "common-hal/touchio/TouchIn.h" #include "common-hal/watchdog/WatchDogTimer.h" #include "common-hal/wifi/__init__.h" #include "supervisor/memory.h" @@ -127,6 +128,10 @@ void reset_port(void) { rtc_reset(); #endif +#if CIRCUITPY_TOUCHIO_USE_NATIVE + touchin_reset(); +#endif + #if CIRCUITPY_WATCHDOG watchdog_reset(); #endif From 104a089677d62de3554deea7850796dfbb29b1fc Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 26 Nov 2020 22:06:37 -0500 Subject: [PATCH 300/770] deep sleep working; deep sleep delay when connected --- main.c | 82 +++---------------- .../common-hal/microcontroller/__init__.c | 4 - .../common-hal/microcontroller/__init__.c | 4 - ports/esp32s2/common-hal/alarm/__init__.c | 54 ++++++------ .../common-hal/microcontroller/__init__.c | 6 -- .../common-hal/microcontroller/__init__.c | 4 - .../common-hal/microcontroller/__init__.c | 4 - .../nrf/common-hal/microcontroller/__init__.c | 4 - .../stm/common-hal/microcontroller/__init__.c | 4 - shared-bindings/_typing/__init__.pyi | 4 +- shared-bindings/alarm/__init__.c | 43 ++++++++-- shared-bindings/alarm/__init__.h | 3 +- shared-bindings/alarm/pin/PinAlarm.c | 2 +- shared-bindings/alarm/time/TimeAlarm.c | 78 ++++++++++++++---- shared-bindings/microcontroller/__init__.h | 2 - 15 files changed, 143 insertions(+), 155 deletions(-) diff --git a/main.c b/main.c index a9dbb1b7c344a..dda439d6de51b 100755 --- a/main.c +++ b/main.c @@ -66,9 +66,6 @@ #include "boards/board.h" -// REMOVE *********** -#include "esp_log.h" - #if CIRCUITPY_ALARM #include "shared-bindings/alarm/__init__.h" #endif @@ -98,12 +95,6 @@ #include "common-hal/canio/CAN.h" #endif -// How long to wait for host to start connecting.. -#define CIRCUITPY_USB_CONNECTING_DELAY 1 - -// How long to flash errors on the RGB status LED before going to sleep (secs) -#define CIRCUITPY_FLASH_ERROR_PERIOD 10 - #if MICROPY_ENABLE_PYSTACK static size_t PLACE_IN_DTCM_BSS(_pystack[CIRCUITPY_PYSTACK_SIZE / sizeof(size_t)]); #endif @@ -259,17 +250,6 @@ STATIC void print_code_py_status_message(safe_mode_t safe_mode) { } } -// Should we go into deep sleep when program finishes? -// Normally we won't deep sleep if there was an error or if we are connected to a host -// but either of those can be enabled. -// It's ok to deep sleep if we're not connected to a host, but we need to make sure -// we're giving enough time for USB to start to connect -STATIC bool deep_sleep_allowed(void) { - return - (ok || supervisor_workflow_get_allow_deep_sleep_on_error()) && - !supervisor_workflow_connecting() - (supervisor_ticks_ms64() > CIRCUITPY_USB_CONNECTING_DELAY * 1024); - STATIC bool run_code_py(safe_mode_t safe_mode) { bool serial_connected_at_start = serial_connected(); #if CIRCUITPY_AUTORELOAD_DELAY_MS > 0 @@ -290,10 +270,12 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { if (safe_mode == NO_SAFE_MODE) { new_status_color(MAIN_RUNNING); - static const char * const supported_filenames[] = STRING_LIST("code.txt", "code.py", "main.py", "main.txt"); + static const char * const supported_filenames[] = STRING_LIST( + "code.txt", "code.py", "main.py", "main.txt"); #if CIRCUITPY_FULL_BUILD - static const char * const double_extension_filenames[] = STRING_LIST("code.txt.py", "code.py.txt", "code.txt.txt","code.py.py", - "main.txt.py", "main.py.txt", "main.txt.txt","main.py.py"); + static const char * const double_extension_filenames[] = STRING_LIST( + "code.txt.py", "code.py.txt", "code.txt.txt","code.py.py", + "main.txt.py", "main.py.txt", "main.txt.txt","main.py.py"); #endif stack_resize(); @@ -319,7 +301,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { // Program has finished running. // Display a different completion message if the user has no USB attached (cannot save files) - if (!serial_connected_at_start && !deep_sleep_allowed()) { + if (!serial_connected_at_start) { serial_write_compressed(translate("\nCode done running. Waiting for reload.\n")); } @@ -327,16 +309,8 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { #if CIRCUITPY_DISPLAYIO bool refreshed_epaper_display = false; #endif - rgb_status_animation_t animation; - bool ok = result.return_code != PYEXEC_EXCEPTION; - - #if CIRCUITPY_ALARM - // Enable pin or time alarms before sleeping. - // If immediate_wake is true, then there's an alarm that would trigger immediately, - // so don't sleep. - bool immediate_wake = !common_hal_alarm_enable_deep_sleep_alarms(); - #endif + rgb_status_animation_t animation; prep_rgb_status_animation(&result, found_main, safe_mode, &animation); while (true) { @@ -360,12 +334,10 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { if (!serial_connected_at_start) { print_code_py_status_message(safe_mode); } - // We won't be going into the REPL if we're going to sleep. - if (!deep_sleep_allowed()) { - print_safe_mode_message(safe_mode); - serial_write("\n"); - serial_write_compressed(translate("Press any key to enter the REPL. Use CTRL-D to reload.")); - } + + print_safe_mode_message(safe_mode); + serial_write("\n"); + serial_write_compressed(translate("Press any key to enter the REPL. Use CTRL-D to reload.")); } if (serial_connected_before_animation && !serial_connected()) { serial_connected_at_start = false; @@ -379,37 +351,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { } #endif - bool animation_done = false; - - if (deep_sleep_allowed() && ok) { - // Skip animation if everything is OK. - animation_done = true; - } else { - animation_done = tick_rgb_status_animation(&animation); - } - // Do an error animation only once before deep-sleeping. - if (animation_done) { - if (immediate_wake) { - // Don't sleep, we are already supposed to wake up. - return true; - } - if (deep_sleep_allowed()) { - common_hal_mcu_deep_sleep(); - // Does not return. - } - - // Wake up every so often to flash the error code. - if (!ok) { - port_interrupt_after_ticks(CIRCUITPY_FLASH_ERROR_PERIOD * 1024); - } else { - int64_t remaining_connecting_wait = - CIRCUITPY_USB_CONNECTING_DELAY * 1024 - supervisor_ticks_ms64(); - if (remaining_connecting_wait > 0) { - port_interrupt_after_ticks(remaining_connecting_wait); - } - port_sleep_until_interrupt(); - } - } + tick_rgb_status_animation(&animation); } } diff --git a/ports/atmel-samd/common-hal/microcontroller/__init__.c b/ports/atmel-samd/common-hal/microcontroller/__init__.c index ca39f28386cdd..50a1ec038e931 100644 --- a/ports/atmel-samd/common-hal/microcontroller/__init__.c +++ b/ports/atmel-samd/common-hal/microcontroller/__init__.c @@ -84,10 +84,6 @@ void common_hal_mcu_reset(void) { reset(); } -void common_hal_mcu_deep_sleep(void) { - //deep sleep call here -} - // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/ports/cxd56/common-hal/microcontroller/__init__.c b/ports/cxd56/common-hal/microcontroller/__init__.c index 57140dec7041f..7aa3b839d7801 100644 --- a/ports/cxd56/common-hal/microcontroller/__init__.c +++ b/ports/cxd56/common-hal/microcontroller/__init__.c @@ -81,10 +81,6 @@ void common_hal_mcu_reset(void) { boardctl(BOARDIOC_RESET, 0); } -void common_hal_mcu_deep_sleep(void) { - //deep sleep call here -} - STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_UART2_RXD), MP_ROM_PTR(&pin_UART2_RXD) }, { MP_ROM_QSTR(MP_QSTR_UART2_TXD), MP_ROM_PTR(&pin_UART2_TXD) }, diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index 7cf74a0efcd06..767b0de70ef41 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -1,4 +1,4 @@ -/* + /* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) @@ -77,12 +77,10 @@ mp_obj_t common_hal_alarm_get_wake_alarm(void) { return mp_const_none; } -mp_obj_t common_hal_alarm_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms) { - mp_raise_NotImplementedError(NULL); -} - -void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms) { +STATIC void setup_alarms(size_t n_alarms, const mp_obj_t *alarms) { bool time_alarm_set = false; + alarm_time_time_alarm_obj_t *time_alarm = MP_OBJ_NULL; + for (size_t i = 0; i < n_alarms; i++) { if (MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pin_alarm_type)) { mp_raise_NotImplementedError(translate("PinAlarm deep sleep not yet implemented")); @@ -91,32 +89,32 @@ void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *ala if (time_alarm_set) { mp_raise_ValueError(translate("Only one alarm.time alarm can be set.")); } + time_alarm = MP_OBJ_TO_PTR(alarms[i]); time_alarm_set = true; } } - _deep_sleep_alarms = mp_obj_new_tuple(n_alarms, alarms); + if (time_alarm != MP_OBJ_NULL) { + // Compute how long to actually sleep, considering the time now. + mp_float_t now_secs = uint64_to_float(common_hal_time_monotonic_ms()) / 1000.0f; + mp_float_t wakeup_in_secs = MAX(0.0f, time_alarm->monotonic_time - now_secs); + esp_sleep_enable_timer_wakeup((uint64_t) (wakeup_in_secs * 1000000)); + } } -// Return false if we should wake up immediately because a time alarm is in the past -// or otherwise already triggered. -bool common_hal_alarm_enable_deep_sleep_alarms(void) { - for (size_t i = 0; i < _deep_sleep_alarms->len; i++) { - mp_obj_t alarm = _deep_sleep_alarms->items[i]; - if (MP_OBJ_IS_TYPE(alarm, &alarm_pin_pin_alarm_type)) { - // TODO: handle pin alarms - mp_raise_NotImplementedError(translate("PinAlarm deep sleep not yet implemented")); - } - else if (MP_OBJ_IS_TYPE(alarm, &alarm_time_time_alarm_type)) { - alarm_time_time_alarm_obj_t *time_alarm = MP_OBJ_TO_PTR(alarm); - mp_float_t now_secs = uint64_to_float(common_hal_time_monotonic_ms()) / 1000.0f; - // Compute how long to actually sleep, considering hte time now. - mp_float_t wakeup_in_secs = time_alarm->monotonic_time - now_secs; - if (wakeup_in_secs <= 0.0f) { - return false; - } - esp_sleep_enable_timer_wakeup((uint64_t) (wakeup_in_secs * 1000000)); - } - } - return true; +mp_obj_t common_hal_alarm_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms) { + setup_alarms(n_alarms, alarms); + + // Shut down wifi cleanly. + esp_wifi_stop(); + esp_light_sleep_start(); + return common_hal_alarm_get_wake_alarm(); +} + +void common_hal_alarm_exit_and_deep_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms) { + setup_alarms(n_alarms, alarms); + + // Shut down wifi cleanly. + esp_wifi_stop(); + esp_deep_sleep_start(); } diff --git a/ports/esp32s2/common-hal/microcontroller/__init__.c b/ports/esp32s2/common-hal/microcontroller/__init__.c index 3578b86d02233..184f5be69676d 100644 --- a/ports/esp32s2/common-hal/microcontroller/__init__.c +++ b/ports/esp32s2/common-hal/microcontroller/__init__.c @@ -81,12 +81,6 @@ void common_hal_mcu_reset(void) { while(1); } -void NORETURN common_hal_mcu_deep_sleep(void) { - // Shut down wifi cleanly. - esp_wifi_stop(); - esp_deep_sleep_start(); -} - // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/ports/litex/common-hal/microcontroller/__init__.c b/ports/litex/common-hal/microcontroller/__init__.c index e6f50ed5a6abe..3c91661144b81 100644 --- a/ports/litex/common-hal/microcontroller/__init__.c +++ b/ports/litex/common-hal/microcontroller/__init__.c @@ -89,10 +89,6 @@ void common_hal_mcu_reset(void) { while(1); } -void common_hal_mcu_deep_sleep(void) { - //deep sleep call here -} - // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/ports/mimxrt10xx/common-hal/microcontroller/__init__.c b/ports/mimxrt10xx/common-hal/microcontroller/__init__.c index 0329ced69b5d9..6a8537e2da17b 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/__init__.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/__init__.c @@ -86,10 +86,6 @@ void common_hal_mcu_reset(void) { NVIC_SystemReset(); } -void common_hal_mcu_deep_sleep(void) { - //deep sleep call here -} - // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/ports/nrf/common-hal/microcontroller/__init__.c b/ports/nrf/common-hal/microcontroller/__init__.c index 9911896bff751..06aac9409dc1f 100644 --- a/ports/nrf/common-hal/microcontroller/__init__.c +++ b/ports/nrf/common-hal/microcontroller/__init__.c @@ -95,10 +95,6 @@ void common_hal_mcu_reset(void) { reset_cpu(); } -void common_hal_mcu_deep_sleep(void) { - //deep sleep call here -} - // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/ports/stm/common-hal/microcontroller/__init__.c b/ports/stm/common-hal/microcontroller/__init__.c index bc81b0e4f5e90..a827399ccb05f 100644 --- a/ports/stm/common-hal/microcontroller/__init__.c +++ b/ports/stm/common-hal/microcontroller/__init__.c @@ -81,10 +81,6 @@ void common_hal_mcu_reset(void) { NVIC_SystemReset(); } -void common_hal_mcu_deep_sleep(void) { - //deep sleep call here -} - // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. const mcu_processor_obj_t common_hal_mcu_processor_obj = { diff --git a/shared-bindings/_typing/__init__.pyi b/shared-bindings/_typing/__init__.pyi index 02839ab4773f8..2716936860a3c 100644 --- a/shared-bindings/_typing/__init__.pyi +++ b/shared-bindings/_typing/__init__.pyi @@ -54,12 +54,12 @@ FrameBuffer = Union[rgbmatrix.RGBMatrix] """ Alarm = Union[ - alarm.pin.PinAlarm, alarm.time.DurationAlarm + alarm.pin.PinAlarm, alarm.time.TimeAlarm ] """Classes that implement alarms for sleeping and asynchronous notification. - `alarm.pin.PinAlarm` - - `alarm.time.DurationAlarm` + - `alarm.time.TimeAlarm` You can use these alarms to wake from light or deep sleep. """ diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 4aa6c8457d122..4c2189c0d041e 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -30,6 +30,15 @@ #include "shared-bindings/alarm/__init__.h" #include "shared-bindings/alarm/pin/PinAlarm.h" #include "shared-bindings/alarm/time/TimeAlarm.h" +#include "shared-bindings/time/__init__.h" +#include "supervisor/shared/rgb_led_status.h" +#include "supervisor/shared/workflow.h" + +// Wait this long to see if USB is being connected (enumeration starting). +#define CIRCUITPY_USB_CONNECTING_DELAY 1 +// Wait this long before going into deep sleep if connected. This +// allows the user to ctrl-C before deep sleep starts. +#define CIRCUITPY_USB_CONNECTED_DEEP_SLEEP_DELAY 5 //| """Power-saving light and deep sleep. Alarms can be set to wake up from sleep. //| @@ -44,16 +53,12 @@ //| Deep sleep shuts down power to nearly all of the chip including the CPU and RAM. This can save //| a more significant amount of power, but CircuitPython must start ``code.py`` from the beginning when //| awakened. +//| """ -//| -//| An error includes an uncaught exception, or sys.exit() called with a non-zero argument -//| -//| To set alarms for deep sleep use `alarm.set_deep_sleep_alarms()` they will apply to next deep sleep only.""" //| //| wake_alarm: Alarm //| """The most recent alarm to wake us up from a sleep (light or deep.)""" //| - void validate_objs_are_alarms(size_t n_args, const mp_obj_t *objs) { for (size_t i = 0; i < n_args; i++) { if (MP_OBJ_IS_TYPE(objs[i], &alarm_pin_pin_alarm_type) || @@ -88,12 +93,38 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_sleep_until_alarms_obj, 1, MP_OBJ_FUN_ //| For time-base alarms, currently, an `alarm.time.TimeAlarm()` is created. //| //| If no alarms are specified, the microcontroller will deep sleep until reset. +//| +//| If CircuitPython is unconnected to a host computer, go into deep sleep immediately. +//| But if it already connected or in the process of connecting to a host computer, wait at least +//| five seconds after starting code.py before entering deep sleep. +//| This allows interrupting a program that would otherwise go into deep sleep too quickly +//| to interrupt from the keyboard. //| """ //| ... //| STATIC mp_obj_t alarm_exit_and_deep_sleep_until_alarms(size_t n_args, const mp_obj_t *args) { validate_objs_are_alarms(n_args, args); - common_hal_exit_and_deep_sleep_until_alarms(n_args, args); + + int64_t connecting_delay_msec = CIRCUITPY_USB_CONNECTING_DELAY * 1024 - supervisor_ticks_ms64(); + if (connecting_delay_msec > 0) { + common_hal_time_delay_ms(connecting_delay_msec * 1000 / 1024); + } + + // If connected, wait for the program to be running at least as long as + // CIRCUITPY_USB_CONNECTED_DEEP_SLEEP_DELAY. This allows a user to ctrl-C the running + // program in case it is in a tight deep sleep loop that would otherwise be difficult + // or impossible to interrupt. + // Indicate that we're delaying with the SAFE_MODE color. + int64_t delay_before_sleeping_msec = + supervisor_ticks_ms64() - CIRCUITPY_USB_CONNECTED_DEEP_SLEEP_DELAY * 1000; + if (supervisor_workflow_connecting() && delay_before_sleeping_msec > 0) { + temp_status_color(SAFE_MODE); + common_hal_time_delay_ms(delay_before_sleeping_msec); + clear_temp_status(); + } + + common_hal_alarm_exit_and_deep_sleep_until_alarms(n_args, args); + // Does not return. return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_exit_and_deep_sleep_until_alarms_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_exit_and_deep_sleep_until_alarms); diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h index 0f084c78e8fec..968136345ccbc 100644 --- a/shared-bindings/alarm/__init__.h +++ b/shared-bindings/alarm/__init__.h @@ -32,8 +32,7 @@ #include "common-hal/alarm/__init__.h" extern mp_obj_t common_hal_alarm_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms); -extern bool common_hal_alarm_enable_deep_sleep_alarms(void); -extern void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms); +extern void common_hal_alarm_exit_and_deep_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms); // Used by wake-up code. extern void common_hal_alarm_set_wake_alarm(mp_obj_t alarm); diff --git a/shared-bindings/alarm/pin/PinAlarm.c b/shared-bindings/alarm/pin/PinAlarm.c index ff7b19ca1fd4f..fadd1b0d4a4a0 100644 --- a/shared-bindings/alarm/pin/PinAlarm.c +++ b/shared-bindings/alarm/pin/PinAlarm.c @@ -41,7 +41,7 @@ //| def __init__(self, *pins: microcontroller.Pin, value: bool, all_same_value: bool = False, edge: bool = False, pull: bool = False) -> None: //| """Create an alarm triggered by a `microcontroller.Pin` level. The alarm is not active //| until it is passed to an `alarm`-enabling function, such as `alarm.sleep_until_alarms()` or -//| `alarm.set_deep_sleep_alarms()`. +//| `alarm.exit_and_deep_sleep_until_alarms()`. //| //| :param microcontroller.Pin \*pins: The pins to monitor. On some ports, the choice of pins //| may be limited due to hardware restrictions, particularly for deep-sleep alarms. diff --git a/shared-bindings/alarm/time/TimeAlarm.c b/shared-bindings/alarm/time/TimeAlarm.c index 864ece284e01d..6339b850c61a5 100644 --- a/shared-bindings/alarm/time/TimeAlarm.c +++ b/shared-bindings/alarm/time/TimeAlarm.c @@ -24,25 +24,32 @@ * THE SOFTWARE. */ -#include "shared-bindings/board/__init__.h" -#include "shared-bindings/microcontroller/__init__.h" -#include "shared-bindings/alarm/time/TimeAlarm.h" - #include "py/nlr.h" #include "py/obj.h" #include "py/objproperty.h" #include "py/runtime.h" + +#include "shared-bindings/time/__init__.h" +#include "shared-bindings/alarm/time/TimeAlarm.h" + #include "supervisor/shared/translate.h" +#if MICROPY_LONGINT_IMPL != MICROPY_LONGINT_IMPL_NONE +mp_obj_t MP_WEAK rtc_get_time_source_time(void) { + mp_raise_RuntimeError(translate("RTC is not supported on this board")); +} +#endif + //| class TimeAlarm: -//| """Trigger an alarm when `time.monotonic()` reaches the given value.""" +//| """Trigger an alarm when the specified time is reached.""" //| -//| def __init__(self, monotonic_time: float) -> None: +//| def __init__(self, monotonic_time: Optional[Float] = None, epoch_time: Optional[int] = None) -> None: //| """Create an alarm that will be triggered when `time.monotonic()` would equal -//| ``monotonic_time``. +//| ``monotonic_time``, or when `time.time()` would equal ``epoch_time``. +//| Only one of the two arguments can be given. //| The alarm is not active until it is passed to an //| `alarm`-enabling function, such as `alarm.sleep_until_alarms()` or -//| `alarm.set_deep_sleep_alarms()`. +//| `alarm.exit_and_deep_sleep_until_alarms()`. //| //| If the given time is in the past when sleep occurs, the alarm will be triggered //| immediately. @@ -50,21 +57,64 @@ //| ... //| STATIC mp_obj_t alarm_time_time_alarm_make_new(const mp_obj_type_t *type, - mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kw_args) { - mp_arg_check_num(n_args, kw_args, 1, 1, false); - + mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { alarm_time_time_alarm_obj_t *self = m_new_obj(alarm_time_time_alarm_obj_t); self->base.type = &alarm_time_time_alarm_type; - mp_float_t secs = mp_obj_get_float(args[0]); + enum { ARG_monotonic_time, ARG_epoch_time }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_monotonic_time, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, + { MP_QSTR_epoch_time, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + bool have_monotonic = args[ARG_monotonic_time].u_obj != mp_const_none; + bool have_epoch = args[ARG_epoch_time].u_obj != mp_const_none; + + if (!(have_monotonic ^ have_epoch)) { + mp_raise_ValueError(translate("Supply one of monotonic_time or epoch_time")); + } + + mp_float_t monotonic_time = 0; // To avoid compiler warning. + if (have_monotonic) { + monotonic_time = mp_obj_get_float(args[ARG_monotonic_time].u_obj); + } + + mp_float_t monotonic_time_now = common_hal_time_monotonic_ms() / 1000.0; + + if (have_epoch) { +#if MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_NONE + mp_raise_ValueError(translate("epoch_time not supported on this board")); +#else + mp_uint_t epoch_time_secs = mp_obj_int_get_checked(args[ARG_epoch_time].u_obj); + + timeutils_struct_time_t tm; + struct_time_to_tm(rtc_get_time_source_time(), &tm); + mp_uint_t epoch_secs_now = timeutils_seconds_since_epoch(tm.tm_year, tm.tm_mon, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec); + // How far in the future (in secs) is the requested time? + mp_int_t epoch_diff = epoch_time_secs - epoch_secs_now; + // Convert it to a future monotonic time. + monotonic_time = monotonic_time_now + epoch_diff; +#endif + } + + if (monotonic_time < monotonic_time_now) { + mp_raise_ValueError(translate("Time is in the past.")); + } - common_hal_alarm_time_time_alarm_construct(self, secs); + common_hal_alarm_time_time_alarm_construct(self, monotonic_time); return MP_OBJ_FROM_PTR(self); } //| monotonic_time: float -//| """The time at which to trigger, based on the `time.monotonic()` clock.""" +//| """When this time is reached, the alarm will trigger, based on the `time.monotonic()` clock. +//| The time may be given as ``epoch_time`` in the constructor, but it is returned +//| by this property only as a `time.monotonic()` time. +//| """ //| STATIC mp_obj_t alarm_time_time_alarm_obj_get_monotonic_time(mp_obj_t self_in) { alarm_time_time_alarm_obj_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/microcontroller/__init__.h b/shared-bindings/microcontroller/__init__.h index 87284fc2e55fa..ac71de4247f2a 100644 --- a/shared-bindings/microcontroller/__init__.h +++ b/shared-bindings/microcontroller/__init__.h @@ -43,8 +43,6 @@ extern void common_hal_mcu_enable_interrupts(void); extern void common_hal_mcu_on_next_reset(mcu_runmode_t runmode); extern void common_hal_mcu_reset(void); -extern void NORETURN common_hal_mcu_deep_sleep(void); - extern const mp_obj_dict_t mcu_pin_globals; extern const mcu_processor_obj_t common_hal_mcu_processor_obj; From 3cde6c3fdc46e3641748d5be25c9ee03a2528a64 Mon Sep 17 00:00:00 2001 From: Ernie Hershey Date: Fri, 27 Nov 2020 12:07:49 -0500 Subject: [PATCH 301/770] README typos --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index d21e8d8d3ced2..19992d284bcae 100644 --- a/README.rst +++ b/README.rst @@ -114,14 +114,14 @@ Behavior finishes or is interrupted. After it is done running, the vm and hardware is reinitialized. **This means you cannot read state from** ``code.py`` **in the REPL anymore.** CircuitPython's goal for this - change includes reduce confusion about pins and memory being used. + change includes reducing confusion about pins and memory being used. - After ``code.py`` the REPL can be entered by pressing any key. It no longer shares state with ``code.py`` so it is a fresh vm. - Autoreload state will be maintained across reload. - Adds a safe mode that does not run user code after a hard crash or brown out. The hope is that this will make it easier to fix code that causes nasty crashes by making it available through mass storage - after the crash. A reset (the button) is needed after its fixed to + after the crash. A reset (the button) is needed after it's fixed to get back into normal mode. - RGB status LED indicating CircuitPython state, and errors through a sequence of colored flashes. - Re-runs ``code.py`` or other main file after file system writes over USB mass storage. (Disable with From 518328c71e5fc0c81218d7ee7dfbf9d0f3cb0ea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Montiel=20Cardona?= Date: Thu, 26 Nov 2020 23:24:10 +0000 Subject: [PATCH 302/770] Translated using Weblate (Spanish) Currently translated at 100.0% (864 of 864 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/es.po b/locale/es.po index 1a02843ed7455..6b0fde563c0c2 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-24 15:40-0500\n" -"PO-Revision-Date: 2020-11-26 03:11+0000\n" -"Last-Translator: Daniel Bravo Darriba \n" +"PO-Revision-Date: 2020-11-27 18:34+0000\n" +"Last-Translator: Iván Montiel Cardona \n" "Language-Team: \n" "Language: es\n" "MIME-Version: 1.0\n" @@ -1449,7 +1449,7 @@ msgstr "Solo hay capacidad para direcciones IPv4" #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Only IPv4 sockets supported" -msgstr "" +msgstr "Solo se admiten sockets IPv4" #: shared-module/displayio/OnDiskBitmap.c #, c-format From 884028c7483e33ff10b8cffc9eceeac397dcae09 Mon Sep 17 00:00:00 2001 From: sporeball Date: Thu, 26 Nov 2020 18:20:45 +0000 Subject: [PATCH 303/770] Translated using Weblate (Japanese) Currently translated at 69.2% (598 of 864 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ja/ --- locale/ja.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/ja.po b/locale/ja.po index 2076bbabfdc55..bacf0df812767 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-24 15:40-0500\n" -"PO-Revision-Date: 2020-11-25 01:11+0000\n" -"Last-Translator: Mitsuharu Aoyama \n" +"PO-Revision-Date: 2020-11-27 18:34+0000\n" +"Last-Translator: sporeball \n" "Language-Team: none\n" "Language: ja\n" "MIME-Version: 1.0\n" @@ -3757,7 +3757,7 @@ msgstr "" #: shared-module/displayio/Shape.c msgid "x value out of bounds" -msgstr "" +msgstr "xが範囲外" #: shared-bindings/displayio/Shape.c msgid "y should be an int" From e308a9ec1134412f6194358790176d17b0724ef1 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 27 Nov 2020 16:02:17 -0500 Subject: [PATCH 304/770] working! PinAlarm not implemented yet. --- locale/circuitpython.pot | 25 +++- ports/esp32s2/common-hal/alarm/__init__.c | 71 +++++++++- .../common-hal/microcontroller/__init__.c | 3 - shared-bindings/alarm/__init__.c | 122 ++++++++++++------ shared-bindings/alarm/__init__.h | 1 + shared-bindings/alarm/pin/PinAlarm.c | 6 +- supervisor/shared/workflow.c | 4 +- 7 files changed, 175 insertions(+), 57 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 1532a67b54720..36fd5f647c383 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,11 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -<<<<<<< HEAD -"POT-Creation-Date: 2020-11-25 15:08-0500\n" -======= -"POT-Creation-Date: 2020-11-11 16:30+0530\n" ->>>>>>> adafruit/main +"POT-Creation-Date: 2020-11-27 16:03-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -301,6 +297,7 @@ msgid "All I2C peripherals are in use" msgstr "" #: ports/esp32s2/common-hal/countio/Counter.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" msgstr "" @@ -337,6 +334,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/neopixel_write/__init__.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c #: ports/esp32s2/common-hal/pulseio/PulseOut.c @@ -1098,6 +1096,7 @@ msgid "Invalid byteorder string" msgstr "" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c +#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "" @@ -1511,7 +1510,7 @@ msgid "Pin number already reserved by EXTI" msgstr "" #: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm deep sleep not yet implemented" +msgid "PinAlarm not yet implemented" msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c @@ -1575,7 +1574,7 @@ msgstr "" msgid "RTC calibration is not supported on this board" msgstr "" -#: shared-bindings/time/__init__.c +#: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "" @@ -1721,6 +1720,10 @@ msgstr "" msgid "Supply at least one UART pin" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Supply one of monotonic_time or epoch_time" +msgstr "" + #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" msgstr "" @@ -1784,6 +1787,10 @@ msgstr "" msgid "Tile width must exactly divide bitmap width" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Time is in the past." +msgstr "" + #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Timeout is too long: Maximum timeout length is %d seconds" @@ -2498,6 +2505,10 @@ msgstr "" msgid "end_x should be an int" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "epoch_time not supported on this board" +msgstr "" + #: ports/nrf/common-hal/busio/UART.c #, c-format msgid "error = 0x%08lX" diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index 767b0de70ef41..e044103bcee3c 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -37,6 +37,7 @@ #include "esp_log.h" #include "esp_sleep.h" +#include "esp_wifi.h" STATIC mp_obj_tuple_t *_deep_sleep_alarms; @@ -77,13 +78,14 @@ mp_obj_t common_hal_alarm_get_wake_alarm(void) { return mp_const_none; } -STATIC void setup_alarms(size_t n_alarms, const mp_obj_t *alarms) { +// Set up light sleep or deep sleep alarms. +STATIC void setup_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms) { bool time_alarm_set = false; alarm_time_time_alarm_obj_t *time_alarm = MP_OBJ_NULL; for (size_t i = 0; i < n_alarms; i++) { if (MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pin_alarm_type)) { - mp_raise_NotImplementedError(translate("PinAlarm deep sleep not yet implemented")); + mp_raise_NotImplementedError(translate("PinAlarm not yet implemented")); } else if (MP_OBJ_IS_TYPE(alarms[i], &alarm_time_time_alarm_type)) { if (time_alarm_set) { @@ -98,23 +100,82 @@ STATIC void setup_alarms(size_t n_alarms, const mp_obj_t *alarms) { // Compute how long to actually sleep, considering the time now. mp_float_t now_secs = uint64_to_float(common_hal_time_monotonic_ms()) / 1000.0f; mp_float_t wakeup_in_secs = MAX(0.0f, time_alarm->monotonic_time - now_secs); - esp_sleep_enable_timer_wakeup((uint64_t) (wakeup_in_secs * 1000000)); + const uint64_t sleep_for_us = (uint64_t) (wakeup_in_secs * 1000000); + ESP_LOGI("ALARM", "Sleep for us: %lld", sleep_for_us); + esp_sleep_enable_timer_wakeup(sleep_for_us); } } +mp_obj_t common_hal_alarm_wait_until_alarms(size_t n_alarms, const mp_obj_t *alarms) { + if (n_alarms == 0) { + return mp_const_none; + } + + bool time_alarm_set = false; + alarm_time_time_alarm_obj_t *time_alarm = MP_OBJ_NULL; + + for (size_t i = 0; i < n_alarms; i++) { + if (MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pin_alarm_type)) { + mp_raise_NotImplementedError(translate("PinAlarm not yet implemented")); + } + else if (MP_OBJ_IS_TYPE(alarms[i], &alarm_time_time_alarm_type)) { + if (time_alarm_set) { + mp_raise_ValueError(translate("Only one alarm.time alarm can be set.")); + } + time_alarm = MP_OBJ_TO_PTR(alarms[i]); + time_alarm_set = true; + } + } + + ESP_LOGI("ALARM", "waiting for alarms"); + + if (time_alarm_set && n_alarms == 1) { + // If we're only checking time, avoid a polling loop, so maybe we can save some power. + const mp_float_t now_secs = uint64_to_float(common_hal_time_monotonic_ms()) / 1000.0f; + const mp_float_t wakeup_in_secs = MAX(0.0f, time_alarm->monotonic_time - now_secs); + const uint32_t delay_ms = (uint32_t) (wakeup_in_secs * 1000.0f); + ESP_LOGI("ALARM", "Delay for ms: %d", delay_ms); + common_hal_time_delay_ms((uint32_t) delay_ms); + } else { + // Poll for alarms. + while (true) { + RUN_BACKGROUND_TASKS; + // Allow ctrl-C interrupt. + if (mp_hal_is_interrupted()) { + return mp_const_none; + } + + // TODO: Check PinAlarms. + + if (time_alarm != MP_OBJ_NULL && + common_hal_time_monotonic_ms() * 1000.f >= time_alarm->monotonic_time) { + return time_alarm; + } + } + } + + return mp_const_none; +} + mp_obj_t common_hal_alarm_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms) { - setup_alarms(n_alarms, alarms); + if (n_alarms == 0) { + return mp_const_none; + } + + setup_sleep_alarms(n_alarms, alarms); // Shut down wifi cleanly. esp_wifi_stop(); + ESP_LOGI("ALARM", "start light sleep"); esp_light_sleep_start(); return common_hal_alarm_get_wake_alarm(); } void common_hal_alarm_exit_and_deep_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms) { - setup_alarms(n_alarms, alarms); + setup_sleep_alarms(n_alarms, alarms); // Shut down wifi cleanly. esp_wifi_stop(); + ESP_LOGI("ALARM", "start deep sleep"); esp_deep_sleep_start(); } diff --git a/ports/esp32s2/common-hal/microcontroller/__init__.c b/ports/esp32s2/common-hal/microcontroller/__init__.c index 184f5be69676d..b7bea4e6b8126 100644 --- a/ports/esp32s2/common-hal/microcontroller/__init__.c +++ b/ports/esp32s2/common-hal/microcontroller/__init__.c @@ -42,9 +42,6 @@ #include "freertos/FreeRTOS.h" -#include "esp_sleep.h" -#include "esp_wifi.h" - void common_hal_mcu_delay_us(uint32_t delay) { mp_hal_delay_us(delay); } diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 4c2189c0d041e..195ec63745746 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -25,40 +25,46 @@ */ #include "py/obj.h" +#include "py/reload.h" #include "py/runtime.h" #include "shared-bindings/alarm/__init__.h" #include "shared-bindings/alarm/pin/PinAlarm.h" #include "shared-bindings/alarm/time/TimeAlarm.h" +#include "shared-bindings/supervisor/Runtime.h" #include "shared-bindings/time/__init__.h" -#include "supervisor/shared/rgb_led_status.h" +#include "supervisor/shared/autoreload.h" #include "supervisor/shared/workflow.h" -// Wait this long to see if USB is being connected (enumeration starting). -#define CIRCUITPY_USB_CONNECTING_DELAY 1 -// Wait this long before going into deep sleep if connected. This -// allows the user to ctrl-C before deep sleep starts. -#define CIRCUITPY_USB_CONNECTED_DEEP_SLEEP_DELAY 5 +// Wait this long imediately after startup to see if we are connected to USB. +#define CIRCUITPY_USB_CONNECTED_SLEEP_DELAY 5 -//| """Power-saving light and deep sleep. Alarms can be set to wake up from sleep. +//| """Alarms and sleep //| -//| The `alarm` module provides sleep related functionality. There are two supported levels of -//| sleep, light and deep. +//| Provides alarms that trigger based on time intervals or on external events, such as pin +//| changes. +//| The program can simply wait for these alarms, or go into a sleep state and +//| and be awoken when they trigger. //| -//| Light sleep leaves the CPU and RAM powered so that CircuitPython can resume where it left off -//| after being woken up. CircuitPython automatically goes into a light sleep when `time.sleep()` is -//| called. To light sleep until a non-time alarm use `alarm.sleep_until_alarms()`. Any active -//| peripherals, such as I2C, are left on. +//| There are two supported levels of sleep: light sleep and deep sleep. //| -//| Deep sleep shuts down power to nearly all of the chip including the CPU and RAM. This can save -//| a more significant amount of power, but CircuitPython must start ``code.py`` from the beginning when +//| Light sleep leaves the CPU and RAM powered so the program can resume after sleeping. +//| +//| *However, note that on some platforms, light sleep will shut down some communications, including +//| WiFi and/or Bluetooth.* +//| +//| Deep sleep shuts down power to nearly all of the microcontroller including the CPU and RAM. This can save +//| a more significant amount of power, but CircuitPython must restart ``code.py`` from the beginning when //| awakened. //| """ //| //| wake_alarm: Alarm -//| """The most recent alarm to wake us up from a sleep (light or deep.)""" +//| """The most recently triggered alarm. If CircuitPython was sleeping, the alarm the woke it from sleep.""" //| + +// wake_alarm is implemented as a dictionary entry, so there's no code here. + void validate_objs_are_alarms(size_t n_args, const mp_obj_t *objs) { for (size_t i = 0; i < n_args; i++) { if (MP_OBJ_IS_TYPE(objs[i], &alarm_pin_pin_alarm_type) || @@ -69,9 +75,36 @@ void validate_objs_are_alarms(size_t n_args, const mp_obj_t *objs) { } } +//| def wait_until_alarms(*alarms: Alarm) -> Alarm: +//| """Wait for one of the alarms to trigger. The triggering alarm is returned. +//| is returned, and is also available as `alarm.wake_alarm`. Nothing is shut down +//| or interrupted. Power consumption will be reduced if possible. +//| +//| If no alarms are specified, return immediately. +//| """ +//| ... +//| +STATIC mp_obj_t alarm_wait_until_alarms(size_t n_args, const mp_obj_t *args) { + validate_objs_are_alarms(n_args, args); + common_hal_alarm_wait_until_alarms(n_args, args); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_wait_until_alarms_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_wait_until_alarms); + //| def sleep_until_alarms(*alarms: Alarm) -> Alarm: //| """Go into a light sleep until awakened one of the alarms. The alarm causing the wake-up -//| is returned, and is also available as `alarm.wake_alarm`. +//| is returned, and is also available as `alarm.wake_alarm`. +//| +//| Some functionality may be shut down during sleep. On ESP32-S2, WiFi is turned off, +//| and existing connections are broken. +//| +//| If no alarms are specified, return immediately. +//| +//| **If CircuitPython is connected to a host computer,** `alarm.sleep_until_alarms()` +//| **does not go into light sleep.** +//| Instead, light sleep is simulated by doing `alarm.wait_until_alarms()`, +//| This allows the user to interrupt an existing program with ctrl-C, +//| and to edit the files in CIRCUITPY, which would not be possible in true light sleep //| """ //| ... //| @@ -84,47 +117,60 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_sleep_until_alarms_obj, 1, MP_OBJ_FUN_ //| def exit_and_deep_sleep_until_alarms(*alarms: Alarm) -> None: //| """Exit the program and go into a deep sleep, until awakened by one of the alarms. +//| This function does not return. //| //| When awakened, the microcontroller will restart and will run ``boot.py`` and ``code.py`` //| from the beginning. //| -//| An alarm equivalent to the one that caused the wake-up is available as `alarm.wake_alarm`. +//| After restart, an alarm *equivalent* to the one that caused the wake-up +//| will be available as `alarm.wake_alarm`. //| Its type and/or attributes may not correspond exactly to the original alarm. //| For time-base alarms, currently, an `alarm.time.TimeAlarm()` is created. //| //| If no alarms are specified, the microcontroller will deep sleep until reset. //| -//| If CircuitPython is unconnected to a host computer, go into deep sleep immediately. -//| But if it already connected or in the process of connecting to a host computer, wait at least -//| five seconds after starting code.py before entering deep sleep. -//| This allows interrupting a program that would otherwise go into deep sleep too quickly -//| to interrupt from the keyboard. +//| **If CircuitPython is connected to a host computer, `alarm.exit_and_deep_sleep_until_alarms()` +//| does not go into deep sleep.** +//| Instead, deep sleep is simulated by first doing `alarm.wait_until_alarms()`, +//| and then, when an alarm triggers, by restarting CircuitPython. +//| This allows the user to interrupt an existing program with ctrl-C, +//| and to edit the files in CIRCUITPY, which would not be possible in true deep sleep. +//| +//| Here is skeletal example that deep-sleeps and restarts every 60 seconds: +//| +//| .. code-block:: python +//| +//| import alarm +//| import time +//| +//| print("Waking up") +//| +//| # Set an alarm for 60 seconds from now. +//| time_alarm = alarm.time.TimeAlarm(monotonic_time=time.monotonic() + 60) +//| +//| # Deep sleep until the alarm goes off. Then restart the program. +//| alarm.exit_and_deep_sleep_until_alarms(time_alarm) //| """ //| ... //| STATIC mp_obj_t alarm_exit_and_deep_sleep_until_alarms(size_t n_args, const mp_obj_t *args) { validate_objs_are_alarms(n_args, args); - int64_t connecting_delay_msec = CIRCUITPY_USB_CONNECTING_DELAY * 1024 - supervisor_ticks_ms64(); + // Make sure we have been awake long enough for USB to connect (enumeration delay). + int64_t connecting_delay_msec = CIRCUITPY_USB_CONNECTED_SLEEP_DELAY * 1024 - supervisor_ticks_ms64(); if (connecting_delay_msec > 0) { common_hal_time_delay_ms(connecting_delay_msec * 1000 / 1024); } - // If connected, wait for the program to be running at least as long as - // CIRCUITPY_USB_CONNECTED_DEEP_SLEEP_DELAY. This allows a user to ctrl-C the running - // program in case it is in a tight deep sleep loop that would otherwise be difficult - // or impossible to interrupt. - // Indicate that we're delaying with the SAFE_MODE color. - int64_t delay_before_sleeping_msec = - supervisor_ticks_ms64() - CIRCUITPY_USB_CONNECTED_DEEP_SLEEP_DELAY * 1000; - if (supervisor_workflow_connecting() && delay_before_sleeping_msec > 0) { - temp_status_color(SAFE_MODE); - common_hal_time_delay_ms(delay_before_sleeping_msec); - clear_temp_status(); + if (supervisor_workflow_active()) { + common_hal_alarm_wait_until_alarms(n_args, args); + reload_requested = true; + supervisor_set_run_reason(RUN_REASON_STARTUP); + mp_raise_reload_exception(); + } else { + common_hal_alarm_exit_and_deep_sleep_until_alarms(n_args, args); + // Does not return. } - - common_hal_alarm_exit_and_deep_sleep_until_alarms(n_args, args); - // Does not return. return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_exit_and_deep_sleep_until_alarms_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_exit_and_deep_sleep_until_alarms); diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h index 968136345ccbc..26dbb2897c728 100644 --- a/shared-bindings/alarm/__init__.h +++ b/shared-bindings/alarm/__init__.h @@ -31,6 +31,7 @@ #include "common-hal/alarm/__init__.h" +extern mp_obj_t common_hal_alarm_wait_until_alarms(size_t n_alarms, const mp_obj_t *alarms); extern mp_obj_t common_hal_alarm_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms); extern void common_hal_alarm_exit_and_deep_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms); diff --git a/shared-bindings/alarm/pin/PinAlarm.c b/shared-bindings/alarm/pin/PinAlarm.c index fadd1b0d4a4a0..a6497d4cde04d 100644 --- a/shared-bindings/alarm/pin/PinAlarm.c +++ b/shared-bindings/alarm/pin/PinAlarm.c @@ -56,7 +56,7 @@ //| to ``value`` to trigger the alarm. On some ports, edge-triggering may not be available, //| particularly for deep-sleep alarms. //| :param bool pull: Enable a pull-up or pull-down which pulls the pin to the level opposite -//| opposite that of ``value``. For instance, if ``value`` is set to ``True``, setting ``pull`` +//| that of ``value``. For instance, if ``value`` is set to ``True``, setting ``pull`` //| to ``True`` will enable a pull-down, to hold the pin low normally until an outside signal //| pulls it high. //| """ @@ -89,7 +89,7 @@ STATIC mp_obj_t alarm_pin_pin_alarm_make_new(const mp_obj_type_t *type, mp_uint_ return MP_OBJ_FROM_PTR(self); } -//| pins: Tuple[microcontroller.pin] +//| pins: Tuple[microcontroller.Pin] //| """The trigger pins.""" //| STATIC mp_obj_t alarm_pin_pin_alarm_obj_get_pins(mp_obj_t self_in) { @@ -105,7 +105,7 @@ const mp_obj_property_t alarm_pin_pin_alarm_pins_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| value: Tuple[microcontroller.pin] +//| value: Tuple[microcontroller.Pin] //| """The value on which to trigger.""" //| STATIC mp_obj_t alarm_pin_pin_alarm_obj_get_value(mp_obj_t self_in) { diff --git a/supervisor/shared/workflow.c b/supervisor/shared/workflow.c index 8e4ec16c0b02c..4986c09570301 100644 --- a/supervisor/shared/workflow.c +++ b/supervisor/shared/workflow.c @@ -33,8 +33,10 @@ void supervisor_workflow_reset(void) { // Return true as soon as USB communication with host has started, // even before enumeration is done. +// Not that some chips don't notice when USB is unplugged after first being plugged in, +// so this is not perfect, but tud_suspended() check helps. bool supervisor_workflow_connecting(void) { - return tud_connected(); + return tud_connected() && !tud_suspended(); } // Return true if host has completed connection to us (such as USB enumeration). From f96475cbbf5417531bbdd302b720658c5fa0f541 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 27 Nov 2020 16:24:36 -0500 Subject: [PATCH 305/770] update Requests; rolled back by accident --- frozen/Adafruit_CircuitPython_Requests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frozen/Adafruit_CircuitPython_Requests b/frozen/Adafruit_CircuitPython_Requests index 43017e30a1e77..53902152c674b 160000 --- a/frozen/Adafruit_CircuitPython_Requests +++ b/frozen/Adafruit_CircuitPython_Requests @@ -1 +1 @@ -Subproject commit 43017e30a1e772b67ac68293a944e863c031e389 +Subproject commit 53902152c674b0ba31536b50291f7ddd28960f47 From 65e2fe46540abc09f341c39d877eafeb791933f1 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 27 Nov 2020 23:27:15 -0500 Subject: [PATCH 306/770] fix stub problems; touch up doc --- shared-bindings/_typing/__init__.pyi | 5 ++++- shared-bindings/alarm/time/TimeAlarm.c | 2 +- shared-bindings/microcontroller/__init__.c | 9 --------- tools/extract_pyi.py | 2 +- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/shared-bindings/_typing/__init__.pyi b/shared-bindings/_typing/__init__.pyi index 2716936860a3c..cc4a0a4391f00 100644 --- a/shared-bindings/_typing/__init__.pyi +++ b/shared-bindings/_typing/__init__.pyi @@ -2,6 +2,9 @@ from typing import Union +import alarm +import alarm.pin +import alarm.time import array import audiocore import audiomixer @@ -61,5 +64,5 @@ Alarm = Union[ - `alarm.pin.PinAlarm` - `alarm.time.TimeAlarm` - You can use these alarms to wake from light or deep sleep. + You can use these alarms to wake up from light or deep sleep. """ diff --git a/shared-bindings/alarm/time/TimeAlarm.c b/shared-bindings/alarm/time/TimeAlarm.c index 6339b850c61a5..17a4faac25723 100644 --- a/shared-bindings/alarm/time/TimeAlarm.c +++ b/shared-bindings/alarm/time/TimeAlarm.c @@ -43,7 +43,7 @@ mp_obj_t MP_WEAK rtc_get_time_source_time(void) { //| class TimeAlarm: //| """Trigger an alarm when the specified time is reached.""" //| -//| def __init__(self, monotonic_time: Optional[Float] = None, epoch_time: Optional[int] = None) -> None: +//| def __init__(self, monotonic_time: Optional[float] = None, epoch_time: Optional[int] = None) -> None: //| """Create an alarm that will be triggered when `time.monotonic()` would equal //| ``monotonic_time``, or when `time.time()` would equal ``epoch_time``. //| Only one of the two arguments can be given. diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index d09cf8f445fcc..8a77d1df5b91c 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -147,15 +147,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_reset_obj, mcu_reset); //| This object is the sole instance of `watchdog.WatchDogTimer` when available or ``None`` otherwise.""" //| - -//| """:mod:`microcontroller.pin` --- Microcontroller pin names -//| -------------------------------------------------------- -//| -//| .. module:: microcontroller.pin -//| :synopsis: Microcontroller pin names -//| -//| References to pins as named by the microcontroller""" -//| const mp_obj_module_t mcu_pin_module = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t*)&mcu_pin_globals, diff --git a/tools/extract_pyi.py b/tools/extract_pyi.py index b7ce584a1e1d3..2730102ac0804 100644 --- a/tools/extract_pyi.py +++ b/tools/extract_pyi.py @@ -19,7 +19,7 @@ IMPORTS_IGNORE = frozenset({'int', 'float', 'bool', 'str', 'bytes', 'tuple', 'list', 'set', 'dict', 'bytearray', 'slice', 'file', 'buffer', 'range', 'array', 'struct_time'}) IMPORTS_TYPING = frozenset({'Any', 'Optional', 'Union', 'Tuple', 'List', 'Sequence', 'NamedTuple', 'Iterable', 'Iterator', 'Callable', 'AnyStr', 'overload', 'Type'}) IMPORTS_TYPES = frozenset({'TracebackType'}) -CPY_TYPING = frozenset({'ReadableBuffer', 'WriteableBuffer', 'AudioSample', 'FrameBuffer'}) +CPY_TYPING = frozenset({'ReadableBuffer', 'WriteableBuffer', 'AudioSample', 'FrameBuffer', 'Alarm'}) def is_typed(node, allow_any=False): From 2830cc9433dc9954c781c5351f3051dcacaaa467 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 27 Nov 2020 23:57:59 -0500 Subject: [PATCH 307/770] make translate --- locale/circuitpython.pot | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 38deb62d70aed..63d818da9c560 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-11-24 15:40-0500\n" +"POT-Creation-Date: 2020-11-27 23:57-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1448,6 +1448,10 @@ msgid "" "%d bpp given" msgstr "" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "Only one alarm.time alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "" @@ -1505,6 +1509,10 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "PinAlarm not yet implemented" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1566,7 +1574,7 @@ msgstr "" msgid "RTC calibration is not supported on this board" msgstr "" -#: shared-bindings/time/__init__.c +#: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "" @@ -1712,6 +1720,10 @@ msgstr "" msgid "Supply at least one UART pin" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Supply one of monotonic_time or epoch_time" +msgstr "" + #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" msgstr "" @@ -1775,6 +1787,10 @@ msgstr "" msgid "Tile width must exactly divide bitmap width" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Time is in the past." +msgstr "" + #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Timeout is too long: Maximum timeout length is %d seconds" @@ -2489,6 +2505,10 @@ msgstr "" msgid "end_x should be an int" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "epoch_time not supported on this board" +msgstr "" + #: ports/nrf/common-hal/busio/UART.c #, c-format msgid "error = 0x%08lX" @@ -2858,6 +2878,10 @@ msgstr "" msgid "invalid syntax for number" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "io must be rtc io" +msgstr "" + #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "" @@ -3545,6 +3569,10 @@ msgstr "" msgid "trapz is defined for 1D arrays of equal length" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "trigger level must be 0 or 1" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" msgstr "" @@ -3687,6 +3715,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "wakeup conflict" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" msgstr "" From 28d9e9186e6a9a153217535bd2d9f144672846bb Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sat, 28 Nov 2020 10:12:46 -0500 Subject: [PATCH 308/770] Disable complex arithmetic on SAMD21 builds to make space --- ports/atmel-samd/mpconfigport.h | 1 + py/circuitpy_mpconfig.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/ports/atmel-samd/mpconfigport.h b/ports/atmel-samd/mpconfigport.h index ed10da9b9d4bc..bce89e0b99290 100644 --- a/ports/atmel-samd/mpconfigport.h +++ b/ports/atmel-samd/mpconfigport.h @@ -42,6 +42,7 @@ #define CIRCUITPY_MCU_FAMILY samd21 #define MICROPY_PY_SYS_PLATFORM "Atmel SAMD21" #define SPI_FLASH_MAX_BAUDRATE 8000000 +#define MICROPY_PY_BUILTINS_COMPLEX (0) #define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0) #define MICROPY_PY_FUNCTION_ATTRS (0) // MICROPY_PY_UJSON depends on MICROPY_PY_IO diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 799217777cc42..4b847de38bfe7 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -188,7 +188,9 @@ typedef long mp_off_t; #define MICROPY_COMP_FSTRING_LITERAL (MICROPY_CPYTHON_COMPAT) #define MICROPY_MODULE_WEAK_LINKS (0) #define MICROPY_PY_ALL_SPECIAL_METHODS (CIRCUITPY_FULL_BUILD) +#ifndef MICROPY_PY_BUILTINS_COMPLEX #define MICROPY_PY_BUILTINS_COMPLEX (CIRCUITPY_FULL_BUILD) +#endif #define MICROPY_PY_BUILTINS_FROZENSET (CIRCUITPY_FULL_BUILD) #define MICROPY_PY_BUILTINS_STR_CENTER (CIRCUITPY_FULL_BUILD) #define MICROPY_PY_BUILTINS_STR_PARTITION (CIRCUITPY_FULL_BUILD) From c7404a3ff89c738c002ec63448a58d56330dfcc3 Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Sun, 11 Oct 2020 14:59:33 +0200 Subject: [PATCH 309/770] Add movable allocation system. This allows calls to `allocate_memory()` while the VM is running, it will then allocate from the GC heap (unless there is a suitable hole among the supervisor allocations), and when the VM exits and the GC heap is freed, the allocation will be moved to the bottom of the former GC heap and transformed into a proper supervisor allocation. Existing movable allocations will also be moved to defragment the supervisor heap and ensure that the next VM run gets as much memory as possible for the GC heap. By itself this breaks terminalio because it violates the assumption that supervisor_display_move_memory() still has access to an undisturbed heap to copy the tilegrid from. It will work in many cases, but if you're unlucky you will get garbled terminal contents after exiting from the vm run that created the display. This will be fixed in the following commit, which is separate to simplify review. --- main.c | 13 +- ports/atmel-samd/supervisor/port.c | 4 +- ports/cxd56/supervisor/port.c | 8 +- ports/esp32s2/supervisor/port.c | 8 +- ports/litex/supervisor/port.c | 4 +- ports/mimxrt10xx/supervisor/port.c | 7 +- ports/nrf/supervisor/port.c | 4 +- ports/stm/supervisor/port.c | 4 +- py/circuitpy_mpconfig.h | 4 + shared-module/rgbmatrix/RGBMatrix.c | 2 +- .../sharpdisplay/SharpMemoryFramebuffer.c | 2 +- shared-module/usb_midi/__init__.c | 2 +- supervisor/memory.h | 26 +- supervisor/port.h | 5 +- supervisor/shared/display.c | 4 +- .../shared/external_flash/external_flash.c | 2 +- supervisor/shared/memory.c | 277 +++++++++++++----- supervisor/shared/stack.c | 38 ++- supervisor/shared/stack.h | 6 +- 19 files changed, 283 insertions(+), 137 deletions(-) diff --git a/main.c b/main.c index 80b163f6079f7..1389f524b6b54 100755 --- a/main.c +++ b/main.c @@ -123,15 +123,15 @@ void start_mp(supervisor_allocation* heap) { // to recover from limit hit. (Limit is measured in bytes.) mp_stack_ctrl_init(); - if (stack_alloc != NULL) { - mp_stack_set_limit(stack_alloc->length - 1024); + if (stack_get_bottom() != NULL) { + mp_stack_set_limit(stack_get_length() - 1024); } #if MICROPY_MAX_STACK_USAGE // _ezero (same as _ebss) is an int, so start 4 bytes above it. - if (stack_alloc != NULL) { - mp_stack_set_bottom(stack_alloc->ptr); + if (stack_get_bottom() != NULL) { + mp_stack_set_bottom(stack_get_bottom()); mp_stack_fill_with_sentinel(); } #endif @@ -148,7 +148,7 @@ void start_mp(supervisor_allocation* heap) { #endif #if MICROPY_ENABLE_GC - gc_init(heap->ptr, heap->ptr + heap->length / 4); + gc_init(heap->ptr, heap->ptr + get_allocation_length(heap) / 4); #endif mp_init(); mp_obj_list_init(mp_sys_path, 0); @@ -451,9 +451,6 @@ int __attribute__((used)) main(void) { // initialise the cpu and peripherals safe_mode_t safe_mode = port_init(); - // Init memory after the port in case the port needs to set aside memory. - memory_init(); - // Turn on LEDs init_status_leds(); rgb_led_status_init(); diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index d65d098257fc7..fc1d1198e2f45 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -390,8 +390,8 @@ void reset_cpu(void) { reset(); } -supervisor_allocation* port_fixed_stack(void) { - return NULL; +bool port_has_fixed_stack(void) { + return false; } uint32_t *port_stack_get_limit(void) { diff --git a/ports/cxd56/supervisor/port.c b/ports/cxd56/supervisor/port.c index 086c2d198ec3a..d69f357799a1a 100644 --- a/ports/cxd56/supervisor/port.c +++ b/ports/cxd56/supervisor/port.c @@ -98,12 +98,8 @@ void reset_to_bootloader(void) { } } -supervisor_allocation _fixed_stack; - -supervisor_allocation* port_fixed_stack(void) { - _fixed_stack.ptr = port_stack_get_limit(); - _fixed_stack.length = (port_stack_get_top() - port_stack_get_limit()) * sizeof(uint32_t); - return &_fixed_stack; +bool port_has_fixed_stack(void) { + return true; } uint32_t *port_stack_get_limit(void) { diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index aff7dbda4dcdd..264bdee9749ab 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -193,12 +193,8 @@ uint32_t *port_stack_get_top(void) { return port_stack_get_limit() + ESP_TASK_MAIN_STACK / (sizeof(uint32_t) / sizeof(StackType_t)); } -supervisor_allocation _fixed_stack; - -supervisor_allocation* port_fixed_stack(void) { - _fixed_stack.ptr = port_stack_get_limit(); - _fixed_stack.length = (port_stack_get_top() - port_stack_get_limit()) * sizeof(uint32_t); - return &_fixed_stack; +bool port_has_fixed_stack(void) { + return true; } // Place the word to save just after our BSS section that gets blanked. diff --git a/ports/litex/supervisor/port.c b/ports/litex/supervisor/port.c index 02617b9af7deb..f5c362ea6e6de 100644 --- a/ports/litex/supervisor/port.c +++ b/ports/litex/supervisor/port.c @@ -98,8 +98,8 @@ void reset_cpu(void) { for(;;) {} } -supervisor_allocation* port_fixed_stack(void) { - return NULL; +bool port_has_fixed_stack(void) { + return false; } uint32_t *port_heap_get_bottom(void) { diff --git a/ports/mimxrt10xx/supervisor/port.c b/ports/mimxrt10xx/supervisor/port.c index e3fef373f8154..1be2b10396c92 100644 --- a/ports/mimxrt10xx/supervisor/port.c +++ b/ports/mimxrt10xx/supervisor/port.c @@ -334,11 +334,8 @@ uint32_t *port_stack_get_top(void) { return &_ld_stack_top; } -supervisor_allocation _fixed_stack; -supervisor_allocation* port_fixed_stack(void) { - _fixed_stack.ptr = port_stack_get_limit(); - _fixed_stack.length = (port_stack_get_top() - port_stack_get_limit()) * sizeof(uint32_t); - return &_fixed_stack; +bool port_has_fixed_stack(void) { + return true; } uint32_t *port_heap_get_bottom(void) { diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c index 493de43e0f024..5f1c9f1ba9195 100644 --- a/ports/nrf/supervisor/port.c +++ b/ports/nrf/supervisor/port.c @@ -251,8 +251,8 @@ uint32_t *port_heap_get_top(void) { return port_stack_get_top(); } -supervisor_allocation* port_fixed_stack(void) { - return NULL; +bool port_has_fixed_stack(void) { + return false; } uint32_t *port_stack_get_limit(void) { diff --git a/ports/stm/supervisor/port.c b/ports/stm/supervisor/port.c index a8aab00ff25e3..dba1cf21ee983 100644 --- a/ports/stm/supervisor/port.c +++ b/ports/stm/supervisor/port.c @@ -267,8 +267,8 @@ uint32_t *port_heap_get_top(void) { return &_ld_heap_end; } -supervisor_allocation* port_fixed_stack(void) { - return NULL; +bool port_has_fixed_stack(void) { + return false; } uint32_t *port_stack_get_limit(void) { diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 28fd4095c4621..28fd6e9b00f17 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -858,6 +858,9 @@ extern const struct _mp_obj_module_t wifi_module; #include "supervisor/flash_root_pointers.h" +// From supervisor/memory.c +struct _supervisor_allocation_node; + #define CIRCUITPY_COMMON_ROOT_POINTERS \ const char *readline_hist[8]; \ vstr_t *repl_line; \ @@ -869,6 +872,7 @@ extern const struct _mp_obj_module_t wifi_module; FLASH_ROOT_POINTERS \ MEMORYMONITOR_ROOT_POINTERS \ NETWORK_ROOT_POINTERS \ + struct _supervisor_allocation_node* first_embedded_allocation; \ void supervisor_run_background_tasks_if_tick(void); #define RUN_BACKGROUND_TASKS (supervisor_run_background_tasks_if_tick()) diff --git a/shared-module/rgbmatrix/RGBMatrix.c b/shared-module/rgbmatrix/RGBMatrix.c index 94c3eda27f3ae..1f144aedb5f36 100644 --- a/shared-module/rgbmatrix/RGBMatrix.c +++ b/shared-module/rgbmatrix/RGBMatrix.c @@ -220,7 +220,7 @@ void *common_hal_rgbmatrix_allocator_impl(size_t sz) { if (gc_alloc_possible()) { return m_malloc_maybe(sz + sizeof(void*), true); } else { - supervisor_allocation *allocation = allocate_memory(align32_size(sz), false); + supervisor_allocation *allocation = allocate_memory(align32_size(sz), false, false); return allocation ? allocation->ptr : NULL; } } diff --git a/shared-module/sharpdisplay/SharpMemoryFramebuffer.c b/shared-module/sharpdisplay/SharpMemoryFramebuffer.c index b199e98d63efc..aefb6b18de490 100644 --- a/shared-module/sharpdisplay/SharpMemoryFramebuffer.c +++ b/shared-module/sharpdisplay/SharpMemoryFramebuffer.c @@ -40,7 +40,7 @@ #define SHARPMEM_BIT_VCOM_LSB (0x40) static void *hybrid_alloc(size_t sz) { - supervisor_allocation *allocation = allocate_memory(align32_size(sz), false); + supervisor_allocation *allocation = allocate_memory(align32_size(sz), false, false); if (allocation) { memset(allocation->ptr, 0, sz); return allocation->ptr; diff --git a/shared-module/usb_midi/__init__.c b/shared-module/usb_midi/__init__.c index 73a314b9972a3..5afdd18213265 100644 --- a/shared-module/usb_midi/__init__.c +++ b/shared-module/usb_midi/__init__.c @@ -45,7 +45,7 @@ void usb_midi_init(void) { uint16_t portout_size = align32_size(sizeof(usb_midi_portout_obj_t)); // For each embedded MIDI Jack in the descriptor we create a Port - usb_midi_allocation = allocate_memory(tuple_size + portin_size + portout_size, false); + usb_midi_allocation = allocate_memory(tuple_size + portin_size + portout_size, false, false); mp_obj_tuple_t *ports = (mp_obj_tuple_t *) usb_midi_allocation->ptr; ports->base.type = &mp_type_tuple; diff --git a/supervisor/memory.h b/supervisor/memory.h index f4359ca46ecd8..4307e3f21d556 100755 --- a/supervisor/memory.h +++ b/supervisor/memory.h @@ -33,23 +33,36 @@ #include #include +#include typedef struct { uint32_t* ptr; - uint32_t length; // in bytes } supervisor_allocation; -void memory_init(void); void free_memory(supervisor_allocation* allocation); + +// Find the allocation with the given ptr, NULL if not found. When called from the context of a +// supervisor_move_memory() callback, finds the allocation that had that ptr *before* the move, but +// the returned allocation already contains the ptr after the move. +// When called with NULL, may return either NULL or an unused allocation whose ptr is NULL (this is +// a feature used internally in allocate_memory to save code size). Passing the return value to +// free_memory() is a permissible no-op in either case. supervisor_allocation* allocation_from_ptr(void *ptr); + supervisor_allocation* allocate_remaining_memory(void); // Allocate a piece of a given length in bytes. If high_address is true then it should be allocated // at a lower address from the top of the stack. Otherwise, addresses will increase starting after -// statically allocated memory. -supervisor_allocation* allocate_memory(uint32_t length, bool high_address); +// statically allocated memory. If movable is false, memory will be taken from outside the GC heap +// and will stay stationary until freed. While the VM is running, this will fail unless a previous +// allocation of exactly matching length has recently been freed. If movable is true, memory will be +// taken from either outside or inside the GC heap, and when the VM exits, will be moved outside. +// The ptr of the returned supervisor_allocation will change at that point. If you need to be +// notified of that, add your own callback function at the designated place near the end of +// supervisor_move_memory(). +supervisor_allocation* allocate_memory(uint32_t length, bool high_address, bool movable); static inline uint16_t align32_size(uint16_t size) { if (size % 4 != 0) { @@ -58,7 +71,10 @@ static inline uint16_t align32_size(uint16_t size) { return size; } -// Called after the heap is freed in case the supervisor wants to save some values. +size_t get_allocation_length(supervisor_allocation* allocation); + +// Called after the GC heap is freed, transfers movable allocations from the GC heap to the +// supervisor heap and compacts the supervisor heap. void supervisor_move_memory(void); #endif // MICROPY_INCLUDED_SUPERVISOR_MEMORY_H diff --git a/supervisor/port.h b/supervisor/port.h index f5b3c15d1412e..5bc06bc4e1413 100644 --- a/supervisor/port.h +++ b/supervisor/port.h @@ -61,7 +61,8 @@ uint32_t *port_stack_get_limit(void); // Get stack top address uint32_t *port_stack_get_top(void); -supervisor_allocation* port_fixed_stack(void); +// True if stack is not located inside heap (at the top) +bool port_has_fixed_stack(void); // Get heap bottom address uint32_t *port_heap_get_bottom(void); @@ -69,8 +70,6 @@ uint32_t *port_heap_get_bottom(void); // Get heap top address uint32_t *port_heap_get_top(void); -supervisor_allocation* port_fixed_heap(void); - // Save and retrieve a word from memory that is preserved over reset. Used for safe mode. void port_set_saved_word(uint32_t); uint32_t port_get_saved_word(void); diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c index a9ae25884239f..de45e2672f13f 100644 --- a/supervisor/shared/display.c +++ b/supervisor/shared/display.c @@ -82,7 +82,7 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) { uint16_t total_tiles = width_in_tiles * height_in_tiles; // First try to allocate outside the heap. This will fail when the VM is running. - tilegrid_tiles = allocate_memory(align32_size(total_tiles), false); + tilegrid_tiles = allocate_memory(align32_size(total_tiles), false, false); uint8_t* tiles; if (tilegrid_tiles == NULL) { tiles = m_malloc(total_tiles, true); @@ -133,7 +133,7 @@ void supervisor_display_move_memory(void) { grid->tiles == MP_STATE_VM(terminal_tilegrid_tiles)) { uint16_t total_tiles = grid->width_in_tiles * grid->height_in_tiles; - tilegrid_tiles = allocate_memory(align32_size(total_tiles), false); + tilegrid_tiles = allocate_memory(align32_size(total_tiles), false, false); if (tilegrid_tiles != NULL) { memcpy(tilegrid_tiles->ptr, grid->tiles, total_tiles); grid->tiles = (uint8_t*) tilegrid_tiles->ptr; diff --git a/supervisor/shared/external_flash/external_flash.c b/supervisor/shared/external_flash/external_flash.c index 5bde7fd4855f5..e2d767235ee73 100644 --- a/supervisor/shared/external_flash/external_flash.c +++ b/supervisor/shared/external_flash/external_flash.c @@ -338,7 +338,7 @@ static bool allocate_ram_cache(void) { uint32_t table_size = blocks_per_sector * pages_per_block * sizeof(uint32_t); // Attempt to allocate outside the heap first. - supervisor_cache = allocate_memory(table_size + SPI_FLASH_ERASE_SIZE, false); + supervisor_cache = allocate_memory(table_size + SPI_FLASH_ERASE_SIZE, false, false); if (supervisor_cache != NULL) { MP_STATE_VM(flash_ram_cache) = (uint8_t **) supervisor_cache->ptr; uint8_t* page_start = (uint8_t *) supervisor_cache->ptr + table_size; diff --git a/supervisor/shared/memory.c b/supervisor/shared/memory.c index 0f96ae273409d..2be3b42d63f94 100755 --- a/supervisor/shared/memory.c +++ b/supervisor/shared/memory.c @@ -27,78 +27,81 @@ #include "supervisor/memory.h" #include "supervisor/port.h" -#include +#include +#include "py/gc.h" #include "supervisor/shared/display.h" #define CIRCUITPY_SUPERVISOR_ALLOC_COUNT (12) -// Using a zero length to mark an unused allocation makes the code a bit shorter (but makes it -// impossible to support zero-length allocations). -#define FREE 0 - // The lowest two bits of a valid length are always zero, so we can use them to mark an allocation -// as freed by the client but not yet reclaimed into the FREE middle. +// as a hole (freed by the client but not yet reclaimed into the free middle) and as movable. +#define FLAGS 3 #define HOLE 1 +#define MOVABLE 2 static supervisor_allocation allocations[CIRCUITPY_SUPERVISOR_ALLOC_COUNT]; -// We use uint32_t* to ensure word (4 byte) alignment. -uint32_t* low_address; -uint32_t* high_address; +supervisor_allocation* old_allocations; -void memory_init(void) { - low_address = port_heap_get_bottom(); - high_address = port_heap_get_top(); -} +typedef struct _supervisor_allocation_node { + struct _supervisor_allocation_node* next; + size_t length; + // We use uint32_t to ensure word (4 byte) alignment. + uint32_t data[]; +} supervisor_allocation_node; + +supervisor_allocation_node* low_head; +supervisor_allocation_node* high_head; + +// Intermediate (void*) is to suppress -Wcast-align warning. Alignment will always be correct +// because this only reverses how (alloc)->ptr was obtained as &(node->data[0]). +#define ALLOCATION_NODE(alloc) ((supervisor_allocation_node*)(void*)((char*)((alloc)->ptr) - sizeof(supervisor_allocation_node))) void free_memory(supervisor_allocation* allocation) { - if (allocation == NULL) { + if (allocation == NULL || allocation->ptr == NULL) { return; } - int32_t index = 0; - bool found = false; - for (index = 0; index < CIRCUITPY_SUPERVISOR_ALLOC_COUNT; index++) { - found = allocation == &allocations[index]; - if (found) { - break; - } + supervisor_allocation_node* node = ALLOCATION_NODE(allocation); + if (node == low_head) { + do { + low_head = low_head->next; + } while (low_head != NULL && (low_head->length & HOLE)); } - if (!found) { - // Bad! - // TODO(tannewt): Add a way to escape into safe mode on error. + else if (node == high_head) { + do { + high_head = high_head->next; + } while (high_head != NULL && (high_head->length & HOLE)); } - if (allocation->ptr == high_address) { - high_address += allocation->length / 4; - allocation->length = FREE; - for (index++; index < CIRCUITPY_SUPERVISOR_ALLOC_COUNT; index++) { - if (!(allocations[index].length & HOLE)) { - break; - } - // Division automatically shifts out the HOLE bit. - high_address += allocations[index].length / 4; - allocations[index].length = FREE; - } - } else if (allocation->ptr + allocation->length / 4 == low_address) { - low_address = allocation->ptr; - allocation->length = FREE; - for (index--; index >= 0; index--) { - if (!(allocations[index].length & HOLE)) { - break; + else { + // Check if it's in the list of embedded allocations. + supervisor_allocation_node** emb = &MP_STATE_VM(first_embedded_allocation); + while (*emb != NULL) { + if (*emb == node) { + // Found, remove it from the list. + *emb = node->next; + m_free(node +#if MICROPY_MALLOC_USES_ALLOCATED_SIZE + , sizeof(supervisor_allocation_node) + (node->length & ~FLAGS) +#endif + ); + goto done; } - low_address -= allocations[index].length / 4; - allocations[index].length = FREE; + emb = &((*emb)->next); } - } else { - // Freed memory isn't in the middle so skip updating bounds. The memory will be added to the - // middle when the memory to the inside is freed. We still need its length, but setting - // only the lowest bit is nondestructive. - allocation->length |= HOLE; + // Else it must be within the low or high ranges and becomes a hole. + node->length = ((node->length & ~FLAGS) | HOLE); } +done: + allocation->ptr = NULL; } supervisor_allocation* allocation_from_ptr(void *ptr) { + // When called from the context of supervisor_move_memory() (old_allocations != NULL), search + // by old pointer to give clients a way of mapping from old to new pointer. But not if + // ptr == NULL, then the caller wants an allocation whose current ptr is NULL. + supervisor_allocation* list = (old_allocations && ptr) ? old_allocations : &allocations[0]; for (size_t index = 0; index < CIRCUITPY_SUPERVISOR_ALLOC_COUNT; index++) { - if (allocations[index].ptr == ptr) { + if (list[index].ptr == ptr) { return &allocations[index]; } } @@ -106,50 +109,172 @@ supervisor_allocation* allocation_from_ptr(void *ptr) { } supervisor_allocation* allocate_remaining_memory(void) { - if (low_address == high_address) { - return NULL; + uint32_t* low_address = low_head ? low_head->data + low_head->length / 4 : port_heap_get_bottom(); + uint32_t* high_address = high_head ? (uint32_t*)high_head : port_heap_get_top(); + return allocate_memory((high_address - low_address) * 4 - sizeof(supervisor_allocation_node), false, false); +} + +static supervisor_allocation_node* find_hole(supervisor_allocation_node* node, size_t length) { + for (; node != NULL; node = node->next) { + if (node->length == (length | HOLE)) { + break; + } } - return allocate_memory((high_address - low_address) * 4, false); + return node; } -supervisor_allocation* allocate_memory(uint32_t length, bool high) { +static supervisor_allocation_node* allocate_memory_node(uint32_t length, bool high, bool movable) { + // supervisor_move_memory() currently does not support movable allocations on the high side, it + // must be extended first if this is ever needed. + assert(!(high && movable)); if (length == 0 || length % 4 != 0) { return NULL; } - uint8_t index = 0; - int8_t direction = 1; - if (high) { - index = CIRCUITPY_SUPERVISOR_ALLOC_COUNT - 1; - direction = -1; - } - supervisor_allocation* alloc; - for (; index < CIRCUITPY_SUPERVISOR_ALLOC_COUNT; index += direction) { - alloc = &allocations[index]; - if (alloc->length == FREE && (high_address - low_address) * 4 >= (int32_t) length) { - break; + // 1. Matching hole on the requested side? + supervisor_allocation_node* node = find_hole(high ? high_head : low_head, length); + if (!node) { + // 2. Enough free space in the middle? + uint32_t* low_address = low_head ? low_head->data + low_head->length / 4 : port_heap_get_bottom(); + uint32_t* high_address = high_head ? (uint32_t*)high_head : port_heap_get_top(); + if ((high_address - low_address) * 4 >= (int32_t)(sizeof(supervisor_allocation_node) + length)) { + if (high) { + high_address -= (sizeof(supervisor_allocation_node) + length) / 4; + node = (supervisor_allocation_node*)high_address; + node->next = high_head; + high_head = node; + } + else { + node = (supervisor_allocation_node*)low_address; + node->next = low_head; + low_head = node; + } } - // If a hole matches in length exactly, we can reuse it. - if (alloc->length == (length | HOLE)) { - alloc->length = length; - return alloc; + else { + // 3. Matching hole on the other side? + node = find_hole(high ? low_head : high_head, length); + if (!node) { + // 4. GC allocation? + if (movable && gc_alloc_possible()) { + node = m_malloc_maybe(sizeof(supervisor_allocation_node) + length, true); + if (node) { + node->next = MP_STATE_VM(first_embedded_allocation); + MP_STATE_VM(first_embedded_allocation) = node; + } + } + if (!node) { + // 5. Give up. + return NULL; + } + } } } - if (index >= CIRCUITPY_SUPERVISOR_ALLOC_COUNT) { + node->length = length; + if (movable) { + node->length |= MOVABLE; + } + return node; +} + +supervisor_allocation* allocate_memory(uint32_t length, bool high, bool movable) { + supervisor_allocation_node* node = allocate_memory_node(length, high, movable); + if (!node) { return NULL; } - if (high) { - high_address -= length / 4; - alloc->ptr = high_address; - } else { - alloc->ptr = low_address; - low_address += length / 4; + // Find the first free allocation. + supervisor_allocation* alloc = allocation_from_ptr(NULL); + if (!alloc) { + // We should free node again to avoid leaking, but something is wrong anyway if clients try + // to make more allocations than available, so don't bother. + return NULL; } - alloc->length = length; + alloc->ptr = &(node->data[0]); return alloc; } +size_t get_allocation_length(supervisor_allocation* allocation) { + return ALLOCATION_NODE(allocation)->length & ~FLAGS; +} + void supervisor_move_memory(void) { + // This must be called exactly after freeing the heap, so that the embedded allocations, if any, + // are now in the free region. + assert(MP_STATE_VM(first_embedded_allocation) == NULL || (low_head < MP_STATE_VM(first_embedded_allocation) && MP_STATE_VM(first_embedded_allocation) < high_head)); + + // Save the old pointers for allocation_from_ptr(). + supervisor_allocation old_allocations_array[CIRCUITPY_SUPERVISOR_ALLOC_COUNT]; + memcpy(old_allocations_array, allocations, sizeof(allocations)); + + // Compact the low side. Traverse the list repeatedly, finding movable allocations preceded by a + // hole and swapping them, until no more are found. This is not the most runtime-efficient way, + // but probably the shortest and simplest code. + bool acted; + do { + acted = false; + supervisor_allocation_node** nodep = &low_head; + while (*nodep != NULL && (*nodep)->next != NULL) { + if (((*nodep)->length & MOVABLE) && ((*nodep)->next->length & HOLE)) { + supervisor_allocation_node* oldnode = *nodep; + supervisor_allocation_node* start = oldnode->next; + supervisor_allocation* alloc = allocation_from_ptr(&(oldnode->data[0])); + assert(alloc != NULL); + alloc->ptr = &(start->data[0]); + oldnode->next = start->next; + size_t holelength = start->length; + size_t size = sizeof(supervisor_allocation_node) + (oldnode->length & ~FLAGS); + memmove(start, oldnode, size); + supervisor_allocation_node* newhole = (supervisor_allocation_node*)(void*)((char*)start + size); + newhole->next = start; + newhole->length = holelength; + *nodep = newhole; + acted = true; + } + nodep = &((*nodep)->next); + } + } while (acted); + // Any holes bubbled to the top can be absorbed into the free middle. + while (low_head != NULL && (low_head->length & HOLE)) { + low_head = low_head->next; + }; + + // Don't bother compacting the high side, there are no movable allocations and no holes there in + // current usage. + + // Promote the embedded allocations to top-level ones, compacting them at the beginning of the + // now free region (or possibly in matching holes). + // The linked list is unordered, but allocations must be processed in order to avoid risking + // overwriting each other. To that end, repeatedly find the lowest element of the list, remove + // it from the list, and process it. This ad-hoc selection sort results in substantially shorter + // code than using the qsort() function from the C library. + while (MP_STATE_VM(first_embedded_allocation)) { + // First element is first candidate. + supervisor_allocation_node** pminnode = &MP_STATE_VM(first_embedded_allocation); + // Iterate from second element (if any) on. + for (supervisor_allocation_node** pnode = &(MP_STATE_VM(first_embedded_allocation)->next); *pnode != NULL; pnode = &(*pnode)->next) { + if (*pnode < *pminnode) { + pminnode = pnode; + } + } + // Remove from list. + supervisor_allocation_node* node = *pminnode; + *pminnode = node->next; + // Process. + size_t length = (node->length & ~FLAGS); + supervisor_allocation* alloc = allocation_from_ptr(&(node->data[0])); + assert(alloc != NULL); + // This may overwrite the header of node if it happened to be there already, but not the + // data. + supervisor_allocation_node* new_node = allocate_memory_node(length, false, true); + // There must be enough free space. + assert(new_node != NULL); + memmove(&(new_node->data[0]), &(node->data[0]), length); + alloc->ptr = &(new_node->data[0]); + } + + // Notify clients that their movable allocations may have moved. + old_allocations = &old_allocations_array[0]; #if CIRCUITPY_DISPLAYIO supervisor_display_move_memory(); #endif + // Add calls to further clients here. + old_allocations = NULL; } diff --git a/supervisor/shared/stack.c b/supervisor/shared/stack.c index e7aa956b01612..afea204010d7e 100755 --- a/supervisor/shared/stack.c +++ b/supervisor/shared/stack.c @@ -34,36 +34,42 @@ extern uint32_t _estack; +// Requested size. static uint32_t next_stack_size = CIRCUITPY_DEFAULT_STACK_SIZE; static uint32_t current_stack_size = 0; -supervisor_allocation* stack_alloc = NULL; +// Actual location and size, may be larger than requested. +static uint32_t* stack_limit = NULL; +static size_t stack_length = 0; #define EXCEPTION_STACK_SIZE 1024 void allocate_stack(void) { - if (port_fixed_stack() != NULL) { - stack_alloc = port_fixed_stack(); - current_stack_size = stack_alloc->length; + if (port_has_fixed_stack()) { + stack_limit = port_stack_get_limit(); + stack_length = (port_stack_get_top() - stack_limit)*sizeof(uint32_t); + current_stack_size = stack_length; } else { mp_uint_t regs[10]; mp_uint_t sp = cpu_get_regs_and_sp(regs); mp_uint_t c_size = (uint32_t) port_stack_get_top() - sp; - stack_alloc = allocate_memory(c_size + next_stack_size + EXCEPTION_STACK_SIZE, true); + supervisor_allocation* stack_alloc = allocate_memory(c_size + next_stack_size + EXCEPTION_STACK_SIZE, true, false); if (stack_alloc == NULL) { - stack_alloc = allocate_memory(c_size + CIRCUITPY_DEFAULT_STACK_SIZE + EXCEPTION_STACK_SIZE, true); + stack_alloc = allocate_memory(c_size + CIRCUITPY_DEFAULT_STACK_SIZE + EXCEPTION_STACK_SIZE, true, false); current_stack_size = CIRCUITPY_DEFAULT_STACK_SIZE; } else { current_stack_size = next_stack_size; } + stack_limit = stack_alloc->ptr; + stack_length = get_allocation_length(stack_alloc); } - *stack_alloc->ptr = STACK_CANARY_VALUE; + *stack_limit = STACK_CANARY_VALUE; } inline bool stack_ok(void) { - return stack_alloc == NULL || *stack_alloc->ptr == STACK_CANARY_VALUE; + return stack_limit == NULL || *stack_limit == STACK_CANARY_VALUE; } inline void assert_heap_ok(void) { @@ -77,18 +83,26 @@ void stack_init(void) { } void stack_resize(void) { - if (stack_alloc == NULL) { + if (stack_limit == NULL) { return; } if (next_stack_size == current_stack_size) { - *stack_alloc->ptr = STACK_CANARY_VALUE; + *stack_limit = STACK_CANARY_VALUE; return; } - free_memory(stack_alloc); - stack_alloc = NULL; + free_memory(allocation_from_ptr(stack_limit)); + stack_limit = NULL; allocate_stack(); } +uint32_t* stack_get_bottom(void) { + return stack_limit; +} + +size_t stack_get_length(void) { + return stack_length; +} + void set_next_stack_size(uint32_t size) { next_stack_size = size; } diff --git a/supervisor/shared/stack.h b/supervisor/shared/stack.h index 7096f0b3edaf4..1c75de5f78ba0 100755 --- a/supervisor/shared/stack.h +++ b/supervisor/shared/stack.h @@ -31,10 +31,12 @@ #include "supervisor/memory.h" -extern supervisor_allocation* stack_alloc; - void stack_init(void); void stack_resize(void); +// Actual stack location and size, may be larger than requested. +uint32_t* stack_get_bottom(void); +size_t stack_get_length(void); +// Next/current requested stack size. void set_next_stack_size(uint32_t size); uint32_t get_current_stack_size(void); bool stack_ok(void); From 2ba9805f845e000fa3299e95e93a063471751ecd Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Sun, 11 Oct 2020 20:39:19 +0200 Subject: [PATCH 310/770] Use movable allocation system for terminal tilegrid. Moving memory is now done by the infrastructure and neither necessary nor correct here anymore. --- py/circuitpy_mpconfig.h | 1 - supervisor/shared/display.c | 43 +++++++++++++++---------------------- 2 files changed, 17 insertions(+), 27 deletions(-) diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 28fd6e9b00f17..34ea9b022fa2d 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -867,7 +867,6 @@ struct _supervisor_allocation_node; mp_obj_t rtc_time_source; \ GAMEPAD_ROOT_POINTERS \ mp_obj_t pew_singleton; \ - mp_obj_t terminal_tilegrid_tiles; \ BOARD_UART_ROOT_POINTER \ FLASH_ROOT_POINTERS \ MEMORYMONITOR_ROOT_POINTERS \ diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c index de45e2672f13f..9c9c66cd7fb69 100644 --- a/supervisor/shared/display.c +++ b/supervisor/shared/display.c @@ -81,19 +81,21 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) { uint16_t total_tiles = width_in_tiles * height_in_tiles; - // First try to allocate outside the heap. This will fail when the VM is running. - tilegrid_tiles = allocate_memory(align32_size(total_tiles), false, false); - uint8_t* tiles; - if (tilegrid_tiles == NULL) { - tiles = m_malloc(total_tiles, true); - MP_STATE_VM(terminal_tilegrid_tiles) = tiles; - } else { - tiles = (uint8_t*) tilegrid_tiles->ptr; + // Reuse the previous allocation if possible + if (tilegrid_tiles) { + if (get_allocation_length(tilegrid_tiles) != align32_size(total_tiles)) { + free_memory(tilegrid_tiles); + tilegrid_tiles = NULL; + } } - - if (tiles == NULL) { - return; + if (!tilegrid_tiles) { + tilegrid_tiles = allocate_memory(align32_size(total_tiles), false, true); + if (!tilegrid_tiles) { + return; + } } + uint8_t* tiles = (uint8_t*) tilegrid_tiles->ptr; + grid->y = tall ? blinka_bitmap.height : 0; grid->x = tall ? 0 : blinka_bitmap.width; grid->top_left_y = 0; @@ -120,7 +122,6 @@ void supervisor_stop_terminal(void) { if (tilegrid_tiles != NULL) { free_memory(tilegrid_tiles); tilegrid_tiles = NULL; - supervisor_terminal_text_grid.inline_tiles = false; supervisor_terminal_text_grid.tiles = NULL; } #endif @@ -128,20 +129,10 @@ void supervisor_stop_terminal(void) { void supervisor_display_move_memory(void) { #if CIRCUITPY_TERMINALIO - displayio_tilegrid_t* grid = &supervisor_terminal_text_grid; - if (MP_STATE_VM(terminal_tilegrid_tiles) != NULL && - grid->tiles == MP_STATE_VM(terminal_tilegrid_tiles)) { - uint16_t total_tiles = grid->width_in_tiles * grid->height_in_tiles; - - tilegrid_tiles = allocate_memory(align32_size(total_tiles), false, false); - if (tilegrid_tiles != NULL) { - memcpy(tilegrid_tiles->ptr, grid->tiles, total_tiles); - grid->tiles = (uint8_t*) tilegrid_tiles->ptr; - } else { - grid->tiles = NULL; - grid->inline_tiles = false; - } - MP_STATE_VM(terminal_tilegrid_tiles) = NULL; + if (tilegrid_tiles != NULL) { + supervisor_terminal_text_grid.tiles = (uint8_t*) tilegrid_tiles->ptr; + } else { + supervisor_terminal_text_grid.tiles = NULL; } #endif From ac91220361e402bbf6ebb741a9b6ea258a05da99 Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Fri, 16 Oct 2020 23:08:29 +0200 Subject: [PATCH 311/770] Use movable allocation system for Sharp display framebuffer. Hybrid allocation is now part of the infrastructure. Moving memory contents would not be necessary because displayio can recreate them, but does not hurt. --- .../sharpdisplay/SharpMemoryFramebuffer.c | 57 +++++-------------- .../sharpdisplay/SharpMemoryFramebuffer.h | 1 - 2 files changed, 14 insertions(+), 44 deletions(-) diff --git a/shared-module/sharpdisplay/SharpMemoryFramebuffer.c b/shared-module/sharpdisplay/SharpMemoryFramebuffer.c index aefb6b18de490..4b92bd637ac96 100644 --- a/shared-module/sharpdisplay/SharpMemoryFramebuffer.c +++ b/shared-module/sharpdisplay/SharpMemoryFramebuffer.c @@ -34,32 +34,10 @@ #include "shared-module/sharpdisplay/SharpMemoryFramebuffer.h" #include "supervisor/memory.h" -#include "supervisor/shared/safe_mode.h" #define SHARPMEM_BIT_WRITECMD_LSB (0x80) #define SHARPMEM_BIT_VCOM_LSB (0x40) -static void *hybrid_alloc(size_t sz) { - supervisor_allocation *allocation = allocate_memory(align32_size(sz), false, false); - if (allocation) { - memset(allocation->ptr, 0, sz); - return allocation->ptr; - } - if (gc_alloc_possible()) { - return m_malloc(sz, true); - } - reset_into_safe_mode(MEM_MANAGE); - return NULL; // unreached -} - -static inline void hybrid_free(void *ptr_in) { - supervisor_allocation *allocation = allocation_from_ptr(ptr_in); - - if (allocation) { - free_memory(allocation); - } -} - STATIC uint8_t bitrev(uint8_t n) { uint8_t r = 0; for(int i=0;i<8;i++) r |= ((n>>i) & 1)<<(7-i); @@ -102,9 +80,9 @@ void common_hal_sharpdisplay_framebuffer_reset(sharpdisplay_framebuffer_obj_t *s } void common_hal_sharpdisplay_framebuffer_reconstruct(sharpdisplay_framebuffer_obj_t *self) { - if (!allocation_from_ptr(self->bufinfo.buf)) { - self->bufinfo.buf = NULL; - } + // Look up the allocation by the old pointer and get the new pointer from it. + supervisor_allocation* alloc = allocation_from_ptr(self->bufinfo.buf); + self->bufinfo.buf = alloc ? alloc->ptr : NULL; } void common_hal_sharpdisplay_framebuffer_get_bufinfo(sharpdisplay_framebuffer_obj_t *self, mp_buffer_info_t *bufinfo) { @@ -112,7 +90,12 @@ void common_hal_sharpdisplay_framebuffer_get_bufinfo(sharpdisplay_framebuffer_ob int row_stride = common_hal_sharpdisplay_framebuffer_get_row_stride(self); int height = common_hal_sharpdisplay_framebuffer_get_height(self); self->bufinfo.len = row_stride * height + 2; - self->bufinfo.buf = hybrid_alloc(self->bufinfo.len); + supervisor_allocation* alloc = allocate_memory(align32_size(self->bufinfo.len), false, true); + if (alloc == NULL) { + m_malloc_fail(self->bufinfo.len); + } + self->bufinfo.buf = alloc->ptr; + memset(alloc->ptr, 0, self->bufinfo.len); uint8_t *data = self->bufinfo.buf; *data++ = SHARPMEM_BIT_WRITECMD_LSB; @@ -123,7 +106,9 @@ void common_hal_sharpdisplay_framebuffer_get_bufinfo(sharpdisplay_framebuffer_ob } self->full_refresh = true; } - *bufinfo = self->bufinfo; + if (bufinfo) { + *bufinfo = self->bufinfo; + } } void common_hal_sharpdisplay_framebuffer_deinit(sharpdisplay_framebuffer_obj_t *self) { @@ -137,7 +122,7 @@ void common_hal_sharpdisplay_framebuffer_deinit(sharpdisplay_framebuffer_obj_t * common_hal_reset_pin(self->chip_select.pin); - hybrid_free(self->bufinfo.buf); + free_memory(allocation_from_ptr(self->bufinfo.buf)); memset(self, 0, sizeof(*self)); } @@ -154,19 +139,7 @@ void common_hal_sharpdisplay_framebuffer_construct(sharpdisplay_framebuffer_obj_ self->height = height; self->baudrate = baudrate; - int row_stride = common_hal_sharpdisplay_framebuffer_get_row_stride(self); - self->bufinfo.len = row_stride * height + 2; - // re-use a supervisor allocation if possible - self->bufinfo.buf = hybrid_alloc(self->bufinfo.len); - - uint8_t *data = self->bufinfo.buf; - *data++ = SHARPMEM_BIT_WRITECMD_LSB; - - for(int y=0; yheight; y++) { - *data = bitrev(y+1); - data += row_stride; - } - self->full_refresh = true; + common_hal_sharpdisplay_framebuffer_get_bufinfo(self, NULL); } void common_hal_sharpdisplay_framebuffer_swapbuffers(sharpdisplay_framebuffer_obj_t *self, uint8_t *dirty_row_bitmask) { @@ -271,7 +244,5 @@ const framebuffer_p_t sharpdisplay_framebuffer_proto = { }; void common_hal_sharpdisplay_framebuffer_collect_ptrs(sharpdisplay_framebuffer_obj_t *self) { - gc_collect_ptr(self->framebuffer); gc_collect_ptr(self->bus); - gc_collect_ptr(self->bufinfo.buf); } diff --git a/shared-module/sharpdisplay/SharpMemoryFramebuffer.h b/shared-module/sharpdisplay/SharpMemoryFramebuffer.h index 8acacc94e1122..08966a89c1f35 100644 --- a/shared-module/sharpdisplay/SharpMemoryFramebuffer.h +++ b/shared-module/sharpdisplay/SharpMemoryFramebuffer.h @@ -33,7 +33,6 @@ typedef struct { mp_obj_base_t base; - mp_obj_t framebuffer; busio_spi_obj_t* bus; busio_spi_obj_t inline_bus; digitalio_digitalinout_obj_t chip_select; From a4b84cf0e118f06cc3b563866d5c594b94b9b3fb Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Sat, 17 Oct 2020 13:49:10 +0200 Subject: [PATCH 312/770] Use movable allocation system for RGBMatrix allocations. Hybrid allocation is now part of the infrastructure. Moving memory contents would not be necessary because displayio can recreate them, but does not hurt. --- shared-module/rgbmatrix/RGBMatrix.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/shared-module/rgbmatrix/RGBMatrix.c b/shared-module/rgbmatrix/RGBMatrix.c index 1f144aedb5f36..a09767b62267e 100644 --- a/shared-module/rgbmatrix/RGBMatrix.c +++ b/shared-module/rgbmatrix/RGBMatrix.c @@ -78,10 +78,10 @@ void common_hal_rgbmatrix_rgbmatrix_reconstruct(rgbmatrix_rgbmatrix_obj_t* self, // verify that the matrix is big enough mp_get_index(mp_obj_get_type(self->framebuffer), self->bufinfo.len, MP_OBJ_NEW_SMALL_INT(self->bufsize-1), false); } else { - _PM_free(self->bufinfo.buf); - _PM_free(self->protomatter.rgbPins); - _PM_free(self->protomatter.addr); - _PM_free(self->protomatter.screenData); + common_hal_rgbmatrix_free_impl(self->bufinfo.buf); + common_hal_rgbmatrix_free_impl(self->protomatter.rgbPins); + common_hal_rgbmatrix_free_impl(self->protomatter.addr); + common_hal_rgbmatrix_free_impl(self->protomatter.screenData); self->framebuffer = NULL; self->bufinfo.buf = common_hal_rgbmatrix_allocator_impl(self->bufsize); @@ -180,9 +180,6 @@ void common_hal_rgbmatrix_rgbmatrix_deinit(rgbmatrix_rgbmatrix_obj_t* self) { void rgbmatrix_rgbmatrix_collect_ptrs(rgbmatrix_rgbmatrix_obj_t* self) { gc_collect_ptr(self->framebuffer); - gc_collect_ptr(self->protomatter.rgbPins); - gc_collect_ptr(self->protomatter.addr); - gc_collect_ptr(self->protomatter.screenData); } void common_hal_rgbmatrix_rgbmatrix_set_paused(rgbmatrix_rgbmatrix_obj_t* self, bool paused) { @@ -217,18 +214,10 @@ int common_hal_rgbmatrix_rgbmatrix_get_height(rgbmatrix_rgbmatrix_obj_t* self) { } void *common_hal_rgbmatrix_allocator_impl(size_t sz) { - if (gc_alloc_possible()) { - return m_malloc_maybe(sz + sizeof(void*), true); - } else { - supervisor_allocation *allocation = allocate_memory(align32_size(sz), false, false); - return allocation ? allocation->ptr : NULL; - } + supervisor_allocation *allocation = allocate_memory(align32_size(sz), false, true); + return allocation ? allocation->ptr : NULL; } void common_hal_rgbmatrix_free_impl(void *ptr_in) { - supervisor_allocation *allocation = allocation_from_ptr(ptr_in); - - if (allocation) { - free_memory(allocation); - } + free_memory(allocation_from_ptr(ptr_in)); } From 7ca36d45a4ffe40c70814d62cb970007b7f40fee Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Fri, 23 Oct 2020 22:35:56 +0200 Subject: [PATCH 313/770] Fix align32_size(). It not only caused crashes with requests larger than 64K (can happen with RGBMatrix), but also generated a lot longer code than necessary. --- shared-module/usb_midi/__init__.c | 6 +++--- supervisor/memory.h | 7 ++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/shared-module/usb_midi/__init__.c b/shared-module/usb_midi/__init__.c index 5afdd18213265..3fb3f836cd763 100644 --- a/shared-module/usb_midi/__init__.c +++ b/shared-module/usb_midi/__init__.c @@ -40,9 +40,9 @@ supervisor_allocation* usb_midi_allocation; void usb_midi_init(void) { // TODO(tannewt): Make this dynamic. - uint16_t tuple_size = align32_size(sizeof(mp_obj_tuple_t) + sizeof(mp_obj_t*) * 2); - uint16_t portin_size = align32_size(sizeof(usb_midi_portin_obj_t)); - uint16_t portout_size = align32_size(sizeof(usb_midi_portout_obj_t)); + size_t tuple_size = align32_size(sizeof(mp_obj_tuple_t) + sizeof(mp_obj_t*) * 2); + size_t portin_size = align32_size(sizeof(usb_midi_portin_obj_t)); + size_t portout_size = align32_size(sizeof(usb_midi_portout_obj_t)); // For each embedded MIDI Jack in the descriptor we create a Port usb_midi_allocation = allocate_memory(tuple_size + portin_size + portout_size, false, false); diff --git a/supervisor/memory.h b/supervisor/memory.h index 4307e3f21d556..0f820eac1c475 100755 --- a/supervisor/memory.h +++ b/supervisor/memory.h @@ -64,11 +64,8 @@ supervisor_allocation* allocate_remaining_memory(void); // supervisor_move_memory(). supervisor_allocation* allocate_memory(uint32_t length, bool high_address, bool movable); -static inline uint16_t align32_size(uint16_t size) { - if (size % 4 != 0) { - return (size & 0xfffc) + 0x4; - } - return size; +static inline size_t align32_size(size_t size) { + return (size + 3) & ~3; } size_t get_allocation_length(supervisor_allocation* allocation); From 993a581f5e8c039b562bbacdf17615162d8a85f6 Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Wed, 28 Oct 2020 21:50:28 +0100 Subject: [PATCH 314/770] Make CIRCUITPY_SUPERVISOR_ALLOC_COUNT dependent on enabled features. Avoids wasted memory and makes it easier to keep track of who needs how much for future additions. --- supervisor/shared/memory.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/supervisor/shared/memory.c b/supervisor/shared/memory.c index 2be3b42d63f94..1760b9bd67a70 100755 --- a/supervisor/shared/memory.c +++ b/supervisor/shared/memory.c @@ -32,7 +32,32 @@ #include "py/gc.h" #include "supervisor/shared/display.h" -#define CIRCUITPY_SUPERVISOR_ALLOC_COUNT (12) +enum { + CIRCUITPY_SUPERVISOR_ALLOC_COUNT = + // stack + heap + 2 +#ifdef EXTERNAL_FLASH_DEVICES + + 1 +#endif +#if CIRCUITPY_USB_MIDI + + 1 +#endif +#if CIRCUITPY_DISPLAYIO + #if CIRCUITPY_TERMINALIO + + 1 + #endif + + CIRCUITPY_DISPLAY_LIMIT * ( + // Maximum needs of one display: max(4 if RGBMATRIX, 1 if SHARPDISPLAY, 0) + #if CIRCUITPY_RGBMATRIX + 4 + #elif CIRCUITPY_SHARPDISPLAY + 1 + #else + 0 + #endif + ) +#endif +}; // The lowest two bits of a valid length are always zero, so we can use them to mark an allocation // as a hole (freed by the client but not yet reclaimed into the free middle) and as movable. From 848eb2813247edc555bbef34ff2505f12094ef4e Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sat, 28 Nov 2020 14:52:56 -0500 Subject: [PATCH 315/770] esp-uart-pins --- ports/atmel-samd/boards/pybadge_airlift/pins.c | 4 +++- ports/atmel-samd/boards/pyportal/pins.c | 2 ++ ports/atmel-samd/boards/pyportal_titano/pins.c | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ports/atmel-samd/boards/pybadge_airlift/pins.c b/ports/atmel-samd/boards/pybadge_airlift/pins.c index d39650246047e..399c634413909 100644 --- a/ports/atmel-samd/boards/pybadge_airlift/pins.c +++ b/ports/atmel-samd/boards/pybadge_airlift/pins.c @@ -30,8 +30,10 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { {MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA22)}, {MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA23)}, - // UART + // ESP UART + {MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_PB17)}, {MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB17)}, + {MP_OBJ_NEW_QSTR(MP_QSTR_ESP_TX), MP_ROM_PTR(&pin_PB16)}, {MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB16)}, // I2C diff --git a/ports/atmel-samd/boards/pyportal/pins.c b/ports/atmel-samd/boards/pyportal/pins.c index 14699a209db01..36140427cb384 100644 --- a/ports/atmel-samd/boards/pyportal/pins.c +++ b/ports/atmel-samd/boards/pyportal/pins.c @@ -61,7 +61,9 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { // UART { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_TX), MP_ROM_PTR(&pin_PB12) }, { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_PB13) }, // SPI { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_PA12) }, diff --git a/ports/atmel-samd/boards/pyportal_titano/pins.c b/ports/atmel-samd/boards/pyportal_titano/pins.c index 14699a209db01..cf8dfbbb2706a 100644 --- a/ports/atmel-samd/boards/pyportal_titano/pins.c +++ b/ports/atmel-samd/boards/pyportal_titano/pins.c @@ -59,8 +59,11 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RESET), MP_ROM_PTR(&pin_PB17) }, { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RTS), MP_ROM_PTR(&pin_PA15) }, - // UART + // ESP UART + { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_TX), MP_ROM_PTR(&pin_PB12) }, { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB12) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_PB13) }, { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB13) }, // SPI From bde1c4166d08bd9530b1dc4dcf3bfff7f3e33bca Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Sat, 28 Nov 2020 23:09:05 +0100 Subject: [PATCH 316/770] Revert "Prevent exceptions from accumulating in REPL" This reverts commit 0cd951fb73198f5c3dd03ea0463382edac0d3d4d. It is not a correct solution because it prevents printing the same exception twice. --- py/obj.c | 1 - 1 file changed, 1 deletion(-) diff --git a/py/obj.c b/py/obj.c index d8e34746cad71..b6462641ce01c 100644 --- a/py/obj.c +++ b/py/obj.c @@ -125,7 +125,6 @@ void mp_obj_print_exception(const mp_print_t *print, mp_obj_t exc) { mp_printf(print, decompressed_block, block); } } - mp_obj_exception_clear_traceback(exc); } } mp_obj_print_helper(print, exc, PRINT_EXC); From 9ecaa16eced40f3f56ba67737aed3f0950c5164f Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Sun, 29 Nov 2020 16:04:31 +0100 Subject: [PATCH 317/770] Unify redundant low/high_address computation to save a bit of code size. --- supervisor/shared/memory.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/supervisor/shared/memory.c b/supervisor/shared/memory.c index 1760b9bd67a70..acace7f890fc7 100755 --- a/supervisor/shared/memory.c +++ b/supervisor/shared/memory.c @@ -134,9 +134,7 @@ supervisor_allocation* allocation_from_ptr(void *ptr) { } supervisor_allocation* allocate_remaining_memory(void) { - uint32_t* low_address = low_head ? low_head->data + low_head->length / 4 : port_heap_get_bottom(); - uint32_t* high_address = high_head ? (uint32_t*)high_head : port_heap_get_top(); - return allocate_memory((high_address - low_address) * 4 - sizeof(supervisor_allocation_node), false, false); + return allocate_memory((uint32_t)-1, false, false); } static supervisor_allocation_node* find_hole(supervisor_allocation_node* node, size_t length) { @@ -152,6 +150,12 @@ static supervisor_allocation_node* allocate_memory_node(uint32_t length, bool hi // supervisor_move_memory() currently does not support movable allocations on the high side, it // must be extended first if this is ever needed. assert(!(high && movable)); + uint32_t* low_address = low_head ? low_head->data + low_head->length / 4 : port_heap_get_bottom(); + uint32_t* high_address = high_head ? (uint32_t*)high_head : port_heap_get_top(); + // Special case for allocate_remaining_memory(), avoids computing low/high_address twice. + if (length == (uint32_t)-1) { + length = (high_address - low_address) * 4 - sizeof(supervisor_allocation_node); + } if (length == 0 || length % 4 != 0) { return NULL; } @@ -159,8 +163,6 @@ static supervisor_allocation_node* allocate_memory_node(uint32_t length, bool hi supervisor_allocation_node* node = find_hole(high ? high_head : low_head, length); if (!node) { // 2. Enough free space in the middle? - uint32_t* low_address = low_head ? low_head->data + low_head->length / 4 : port_heap_get_bottom(); - uint32_t* high_address = high_head ? (uint32_t*)high_head : port_heap_get_top(); if ((high_address - low_address) * 4 >= (int32_t)(sizeof(supervisor_allocation_node) + length)) { if (high) { high_address -= (sizeof(supervisor_allocation_node) + length) / 4; From 11ed6f86f02f61ace55951d2fff62a9d36cf3ac7 Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Sun, 29 Nov 2020 16:27:36 +0100 Subject: [PATCH 318/770] Optimize out allocation moving code on boards that don't need it. When no features are enabled that use movable allocations, supervisor_move_memory() is not needed. --- supervisor/shared/memory.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/supervisor/shared/memory.c b/supervisor/shared/memory.c index acace7f890fc7..bc82804b70ef8 100755 --- a/supervisor/shared/memory.c +++ b/supervisor/shared/memory.c @@ -33,7 +33,7 @@ #include "supervisor/shared/display.h" enum { - CIRCUITPY_SUPERVISOR_ALLOC_COUNT = + CIRCUITPY_SUPERVISOR_IMMOVABLE_ALLOC_COUNT = // stack + heap 2 #ifdef EXTERNAL_FLASH_DEVICES @@ -42,6 +42,9 @@ enum { #if CIRCUITPY_USB_MIDI + 1 #endif + , + CIRCUITPY_SUPERVISOR_MOVABLE_ALLOC_COUNT = + 0 #if CIRCUITPY_DISPLAYIO #if CIRCUITPY_TERMINALIO + 1 @@ -57,6 +60,8 @@ enum { #endif ) #endif + , + CIRCUITPY_SUPERVISOR_ALLOC_COUNT = CIRCUITPY_SUPERVISOR_IMMOVABLE_ALLOC_COUNT + CIRCUITPY_SUPERVISOR_MOVABLE_ALLOC_COUNT }; // The lowest two bits of a valid length are always zero, so we can use them to mark an allocation @@ -147,6 +152,9 @@ static supervisor_allocation_node* find_hole(supervisor_allocation_node* node, s } static supervisor_allocation_node* allocate_memory_node(uint32_t length, bool high, bool movable) { + if (CIRCUITPY_SUPERVISOR_MOVABLE_ALLOC_COUNT == 0) { + assert(!movable); + } // supervisor_move_memory() currently does not support movable allocations on the high side, it // must be extended first if this is ever needed. assert(!(high && movable)); @@ -223,6 +231,11 @@ size_t get_allocation_length(supervisor_allocation* allocation) { } void supervisor_move_memory(void) { + // This whole function is not needed when there are no movable allocations, let it be optimized + // out. + if (CIRCUITPY_SUPERVISOR_MOVABLE_ALLOC_COUNT == 0) { + return; + } // This must be called exactly after freeing the heap, so that the embedded allocations, if any, // are now in the free region. assert(MP_STATE_VM(first_embedded_allocation) == NULL || (low_head < MP_STATE_VM(first_embedded_allocation) && MP_STATE_VM(first_embedded_allocation) < high_head)); From 9768951a2a42fd69f1f1adb0378a47e781d2fad7 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sat, 28 Nov 2020 10:12:46 -0500 Subject: [PATCH 319/770] Disable complex arithmetic on SAMD21 builds to make space --- ports/atmel-samd/mpconfigport.h | 1 + py/circuitpy_mpconfig.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/ports/atmel-samd/mpconfigport.h b/ports/atmel-samd/mpconfigport.h index ed10da9b9d4bc..bce89e0b99290 100644 --- a/ports/atmel-samd/mpconfigport.h +++ b/ports/atmel-samd/mpconfigport.h @@ -42,6 +42,7 @@ #define CIRCUITPY_MCU_FAMILY samd21 #define MICROPY_PY_SYS_PLATFORM "Atmel SAMD21" #define SPI_FLASH_MAX_BAUDRATE 8000000 +#define MICROPY_PY_BUILTINS_COMPLEX (0) #define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0) #define MICROPY_PY_FUNCTION_ATTRS (0) // MICROPY_PY_UJSON depends on MICROPY_PY_IO diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 28fd4095c4621..fa7095c78d311 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -188,7 +188,9 @@ typedef long mp_off_t; #define MICROPY_COMP_FSTRING_LITERAL (MICROPY_CPYTHON_COMPAT) #define MICROPY_MODULE_WEAK_LINKS (0) #define MICROPY_PY_ALL_SPECIAL_METHODS (CIRCUITPY_FULL_BUILD) +#ifndef MICROPY_PY_BUILTINS_COMPLEX #define MICROPY_PY_BUILTINS_COMPLEX (CIRCUITPY_FULL_BUILD) +#endif #define MICROPY_PY_BUILTINS_FROZENSET (CIRCUITPY_FULL_BUILD) #define MICROPY_PY_BUILTINS_STR_CENTER (CIRCUITPY_FULL_BUILD) #define MICROPY_PY_BUILTINS_STR_PARTITION (CIRCUITPY_FULL_BUILD) From dbfabddf58338c5442ee725c9c904d7960c03b1a Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 30 Nov 2020 11:11:04 -0500 Subject: [PATCH 320/770] rename ESP TX and RX pins; remove support --- ports/atmel-samd/boards/pybadge_airlift/mpconfigboard.h | 3 --- ports/atmel-samd/boards/pybadge_airlift/pins.c | 9 ++------- ports/atmel-samd/boards/pyportal/mpconfigboard.h | 3 --- ports/atmel-samd/boards/pyportal/pins.c | 5 ----- ports/atmel-samd/boards/pyportal_titano/mpconfigboard.h | 3 --- ports/atmel-samd/boards/pyportal_titano/pins.c | 6 ------ 6 files changed, 2 insertions(+), 27 deletions(-) diff --git a/ports/atmel-samd/boards/pybadge_airlift/mpconfigboard.h b/ports/atmel-samd/boards/pybadge_airlift/mpconfigboard.h index c6ab4ed8e06bf..a37d7ceec44dd 100644 --- a/ports/atmel-samd/boards/pybadge_airlift/mpconfigboard.h +++ b/ports/atmel-samd/boards/pybadge_airlift/mpconfigboard.h @@ -23,9 +23,6 @@ #define DEFAULT_SPI_BUS_MOSI (&pin_PB23) #define DEFAULT_SPI_BUS_MISO (&pin_PB22) -#define DEFAULT_UART_BUS_RX (&pin_PB17) -#define DEFAULT_UART_BUS_TX (&pin_PB16) - // 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/pybadge_airlift/pins.c b/ports/atmel-samd/boards/pybadge_airlift/pins.c index 399c634413909..9ee579be14536 100644 --- a/ports/atmel-samd/boards/pybadge_airlift/pins.c +++ b/ports/atmel-samd/boards/pybadge_airlift/pins.c @@ -30,12 +30,6 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { {MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA22)}, {MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA23)}, - // ESP UART - {MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_PB17)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB17)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_ESP_TX), MP_ROM_PTR(&pin_PB16)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB16)}, - // I2C {MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA12)}, {MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA13)}, @@ -60,6 +54,8 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { {MP_OBJ_NEW_QSTR(MP_QSTR_ESP_GPIO0), MP_ROM_PTR(&pin_PA31)}, {MP_OBJ_NEW_QSTR(MP_QSTR_ESP_BUSY), MP_ROM_PTR(&pin_PA00)}, {MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RESET), MP_ROM_PTR(&pin_PB12)}, + {MP_OBJ_NEW_QSTR(MP_QSTR_ESP_TX), MP_ROM_PTR(&pin_PB16)}, + {MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_PB17)}, // TFT control pins {MP_OBJ_NEW_QSTR(MP_QSTR_TFT_LITE), MP_ROM_PTR(&pin_PA01)}, @@ -71,7 +67,6 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { {MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj)}, {MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj)}, - {MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj)}, {MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)}}; MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); diff --git a/ports/atmel-samd/boards/pyportal/mpconfigboard.h b/ports/atmel-samd/boards/pyportal/mpconfigboard.h index 2c4cf4f580c0f..00c376ad90bd5 100644 --- a/ports/atmel-samd/boards/pyportal/mpconfigboard.h +++ b/ports/atmel-samd/boards/pyportal/mpconfigboard.h @@ -24,9 +24,6 @@ #define DEFAULT_SPI_BUS_MOSI (&pin_PA12) #define DEFAULT_SPI_BUS_MISO (&pin_PA14) -#define DEFAULT_UART_BUS_RX (&pin_PB13) -#define DEFAULT_UART_BUS_TX (&pin_PB12) - // 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/pyportal/pins.c b/ports/atmel-samd/boards/pyportal/pins.c index 36140427cb384..461ee98da5e81 100644 --- a/ports/atmel-samd/boards/pyportal/pins.c +++ b/ports/atmel-samd/boards/pyportal/pins.c @@ -58,11 +58,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_BUSY), MP_ROM_PTR(&pin_PB16) }, { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RESET), MP_ROM_PTR(&pin_PB17) }, { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RTS), MP_ROM_PTR(&pin_PA15) }, - - // UART - { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB12) }, { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_TX), MP_ROM_PTR(&pin_PB12) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB13) }, { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_PB13) }, // SPI @@ -80,7 +76,6 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, - { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display) }, }; diff --git a/ports/atmel-samd/boards/pyportal_titano/mpconfigboard.h b/ports/atmel-samd/boards/pyportal_titano/mpconfigboard.h index 4d58b8183907d..a76f1db5c846b 100644 --- a/ports/atmel-samd/boards/pyportal_titano/mpconfigboard.h +++ b/ports/atmel-samd/boards/pyportal_titano/mpconfigboard.h @@ -22,9 +22,6 @@ #define DEFAULT_SPI_BUS_MOSI (&pin_PA12) #define DEFAULT_SPI_BUS_MISO (&pin_PA14) -#define DEFAULT_UART_BUS_RX (&pin_PB13) -#define DEFAULT_UART_BUS_TX (&pin_PB12) - // 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/pyportal_titano/pins.c b/ports/atmel-samd/boards/pyportal_titano/pins.c index cf8dfbbb2706a..461ee98da5e81 100644 --- a/ports/atmel-samd/boards/pyportal_titano/pins.c +++ b/ports/atmel-samd/boards/pyportal_titano/pins.c @@ -58,13 +58,8 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_BUSY), MP_ROM_PTR(&pin_PB16) }, { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RESET), MP_ROM_PTR(&pin_PB17) }, { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RTS), MP_ROM_PTR(&pin_PA15) }, - - // ESP UART { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_TX), MP_ROM_PTR(&pin_PB12) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB12) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_PB13) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB13) }, // SPI { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_PA12) }, @@ -81,7 +76,6 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, - { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display) }, }; From 5e5045ddf1ed0ca88fface94c17c7af123ee6ff4 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Sun, 29 Nov 2020 10:02:13 +0000 Subject: [PATCH 321/770] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (864 of 864 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 8f899a12c46b4..36b1317d7a252 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-24 15:40-0500\n" -"PO-Revision-Date: 2020-11-24 23:22+0000\n" +"PO-Revision-Date: 2020-11-30 18:06+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -1451,7 +1451,7 @@ msgstr "Somente os endereços IPv4 são suportados" #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Only IPv4 sockets supported" -msgstr "" +msgstr "Apenas soquetes IPv4 são suportados" #: shared-module/displayio/OnDiskBitmap.c #, c-format From f65449027a037627cd639501a11d3a754abb0ddf Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Mon, 30 Nov 2020 14:49:04 +0000 Subject: [PATCH 322/770] Translated using Weblate (Swedish) Currently translated at 100.0% (864 of 864 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 66 ++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 66c1f345a2329..47739e4aa1d3e 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-24 15:40-0500\n" -"PO-Revision-Date: 2020-11-20 22:28+0000\n" +"PO-Revision-Date: 2020-11-30 18:06+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -871,7 +871,7 @@ msgstr "FFT är enbart definierade för ndarrays" #: extmod/ulab/code/fft/fft.c msgid "FFT is implemented for linear arrays only" -msgstr "" +msgstr "FTT är enbart implementerad för linjära matriser" #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" @@ -1282,7 +1282,7 @@ msgstr "Måste använda ett multipel av 6 rgb-pinnar, inte %d" #: ports/esp32s2/common-hal/nvm/ByteArray.c msgid "NVS Error" -msgstr "" +msgstr "NVS-fel" #: py/parse.c msgid "Name too long" @@ -1442,7 +1442,7 @@ msgstr "Endast IPv4-adresser stöds" #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Only IPv4 sockets supported" -msgstr "" +msgstr "Endast IPv4-socket stöds" #: shared-module/displayio/OnDiskBitmap.c #, c-format @@ -2099,7 +2099,7 @@ msgstr "argumentet argsort måste vara en ndarray" #: extmod/ulab/code/numerical/numerical.c msgid "argsort is not implemented for flattened arrays" -msgstr "" +msgstr "argsort är inte implementerad för tillplattade matriser" #: py/runtime.c msgid "argument has wrong type" @@ -2124,7 +2124,7 @@ msgstr "argumenten måste vara ndarray" #: extmod/ulab/code/ndarray.c msgid "array and index length must be equal" -msgstr "" +msgstr "array och indexlängd måste vara lika" #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2132,7 +2132,7 @@ msgstr "array/bytes krävs på höger sida" #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" -msgstr "" +msgstr "försök att läsa (arg)min/(arg)max av tom sekvens" #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" @@ -2144,15 +2144,15 @@ msgstr "attribut stöds inte än" #: extmod/ulab/code/numerical/numerical.c msgid "axis is out of bounds" -msgstr "" +msgstr "axis är utanför gränsen" #: extmod/ulab/code/numerical/numerical.c msgid "axis must be None, or an integer" -msgstr "" +msgstr "axis måste vara None eller ett heltal" #: extmod/ulab/code/numerical/numerical.c msgid "axis too long" -msgstr "" +msgstr "axis för lång" #: py/builtinevex.c msgid "bad compile mode" @@ -2359,7 +2359,7 @@ msgstr "" #: extmod/ulab/code/ndarray_operators.c msgid "cannot cast output with casting rule" -msgstr "" +msgstr "kan inte casta utdata med regel" #: py/objtype.c msgid "cannot create '%q' instances" @@ -2459,7 +2459,7 @@ msgstr "kan inte avgöra SD-kortversion" #: extmod/ulab/code/numerical/numerical.c msgid "cross is defined for 1D arrays of length 3" -msgstr "" +msgstr "cross är definierad för 1D-matriser med längd 3" #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" @@ -2503,7 +2503,7 @@ msgstr "argumentet diff måste vara en ndarray" #: extmod/ulab/code/numerical/numerical.c msgid "differentiation order out of range" -msgstr "" +msgstr "differentieringsordning utanför intervallet" #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c @@ -2622,7 +2622,7 @@ msgstr "första argumentet måste vara en funktion" #: extmod/ulab/code/ulab_create.c msgid "first argument must be a tuple of ndarrays" -msgstr "" +msgstr "första argumentet måste vara en tupel av ndarray" #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" @@ -2679,7 +2679,7 @@ msgstr "funktionen har samma teckenvärden vid slutet av intervall" #: extmod/ulab/code/ndarray.c msgid "function is defined for ndarrays only" -msgstr "" +msgstr "funktionen är enbart definierad för ndarray" #: py/argcheck.c #, c-format @@ -2775,7 +2775,7 @@ msgstr "inline assembler måste vara en funktion" #: extmod/ulab/code/ndarray.c msgid "input and output shapes are not compatible" -msgstr "" +msgstr "indata- och utdataformer är inte kompatibla" #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" @@ -2787,7 +2787,7 @@ msgstr "indataarraylängden måste vara en multipel av 2" #: extmod/ulab/code/ulab_create.c msgid "input arrays are not compatible" -msgstr "" +msgstr "indatamatriser är inte kompatibla" #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" @@ -2803,19 +2803,19 @@ msgstr "indatamatrisen är singulär" #: extmod/ulab/code/user/user.c msgid "input must be a dense ndarray" -msgstr "" +msgstr "indata måste vara en dense ndarray" #: extmod/ulab/code/ulab_create.c msgid "input must be a tensor of rank 2" -msgstr "" +msgstr "indata måste vara en tensor av rank 2" #: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c msgid "input must be an ndarray" -msgstr "" +msgstr "indata måste vara en ndarray" #: extmod/ulab/code/filter/filter.c msgid "input must be one-dimensional" -msgstr "" +msgstr "indata måste vara endimensionell" #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" @@ -2831,7 +2831,7 @@ msgstr "indatavektorer måste ha samma längd" #: extmod/ulab/code/poly/poly.c msgid "inputs are not iterable" -msgstr "" +msgstr "indata är inte iterbara" #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" @@ -3006,7 +3006,7 @@ msgstr "max_length måste vara > 0" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" -msgstr "" +msgstr "maximalt antal dimensioner är 4" #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3141,7 +3141,7 @@ msgstr "icke nyckelord arg efter nyckelord arg" #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" -msgstr "" +msgstr "norm är definierad för 1D- och 2D-matriser" #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" @@ -3209,7 +3209,7 @@ msgstr "sträng har udda längd" #: extmod/ulab/code/ulab_create.c msgid "offset is too large" -msgstr "" +msgstr "offset är för stor" #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" @@ -3235,11 +3235,11 @@ msgstr "operander kan inte sändas tillsammans" #: extmod/ulab/code/ndarray.c msgid "operation is implemented for 1D Boolean arrays only" -msgstr "" +msgstr "operationen är enbart implementerad för 1D Boolean-matriser" #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented for flattened array" -msgstr "" +msgstr "operationen inte implementeras för tillplattad matris" #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" @@ -3378,7 +3378,7 @@ msgstr "begärd längd %d men objektet har längden %d" #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" -msgstr "" +msgstr "resultaten kan inte castas till angiven typ" #: py/compile.c msgid "return annotation must be an identifier" @@ -3400,7 +3400,7 @@ msgstr "rgb_pins[%d] är inte på samma port som en klocka" #: extmod/ulab/code/numerical/numerical.c msgid "roll argument must be an ndarray" -msgstr "" +msgstr "argumentet roll måste vara en ndarray" #: py/objstr.c msgid "rsplit(None,n)" @@ -3428,7 +3428,7 @@ msgstr "skriptkompilering stöds inte" #: extmod/ulab/code/ndarray.c msgid "shape must be a tuple" -msgstr "" +msgstr "shape måste vara en tuple" #: py/objstr.c msgid "sign not allowed in string format specifier" @@ -3577,7 +3577,7 @@ msgstr "timestamp utom räckvidd för plattformens \"time_t\"" #: extmod/ulab/code/ndarray.c msgid "tobytes can be invoked for dense arrays only" -msgstr "" +msgstr "tobyte kan enbart anropas för täta matriser" #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" @@ -3756,11 +3756,11 @@ msgstr "window måste vara <= interval" #: extmod/ulab/code/numerical/numerical.c msgid "wrong axis index" -msgstr "" +msgstr "fel axelindex" #: extmod/ulab/code/ulab_create.c msgid "wrong axis specified" -msgstr "" +msgstr "fel axel angiven" #: extmod/ulab/code/vector/vectorise.c msgid "wrong input type" From 205d135e1a6cebed18ff809a5676f5d667ad677d Mon Sep 17 00:00:00 2001 From: vkuthan Date: Sun, 29 Nov 2020 20:13:26 +0000 Subject: [PATCH 323/770] Translated using Weblate (Czech) Currently translated at 1.8% (16 of 864 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/cs/ --- locale/cs.po | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/locale/cs.po b/locale/cs.po index a77a655a62973..05b5942fc5b42 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -6,15 +6,15 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-24 15:40-0500\n" -"PO-Revision-Date: 2020-05-24 03:22+0000\n" -"Last-Translator: dronecz \n" +"PO-Revision-Date: 2020-11-30 18:06+0000\n" +"Last-Translator: vkuthan \n" "Language-Team: LANGUAGE \n" "Language: cs\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" -"X-Generator: Weblate 4.1-dev\n" +"X-Generator: Weblate 4.4-dev\n" #: main.c msgid "" @@ -74,7 +74,7 @@ msgstr "%q index je mimo rozsah" #: py/obj.c msgid "%q indices must be integers, not %q" -msgstr "" +msgstr "%q indexy musí být celá čísla, ne %q" #: shared-bindings/vectorio/Polygon.c msgid "%q list must be a list" @@ -82,7 +82,7 @@ msgstr "Seznam %q musí být seznam" #: shared-bindings/memorymonitor/AllocationAlarm.c msgid "%q must be >= 0" -msgstr "" +msgstr "%q musí být >= 0" #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c @@ -98,7 +98,7 @@ msgstr " %q musí být n-tice délky 2" #: shared-bindings/canio/Match.c msgid "%q out of range" -msgstr "" +msgstr "%q je mimo rozsah" #: ports/atmel-samd/common-hal/microcontroller/Pin.c msgid "%q pin invalid" From d6f8a43f6cc755b90376a66b75818744fbe63320 Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Mon, 30 Nov 2020 23:33:07 +0100 Subject: [PATCH 324/770] Eliminate goto. --- supervisor/shared/memory.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/supervisor/shared/memory.c b/supervisor/shared/memory.c index bc82804b70ef8..480c322b0112e 100755 --- a/supervisor/shared/memory.c +++ b/supervisor/shared/memory.c @@ -105,23 +105,23 @@ void free_memory(supervisor_allocation* allocation) { else { // Check if it's in the list of embedded allocations. supervisor_allocation_node** emb = &MP_STATE_VM(first_embedded_allocation); - while (*emb != NULL) { - if (*emb == node) { - // Found, remove it from the list. - *emb = node->next; - m_free(node + while (*emb != NULL && *emb != node) { + emb = &((*emb)->next); + } + if (*emb != NULL) { + // Found, remove it from the list. + *emb = node->next; + m_free(node #if MICROPY_MALLOC_USES_ALLOCATED_SIZE - , sizeof(supervisor_allocation_node) + (node->length & ~FLAGS) + , sizeof(supervisor_allocation_node) + (node->length & ~FLAGS) #endif - ); - goto done; - } - emb = &((*emb)->next); + ); + } + else { + // Else it must be within the low or high ranges and becomes a hole. + node->length = ((node->length & ~FLAGS) | HOLE); } - // Else it must be within the low or high ranges and becomes a hole. - node->length = ((node->length & ~FLAGS) | HOLE); } -done: allocation->ptr = NULL; } From 4ac4faaaf684bfb3713f54de5fca452e64847700 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 30 Nov 2020 17:02:26 -0800 Subject: [PATCH 325/770] Use nina-fw root certs That way we have one set we use for all of Adafruit's connected devices. --- .gitmodules | 3 +++ ports/esp32s2/certificates/README.md | 3 +++ ports/esp32s2/certificates/nina-fw | 1 + ports/esp32s2/esp-idf-config/sdkconfig.defaults | 7 ++++--- 4 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 ports/esp32s2/certificates/README.md create mode 160000 ports/esp32s2/certificates/nina-fw diff --git a/.gitmodules b/.gitmodules index aaa66caf71821..d36613d604786 100644 --- a/.gitmodules +++ b/.gitmodules @@ -153,3 +153,6 @@ [submodule "ports/esp32s2/esp-idf"] path = ports/esp32s2/esp-idf url = https://github.com/jepler/esp-idf.git +[submodule "ports/esp32s2/certificates/nina-fw"] + path = ports/esp32s2/certificates/nina-fw + url = https://github.com/adafruit/nina-fw.git diff --git a/ports/esp32s2/certificates/README.md b/ports/esp32s2/certificates/README.md new file mode 100644 index 0000000000000..dd5cf25b00a01 --- /dev/null +++ b/ports/esp32s2/certificates/README.md @@ -0,0 +1,3 @@ +We share root certificates with the nina-fw to ensure they both use the same roots. + +https://github.com/adafruit/nina-fw diff --git a/ports/esp32s2/certificates/nina-fw b/ports/esp32s2/certificates/nina-fw new file mode 160000 index 0000000000000..f2a0e601b2321 --- /dev/null +++ b/ports/esp32s2/certificates/nina-fw @@ -0,0 +1 @@ +Subproject commit f2a0e601b23212dda4fe305eab30af49a7c7fb41 diff --git a/ports/esp32s2/esp-idf-config/sdkconfig.defaults b/ports/esp32s2/esp-idf-config/sdkconfig.defaults index 025b05caa681a..53b169e39e01c 100644 --- a/ports/esp32s2/esp-idf-config/sdkconfig.defaults +++ b/ports/esp32s2/esp-idf-config/sdkconfig.defaults @@ -575,10 +575,11 @@ CONFIG_MBEDTLS_DYNAMIC_FREE_CONFIG_DATA=y # Certificate Bundle # CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y +# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL is not set # CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN is not set -# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_NONE is not set -# CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE is not set +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_NONE=y +CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE=y +CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE_PATH="certificates/nina-fw/data/roots.pem" # end of Certificate Bundle # CONFIG_MBEDTLS_ECP_RESTARTABLE is not set From 927624468d3f2351826b79ca5789c81980ba0cf7 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 30 Nov 2020 18:39:50 -0800 Subject: [PATCH 326/770] Two minor socket changes * Remove BrokenPipeError and prefer to return the number of bytes received. (May be zero.) * Add two minute backup timeout to reduce the chance we hang on recv accidentally. --- ports/esp32s2/common-hal/socketpool/Socket.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ports/esp32s2/common-hal/socketpool/Socket.c b/ports/esp32s2/common-hal/socketpool/Socket.c index 92247420f9bf0..32c5fc72f2fde 100644 --- a/ports/esp32s2/common-hal/socketpool/Socket.c +++ b/ports/esp32s2/common-hal/socketpool/Socket.c @@ -64,6 +64,18 @@ bool common_hal_socketpool_socket_connect(socketpool_socket_obj_t* self, const c } else { mp_raise_OSError_msg_varg(translate("Unhandled ESP TLS error %d %d %x %d"), esp_tls_code, flags, err, result); } + } else { + // Connection successful, set the timeout on the underlying socket. We can't rely on the IDF + // to do it because the config structure is only used for TLS connections. Generally, we + // shouldn't hit this timeout because we try to only read available data. However, there is + // always a chance that we try to read something that is used internally. + int fd; + esp_tls_get_conn_sockfd(self->tcp, &fd); + struct timeval tv; + tv.tv_sec = 2 * 60; // Two minutes + tv.tv_usec = 0; + setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); + setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)); } return self->connected; @@ -123,9 +135,6 @@ mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, // socket closed common_hal_socketpool_socket_close(self); } - if (status < 0) { - mp_raise_BrokenPipeError(); - } return received; } From 9a9e972242e985b5528f0255217b641b065ecf74 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 1 Dec 2020 11:01:26 -0800 Subject: [PATCH 327/770] Ignore certificates readme in doc build --- conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/conf.py b/conf.py index 1d4c420481891..1a90b617b8d74 100644 --- a/conf.py +++ b/conf.py @@ -172,6 +172,7 @@ "ports/atmel-samd/tools", "ports/cxd56/mkspk", "ports/cxd56/spresense-exported-sdk", + "ports/esp32s2/certificates", "ports/esp32s2/esp-idf", "ports/esp32s2/peripherals", "ports/litex/hw", From a95285ad362e00dc560f6500ed9df7c86fbaddd0 Mon Sep 17 00:00:00 2001 From: Szymon Jakubiak Date: Tue, 1 Dec 2020 19:52:29 +0000 Subject: [PATCH 328/770] Translated using Weblate (Polish) Currently translated at 70.7% (611 of 864 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pl/ --- locale/pl.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/pl.po b/locale/pl.po index 5fbe727efada0..5381a96c4ea50 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,8 +7,8 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-24 15:40-0500\n" -"PO-Revision-Date: 2020-11-11 19:13+0000\n" -"Last-Translator: Maciej Stankiewicz \n" +"PO-Revision-Date: 2020-12-01 19:53+0000\n" +"Last-Translator: Szymon Jakubiak \n" "Language-Team: pl\n" "Language: pl\n" "MIME-Version: 1.0\n" @@ -132,7 +132,7 @@ msgstr "" #: py/obj.c msgid "'%q' object does not support item deletion" -msgstr "" +msgstr "'%q' obiekt nie umożliwia kasowania elementów" #: py/runtime.c msgid "'%q' object has no attribute '%q'" From f6cba4c9743cb2a9e5b23c61453d5d3aed789e37 Mon Sep 17 00:00:00 2001 From: Maciej Stankiewicz Date: Tue, 1 Dec 2020 19:51:26 +0000 Subject: [PATCH 329/770] Translated using Weblate (Polish) Currently translated at 70.7% (611 of 864 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pl/ --- locale/pl.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/pl.po b/locale/pl.po index 5381a96c4ea50..66048c2477181 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -8,7 +8,7 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-24 15:40-0500\n" "PO-Revision-Date: 2020-12-01 19:53+0000\n" -"Last-Translator: Szymon Jakubiak \n" +"Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" "Language: pl\n" "MIME-Version: 1.0\n" @@ -3197,7 +3197,7 @@ msgstr "tylko fragmenty ze step=1 (lub None) są wspierane" #: extmod/ulab/code/compare/compare.c extmod/ulab/code/ndarray.c #: extmod/ulab/code/vector/vectorise.c msgid "operands could not be broadcast together" -msgstr "" +msgstr "operandy nie mogły być rozgłaszane razem" #: extmod/ulab/code/ndarray.c msgid "operation is implemented for 1D Boolean arrays only" @@ -3433,7 +3433,7 @@ msgstr "programowy reset\n" #: extmod/ulab/code/numerical/numerical.c msgid "sort argument must be an ndarray" -msgstr "" +msgstr "argument sort musi być ndarray" #: extmod/ulab/code/filter/filter.c msgid "sos array must be of shape (n_section, 6)" @@ -3741,7 +3741,7 @@ msgstr "zła liczba wartości do rozpakowania" #: extmod/ulab/code/ndarray.c msgid "wrong operand type" -msgstr "" +msgstr "zły typ operandu" #: extmod/ulab/code/vector/vectorise.c msgid "wrong output type" From 44e0d98c62097d5e2c53616e380ccc104c4ccfcd Mon Sep 17 00:00:00 2001 From: Szymon Jakubiak Date: Tue, 1 Dec 2020 19:55:54 +0000 Subject: [PATCH 330/770] Translated using Weblate (Polish) Currently translated at 70.9% (613 of 864 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pl/ --- locale/pl.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/pl.po b/locale/pl.po index 66048c2477181..9f8de945eeeaa 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,8 +7,8 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-24 15:40-0500\n" -"PO-Revision-Date: 2020-12-01 19:53+0000\n" -"Last-Translator: Maciej Stankiewicz \n" +"PO-Revision-Date: 2020-12-01 19:56+0000\n" +"Last-Translator: Szymon Jakubiak \n" "Language-Team: pl\n" "Language: pl\n" "MIME-Version: 1.0\n" @@ -128,7 +128,7 @@ msgstr "Obiekt '%q' nie wspiera '%q'" #: py/obj.c msgid "'%q' object does not support item assignment" -msgstr "" +msgstr "'%q' obiekt nie wspiera dopisywania elementów" #: py/obj.c msgid "'%q' object does not support item deletion" @@ -152,7 +152,7 @@ msgstr "Obiekt '%q' nie jest iterowalny" #: py/obj.c msgid "'%q' object is not subscriptable" -msgstr "" +msgstr "'%q' obiekt nie jest indeksowany" #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format From 2b9ca4d48aa6756a5ff4cc794abc3299782bc01b Mon Sep 17 00:00:00 2001 From: Maciej Stankiewicz Date: Tue, 1 Dec 2020 19:53:22 +0000 Subject: [PATCH 331/770] Translated using Weblate (Polish) Currently translated at 70.9% (613 of 864 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pl/ --- locale/pl.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/pl.po b/locale/pl.po index 9f8de945eeeaa..2c028527dcdfc 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -8,7 +8,7 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-24 15:40-0500\n" "PO-Revision-Date: 2020-12-01 19:56+0000\n" -"Last-Translator: Szymon Jakubiak \n" +"Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" "Language: pl\n" "MIME-Version: 1.0\n" @@ -132,7 +132,7 @@ msgstr "'%q' obiekt nie wspiera dopisywania elementów" #: py/obj.c msgid "'%q' object does not support item deletion" -msgstr "'%q' obiekt nie umożliwia kasowania elementów" +msgstr "obiekt '%q' nie wspiera usuwania elementów" #: py/runtime.c msgid "'%q' object has no attribute '%q'" From d3bbb99e071a97d7295f6d46dbed766c2aa51fb5 Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Tue, 1 Dec 2020 17:49:15 -0600 Subject: [PATCH 332/770] Fixing stubs --- .../adafruit_bus_device/I2CDevice.c | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/shared-bindings/adafruit_bus_device/I2CDevice.c b/shared-bindings/adafruit_bus_device/I2CDevice.c index 3ec4dae12ed04..4c9086162deac 100644 --- a/shared-bindings/adafruit_bus_device/I2CDevice.c +++ b/shared-bindings/adafruit_bus_device/I2CDevice.c @@ -86,7 +86,7 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_make_new(const mp_obj_type_t *type return (mp_obj_t)self; } -//| def __enter__(self) -> I2C: +//| def __enter__(self) -> I2CDevice: //| """Context manager entry to lock bus.""" //| ... //| @@ -107,14 +107,13 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_obj___exit__(size_t n_args, const } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(adafruit_bus_device_i2cdevice___exit___obj, 4, 4, adafruit_bus_device_i2cdevice_obj___exit__); -//| def readinto(self, buf, *, start=0, end=None) -> None: -//| """ -//| Read into ``buf`` from the device. The number of bytes read will be the +//| def readinto(self, buf: WriteableBuffer, *, start: int = 0, end: int = 0) -> None: +//| """Read into ``buf`` from the device. The number of bytes read will be the //| length of ``buf``. //| If ``start`` or ``end`` is provided, then the buffer will be sliced //| as if ``buf[start:end]``. This will not cause an allocation like //| ``buf[start:end]`` will so it saves memory. -//| :param bytearray buffer: buffer to write into +//| :param bytearray buf: buffer to write into //| :param int start: Index to start writing at //| :param int end: Index to write up to but not include; if None, use ``len(buf)``""" //| ... @@ -153,17 +152,16 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_readinto(size_t n_args, const mp_o } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(adafruit_bus_device_i2cdevice_readinto_obj, 2, adafruit_bus_device_i2cdevice_readinto); -//| def write(self, buf, *, start=0, end=None) -> None: -//| """ -//| Write the bytes from ``buffer`` to the device, then transmit a stop bit. -//| If ``start`` or ``end`` is provided, then the buffer will be sliced -//| as if ``buffer[start:end]``. This will not cause an allocation like -//| ``buffer[start:end]`` will so it saves memory. -//| :param bytearray buffer: buffer containing the bytes to write -//| :param int start: Index to start writing from -//| :param int end: Index to read up to but not include; if None, use ``len(buf)`` -//| """ -//| ... +//| def write(self, buf: ReadableBuffer, *, start: int = 0, end: int = 0) -> None: +//| """Write the bytes from ``buffer`` to the device, then transmit a stop bit. +//| If ``start`` or ``end`` is provided, then the buffer will be sliced +//| as if ``buffer[start:end]``. This will not cause an allocation like +//| ``buffer[start:end]`` will so it saves memory. +//| :param bytearray buf: buffer containing the bytes to write +//| :param int start: Index to start writing from +//| :param int end: Index to read up to but not include; if None, use ``len(buf)`` +//| """ +//| ... //| STATIC void write(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, int32_t start, mp_int_t end) { mp_buffer_info_t bufinfo; @@ -199,9 +197,8 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_write(size_t n_args, const mp_obj_ MP_DEFINE_CONST_FUN_OBJ_KW(adafruit_bus_device_i2cdevice_write_obj, 2, adafruit_bus_device_i2cdevice_write); -//| def write_then_readinto(self, out_buffer, in_buffer, *, out_start=0, out_end=None, in_start=0, in_end=None) -> None: -//| """ -//| Write the bytes from ``out_buffer`` to the device, then immediately +//| def write_then_readinto(self, out_buffer: WriteableBuffer, in_buffer: ReadableBuffer, *, out_start: int = 0, out_end: int = 0, in_start: int = 0, in_end: int = 0) -> None: +//| """Write the bytes from ``out_buffer`` to the device, then immediately //| reads into ``in_buffer`` from the device. The number of bytes read //| will be the length of ``in_buffer``. //| If ``out_start`` or ``out_end`` is provided, then the output buffer From 8b7c23c1ee5d3fbfbda9116d6689e99f44e3b95a Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 1 Dec 2020 20:01:14 -0500 Subject: [PATCH 333/770] address review comments --- lib/utils/pyexec.c | 6 +- lib/utils/pyexec.h | 1 + main.c | 10 +++ .../common-hal/microcontroller/Processor.c | 2 +- .../common-hal/microcontroller/Processor.c | 2 +- ports/esp32s2/common-hal/alarm/__init__.c | 43 +++++++--- ports/esp32s2/common-hal/alarm/pin/PinAlarm.c | 13 +-- ports/esp32s2/common-hal/alarm/pin/PinAlarm.h | 2 +- .../common-hal/microcontroller/Processor.c | 2 +- .../common-hal/microcontroller/Processor.c | 2 +- .../common-hal/microcontroller/Processor.c | 2 +- .../common-hal/microcontroller/Processor.c | 2 +- py/obj.h | 4 + py/objexcept.c | 3 + py/reload.c | 22 ++++- py/reload.h | 22 ++++- shared-bindings/alarm/__init__.c | 80 +++++++++---------- shared-bindings/alarm/__init__.h | 4 +- shared-bindings/alarm/pin/PinAlarm.c | 37 ++++----- shared-bindings/alarm/pin/PinAlarm.h | 4 +- 20 files changed, 160 insertions(+), 103 deletions(-) diff --git a/lib/utils/pyexec.c b/lib/utils/pyexec.c index 378fb6267d481..68a3710ce670a 100755 --- a/lib/utils/pyexec.c +++ b/lib/utils/pyexec.c @@ -101,7 +101,7 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input #endif } - // If the code was loaded from a file its likely to be running for a while so we'll long + // If the code was loaded from a file it's likely to be running for a while so we'll long // live it and collect any garbage before running. if (input_kind == MP_PARSE_FILE_INPUT) { module_fun = make_obj_long_lived(module_fun, 6); @@ -132,6 +132,10 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input if (mp_obj_is_subclass_fast(mp_obj_get_type((mp_obj_t)nlr.ret_val), &mp_type_SystemExit)) { // at the moment, the value of SystemExit is unused ret = pyexec_system_exit; +#if CIRCUITPY_ALARM + } else if (mp_obj_is_subclass_fast(mp_obj_get_type((mp_obj_t)nlr.ret_val), &mp_type_DeepSleepRequest)) { + ret = PYEXEC_DEEP_SLEEP; +#endif } else { if ((mp_obj_t) nlr.ret_val != MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception))) { mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val); diff --git a/lib/utils/pyexec.h b/lib/utils/pyexec.h index cef72a76c7a15..4c773cd640e2a 100644 --- a/lib/utils/pyexec.h +++ b/lib/utils/pyexec.h @@ -49,6 +49,7 @@ extern int pyexec_system_exit; #define PYEXEC_FORCED_EXIT (0x100) #define PYEXEC_SWITCH_MODE (0x200) #define PYEXEC_EXCEPTION (0x400) +#define PYEXEC_DEEP_SLEEP (0x800) int pyexec_raw_repl(void); int pyexec_friendly_repl(void); diff --git a/main.c b/main.c index dda439d6de51b..270c0eacf781e 100755 --- a/main.c +++ b/main.c @@ -291,11 +291,21 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { } } #endif + + // TODO: on deep sleep, make sure display is refreshed before sleeping (for e-ink). + cleanup_after_vm(heap); if (result.return_code & PYEXEC_FORCED_EXIT) { return reload_requested; } + + #if CIRCUITPY_ALARM + if (result.return_code & PYEXEC_DEEP_SLEEP) { + common_hal_alarm_enter_deep_sleep(); + // Does not return. + } + #endif } // Program has finished running. diff --git a/ports/atmel-samd/common-hal/microcontroller/Processor.c b/ports/atmel-samd/common-hal/microcontroller/Processor.c index 9955212657ea7..8c288a352ec0e 100644 --- a/ports/atmel-samd/common-hal/microcontroller/Processor.c +++ b/ports/atmel-samd/common-hal/microcontroller/Processor.c @@ -352,5 +352,5 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { } mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) { - return RESET_REASON_POWER_ON; + return RESET_REASON_UNKNOWN; } diff --git a/ports/cxd56/common-hal/microcontroller/Processor.c b/ports/cxd56/common-hal/microcontroller/Processor.c index bd778e80dd582..3cb187de61cef 100644 --- a/ports/cxd56/common-hal/microcontroller/Processor.c +++ b/ports/cxd56/common-hal/microcontroller/Processor.c @@ -50,5 +50,5 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { } mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) { - return RESET_REASON_POWER_ON; + return RESET_REASON_UNKNOWN; } diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index e044103bcee3c..11e173fe2eaf6 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -29,15 +29,16 @@ #include "py/objtuple.h" #include "py/runtime.h" -#include "shared-bindings/alarm/__init__.h" #include "shared-bindings/alarm/pin/PinAlarm.h" #include "shared-bindings/alarm/time/TimeAlarm.h" #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/time/__init__.h" +#include "shared-bindings/wifi/__init__.h" + +#include "common-hal/alarm/__init__.h" #include "esp_log.h" #include "esp_sleep.h" -#include "esp_wifi.h" STATIC mp_obj_tuple_t *_deep_sleep_alarms; @@ -101,7 +102,7 @@ STATIC void setup_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms) { mp_float_t now_secs = uint64_to_float(common_hal_time_monotonic_ms()) / 1000.0f; mp_float_t wakeup_in_secs = MAX(0.0f, time_alarm->monotonic_time - now_secs); const uint64_t sleep_for_us = (uint64_t) (wakeup_in_secs * 1000000); - ESP_LOGI("ALARM", "Sleep for us: %lld", sleep_for_us); + ESP_LOGI("ALARM", "will sleep for us: %lld", sleep_for_us); esp_sleep_enable_timer_wakeup(sleep_for_us); } } @@ -157,25 +158,41 @@ mp_obj_t common_hal_alarm_wait_until_alarms(size_t n_alarms, const mp_obj_t *ala return mp_const_none; } -mp_obj_t common_hal_alarm_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms) { +// Is it safe to do a light sleep? Check whether WiFi is on or there are +// other ongoing tasks that should not be shut down. +static bool light_sleep_ok(void) { + return !common_hal_wifi_radio_get_enabled(&common_hal_wifi_radio_obj); +} + +mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms) { if (n_alarms == 0) { return mp_const_none; } - setup_sleep_alarms(n_alarms, alarms); - - // Shut down wifi cleanly. - esp_wifi_stop(); - ESP_LOGI("ALARM", "start light sleep"); - esp_light_sleep_start(); - return common_hal_alarm_get_wake_alarm(); + if (light_sleep_ok()) { + ESP_LOGI("ALARM", "start light sleep"); + setup_sleep_alarms(n_alarms, alarms); + esp_light_sleep_start(); + return common_hal_alarm_get_wake_alarm(); + } else { + // Don't do an ESP32 light sleep. + return common_hal_alarm_wait_until_alarms(n_alarms, alarms); + } } void common_hal_alarm_exit_and_deep_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms) { setup_sleep_alarms(n_alarms, alarms); - // Shut down wifi cleanly. - esp_wifi_stop(); + // Raise an exception, which will be processed in main.c. + mp_raise_arg1(&mp_type_DeepSleepRequest, NULL); +} + +void common_hal_alarm_prepare_for_deep_sleep(void) { + // Turn off WiFi and anything else that should be shut down cleanly. + common_hal_wifi_radio_set_enabled(&common_hal_wifi_radio_obj, false); +} + +void NORETURN common_hal_alarm_enter_deep_sleep(void) { ESP_LOGI("ALARM", "start deep sleep"); esp_deep_sleep_start(); } diff --git a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c index 438d6885dc3af..582a665729810 100644 --- a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +++ b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c @@ -29,26 +29,21 @@ #include "shared-bindings/alarm/pin/PinAlarm.h" #include "shared-bindings/microcontroller/Pin.h" -void common_hal_alarm_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, const mp_obj_t pins[], size_t num_pins, bool value, bool all_same_value, bool edge, bool pull) { - self->pins = mp_obj_new_tuple(num_pins, pins); +void common_hal_alarm_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, mcu_pin_obj_t *pin, bool value, bool edge, bool pull) { + self->pin = pin; self->value = value; - self->all_same_value = all_same_value; self->edge = edge; self->pull = pull; } -mp_obj_tuple_t *common_hal_alarm_pin_pin_alarm_get_pins(alarm_pin_pin_alarm_obj_t *self) { - return self->pins; +mcu_pin_obj_t *common_hal_alarm_pin_pin_alarm_get_pin(alarm_pin_pin_alarm_obj_t *self) { + return self->pin; } bool common_hal_alarm_pin_pin_alarm_get_value(alarm_pin_pin_alarm_obj_t *self) { return self->value; } -bool common_hal_alarm_pin_pin_alarm_get_all_same_value(alarm_pin_pin_alarm_obj_t *self) { - return self->all_same_value; -} - bool common_hal_alarm_pin_pin_alarm_get_edge(alarm_pin_pin_alarm_obj_t *self) { return self->edge; } diff --git a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h index d7e7e2552a610..0eaa7777f5ed1 100644 --- a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h +++ b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h @@ -29,7 +29,7 @@ typedef struct { mp_obj_base_t base; - mp_obj_tuple_t *pins; + mcu_pin_obj_t *pin; bool value; bool all_same_value; bool edge; diff --git a/ports/litex/common-hal/microcontroller/Processor.c b/ports/litex/common-hal/microcontroller/Processor.c index 013a7ca035b92..4d4f88288e059 100644 --- a/ports/litex/common-hal/microcontroller/Processor.c +++ b/ports/litex/common-hal/microcontroller/Processor.c @@ -66,5 +66,5 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { } mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) { - return RESET_REASON_POWER_ON; + return RESET_REASON_UNKNOWN; } diff --git a/ports/mimxrt10xx/common-hal/microcontroller/Processor.c b/ports/mimxrt10xx/common-hal/microcontroller/Processor.c index 28fe67db7cbab..efbde35d28136 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/Processor.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/Processor.c @@ -73,5 +73,5 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { } mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) { - return RESET_REASON_POWER_ON; + return RESET_REASON_UNKNOWN; } diff --git a/ports/nrf/common-hal/microcontroller/Processor.c b/ports/nrf/common-hal/microcontroller/Processor.c index e2695139c5fa6..ab5f29b5db71d 100644 --- a/ports/nrf/common-hal/microcontroller/Processor.c +++ b/ports/nrf/common-hal/microcontroller/Processor.c @@ -123,5 +123,5 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { } mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) { - return RESET_REASON_POWER_ON; + return RESET_REASON_UNKNOWN; } diff --git a/ports/stm/common-hal/microcontroller/Processor.c b/ports/stm/common-hal/microcontroller/Processor.c index d77d287a9e201..dd04c56dce730 100644 --- a/ports/stm/common-hal/microcontroller/Processor.c +++ b/ports/stm/common-hal/microcontroller/Processor.c @@ -143,5 +143,5 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { } mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) { - return RESET_REASON_POWER_ON; + return RESET_REASON_UNKNOWN; } diff --git a/py/obj.h b/py/obj.h index e055c975065ef..066562cc43549 100644 --- a/py/obj.h +++ b/py/obj.h @@ -640,6 +640,10 @@ extern const mp_obj_type_t mp_type_UnicodeError; extern const mp_obj_type_t mp_type_ValueError; extern const mp_obj_type_t mp_type_ViperTypeError; extern const mp_obj_type_t mp_type_ZeroDivisionError; +#if CIRCUITPY_ALARM +extern const mp_obj_type_t mp_type_DeepSleepRequest; +#endif + // Constant objects, globally accessible // The macros are for convenience only diff --git a/py/objexcept.c b/py/objexcept.c index 01ba6da9c4de2..afefee2caff66 100644 --- a/py/objexcept.c +++ b/py/objexcept.c @@ -318,6 +318,9 @@ MP_DEFINE_EXCEPTION(Exception, BaseException) #if MICROPY_PY_BUILTINS_STR_UNICODE MP_DEFINE_EXCEPTION(UnicodeError, ValueError) //TODO: Implement more UnicodeError subclasses which take arguments +#endif +#if CIRCUITPY_ALARM + MP_DEFINE_EXCEPTION(DeepSleepRequest, BaseException) #endif MP_DEFINE_EXCEPTION(MpyError, ValueError) /* diff --git a/py/reload.c b/py/reload.c index 95305f2c9cfd4..f9f8a590a67d4 100644 --- a/py/reload.c +++ b/py/reload.c @@ -1,6 +1,22 @@ -// -// Created by Roy Hooper on 2018-05-14. -// + /* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2018 by Roy Hooper + * 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 "reload.h" #include "py/mpstate.h" diff --git a/py/reload.h b/py/reload.h index 72e84e5ca64fe..3e8928a32c055 100644 --- a/py/reload.h +++ b/py/reload.h @@ -1,6 +1,22 @@ -// -// Created by Roy Hooper on 2018-05-14. -// + /* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2018 by Roy Hooper + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ #ifndef CIRCUITPYTHON_RELOAD_H #define CIRCUITPYTHON_RELOAD_H diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 195ec63745746..c983130a19c8b 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -43,19 +43,21 @@ //| //| Provides alarms that trigger based on time intervals or on external events, such as pin //| changes. -//| The program can simply wait for these alarms, or go into a sleep state and -//| and be awoken when they trigger. +//| The program can simply wait for these alarms, or go to sleep and be awoken when they trigger. //| //| There are two supported levels of sleep: light sleep and deep sleep. //| -//| Light sleep leaves the CPU and RAM powered so the program can resume after sleeping. -//| -//| *However, note that on some platforms, light sleep will shut down some communications, including -//| WiFi and/or Bluetooth.* +//| Light sleep keeps sufficient state so the program can resume after sleeping. +//| It does not shut down WiFi, BLE, or other communications, or ongoing activities such +//| as audio playback. It reduces power consumption to the extent possible that leaves +//| these continuing activities running. In some cases there may be no decrease in power consumption. //| //| Deep sleep shuts down power to nearly all of the microcontroller including the CPU and RAM. This can save //| a more significant amount of power, but CircuitPython must restart ``code.py`` from the beginning when //| awakened. +//| +//| For both light sleep and deep sleep, if CircuitPython is connected to a host computer, +//| maintaining the connection takes priority and power consumption may not be reduced. //| """ //| @@ -75,45 +77,39 @@ void validate_objs_are_alarms(size_t n_args, const mp_obj_t *objs) { } } -//| def wait_until_alarms(*alarms: Alarm) -> Alarm: -//| """Wait for one of the alarms to trigger. The triggering alarm is returned. -//| is returned, and is also available as `alarm.wake_alarm`. Nothing is shut down -//| or interrupted. Power consumption will be reduced if possible. -//| -//| If no alarms are specified, return immediately. -//| """ -//| ... -//| -STATIC mp_obj_t alarm_wait_until_alarms(size_t n_args, const mp_obj_t *args) { - validate_objs_are_alarms(n_args, args); - common_hal_alarm_wait_until_alarms(n_args, args); - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_wait_until_alarms_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_wait_until_alarms); - -//| def sleep_until_alarms(*alarms: Alarm) -> Alarm: +//| def light_sleep_until_alarms(*alarms: Alarm) -> Alarm: //| """Go into a light sleep until awakened one of the alarms. The alarm causing the wake-up //| is returned, and is also available as `alarm.wake_alarm`. //| -//| Some functionality may be shut down during sleep. On ESP32-S2, WiFi is turned off, -//| and existing connections are broken. -//| //| If no alarms are specified, return immediately. //| -//| **If CircuitPython is connected to a host computer,** `alarm.sleep_until_alarms()` -//| **does not go into light sleep.** -//| Instead, light sleep is simulated by doing `alarm.wait_until_alarms()`, +//| **If CircuitPython is connected to a host computer, the connection will be maintained, +//| and the microcontroller may not actually go into a light sleep.** //| This allows the user to interrupt an existing program with ctrl-C, -//| and to edit the files in CIRCUITPY, which would not be possible in true light sleep +//| and to edit the files in CIRCUITPY, which would not be possible in true light sleep. +//| Thus, to use light sleep and save significant power, +// it may be necessary to disconnect from the host. //| """ //| ... //| -STATIC mp_obj_t alarm_sleep_until_alarms(size_t n_args, const mp_obj_t *args) { +STATIC mp_obj_t alarm_light_sleep_until_alarms(size_t n_args, const mp_obj_t *args) { validate_objs_are_alarms(n_args, args); - common_hal_alarm_sleep_until_alarms(n_args, args); + + // See if we are connected to a host. + // Make sure we have been awake long enough for USB to connect (enumeration delay). + int64_t connecting_delay_msec = CIRCUITPY_USB_CONNECTED_SLEEP_DELAY * 1024 - supervisor_ticks_ms64(); + if (connecting_delay_msec > 0) { + common_hal_time_delay_ms(connecting_delay_msec * 1000 / 1024); + } + + if (supervisor_workflow_active()) { + common_hal_alarm_wait_until_alarms(n_args, args); + } else { + common_hal_alarm_light_sleep_until_alarms(n_args, args); + } return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_sleep_until_alarms_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_sleep_until_alarms); +MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_light_sleep_until_alarms_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_light_sleep_until_alarms); //| def exit_and_deep_sleep_until_alarms(*alarms: Alarm) -> None: //| """Exit the program and go into a deep sleep, until awakened by one of the alarms. @@ -130,11 +126,10 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_sleep_until_alarms_obj, 1, MP_OBJ_FUN_ //| If no alarms are specified, the microcontroller will deep sleep until reset. //| //| **If CircuitPython is connected to a host computer, `alarm.exit_and_deep_sleep_until_alarms()` -//| does not go into deep sleep.** -//| Instead, deep sleep is simulated by first doing `alarm.wait_until_alarms()`, -//| and then, when an alarm triggers, by restarting CircuitPython. +//| then the connection will be maintained, and the system will not go into deep sleep.** //| This allows the user to interrupt an existing program with ctrl-C, //| and to edit the files in CIRCUITPY, which would not be possible in true deep sleep. +//| Thus, to use deep sleep and save significant power, you will need to disconnect from the host. //| //| Here is skeletal example that deep-sleeps and restarts every 60 seconds: //| @@ -156,6 +151,10 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_sleep_until_alarms_obj, 1, MP_OBJ_FUN_ STATIC mp_obj_t alarm_exit_and_deep_sleep_until_alarms(size_t n_args, const mp_obj_t *args) { validate_objs_are_alarms(n_args, args); + // Shut down WiFi, etc. + common_hal_alarm_prepare_for_deep_sleep(); + + // See if we are connected to a host. // Make sure we have been awake long enough for USB to connect (enumeration delay). int64_t connecting_delay_msec = CIRCUITPY_USB_CONNECTED_SLEEP_DELAY * 1024 - supervisor_ticks_ms64(); if (connecting_delay_msec > 0) { @@ -163,6 +162,7 @@ STATIC mp_obj_t alarm_exit_and_deep_sleep_until_alarms(size_t n_args, const mp_o } if (supervisor_workflow_active()) { + // Simulate deep sleep by waiting for an alarm and then restarting when done. common_hal_alarm_wait_until_alarms(n_args, args); reload_requested = true; supervisor_set_run_reason(RUN_REASON_STARTUP); @@ -175,9 +175,6 @@ STATIC mp_obj_t alarm_exit_and_deep_sleep_until_alarms(size_t n_args, const mp_o } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_exit_and_deep_sleep_until_alarms_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_exit_and_deep_sleep_until_alarms); -//| """The `alarm.pin` module contains alarm attributes and classes related to pins. -//| """ -//| STATIC const mp_map_elem_t alarm_pin_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_pin) }, @@ -191,9 +188,6 @@ STATIC const mp_obj_module_t alarm_pin_module = { .globals = (mp_obj_dict_t*)&alarm_pin_globals, }; -//| """The `alarm.time` module contains alarm attributes and classes related to time-keeping. -//| """ -//| STATIC const mp_map_elem_t alarm_time_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_time) }, @@ -213,7 +207,7 @@ STATIC mp_map_elem_t alarm_module_globals_table[] = { // wake_alarm is a mutable attribute. { MP_ROM_QSTR(MP_QSTR_wake_alarm), mp_const_none }, - { MP_ROM_QSTR(MP_QSTR_sleep_until_alarms), MP_OBJ_FROM_PTR(&alarm_sleep_until_alarms_obj) }, + { MP_ROM_QSTR(MP_QSTR_light_sleep_until_alarms), MP_OBJ_FROM_PTR(&alarm_light_sleep_until_alarms_obj) }, { MP_ROM_QSTR(MP_QSTR_exit_and_deep_sleep_until_alarms), MP_OBJ_FROM_PTR(&alarm_exit_and_deep_sleep_until_alarms_obj) }, diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h index 26dbb2897c728..380c65ea8c3c9 100644 --- a/shared-bindings/alarm/__init__.h +++ b/shared-bindings/alarm/__init__.h @@ -32,8 +32,10 @@ #include "common-hal/alarm/__init__.h" extern mp_obj_t common_hal_alarm_wait_until_alarms(size_t n_alarms, const mp_obj_t *alarms); -extern mp_obj_t common_hal_alarm_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms); +extern mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms); extern void common_hal_alarm_exit_and_deep_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms); +extern void common_hal_alarm_prepare_for_deep_sleep(void); +extern NORETURN void common_hal_alarm_enter_deep_sleep(void); // Used by wake-up code. extern void common_hal_alarm_set_wake_alarm(mp_obj_t alarm); diff --git a/shared-bindings/alarm/pin/PinAlarm.c b/shared-bindings/alarm/pin/PinAlarm.c index a6497d4cde04d..a435407acc264 100644 --- a/shared-bindings/alarm/pin/PinAlarm.c +++ b/shared-bindings/alarm/pin/PinAlarm.c @@ -38,18 +38,16 @@ //| class PinAlarm: //| """Trigger an alarm when a pin changes state.""" //| -//| def __init__(self, *pins: microcontroller.Pin, value: bool, all_same_value: bool = False, edge: bool = False, pull: bool = False) -> None: +//| def __init__(self, pin: microcontroller.Pin, value: bool, edge: bool = False, pull: bool = False) -> None: //| """Create an alarm triggered by a `microcontroller.Pin` level. The alarm is not active //| until it is passed to an `alarm`-enabling function, such as `alarm.sleep_until_alarms()` or //| `alarm.exit_and_deep_sleep_until_alarms()`. //| -//| :param microcontroller.Pin \*pins: The pins to monitor. On some ports, the choice of pins +//| :param microcontroller.Pin pin: The pin to monitor. On some ports, the choice of pin //| may be limited due to hardware restrictions, particularly for deep-sleep alarms. //| :param bool value: When active, trigger when the pin value is high (``True``) or low (``False``). //| On some ports, multiple `PinAlarm` objects may need to have coordinated values //| for deep-sleep alarms. -//| :param bool all_same_value: If ``True``, all pins listed must be at ``value`` to trigger the alarm. -//| If ``False``, any one of the pins going to ``value`` will trigger the alarm. //| :param bool edge: If ``True``, trigger only when there is a transition to the specified //| value of ``value``. If ``True``, if the alarm becomes active when the pin value already //| matches ``value``, the alarm is not triggered: the pin must transition from ``not value`` @@ -65,47 +63,44 @@ STATIC mp_obj_t alarm_pin_pin_alarm_make_new(const mp_obj_type_t *type, mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { alarm_pin_pin_alarm_obj_t *self = m_new_obj(alarm_pin_pin_alarm_obj_t); self->base.type = &alarm_pin_pin_alarm_type; - enum { ARG_value, ARG_all_same_value, ARG_edge, ARG_pull }; + enum { ARG_pin, ARG_value, ARG_edge, ARG_pull }; static const mp_arg_t allowed_args[] = { + { MP_QSTR_pin, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_value, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_BOOL }, - { MP_QSTR_all_same_value, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, { MP_QSTR_edge, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, { MP_QSTR_pull, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(0, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - for (size_t i = 0; i < n_args; i ++) { - validate_obj_is_free_pin(pos_args[i]); - } + mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj); - common_hal_alarm_pin_pin_alarm_construct( - self, pos_args, n_args, + common_hal_alarm_pin_pin_alarm_construct(self, + pin, args[ARG_value].u_bool, - args[ARG_all_same_value].u_bool, args[ARG_edge].u_bool, args[ARG_pull].u_bool); return MP_OBJ_FROM_PTR(self); } -//| pins: Tuple[microcontroller.Pin] -//| """The trigger pins.""" +//| pin: microcontroller.Pin +//| """The trigger pin.""" //| -STATIC mp_obj_t alarm_pin_pin_alarm_obj_get_pins(mp_obj_t self_in) { +STATIC mp_obj_t alarm_pin_pin_alarm_obj_get_pin(mp_obj_t self_in) { alarm_pin_pin_alarm_obj_t *self = MP_OBJ_TO_PTR(self_in); - return common_hal_alarm_pin_pin_alarm_get_pins(self); + return common_hal_alarm_pin_pin_alarm_get_pin(self); } -MP_DEFINE_CONST_FUN_OBJ_1(alarm_pin_pin_alarm_get_pins_obj, alarm_pin_pin_alarm_obj_get_pins); +MP_DEFINE_CONST_FUN_OBJ_1(alarm_pin_pin_alarm_get_pin_obj, alarm_pin_pin_alarm_obj_get_pin); -const mp_obj_property_t alarm_pin_pin_alarm_pins_obj = { +const mp_obj_property_t alarm_pin_pin_alarm_pin_obj = { .base.type = &mp_type_property, - .proxy = {(mp_obj_t)&alarm_pin_pin_alarm_get_pins_obj, + .proxy = {(mp_obj_t)&alarm_pin_pin_alarm_get_pin_obj, (mp_obj_t)&mp_const_none_obj, (mp_obj_t)&mp_const_none_obj}, }; -//| value: Tuple[microcontroller.Pin] +//| value: bool //| """The value on which to trigger.""" //| STATIC mp_obj_t alarm_pin_pin_alarm_obj_get_value(mp_obj_t self_in) { @@ -122,7 +117,7 @@ const mp_obj_property_t alarm_pin_pin_alarm_value_obj = { }; STATIC const mp_rom_map_elem_t alarm_pin_pin_alarm_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_pins), MP_ROM_PTR(&alarm_pin_pin_alarm_pins_obj) }, + { MP_ROM_QSTR(MP_QSTR_pin), MP_ROM_PTR(&alarm_pin_pin_alarm_pin_obj) }, { MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&alarm_pin_pin_alarm_value_obj) }, }; diff --git a/shared-bindings/alarm/pin/PinAlarm.h b/shared-bindings/alarm/pin/PinAlarm.h index cb69468124bf1..49ba71089970c 100644 --- a/shared-bindings/alarm/pin/PinAlarm.h +++ b/shared-bindings/alarm/pin/PinAlarm.h @@ -34,8 +34,8 @@ extern const mp_obj_type_t alarm_pin_pin_alarm_type; -void common_hal_alarm_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, const mp_obj_t pins[], size_t num_pins, bool value, bool all_same_value, bool edge, bool pull); -extern mp_obj_tuple_t *common_hal_alarm_pin_pin_alarm_get_pins(alarm_pin_pin_alarm_obj_t *self); +void common_hal_alarm_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, mcu_pin_obj_t *pin, bool value, bool edge, bool pull); +extern mcu_pin_obj_t *common_hal_alarm_pin_pin_alarm_get_pin(alarm_pin_pin_alarm_obj_t *self); extern bool common_hal_alarm_pin_pin_alarm_get_value(alarm_pin_pin_alarm_obj_t *self); extern bool common_hal_alarm_pin_pin_alarm_get_edge(alarm_pin_pin_alarm_obj_t *self); extern bool common_hal_alarm_pin_pin_alarm_get_pull(alarm_pin_pin_alarm_obj_t *self); From fe1c2fa6f0571d9f5f70ff1e5572dbb0ce629dfb Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Tue, 1 Dec 2020 19:11:17 -0600 Subject: [PATCH 334/770] Removed bus device from simmel build --- ports/nrf/boards/simmel/mpconfigboard.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/nrf/boards/simmel/mpconfigboard.mk b/ports/nrf/boards/simmel/mpconfigboard.mk index e34739c0f3460..704881b3c4d2b 100644 --- a/ports/nrf/boards/simmel/mpconfigboard.mk +++ b/ports/nrf/boards/simmel/mpconfigboard.mk @@ -25,6 +25,7 @@ CIRCUITPY_RTC = 1 CIRCUITPY_TOUCHIO = 0 CIRCUITPY_ULAB = 0 CIRCUITPY_WATCHDOG = 1 +CIRCUITPY_BUSDEVICE = 0 # Enable micropython.native #CIRCUITPY_ENABLE_MPY_NATIVE = 1 From 72fa7d88b881d2ed9978c0bd65ce5f8d6eb51703 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 1 Dec 2020 20:13:46 -0500 Subject: [PATCH 335/770] fix doc errors --- shared-bindings/alarm/pin/PinAlarm.c | 2 +- shared-bindings/alarm/time/TimeAlarm.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/alarm/pin/PinAlarm.c b/shared-bindings/alarm/pin/PinAlarm.c index a435407acc264..7a5617142b46a 100644 --- a/shared-bindings/alarm/pin/PinAlarm.c +++ b/shared-bindings/alarm/pin/PinAlarm.c @@ -40,7 +40,7 @@ //| //| def __init__(self, pin: microcontroller.Pin, value: bool, edge: bool = False, pull: bool = False) -> None: //| """Create an alarm triggered by a `microcontroller.Pin` level. The alarm is not active -//| until it is passed to an `alarm`-enabling function, such as `alarm.sleep_until_alarms()` or +//| until it is passed to an `alarm`-enabling function, such as `alarm.light_sleep_until_alarms()` or //| `alarm.exit_and_deep_sleep_until_alarms()`. //| //| :param microcontroller.Pin pin: The pin to monitor. On some ports, the choice of pin diff --git a/shared-bindings/alarm/time/TimeAlarm.c b/shared-bindings/alarm/time/TimeAlarm.c index 17a4faac25723..1c4d976ada0ff 100644 --- a/shared-bindings/alarm/time/TimeAlarm.c +++ b/shared-bindings/alarm/time/TimeAlarm.c @@ -48,7 +48,7 @@ mp_obj_t MP_WEAK rtc_get_time_source_time(void) { //| ``monotonic_time``, or when `time.time()` would equal ``epoch_time``. //| Only one of the two arguments can be given. //| The alarm is not active until it is passed to an -//| `alarm`-enabling function, such as `alarm.sleep_until_alarms()` or +//| `alarm`-enabling function, such as `alarm.light_sleep_until_alarms()` or //| `alarm.exit_and_deep_sleep_until_alarms()`. //| //| If the given time is in the past when sleep occurs, the alarm will be triggered From 73e22f9eeb2b02fcf4c39b62ddbabffe6db21199 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 1 Dec 2020 18:15:06 -0800 Subject: [PATCH 336/770] Block all tasks (not interrupts) during flash erase Otherwise we risk running code from flash while an erase is in progress, crashing and corrupting the file system. Related to #3744 --- ports/esp32s2/esp-idf-config/sdkconfig.defaults | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ports/esp32s2/esp-idf-config/sdkconfig.defaults b/ports/esp32s2/esp-idf-config/sdkconfig.defaults index 025b05caa681a..2c53da108e144 100644 --- a/ports/esp32s2/esp-idf-config/sdkconfig.defaults +++ b/ports/esp32s2/esp-idf-config/sdkconfig.defaults @@ -717,10 +717,8 @@ CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y # CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED is not set # CONFIG_SPI_FLASH_USE_LEGACY_IMPL is not set # CONFIG_SPI_FLASH_BYPASS_BLOCK_ERASE is not set -CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y -CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=20 -CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=1 -CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=8192 +# CONFIG_SPI_FLASH_YIELD_DURING_ERASE is not set +CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=4096 # CONFIG_SPI_FLASH_SIZE_OVERRIDE is not set # From 90c203a3dd0c25b39909e98ec64dcdd0fc73054c Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Sun, 8 Nov 2020 18:39:20 -0800 Subject: [PATCH 337/770] add module msgpack --- ports/nrf/mpconfigport.mk | 2 + py/circuitpy_defns.mk | 4 + py/circuitpy_mpconfig.h | 8 + py/circuitpy_mpconfig.mk | 4 + shared-bindings/msgpack/__init__.c | 391 +++++++++++++++++++++++++++++ shared-bindings/msgpack/__init__.h | 34 +++ 6 files changed, 443 insertions(+) create mode 100644 shared-bindings/msgpack/__init__.c create mode 100644 shared-bindings/msgpack/__init__.h diff --git a/ports/nrf/mpconfigport.mk b/ports/nrf/mpconfigport.mk index 9560064fbc5c4..2ee182b7d530d 100644 --- a/ports/nrf/mpconfigport.mk +++ b/ports/nrf/mpconfigport.mk @@ -52,6 +52,8 @@ MCU_SUB_VARIANT = nrf52840 # Fits on nrf52840 but space is tight on nrf52833. CIRCUITPY_AESIO ?= 1 +CIRCUITPY_MSGPACK ?= 1 + SD ?= s140 SOFTDEV_VERSION ?= 6.1.0 diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index ccdf973e9fb5c..144168c79e91c 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -283,6 +283,9 @@ endif ifeq ($(CIRCUITPY_PEW),1) SRC_PATTERNS += _pew/% endif +ifeq ($(CIRCUITPY_MSGPACK),1) +SRC_PATTERNS += msgpack/% +endif # All possible sources are listed here, and are filtered by SRC_PATTERNS in SRC_COMMON_HAL SRC_COMMON_HAL_ALL = \ @@ -396,6 +399,7 @@ $(filter $(SRC_PATTERNS), \ fontio/Glyph.c \ math/__init__.c \ microcontroller/RunMode.c \ + msgpack/__init__.c \ ) SRC_BINDINGS_ENUMS += \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index bffab4f30f783..3c4e5c2909c3b 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -754,6 +754,13 @@ extern const struct _mp_obj_module_t wifi_module; #define WIFI_MODULE #endif +#if CIRCUITPY_MSGPACK +extern const struct _mp_obj_module_t msgpack_module; +#define MSGPACK_MODULE { MP_ROM_QSTR(MP_QSTR_msgpack), MP_ROM_PTR(&msgpack_module) }, +#else +#define MSGPACK_MODULE +#endif + // Define certain native modules with weak links so they can be replaced with Python // implementations. This list may grow over time. #define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS \ @@ -839,6 +846,7 @@ extern const struct _mp_obj_module_t wifi_module; USTACK_MODULE \ WATCHDOG_MODULE \ WIFI_MODULE \ + MSGPACK_MODULE \ // If weak links are enabled, just include strong links in the main list of modules, // and also include the underscore alternate names. diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 08e77371800e1..38ca795849e9f 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -296,3 +296,7 @@ CFLAGS += -DCIRCUITPY_WIFI=$(CIRCUITPY_WIFI) # Enabled micropython.native decorator (experimental) CIRCUITPY_ENABLE_MPY_NATIVE ?= 0 CFLAGS += -DCIRCUITPY_ENABLE_MPY_NATIVE=$(CIRCUITPY_ENABLE_MPY_NATIVE) + +CIRCUITPY_MSGPACK ?= 0 +CFLAGS += -DCIRCUITPY_MSGPACK=$(CIRCUITPY_MSGPACK) + diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c new file mode 100644 index 0000000000000..74ab644702199 --- /dev/null +++ b/shared-bindings/msgpack/__init__.c @@ -0,0 +1,391 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Bernhard Boser + * + * 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 + +#include "py/binary.h" +#include "py/objarray.h" +#include "py/objlist.h" +#include "py/objstringio.h" +#include "py/parsenum.h" +#include "py/runtime.h" +#include "py/stream.h" + +#include "supervisor/shared/translate.h" + +//////////////////////////////////////////////////////////////// +// stream management + +typedef struct _msgpack_stream_t { + mp_obj_t stream_obj; + mp_uint_t (*read)(mp_obj_t obj, void *buf, mp_uint_t size, int *errcode); + mp_uint_t (*write)(mp_obj_t obj, const void *buf, mp_uint_t size, int *errcode); + int errcode; +} msgpack_stream_t; + +STATIC msgpack_stream_t get_stream(mp_obj_t stream_obj, int flags) { + const mp_stream_p_t *stream_p = mp_get_stream_raise(stream_obj, flags); + msgpack_stream_t s = {stream_obj, stream_p->read, stream_p->write, 0}; + return s; +} + +//////////////////////////////////////////////////////////////// +// readers + +STATIC void read(msgpack_stream_t *s, void *buf, mp_uint_t size) { + if (size == 0) return; + mp_uint_t ret = s->read(s->stream_obj, buf, size, &s->errcode); + if (s->errcode != 0) { + mp_raise_OSError(s->errcode); + } + if (ret == 0) { + mp_raise_msg(&mp_type_EOFError, NULL); + } +} + +STATIC uint32_t read_bytes(msgpack_stream_t *s, mp_uint_t n_bytes) { + uint32_t res = 0; + read(s, &res, n_bytes); + return res; +} + +size_t read_size(msgpack_stream_t *s, uint8_t len_index) { + size_t n_bytes = 4; + switch (len_index) { + case 0: n_bytes = 1; break; + case 1: n_bytes = 2; break; + case 2: n_bytes = 4; break; + } + size_t res = 0; + read(s, &res, n_bytes); + return res; +} + +//////////////////////////////////////////////////////////////// +// writers + +STATIC void write(msgpack_stream_t *s, const void *buf, mp_uint_t size) { + mp_uint_t ret = s->write(s->stream_obj, buf, size, &s->errcode); + if (s->errcode != 0) { + mp_raise_OSError(s->errcode); + } + if (ret == 0) { + mp_raise_msg(&mp_type_EOFError, NULL); + } +} + +STATIC void write_bytes(msgpack_stream_t *s, mp_uint_t n_bytes, uint32_t obj) { + write(s, &obj, n_bytes); +} + +void write_size(msgpack_stream_t *s, uint8_t code, size_t size) { + if ((uint8_t)size == size) { + write_bytes(s, 1, code); + write_bytes(s, 1, size); + } else if ((uint16_t)size == size) { + write_bytes(s, 1, code+1); + write_bytes(s, 2, size); + } else { + write_bytes(s, 1, code+2); + write_bytes(s, 4, size); + } +} + +//////////////////////////////////////////////////////////////// +// packers + +// This is a helper function to iterate through a dictionary. The state of +// the iteration is held in *cur and should be initialised with zero for the +// first call. Will return NULL when no more elements are available. +STATIC mp_map_elem_t *dict_iter_next(mp_obj_dict_t *dict, size_t *cur) { + size_t max = dict->map.alloc; + mp_map_t *map = &dict->map; + + for (size_t i = *cur; i < max; i++) { + if (MP_MAP_SLOT_IS_FILLED(map, i)) { + *cur = i + 1; + return &(map->table[i]); + } + } + + return NULL; +} + + +STATIC void pack_int(msgpack_stream_t *s, int32_t x) { + if (x > -32 && x < 128) { + write_bytes(s, 1, x); + } else if ((int8_t)x == x) { + write_bytes(s, 1, 0xd0); + write_bytes(s, 1, x); + } else if ((int16_t)x == x) { + write_bytes(s, 1, 0xd1); + write_bytes(s, 2, x); + } else { + write_bytes(s, 1, 0xd2); + write_bytes(s, 4, x); + } +} + +void pack_bin(msgpack_stream_t *s, const uint8_t* data, size_t len) { + write_size(s, 0xc4, len); + for (size_t i=0; ilen); + for (size_t i=0; ilen; i++) { + _pack(self->items[i], s); + } + } else if (MP_OBJ_IS_TYPE(obj, &mp_type_list)) { + // list (layout differs from tuple) + mp_obj_list_t *self = MP_OBJ_TO_PTR(obj); + pack_array(s, self->len); + for (size_t i=0; ilen; i++) { + _pack(self->items[i], s); + } + } else if (MP_OBJ_IS_TYPE(obj, &mp_type_dict)) { + // dict + mp_obj_dict_t *self = MP_OBJ_TO_PTR(obj); + pack_dict(s, self->map.used); + size_t cur = 0; + mp_map_elem_t *next = NULL; + while ((next = dict_iter_next(self, &cur)) != NULL) { + _pack(next->key, s); + _pack(next->value, s); + } + } else if (mp_obj_is_float(obj)) { + mp_float_t f = mp_obj_float_get(obj); + write_bytes(s, 1, 0xca); + write(s, &f, 4); + } else if (obj == mp_const_none) { + write_bytes(s, 1, 0xc0); + } else if (obj == mp_const_false) { + write_bytes(s, 1, 0xc2); + } else if (obj == mp_const_true) { + write_bytes(s, 1, 0xc3); + } else { + mp_raise_ValueError(translate("no packer")); + } +} + +// Write obj to stream in msgpack format +STATIC mp_obj_t mod_msgpack_pack(mp_obj_t obj, mp_obj_t stream_obj) { + msgpack_stream_t s = get_stream(stream_obj, MP_STREAM_OP_WRITE); + _pack(obj, &s); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_msgpack_pack_obj, mod_msgpack_pack); + +//////////////////////////////////////////////////////////////// +// un-packers + +STATIC mp_obj_t _unpack(msgpack_stream_t *s) { + uint8_t code = read_bytes(s, 1); + if (((code & 0b10000000) == 0) || ((code & 0b11100000) == 0b11100000)) { + // int + return MP_OBJ_NEW_SMALL_INT((int8_t)code); + } + if ((code & 0b11100000) == 0b10100000) { + // str + size_t len = code & 0b11111; + // allocate on stack; len < 32 + char str[len]; + read(s, &str, len); + return mp_obj_new_str(str, len); + } + if ((code & 0b11110000) == 0b10010000) { + // array (tuple) + size_t len = code & 0b1111; + mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(len, NULL)); + for (size_t i=0; iitems[i] = _unpack(s); + } + return MP_OBJ_FROM_PTR(t); + } + if ((code & 0b11110000) == 0b10000000) { + // map (dict) + size_t len = code & 0b1111; + mp_obj_dict_t *d = MP_OBJ_TO_PTR(mp_obj_new_dict(len)); + for (size_t i=0; iitems[i] = _unpack(s); + } + return MP_OBJ_FROM_PTR(t); + } + case 0xc1: // never used + case 0xc7: // ext 8 + case 0xc8: // ext 16 + case 0xc9: // ext 32 + case 0xcb: // float 64 + case 0xcc: // uint 8 + case 0xcd: // uint 16 + case 0xce: // uint 32 + case 0xcf: // uint 64 + case 0xd3: // int 64 + case 0xd4: // fixenxt 1 + case 0xd5: // fixenxt 2 + case 0xd6: // fixenxt 4 + case 0xd7: // fixenxt 8 + case 0xd8: // fixenxt 16 + default: + mp_raise_ValueError(translate("no unpacker found")); + } +} + +// Read msgpack encoded object from stream +STATIC mp_obj_t mod_msgpack_unpack(mp_obj_t stream_obj) { + msgpack_stream_t s = get_stream(stream_obj, MP_STREAM_OP_READ); + return _unpack(&s); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_msgpack_unpack_obj, mod_msgpack_unpack); + +STATIC const mp_rom_map_elem_t msgpack_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_msgpack) }, + { MP_ROM_QSTR(MP_QSTR_pack), MP_ROM_PTR(&mod_msgpack_pack_obj) }, + { MP_ROM_QSTR(MP_QSTR_unpack), MP_ROM_PTR(&mod_msgpack_unpack_obj) }, +}; + +STATIC MP_DEFINE_CONST_DICT(msgpack_module_globals, msgpack_module_globals_table); + +const mp_obj_module_t msgpack_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&msgpack_module_globals, +}; diff --git a/shared-bindings/msgpack/__init__.h b/shared-bindings/msgpack/__init__.h new file mode 100644 index 0000000000000..4836cc62e74fa --- /dev/null +++ b/shared-bindings/msgpack/__init__.h @@ -0,0 +1,34 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 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. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_MSGPACK___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_MSGPACK___INIT___H + +#include "py/obj.h" + +// Nothing now. + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_MSGPACK___INIT___H From 748472de7a0c2b18d88d868b1037252d57ab1bfb Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Sun, 8 Nov 2020 18:52:33 -0800 Subject: [PATCH 338/770] removed empty line at end of py/circuitpy_mpconfig.mk --- py/circuitpy_mpconfig.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 38ca795849e9f..4b6f4eb966654 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -299,4 +299,3 @@ CFLAGS += -DCIRCUITPY_ENABLE_MPY_NATIVE=$(CIRCUITPY_ENABLE_MPY_NATIVE) CIRCUITPY_MSGPACK ?= 0 CFLAGS += -DCIRCUITPY_MSGPACK=$(CIRCUITPY_MSGPACK) - From 513253bc3f22e5afa67155f7b4ca29a770929a3e Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Mon, 9 Nov 2020 18:09:56 -0800 Subject: [PATCH 339/770] moved logic to shared-module and added documentation --- ports/nrf/mpconfigport.mk | 2 - py/circuitpy_defns.mk | 1 + py/circuitpy_mpconfig.h | 2 +- py/circuitpy_mpconfig.mk | 2 +- shared-bindings/msgpack/__init__.c | 371 +++------------------------- shared-module/msgpack/__init__.c | 372 +++++++++++++++++++++++++++++ shared-module/msgpack/__init__.h | 34 +++ 7 files changed, 439 insertions(+), 345 deletions(-) create mode 100644 shared-module/msgpack/__init__.c create mode 100644 shared-module/msgpack/__init__.h diff --git a/ports/nrf/mpconfigport.mk b/ports/nrf/mpconfigport.mk index 2ee182b7d530d..9560064fbc5c4 100644 --- a/ports/nrf/mpconfigport.mk +++ b/ports/nrf/mpconfigport.mk @@ -52,8 +52,6 @@ MCU_SUB_VARIANT = nrf52840 # Fits on nrf52840 but space is tight on nrf52833. CIRCUITPY_AESIO ?= 1 -CIRCUITPY_MSGPACK ?= 1 - SD ?= s140 SOFTDEV_VERSION ?= 6.1.0 diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 144168c79e91c..8c452c2b0342c 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -465,6 +465,7 @@ SRC_SHARED_MODULE_ALL = \ memorymonitor/AllocationAlarm.c \ memorymonitor/AllocationSize.c \ network/__init__.c \ + msgpack/__init__.c \ os/__init__.c \ random/__init__.c \ rgbmatrix/RGBMatrix.c \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 3c4e5c2909c3b..64fedd506cf91 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -815,6 +815,7 @@ extern const struct _mp_obj_module_t msgpack_module; _EVE_MODULE \ MEMORYMONITOR_MODULE \ MICROCONTROLLER_MODULE \ + MSGPACK_MODULE \ NEOPIXEL_WRITE_MODULE \ NETWORK_MODULE \ SOCKET_MODULE \ @@ -846,7 +847,6 @@ extern const struct _mp_obj_module_t msgpack_module; USTACK_MODULE \ WATCHDOG_MODULE \ WIFI_MODULE \ - MSGPACK_MODULE \ // If weak links are enabled, just include strong links in the main list of modules, // and also include the underscore alternate names. diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 4b6f4eb966654..348a22cd4b1d2 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -297,5 +297,5 @@ CFLAGS += -DCIRCUITPY_WIFI=$(CIRCUITPY_WIFI) CIRCUITPY_ENABLE_MPY_NATIVE ?= 0 CFLAGS += -DCIRCUITPY_ENABLE_MPY_NATIVE=$(CIRCUITPY_ENABLE_MPY_NATIVE) -CIRCUITPY_MSGPACK ?= 0 +CIRCUITPY_MSGPACK ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_MSGPACK=$(CIRCUITPY_MSGPACK) diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index 74ab644702199..6329c502694bc 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -24,359 +24,48 @@ * THE SOFTWARE. */ -#include +#include "shared-bindings/msgpack/__init__.h" +#include "shared-module/msgpack/__init__.h" + +//| """Pack object in msgpack format +//| +//| The msgpack format is similar to json, except that the encoded data is binary. +//| See https://msgpack.org for details. +//| +//| Example: +//| import msgpack +//| from io import StringIO +//| +//| s = StringIO() +//| msgpack.pack({'list': [True, False, None, 1, 'abc'], 'str': 'blah'}, s) +//| s.seek(0) +//| print(msgpack.unpack(s))""" +//| + +//| def pack(obj, stream): +//| """Pack obj to stream.""" +//| ... +//| -#include "py/binary.h" -#include "py/objarray.h" -#include "py/objlist.h" -#include "py/objstringio.h" -#include "py/parsenum.h" -#include "py/runtime.h" -#include "py/stream.h" - -#include "supervisor/shared/translate.h" - -//////////////////////////////////////////////////////////////// -// stream management - -typedef struct _msgpack_stream_t { - mp_obj_t stream_obj; - mp_uint_t (*read)(mp_obj_t obj, void *buf, mp_uint_t size, int *errcode); - mp_uint_t (*write)(mp_obj_t obj, const void *buf, mp_uint_t size, int *errcode); - int errcode; -} msgpack_stream_t; - -STATIC msgpack_stream_t get_stream(mp_obj_t stream_obj, int flags) { - const mp_stream_p_t *stream_p = mp_get_stream_raise(stream_obj, flags); - msgpack_stream_t s = {stream_obj, stream_p->read, stream_p->write, 0}; - return s; -} - -//////////////////////////////////////////////////////////////// -// readers - -STATIC void read(msgpack_stream_t *s, void *buf, mp_uint_t size) { - if (size == 0) return; - mp_uint_t ret = s->read(s->stream_obj, buf, size, &s->errcode); - if (s->errcode != 0) { - mp_raise_OSError(s->errcode); - } - if (ret == 0) { - mp_raise_msg(&mp_type_EOFError, NULL); - } -} - -STATIC uint32_t read_bytes(msgpack_stream_t *s, mp_uint_t n_bytes) { - uint32_t res = 0; - read(s, &res, n_bytes); - return res; -} - -size_t read_size(msgpack_stream_t *s, uint8_t len_index) { - size_t n_bytes = 4; - switch (len_index) { - case 0: n_bytes = 1; break; - case 1: n_bytes = 2; break; - case 2: n_bytes = 4; break; - } - size_t res = 0; - read(s, &res, n_bytes); - return res; -} - -//////////////////////////////////////////////////////////////// -// writers - -STATIC void write(msgpack_stream_t *s, const void *buf, mp_uint_t size) { - mp_uint_t ret = s->write(s->stream_obj, buf, size, &s->errcode); - if (s->errcode != 0) { - mp_raise_OSError(s->errcode); - } - if (ret == 0) { - mp_raise_msg(&mp_type_EOFError, NULL); - } -} - -STATIC void write_bytes(msgpack_stream_t *s, mp_uint_t n_bytes, uint32_t obj) { - write(s, &obj, n_bytes); -} - -void write_size(msgpack_stream_t *s, uint8_t code, size_t size) { - if ((uint8_t)size == size) { - write_bytes(s, 1, code); - write_bytes(s, 1, size); - } else if ((uint16_t)size == size) { - write_bytes(s, 1, code+1); - write_bytes(s, 2, size); - } else { - write_bytes(s, 1, code+2); - write_bytes(s, 4, size); - } -} - -//////////////////////////////////////////////////////////////// -// packers - -// This is a helper function to iterate through a dictionary. The state of -// the iteration is held in *cur and should be initialised with zero for the -// first call. Will return NULL when no more elements are available. -STATIC mp_map_elem_t *dict_iter_next(mp_obj_dict_t *dict, size_t *cur) { - size_t max = dict->map.alloc; - mp_map_t *map = &dict->map; - - for (size_t i = *cur; i < max; i++) { - if (MP_MAP_SLOT_IS_FILLED(map, i)) { - *cur = i + 1; - return &(map->table[i]); - } - } - - return NULL; -} - - -STATIC void pack_int(msgpack_stream_t *s, int32_t x) { - if (x > -32 && x < 128) { - write_bytes(s, 1, x); - } else if ((int8_t)x == x) { - write_bytes(s, 1, 0xd0); - write_bytes(s, 1, x); - } else if ((int16_t)x == x) { - write_bytes(s, 1, 0xd1); - write_bytes(s, 2, x); - } else { - write_bytes(s, 1, 0xd2); - write_bytes(s, 4, x); - } -} - -void pack_bin(msgpack_stream_t *s, const uint8_t* data, size_t len) { - write_size(s, 0xc4, len); - for (size_t i=0; ilen); - for (size_t i=0; ilen; i++) { - _pack(self->items[i], s); - } - } else if (MP_OBJ_IS_TYPE(obj, &mp_type_list)) { - // list (layout differs from tuple) - mp_obj_list_t *self = MP_OBJ_TO_PTR(obj); - pack_array(s, self->len); - for (size_t i=0; ilen; i++) { - _pack(self->items[i], s); - } - } else if (MP_OBJ_IS_TYPE(obj, &mp_type_dict)) { - // dict - mp_obj_dict_t *self = MP_OBJ_TO_PTR(obj); - pack_dict(s, self->map.used); - size_t cur = 0; - mp_map_elem_t *next = NULL; - while ((next = dict_iter_next(self, &cur)) != NULL) { - _pack(next->key, s); - _pack(next->value, s); - } - } else if (mp_obj_is_float(obj)) { - mp_float_t f = mp_obj_float_get(obj); - write_bytes(s, 1, 0xca); - write(s, &f, 4); - } else if (obj == mp_const_none) { - write_bytes(s, 1, 0xc0); - } else if (obj == mp_const_false) { - write_bytes(s, 1, 0xc2); - } else if (obj == mp_const_true) { - write_bytes(s, 1, 0xc3); - } else { - mp_raise_ValueError(translate("no packer")); - } -} - -// Write obj to stream in msgpack format STATIC mp_obj_t mod_msgpack_pack(mp_obj_t obj, mp_obj_t stream_obj) { - msgpack_stream_t s = get_stream(stream_obj, MP_STREAM_OP_WRITE); - _pack(obj, &s); + common_hal_msgpack_pack(obj, stream_obj); return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_msgpack_pack_obj, mod_msgpack_pack); -//////////////////////////////////////////////////////////////// -// un-packers -STATIC mp_obj_t _unpack(msgpack_stream_t *s) { - uint8_t code = read_bytes(s, 1); - if (((code & 0b10000000) == 0) || ((code & 0b11100000) == 0b11100000)) { - // int - return MP_OBJ_NEW_SMALL_INT((int8_t)code); - } - if ((code & 0b11100000) == 0b10100000) { - // str - size_t len = code & 0b11111; - // allocate on stack; len < 32 - char str[len]; - read(s, &str, len); - return mp_obj_new_str(str, len); - } - if ((code & 0b11110000) == 0b10010000) { - // array (tuple) - size_t len = code & 0b1111; - mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(len, NULL)); - for (size_t i=0; iitems[i] = _unpack(s); - } - return MP_OBJ_FROM_PTR(t); - } - if ((code & 0b11110000) == 0b10000000) { - // map (dict) - size_t len = code & 0b1111; - mp_obj_dict_t *d = MP_OBJ_TO_PTR(mp_obj_new_dict(len)); - for (size_t i=0; iitems[i] = _unpack(s); - } - return MP_OBJ_FROM_PTR(t); - } - case 0xc1: // never used - case 0xc7: // ext 8 - case 0xc8: // ext 16 - case 0xc9: // ext 32 - case 0xcb: // float 64 - case 0xcc: // uint 8 - case 0xcd: // uint 16 - case 0xce: // uint 32 - case 0xcf: // uint 64 - case 0xd3: // int 64 - case 0xd4: // fixenxt 1 - case 0xd5: // fixenxt 2 - case 0xd6: // fixenxt 4 - case 0xd7: // fixenxt 8 - case 0xd8: // fixenxt 16 - default: - mp_raise_ValueError(translate("no unpacker found")); - } -} +//| def pack(obj, stream) -> obj: +//| """Unpack and return one object (in msgpack format) from stream. +//| Call repeatedly to read multiple objects from the stream.""" +//| ... +//| -// Read msgpack encoded object from stream STATIC mp_obj_t mod_msgpack_unpack(mp_obj_t stream_obj) { - msgpack_stream_t s = get_stream(stream_obj, MP_STREAM_OP_READ); - return _unpack(&s); + return common_hal_msgpack_unpack(stream_obj); } STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_msgpack_unpack_obj, mod_msgpack_unpack); + STATIC const mp_rom_map_elem_t msgpack_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_msgpack) }, { MP_ROM_QSTR(MP_QSTR_pack), MP_ROM_PTR(&mod_msgpack_pack_obj) }, diff --git a/shared-module/msgpack/__init__.c b/shared-module/msgpack/__init__.c new file mode 100644 index 0000000000000..4a969901d1cb0 --- /dev/null +++ b/shared-module/msgpack/__init__.c @@ -0,0 +1,372 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Bernhard Boser + * + * 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 + +#include "py/binary.h" +#include "py/objarray.h" +#include "py/objlist.h" +#include "py/objstringio.h" +#include "py/parsenum.h" +#include "py/runtime.h" +#include "py/stream.h" + +#include "supervisor/shared/translate.h" + +//////////////////////////////////////////////////////////////// +// stream management + +typedef struct _msgpack_stream_t { + mp_obj_t stream_obj; + mp_uint_t (*read)(mp_obj_t obj, void *buf, mp_uint_t size, int *errcode); + mp_uint_t (*write)(mp_obj_t obj, const void *buf, mp_uint_t size, int *errcode); + int errcode; +} msgpack_stream_t; + +STATIC msgpack_stream_t get_stream(mp_obj_t stream_obj, int flags) { + const mp_stream_p_t *stream_p = mp_get_stream_raise(stream_obj, flags); + msgpack_stream_t s = {stream_obj, stream_p->read, stream_p->write, 0}; + return s; +} + +//////////////////////////////////////////////////////////////// +// readers + +STATIC void read(msgpack_stream_t *s, void *buf, mp_uint_t size) { + if (size == 0) return; + mp_uint_t ret = s->read(s->stream_obj, buf, size, &s->errcode); + if (s->errcode != 0) { + mp_raise_OSError(s->errcode); + } + if (ret == 0) { + mp_raise_msg(&mp_type_EOFError, NULL); + } +} + +STATIC uint32_t read_bytes(msgpack_stream_t *s, mp_uint_t n_bytes) { + uint32_t res = 0; + read(s, &res, n_bytes); + return res; +} + +size_t read_size(msgpack_stream_t *s, uint8_t len_index) { + size_t n_bytes = 4; + switch (len_index) { + case 0: n_bytes = 1; break; + case 1: n_bytes = 2; break; + case 2: n_bytes = 4; break; + } + size_t res = 0; + read(s, &res, n_bytes); + return res; +} + +//////////////////////////////////////////////////////////////// +// writers + +STATIC void write(msgpack_stream_t *s, const void *buf, mp_uint_t size) { + mp_uint_t ret = s->write(s->stream_obj, buf, size, &s->errcode); + if (s->errcode != 0) { + mp_raise_OSError(s->errcode); + } + if (ret == 0) { + mp_raise_msg(&mp_type_EOFError, NULL); + } +} + +STATIC void write_bytes(msgpack_stream_t *s, mp_uint_t n_bytes, uint32_t obj) { + write(s, &obj, n_bytes); +} + +void write_size(msgpack_stream_t *s, uint8_t code, size_t size) { + if ((uint8_t)size == size) { + write_bytes(s, 1, code); + write_bytes(s, 1, size); + } else if ((uint16_t)size == size) { + write_bytes(s, 1, code+1); + write_bytes(s, 2, size); + } else { + write_bytes(s, 1, code+2); + write_bytes(s, 4, size); + } +} + +//////////////////////////////////////////////////////////////// +// packers + +// This is a helper function to iterate through a dictionary. The state of +// the iteration is held in *cur and should be initialised with zero for the +// first call. Will return NULL when no more elements are available. +STATIC mp_map_elem_t *dict_iter_next(mp_obj_dict_t *dict, size_t *cur) { + size_t max = dict->map.alloc; + mp_map_t *map = &dict->map; + + for (size_t i = *cur; i < max; i++) { + if (MP_MAP_SLOT_IS_FILLED(map, i)) { + *cur = i + 1; + return &(map->table[i]); + } + } + + return NULL; +} + +STATIC void pack_int(msgpack_stream_t *s, int32_t x) { + if (x > -32 && x < 128) { + write_bytes(s, 1, x); + } else if ((int8_t)x == x) { + write_bytes(s, 1, 0xd0); + write_bytes(s, 1, x); + } else if ((int16_t)x == x) { + write_bytes(s, 1, 0xd1); + write_bytes(s, 2, x); + } else { + write_bytes(s, 1, 0xd2); + write_bytes(s, 4, x); + } +} + +void pack_bin(msgpack_stream_t *s, const uint8_t* data, size_t len) { + write_size(s, 0xc4, len); + for (size_t i=0; ilen); + for (size_t i=0; ilen; i++) { + pack(self->items[i], s); + } + } else if (MP_OBJ_IS_TYPE(obj, &mp_type_list)) { + // list (layout differs from tuple) + mp_obj_list_t *self = MP_OBJ_TO_PTR(obj); + pack_array(s, self->len); + for (size_t i=0; ilen; i++) { + pack(self->items[i], s); + } + } else if (MP_OBJ_IS_TYPE(obj, &mp_type_dict)) { + // dict + mp_obj_dict_t *self = MP_OBJ_TO_PTR(obj); + pack_dict(s, self->map.used); + size_t cur = 0; + mp_map_elem_t *next = NULL; + while ((next = dict_iter_next(self, &cur)) != NULL) { + pack(next->key, s); + pack(next->value, s); + } + } else if (mp_obj_is_float(obj)) { + mp_float_t f = mp_obj_float_get(obj); + write_bytes(s, 1, 0xca); + write(s, &f, 4); + } else if (obj == mp_const_none) { + write_bytes(s, 1, 0xc0); + } else if (obj == mp_const_false) { + write_bytes(s, 1, 0xc2); + } else if (obj == mp_const_true) { + write_bytes(s, 1, 0xc3); + } else { + mp_raise_ValueError(translate("no packer")); + } +} + +//////////////////////////////////////////////////////////////// +// unpacker + +mp_obj_t unpack(msgpack_stream_t *s) { + uint8_t code = read_bytes(s, 1); + if (((code & 0b10000000) == 0) || ((code & 0b11100000) == 0b11100000)) { + // int + return MP_OBJ_NEW_SMALL_INT((int8_t)code); + } + if ((code & 0b11100000) == 0b10100000) { + // str + size_t len = code & 0b11111; + // allocate on stack; len < 32 + char str[len]; + read(s, &str, len); + return mp_obj_new_str(str, len); + } + if ((code & 0b11110000) == 0b10010000) { + // array (tuple) + size_t len = code & 0b1111; + mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(len, NULL)); + for (size_t i=0; iitems[i] = unpack(s); + } + return MP_OBJ_FROM_PTR(t); + } + if ((code & 0b11110000) == 0b10000000) { + // map (dict) + size_t len = code & 0b1111; + mp_obj_dict_t *d = MP_OBJ_TO_PTR(mp_obj_new_dict(len)); + for (size_t i=0; iitems[i] = unpack(s); + } + return MP_OBJ_FROM_PTR(t); + } + case 0xc1: // never used + case 0xc7: // ext 8 + case 0xc8: // ext 16 + case 0xc9: // ext 32 + case 0xcb: // float 64 + case 0xcc: // uint 8 + case 0xcd: // uint 16 + case 0xce: // uint 32 + case 0xcf: // uint 64 + case 0xd3: // int 64 + case 0xd4: // fixenxt 1 + case 0xd5: // fixenxt 2 + case 0xd6: // fixenxt 4 + case 0xd7: // fixenxt 8 + case 0xd8: // fixenxt 16 + default: + mp_raise_ValueError(translate("no unpacker found")); + } +} + +void common_hal_msgpack_pack(mp_obj_t obj, mp_obj_t stream_obj) { + msgpack_stream_t stream = get_stream(stream_obj, MP_STREAM_OP_WRITE); + pack(obj, &stream); +} + +mp_obj_t common_hal_msgpack_unpack(mp_obj_t stream_obj) { + msgpack_stream_t stream = get_stream(stream_obj, MP_STREAM_OP_WRITE); + return unpack(&stream); +} + diff --git a/shared-module/msgpack/__init__.h b/shared-module/msgpack/__init__.h new file mode 100644 index 0000000000000..0a5e7852ad9c9 --- /dev/null +++ b/shared-module/msgpack/__init__.h @@ -0,0 +1,34 @@ +/* + * 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. + */ +#ifndef MICROPY_INCLUDED_SHARED_MODULE_MSGPACK___INIT___H +#define MICROPY_INCLUDED_SHARED_MODULE_MSGPACK___INIT___H + +#include "py/stream.h" + +void common_hal_msgpack_pack(mp_obj_t obj, mp_obj_t stream_obj); +mp_obj_t common_hal_msgpack_unpack(mp_obj_t stream_obj); + +#endif From e19782633a88ac5b076119d506ddef1d35728e4d Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Mon, 9 Nov 2020 18:12:55 -0800 Subject: [PATCH 340/770] removed blanks to make pre-commit check happy --- shared-bindings/msgpack/__init__.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index 6329c502694bc..b53fb9399846d 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -35,12 +35,12 @@ //| Example: //| import msgpack //| from io import StringIO -//| +//| //| s = StringIO() //| msgpack.pack({'list': [True, False, None, 1, 'abc'], 'str': 'blah'}, s) //| s.seek(0) //| print(msgpack.unpack(s))""" -//| +//| //| def pack(obj, stream): //| """Pack obj to stream.""" From 912691e0d28ecbef563610dc328f6b08c61b31b0 Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Mon, 9 Nov 2020 18:16:22 -0800 Subject: [PATCH 341/770] removed blanks line at end of file --- shared-module/msgpack/__init__.c | 1 - 1 file changed, 1 deletion(-) diff --git a/shared-module/msgpack/__init__.c b/shared-module/msgpack/__init__.c index 4a969901d1cb0..437469978bee4 100644 --- a/shared-module/msgpack/__init__.c +++ b/shared-module/msgpack/__init__.c @@ -369,4 +369,3 @@ mp_obj_t common_hal_msgpack_unpack(mp_obj_t stream_obj) { msgpack_stream_t stream = get_stream(stream_obj, MP_STREAM_OP_WRITE); return unpack(&stream); } - From f38bd59c6bbf3cb2f5e4417c676a12444e39f11b Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Mon, 9 Nov 2020 18:29:31 -0800 Subject: [PATCH 342/770] added signatures to documenation --- shared-bindings/msgpack/__init__.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index b53fb9399846d..720d88109a230 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -42,7 +42,7 @@ //| print(msgpack.unpack(s))""" //| -//| def pack(obj, stream): +//| def pack(obj: Any, buffer: WriteableBuffer) -> None: //| """Pack obj to stream.""" //| ... //| @@ -54,7 +54,7 @@ STATIC mp_obj_t mod_msgpack_pack(mp_obj_t obj, mp_obj_t stream_obj) { STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_msgpack_pack_obj, mod_msgpack_pack); -//| def pack(obj, stream) -> obj: +//| def unpack(buffer: ReadableBuffer) -> Any: //| """Unpack and return one object (in msgpack format) from stream. //| Call repeatedly to read multiple objects from the stream.""" //| ... From f91932d78374bec0fe6225f53a487919a956b76f Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Wed, 11 Nov 2020 16:37:15 -0800 Subject: [PATCH 343/770] make translate --- locale/circuitpython.pot | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 274d92168a99b..51feb16c35e6c 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-11-24 15:40-0500\n" +"POT-Creation-Date: 2020-12-01 18:38-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -3050,6 +3050,10 @@ msgstr "" msgid "no module named '%q'" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "no packer" +msgstr "" + #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c #: shared-bindings/displayio/ParallelBus.c msgid "no reset pin available" @@ -3063,6 +3067,10 @@ msgstr "" msgid "no such attribute" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "no unpacker found" +msgstr "" + #: ports/nrf/common-hal/_bleio/Connection.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" From 44bc75af37a464eb6e5ba26bab19f2150d58044d Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Thu, 12 Nov 2020 12:28:40 -0800 Subject: [PATCH 344/770] output little endian; update example --- shared-bindings/msgpack/__init__.c | 10 +- shared-module/msgpack/__init__.c | 147 ++++++++++++++++++++--------- 2 files changed, 106 insertions(+), 51 deletions(-) diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index 720d88109a230..a222177f748bf 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -34,12 +34,12 @@ //| //| Example: //| import msgpack -//| from io import StringIO +//| from io import BytesIO //| -//| s = StringIO() -//| msgpack.pack({'list': [True, False, None, 1, 'abc'], 'str': 'blah'}, s) -//| s.seek(0) -//| print(msgpack.unpack(s))""" +//| b = BytesIO() +//| msgpack.pack({'list': [True, False, None, 1, 'abc'], 'str': 'blah'}, b) +//| b.seek(0) +//| print(msgpack.unpack(b))""" //| //| def pack(obj: Any, buffer: WriteableBuffer) -> None: diff --git a/shared-module/msgpack/__init__.c b/shared-module/msgpack/__init__.c index 437469978bee4..505c1c96976d4 100644 --- a/shared-module/msgpack/__init__.c +++ b/shared-module/msgpack/__init__.c @@ -25,6 +25,7 @@ */ #include +#include #include "py/binary.h" #include "py/objarray.h" @@ -66,13 +67,37 @@ STATIC void read(msgpack_stream_t *s, void *buf, mp_uint_t size) { } } +/* STATIC uint32_t read_bytes(msgpack_stream_t *s, mp_uint_t n_bytes) { uint32_t res = 0; read(s, &res, n_bytes); return res; } +*/ +STATIC uint8_t read1(msgpack_stream_t *s) { + uint8_t res = 0; + read(s, &res, 1); + return res; +} + +STATIC uint16_t read2(msgpack_stream_t *s) { + uint16_t res = 0; + read(s, &res, 2); + int n = 1; + if (*(char *)&n == 1) res = __builtin_bswap16(res); + return res; +} + +STATIC uint32_t read4(msgpack_stream_t *s) { + uint32_t res = 0; + read(s, &res, 4); + int n = 1; + if (*(char *)&n == 1) res = __builtin_bswap32(res); + return res; +} -size_t read_size(msgpack_stream_t *s, uint8_t len_index) { +/* +STATIC size_t read_size(msgpack_stream_t *s, uint8_t len_index) { size_t n_bytes = 4; switch (len_index) { case 0: n_bytes = 1; break; @@ -83,6 +108,17 @@ size_t read_size(msgpack_stream_t *s, uint8_t len_index) { read(s, &res, n_bytes); return res; } +*/ + +STATIC size_t read_size(msgpack_stream_t *s, uint8_t len_index) { + size_t res; + switch (len_index) { + case 0: res = (size_t)read1(s); break; + case 1: res = (size_t)read2(s); break; + case 2: res = (size_t)read4(s); break; + } + return res; +} //////////////////////////////////////////////////////////////// // writers @@ -97,20 +133,33 @@ STATIC void write(msgpack_stream_t *s, const void *buf, mp_uint_t size) { } } -STATIC void write_bytes(msgpack_stream_t *s, mp_uint_t n_bytes, uint32_t obj) { - write(s, &obj, n_bytes); +STATIC void write1(msgpack_stream_t *s, uint8_t obj) { + write(s, &obj, 1); +} + +STATIC void write2(msgpack_stream_t *s, uint16_t obj) { + int n = 1; + if (*(char *)&n == 1) obj = __builtin_bswap16(obj); + write(s, &obj, 2); +} + +STATIC void write4(msgpack_stream_t *s, uint32_t obj) { + int n = 1; + if (*(char *)&n == 1) obj = __builtin_bswap32(obj); + write(s, &obj, 4); } -void write_size(msgpack_stream_t *s, uint8_t code, size_t size) { +// compute and write msgpack size code (array structures) +STATIC void write_size(msgpack_stream_t *s, uint8_t code, size_t size) { if ((uint8_t)size == size) { - write_bytes(s, 1, code); - write_bytes(s, 1, size); + write1(s, code); + write1(s, size); } else if ((uint16_t)size == size) { - write_bytes(s, 1, code+1); - write_bytes(s, 2, size); + write1(s, code+1); + write2(s, size); } else { - write_bytes(s, 1, code+2); - write_bytes(s, 4, size); + write1(s, code+2); + write4(s, size); } } @@ -136,61 +185,61 @@ STATIC mp_map_elem_t *dict_iter_next(mp_obj_dict_t *dict, size_t *cur) { STATIC void pack_int(msgpack_stream_t *s, int32_t x) { if (x > -32 && x < 128) { - write_bytes(s, 1, x); + write1(s, x); } else if ((int8_t)x == x) { - write_bytes(s, 1, 0xd0); - write_bytes(s, 1, x); + write1(s, 0xd0); + write1(s, x); } else if ((int16_t)x == x) { - write_bytes(s, 1, 0xd1); - write_bytes(s, 2, x); + write1(s, 0xd1); + write2(s, x); } else { - write_bytes(s, 1, 0xd2); - write_bytes(s, 4, x); + write1(s, 0xd2); + write4(s, x); } } void pack_bin(msgpack_stream_t *s, const uint8_t* data, size_t len) { write_size(s, 0xc4, len); for (size_t i=0; ivalue, s); } } else if (mp_obj_is_float(obj)) { - mp_float_t f = mp_obj_float_get(obj); - write_bytes(s, 1, 0xca); - write(s, &f, 4); + union Float { mp_float_t f; uint32_t u; }; + union Float data; + data.f = mp_obj_float_get(obj); + write1(s, 0xca); + write4(s, data.u); } else if (obj == mp_const_none) { - write_bytes(s, 1, 0xc0); + write1(s, 0xc0); } else if (obj == mp_const_false) { - write_bytes(s, 1, 0xc2); + write1(s, 0xc2); } else if (obj == mp_const_true) { - write_bytes(s, 1, 0xc3); + write1(s, 0xc3); } else { mp_raise_ValueError(translate("no packer")); } @@ -252,7 +303,7 @@ void pack(mp_obj_t obj, msgpack_stream_t *s) { // unpacker mp_obj_t unpack(msgpack_stream_t *s) { - uint8_t code = read_bytes(s, 1); + uint8_t code = read1(s); if (((code & 0b10000000) == 0) || ((code & 0b11100000) == 0b11100000)) { // int return MP_OBJ_NEW_SMALL_INT((int8_t)code); @@ -298,17 +349,24 @@ mp_obj_t unpack(msgpack_stream_t *s) { read(s, p, size); return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); } + case 0xcc: + return MP_OBJ_NEW_SMALL_INT(read1(s)); + case 0xcd: + return MP_OBJ_NEW_SMALL_INT(read2(s)); + case 0xce: + return MP_OBJ_NEW_SMALL_INT(read4(s)); case 0xca: { - float f; - read(s, &f, 4); - return mp_obj_new_float(f); + union Float { mp_float_t f; uint32_t u; }; + union Float data; + data.u = read4(s); + return mp_obj_new_float(data.f); } case 0xd0: - return MP_OBJ_NEW_SMALL_INT((int8_t)read_bytes(s, 1)); + return MP_OBJ_NEW_SMALL_INT((int8_t)read1(s)); case 0xd1: - return MP_OBJ_NEW_SMALL_INT((int16_t)read_bytes(s, 2)); + return MP_OBJ_NEW_SMALL_INT((int16_t)read2(s)); case 0xd2: - return MP_OBJ_NEW_SMALL_INT((int32_t)read_bytes(s, 4)); + return MP_OBJ_NEW_SMALL_INT((int32_t)read4(s)); case 0xd9: case 0xda: case 0xdb: { @@ -345,9 +403,6 @@ mp_obj_t unpack(msgpack_stream_t *s) { case 0xc8: // ext 16 case 0xc9: // ext 32 case 0xcb: // float 64 - case 0xcc: // uint 8 - case 0xcd: // uint 16 - case 0xce: // uint 32 case 0xcf: // uint 64 case 0xd3: // int 64 case 0xd4: // fixenxt 1 From b805bf8a6293ff4c6f8550946403e509a0aa9e37 Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Thu, 12 Nov 2020 13:21:59 -0800 Subject: [PATCH 345/770] cleanup --- shared-module/msgpack/__init__.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/shared-module/msgpack/__init__.c b/shared-module/msgpack/__init__.c index 505c1c96976d4..a825bb0f3b8d5 100644 --- a/shared-module/msgpack/__init__.c +++ b/shared-module/msgpack/__init__.c @@ -67,13 +67,6 @@ STATIC void read(msgpack_stream_t *s, void *buf, mp_uint_t size) { } } -/* -STATIC uint32_t read_bytes(msgpack_stream_t *s, mp_uint_t n_bytes) { - uint32_t res = 0; - read(s, &res, n_bytes); - return res; -} -*/ STATIC uint8_t read1(msgpack_stream_t *s) { uint8_t res = 0; read(s, &res, 1); @@ -96,20 +89,6 @@ STATIC uint32_t read4(msgpack_stream_t *s) { return res; } -/* -STATIC size_t read_size(msgpack_stream_t *s, uint8_t len_index) { - size_t n_bytes = 4; - switch (len_index) { - case 0: n_bytes = 1; break; - case 1: n_bytes = 2; break; - case 2: n_bytes = 4; break; - } - size_t res = 0; - read(s, &res, n_bytes); - return res; -} -*/ - STATIC size_t read_size(msgpack_stream_t *s, uint8_t len_index) { size_t res; switch (len_index) { From a310cde8c10878d83128c1a96b1dc4ecdf4b721a Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Thu, 12 Nov 2020 17:43:40 -0800 Subject: [PATCH 346/770] fixed res may not be initialized in read_size --- shared-module/msgpack/__init__.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shared-module/msgpack/__init__.c b/shared-module/msgpack/__init__.c index a825bb0f3b8d5..3508755e0f446 100644 --- a/shared-module/msgpack/__init__.c +++ b/shared-module/msgpack/__init__.c @@ -90,11 +90,12 @@ STATIC uint32_t read4(msgpack_stream_t *s) { } STATIC size_t read_size(msgpack_stream_t *s, uint8_t len_index) { - size_t res; + size_t res = 0; switch (len_index) { case 0: res = (size_t)read1(s); break; case 1: res = (size_t)read2(s); break; case 2: res = (size_t)read4(s); break; + default: mp_raise_ValueError(translate("too big")); } return res; } From 4b710796289756cb43275f19bafa9ff806e1011e Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Fri, 13 Nov 2020 17:00:32 -0800 Subject: [PATCH 347/770] update translations --- locale/circuitpython.pot | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 51feb16c35e6c..163d59428a805 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-12-01 18:38-0800\n" +"POT-Creation-Date: 2020-12-01 18:39-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -3528,6 +3528,10 @@ msgstr "" msgid "tobytes can be invoked for dense arrays only" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "too big" +msgstr "" + #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "" From 59c3e25168fde52939948f5c1ffce13557bf4f4b Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Tue, 17 Nov 2020 11:56:36 -0800 Subject: [PATCH 348/770] disable on boards tight on memory. add stddef.h to imports (not actually needed). --- ports/atmel-samd/boards/bdmicro_vina_d21/mpconfigboard.mk | 1 + .../boards/circuitplayground_express/mpconfigboard.mk | 1 + .../boards/circuitplayground_express_crickit/mpconfigboard.mk | 1 + .../boards/circuitplayground_express_displayio/mpconfigboard.mk | 1 + ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk | 1 + .../boards/feather_m0_express_crickit/mpconfigboard.mk | 1 + ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk | 1 + ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk | 1 + ports/atmel-samd/boards/snekboard/mpconfigboard.mk | 1 + .../atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk | 1 + ports/cxd56/boards/spresense/mpconfigboard.mk | 2 ++ shared-module/msgpack/__init__.c | 1 + 12 files changed, 13 insertions(+) diff --git a/ports/atmel-samd/boards/bdmicro_vina_d21/mpconfigboard.mk b/ports/atmel-samd/boards/bdmicro_vina_d21/mpconfigboard.mk index a9885d064bf71..4e2314b8d512a 100644 --- a/ports/atmel-samd/boards/bdmicro_vina_d21/mpconfigboard.mk +++ b/ports/atmel-samd/boards/bdmicro_vina_d21/mpconfigboard.mk @@ -14,6 +14,7 @@ LONGINT_IMPL = MPZ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 CIRCUITPY_VECTORIO = 0 CFLAGS_INLINE_LIMIT = 60 diff --git a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk index 13ec9e861cbbf..505f5c145db1c 100644 --- a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk @@ -15,6 +15,7 @@ LONGINT_IMPL = MPZ CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 MICROPY_PY_ASYNC_AWAIT = 0 SUPEROPT_GC = 0 diff --git a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk index 7aa45eb39e4b6..c3be33134cd96 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk @@ -16,6 +16,7 @@ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 CIRCUITPY_PIXELBUF = 1 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_RTC = 0 diff --git a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk index 3a43093a98cef..51e9b05af207a 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk @@ -16,6 +16,7 @@ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 CIRCUITPY_PIXELBUF = 0 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_RTC = 0 diff --git a/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk index dc02e1f60d4fd..73ce47199b418 100644 --- a/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk @@ -15,6 +15,7 @@ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 CIRCUITPY_VECTORIO = 0 CFLAGS_INLINE_LIMIT = 60 diff --git a/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk index 5624144e880b1..f06163b84af14 100644 --- a/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk @@ -18,6 +18,7 @@ CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_GAMEPAD = 0 CFLAGS_INLINE_LIMIT = 50 +CIRCUITPY_MSGPACK = 0 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice diff --git a/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk index 6f7f2d8b67744..0f1972abc3043 100644 --- a/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk @@ -15,6 +15,7 @@ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 # supersized, not ultra-supersized CIRCUITPY_VECTORIO = 0 diff --git a/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk index 7dd965000372c..0e9361a44333f 100644 --- a/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk @@ -14,6 +14,7 @@ LONGINT_IMPL = MPZ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 CIRCUITPY_VECTORIO = 0 CFLAGS_INLINE_LIMIT = 60 diff --git a/ports/atmel-samd/boards/snekboard/mpconfigboard.mk b/ports/atmel-samd/boards/snekboard/mpconfigboard.mk index e0262b6b22a4b..d7540fe64dcda 100644 --- a/ports/atmel-samd/boards/snekboard/mpconfigboard.mk +++ b/ports/atmel-samd/boards/snekboard/mpconfigboard.mk @@ -14,6 +14,7 @@ LONGINT_IMPL = MPZ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_GAMEPAD = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 CIRCUITPY_VECTORIO = 0 CFLAGS_INLINE_LIMIT = 60 diff --git a/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk b/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk index 5170f8a233fcc..ddf7246dfbc6d 100755 --- a/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk +++ b/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk @@ -15,6 +15,7 @@ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_GAMEPAD = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 CIRCUITPY_VECTORIO = 0 CFLAGS_INLINE_LIMIT = 60 diff --git a/ports/cxd56/boards/spresense/mpconfigboard.mk b/ports/cxd56/boards/spresense/mpconfigboard.mk index 7b8ac6ff63446..80c6e4b6924de 100644 --- a/ports/cxd56/boards/spresense/mpconfigboard.mk +++ b/ports/cxd56/boards/spresense/mpconfigboard.mk @@ -4,3 +4,5 @@ USB_PRODUCT = "Spresense" USB_MANUFACTURER = "Sony" INTERNAL_FLASH_FILESYSTEM = 1 + +CIRCUITPY_MSGPACK = 0 diff --git a/shared-module/msgpack/__init__.c b/shared-module/msgpack/__init__.c index 3508755e0f446..e550b01af984f 100644 --- a/shared-module/msgpack/__init__.c +++ b/shared-module/msgpack/__init__.c @@ -24,6 +24,7 @@ * THE SOFTWARE. */ +#include #include #include From 582a47d71a5d047abc7ee9a17b0940d1a1ed4b31 Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Tue, 17 Nov 2020 16:26:09 -0800 Subject: [PATCH 349/770] rename read, write to read_bytes, write_bytes --- ports/cxd56/boards/spresense/mpconfigboard.mk | 2 -- shared-module/msgpack/__init__.c | 23 +++++++++---------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/ports/cxd56/boards/spresense/mpconfigboard.mk b/ports/cxd56/boards/spresense/mpconfigboard.mk index 80c6e4b6924de..7b8ac6ff63446 100644 --- a/ports/cxd56/boards/spresense/mpconfigboard.mk +++ b/ports/cxd56/boards/spresense/mpconfigboard.mk @@ -4,5 +4,3 @@ USB_PRODUCT = "Spresense" USB_MANUFACTURER = "Sony" INTERNAL_FLASH_FILESYSTEM = 1 - -CIRCUITPY_MSGPACK = 0 diff --git a/shared-module/msgpack/__init__.c b/shared-module/msgpack/__init__.c index e550b01af984f..5bc7d1f6159f5 100644 --- a/shared-module/msgpack/__init__.c +++ b/shared-module/msgpack/__init__.c @@ -24,7 +24,6 @@ * THE SOFTWARE. */ -#include #include #include @@ -57,7 +56,7 @@ STATIC msgpack_stream_t get_stream(mp_obj_t stream_obj, int flags) { //////////////////////////////////////////////////////////////// // readers -STATIC void read(msgpack_stream_t *s, void *buf, mp_uint_t size) { +STATIC void read_bytes(msgpack_stream_t *s, void *buf, mp_uint_t size) { if (size == 0) return; mp_uint_t ret = s->read(s->stream_obj, buf, size, &s->errcode); if (s->errcode != 0) { @@ -70,13 +69,13 @@ STATIC void read(msgpack_stream_t *s, void *buf, mp_uint_t size) { STATIC uint8_t read1(msgpack_stream_t *s) { uint8_t res = 0; - read(s, &res, 1); + read_bytes(s, &res, 1); return res; } STATIC uint16_t read2(msgpack_stream_t *s) { uint16_t res = 0; - read(s, &res, 2); + read_bytes(s, &res, 2); int n = 1; if (*(char *)&n == 1) res = __builtin_bswap16(res); return res; @@ -84,7 +83,7 @@ STATIC uint16_t read2(msgpack_stream_t *s) { STATIC uint32_t read4(msgpack_stream_t *s) { uint32_t res = 0; - read(s, &res, 4); + read_bytes(s, &res, 4); int n = 1; if (*(char *)&n == 1) res = __builtin_bswap32(res); return res; @@ -104,7 +103,7 @@ STATIC size_t read_size(msgpack_stream_t *s, uint8_t len_index) { //////////////////////////////////////////////////////////////// // writers -STATIC void write(msgpack_stream_t *s, const void *buf, mp_uint_t size) { +STATIC void write_bytes(msgpack_stream_t *s, const void *buf, mp_uint_t size) { mp_uint_t ret = s->write(s->stream_obj, buf, size, &s->errcode); if (s->errcode != 0) { mp_raise_OSError(s->errcode); @@ -115,19 +114,19 @@ STATIC void write(msgpack_stream_t *s, const void *buf, mp_uint_t size) { } STATIC void write1(msgpack_stream_t *s, uint8_t obj) { - write(s, &obj, 1); + write_bytes(s, &obj, 1); } STATIC void write2(msgpack_stream_t *s, uint16_t obj) { int n = 1; if (*(char *)&n == 1) obj = __builtin_bswap16(obj); - write(s, &obj, 2); + write_bytes(s, &obj, 2); } STATIC void write4(msgpack_stream_t *s, uint32_t obj) { int n = 1; if (*(char *)&n == 1) obj = __builtin_bswap32(obj); - write(s, &obj, 4); + write_bytes(s, &obj, 4); } // compute and write msgpack size code (array structures) @@ -294,7 +293,7 @@ mp_obj_t unpack(msgpack_stream_t *s) { size_t len = code & 0b11111; // allocate on stack; len < 32 char str[len]; - read(s, &str, len); + read_bytes(s, &str, len); return mp_obj_new_str(str, len); } if ((code & 0b11110000) == 0b10010000) { @@ -327,7 +326,7 @@ mp_obj_t unpack(msgpack_stream_t *s) { vstr_t vstr; vstr_init_len(&vstr, size); byte *p = (byte*)vstr.buf; - read(s, p, size); + read_bytes(s, p, size); return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); } case 0xcc: @@ -356,7 +355,7 @@ mp_obj_t unpack(msgpack_stream_t *s) { vstr_t vstr; vstr_init_len(&vstr, size); byte *p = (byte*)vstr.buf; - read(s, p, size); + read_bytes(s, p, size); return mp_obj_new_str_from_vstr(&mp_type_str, &vstr); } case 0xde: From 87d4184dd5e143494b77daa8d43bbc997f727095 Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Wed, 18 Nov 2020 08:38:48 -0800 Subject: [PATCH 350/770] exclude spresense --- ports/cxd56/boards/spresense/mpconfigboard.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/cxd56/boards/spresense/mpconfigboard.mk b/ports/cxd56/boards/spresense/mpconfigboard.mk index 7b8ac6ff63446..1e81c4683fc2c 100644 --- a/ports/cxd56/boards/spresense/mpconfigboard.mk +++ b/ports/cxd56/boards/spresense/mpconfigboard.mk @@ -4,3 +4,5 @@ USB_PRODUCT = "Spresense" USB_MANUFACTURER = "Sony" INTERNAL_FLASH_FILESYSTEM = 1 + +CIRCUITPY_MSGPACK = 0 \ No newline at end of file From 546b15bf1abb66174c77eca4d21af71aa55384db Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Wed, 18 Nov 2020 08:53:55 -0800 Subject: [PATCH 351/770] add trailing newline --- ports/cxd56/boards/spresense/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/cxd56/boards/spresense/mpconfigboard.mk b/ports/cxd56/boards/spresense/mpconfigboard.mk index 1e81c4683fc2c..80c6e4b6924de 100644 --- a/ports/cxd56/boards/spresense/mpconfigboard.mk +++ b/ports/cxd56/boards/spresense/mpconfigboard.mk @@ -5,4 +5,4 @@ USB_MANUFACTURER = "Sony" INTERNAL_FLASH_FILESYSTEM = 1 -CIRCUITPY_MSGPACK = 0 \ No newline at end of file +CIRCUITPY_MSGPACK = 0 From cb863e4c5c9ed0c7628ccd737da03085d1bc1a5b Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Tue, 1 Dec 2020 22:19:48 -0600 Subject: [PATCH 352/770] Added to partial builds where frozen removed --- ports/atmel-samd/boards/8086_commander/mpconfigboard.mk | 1 + ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk | 1 + ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk | 1 + ports/atmel-samd/boards/xinabox_cc03/mpconfigboard.mk | 1 + ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk | 1 + 5 files changed, 5 insertions(+) diff --git a/ports/atmel-samd/boards/8086_commander/mpconfigboard.mk b/ports/atmel-samd/boards/8086_commander/mpconfigboard.mk index 66e1a12256097..f976dfe787cb8 100644 --- a/ports/atmel-samd/boards/8086_commander/mpconfigboard.mk +++ b/ports/atmel-samd/boards/8086_commander/mpconfigboard.mk @@ -19,6 +19,7 @@ SUPEROPT_GC = 0 CFLAGS_INLINE_LIMIT = 60 CIRCUITPY_GAMEPAD = 1 +CIRCUITPY_BUSDEVICE = 1 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID diff --git a/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk index 3ae94b231f432..6ea21ed82e824 100644 --- a/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk @@ -21,6 +21,7 @@ CIRCUITPY_SAMD = 0 CIRCUITPY_USB_MIDI = 0 CIRCUITPY_USB_HID = 0 CIRCUITPY_TOUCHIO = 0 +CIRCUITPY_BUSDEVICE = 1 CFLAGS_INLINE_LIMIT = 35 # Make more room. diff --git a/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk index 3ee2396729899..76a6be2e34e28 100644 --- a/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk @@ -22,6 +22,7 @@ CIRCUITPY_SAMD = 0 CIRCUITPY_USB_MIDI = 0 CIRCUITPY_USB_HID = 0 CIRCUITPY_TOUCHIO = 0 +CIRCUITPY_BUSDEVICE = 1 CFLAGS_INLINE_LIMIT = 35 # Make more room. diff --git a/ports/atmel-samd/boards/xinabox_cc03/mpconfigboard.mk b/ports/atmel-samd/boards/xinabox_cc03/mpconfigboard.mk index 7243c54db7a70..d6f333b5be6e7 100644 --- a/ports/atmel-samd/boards/xinabox_cc03/mpconfigboard.mk +++ b/ports/atmel-samd/boards/xinabox_cc03/mpconfigboard.mk @@ -21,5 +21,6 @@ CIRCUITPY_PULSEIO=0 CIRCUITPY_ROTARYIO=0 CIRCUITPY_TOUCHIO_USE_NATIVE=0 CIRCUITPY_TOUCHIO=0 +CIRCUITPY_BUSDEVICE=1 # Include these Python libraries in firmware. diff --git a/ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk b/ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk index 50b2100aba33d..fd2fa044a8d1a 100644 --- a/ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk +++ b/ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk @@ -24,6 +24,7 @@ CIRCUITPY_TOUCHIO=0 CIRCUITPY_USB_MIDI=0 CIRCUITPY_RTC=0 CIRCUITPY_COUNTIO=0 +CIRCUITPY_BUSDEVICE=1 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD From 1c00deb8be31856cd276ca56303c33ab63053a4a Mon Sep 17 00:00:00 2001 From: Maciej Stankiewicz Date: Tue, 1 Dec 2020 20:02:10 +0000 Subject: [PATCH 353/770] Translated using Weblate (Polish) Currently translated at 71.8% (621 of 864 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pl/ --- locale/pl.po | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/locale/pl.po b/locale/pl.po index 2c028527dcdfc..e2a064703e205 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-24 15:40-0500\n" -"PO-Revision-Date: 2020-12-01 19:56+0000\n" +"PO-Revision-Date: 2020-12-02 20:29+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" "Language: pl\n" @@ -152,7 +152,7 @@ msgstr "Obiekt '%q' nie jest iterowalny" #: py/obj.c msgid "'%q' object is not subscriptable" -msgstr "'%q' obiekt nie jest indeksowany" +msgstr "obiekt '%q' nie jest indeksowany" #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format @@ -292,7 +292,7 @@ msgstr "Adres musi mieć %d bajtów" #: shared-bindings/_bleio/Address.c msgid "Address type out of range" -msgstr "" +msgstr "Typ adresu poza zakresem" #: ports/esp32s2/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" @@ -409,7 +409,7 @@ msgstr "Próba przydzielenia %d bloków" #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." -msgstr "" +msgstr "Próba przydziału sterty, gdy MicroPython VM nie działa." #: shared-bindings/wifi/Radio.c msgid "Authentication failure" @@ -1191,7 +1191,7 @@ msgstr "Zły tryb uruchomienia." #: shared-module/_bleio/Attribute.c msgid "Invalid security_mode" -msgstr "" +msgstr "Nieprawidłowy security_mode" #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" @@ -1393,7 +1393,7 @@ msgstr "Brak pliku/katalogu" #: shared-module/rgbmatrix/RGBMatrix.c msgid "No timer available" -msgstr "" +msgstr "Brak dostępnego timera" #: supervisor/shared/safe_mode.c msgid "Nordic Soft Device failure assertion." @@ -1584,7 +1584,7 @@ msgstr "" #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" -msgstr "" +msgstr "Błąd generowania liczb losowych" #: shared-bindings/memorymonitor/AllocationSize.c #: shared-bindings/pulseio/PulseIn.c @@ -1665,11 +1665,11 @@ msgstr "Skanuj już w toku. Zatrzymaj za pomocą stop_scan." #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Selected CTS pin not valid" -msgstr "" +msgstr "Wybrany pin CTS jest nieprawidłowy" #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Selected RTS pin not valid" -msgstr "" +msgstr "Wybrany pin RTS jest nieprawidłowy" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c @@ -1717,7 +1717,7 @@ msgstr "Strumień nie ma metod readinto() lub write()." #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" -msgstr "" +msgstr "Podaj co najmniej jeden pin UART" #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" From 9e6b2b1da8b97a4663a5feb0954b759ab816c9b7 Mon Sep 17 00:00:00 2001 From: vkuthan Date: Tue, 1 Dec 2020 12:08:42 +0000 Subject: [PATCH 354/770] Translated using Weblate (Czech) Currently translated at 3.2% (28 of 864 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/cs/ --- locale/cs.po | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/locale/cs.po b/locale/cs.po index 05b5942fc5b42..c69ae2820b755 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-24 15:40-0500\n" -"PO-Revision-Date: 2020-11-30 18:06+0000\n" +"PO-Revision-Date: 2020-12-02 20:29+0000\n" "Last-Translator: vkuthan \n" "Language-Team: LANGUAGE \n" "Language: cs\n" @@ -122,35 +122,35 @@ msgstr "" #: py/proto.c msgid "'%q' object does not support '%q'" -msgstr "" +msgstr "Objekt '%q' nepodporuje '%q'" #: py/obj.c msgid "'%q' object does not support item assignment" -msgstr "" +msgstr "Objekt '%q' nepodporuje přiřazení položek" #: py/obj.c msgid "'%q' object does not support item deletion" -msgstr "" +msgstr "Objekt '%q' nepodporuje mazání položek" #: py/runtime.c msgid "'%q' object has no attribute '%q'" -msgstr "" +msgstr "Objekt '%q' nemá žádný atribut" #: py/runtime.c msgid "'%q' object is not an iterator" -msgstr "" +msgstr "Objekt '%q' není iterátor" #: py/objtype.c py/runtime.c msgid "'%q' object is not callable" -msgstr "" +msgstr "Objekt '%q' nelze volat" #: py/runtime.c msgid "'%q' object is not iterable" -msgstr "" +msgstr "Objekt '%q' není iterovatelný" #: py/obj.c msgid "'%q' object is not subscriptable" -msgstr "" +msgstr "Objekt '%q' nelze zapsat" #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format @@ -170,17 +170,17 @@ msgstr "" #: py/emitinlinethumb.c #, c-format msgid "'%s' expects an FPU register" -msgstr "" +msgstr "'%s' očekává register FPU" #: py/emitinlinethumb.c #, c-format msgid "'%s' expects an address of the form [a, b]" -msgstr "" +msgstr "'%s' očekává adresu ve formátu [a, b]" #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects an integer" -msgstr "" +msgstr "'%s' očekává integer (celé číslo)" #: py/emitinlinethumb.c #, c-format @@ -190,7 +190,7 @@ msgstr "" #: py/emitinlinethumb.c #, c-format msgid "'%s' expects {r0, r1, ...}" -msgstr "" +msgstr "'%s' očekává {r0, r1, ...}" #: py/emitinlinextensa.c #, c-format From 7655102ef25bc372000c8e9757694af6f979a78e Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Wed, 2 Dec 2020 21:51:54 +0100 Subject: [PATCH 355/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 44 ++++++++++++++++++++++++++++++++++++++-- locale/cs.po | 44 ++++++++++++++++++++++++++++++++++++++-- locale/de_DE.po | 44 ++++++++++++++++++++++++++++++++++++++-- locale/el.po | 44 ++++++++++++++++++++++++++++++++++++++-- locale/es.po | 44 ++++++++++++++++++++++++++++++++++++++-- locale/fil.po | 44 ++++++++++++++++++++++++++++++++++++++-- locale/fr.po | 44 ++++++++++++++++++++++++++++++++++++++-- locale/hi.po | 44 ++++++++++++++++++++++++++++++++++++++-- locale/it_IT.po | 44 ++++++++++++++++++++++++++++++++++++++-- locale/ja.po | 44 ++++++++++++++++++++++++++++++++++++++-- locale/ko.po | 44 ++++++++++++++++++++++++++++++++++++++-- locale/nl.po | 44 ++++++++++++++++++++++++++++++++++++++-- locale/pl.po | 44 ++++++++++++++++++++++++++++++++++++++-- locale/pt_BR.po | 44 ++++++++++++++++++++++++++++++++++++++-- locale/sv.po | 44 ++++++++++++++++++++++++++++++++++++++-- locale/zh_Latn_pinyin.po | 44 ++++++++++++++++++++++++++++++++++++++-- 16 files changed, 672 insertions(+), 32 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 6073b6a462df6..43dcc72889ac2 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-24 15:40-0500\n" +"POT-Creation-Date: 2020-11-27 23:57-0500\n" "PO-Revision-Date: 2020-10-10 23:51+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -862,6 +862,10 @@ msgstr "Diharapkan sebuah UUID" msgid "Expected an Address" msgstr "Diharapkan sebuah Alamat" +#: shared-bindings/alarm/__init__.c +msgid "Expected an alarm" +msgstr "" + #: shared-module/_pixelbuf/PixelBuf.c #, c-format msgid "Expected tuple of length %d, got %d" @@ -1008,6 +1012,10 @@ msgstr "Gagal Inisialisasi I2C" msgid "I2SOut not available" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" +msgstr "" + #: shared-bindings/aesio/aes.c #, c-format msgid "IV must be %d bytes long" @@ -1467,6 +1475,10 @@ msgstr "" "Hanya monokrom, 4bpp atau 8bpp yang diindeks, dan 16bpp atau lebih yang " "didukung: %d bpp diberikan" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "Only one alarm.time alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "" @@ -1526,6 +1538,10 @@ msgstr "Pin harus mendukung interupsi perangkat keras" msgid "Pin number already reserved by EXTI" msgstr "Nomor pin sudah dipesan oleh EXTI" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "PinAlarm not yet implemented" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1592,7 +1608,7 @@ msgstr "Pembalikan RS485 ditentukan saat tidak dalam mode RS485" msgid "RTC calibration is not supported on this board" msgstr "Kalibrasi RTC tidak didukung pada board ini" -#: shared-bindings/time/__init__.c +#: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "RTC tidak didukung di board ini" @@ -1739,6 +1755,10 @@ msgstr "Aliran tidak menemukan metode readinto() atau write()." msgid "Supply at least one UART pin" msgstr "Berikan setidaknya satu pin UART" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Supply one of monotonic_time or epoch_time" +msgstr "" + #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" msgstr "" @@ -1806,6 +1826,10 @@ msgstr "" msgid "Tile width must exactly divide bitmap width" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Time is in the past." +msgstr "" + #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Timeout is too long: Maximum timeout length is %d seconds" @@ -2528,6 +2552,10 @@ msgstr "" msgid "end_x should be an int" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "epoch_time not supported on this board" +msgstr "" + #: ports/nrf/common-hal/busio/UART.c #, c-format msgid "error = 0x%08lX" @@ -2897,6 +2925,10 @@ msgstr "" msgid "invalid syntax for number" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "io must be rtc io" +msgstr "" + #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "" @@ -3586,6 +3618,10 @@ msgstr "" msgid "trapz is defined for 1D arrays of equal length" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "trigger level must be 0 or 1" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" msgstr "" @@ -3728,6 +3764,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "wakeup conflict" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index c69ae2820b755..72b2162678c68 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-24 15:40-0500\n" +"POT-Creation-Date: 2020-11-27 23:57-0500\n" "PO-Revision-Date: 2020-12-02 20:29+0000\n" "Last-Translator: vkuthan \n" "Language-Team: LANGUAGE \n" @@ -848,6 +848,10 @@ msgstr "" msgid "Expected an Address" msgstr "" +#: shared-bindings/alarm/__init__.c +msgid "Expected an alarm" +msgstr "" + #: shared-module/_pixelbuf/PixelBuf.c #, c-format msgid "Expected tuple of length %d, got %d" @@ -993,6 +997,10 @@ msgstr "" msgid "I2SOut not available" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" +msgstr "" + #: shared-bindings/aesio/aes.c #, c-format msgid "IV must be %d bytes long" @@ -1444,6 +1452,10 @@ msgid "" "%d bpp given" msgstr "" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "Only one alarm.time alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "" @@ -1501,6 +1513,10 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "PinAlarm not yet implemented" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1562,7 +1578,7 @@ msgstr "" msgid "RTC calibration is not supported on this board" msgstr "" -#: shared-bindings/time/__init__.c +#: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "" @@ -1708,6 +1724,10 @@ msgstr "" msgid "Supply at least one UART pin" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Supply one of monotonic_time or epoch_time" +msgstr "" + #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" msgstr "" @@ -1771,6 +1791,10 @@ msgstr "" msgid "Tile width must exactly divide bitmap width" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Time is in the past." +msgstr "" + #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Timeout is too long: Maximum timeout length is %d seconds" @@ -2485,6 +2509,10 @@ msgstr "" msgid "end_x should be an int" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "epoch_time not supported on this board" +msgstr "" + #: ports/nrf/common-hal/busio/UART.c #, c-format msgid "error = 0x%08lX" @@ -2854,6 +2882,10 @@ msgstr "" msgid "invalid syntax for number" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "io must be rtc io" +msgstr "" + #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "" @@ -3541,6 +3573,10 @@ msgstr "" msgid "trapz is defined for 1D arrays of equal length" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "trigger level must be 0 or 1" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" msgstr "" @@ -3683,6 +3719,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "wakeup conflict" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 7dd79d9151c6a..a3b4cd2cc2224 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-24 15:40-0500\n" +"POT-Creation-Date: 2020-11-27 23:57-0500\n" "PO-Revision-Date: 2020-11-26 03:11+0000\n" "Last-Translator: Daniel Bravo Darriba \n" "Language: de_DE\n" @@ -858,6 +858,10 @@ msgstr "Eine UUID wird erwartet" msgid "Expected an Address" msgstr "Erwartet eine Adresse" +#: shared-bindings/alarm/__init__.c +msgid "Expected an alarm" +msgstr "" + #: shared-module/_pixelbuf/PixelBuf.c #, c-format msgid "Expected tuple of length %d, got %d" @@ -1008,6 +1012,10 @@ msgstr "I2C-Init-Fehler" msgid "I2SOut not available" msgstr "I2SOut nicht verfügbar" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" +msgstr "" + #: shared-bindings/aesio/aes.c #, c-format msgid "IV must be %d bytes long" @@ -1469,6 +1477,10 @@ msgstr "" "Nur monochrome, indizierte 4bpp oder 8bpp, und 16bpp oder größere BMPs " "unterstützt: %d bpp wurden gegeben" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "Only one alarm.time alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "" @@ -1526,6 +1538,10 @@ msgstr "Pin muss Hardware-Interrupts unterstützen" msgid "Pin number already reserved by EXTI" msgstr "PIN-Nummer bereits von EXTI reserviert" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "PinAlarm not yet implemented" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1592,7 +1608,7 @@ msgstr "RS485-Inversion angegeben, wenn nicht im RS485-Modus" msgid "RTC calibration is not supported on this board" msgstr "Die RTC-Kalibrierung wird auf diesem Board nicht unterstützt" -#: shared-bindings/time/__init__.c +#: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "Eine RTC wird auf diesem Board nicht unterstützt" @@ -1738,6 +1754,10 @@ msgstr "Stream fehlt readinto() oder write() Methode." msgid "Supply at least one UART pin" msgstr "Geben Sie mindestens einen UART-Pin an" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Supply one of monotonic_time or epoch_time" +msgstr "" + #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" msgstr "" @@ -1812,6 +1832,10 @@ msgstr "Kachelwert außerhalb der Grenzen" msgid "Tile width must exactly divide bitmap width" msgstr "Die Kachelbreite muss die Bitmap-Breite genau teilen" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Time is in the past." +msgstr "" + #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Timeout is too long: Maximum timeout length is %d seconds" @@ -2556,6 +2580,10 @@ msgstr "Ende des Formats wärend der Suche nach einem conversion specifier" msgid "end_x should be an int" msgstr "end_x sollte ein int sein" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "epoch_time not supported on this board" +msgstr "" + #: ports/nrf/common-hal/busio/UART.c #, c-format msgid "error = 0x%08lX" @@ -2926,6 +2954,10 @@ msgstr "ungültige Syntax für integer mit Basis %d" msgid "invalid syntax for number" msgstr "ungültige Syntax für number" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "io must be rtc io" +msgstr "" + #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "issubclass() arg 1 muss eine Klasse sein" @@ -3626,6 +3658,10 @@ msgstr "zu viele Werte zum Auspacken (erwartet %d)" msgid "trapz is defined for 1D arrays of equal length" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "trigger level must be 0 or 1" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" msgstr "Tupelindex außerhalb des Bereichs" @@ -3772,6 +3808,10 @@ msgstr "value_count muss größer als 0 sein" msgid "vectors must have same lengths" msgstr "Vektoren müssen die selbe Länge haben" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "wakeup conflict" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" msgstr "" diff --git a/locale/el.po b/locale/el.po index 8d6dad828e4e5..01e42604031cc 100644 --- a/locale/el.po +++ b/locale/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-24 15:40-0500\n" +"POT-Creation-Date: 2020-11-27 23:57-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -843,6 +843,10 @@ msgstr "" msgid "Expected an Address" msgstr "" +#: shared-bindings/alarm/__init__.c +msgid "Expected an alarm" +msgstr "" + #: shared-module/_pixelbuf/PixelBuf.c #, c-format msgid "Expected tuple of length %d, got %d" @@ -988,6 +992,10 @@ msgstr "" msgid "I2SOut not available" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" +msgstr "" + #: shared-bindings/aesio/aes.c #, c-format msgid "IV must be %d bytes long" @@ -1439,6 +1447,10 @@ msgid "" "%d bpp given" msgstr "" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "Only one alarm.time alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "" @@ -1496,6 +1508,10 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "PinAlarm not yet implemented" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1557,7 +1573,7 @@ msgstr "" msgid "RTC calibration is not supported on this board" msgstr "" -#: shared-bindings/time/__init__.c +#: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "" @@ -1703,6 +1719,10 @@ msgstr "" msgid "Supply at least one UART pin" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Supply one of monotonic_time or epoch_time" +msgstr "" + #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" msgstr "" @@ -1766,6 +1786,10 @@ msgstr "" msgid "Tile width must exactly divide bitmap width" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Time is in the past." +msgstr "" + #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Timeout is too long: Maximum timeout length is %d seconds" @@ -2480,6 +2504,10 @@ msgstr "" msgid "end_x should be an int" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "epoch_time not supported on this board" +msgstr "" + #: ports/nrf/common-hal/busio/UART.c #, c-format msgid "error = 0x%08lX" @@ -2849,6 +2877,10 @@ msgstr "" msgid "invalid syntax for number" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "io must be rtc io" +msgstr "" + #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "" @@ -3536,6 +3568,10 @@ msgstr "" msgid "trapz is defined for 1D arrays of equal length" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "trigger level must be 0 or 1" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" msgstr "" @@ -3678,6 +3714,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "wakeup conflict" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" msgstr "" diff --git a/locale/es.po b/locale/es.po index 6b0fde563c0c2..293a0c19e75c0 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-11-24 15:40-0500\n" +"POT-Creation-Date: 2020-11-27 23:57-0500\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: Iván Montiel Cardona \n" "Language-Team: \n" @@ -863,6 +863,10 @@ msgstr "Se esperaba un UUID" msgid "Expected an Address" msgstr "Se esperaba una dirección" +#: shared-bindings/alarm/__init__.c +msgid "Expected an alarm" +msgstr "" + #: shared-module/_pixelbuf/PixelBuf.c #, c-format msgid "Expected tuple of length %d, got %d" @@ -1009,6 +1013,10 @@ msgstr "I2C Error de inicio" msgid "I2SOut not available" msgstr "I2SOut no disponible" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" +msgstr "" + #: shared-bindings/aesio/aes.c #, c-format msgid "IV must be %d bytes long" @@ -1468,6 +1476,10 @@ msgstr "" "Solo se admiten BMP monocromáticos, indexados de 4 bpp u 8 bpp y 16 bpp o " "más: %d bpp proporcionados" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "Only one alarm.time alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "Solo un color puede ser transparente a la vez" @@ -1527,6 +1539,10 @@ msgstr "El pin debe admitir interrupciones de hardware" msgid "Pin number already reserved by EXTI" msgstr "Número de pin ya reservado por EXTI" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "PinAlarm not yet implemented" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1596,7 +1612,7 @@ msgstr "Se especifica inversión de RS485 si no está en modo RS485" msgid "RTC calibration is not supported on this board" msgstr "Calibración de RTC no es soportada en esta placa" -#: shared-bindings/time/__init__.c +#: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "RTC no soportado en esta placa" @@ -1742,6 +1758,10 @@ msgstr "A Stream le falta el método readinto() o write()." msgid "Supply at least one UART pin" msgstr "Suministre al menos un pin UART" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Supply one of monotonic_time or epoch_time" +msgstr "" + #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" msgstr "La entrada del sistema debe ser gnss.SatelliteSystem" @@ -1814,6 +1834,10 @@ msgstr "Valor de mosaico fuera de límites" msgid "Tile width must exactly divide bitmap width" msgstr "Ancho del Tile debe dividir exactamente el ancho de mapa de bits" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Time is in the past." +msgstr "" + #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Timeout is too long: Maximum timeout length is %d seconds" @@ -2551,6 +2575,10 @@ msgstr "el final del formato mientras se busca el especificador de conversión" msgid "end_x should be an int" msgstr "end_x debe ser un int" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "epoch_time not supported on this board" +msgstr "" + #: ports/nrf/common-hal/busio/UART.c #, c-format msgid "error = 0x%08lX" @@ -2920,6 +2948,10 @@ msgstr "sintaxis inválida para entero con base %d" msgid "invalid syntax for number" msgstr "sintaxis inválida para número" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "io must be rtc io" +msgstr "" + #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "issubclass() arg 1 debe ser una clase" @@ -3616,6 +3648,10 @@ msgstr "demasiados valores para descomprimir (%d esperado)" msgid "trapz is defined for 1D arrays of equal length" msgstr "trapz está definido para arreglos 1D de igual tamaño" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "trigger level must be 0 or 1" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" msgstr "tuple index fuera de rango" @@ -3758,6 +3794,10 @@ msgstr "value_count debe ser > 0" msgid "vectors must have same lengths" msgstr "los vectores deben tener el mismo tamaño" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "wakeup conflict" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" msgstr "watchdog no inicializado" diff --git a/locale/fil.po b/locale/fil.po index 9178623a29852..c492f36c0886a 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-24 15:40-0500\n" +"POT-Creation-Date: 2020-11-27 23:57-0500\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -856,6 +856,10 @@ msgstr "Umasa ng %q" msgid "Expected an Address" msgstr "" +#: shared-bindings/alarm/__init__.c +msgid "Expected an alarm" +msgstr "" + #: shared-module/_pixelbuf/PixelBuf.c #, c-format msgid "Expected tuple of length %d, got %d" @@ -1001,6 +1005,10 @@ msgstr "" msgid "I2SOut not available" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" +msgstr "" + #: shared-bindings/aesio/aes.c #, c-format msgid "IV must be %d bytes long" @@ -1457,6 +1465,10 @@ msgid "" "%d bpp given" msgstr "" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "Only one alarm.time alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "" @@ -1515,6 +1527,10 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "PinAlarm not yet implemented" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1578,7 +1594,7 @@ msgstr "" msgid "RTC calibration is not supported on this board" msgstr "RTC calibration ay hindi supportado ng board na ito" -#: shared-bindings/time/__init__.c +#: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "Hindi supportado ang RTC sa board na ito" @@ -1725,6 +1741,10 @@ msgstr "Stream kulang ng readinto() o write() method." msgid "Supply at least one UART pin" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Supply one of monotonic_time or epoch_time" +msgstr "" + #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" msgstr "" @@ -1788,6 +1808,10 @@ msgstr "" msgid "Tile width must exactly divide bitmap width" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Time is in the past." +msgstr "" + #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Timeout is too long: Maximum timeout length is %d seconds" @@ -2524,6 +2548,10 @@ msgstr "sa huli ng format habang naghahanap sa conversion specifier" msgid "end_x should be an int" msgstr "y ay dapat int" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "epoch_time not supported on this board" +msgstr "" + #: ports/nrf/common-hal/busio/UART.c #, c-format msgid "error = 0x%08lX" @@ -2894,6 +2922,10 @@ msgstr "maling sintaks sa integer na may base %d" msgid "invalid syntax for number" msgstr "maling sintaks sa number" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "io must be rtc io" +msgstr "" + #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "issubclass() arg 1 ay dapat na class" @@ -3591,6 +3623,10 @@ msgstr "masyadong maraming values para i-unpact (umaasa ng %d)" msgid "trapz is defined for 1D arrays of equal length" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "trigger level must be 0 or 1" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" msgstr "indeks ng tuple wala sa sakop" @@ -3733,6 +3769,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "wakeup conflict" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index bb9b6ea98d1cb..5dc91096c511e 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-24 15:40-0500\n" +"POT-Creation-Date: 2020-11-27 23:57-0500\n" "PO-Revision-Date: 2020-11-24 22:45+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" @@ -867,6 +867,10 @@ msgstr "Un UUID est attendu" msgid "Expected an Address" msgstr "Attendu une adresse" +#: shared-bindings/alarm/__init__.c +msgid "Expected an alarm" +msgstr "" + #: shared-module/_pixelbuf/PixelBuf.c #, c-format msgid "Expected tuple of length %d, got %d" @@ -1014,6 +1018,10 @@ msgstr "Erreur d'initialisation I2C" msgid "I2SOut not available" msgstr "I2SOut n'est pas disponible" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" +msgstr "" + #: shared-bindings/aesio/aes.c #, c-format msgid "IV must be %d bytes long" @@ -1473,6 +1481,10 @@ msgstr "" "Prise en charge uniquement des monochromes, 4 bpp ou 8 bpp indexés et 16 bpp " "ou plus : %d bpp fournis" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "Only one alarm.time alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "Une seule couleur peut être transparente à la fois" @@ -1534,6 +1546,10 @@ msgstr "La broche doit prendre en charge les interruptions matérielles" msgid "Pin number already reserved by EXTI" msgstr "Numéro de broche déjà réservé par EXTI" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "PinAlarm not yet implemented" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1602,7 +1618,7 @@ msgstr "Inversion RS485 spécifiée lorsqu'elle n'est pas en mode RS485" msgid "RTC calibration is not supported on this board" msgstr "étalonnage de la RTC non supportée sur cette carte" -#: shared-bindings/time/__init__.c +#: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "RTC non supportée sur cette carte" @@ -1748,6 +1764,10 @@ msgstr "Il manque une méthode readinto() ou write() au flux." msgid "Supply at least one UART pin" msgstr "Fournissez au moins une broche UART" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Supply one of monotonic_time or epoch_time" +msgstr "" + #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" msgstr "L'entrée du système doit être gnss.SatelliteSystem" @@ -1820,6 +1840,10 @@ msgstr "Valeur de tuile hors limites" msgid "Tile width must exactly divide bitmap width" msgstr "La largeur de la tuile doit diviser exactement la largeur de l'image" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Time is in the past." +msgstr "" + #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Timeout is too long: Maximum timeout length is %d seconds" @@ -2566,6 +2590,10 @@ msgstr "fin de format en cherchant une spécification de conversion" msgid "end_x should be an int" msgstr "end_x doit être un entier 'int'" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "epoch_time not supported on this board" +msgstr "" + #: ports/nrf/common-hal/busio/UART.c #, c-format msgid "error = 0x%08lX" @@ -2938,6 +2966,10 @@ msgstr "syntaxe invalide pour un entier de base %d" msgid "invalid syntax for number" msgstr "syntaxe invalide pour un nombre" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "io must be rtc io" +msgstr "" + #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "l'argument 1 de issubclass() doit être une classe" @@ -3637,6 +3669,10 @@ msgstr "trop de valeur à dégrouper (%d attendues)" msgid "trapz is defined for 1D arrays of equal length" msgstr "trapz n'est défini que pour des tableaux 1D de longueur égale" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "trigger level must be 0 or 1" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" msgstr "index du tuple hors gamme" @@ -3779,6 +3815,10 @@ msgstr "'value_count' doit être > 0" msgid "vectors must have same lengths" msgstr "les vecteurs doivent avoir la même longueur" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "wakeup conflict" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" msgstr "chien de garde non initialisé" diff --git a/locale/hi.po b/locale/hi.po index 025664069ddd9..b70a052019168 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-24 15:40-0500\n" +"POT-Creation-Date: 2020-11-27 23:57-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -843,6 +843,10 @@ msgstr "" msgid "Expected an Address" msgstr "" +#: shared-bindings/alarm/__init__.c +msgid "Expected an alarm" +msgstr "" + #: shared-module/_pixelbuf/PixelBuf.c #, c-format msgid "Expected tuple of length %d, got %d" @@ -988,6 +992,10 @@ msgstr "" msgid "I2SOut not available" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" +msgstr "" + #: shared-bindings/aesio/aes.c #, c-format msgid "IV must be %d bytes long" @@ -1439,6 +1447,10 @@ msgid "" "%d bpp given" msgstr "" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "Only one alarm.time alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "" @@ -1496,6 +1508,10 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "PinAlarm not yet implemented" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1557,7 +1573,7 @@ msgstr "" msgid "RTC calibration is not supported on this board" msgstr "" -#: shared-bindings/time/__init__.c +#: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "" @@ -1703,6 +1719,10 @@ msgstr "" msgid "Supply at least one UART pin" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Supply one of monotonic_time or epoch_time" +msgstr "" + #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" msgstr "" @@ -1766,6 +1786,10 @@ msgstr "" msgid "Tile width must exactly divide bitmap width" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Time is in the past." +msgstr "" + #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Timeout is too long: Maximum timeout length is %d seconds" @@ -2480,6 +2504,10 @@ msgstr "" msgid "end_x should be an int" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "epoch_time not supported on this board" +msgstr "" + #: ports/nrf/common-hal/busio/UART.c #, c-format msgid "error = 0x%08lX" @@ -2849,6 +2877,10 @@ msgstr "" msgid "invalid syntax for number" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "io must be rtc io" +msgstr "" + #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "" @@ -3536,6 +3568,10 @@ msgstr "" msgid "trapz is defined for 1D arrays of equal length" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "trigger level must be 0 or 1" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" msgstr "" @@ -3678,6 +3714,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "wakeup conflict" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index bb77d71cc353a..836d80585289c 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-24 15:40-0500\n" +"POT-Creation-Date: 2020-11-27 23:57-0500\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -856,6 +856,10 @@ msgstr "Atteso un %q" msgid "Expected an Address" msgstr "" +#: shared-bindings/alarm/__init__.c +msgid "Expected an alarm" +msgstr "" + #: shared-module/_pixelbuf/PixelBuf.c #, c-format msgid "Expected tuple of length %d, got %d" @@ -1001,6 +1005,10 @@ msgstr "" msgid "I2SOut not available" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" +msgstr "" + #: shared-bindings/aesio/aes.c #, c-format msgid "IV must be %d bytes long" @@ -1462,6 +1470,10 @@ msgid "" "%d bpp given" msgstr "" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "Only one alarm.time alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "" @@ -1524,6 +1536,10 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "PinAlarm not yet implemented" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1587,7 +1603,7 @@ msgstr "" msgid "RTC calibration is not supported on this board" msgstr "calibrazione RTC non supportata su questa scheda" -#: shared-bindings/time/__init__.c +#: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "RTC non supportato su questa scheda" @@ -1736,6 +1752,10 @@ msgstr "Metodi mancanti readinto() o write() allo stream." msgid "Supply at least one UART pin" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Supply one of monotonic_time or epoch_time" +msgstr "" + #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" msgstr "" @@ -1799,6 +1819,10 @@ msgstr "" msgid "Tile width must exactly divide bitmap width" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Time is in the past." +msgstr "" + #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Timeout is too long: Maximum timeout length is %d seconds" @@ -2525,6 +2549,10 @@ msgstr "" msgid "end_x should be an int" msgstr "y dovrebbe essere un int" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "epoch_time not supported on this board" +msgstr "" + #: ports/nrf/common-hal/busio/UART.c #, c-format msgid "error = 0x%08lX" @@ -2895,6 +2923,10 @@ msgstr "sintassi invalida per l'intero con base %d" msgid "invalid syntax for number" msgstr "sintassi invalida per il numero" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "io must be rtc io" +msgstr "" + #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "il primo argomento di issubclass() deve essere una classe" @@ -3598,6 +3630,10 @@ msgstr "troppi valori da scompattare (%d attesi)" msgid "trapz is defined for 1D arrays of equal length" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "trigger level must be 0 or 1" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" msgstr "indice della tupla fuori intervallo" @@ -3740,6 +3776,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "wakeup conflict" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" msgstr "" diff --git a/locale/ja.po b/locale/ja.po index bacf0df812767..2496db520cf0f 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-24 15:40-0500\n" +"POT-Creation-Date: 2020-11-27 23:57-0500\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: sporeball \n" "Language-Team: none\n" @@ -856,6 +856,10 @@ msgstr "UUIDが必要" msgid "Expected an Address" msgstr "Addressが必要" +#: shared-bindings/alarm/__init__.c +msgid "Expected an alarm" +msgstr "" + #: shared-module/_pixelbuf/PixelBuf.c #, c-format msgid "Expected tuple of length %d, got %d" @@ -1001,6 +1005,10 @@ msgstr "I2C初期化エラー" msgid "I2SOut not available" msgstr "I2SOutが利用できません" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" +msgstr "" + #: shared-bindings/aesio/aes.c #, c-format msgid "IV must be %d bytes long" @@ -1456,6 +1464,10 @@ msgid "" "%d bpp given" msgstr "" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "Only one alarm.time alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "" @@ -1514,6 +1526,10 @@ msgstr "ピンはハードウェア割り込みに対応していなければな msgid "Pin number already reserved by EXTI" msgstr "ピン番号はすでにEXTIによって予約されています" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "PinAlarm not yet implemented" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1575,7 +1591,7 @@ msgstr "" msgid "RTC calibration is not supported on this board" msgstr "このボードはRTCのキャリブレーションに非対応" -#: shared-bindings/time/__init__.c +#: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "このボードはRTCに対応していません" @@ -1721,6 +1737,10 @@ msgstr "ストリームにreadinto()またはwrite()メソッドがありませ msgid "Supply at least one UART pin" msgstr "少なくとも1つのUARTピンが必要" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Supply one of monotonic_time or epoch_time" +msgstr "" + #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" msgstr "system引数はgnss.SatelliteSystemでなければなりません" @@ -1790,6 +1810,10 @@ msgstr "タイル値が範囲外" msgid "Tile width must exactly divide bitmap width" msgstr "タイルの幅はビットマップの幅を割り切れる値でなければなりません" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Time is in the past." +msgstr "" + #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Timeout is too long: Maximum timeout length is %d seconds" @@ -2509,6 +2533,10 @@ msgstr "" msgid "end_x should be an int" msgstr "end_xは整数でなければなりません" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "epoch_time not supported on this board" +msgstr "" + #: ports/nrf/common-hal/busio/UART.c #, c-format msgid "error = 0x%08lX" @@ -2879,6 +2907,10 @@ msgstr "" msgid "invalid syntax for number" msgstr "数字として不正な構文" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "io must be rtc io" +msgstr "" + #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "issubclass()の第1引数はクラスでなければなりません" @@ -3569,6 +3601,10 @@ msgstr "アンパックする値が多すぎます (%d個を期待)" msgid "trapz is defined for 1D arrays of equal length" msgstr "trapzは同じ長さの1次元arrayに対して定義されています" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "trigger level must be 0 or 1" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" msgstr "" @@ -3711,6 +3747,10 @@ msgstr "value_countは0より大きくなければなりません" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "wakeup conflict" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" msgstr "" diff --git a/locale/ko.po b/locale/ko.po index 9e6cbb0c2a9c1..dcbbfb81d3853 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-24 15:40-0500\n" +"POT-Creation-Date: 2020-11-27 23:57-0500\n" "PO-Revision-Date: 2020-10-05 12:12+0000\n" "Last-Translator: Michal Čihař \n" "Language-Team: LANGUAGE \n" @@ -848,6 +848,10 @@ msgstr "UUID이 예상되었습니다." msgid "Expected an Address" msgstr "" +#: shared-bindings/alarm/__init__.c +msgid "Expected an alarm" +msgstr "" + #: shared-module/_pixelbuf/PixelBuf.c #, c-format msgid "Expected tuple of length %d, got %d" @@ -993,6 +997,10 @@ msgstr "" msgid "I2SOut not available" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" +msgstr "" + #: shared-bindings/aesio/aes.c #, c-format msgid "IV must be %d bytes long" @@ -1444,6 +1452,10 @@ msgid "" "%d bpp given" msgstr "" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "Only one alarm.time alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "" @@ -1501,6 +1513,10 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "PinAlarm not yet implemented" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1562,7 +1578,7 @@ msgstr "" msgid "RTC calibration is not supported on this board" msgstr "" -#: shared-bindings/time/__init__.c +#: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "" @@ -1708,6 +1724,10 @@ msgstr "" msgid "Supply at least one UART pin" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Supply one of monotonic_time or epoch_time" +msgstr "" + #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" msgstr "" @@ -1771,6 +1791,10 @@ msgstr "" msgid "Tile width must exactly divide bitmap width" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Time is in the past." +msgstr "" + #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Timeout is too long: Maximum timeout length is %d seconds" @@ -2486,6 +2510,10 @@ msgstr "" msgid "end_x should be an int" msgstr "" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "epoch_time not supported on this board" +msgstr "" + #: ports/nrf/common-hal/busio/UART.c #, c-format msgid "error = 0x%08lX" @@ -2855,6 +2883,10 @@ msgstr "구문(syntax)가 정수가 유효하지 않습니다" msgid "invalid syntax for number" msgstr "숫자에 대한 구문(syntax)가 유효하지 않습니다" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "io must be rtc io" +msgstr "" + #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "" @@ -3542,6 +3574,10 @@ msgstr "" msgid "trapz is defined for 1D arrays of equal length" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "trigger level must be 0 or 1" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" msgstr "" @@ -3684,6 +3720,10 @@ msgstr "" msgid "vectors must have same lengths" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "wakeup conflict" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 41a3ace76bd00..c5d9601c27d5c 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-24 15:40-0500\n" +"POT-Creation-Date: 2020-11-27 23:57-0500\n" "PO-Revision-Date: 2020-10-27 16:47+0000\n" "Last-Translator: Jelle Jager \n" "Language-Team: none\n" @@ -856,6 +856,10 @@ msgstr "Verwachtte een UUID" msgid "Expected an Address" msgstr "Verwachtte een adres" +#: shared-bindings/alarm/__init__.c +msgid "Expected an alarm" +msgstr "" + #: shared-module/_pixelbuf/PixelBuf.c #, c-format msgid "Expected tuple of length %d, got %d" @@ -1003,6 +1007,10 @@ msgstr "I2C Init Fout" msgid "I2SOut not available" msgstr "I2SOut is niet beschikbaar" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" +msgstr "" + #: shared-bindings/aesio/aes.c #, c-format msgid "IV must be %d bytes long" @@ -1462,6 +1470,10 @@ msgstr "" "Alleen monochrome en 4bpp of 8bpp, en 16bpp of grotere geïndiceerde BMP's " "zijn ondersteund: %d bpp is gegeven" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "Only one alarm.time alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "Er kan maar één kleur per keer transparant zijn" @@ -1522,6 +1534,10 @@ msgstr "Pin moet hardware interrupts ondersteunen" msgid "Pin number already reserved by EXTI" msgstr "Pin nummer al gereserveerd door EXTI" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "PinAlarm not yet implemented" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1592,7 +1608,7 @@ msgstr "RS485 inversie gespecificeerd terwijl niet in RS485 modus" msgid "RTC calibration is not supported on this board" msgstr "RTC calibratie niet ondersteund door dit board" -#: shared-bindings/time/__init__.c +#: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "RTC is niet ondersteund door dit board" @@ -1738,6 +1754,10 @@ msgstr "Stream mist readinto() of write() methode." msgid "Supply at least one UART pin" msgstr "Geef op zijn minst 1 UART pin op" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Supply one of monotonic_time or epoch_time" +msgstr "" + #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" msgstr "Systeem invoer moet gnss.SatelliteSystem zijn" @@ -1809,6 +1829,10 @@ msgstr "Tile waarde buiten bereik" msgid "Tile width must exactly divide bitmap width" msgstr "Tile breedte moet exact de bitmap breedte verdelen" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Time is in the past." +msgstr "" + #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Timeout is too long: Maximum timeout length is %d seconds" @@ -2540,6 +2564,10 @@ msgstr "einde van format terwijl zoekend naar conversie-specifier" msgid "end_x should be an int" msgstr "end_x moet een int zijn" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "epoch_time not supported on this board" +msgstr "" + #: ports/nrf/common-hal/busio/UART.c #, c-format msgid "error = 0x%08lX" @@ -2910,6 +2938,10 @@ msgstr "ongeldige syntax voor integer met grondtal %d" msgid "invalid syntax for number" msgstr "ongeldige syntax voor nummer" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "io must be rtc io" +msgstr "" + #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "issubclass() argument 1 moet een klasse zijn" @@ -3603,6 +3635,10 @@ msgstr "te veel waarden om uit te pakken (%d verwacht)" msgid "trapz is defined for 1D arrays of equal length" msgstr "trapz is gedefinieerd voor eendimensionale arrays van gelijke lengte" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "trigger level must be 0 or 1" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" msgstr "tuple index buiten bereik" @@ -3745,6 +3781,10 @@ msgstr "value_count moet groter dan 0 zijn" msgid "vectors must have same lengths" msgstr "vectoren moeten van gelijke lengte zijn" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "wakeup conflict" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" msgstr "" diff --git a/locale/pl.po b/locale/pl.po index e2a064703e205..12c612cc7f08e 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-24 15:40-0500\n" +"POT-Creation-Date: 2020-11-27 23:57-0500\n" "PO-Revision-Date: 2020-12-02 20:29+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" @@ -856,6 +856,10 @@ msgstr "Oczekiwano UUID" msgid "Expected an Address" msgstr "Oczekiwano adresu" +#: shared-bindings/alarm/__init__.c +msgid "Expected an alarm" +msgstr "" + #: shared-module/_pixelbuf/PixelBuf.c #, c-format msgid "Expected tuple of length %d, got %d" @@ -1001,6 +1005,10 @@ msgstr "Błąd inicjalizacji I2C" msgid "I2SOut not available" msgstr "I2SOut niedostępne" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" +msgstr "" + #: shared-bindings/aesio/aes.c #, c-format msgid "IV must be %d bytes long" @@ -1455,6 +1463,10 @@ msgid "" "%d bpp given" msgstr "" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "Only one alarm.time alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "W danym momencie przezroczysty może być tylko jeden kolor" @@ -1512,6 +1524,10 @@ msgstr "Pin musi obsługiwać przerwania sprzętowe" msgid "Pin number already reserved by EXTI" msgstr "" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "PinAlarm not yet implemented" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1573,7 +1589,7 @@ msgstr "" msgid "RTC calibration is not supported on this board" msgstr "Brak obsługi kalibracji RTC" -#: shared-bindings/time/__init__.c +#: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "Brak obsługi RTC" @@ -1719,6 +1735,10 @@ msgstr "Strumień nie ma metod readinto() lub write()." msgid "Supply at least one UART pin" msgstr "Podaj co najmniej jeden pin UART" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Supply one of monotonic_time or epoch_time" +msgstr "" + #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" msgstr "" @@ -1782,6 +1802,10 @@ msgstr "" msgid "Tile width must exactly divide bitmap width" msgstr "Szerokość bitmapy musi być wielokrotnością szerokości kafelka" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Time is in the past." +msgstr "" + #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Timeout is too long: Maximum timeout length is %d seconds" @@ -2503,6 +2527,10 @@ msgstr "koniec formatu przy szukaniu specyfikacji konwersji" msgid "end_x should be an int" msgstr "end_x powinien być całkowity" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "epoch_time not supported on this board" +msgstr "" + #: ports/nrf/common-hal/busio/UART.c #, c-format msgid "error = 0x%08lX" @@ -2872,6 +2900,10 @@ msgstr "zła składnia dla liczby całkowitej w bazie %d" msgid "invalid syntax for number" msgstr "zła składnia dla liczby" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "io must be rtc io" +msgstr "" + #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "argument 1 dla issubclass() musi być klasą" @@ -3561,6 +3593,10 @@ msgstr "zbyt wiele wartości do rozpakowania (oczekiwano %d)" msgid "trapz is defined for 1D arrays of equal length" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "trigger level must be 0 or 1" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" msgstr "indeks krotki poza zakresem" @@ -3703,6 +3739,10 @@ msgstr "value_count musi być > 0" msgid "vectors must have same lengths" msgstr "wektory muszą mieć identyczną długość" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "wakeup conflict" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" msgstr "" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 36b1317d7a252..39975643f14f8 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-24 15:40-0500\n" +"POT-Creation-Date: 2020-11-27 23:57-0500\n" "PO-Revision-Date: 2020-11-30 18:06+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -865,6 +865,10 @@ msgstr "Um UUID é necessário" msgid "Expected an Address" msgstr "Um endereço esperado" +#: shared-bindings/alarm/__init__.c +msgid "Expected an alarm" +msgstr "" + #: shared-module/_pixelbuf/PixelBuf.c #, c-format msgid "Expected tuple of length %d, got %d" @@ -1012,6 +1016,10 @@ msgstr "Erro de inicialização do I2C" msgid "I2SOut not available" msgstr "O I2SOut não está disponível" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" +msgstr "" + #: shared-bindings/aesio/aes.c #, c-format msgid "IV must be %d bytes long" @@ -1470,6 +1478,10 @@ msgstr "" "São compatíveis apenas os BMPs monocromáticos, indexados em 4bpp ou 8bpp e " "16bpp ou superior: determinado %d bpp" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "Only one alarm.time alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "Apenas uma cor pode ser transparente de cada vez" @@ -1531,6 +1543,10 @@ msgstr "O pino deve ser compatível com as interrupções do hardware" msgid "Pin number already reserved by EXTI" msgstr "Número do PIN já está reservado através da EXTI" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "PinAlarm not yet implemented" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1602,7 +1618,7 @@ msgstr "A definição da inversão do RS485 quando não está no modo RS485" msgid "RTC calibration is not supported on this board" msgstr "A calibração RTC não é suportada nesta placa" -#: shared-bindings/time/__init__.c +#: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "O RTC não é suportado nesta placa" @@ -1748,6 +1764,10 @@ msgstr "Transmita o método ausente readinto() ou write()." msgid "Supply at least one UART pin" msgstr "Forneça pelo menos um pino UART" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Supply one of monotonic_time or epoch_time" +msgstr "" + #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" msgstr "A entrada no sistema deve ser gnss.SatelliteSystem" @@ -1820,6 +1840,10 @@ msgstr "O valor do bloco está fora dos limites" msgid "Tile width must exactly divide bitmap width" msgstr "A largura do bloco deve dividir exatamente com a largura do bitmap" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Time is in the past." +msgstr "" + #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Timeout is too long: Maximum timeout length is %d seconds" @@ -2560,6 +2584,10 @@ msgstr "final de formato enquanto procura pelo especificador de conversão" msgid "end_x should be an int" msgstr "end_x deve ser um int" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "epoch_time not supported on this board" +msgstr "" + #: ports/nrf/common-hal/busio/UART.c #, c-format msgid "error = 0x%08lX" @@ -2929,6 +2957,10 @@ msgstr "sintaxe inválida para o número inteiro com base %d" msgid "invalid syntax for number" msgstr "sintaxe inválida para o número" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "io must be rtc io" +msgstr "" + #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "issubclass() arg 1 deve ser uma classe" @@ -3628,6 +3660,10 @@ msgstr "valores demais para descompactar (esperado %d)" msgid "trapz is defined for 1D arrays of equal length" msgstr "o trapz está definido para 1D arrays de igual tamanho" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "trigger level must be 0 or 1" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" msgstr "o índice da tupla está fora do intervalo" @@ -3770,6 +3806,10 @@ msgstr "o value_count deve ser > 0" msgid "vectors must have same lengths" msgstr "os vetores devem ter os mesmos comprimentos" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "wakeup conflict" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" msgstr "o watchdog não foi inicializado" diff --git a/locale/sv.po b/locale/sv.po index 47739e4aa1d3e..72aa0852df7b3 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-24 15:40-0500\n" +"POT-Creation-Date: 2020-11-27 23:57-0500\n" "PO-Revision-Date: 2020-11-30 18:06+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -856,6 +856,10 @@ msgstr "Förväntade en UUID" msgid "Expected an Address" msgstr "Förväntade en adress" +#: shared-bindings/alarm/__init__.c +msgid "Expected an alarm" +msgstr "" + #: shared-module/_pixelbuf/PixelBuf.c #, c-format msgid "Expected tuple of length %d, got %d" @@ -1001,6 +1005,10 @@ msgstr "I2C init-fel" msgid "I2SOut not available" msgstr "I2SOut är inte tillgängligt" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" +msgstr "" + #: shared-bindings/aesio/aes.c #, c-format msgid "IV must be %d bytes long" @@ -1460,6 +1468,10 @@ msgstr "" "Endast monokrom, indexerad 4 bpp eller 8 bpp och 16 bpp eller högre BMP: er " "stöds: %d bpp angiven" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "Only one alarm.time alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "Bara en färg kan vara genomskinlig i taget" @@ -1519,6 +1531,10 @@ msgstr "Pinnen måste stödja hårdvaruavbrott" msgid "Pin number already reserved by EXTI" msgstr "PInn-nummer redan reserverat av EXTI" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "PinAlarm not yet implemented" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1588,7 +1604,7 @@ msgstr "RS485-inversion specificerad när den inte är i RS485-läge" msgid "RTC calibration is not supported on this board" msgstr "RTC-kalibrering stöds inte av detta kort" -#: shared-bindings/time/__init__.c +#: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "RTC stöds inte av detta kort" @@ -1734,6 +1750,10 @@ msgstr "Stream saknar readinto() eller write() metod." msgid "Supply at least one UART pin" msgstr "Ange minst en UART-pinne" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Supply one of monotonic_time or epoch_time" +msgstr "" + #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" msgstr "Systeminträdet måste vara gnss. SatellitSystem" @@ -1805,6 +1825,10 @@ msgstr "Tile-värde utanför intervall" msgid "Tile width must exactly divide bitmap width" msgstr "Tile-bredd måste vara jämnt delbar med bredd på bitmap" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Time is in the past." +msgstr "" + #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Timeout is too long: Maximum timeout length is %d seconds" @@ -2534,6 +2558,10 @@ msgstr "slut på format vid sökning efter konverteringsspecificerare" msgid "end_x should be an int" msgstr "color ska vara en int" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "epoch_time not supported on this board" +msgstr "" + #: ports/nrf/common-hal/busio/UART.c #, c-format msgid "error = 0x%08lX" @@ -2903,6 +2931,10 @@ msgstr "ogiltig syntax för heltal med bas %d" msgid "invalid syntax for number" msgstr "ogiltig syntax för tal" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "io must be rtc io" +msgstr "" + #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "issubclass() arg 1 måste vara en klass" @@ -3596,6 +3628,10 @@ msgstr "för många värden att packa upp (förväntat %d)" msgid "trapz is defined for 1D arrays of equal length" msgstr "trapz är definierad för 1D-matriser med samma längd" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "trigger level must be 0 or 1" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" msgstr "tupelindex utanför intervallet" @@ -3738,6 +3774,10 @@ msgstr "value_count måste vara > 0" msgid "vectors must have same lengths" msgstr "vektorer måste ha samma längd" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "wakeup conflict" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" msgstr "watchdog är inte initierad" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 7a08bc6e8c1e8..eb24ad4210fe2 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-24 15:40-0500\n" +"POT-Creation-Date: 2020-11-27 23:57-0500\n" "PO-Revision-Date: 2020-11-19 01:28+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -854,6 +854,10 @@ msgstr "Yùqí UUID" msgid "Expected an Address" msgstr "Qídài yīgè dìzhǐ" +#: shared-bindings/alarm/__init__.c +msgid "Expected an alarm" +msgstr "" + #: shared-module/_pixelbuf/PixelBuf.c #, c-format msgid "Expected tuple of length %d, got %d" @@ -999,6 +1003,10 @@ msgstr "I2C chūshǐhuà cuòwù" msgid "I2SOut not available" msgstr "I2SOut bù kě yòng" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" +msgstr "" + #: shared-bindings/aesio/aes.c #, c-format msgid "IV must be %d bytes long" @@ -1457,6 +1465,10 @@ msgstr "" "Jǐn zhīchí dān sè, suǒyǐn wéi 4bpp huò 8bpp yǐjí 16bpp huò gèng gāo de BMP: " "Gěi chū %d bpp" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "Only one alarm.time alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "Yīcì zhǐ néng yǒuyī zhǒng yánsè shì tòumíng de" @@ -1515,6 +1527,10 @@ msgstr "Yǐn jiǎo bìxū zhīchí yìngjiàn zhōngduàn" msgid "Pin number already reserved by EXTI" msgstr "Zhēn hào yǐ bèi EXTI bǎoliú" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "PinAlarm not yet implemented" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1580,7 +1596,7 @@ msgstr "Wèi chǔyú RS485 móshì shí zhǐdìngle RS485 fǎn zhuǎn" msgid "RTC calibration is not supported on this board" msgstr "Cǐ bǎn bù zhīchí RTC jiàozhǔn" -#: shared-bindings/time/__init__.c +#: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "Cǐ bǎn bù zhīchí RTC" @@ -1726,6 +1742,10 @@ msgstr "Liú quēshǎo readinto() huò write() fāngfǎ." msgid "Supply at least one UART pin" msgstr "Dìngyì zhìshǎo yīgè UART yǐn jiǎo" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Supply one of monotonic_time or epoch_time" +msgstr "" + #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" msgstr "Xìtǒng tiáomù bìxū shì gnss.SatelliteSystem" @@ -1796,6 +1816,10 @@ msgstr "Píng pū zhí chāochū fànwéi" msgid "Tile width must exactly divide bitmap width" msgstr "Píng pū kuāndù bìxū huàfēn wèi tú kuāndù" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "Time is in the past." +msgstr "" + #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Timeout is too long: Maximum timeout length is %d seconds" @@ -2526,6 +2550,10 @@ msgstr "xúnzhǎo zhuǎnhuàn biāozhù géshì de jiéshù" msgid "end_x should be an int" msgstr "jiéwěi_x yīnggāi shì yīgè zhěngshù" +#: shared-bindings/alarm/time/TimeAlarm.c +msgid "epoch_time not supported on this board" +msgstr "" + #: ports/nrf/common-hal/busio/UART.c #, c-format msgid "error = 0x%08lX" @@ -2895,6 +2923,10 @@ msgstr "jīshù wèi %d de zhěng shǔ de yǔfǎ wúxiào" msgid "invalid syntax for number" msgstr "wúxiào de hàomǎ yǔfǎ" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "io must be rtc io" +msgstr "" + #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "issubclass() cānshù 1 bìxū shì yīgè lèi" @@ -3585,6 +3617,10 @@ msgstr "dǎkāi tài duō zhí (yùqí %d)" msgid "trapz is defined for 1D arrays of equal length" msgstr "Trapz shì wèi děng zhǎng de 1D shùzǔ dìngyì de" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "trigger level must be 0 or 1" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" msgstr "yuán zǔ suǒyǐn chāochū fànwéi" @@ -3727,6 +3763,10 @@ msgstr "zhí jìshù bìxū wèi > 0" msgid "vectors must have same lengths" msgstr "xiàngliàng bìxū jùyǒu xiāngtóng de chángdù" +#: ports/esp32s2/common-hal/alarm/pin/__init__.c +msgid "wakeup conflict" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" msgstr "wèi chū shǐ huà jiān shì qì" From 34bbcc4910014c3b4646d8005baf8244bac51f03 Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Wed, 2 Dec 2020 11:52:29 -0800 Subject: [PATCH 356/770] exclude nrf/simmel due to lack of flash --- ports/nrf/boards/simmel/mpconfigboard.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/nrf/boards/simmel/mpconfigboard.mk b/ports/nrf/boards/simmel/mpconfigboard.mk index e34739c0f3460..f702a336fd2da 100644 --- a/ports/nrf/boards/simmel/mpconfigboard.mk +++ b/ports/nrf/boards/simmel/mpconfigboard.mk @@ -16,6 +16,7 @@ CIRCUITPY_AUDIOMP3 = 0 CIRCUITPY_BUSIO = 1 CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_FRAMEBUFFERIO = 0 +CIRCUITPY_MSGPACK = 0 CIRCUITPY_NEOPIXEL_WRITE = 0 CIRCUITPY_NVM = 0 CIRCUITPY_PIXELBUF = 0 From 03d0ec85a19eb1dd0751385c764a043bf9b33ca3 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Wed, 2 Dec 2020 22:23:14 +0100 Subject: [PATCH 357/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 8 +++++++- locale/cs.po | 8 +++++++- locale/de_DE.po | 8 +++++++- locale/el.po | 8 +++++++- locale/es.po | 8 +++++++- locale/fil.po | 8 +++++++- locale/fr.po | 8 +++++++- locale/hi.po | 8 +++++++- locale/it_IT.po | 8 +++++++- locale/ja.po | 8 +++++++- locale/ko.po | 8 +++++++- locale/nl.po | 8 +++++++- locale/pl.po | 8 +++++++- locale/pt_BR.po | 8 +++++++- locale/sv.po | 8 +++++++- locale/zh_Latn_pinyin.po | 8 +++++++- 16 files changed, 112 insertions(+), 16 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 43dcc72889ac2..9645dc70246e5 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -504,7 +504,8 @@ msgstr "Panjang buffer harus kelipatan 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c +#: shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Penyangga harus memiliki panjang setidaknya 1" @@ -1316,6 +1317,11 @@ msgstr "Tidak ada DAC (Digital Analog Converter) di dalam chip" msgid "No DMA channel found" msgstr "tidak ada channel DMA ditemukan" +#: shared-module/busdevice/I2CDevice.c +#, c-format +msgid "No I2C device at address: %x" +msgstr "" + #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c msgid "No MISO Pin" diff --git a/locale/cs.po b/locale/cs.po index 72b2162678c68..e8287d266f13e 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -502,7 +502,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c +#: shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "" @@ -1299,6 +1300,11 @@ msgstr "" msgid "No DMA channel found" msgstr "" +#: shared-module/busdevice/I2CDevice.c +#, c-format +msgid "No I2C device at address: %x" +msgstr "" + #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c msgid "No MISO Pin" diff --git a/locale/de_DE.po b/locale/de_DE.po index a3b4cd2cc2224..1aedb6ce1f6c8 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -505,7 +505,8 @@ msgstr "Die Pufferlänge muss ein vielfaches von 512 sein" msgid "Buffer must be a multiple of 512 bytes" msgstr "Der Puffer muss ein vielfaches von 512 bytes sein" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c +#: shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Der Puffer muss eine Mindestenslänge von 1 haben" @@ -1318,6 +1319,11 @@ msgstr "Kein DAC im Chip vorhanden" msgid "No DMA channel found" msgstr "Kein DMA Kanal gefunden" +#: shared-module/busdevice/I2CDevice.c +#, c-format +msgid "No I2C device at address: %x" +msgstr "" + #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c msgid "No MISO Pin" diff --git a/locale/el.po b/locale/el.po index 01e42604031cc..6a4f7cdbb3178 100644 --- a/locale/el.po +++ b/locale/el.po @@ -497,7 +497,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c +#: shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "" @@ -1294,6 +1295,11 @@ msgstr "" msgid "No DMA channel found" msgstr "" +#: shared-module/busdevice/I2CDevice.c +#, c-format +msgid "No I2C device at address: %x" +msgstr "" + #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c msgid "No MISO Pin" diff --git a/locale/es.po b/locale/es.po index 293a0c19e75c0..57b317e008e6d 100644 --- a/locale/es.po +++ b/locale/es.po @@ -511,7 +511,8 @@ msgstr "El tamaño del búfer debe ser múltiplo de 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "Búfer deber ser un múltiplo de 512 bytes" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c +#: shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Buffer debe ser de longitud 1 como minimo" @@ -1317,6 +1318,11 @@ msgstr "El chip no tiene DAC" msgid "No DMA channel found" msgstr "No se encontró el canal DMA" +#: shared-module/busdevice/I2CDevice.c +#, c-format +msgid "No I2C device at address: %x" +msgstr "" + #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c msgid "No MISO Pin" diff --git a/locale/fil.po b/locale/fil.po index c492f36c0886a..4a9e9591ed100 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -502,7 +502,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c +#: shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Buffer dapat ay hindi baba sa 1 na haba" @@ -1309,6 +1310,11 @@ msgstr "Walang DAC sa chip" msgid "No DMA channel found" msgstr "Walang DMA channel na mahanap" +#: shared-module/busdevice/I2CDevice.c +#, c-format +msgid "No I2C device at address: %x" +msgstr "" + #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c msgid "No MISO Pin" diff --git a/locale/fr.po b/locale/fr.po index 5dc91096c511e..12d3feca027d7 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -511,7 +511,8 @@ msgstr "La longueur de la mémoire tampon doit être un multiple de 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "La mémoire tampon doit être un multiple de 512" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c +#: shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Le tampon doit être de longueur au moins 1" @@ -1322,6 +1323,11 @@ msgstr "Pas de DAC sur la puce" msgid "No DMA channel found" msgstr "Aucun canal DMA trouvé" +#: shared-module/busdevice/I2CDevice.c +#, c-format +msgid "No I2C device at address: %x" +msgstr "" + #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c msgid "No MISO Pin" diff --git a/locale/hi.po b/locale/hi.po index b70a052019168..7361e41e65cda 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -497,7 +497,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c +#: shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "" @@ -1294,6 +1295,11 @@ msgstr "" msgid "No DMA channel found" msgstr "" +#: shared-module/busdevice/I2CDevice.c +#, c-format +msgid "No I2C device at address: %x" +msgstr "" + #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c msgid "No MISO Pin" diff --git a/locale/it_IT.po b/locale/it_IT.po index 836d80585289c..4966002d262c1 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -502,7 +502,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c +#: shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Il buffer deve essere lungo almeno 1" @@ -1313,6 +1314,11 @@ msgstr "Nessun DAC sul chip" msgid "No DMA channel found" msgstr "Nessun canale DMA trovato" +#: shared-module/busdevice/I2CDevice.c +#, c-format +msgid "No I2C device at address: %x" +msgstr "" + #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c msgid "No MISO Pin" diff --git a/locale/ja.po b/locale/ja.po index 2496db520cf0f..27e094a0abe00 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -506,7 +506,8 @@ msgstr "バッファ長は512の倍数でなければなりません" msgid "Buffer must be a multiple of 512 bytes" msgstr "バッファは512の倍数でなければなりません" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c +#: shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "バッファ長は少なくとも1以上でなければなりません" @@ -1309,6 +1310,11 @@ msgstr "チップにDACがありません" msgid "No DMA channel found" msgstr "DMAチャネルが見つかりません" +#: shared-module/busdevice/I2CDevice.c +#, c-format +msgid "No I2C device at address: %x" +msgstr "" + #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c msgid "No MISO Pin" diff --git a/locale/ko.po b/locale/ko.po index dcbbfb81d3853..407b495b88a44 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -502,7 +502,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c +#: shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "잘못된 크기의 버퍼. >1 여야합니다" @@ -1299,6 +1300,11 @@ msgstr "" msgid "No DMA channel found" msgstr "" +#: shared-module/busdevice/I2CDevice.c +#, c-format +msgid "No I2C device at address: %x" +msgstr "" + #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c msgid "No MISO Pin" diff --git a/locale/nl.po b/locale/nl.po index c5d9601c27d5c..e45f9338d4112 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -504,7 +504,8 @@ msgstr "Buffer lengte moet een veelvoud van 512 zijn" msgid "Buffer must be a multiple of 512 bytes" msgstr "Buffer moet een veelvoud van 512 bytes zijn" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c +#: shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Buffer moet op zijn minst lengte 1 zijn" @@ -1311,6 +1312,11 @@ msgstr "Geen DAC op de chip" msgid "No DMA channel found" msgstr "Geen DMA kanaal gevonden" +#: shared-module/busdevice/I2CDevice.c +#, c-format +msgid "No I2C device at address: %x" +msgstr "" + #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c msgid "No MISO Pin" diff --git a/locale/pl.po b/locale/pl.po index 12c612cc7f08e..31d446b3baabf 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -506,7 +506,8 @@ msgstr "Długość bufora musi być wielokrotnością 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "Bufor musi być wielokrotnością 512 bajtów" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c +#: shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Bufor musi mieć długość 1 lub więcej" @@ -1310,6 +1311,11 @@ msgstr "Brak DAC" msgid "No DMA channel found" msgstr "Nie znaleziono kanału DMA" +#: shared-module/busdevice/I2CDevice.c +#, c-format +msgid "No I2C device at address: %x" +msgstr "" + #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c msgid "No MISO Pin" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 39975643f14f8..239a83037d8ea 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -512,7 +512,8 @@ msgstr "O comprimento do Buffer deve ser um múltiplo de 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "O buffer deve ser um múltiplo de 512 bytes" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c +#: shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "O comprimento do buffer deve ter pelo menos 1" @@ -1320,6 +1321,11 @@ msgstr "Nenhum DAC no chip" msgid "No DMA channel found" msgstr "Nenhum canal DMA encontrado" +#: shared-module/busdevice/I2CDevice.c +#, c-format +msgid "No I2C device at address: %x" +msgstr "" + #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c msgid "No MISO Pin" diff --git a/locale/sv.po b/locale/sv.po index 72aa0852df7b3..db8d6a2d9dbb0 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -504,7 +504,8 @@ msgstr "Buffertlängd måste vara en multipel av 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "Bufferten måste vara en multipel av 512 byte" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c +#: shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Bufferten måste ha minst längd 1" @@ -1310,6 +1311,11 @@ msgstr "Ingen DAC på chipet" msgid "No DMA channel found" msgstr "Ingen DMA-kanal hittades" +#: shared-module/busdevice/I2CDevice.c +#, c-format +msgid "No I2C device at address: %x" +msgstr "" + #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c msgid "No MISO Pin" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index eb24ad4210fe2..5ef4b0e2ae558 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -506,7 +506,8 @@ msgstr "Huǎn chōng qū cháng dù bì xū wéi 512 de bèi shù" msgid "Buffer must be a multiple of 512 bytes" msgstr "Huǎn chōng qū bì xū shì 512 zì jié de bèi shù" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c +#: shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Huǎnchōng qū bìxū zhìshǎo chángdù 1" @@ -1307,6 +1308,11 @@ msgstr "Méiyǒu DAC zài xīnpiàn shàng de" msgid "No DMA channel found" msgstr "Wèi zhǎodào DMA píndào" +#: shared-module/busdevice/I2CDevice.c +#, c-format +msgid "No I2C device at address: %x" +msgstr "" + #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c msgid "No MISO Pin" From 57fa6bece8fb841de10aaa6e96ced59749e6c566 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 3 Dec 2020 21:27:35 -0500 Subject: [PATCH 358/770] allow radio.enabled to be settable --- shared-bindings/wifi/Radio.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index 991abd4f12b69..d9d7dd5b53c59 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -55,10 +55,19 @@ STATIC mp_obj_t wifi_radio_get_enabled(mp_obj_t self) { } MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_enabled_obj, wifi_radio_get_enabled); +static mp_obj_t wifi_radio_set_enabled(mp_obj_t self, mp_obj_t value) { + const bool enabled = mp_obj_is_true(value); + + common_hal_wifi_radio_set_enabled(self, enabled); + + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(wifi_radio_set_enabled_obj, wifi_radio_set_enabled); + const mp_obj_property_t wifi_radio_enabled_obj = { .base.type = &mp_type_property, .proxy = { (mp_obj_t)&wifi_radio_get_enabled_obj, - (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&wifi_radio_set_enabled_obj, (mp_obj_t)&mp_const_none_obj }, }; From 2f0e676fcba318bbfcd39e6c50e75d6aeb739ac6 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 3 Dec 2020 22:05:02 -0500 Subject: [PATCH 359/770] update doc per review --- shared-bindings/wifi/Radio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index d9d7dd5b53c59..edbd9fd2ffd36 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -48,7 +48,9 @@ //| //| enabled: bool -//| """True when the wifi radio is enabled.""" +//| """``True`` when the wifi radio is enabled. +//| If you set the value to ``False``, any open sockets will be closed. +//| """ //| STATIC mp_obj_t wifi_radio_get_enabled(mp_obj_t self) { return mp_obj_new_bool(common_hal_wifi_radio_get_enabled(self)); From db04582af95e27b6d7fdd94ddc11da5150585eab Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Thu, 3 Dec 2020 05:50:06 +0000 Subject: [PATCH 360/770] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (875 of 875 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 239a83037d8ea..4ac698bd316be 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-27 23:57-0500\n" -"PO-Revision-Date: 2020-11-30 18:06+0000\n" +"PO-Revision-Date: 2020-12-04 06:29+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -868,7 +868,7 @@ msgstr "Um endereço esperado" #: shared-bindings/alarm/__init__.c msgid "Expected an alarm" -msgstr "" +msgstr "Um alarme era esperado" #: shared-module/_pixelbuf/PixelBuf.c #, c-format @@ -1019,7 +1019,7 @@ msgstr "O I2SOut não está disponível" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" -msgstr "" +msgstr "IOs 0, 2 e 4 não suportam pullup interno em repouso (sleep)" #: shared-bindings/aesio/aes.c #, c-format @@ -1324,7 +1324,7 @@ msgstr "Nenhum canal DMA encontrado" #: shared-module/busdevice/I2CDevice.c #, c-format msgid "No I2C device at address: %x" -msgstr "" +msgstr "Nenhum dispositivo I2C no endereço: %x" #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c @@ -1486,7 +1486,7 @@ msgstr "" #: ports/esp32s2/common-hal/alarm/__init__.c msgid "Only one alarm.time alarm can be set." -msgstr "" +msgstr "Apenas um alarme alarm.time pode ser definido." #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" @@ -1551,7 +1551,7 @@ msgstr "Número do PIN já está reservado através da EXTI" #: ports/esp32s2/common-hal/alarm/__init__.c msgid "PinAlarm not yet implemented" -msgstr "" +msgstr "PinAlarm ainda não foi implementado" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format @@ -1772,7 +1772,7 @@ msgstr "Forneça pelo menos um pino UART" #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" -msgstr "" +msgstr "Forneça um de monotonic_time ou de epoch_time" #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" @@ -1848,7 +1848,7 @@ msgstr "A largura do bloco deve dividir exatamente com a largura do bitmap" #: shared-bindings/alarm/time/TimeAlarm.c msgid "Time is in the past." -msgstr "" +msgstr "O tempo está no passado." #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format @@ -2592,7 +2592,7 @@ msgstr "end_x deve ser um int" #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" -msgstr "" +msgstr "O epoch_time não é compatível com esta placa" #: ports/nrf/common-hal/busio/UART.c #, c-format @@ -2965,7 +2965,7 @@ msgstr "sintaxe inválida para o número" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "io must be rtc io" -msgstr "" +msgstr "O io deve ser rtc io" #: py/objtype.c msgid "issubclass() arg 1 must be a class" @@ -3668,7 +3668,7 @@ msgstr "o trapz está definido para 1D arrays de igual tamanho" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "trigger level must be 0 or 1" -msgstr "" +msgstr "nível do gatilho deve ser 0 ou 1" #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" @@ -3814,7 +3814,7 @@ msgstr "os vetores devem ter os mesmos comprimentos" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "wakeup conflict" -msgstr "" +msgstr "conflito de wakeup" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" From 11d829e20eddfbe2a8c2da29fcd4a9232031639a Mon Sep 17 00:00:00 2001 From: vkuthan Date: Fri, 4 Dec 2020 13:22:25 +0000 Subject: [PATCH 361/770] Translated using Weblate (Czech) Currently translated at 3.7% (33 of 875 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/cs/ --- locale/cs.po | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/locale/cs.po b/locale/cs.po index e8287d266f13e..39ea8fcd8745a 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-27 23:57-0500\n" -"PO-Revision-Date: 2020-12-02 20:29+0000\n" +"PO-Revision-Date: 2020-12-04 18:33+0000\n" "Last-Translator: vkuthan \n" "Language-Team: LANGUAGE \n" "Language: cs\n" @@ -22,7 +22,7 @@ msgid "" "Code done running. Waiting for reload.\n" msgstr "" "\n" -"Kód byl dokončen. Čekám na opětovné načtení.\n" +"Kód byl dokončen. Čekám na opětovné nahrání.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -58,11 +58,11 @@ msgstr "%d adresní piny a %d rgb piny označují výšku %d, nikoli %d" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" -msgstr "" +msgstr "Selhání %q: %d" #: shared-bindings/microcontroller/Pin.c msgid "%q in use" -msgstr "%q se nyní používá" +msgstr "Používá se %q" #: extmod/moductypes.c ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c @@ -70,11 +70,11 @@ msgstr "%q se nyní používá" #: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c #: py/objstrunicode.c msgid "%q index out of range" -msgstr "%q index je mimo rozsah" +msgstr "Index %q je mimo rozsah" #: py/obj.c msgid "%q indices must be integers, not %q" -msgstr "%q indexy musí být celá čísla, ne %q" +msgstr "Indexy %q musí být celá čísla, ne %q" #: shared-bindings/vectorio/Polygon.c msgid "%q list must be a list" @@ -90,11 +90,11 @@ msgstr "%q musí být >= 0" #: shared-bindings/memorymonitor/AllocationAlarm.c #: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c msgid "%q must be >= 1" -msgstr " %q musí být > = 1" +msgstr "%q musí být > = 1" #: shared-module/vectorio/Polygon.c msgid "%q must be a tuple of length 2" -msgstr " %q musí být n-tice délky 2" +msgstr "%q musí být n-tice délky 2" #: shared-bindings/canio/Match.c msgid "%q out of range" @@ -102,23 +102,23 @@ msgstr "%q je mimo rozsah" #: ports/atmel-samd/common-hal/microcontroller/Pin.c msgid "%q pin invalid" -msgstr "" +msgstr "Pin %q není platný" #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" -msgstr " %q by měl být int" +msgstr "%q by měl být int" #: py/bc.c py/objnamedtuple.c msgid "%q() takes %d positional arguments but %d were given" -msgstr "" +msgstr "%q() vyžaduje %d pozičních argumentů, ale %d jich bylo zadáno" #: py/argcheck.c msgid "'%q' argument required" -msgstr "" +msgstr "Je vyžadován argument '%q'" #: py/runtime.c msgid "'%q' object cannot assign attribute '%q'" -msgstr "" +msgstr "'%q' nemůže přiřadit atribut '%q'" #: py/proto.c msgid "'%q' object does not support '%q'" From bb1b2bd787ea342ead9e2d4579a8a2cb75a71418 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Fri, 4 Dec 2020 23:14:39 +0000 Subject: [PATCH 362/770] Translated using Weblate (Swedish) Currently translated at 99.7% (873 of 875 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index db8d6a2d9dbb0..e1795a4f202e5 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-27 23:57-0500\n" -"PO-Revision-Date: 2020-11-30 18:06+0000\n" +"PO-Revision-Date: 2020-12-05 23:29+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -859,7 +859,7 @@ msgstr "Förväntade en adress" #: shared-bindings/alarm/__init__.c msgid "Expected an alarm" -msgstr "" +msgstr "Förväntade ett larm" #: shared-module/_pixelbuf/PixelBuf.c #, c-format @@ -1008,7 +1008,7 @@ msgstr "I2SOut är inte tillgängligt" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" -msgstr "" +msgstr "IO 0, 2 & 4 stöder inte intern pullup för sovläge" #: shared-bindings/aesio/aes.c #, c-format @@ -1314,7 +1314,7 @@ msgstr "Ingen DMA-kanal hittades" #: shared-module/busdevice/I2CDevice.c #, c-format msgid "No I2C device at address: %x" -msgstr "" +msgstr "Ingen I2C-enhet på adress: %x" #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c @@ -1476,7 +1476,7 @@ msgstr "" #: ports/esp32s2/common-hal/alarm/__init__.c msgid "Only one alarm.time alarm can be set." -msgstr "" +msgstr "Endast ett alarm.time kan ställas in." #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" @@ -1539,7 +1539,7 @@ msgstr "PInn-nummer redan reserverat av EXTI" #: ports/esp32s2/common-hal/alarm/__init__.c msgid "PinAlarm not yet implemented" -msgstr "" +msgstr "PinAlarm är inte implementerat ännu" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format @@ -1758,7 +1758,7 @@ msgstr "Ange minst en UART-pinne" #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" -msgstr "" +msgstr "Ange en av monotonic_time eller epoch_time" #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" @@ -1833,7 +1833,7 @@ msgstr "Tile-bredd måste vara jämnt delbar med bredd på bitmap" #: shared-bindings/alarm/time/TimeAlarm.c msgid "Time is in the past." -msgstr "" +msgstr "Tid har passerats." #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format @@ -2566,7 +2566,7 @@ msgstr "color ska vara en int" #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" -msgstr "" +msgstr "epoch_time stöds inte av detta kort" #: ports/nrf/common-hal/busio/UART.c #, c-format @@ -2939,7 +2939,7 @@ msgstr "ogiltig syntax för tal" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "io must be rtc io" -msgstr "" +msgstr "io måste vara rtc io" #: py/objtype.c msgid "issubclass() arg 1 must be a class" @@ -3635,8 +3635,9 @@ msgid "trapz is defined for 1D arrays of equal length" msgstr "trapz är definierad för 1D-matriser med samma längd" #: ports/esp32s2/common-hal/alarm/pin/__init__.c +#, fuzzy msgid "trigger level must be 0 or 1" -msgstr "" +msgstr "triggernivå måste vara 0 eller 1" #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" @@ -3781,8 +3782,9 @@ msgid "vectors must have same lengths" msgstr "vektorer måste ha samma längd" #: ports/esp32s2/common-hal/alarm/pin/__init__.c +#, fuzzy msgid "wakeup conflict" -msgstr "" +msgstr "wakeup-konflikt" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" From 9391c8f9ddadbf8b46662f9baa9f10b8826d8b02 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sun, 6 Dec 2020 12:00:00 -0500 Subject: [PATCH 363/770] Make ResetReason and RunReason available --- shared-bindings/alarm/__init__.c | 4 ++-- shared-bindings/microcontroller/ResetReason.c | 4 ++-- shared-bindings/microcontroller/__init__.c | 1 + shared-bindings/microcontroller/__init__.h | 1 - shared-bindings/supervisor/__init__.c | 1 + 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index c983130a19c8b..a1f1a2f8c2056 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -125,8 +125,8 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_light_sleep_until_alarms_obj, 1, MP_OB //| //| If no alarms are specified, the microcontroller will deep sleep until reset. //| -//| **If CircuitPython is connected to a host computer, `alarm.exit_and_deep_sleep_until_alarms()` -//| then the connection will be maintained, and the system will not go into deep sleep.** +//| **If CircuitPython is connected to a host computer, the connection will be maintained, +//| and the system will not go into deep sleep.** //| This allows the user to interrupt an existing program with ctrl-C, //| and to edit the files in CIRCUITPY, which would not be possible in true deep sleep. //| Thus, to use deep sleep and save significant power, you will need to disconnect from the host. diff --git a/shared-bindings/microcontroller/ResetReason.c b/shared-bindings/microcontroller/ResetReason.c index 61891934ae516..1750e5520462e 100644 --- a/shared-bindings/microcontroller/ResetReason.c +++ b/shared-bindings/microcontroller/ResetReason.c @@ -72,6 +72,6 @@ MAKE_ENUM_MAP(mcu_reset_reason) { }; STATIC MP_DEFINE_CONST_DICT(mcu_reset_reason_locals_dict, mcu_reset_reason_locals_table); -MAKE_PRINTER(alarm, mcu_reset_reason); +MAKE_PRINTER(microcontroller, mcu_reset_reason); -MAKE_ENUM_TYPE(alarm, ResetReason, mcu_reset_reason); +MAKE_ENUM_TYPE(microcontroller, ResetReason, mcu_reset_reason); diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index 8a77d1df5b91c..035587c30f247 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -170,6 +170,7 @@ STATIC const mp_rom_map_elem_t mcu_module_globals_table[] = { #else { MP_ROM_QSTR(MP_QSTR_watchdog), MP_ROM_PTR(&mp_const_none_obj) }, #endif + { MP_ROM_QSTR(MP_QSTR_ResetReason), MP_ROM_PTR(&mcu_reset_reason_type) }, { MP_ROM_QSTR(MP_QSTR_RunMode), MP_ROM_PTR(&mcu_runmode_type) }, { MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&mcu_pin_type) }, { MP_ROM_QSTR(MP_QSTR_pin), MP_ROM_PTR(&mcu_pin_module) }, diff --git a/shared-bindings/microcontroller/__init__.h b/shared-bindings/microcontroller/__init__.h index ac71de4247f2a..0dafc74c72ff4 100644 --- a/shared-bindings/microcontroller/__init__.h +++ b/shared-bindings/microcontroller/__init__.h @@ -1,4 +1,3 @@ - /* * This file is part of the MicroPython project, http://micropython.org/ * diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c index aaecdcbeb17df..ad86030478302 100644 --- a/shared-bindings/supervisor/__init__.c +++ b/shared-bindings/supervisor/__init__.c @@ -119,6 +119,7 @@ STATIC const mp_rom_map_elem_t supervisor_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_set_rgb_status_brightness), MP_ROM_PTR(&supervisor_set_rgb_status_brightness_obj) }, { MP_ROM_QSTR(MP_QSTR_runtime), MP_ROM_PTR(&common_hal_supervisor_runtime_obj) }, { MP_ROM_QSTR(MP_QSTR_reload), MP_ROM_PTR(&supervisor_reload_obj) }, + { MP_ROM_QSTR(MP_QSTR_RunReason), MP_ROM_PTR(&supervisor_run_reason_type) }, { MP_ROM_QSTR(MP_QSTR_set_next_stack_limit), MP_ROM_PTR(&supervisor_set_next_stack_limit_obj) }, }; From 70827ac3da1138f3dbd4107ecb139cfbefd1846f Mon Sep 17 00:00:00 2001 From: BennyE Date: Sun, 6 Dec 2020 23:38:04 +0100 Subject: [PATCH 364/770] debug log for wifi scan, start stop --- ports/esp32s2/common-hal/wifi/__init__.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/__init__.c b/ports/esp32s2/common-hal/wifi/__init__.c index e06038c228018..48fee4500f754 100644 --- a/ports/esp32s2/common-hal/wifi/__init__.c +++ b/ports/esp32s2/common-hal/wifi/__init__.c @@ -47,8 +47,15 @@ static void event_handler(void* arg, esp_event_base_t event_base, if (event_base == WIFI_EVENT) { switch (event_id) { case WIFI_EVENT_SCAN_DONE: + ESP_EARLY_LOGW(TAG, "scan"); xEventGroupSetBits(radio->event_group_handle, WIFI_SCAN_DONE_BIT); break; + case WIFI_EVENT_STA_START: + ESP_EARLY_LOGW(TAG, "start"); + break; + case WIFI_EVENT_STA_STOP: + ESP_EARLY_LOGW(TAG, "stop"); + break; case WIFI_EVENT_STA_CONNECTED: ESP_EARLY_LOGW(TAG, "connected"); break; @@ -74,8 +81,6 @@ static void event_handler(void* arg, esp_event_base_t event_base, } // Cases to handle later. - // case WIFI_EVENT_STA_START: - // case WIFI_EVENT_STA_STOP: // case WIFI_EVENT_STA_AUTHMODE_CHANGE: default: break; From 169b4875099869d5d2549e9b717516e4045428d0 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 7 Dec 2020 11:06:33 -0500 Subject: [PATCH 365/770] Include wifi.radio singleton in gc --- main.c | 8 ++++++++ ports/esp32s2/common-hal/wifi/Radio.c | 6 ++++++ ports/esp32s2/common-hal/wifi/Radio.h | 2 ++ ports/esp32s2/common-hal/wifi/__init__.c | 4 ++++ shared-bindings/wifi/__init__.h | 1 + 5 files changed, 21 insertions(+) diff --git a/main.c b/main.c index 95aeeeb81c085..48c89d8adc047 100755 --- a/main.c +++ b/main.c @@ -95,6 +95,10 @@ #include "common-hal/canio/CAN.h" #endif +#if CIRCUITPY_WIFI +#include "shared-bindings/wifi/__init__.h" +#endif + #if MICROPY_ENABLE_PYSTACK static size_t PLACE_IN_DTCM_BSS(_pystack[CIRCUITPY_PYSTACK_SIZE / sizeof(size_t)]); #endif @@ -560,6 +564,10 @@ void gc_collect(void) { common_hal_bleio_gc_collect(); #endif + #if CIRCUITPY_WIFI + common_hal_wifi_gc_collect(); + #endif + // This naively collects all object references from an approximate stack // range. gc_collect_root((void**)sp, ((uint32_t)port_stack_get_top() - sp) / sizeof(uint32_t)); diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index bc987bc1c96d6..49cb8ec30f489 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -31,6 +31,7 @@ #include "common-hal/wifi/__init__.h" #include "lib/utils/interrupt_char.h" +#include "py/gc.h" #include "py/runtime.h" #include "shared-bindings/ipaddress/IPv4Address.h" #include "shared-bindings/wifi/ScannedNetworks.h" @@ -262,3 +263,8 @@ mp_int_t common_hal_wifi_radio_ping(wifi_radio_obj_t *self, mp_obj_t ip_address, return elapsed_time; } + +void common_hal_wifi_radio_gc_collect(wifi_radio_obj_t *self) { + // Only bother to scan the actual object references. + gc_collect_ptr(self->current_scan); +} diff --git a/ports/esp32s2/common-hal/wifi/Radio.h b/ports/esp32s2/common-hal/wifi/Radio.h index c7f484eafda5f..1dac47016b52e 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.h +++ b/ports/esp32s2/common-hal/wifi/Radio.h @@ -59,4 +59,6 @@ typedef struct { uint8_t last_disconnect_reason; } wifi_radio_obj_t; +extern void common_hal_wifi_radio_gc_collect(wifi_radio_obj_t *self); + #endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WIFI_RADIO_H diff --git a/ports/esp32s2/common-hal/wifi/__init__.c b/ports/esp32s2/common-hal/wifi/__init__.c index e06038c228018..5945f222e1103 100644 --- a/ports/esp32s2/common-hal/wifi/__init__.c +++ b/ports/esp32s2/common-hal/wifi/__init__.c @@ -160,3 +160,7 @@ void ipaddress_ipaddress_to_esp_idf(mp_obj_t ip_address, ip_addr_t* esp_ip_addre IP_ADDR4(esp_ip_address, bytes[0], bytes[1], bytes[2], bytes[3]); } + +void common_hal_wifi_gc_collect(void) { + common_hal_wifi_radio_gc_collect(&common_hal_wifi_radio_obj); +} diff --git a/shared-bindings/wifi/__init__.h b/shared-bindings/wifi/__init__.h index c06ee16be7e5b..124c0bc49118a 100644 --- a/shared-bindings/wifi/__init__.h +++ b/shared-bindings/wifi/__init__.h @@ -34,5 +34,6 @@ extern wifi_radio_obj_t common_hal_wifi_radio_obj; void common_hal_wifi_init(void); +void common_hal_wifi_gc_collect(void); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_WIFI___INIT___H From c7b592883313e112e777d220941ca5f5f02a658c Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Mon, 7 Dec 2020 11:47:39 -0500 Subject: [PATCH 366/770] Fix submodule desync --- ports/esp32s2/esp-idf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/esp-idf b/ports/esp32s2/esp-idf index 8bc19ba893e55..d06744f5efc38 160000 --- a/ports/esp32s2/esp-idf +++ b/ports/esp32s2/esp-idf @@ -1 +1 @@ -Subproject commit 8bc19ba893e5544d571a753d82b44a84799b94b1 +Subproject commit d06744f5efc382c61cbad8758107cec308feef09 From c1a2ea27cecc066e57b635e21882c60621c23964 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Mon, 7 Dec 2020 13:57:47 -0500 Subject: [PATCH 367/770] Change to config-based resets --- ports/esp32s2/common-hal/microcontroller/Pin.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index f0e850e25b35e..0434a6e3a021e 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -44,6 +44,19 @@ STATIC uint32_t in_use[2]; bool apa102_mosi_in_use; bool apa102_sck_in_use; +STATIC void floating_gpio_reset(gpio_num_t pin_number) { + // This is the same as gpio_reset_pin(), but without the pullup. + // Note that gpio_config resets the iomatrix to GPIO_FUNC as well. + gpio_config_t cfg = { + .pin_bit_mask = BIT64(pin_number), + .mode = GPIO_MODE_DISABLE, + .pull_up_en = false, + .pull_down_en = false, + .intr_type = GPIO_INTR_DISABLE, + }; + gpio_config(&cfg); +} + void never_reset_pin_number(gpio_num_t pin_number) { if (pin_number == -1 ) { return; @@ -63,7 +76,7 @@ void reset_pin_number(gpio_num_t pin_number) { never_reset_pins[pin_number / 32] &= ~(1 << pin_number % 32); in_use[pin_number / 32] &= ~(1 << pin_number % 32); - gpio_matrix_out(pin_number, 0x100, 0, 0); + floating_gpio_reset(pin_number); #ifdef MICROPY_HW_NEOPIXEL if (pin_number == MICROPY_HW_NEOPIXEL->number) { @@ -85,7 +98,7 @@ void reset_all_pins(void) { (never_reset_pins[i / 32] & (1 << i % 32)) != 0) { continue; } - gpio_matrix_out(i, 0x100, 0, 0); + floating_gpio_reset(i); } in_use[0] = 0; in_use[1] = 0; From ac8a9625de9d554e8c4dd71852d8e994444b4ad9 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Sun, 6 Dec 2020 21:19:10 +0000 Subject: [PATCH 368/770] Translated using Weblate (Swedish) Currently translated at 100.0% (875 of 875 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index e1795a4f202e5..4b7a389c24a39 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-27 23:57-0500\n" -"PO-Revision-Date: 2020-12-05 23:29+0000\n" +"PO-Revision-Date: 2020-12-07 20:26+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -3635,7 +3635,6 @@ msgid "trapz is defined for 1D arrays of equal length" msgstr "trapz är definierad för 1D-matriser med samma längd" #: ports/esp32s2/common-hal/alarm/pin/__init__.c -#, fuzzy msgid "trigger level must be 0 or 1" msgstr "triggernivå måste vara 0 eller 1" @@ -3782,7 +3781,6 @@ msgid "vectors must have same lengths" msgstr "vektorer måste ha samma längd" #: ports/esp32s2/common-hal/alarm/pin/__init__.c -#, fuzzy msgid "wakeup conflict" msgstr "wakeup-konflikt" From b5b6b6d0f2fe669e0304521d663b16388c63b15e Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Mon, 7 Dec 2020 15:16:16 -0800 Subject: [PATCH 369/770] add ExtType, update doc, add a test --- locale/circuitpython.pot | 34 +++-- shared-bindings/msgpack/ExtType.c | 127 ++++++++++++++++++ shared-bindings/msgpack/ExtType.h | 40 ++++++ shared-bindings/msgpack/__init__.c | 108 +++++++++++++--- shared-bindings/msgpack/__init__.h | 2 +- shared-module/msgpack/__init__.c | 199 +++++++++++++++++++---------- shared-module/msgpack/__init__.h | 4 +- tests/extmod/umsgpack_pack.py | 30 +++++ tests/extmod/umsgpack_pack.py.ext | 5 + 9 files changed, 447 insertions(+), 102 deletions(-) create mode 100644 shared-bindings/msgpack/ExtType.c create mode 100644 shared-bindings/msgpack/ExtType.h create mode 100644 tests/extmod/umsgpack_pack.py create mode 100644 tests/extmod/umsgpack_pack.py.ext diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index e0b839ed3efae..979f62466e77e 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-12-01 18:39-0800\n" +"POT-Creation-Date: 2020-12-07 15:35-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -270,6 +270,10 @@ msgstr "" msgid "3-arg pow() not supported" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2371,6 +2375,10 @@ msgstr "" msgid "circle can only be registered in one parent" msgstr "" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "" @@ -2451,6 +2459,10 @@ msgstr "" msgid "default 'except' must be last" msgstr "" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2550,6 +2562,10 @@ msgstr "" msgid "expecting key:value for dict" msgstr "" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "" @@ -3078,12 +3094,12 @@ msgstr "" msgid "no binding for nonlocal found" msgstr "" -#: py/builtinimport.c -msgid "no module named '%q'" +#: shared-module/msgpack/__init__.c +msgid "no default packer" msgstr "" -#: shared-module/msgpack/__init__.c -msgid "no packer" +#: py/builtinimport.c +msgid "no module named '%q'" msgstr "" #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c @@ -3099,10 +3115,6 @@ msgstr "" msgid "no such attribute" msgstr "" -#: shared-module/msgpack/__init__.c -msgid "no unpacker found" -msgstr "" - #: ports/nrf/common-hal/_bleio/Connection.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" @@ -3560,10 +3572,6 @@ msgstr "" msgid "tobytes can be invoked for dense arrays only" msgstr "" -#: shared-module/msgpack/__init__.c -msgid "too big" -msgstr "" - #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "" diff --git a/shared-bindings/msgpack/ExtType.c b/shared-bindings/msgpack/ExtType.c new file mode 100644 index 0000000000000..3a4eee388494a --- /dev/null +++ b/shared-bindings/msgpack/ExtType.c @@ -0,0 +1,127 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Bernhard Boser + * + * 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 "py/runtime.h" +#include "py/smallint.h" +#include "py/objproperty.h" +#include "shared-bindings/msgpack/ExtType.h" + +//| class ExtType: +//| """ExtType represents ext type in msgpack.""" +//| def __init__(self, code: int, data: bytes) -> None: +//| """Constructor""" +//| +//| :param int code: type code in range 0~127. +//| :param bytes data: representation. + +STATIC mp_obj_t mod_msgpack_exttype_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + mod_msgpack_extype_obj_t *self = m_new_obj(mod_msgpack_extype_obj_t); + self->base.type = &mod_msgpack_exttype_type; + enum { ARG_code, ARG_data }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_code, MP_ARG_INT | MP_ARG_REQUIRED }, + { MP_QSTR_data, MP_ARG_OBJ | MP_ARG_REQUIRED }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + int code = args[ARG_code].u_int; + if (code < 0 || code > 127) { + mp_raise_AttributeError(translate("code outside range 0~127")); + } + self->code = code; + + mp_obj_t data = args[ARG_data].u_obj; + self->data = data; + return MP_OBJ_FROM_PTR(self); +} + + +//| code: int +//| """The type code, in range 0~127.""" +//| + +STATIC mp_obj_t mod_msgpack_exttype_get_code(mp_obj_t self_in) { + mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); + return MP_OBJ_NEW_SMALL_INT(self->code); +} +MP_DEFINE_CONST_FUN_OBJ_1(mod_msgpack_exttype_get_code_obj, mod_msgpack_exttype_get_code); + +STATIC mp_obj_t mod_msgpack_exttype_set_code(mp_obj_t self_in, mp_obj_t code_in) { + mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); + int code = mp_obj_get_int(code_in); + if (code < 0 || code > 127) { + mp_raise_AttributeError(translate("code outside range 0~127")); + } + self->code = code; + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(mod_msgpack_exttype_set_code_obj, mod_msgpack_exttype_set_code); + +const mp_obj_property_t mod_msgpack_exttype_code_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&mod_msgpack_exttype_get_code_obj, + (mp_obj_t)&mod_msgpack_exttype_set_code_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +//| data: bytes +//| """Data.""" +//| + +STATIC mp_obj_t mod_msgpack_exttype_get_data(mp_obj_t self_in) { + mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); + return self->data; +} +MP_DEFINE_CONST_FUN_OBJ_1(mod_msgpack_exttype_get_data_obj, mod_msgpack_exttype_get_data); + +STATIC mp_obj_t mod_msgpack_exttype_set_data(mp_obj_t self_in, mp_obj_t data_in) { + mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); + self->data = data_in; + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(mod_msgpack_exttype_set_data_obj, mod_msgpack_exttype_set_data); + +const mp_obj_property_t mod_msgpack_exttype_data_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&mod_msgpack_exttype_get_data_obj, + (mp_obj_t)&mod_msgpack_exttype_set_data_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +STATIC mp_rom_map_elem_t mod_msgpack_exttype_locals_dict_table[] = { + // Properties + { MP_ROM_QSTR(MP_QSTR_code), MP_ROM_PTR(&mod_msgpack_exttype_code_obj) }, + { MP_ROM_QSTR(MP_QSTR_data), MP_ROM_PTR(&mod_msgpack_exttype_data_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(mod_msgpack_exttype_locals_dict, mod_msgpack_exttype_locals_dict_table); + +const mp_obj_type_t mod_msgpack_exttype_type = { + { &mp_type_type }, + .name = MP_QSTR_ExtType, + .make_new = mod_msgpack_exttype_make_new, + .locals_dict = (mp_obj_dict_t*)&mod_msgpack_exttype_locals_dict, +}; diff --git a/shared-bindings/msgpack/ExtType.h b/shared-bindings/msgpack/ExtType.h new file mode 100644 index 0000000000000..64173b22136fd --- /dev/null +++ b/shared-bindings/msgpack/ExtType.h @@ -0,0 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Bernhard Boser + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_MSGPACK_EXTTYPE___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_MSGPACK_EXTTYPE___INIT___H + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + int32_t code; + mp_obj_t data; +} mod_msgpack_extype_obj_t; + +extern const mp_obj_type_t mod_msgpack_exttype_type; + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_MSGPACK_EXTTYPE___INIT___H diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index a222177f748bf..fcb86ac6c7842 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -24,15 +24,24 @@ * THE SOFTWARE. */ +#include +#include "py/obj.h" +#include "py/runtime.h" #include "shared-bindings/msgpack/__init__.h" #include "shared-module/msgpack/__init__.h" +#include "shared-bindings/msgpack/ExtType.h" + +#define MP_OBJ_IS_METH(o) (MP_OBJ_IS_OBJ(o) && (((mp_obj_base_t*)MP_OBJ_TO_PTR(o))->type->name == MP_QSTR_bound_method)) //| """Pack object in msgpack format //| //| The msgpack format is similar to json, except that the encoded data is binary. -//| See https://msgpack.org for details. +//| See https://msgpack.org for details. The module implements a subset of the cpython +//| module msgpack-python. +//| +//| Not implemented: 64-bit int, uint, float. //| -//| Example: +//| Example 1: //| import msgpack //| from io import BytesIO //| @@ -41,33 +50,98 @@ //| b.seek(0) //| print(msgpack.unpack(b))""" //| - -//| def pack(obj: Any, buffer: WriteableBuffer) -> None: -//| """Pack obj to stream.""" -//| ... +//| Example 2: handling objects +//| +//| from msgpack import pack, unpack, ExtType +//| from io import BytesIO +//| +//| class MyClass: +//| def __init__(self, val): +//| self.value = val +//| def __str__(self): +//| return str(self.value) +//| +//| data = MyClass(b'my_value') +//| +//| def encoder(obj): +//| if isinstance(obj, MyClass): +//| return ExtType(1, obj.value) +//| return f"no encoder for {obj}" //| +//| def decoder(code, data): +//| if code == 1: +//| return MyClass(data) +//| return f"no decoder for type {code}" +//| +//| buffer = BytesIO() +//| pack(data, buffer, default=encoder) +//| buffer.seek(0) +//| decoded = unpack(buffer, ext_hook=decoder) +//| print(f"{data} -> {buffer.getvalue()} -> {decoded}") +//| """ + + +//| def pack(obj: object, buffer: WriteableBuffer, *, default: Function=None) -> None: +//| """Ouput object to buffer in msgpack format. +//| :param object obj: Object to convert to msgpack format. +//| :param ~_typing.WriteableBuffer buffer: buffer to write into +//| :param Optional[~_typing.Function] default: +//| function called for python objects that do not have +//| a representation in msgpack format. +//| """ + +STATIC mp_obj_t mod_msgpack_pack(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_obj, ARG_buffer, ARG_default }; + STATIC const mp_arg_t allowed_args[] = { + { MP_QSTR_obj, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_default, MP_ARG_KW_ONLY | MP_ARG_OBJ, { .u_obj = mp_const_none } }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); -STATIC mp_obj_t mod_msgpack_pack(mp_obj_t obj, mp_obj_t stream_obj) { - common_hal_msgpack_pack(obj, stream_obj); + mp_obj_t handler = args[ARG_default].u_obj; + if (handler != mp_const_none && !MP_OBJ_IS_FUN(handler) && !MP_OBJ_IS_METH(handler)) { + mp_raise_ValueError(translate("default is not a function")); + } + + common_hal_msgpack_pack(args[ARG_obj].u_obj, args[ARG_buffer].u_obj, handler); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_msgpack_pack_obj, mod_msgpack_pack); +MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_pack_obj, 1, mod_msgpack_pack); +//| def unpack(buffer: ReadableBuffer, *, ext_hook: Function=None, use_list: bool=True) -> object: +//| """Unpack and return one object from buffer. +//| :param ~_typing.ReadableBuffer buffer: buffer to read from +//| :param Optional[~_typing.Function] ext_hook: function called for objects in +//| msgpack ext format. +//| :param Optional[bool] use_list: return array as list or tuple (use_list=False). +//| :return object: object read from buffer. +//| """ -//| def unpack(buffer: ReadableBuffer) -> Any: -//| """Unpack and return one object (in msgpack format) from stream. -//| Call repeatedly to read multiple objects from the stream.""" -//| ... -//| +STATIC mp_obj_t mod_msgpack_unpack(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_buffer, ARG_ext_hook, ARG_use_list }; + STATIC const mp_arg_t allowed_args[] = { + { MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, }, + { MP_QSTR_ext_hook, MP_ARG_KW_ONLY | MP_ARG_OBJ, { .u_obj = mp_const_none } }, + { MP_QSTR_use_list, MP_ARG_KW_ONLY | MP_ARG_BOOL, { .u_bool = true } }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + mp_obj_t hook = args[ARG_ext_hook].u_obj; + if (hook != mp_const_none && !MP_OBJ_IS_FUN(hook) && !MP_OBJ_IS_METH(hook)) { + mp_raise_ValueError(translate("ext_hook is not a function")); + } -STATIC mp_obj_t mod_msgpack_unpack(mp_obj_t stream_obj) { - return common_hal_msgpack_unpack(stream_obj); + return common_hal_msgpack_unpack(args[ARG_buffer].u_obj, hook, args[ARG_use_list].u_bool); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_msgpack_unpack_obj, mod_msgpack_unpack); +MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_unpack_obj, 1, mod_msgpack_unpack); STATIC const mp_rom_map_elem_t msgpack_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_msgpack) }, + { MP_ROM_QSTR(MP_QSTR_ExtType), MP_ROM_PTR(&mod_msgpack_exttype_type) }, { MP_ROM_QSTR(MP_QSTR_pack), MP_ROM_PTR(&mod_msgpack_pack_obj) }, { MP_ROM_QSTR(MP_QSTR_unpack), MP_ROM_PTR(&mod_msgpack_unpack_obj) }, }; diff --git a/shared-bindings/msgpack/__init__.h b/shared-bindings/msgpack/__init__.h index 4836cc62e74fa..a02ead0bd01b2 100644 --- a/shared-bindings/msgpack/__init__.h +++ b/shared-bindings/msgpack/__init__.h @@ -29,6 +29,6 @@ #include "py/obj.h" -// Nothing now. +// nothing for now #endif // MICROPY_INCLUDED_SHARED_BINDINGS_MSGPACK___INIT___H diff --git a/shared-module/msgpack/__init__.c b/shared-module/msgpack/__init__.c index 5bc7d1f6159f5..204312109a46f 100644 --- a/shared-module/msgpack/__init__.c +++ b/shared-module/msgpack/__init__.c @@ -27,6 +27,7 @@ #include #include +#include "py/obj.h" #include "py/binary.h" #include "py/objarray.h" #include "py/objlist.h" @@ -36,6 +37,7 @@ #include "py/stream.h" #include "supervisor/shared/translate.h" +#include "shared-bindings/msgpack/ExtType.h" //////////////////////////////////////////////////////////////// // stream management @@ -56,7 +58,7 @@ STATIC msgpack_stream_t get_stream(mp_obj_t stream_obj, int flags) { //////////////////////////////////////////////////////////////// // readers -STATIC void read_bytes(msgpack_stream_t *s, void *buf, mp_uint_t size) { +STATIC void read(msgpack_stream_t *s, void *buf, mp_uint_t size) { if (size == 0) return; mp_uint_t ret = s->read(s->stream_obj, buf, size, &s->errcode); if (s->errcode != 0) { @@ -69,13 +71,13 @@ STATIC void read_bytes(msgpack_stream_t *s, void *buf, mp_uint_t size) { STATIC uint8_t read1(msgpack_stream_t *s) { uint8_t res = 0; - read_bytes(s, &res, 1); + read(s, &res, 1); return res; } STATIC uint16_t read2(msgpack_stream_t *s) { uint16_t res = 0; - read_bytes(s, &res, 2); + read(s, &res, 2); int n = 1; if (*(char *)&n == 1) res = __builtin_bswap16(res); return res; @@ -83,19 +85,18 @@ STATIC uint16_t read2(msgpack_stream_t *s) { STATIC uint32_t read4(msgpack_stream_t *s) { uint32_t res = 0; - read_bytes(s, &res, 4); + read(s, &res, 4); int n = 1; if (*(char *)&n == 1) res = __builtin_bswap32(res); return res; } STATIC size_t read_size(msgpack_stream_t *s, uint8_t len_index) { - size_t res = 0; + size_t res; switch (len_index) { case 0: res = (size_t)read1(s); break; case 1: res = (size_t)read2(s); break; case 2: res = (size_t)read4(s); break; - default: mp_raise_ValueError(translate("too big")); } return res; } @@ -103,7 +104,7 @@ STATIC size_t read_size(msgpack_stream_t *s, uint8_t len_index) { //////////////////////////////////////////////////////////////// // writers -STATIC void write_bytes(msgpack_stream_t *s, const void *buf, mp_uint_t size) { +STATIC void write(msgpack_stream_t *s, const void *buf, mp_uint_t size) { mp_uint_t ret = s->write(s->stream_obj, buf, size, &s->errcode); if (s->errcode != 0) { mp_raise_OSError(s->errcode); @@ -114,19 +115,19 @@ STATIC void write_bytes(msgpack_stream_t *s, const void *buf, mp_uint_t size) { } STATIC void write1(msgpack_stream_t *s, uint8_t obj) { - write_bytes(s, &obj, 1); + write(s, &obj, 1); } STATIC void write2(msgpack_stream_t *s, uint16_t obj) { int n = 1; if (*(char *)&n == 1) obj = __builtin_bswap16(obj); - write_bytes(s, &obj, 2); + write(s, &obj, 2); } STATIC void write4(msgpack_stream_t *s, uint32_t obj) { int n = 1; if (*(char *)&n == 1) obj = __builtin_bswap32(obj); - write_bytes(s, &obj, 4); + write(s, &obj, 4); } // compute and write msgpack size code (array structures) @@ -178,15 +179,34 @@ STATIC void pack_int(msgpack_stream_t *s, int32_t x) { } } -void pack_bin(msgpack_stream_t *s, const uint8_t* data, size_t len) { +STATIC void pack_bin(msgpack_stream_t *s, const uint8_t* data, size_t len) { write_size(s, 0xc4, len); for (size_t i=0; idata, &bufinfo, MP_BUFFER_READ); + pack_ext(s, ext->code, bufinfo.buf, bufinfo.len); } else if (MP_OBJ_IS_TYPE(obj, &mp_type_bytes)) { // bytes mp_buffer_info_t bufinfo; @@ -243,14 +268,14 @@ void pack(mp_obj_t obj, msgpack_stream_t *s) { mp_obj_tuple_t *self = MP_OBJ_TO_PTR(obj); pack_array(s, self->len); for (size_t i=0; ilen; i++) { - pack(self->items[i], s); + pack(self->items[i], s, default_handler); } } else if (MP_OBJ_IS_TYPE(obj, &mp_type_list)) { // list (layout differs from tuple) mp_obj_list_t *self = MP_OBJ_TO_PTR(obj); pack_array(s, self->len); for (size_t i=0; ilen; i++) { - pack(self->items[i], s); + pack(self->items[i], s, default_handler); } } else if (MP_OBJ_IS_TYPE(obj, &mp_type_dict)) { // dict @@ -259,8 +284,8 @@ void pack(mp_obj_t obj, msgpack_stream_t *s) { size_t cur = 0; mp_map_elem_t *next = NULL; while ((next = dict_iter_next(self, &cur)) != NULL) { - pack(next->key, s); - pack(next->value, s); + pack(next->key, s, default_handler); + pack(next->value, s, default_handler); } } else if (mp_obj_is_float(obj)) { union Float { mp_float_t f; uint32_t u; }; @@ -275,14 +300,60 @@ void pack(mp_obj_t obj, msgpack_stream_t *s) { } else if (obj == mp_const_true) { write1(s, 0xc3); } else { - mp_raise_ValueError(translate("no packer")); + if (default_handler != mp_const_none) { + // set default_handler to mp_const_none to avoid infinite recursion + // this also precludes some valid outputs + pack(mp_call_function_1(default_handler, obj), s, mp_const_none); + } else { + mp_raise_ValueError(translate("no default packer")); + } } } //////////////////////////////////////////////////////////////// // unpacker -mp_obj_t unpack(msgpack_stream_t *s) { +STATIC mp_obj_t unpack(msgpack_stream_t *s, mp_obj_t ext_hook, bool use_list); + +STATIC mp_obj_t unpack_array_elements(msgpack_stream_t *s, size_t size, mp_obj_t ext_hook, bool use_list) { + if (use_list) { + mp_obj_list_t *t = MP_OBJ_TO_PTR(mp_obj_new_list(size, NULL)); + for (size_t i=0; iitems[i] = unpack(s, ext_hook, use_list); + } + return MP_OBJ_FROM_PTR(t); + } else { + mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(size, NULL)); + for (size_t i=0; iitems[i] = unpack(s, ext_hook, use_list); + } + return MP_OBJ_FROM_PTR(t); + } +} + +STATIC mp_obj_t unpack_bytes(msgpack_stream_t *s, size_t size) { + vstr_t vstr; + vstr_init_len(&vstr, size); + byte *p = (byte*)vstr.buf; + read(s, p, size); + return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); +} + +STATIC mp_obj_t unpack_ext(msgpack_stream_t *s, size_t size, mp_obj_t ext_hook) { + int8_t code = read1(s); + mp_obj_t data = unpack_bytes(s, size); + if (ext_hook != mp_const_none) { + return mp_call_function_2(ext_hook, MP_OBJ_NEW_SMALL_INT(code), data); + } else { + mod_msgpack_extype_obj_t *o = m_new_obj(mod_msgpack_extype_obj_t); + o->base.type = &mod_msgpack_exttype_type; + o->code = code; + o->data = data; + return MP_OBJ_FROM_PTR(o); + } +} + +STATIC mp_obj_t unpack(msgpack_stream_t *s, mp_obj_t ext_hook, bool use_list) { uint8_t code = read1(s); if (((code & 0b10000000) == 0) || ((code & 0b11100000) == 0b11100000)) { // int @@ -293,24 +364,19 @@ mp_obj_t unpack(msgpack_stream_t *s) { size_t len = code & 0b11111; // allocate on stack; len < 32 char str[len]; - read_bytes(s, &str, len); + read(s, &str, len); return mp_obj_new_str(str, len); } if ((code & 0b11110000) == 0b10010000) { - // array (tuple) - size_t len = code & 0b1111; - mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(len, NULL)); - for (size_t i=0; iitems[i] = unpack(s); - } - return MP_OBJ_FROM_PTR(t); + // array (list / tuple) + return unpack_array_elements(s, code & 0b1111, ext_hook, use_list); } if ((code & 0b11110000) == 0b10000000) { // map (dict) size_t len = code & 0b1111; mp_obj_dict_t *d = MP_OBJ_TO_PTR(mp_obj_new_dict(len)); for (size_t i=0; iitems[i] = unpack(s); - } - return MP_OBJ_FROM_PTR(t); + size_t size = read_size(s, code - 0xdc + 1); + return unpack_array_elements(s, size, ext_hook, use_list); } - case 0xc1: // never used - case 0xc7: // ext 8 - case 0xc8: // ext 16 - case 0xc9: // ext 32 - case 0xcb: // float 64 - case 0xcf: // uint 64 - case 0xd3: // int 64 case 0xd4: // fixenxt 1 + return unpack_ext(s, 1, ext_hook); case 0xd5: // fixenxt 2 + return unpack_ext(s, 2, ext_hook); case 0xd6: // fixenxt 4 + return unpack_ext(s, 4, ext_hook); case 0xd7: // fixenxt 8 + return unpack_ext(s, 8, ext_hook); case 0xd8: // fixenxt 16 + return unpack_ext(s, 16, ext_hook); + case 0xc7: // ext 8 + case 0xc8: // ext 16 + case 0xc9: + // ext 8, 16, 32 + return unpack_ext(s, read_size(s, code-0xc7), ext_hook); + case 0xc1: // never used + case 0xcb: // float 64 + case 0xcf: // uint 64 + case 0xd3: // int 64 default: - mp_raise_ValueError(translate("no unpacker found")); + mp_raise_NotImplementedError(translate("64 bit types")); } } -void common_hal_msgpack_pack(mp_obj_t obj, mp_obj_t stream_obj) { +void common_hal_msgpack_pack(mp_obj_t obj, mp_obj_t stream_obj, mp_obj_t default_handler) { msgpack_stream_t stream = get_stream(stream_obj, MP_STREAM_OP_WRITE); - pack(obj, &stream); + pack(obj, &stream, default_handler); } -mp_obj_t common_hal_msgpack_unpack(mp_obj_t stream_obj) { +mp_obj_t common_hal_msgpack_unpack(mp_obj_t stream_obj, mp_obj_t ext_hook, bool use_list) { msgpack_stream_t stream = get_stream(stream_obj, MP_STREAM_OP_WRITE); - return unpack(&stream); + return unpack(&stream, ext_hook, use_list); } diff --git a/shared-module/msgpack/__init__.h b/shared-module/msgpack/__init__.h index 0a5e7852ad9c9..88b4809f958e8 100644 --- a/shared-module/msgpack/__init__.h +++ b/shared-module/msgpack/__init__.h @@ -28,7 +28,7 @@ #include "py/stream.h" -void common_hal_msgpack_pack(mp_obj_t obj, mp_obj_t stream_obj); -mp_obj_t common_hal_msgpack_unpack(mp_obj_t stream_obj); +void common_hal_msgpack_pack(mp_obj_t obj, mp_obj_t stream_obj, mp_obj_t default_handler); +mp_obj_t common_hal_msgpack_unpack(mp_obj_t stream_obj, mp_obj_t ext_hook, bool use_list); #endif diff --git a/tests/extmod/umsgpack_pack.py b/tests/extmod/umsgpack_pack.py new file mode 100644 index 0000000000000..d9f0005e1be38 --- /dev/null +++ b/tests/extmod/umsgpack_pack.py @@ -0,0 +1,30 @@ +try: + from uio import BytesIO + import umsgpack as msgpack +except: + try: + from io import BytesIO + import msgpack + except ImportError: + print("SKIP") + raise SystemExit + +b = BytesIO() +msgpack.pack(False, s) +print(b.getvalue()) + +b = BytesIO() +msgpack.pack({"a": (-1, 0, 2, [3, None], 128)}, b) +print(b.getvalue()) + +# pack to a small-int not allowed +try: + msgpack.pack(123, 1) +except (AttributeError, OSError): # CPython and uPy have different errors + print('Exception') + +# pack to an object not allowed +try: + msgpack.pack(123, {}) +except (AttributeError, OSError): # CPython and uPy have different errors + print('Exception') diff --git a/tests/extmod/umsgpack_pack.py.ext b/tests/extmod/umsgpack_pack.py.ext new file mode 100644 index 0000000000000..2f966be069523 --- /dev/null +++ b/tests/extmod/umsgpack_pack.py.ext @@ -0,0 +1,5 @@ +b'\xc2' +b'\x82\xa1a\x96\xff\x00\x02\x92\x03\xc0\xd1\x00\x80\xc4\x07abcdefg\xa1b\xd4\x05x' +Exception ExtType +Exception to int +Exception to object From 534b48fcfe688d88455bd8421fa02255ecc8508b Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Mon, 7 Dec 2020 16:08:16 -0800 Subject: [PATCH 370/770] remove a ~ from doc that causes an error; add ExtType.c to circuitpy_defns.mk --- locale/circuitpython.pot | 2 +- py/circuitpy_defns.mk | 1 + shared-bindings/msgpack/ExtType.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 979f62466e77e..7acfbe1ded848 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-12-07 15:35-0800\n" +"POT-Creation-Date: 2020-12-07 16:05-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index f13f69bcf2b0c..39ff2e380fbf1 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -407,6 +407,7 @@ $(filter $(SRC_PATTERNS), \ microcontroller/ResetReason.c \ microcontroller/RunMode.c \ msgpack/__init__.c \ + msgpack/ExtType.c \ supervisor/RunReason.c \ ) diff --git a/shared-bindings/msgpack/ExtType.c b/shared-bindings/msgpack/ExtType.c index 3a4eee388494a..dfccbd3ef26e8 100644 --- a/shared-bindings/msgpack/ExtType.c +++ b/shared-bindings/msgpack/ExtType.c @@ -34,7 +34,7 @@ //| def __init__(self, code: int, data: bytes) -> None: //| """Constructor""" //| -//| :param int code: type code in range 0~127. +//| :param int code: type code in range 0 .. 127. //| :param bytes data: representation. STATIC mp_obj_t mod_msgpack_exttype_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { From 9412c3f58e9340d9300cd048f566feda7c48c53c Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Mon, 7 Dec 2020 16:22:09 -0800 Subject: [PATCH 371/770] moved misplaced triple-quote --- shared-bindings/msgpack/ExtType.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/shared-bindings/msgpack/ExtType.c b/shared-bindings/msgpack/ExtType.c index dfccbd3ef26e8..daac55dc446c4 100644 --- a/shared-bindings/msgpack/ExtType.c +++ b/shared-bindings/msgpack/ExtType.c @@ -32,10 +32,9 @@ //| class ExtType: //| """ExtType represents ext type in msgpack.""" //| def __init__(self, code: int, data: bytes) -> None: -//| """Constructor""" -//| -//| :param int code: type code in range 0 .. 127. -//| :param bytes data: representation. +//| """Constructor +//| :param int code: type code in range 0~127. +//| :param bytes data: representation.""" STATIC mp_obj_t mod_msgpack_exttype_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { mod_msgpack_extype_obj_t *self = m_new_obj(mod_msgpack_extype_obj_t); From 5875a27fa8f09dc27c3d25c13f4aa28c22c0279b Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Mon, 7 Dec 2020 16:32:38 -0800 Subject: [PATCH 372/770] removed extra triple quote --- shared-bindings/msgpack/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index fcb86ac6c7842..5f1fac13755f1 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -48,7 +48,7 @@ //| b = BytesIO() //| msgpack.pack({'list': [True, False, None, 1, 'abc'], 'str': 'blah'}, b) //| b.seek(0) -//| print(msgpack.unpack(b))""" +//| print(msgpack.unpack(b)) //| //| Example 2: handling objects //| From 44b56f76c4a65617e8b477eb44cb35dab8624cb9 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 7 Dec 2020 16:39:54 -0800 Subject: [PATCH 373/770] Store safe mode state in the RTC. Also print backtrace before reset when DEBUG. This will help debug safe mode issues which calls reset. --- ports/esp32s2/supervisor/port.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 0841081de8e9b..6222cd29041ba 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -54,8 +54,11 @@ #include "peripherals/rmt.h" #include "peripherals/pcnt.h" #include "peripherals/timer.h" +#include "components/esp_rom/include/esp_rom_uart.h" #include "components/heap/include/esp_heap_caps.h" +#include "components/xtensa/include/esp_debug_helpers.h" #include "components/soc/soc/esp32s2/include/soc/cache_memory.h" +#include "components/soc/soc/esp32s2/include/soc/rtc_cntl_reg.h" #define HEAP_SIZE (48 * 1024) @@ -78,6 +81,11 @@ safe_mode_t port_init(void) { args.name = "CircuitPython Tick"; esp_timer_create(&args, &_tick_timer); + #ifdef DEBUG + // Send the ROM output out of the UART. This includes early logs. + esp_rom_install_channel_putc(1, esp_rom_uart_putc); + #endif + heap = NULL; never_reset_module_internal_pins(); @@ -165,6 +173,7 @@ void reset_to_bootloader(void) { } void reset_cpu(void) { + esp_backtrace_print(100); esp_restart(); } @@ -204,10 +213,11 @@ bool port_has_fixed_stack(void) { // Place the word to save just after our BSS section that gets blanked. void port_set_saved_word(uint32_t value) { + REG_WRITE(RTC_CNTL_STORE0_REG, value); } uint32_t port_get_saved_word(void) { - return 0; + return REG_READ(RTC_CNTL_STORE0_REG); } uint64_t port_get_raw_ticks(uint8_t* subticks) { From 9903c9e855f07b6660f6a89546030d47cd9c70e6 Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Mon, 7 Dec 2020 16:50:52 -0800 Subject: [PATCH 374/770] fixed (?) typespec for callback functions --- shared-bindings/msgpack/__init__.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index 5f1fac13755f1..08d535c58a2a5 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -85,7 +85,7 @@ //| """Ouput object to buffer in msgpack format. //| :param object obj: Object to convert to msgpack format. //| :param ~_typing.WriteableBuffer buffer: buffer to write into -//| :param Optional[~_typing.Function] default: +//| :param Optional[~_typing.Callable[[object], None]] default: //| function called for python objects that do not have //| a representation in msgpack format. //| """ @@ -113,7 +113,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_pack_obj, 1, mod_msgpack_pack); //| def unpack(buffer: ReadableBuffer, *, ext_hook: Function=None, use_list: bool=True) -> object: //| """Unpack and return one object from buffer. //| :param ~_typing.ReadableBuffer buffer: buffer to read from -//| :param Optional[~_typing.Function] ext_hook: function called for objects in +//| :param Optional[~_typing.Callable[[int, bytes], object]] ext_hook: function called for objects in //| msgpack ext format. //| :param Optional[bool] use_list: return array as list or tuple (use_list=False). //| :return object: object read from buffer. From 413885a529db041413a1e1b259389afce3602d7e Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Mon, 7 Dec 2020 17:45:21 -0800 Subject: [PATCH 375/770] fix typspec in function declarations --- shared-bindings/msgpack/__init__.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index 08d535c58a2a5..0660ee78b925b 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -81,7 +81,7 @@ //| """ -//| def pack(obj: object, buffer: WriteableBuffer, *, default: Function=None) -> None: +//| def pack(obj: object, buffer: WriteableBuffer, *, default: Callable[[object], None]]=None) -> None: //| """Ouput object to buffer in msgpack format. //| :param object obj: Object to convert to msgpack format. //| :param ~_typing.WriteableBuffer buffer: buffer to write into @@ -110,7 +110,7 @@ STATIC mp_obj_t mod_msgpack_pack(size_t n_args, const mp_obj_t *pos_args, mp_map } MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_pack_obj, 1, mod_msgpack_pack); -//| def unpack(buffer: ReadableBuffer, *, ext_hook: Function=None, use_list: bool=True) -> object: +//| def unpack(buffer: ReadableBuffer, *, ext_hook: Callable[[int, bytes], object]]=None, use_list: bool=True) -> object: //| """Unpack and return one object from buffer. //| :param ~_typing.ReadableBuffer buffer: buffer to read from //| :param Optional[~_typing.Callable[[int, bytes], object]] ext_hook: function called for objects in From 571c063c2a9059a6957d5dae1d90702d0b5bd879 Mon Sep 17 00:00:00 2001 From: Bruce Segal Date: Mon, 7 Dec 2020 17:57:54 -0800 Subject: [PATCH 376/770] Working, tested with two i2c busses --- ports/esp32s2/common-hal/busio/I2C.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/ports/esp32s2/common-hal/busio/I2C.c b/ports/esp32s2/common-hal/busio/I2C.c index 6f19531288dfa..772262d0a5ef0 100644 --- a/ports/esp32s2/common-hal/busio/I2C.c +++ b/ports/esp32s2/common-hal/busio/I2C.c @@ -49,11 +49,11 @@ void never_reset_i2c(i2c_port_t num) { void i2c_reset(void) { for (i2c_port_t num = 0; num < I2C_NUM_MAX; num++) { if (i2c_status[num] == STATUS_IN_USE) { - i2c_driver_delete(num); i2c_status[num] = STATUS_FREE; } } } +static bool i2c_inited[I2C_NUM_MAX]; void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, const mcu_pin_obj_t* scl, const mcu_pin_obj_t* sda, uint32_t frequency, uint32_t timeout) { @@ -121,13 +121,19 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, if (result != ESP_OK) { mp_raise_ValueError(translate("Invalid pins")); } - result = i2c_driver_install(self->i2c_num, - I2C_MODE_MASTER, - 0, - 0, - 0); - if (result != ESP_OK) { - mp_raise_OSError(MP_EIO); + + + if (!i2c_inited[self->i2c_num]) { + result = i2c_driver_install(self->i2c_num, + I2C_MODE_MASTER, + 0, + 0, + 0); + if (result != ESP_OK) { + mp_raise_OSError(MP_EIO); + } + i2c_inited[self->i2c_num] = true; + } claim_pin(sda); @@ -143,7 +149,6 @@ void common_hal_busio_i2c_deinit(busio_i2c_obj_t *self) { return; } - i2c_driver_delete(self->i2c_num); i2c_status[self->i2c_num] = STATUS_FREE; common_hal_reset_pin(self->sda_pin); From fc23a0cc8ac40115047c2430c700c0832ba979eb Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Tue, 8 Dec 2020 11:30:00 +0530 Subject: [PATCH 377/770] implement ota module --- ports/esp32s2/common-hal/ota/__init__.c | 31 +++++++++++++++ ports/esp32s2/mpconfigport.mk | 1 + py/circuitpy_defns.mk | 4 ++ py/circuitpy_mpconfig.h | 8 ++++ py/circuitpy_mpconfig.mk | 3 ++ shared-bindings/ota/__init__.c | 51 +++++++++++++++++++++++++ shared-bindings/ota/__init__.h | 34 +++++++++++++++++ 7 files changed, 132 insertions(+) create mode 100644 ports/esp32s2/common-hal/ota/__init__.c create mode 100644 shared-bindings/ota/__init__.c create mode 100644 shared-bindings/ota/__init__.h diff --git a/ports/esp32s2/common-hal/ota/__init__.c b/ports/esp32s2/common-hal/ota/__init__.c new file mode 100644 index 0000000000000..87daffa568e17 --- /dev/null +++ b/ports/esp32s2/common-hal/ota/__init__.c @@ -0,0 +1,31 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * 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 "shared-bindings/ota/__init__.h" + +void common_hal_ota_flash(const void *buf, const size_t len) { + +} diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index b3b2a6d70021f..da231107fb82d 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -23,6 +23,7 @@ CIRCUITPY_FREQUENCYIO = 1 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_ROTARYIO = 1 CIRCUITPY_NVM = 1 +CIRCUITPY_OTA = 1 # We don't have enough endpoints to include MIDI. CIRCUITPY_USB_MIDI = 0 CIRCUITPY_WIFI = 1 diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index e9253682e0684..68e806d4b2bc4 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -205,6 +205,9 @@ endif ifeq ($(CIRCUITPY_OS),1) SRC_PATTERNS += os/% endif +ifeq ($(CIRCUITPY_OTA),1) +SRC_PATTERNS += ota/% +endif ifeq ($(CIRCUITPY_PIXELBUF),1) SRC_PATTERNS += _pixelbuf/% endif @@ -347,6 +350,7 @@ SRC_COMMON_HAL_ALL = \ nvm/ByteArray.c \ nvm/__init__.c \ os/__init__.c \ + ota/__init__.c \ ps2io/Ps2.c \ ps2io/__init__.c \ pulseio/PulseIn.c \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index f04112bfcd72a..b432757b33b20 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -539,6 +539,13 @@ extern const struct _mp_obj_module_t os_module; #define OS_MODULE_ALT_NAME #endif +#if CIRCUITPY_OTA +extern const struct _mp_obj_module_t ota_module; +#define OTA_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_ota), (mp_obj_t)&ota_module }, +#else +#define OTA_MODULE +#endif + #if CIRCUITPY_PEW extern const struct _mp_obj_module_t pew_module; #define PEW_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR__pew),(mp_obj_t)&pew_module }, @@ -827,6 +834,7 @@ extern const struct _mp_obj_module_t wifi_module; NETWORK_MODULE \ SOCKET_MODULE \ WIZNET_MODULE \ + OTA_MODULE \ PEW_MODULE \ PIXELBUF_MODULE \ PS2IO_MODULE \ diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 370f13373904a..09074bf53c771 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -179,6 +179,9 @@ CFLAGS += -DCIRCUITPY_NVM=$(CIRCUITPY_NVM) CIRCUITPY_OS ?= 1 CFLAGS += -DCIRCUITPY_OS=$(CIRCUITPY_OS) +CIRCUITPY_OTA ?= 0 +CFLAGS += -DCIRCUITPY_OTA=$(CIRCUITPY_OTA) + CIRCUITPY_PIXELBUF ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_PIXELBUF=$(CIRCUITPY_PIXELBUF) diff --git a/shared-bindings/ota/__init__.c b/shared-bindings/ota/__init__.c new file mode 100644 index 0000000000000..a6c0424865d2c --- /dev/null +++ b/shared-bindings/ota/__init__.c @@ -0,0 +1,51 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * 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 "shared-bindings/ota/__init__.h" + +//| """ota module +//| +//| The `ota` module implements over-the-air update.""" + +STATIC mp_obj_t ota_flash(mp_obj_t program_binary_in) { + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(program_binary_in, &bufinfo, MP_BUFFER_READ); + + common_hal_ota_flash(bufinfo.buf, bufinfo.len); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(ota_flash_obj, ota_flash); + +STATIC const mp_rom_map_elem_t ota_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ota) }, + { MP_ROM_QSTR(MP_QSTR_flash), MP_ROM_PTR(&ota_flash_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(ota_module_globals, ota_module_globals_table); + +const mp_obj_module_t ota_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&ota_module_globals, +}; diff --git a/shared-bindings/ota/__init__.h b/shared-bindings/ota/__init__.h new file mode 100644 index 0000000000000..c4b40b2af350e --- /dev/null +++ b/shared-bindings/ota/__init__.h @@ -0,0 +1,34 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_OTA___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_OTA___INIT___H + +#include "py/runtime.h" + +extern void common_hal_ota_flash(const void *buf, const size_t len); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_OTA___INIT___H From 602243748bdf238ff16ffc8977e6cc18b4357dcc Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Tue, 8 Dec 2020 11:45:00 +0530 Subject: [PATCH 378/770] add ota support for esp32s2 --- locale/circuitpython.pot | 13 +++- ports/esp32s2/Makefile | 2 + ports/esp32s2/common-hal/ota/__init__.c | 99 +++++++++++++++++++++++++ 3 files changed, 110 insertions(+), 4 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index b136e9dd26f02..5bf95043a6d8c 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-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 10:30+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -498,8 +498,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "" @@ -1296,7 +1296,7 @@ msgstr "" msgid "No DMA channel found" msgstr "" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1420,6 +1420,10 @@ msgstr "" msgid "Not settable" msgstr "" +#: ports/esp32s2/common-hal/ota/__init__.c +msgid "OTA Update Failed" +msgstr "" + #: shared-bindings/util.c msgid "" "Object has been deinitialized and can no longer be used. Create a new object." @@ -1503,6 +1507,7 @@ msgstr "" msgid "Pin does not have ADC capabilities" msgstr "" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 4486cb598c1ef..ce0a4825d3b8c 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -106,6 +106,8 @@ INC += -isystem esp-idf/components/heap/include INC += -isystem esp-idf/components/esp_system/include INC += -isystem esp-idf/components/spi_flash/include INC += -isystem esp-idf/components/nvs_flash/include +INC += -isystem esp-idf/components/app_update/include +INC += -isystem esp-idf/components/bootloader_support/include INC += -I$(BUILD)/esp-idf/config CFLAGS += -DHAVE_CONFIG_H \ diff --git a/ports/esp32s2/common-hal/ota/__init__.c b/ports/esp32s2/common-hal/ota/__init__.c index 87daffa568e17..727b6b107b666 100644 --- a/ports/esp32s2/common-hal/ota/__init__.c +++ b/ports/esp32s2/common-hal/ota/__init__.c @@ -26,6 +26,105 @@ #include "shared-bindings/ota/__init__.h" +#include + +#include "esp_log.h" +#include "esp_ota_ops.h" + +static const char *TAG = "OTA"; + +static void __attribute__((noreturn)) task_fatal_error(void) { + ESP_LOGE(TAG, "Exiting task due to fatal error..."); + mp_raise_RuntimeError(translate("OTA Update Failed")); +} + void common_hal_ota_flash(const void *buf, const size_t len) { + esp_err_t err; + /* update handle : set by esp_ota_begin(), must be freed via esp_ota_end() */ + esp_ota_handle_t update_handle = 0 ; + const esp_partition_t *update_partition = NULL; + + ESP_LOGI(TAG, "Starting update"); + + const esp_partition_t *configured = esp_ota_get_boot_partition(); + const esp_partition_t *running = esp_ota_get_running_partition(); + + if (configured != running) { + ESP_LOGW(TAG, "Configured OTA boot partition at offset 0x%08x, but running from offset 0x%08x", + configured->address, running->address); + ESP_LOGW(TAG, "(This can happen if either the OTA boot data or preferred boot image become corrupted somehow.)"); + } + ESP_LOGI(TAG, "Running partition type %d subtype %d (offset 0x%08x)", + running->type, running->subtype, running->address); + + update_partition = esp_ota_get_next_update_partition(NULL); + ESP_LOGI(TAG, "Writing partition type %d subtype %d (offset 0x%08x)\n", + update_partition->type, update_partition->subtype, update_partition->address); + assert(update_partition != NULL); + + + if (len > sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t) + sizeof(esp_app_desc_t)) { + // check current version with downloading + esp_app_desc_t new_app_info; + memcpy(&new_app_info, &((char *)buf)[sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t)], sizeof(esp_app_desc_t)); + ESP_LOGI(TAG, "New firmware version: %s", new_app_info.version); + + esp_app_desc_t running_app_info; + if (esp_ota_get_partition_description(running, &running_app_info) == ESP_OK) { + ESP_LOGI(TAG, "Running firmware version: %s", running_app_info.version); + } + + const esp_partition_t* last_invalid_app = esp_ota_get_last_invalid_partition(); + esp_app_desc_t invalid_app_info; + if (esp_ota_get_partition_description(last_invalid_app, &invalid_app_info) == ESP_OK) { + ESP_LOGI(TAG, "Last invalid firmware version: %s", invalid_app_info.version); + } + + // check current version with last invalid partition + if (last_invalid_app != NULL) { + if (memcmp(invalid_app_info.version, new_app_info.version, sizeof(new_app_info.version)) == 0) { + ESP_LOGW(TAG, "New version is the same as invalid version."); + ESP_LOGW(TAG, "Previously, there was an attempt to launch the firmware with %s version, but it failed.", invalid_app_info.version); + ESP_LOGW(TAG, "The firmware has been rolled back to the previous version."); + task_fatal_error(); + } + } + + if (memcmp(new_app_info.version, running_app_info.version, sizeof(new_app_info.version)) == 0) { + ESP_LOGW(TAG, "Current running version is the same as a new. We will not continue the update."); + task_fatal_error(); + } + + err = esp_ota_begin(update_partition, OTA_WITH_SEQUENTIAL_WRITES, &update_handle); + if (err != ESP_OK) { + ESP_LOGE(TAG, "esp_ota_begin failed (%s)", esp_err_to_name(err)); + task_fatal_error(); + } + ESP_LOGI(TAG, "esp_ota_begin succeeded"); + } else { + ESP_LOGE(TAG, "received package is not fit len"); + task_fatal_error(); + } + + err = esp_ota_write( update_handle, buf, len); + if (err != ESP_OK) { + ESP_LOGE(TAG, "esp_ota_write failed (%s)", esp_err_to_name(err)); + task_fatal_error(); + } + ESP_LOGI(TAG, "Total Write binary data length: %d", len); + + err = esp_ota_end(update_handle); + if (err != ESP_OK) { + if (err == ESP_ERR_OTA_VALIDATE_FAILED) { + ESP_LOGE(TAG, "Image validation failed, image is corrupted"); + } + ESP_LOGE(TAG, "esp_ota_end failed (%s)!", esp_err_to_name(err)); + task_fatal_error(); + } + err = esp_ota_set_boot_partition(update_partition); + if (err != ESP_OK) { + ESP_LOGE(TAG, "esp_ota_set_boot_partition failed (%s)!", esp_err_to_name(err)); + task_fatal_error(); + } } From 2f95c94ad838f25ad96162435b8abab098484bde Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Tue, 8 Dec 2020 18:00:58 +0530 Subject: [PATCH 379/770] esp32s2 - update common_hal_mcu_reset --- ports/esp32s2/common-hal/microcontroller/__init__.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/microcontroller/__init__.c b/ports/esp32s2/common-hal/microcontroller/__init__.c index b7bea4e6b8126..e425cbf543b25 100644 --- a/ports/esp32s2/common-hal/microcontroller/__init__.c +++ b/ports/esp32s2/common-hal/microcontroller/__init__.c @@ -74,8 +74,7 @@ void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { void common_hal_mcu_reset(void) { filesystem_flush(); //TODO: implement as part of flash improvements - // NVIC_SystemReset(); - while(1); + esp_restart(); } // The singleton microcontroller.Processor object, bound to microcontroller.cpu From 2c546ab768e82accbf6c3ed9a7fe3ce8ddcb9456 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Tue, 8 Dec 2020 15:54:34 +0100 Subject: [PATCH 380/770] Remove warning about lack of support on M0 from rotaryio It seems that this warning no longer applies. --- shared-bindings/rotaryio/__init__.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/shared-bindings/rotaryio/__init__.c b/shared-bindings/rotaryio/__init__.c index fd8578753d38c..cd967baa42a42 100644 --- a/shared-bindings/rotaryio/__init__.c +++ b/shared-bindings/rotaryio/__init__.c @@ -39,8 +39,6 @@ //| `Wikipedia's Rotary Encoder page `_ for more //| background. //| -//| .. warning:: This module is not available in some SAMD21 (aka M0) builds. See the :ref:`module-support-matrix` for more info. -//| //| All classes change hardware state and should be deinitialized when they //| are no longer needed if the program continues after use. To do so, either //| call :py:meth:`!deinit` or use a context manager. See From 40118bcf57f026fd6a58733501c759a9ba87e835 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 2 Dec 2020 18:05:29 -0800 Subject: [PATCH 381/770] Add `board_deinit` for use with sleep This changes lots of files to unify `board.h` across ports. It adds `board_deinit` when CIRCUITPY_ALARM is set. `main.c` uses it to deinit the board before deep sleeping (even when pretending.) Deep sleep is now a two step process for the port. First, the port should prepare to deep sleep based on the given alarms. It should set alarms for both deep and pretend sleep. In particular, the pretend versions should be set immediately so that we don't miss an alarm as we shutdown. These alarms should also wake from `port_idle_until_interrupt` which is used when pretending to deep sleep. Second, when real deep sleeping, `alarm_enter_deep_sleep` is called. The port should set any alarms it didn't during prepare based on data it saved internally during prepare. ESP32-S2 sleep is a bit reorganized to locate more logic with TimeAlarm. This will help it scale to more alarm types. Fixes #3786 --- Makefile | 2 +- locale/circuitpython.pot | 19 ++- main.c | 76 +++++++-- .../atmel-samd/boards/8086_commander/board.c | 2 +- .../boards/aloriumtech_evo_m51/board.c | 2 +- .../atmel-samd/boards/arduino_mkr1300/board.c | 2 +- .../atmel-samd/boards/arduino_mkrzero/board.c | 2 +- .../boards/arduino_nano_33_iot/board.c | 2 +- ports/atmel-samd/boards/arduino_zero/board.c | 2 +- .../boards/bast_pro_mini_m0/board.c | 2 +- .../boards/bdmicro_vina_d21/board.c | 2 +- .../boards/bdmicro_vina_d51/board.c | 2 +- ports/atmel-samd/boards/blm_badge/board.c | 4 +- ports/atmel-samd/boards/board.h | 47 ------ .../boards/capablerobot_usbhub/board.c | 2 +- .../atmel-samd/boards/catwan_usbstick/board.c | 2 +- .../boards/circuitbrains_basic_m0/board.c | 2 +- .../boards/circuitbrains_deluxe_m4/board.c | 2 +- .../boards/circuitplayground_express/board.c | 4 +- .../circuitplayground_express_crickit/board.c | 4 +- .../board.c | 4 +- ports/atmel-samd/boards/cp32-m4/board.c | 2 +- ports/atmel-samd/boards/cp_sapling_m0/board.c | 2 +- .../boards/cp_sapling_m0_spiflash/board.c | 2 +- .../atmel-samd/boards/datalore_ip_m4/board.c | 2 +- .../atmel-samd/boards/datum_distance/board.c | 2 +- ports/atmel-samd/boards/datum_imu/board.c | 2 +- ports/atmel-samd/boards/datum_light/board.c | 2 +- ports/atmel-samd/boards/datum_weather/board.c | 2 +- .../boards/dynossat_edu_eps/board.c | 2 +- .../boards/dynossat_edu_obc/board.c | 2 +- .../boards/escornabot_makech/board.c | 2 +- .../boards/feather_m0_adalogger/board.c | 2 +- .../boards/feather_m0_basic/board.c | 2 +- .../boards/feather_m0_express/board.c | 2 +- .../boards/feather_m0_express_crickit/board.c | 2 +- .../boards/feather_m0_rfm69/board.c | 2 +- .../boards/feather_m0_rfm9x/board.c | 2 +- .../boards/feather_m0_supersized/board.c | 2 +- .../atmel-samd/boards/feather_m4_can/board.c | 2 +- .../boards/feather_m4_express/board.c | 2 +- .../boards/feather_radiofruit_zigbee/board.c | 2 +- ports/atmel-samd/boards/fluff_m0/board.c | 2 +- ports/atmel-samd/boards/gemma_m0/board.c | 2 +- .../boards/grandcentral_m4_express/board.c | 2 +- .../boards/hallowing_m0_express/board.c | 2 +- .../boards/hallowing_m0_express/pins.c | 2 +- .../boards/hallowing_m4_express/board.c | 2 +- .../boards/itsybitsy_m0_express/board.c | 2 +- .../boards/itsybitsy_m4_express/board.c | 2 +- .../atmel-samd/boards/kicksat-sprite/board.c | 2 +- ports/atmel-samd/boards/kicksat-sprite/pins.c | 2 +- .../boards/loc_ber_m4_base_board/board.c | 2 +- .../atmel-samd/boards/matrixportal_m4/board.c | 2 +- ports/atmel-samd/boards/meowmeow/board.c | 2 +- .../boards/metro_m0_express/board.c | 2 +- .../boards/metro_m4_airlift_lite/board.c | 2 +- .../boards/metro_m4_express/board.c | 2 +- ports/atmel-samd/boards/mini_sam_m4/board.c | 2 +- ports/atmel-samd/boards/monster_m4sk/board.c | 2 +- ports/atmel-samd/boards/monster_m4sk/pins.c | 2 +- .../atmel-samd/boards/ndgarage_ndbit6/board.c | 2 +- .../boards/ndgarage_ndbit6_v2/board.c | 2 +- ports/atmel-samd/boards/nfc_copy_cat/board.c | 2 +- ports/atmel-samd/boards/openbook_m4/board.c | 2 +- ports/atmel-samd/boards/openbook_m4/pins.c | 2 +- ports/atmel-samd/boards/pewpew10/board.c | 2 +- ports/atmel-samd/boards/pewpew_m4/board.c | 2 +- ports/atmel-samd/boards/picoplanet/board.c | 2 +- ports/atmel-samd/boards/pirkey_m0/board.c | 2 +- ports/atmel-samd/boards/pybadge/board.c | 4 +- ports/atmel-samd/boards/pybadge/pins.c | 2 +- .../atmel-samd/boards/pybadge_airlift/board.c | 4 +- .../atmel-samd/boards/pybadge_airlift/pins.c | 2 +- ports/atmel-samd/boards/pycubed/board.c | 2 +- ports/atmel-samd/boards/pycubed/pins.c | 2 +- ports/atmel-samd/boards/pycubed_mram/board.c | 2 +- ports/atmel-samd/boards/pycubed_mram/pins.c | 2 +- ports/atmel-samd/boards/pygamer/board.c | 4 +- ports/atmel-samd/boards/pygamer/pins.c | 2 +- .../atmel-samd/boards/pygamer_advance/board.c | 4 +- .../atmel-samd/boards/pygamer_advance/pins.c | 2 +- ports/atmel-samd/boards/pyportal/board.c | 2 +- ports/atmel-samd/boards/pyportal/pins.c | 2 +- .../atmel-samd/boards/pyportal_titano/board.c | 2 +- .../atmel-samd/boards/pyportal_titano/pins.c | 2 +- ports/atmel-samd/boards/pyruler/board.c | 2 +- ports/atmel-samd/boards/qtpy_m0/board.c | 2 +- .../boards/qtpy_m0_haxpress/board.c | 2 +- ports/atmel-samd/boards/robohatmm1_m4/board.c | 2 +- ports/atmel-samd/boards/sam32/board.c | 2 +- .../atmel-samd/boards/same54_xplained/board.c | 2 +- .../boards/seeeduino_wio_terminal/board.c | 2 +- .../atmel-samd/boards/seeeduino_xiao/board.c | 2 +- ports/atmel-samd/boards/serpente/board.c | 2 +- ports/atmel-samd/boards/shirtty/board.c | 2 +- ports/atmel-samd/boards/snekboard/board.c | 2 +- .../boards/sparkfun_lumidrive/board.c | 2 +- .../sparkfun_qwiic_micro_no_flash/board.c | 2 +- .../sparkfun_qwiic_micro_with_flash/board.c | 2 +- .../boards/sparkfun_redboard_turbo/board.c | 2 +- .../boards/sparkfun_samd21_dev/board.c | 2 +- .../boards/sparkfun_samd21_mini/board.c | 2 +- .../boards/sparkfun_samd51_thing_plus/board.c | 2 +- .../boards/stringcar_m0_express/board.c | 2 +- .../boards/trellis_m4_express/board.c | 2 +- ports/atmel-samd/boards/trinket_m0/board.c | 2 +- .../boards/trinket_m0_haxpress/board.c | 2 +- ports/atmel-samd/boards/uartlogger2/board.c | 2 +- ports/atmel-samd/boards/uchip/board.c | 2 +- ports/atmel-samd/boards/ugame10/board.c | 2 +- .../winterbloom_big_honking_button/board.c | 2 +- .../atmel-samd/boards/winterbloom_sol/board.c | 2 +- ports/atmel-samd/boards/xinabox_cc03/board.c | 2 +- ports/atmel-samd/boards/xinabox_cs11/board.c | 2 +- ports/atmel-samd/common-hal/busio/SPI.c | 2 +- ports/atmel-samd/common-hal/sdioio/SDCard.c | 1 - ports/atmel-samd/supervisor/port.c | 4 +- ports/cxd56/boards/board.h | 45 ------ ports/cxd56/boards/spresense/board.c | 2 +- ports/cxd56/supervisor/port.c | 4 +- .../adafruit_magtag_2.9_grayscale/board.c | 22 ++- .../boards/adafruit_metro_esp32s2/board.c | 5 +- .../boards/electroniccats_bastwifi/board.c | 5 +- .../esp32s2/boards/espressif_kaluga_1/board.c | 5 +- .../boards/espressif_saola_1_wroom/board.c | 5 +- .../boards/espressif_saola_1_wrover/board.c | 5 +- .../esp32s2/boards/microdev_micro_s2/board.c | 5 +- .../boards/muselab_nanoesp32_s2/board.c | 5 +- .../boards/targett_module_clip_wroom/board.c | 5 +- .../boards/targett_module_clip_wrover/board.c | 5 +- .../boards/unexpectedmaker_feathers2/board.c | 5 +- .../board.c | 5 +- ports/esp32s2/common-hal/alarm/__init__.c | 146 ++++++------------ .../esp32s2/common-hal/alarm/time/TimeAlarm.c | 64 ++++++++ .../esp32s2/common-hal/alarm/time/TimeAlarm.h | 7 + ports/esp32s2/common-hal/busio/SPI.c | 1 - ports/esp32s2/supervisor/port.c | 24 +-- ports/litex/boards/board.h | 45 ------ ports/litex/boards/fomu/board.c | 3 +- ports/litex/supervisor/port.c | 4 +- ports/mimxrt10xx/board.h | 1 + .../mimxrt10xx/boards/feather_m7_1011/board.c | 3 +- .../boards/feather_m7_1011/flash_config.c | 4 +- .../mimxrt10xx/boards/feather_m7_1011/pins.c | 2 +- .../boards/feather_mimxrt1011/board.c | 3 +- .../boards/feather_mimxrt1011/flash_config.c | 4 +- .../boards/feather_mimxrt1011/pins.c | 2 +- .../boards/feather_mimxrt1062/board.c | 3 +- .../boards/feather_mimxrt1062/flash_config.c | 3 +- .../boards/feather_mimxrt1062/pins.c | 2 +- .../boards/{board.h => flash_config.h} | 20 +-- ports/mimxrt10xx/boards/imxrt1010_evk/board.c | 3 +- .../boards/imxrt1010_evk/flash_config.c | 3 +- ports/mimxrt10xx/boards/imxrt1010_evk/pins.c | 2 +- ports/mimxrt10xx/boards/imxrt1020_evk/board.c | 3 +- .../boards/imxrt1020_evk/flash_config.c | 3 +- ports/mimxrt10xx/boards/imxrt1020_evk/pins.c | 2 +- ports/mimxrt10xx/boards/imxrt1060_evk/board.c | 3 +- .../boards/imxrt1060_evk/flash_config.c | 3 +- ports/mimxrt10xx/boards/imxrt1060_evk/pins.c | 2 +- ports/mimxrt10xx/boards/metro_m7_1011/board.c | 3 +- .../boards/metro_m7_1011/flash_config.c | 3 +- ports/mimxrt10xx/boards/metro_m7_1011/pins.c | 2 +- ports/mimxrt10xx/boards/teensy40/board.c | 3 +- .../mimxrt10xx/boards/teensy40/flash_config.c | 3 +- ports/mimxrt10xx/boards/teensy40/pins.c | 2 +- ports/mimxrt10xx/boards/teensy41/board.c | 3 +- .../mimxrt10xx/boards/teensy41/flash_config.c | 3 +- ports/mimxrt10xx/boards/teensy41/pins.c | 2 +- .../supervisor/flexspi_nor_flash_ops.c | 2 +- ports/mimxrt10xx/supervisor/internal_flash.c | 2 +- ports/mimxrt10xx/supervisor/port.c | 4 +- ports/nrf/boards/ADM_B_NRF52840_1/board.c | 2 +- ports/nrf/boards/TG-Watch02A/board.c | 2 +- ports/nrf/boards/aramcon_badge_2019/board.c | 2 +- ports/nrf/boards/arduino_nano_33_ble/board.c | 2 +- .../bless_dev_board_multi_sensor/board.c | 2 +- ports/nrf/boards/board.h | 45 ------ .../circuitplayground_bluefruit/board.c | 4 +- .../nrf/boards/clue_nrf52840_express/board.c | 2 +- ports/nrf/boards/clue_nrf52840_express/pins.c | 2 +- ports/nrf/boards/electronut_labs_blip/board.c | 2 +- .../nrf/boards/electronut_labs_papyr/board.c | 2 +- .../boards/feather_bluefruit_sense/board.c | 2 +- .../boards/feather_nrf52840_express/board.c | 2 +- ports/nrf/boards/hiibot_bluefi/board.c | 2 +- ports/nrf/boards/hiibot_bluefi/pins.c | 2 +- ports/nrf/boards/ikigaisense_vita/board.c | 2 +- .../boards/itsybitsy_nrf52840_express/board.c | 2 +- .../boards/makerdiary_m60_keyboard/board.c | 2 +- .../nrf/boards/makerdiary_m60_keyboard/pins.c | 2 +- .../makerdiary_nrf52840_m2_devkit/board.c | 2 +- .../makerdiary_nrf52840_m2_devkit/pins.c | 2 +- .../boards/makerdiary_nrf52840_mdk/board.c | 2 +- .../board.c | 2 +- .../nrf/boards/metro_nrf52840_express/board.c | 2 +- ports/nrf/boards/nice_nano/board.c | 2 +- ports/nrf/boards/ohs2020_badge/board.c | 2 +- ports/nrf/boards/particle_argon/board.c | 2 +- ports/nrf/boards/particle_boron/board.c | 2 +- ports/nrf/boards/particle_xenon/board.c | 2 +- ports/nrf/boards/pca10056/board.c | 2 +- ports/nrf/boards/pca10059/board.c | 2 +- ports/nrf/boards/pca10100/board.c | 2 +- ports/nrf/boards/pitaya_go/board.c | 2 +- ports/nrf/boards/raytac_mdbt50q-db-40/board.c | 2 +- ports/nrf/boards/simmel/board.c | 2 +- .../nrf/boards/sparkfun_nrf52840_mini/board.c | 2 +- ports/nrf/boards/teknikio_bluebird/board.c | 2 +- .../tinkeringtech_scoutmakes_azul/board.c | 2 +- ports/nrf/supervisor/port.c | 4 +- ports/stm/boards/board.h | 45 ------ ports/stm/boards/espruino_pico/board.c | 2 +- ports/stm/boards/espruino_wifi/board.c | 2 +- .../boards/feather_stm32f405_express/board.c | 2 +- ports/stm/boards/meowbit_v121/board.c | 2 +- ports/stm/boards/nucleo_f746zg/board.c | 2 +- ports/stm/boards/nucleo_f767zi/board.c | 2 +- ports/stm/boards/nucleo_h743zi_2/board.c | 2 +- ports/stm/boards/openmv_h7/board.c | 2 +- ports/stm/boards/pyb_nano_v2/board.c | 2 +- ports/stm/boards/pyboard_v11/board.c | 2 +- .../stm/boards/stm32f411ce_blackpill/board.c | 2 +- .../stm/boards/stm32f411ve_discovery/board.c | 2 +- .../stm/boards/stm32f412zg_discovery/board.c | 2 +- ports/stm/boards/stm32f4_discovery/board.c | 2 +- ports/stm/boards/stm32f746g_discovery/board.c | 2 +- ports/stm/boards/thunderpack_v11/board.c | 2 +- ports/stm/boards/thunderpack_v12/board.c | 2 +- ports/stm/common-hal/busio/SPI.c | 2 +- ports/stm/common-hal/sdioio/SDCard.c | 2 +- ports/stm/supervisor/port.c | 4 +- py/circuitpy_mpconfig.h | 6 + shared-bindings/alarm/__init__.c | 44 ++---- shared-bindings/alarm/__init__.h | 17 +- {ports/esp32s2/boards => supervisor}/board.h | 22 ++- supervisor/port.h | 9 +- supervisor/shared/board.c | 19 ++- supervisor/shared/board.h | 14 +- supervisor/shared/tick.c | 4 +- 241 files changed, 588 insertions(+), 673 deletions(-) delete mode 100644 ports/atmel-samd/boards/board.h delete mode 100644 ports/cxd56/boards/board.h delete mode 100644 ports/litex/boards/board.h create mode 100644 ports/mimxrt10xx/board.h rename ports/mimxrt10xx/boards/{board.h => flash_config.h} (75%) delete mode 100644 ports/nrf/boards/board.h delete mode 100644 ports/stm/boards/board.h rename {ports/esp32s2/boards => supervisor}/board.h (77%) diff --git a/Makefile b/Makefile index e553b85e8b453..a1807c308fa4d 100644 --- a/Makefile +++ b/Makefile @@ -265,7 +265,7 @@ update-frozen-libraries: @echo "Updating all frozen libraries to latest tagged version." cd frozen; for library in *; do cd $$library; ../../tools/git-checkout-latest-tag.sh; cd ..; done -one-of-each: samd21 samd51 esp32s2 litex mimxrt10xx nrf stm +one-of-each: samd21 litex mimxrt10xx nrf stm samd21: $(MAKE) -C ports/atmel-samd BOARD=trinket_m0 diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index b136e9dd26f02..11ca8c8140a33 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-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -498,8 +498,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "" @@ -1296,7 +1296,7 @@ msgstr "" msgid "No DMA channel found" msgstr "" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1503,6 +1503,7 @@ msgstr "" msgid "Pin does not have ADC capabilities" msgstr "" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -1555,7 +1556,11 @@ msgid "Prefix buffer must be on the heap" msgstr "" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -2026,6 +2031,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "" diff --git a/main.c b/main.c index 48c89d8adc047..9eb4787299331 100755 --- a/main.c +++ b/main.c @@ -46,6 +46,7 @@ #include "background.h" #include "mpconfigboard.h" #include "supervisor/background_callback.h" +#include "supervisor/board.h" #include "supervisor/cpu.h" #include "supervisor/filesystem.h" #include "supervisor/memory.h" @@ -64,8 +65,6 @@ #include "shared-bindings/microcontroller/Processor.h" #include "shared-bindings/supervisor/Runtime.h" -#include "boards/board.h" - #if CIRCUITPY_ALARM #include "shared-bindings/alarm/__init__.h" #endif @@ -303,13 +302,6 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { if (result.return_code & PYEXEC_FORCED_EXIT) { return reload_requested; } - - #if CIRCUITPY_ALARM - if (result.return_code & PYEXEC_DEEP_SLEEP) { - common_hal_alarm_enter_deep_sleep(); - // Does not return. - } - #endif } // Program has finished running. @@ -326,24 +318,47 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { rgb_status_animation_t animation; prep_rgb_status_animation(&result, found_main, safe_mode, &animation); + bool asleep = false; while (true) { - RUN_BACKGROUND_TASKS; if (reload_requested) { + #if CIRCUITPY_ALARM + if (asleep) { + board_init(); + } + #endif supervisor_set_run_reason(RUN_REASON_AUTO_RELOAD); reload_requested = false; return true; } if (serial_connected() && serial_bytes_available()) { + #if CIRCUITPY_ALARM + if (asleep) { + board_init(); + } + #endif // Skip REPL if reload was requested. bool ctrl_d = serial_read() == CHAR_CTRL_D; if (ctrl_d) { supervisor_set_run_reason(RUN_REASON_REPL_RELOAD); } - return (ctrl_d); + return ctrl_d; } + // Check for a deep sleep alarm and restart the VM. This can happen if + // an alarm alerts faster than our USB delay or if we pretended to deep + // sleep. + #if CIRCUITPY_ALARM + if (asleep && alarm_woken_from_sleep()) { + serial_write_compressed(translate("Woken up by alarm.\n")); + board_init(); + supervisor_set_run_reason(RUN_REASON_STARTUP); + // TODO: Reset any volatile memory the user may have access to. + return true; + } + #endif + if (!serial_connected_before_animation && serial_connected()) { if (!serial_connected_at_start) { print_code_py_status_message(safe_mode); @@ -351,7 +366,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { print_safe_mode_message(safe_mode); serial_write("\n"); - serial_write_compressed(translate("Press any key to enter the REPL. Use CTRL-D to reload.")); + serial_write_compressed(translate("Press any key to enter the REPL. Use CTRL-D to reload.\n")); } if (serial_connected_before_animation && !serial_connected()) { serial_connected_at_start = false; @@ -360,12 +375,47 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { // Refresh the ePaper display if we have one. That way it'll show an error message. #if CIRCUITPY_DISPLAYIO + // Don't refresh the display if we're about to deep sleep. + #if CIRCUITPY_ALARM + refreshed_epaper_display = refreshed_epaper_display || result.return_code & PYEXEC_DEEP_SLEEP; + #endif if (!refreshed_epaper_display) { refreshed_epaper_display = maybe_refresh_epaperdisplay(); } #endif - tick_rgb_status_animation(&animation); + // Sleep until our next interrupt. + #if CIRCUITPY_ALARM + if (result.return_code & PYEXEC_DEEP_SLEEP) { + // Make sure we have been awake long enough for USB to connect (enumeration delay). + int64_t connecting_delay_ticks = CIRCUITPY_USB_CONNECTED_SLEEP_DELAY * 1024 - port_get_raw_ticks(NULL); + if (connecting_delay_ticks > 0) { + // Set when we've waited long enough so that we wake up from the + // sleep_until_interrupt below and loop around to the real deep + // sleep in the else clause. + port_interrupt_after_ticks(connecting_delay_ticks); + // Deep sleep if we're not connected to a host. + } else if (!asleep) { + asleep = true; + new_status_color(BLACK); + board_deinit(); + if (!supervisor_workflow_active()) { + // Enter true deep sleep. When we wake up we'll be back at the + // top of main(), not in this loop. + alarm_enter_deep_sleep(); + // Does not return. + } else { + serial_write_compressed(translate("Pretending to deep sleep until alarm, any key or file write.\n")); + } + } + } + #endif + + if (!asleep) { + tick_rgb_status_animation(&animation); + } else { + port_idle_until_interrupt(); + } } } diff --git a/ports/atmel-samd/boards/8086_commander/board.c b/ports/atmel-samd/boards/8086_commander/board.c index d7e856d611991..84960e73cf2cd 100644 --- a/ports/atmel-samd/boards/8086_commander/board.c +++ b/ports/atmel-samd/boards/8086_commander/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/atmel-samd/boards/aloriumtech_evo_m51/board.c b/ports/atmel-samd/boards/aloriumtech_evo_m51/board.c index 1e9ab029e21f7..5973eeec1b4b3 100644 --- a/ports/atmel-samd/boards/aloriumtech_evo_m51/board.c +++ b/ports/atmel-samd/boards/aloriumtech_evo_m51/board.c @@ -28,7 +28,7 @@ // Author: Bryan Craker // Date: 2020-05-20 -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/arduino_mkr1300/board.c b/ports/atmel-samd/boards/arduino_mkr1300/board.c index 770bc825938cd..112b173eccb51 100644 --- a/ports/atmel-samd/boards/arduino_mkr1300/board.c +++ b/ports/atmel-samd/boards/arduino_mkr1300/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/arduino_mkrzero/board.c b/ports/atmel-samd/boards/arduino_mkrzero/board.c index 0f60736a24006..7af05ba45a53e 100644 --- a/ports/atmel-samd/boards/arduino_mkrzero/board.c +++ b/ports/atmel-samd/boards/arduino_mkrzero/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/arduino_nano_33_iot/board.c b/ports/atmel-samd/boards/arduino_nano_33_iot/board.c index 770bc825938cd..112b173eccb51 100644 --- a/ports/atmel-samd/boards/arduino_nano_33_iot/board.c +++ b/ports/atmel-samd/boards/arduino_nano_33_iot/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/arduino_zero/board.c b/ports/atmel-samd/boards/arduino_zero/board.c index 770bc825938cd..112b173eccb51 100644 --- a/ports/atmel-samd/boards/arduino_zero/board.c +++ b/ports/atmel-samd/boards/arduino_zero/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/bast_pro_mini_m0/board.c b/ports/atmel-samd/boards/bast_pro_mini_m0/board.c index c8e20206a19fa..6baa43ffaa3cb 100644 --- a/ports/atmel-samd/boards/bast_pro_mini_m0/board.c +++ b/ports/atmel-samd/boards/bast_pro_mini_m0/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/bdmicro_vina_d21/board.c b/ports/atmel-samd/boards/bdmicro_vina_d21/board.c index bd63baa6fd558..bb1c5335c18af 100644 --- a/ports/atmel-samd/boards/bdmicro_vina_d21/board.c +++ b/ports/atmel-samd/boards/bdmicro_vina_d21/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) diff --git a/ports/atmel-samd/boards/bdmicro_vina_d51/board.c b/ports/atmel-samd/boards/bdmicro_vina_d51/board.c index bd63baa6fd558..bb1c5335c18af 100644 --- a/ports/atmel-samd/boards/bdmicro_vina_d51/board.c +++ b/ports/atmel-samd/boards/bdmicro_vina_d51/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) diff --git a/ports/atmel-samd/boards/blm_badge/board.c b/ports/atmel-samd/boards/blm_badge/board.c index ee353c810899d..e374899a66158 100644 --- a/ports/atmel-samd/boards/blm_badge/board.c +++ b/ports/atmel-samd/boards/blm_badge/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "supervisor/shared/board.h" void board_init(void) { @@ -35,5 +35,5 @@ bool board_requests_safe_mode(void) { } void reset_board(void) { - board_reset_user_neopixels(); + board_reset_user_neopixels(&pin_PA05, 10); } diff --git a/ports/atmel-samd/boards/board.h b/ports/atmel-samd/boards/board.h deleted file mode 100644 index 4f0ae9d728e72..0000000000000 --- a/ports/atmel-samd/boards/board.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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. - */ - -// This file defines board specific functions. - -#ifndef MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H -#define MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H - -#include - -#include "py/mpconfig.h" - -// Initializes board related state once on start up. -void board_init(void); - -// Returns true if the user initiates safe mode in a board specific way. -// Also add BOARD_USER_SAFE_MODE in mpconfigboard.h to explain the board specific -// way. -bool board_requests_safe_mode(void); - -// Reset the state of off MCU components such as neopixels. -void reset_board(void); - -#endif // MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H diff --git a/ports/atmel-samd/boards/capablerobot_usbhub/board.c b/ports/atmel-samd/boards/capablerobot_usbhub/board.c index 46385f094fa5e..d65582379e786 100644 --- a/ports/atmel-samd/boards/capablerobot_usbhub/board.c +++ b/ports/atmel-samd/boards/capablerobot_usbhub/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/atmel-samd/boards/catwan_usbstick/board.c b/ports/atmel-samd/boards/catwan_usbstick/board.c index c8e20206a19fa..6baa43ffaa3cb 100644 --- a/ports/atmel-samd/boards/catwan_usbstick/board.c +++ b/ports/atmel-samd/boards/catwan_usbstick/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/circuitbrains_basic_m0/board.c b/ports/atmel-samd/boards/circuitbrains_basic_m0/board.c index efafd152dbf6d..59d573ce9fba6 100755 --- a/ports/atmel-samd/boards/circuitbrains_basic_m0/board.c +++ b/ports/atmel-samd/boards/circuitbrains_basic_m0/board.c @@ -25,7 +25,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/circuitbrains_deluxe_m4/board.c b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/board.c index efafd152dbf6d..59d573ce9fba6 100755 --- a/ports/atmel-samd/boards/circuitbrains_deluxe_m4/board.c +++ b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/board.c @@ -25,7 +25,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/circuitplayground_express/board.c b/ports/atmel-samd/boards/circuitplayground_express/board.c index 85c37ee622920..f771c214b3275 100644 --- a/ports/atmel-samd/boards/circuitplayground_express/board.c +++ b/ports/atmel-samd/boards/circuitplayground_express/board.c @@ -26,7 +26,7 @@ #include -#include "boards/board.h" +#include "supervisor/board.h" #include "common-hal/microcontroller/Pin.h" #include "supervisor/shared/board.h" #include "hal/include/hal_gpio.h" @@ -53,5 +53,5 @@ bool board_requests_safe_mode(void) { } void reset_board(void) { - board_reset_user_neopixels(); + board_reset_user_neopixels(&pin_PB23, 10); } diff --git a/ports/atmel-samd/boards/circuitplayground_express_crickit/board.c b/ports/atmel-samd/boards/circuitplayground_express_crickit/board.c index 21217caac9574..13fed598eb397 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_crickit/board.c +++ b/ports/atmel-samd/boards/circuitplayground_express_crickit/board.c @@ -26,7 +26,7 @@ #include -#include "boards/board.h" +#include "supervisor/board.h" #include "common-hal/microcontroller/Pin.h" #include "hal/include/hal_gpio.h" #include "supervisor/shared/board.h" @@ -53,5 +53,5 @@ bool board_requests_safe_mode(void) { } void reset_board(void) { - board_reset_user_neopixels(); + board_reset_user_neopixels(&pin_PB23, 10); } diff --git a/ports/atmel-samd/boards/circuitplayground_express_displayio/board.c b/ports/atmel-samd/boards/circuitplayground_express_displayio/board.c index 21217caac9574..13fed598eb397 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_displayio/board.c +++ b/ports/atmel-samd/boards/circuitplayground_express_displayio/board.c @@ -26,7 +26,7 @@ #include -#include "boards/board.h" +#include "supervisor/board.h" #include "common-hal/microcontroller/Pin.h" #include "hal/include/hal_gpio.h" #include "supervisor/shared/board.h" @@ -53,5 +53,5 @@ bool board_requests_safe_mode(void) { } void reset_board(void) { - board_reset_user_neopixels(); + board_reset_user_neopixels(&pin_PB23, 10); } diff --git a/ports/atmel-samd/boards/cp32-m4/board.c b/ports/atmel-samd/boards/cp32-m4/board.c index 0f60736a24006..7af05ba45a53e 100644 --- a/ports/atmel-samd/boards/cp32-m4/board.c +++ b/ports/atmel-samd/boards/cp32-m4/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/cp_sapling_m0/board.c b/ports/atmel-samd/boards/cp_sapling_m0/board.c index ce563667622f6..cde441b3d9fab 100644 --- a/ports/atmel-samd/boards/cp_sapling_m0/board.c +++ b/ports/atmel-samd/boards/cp_sapling_m0/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "common-hal/microcontroller/Pin.h" #include "supervisor/shared/board.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/cp_sapling_m0_spiflash/board.c b/ports/atmel-samd/boards/cp_sapling_m0_spiflash/board.c index ce563667622f6..cde441b3d9fab 100644 --- a/ports/atmel-samd/boards/cp_sapling_m0_spiflash/board.c +++ b/ports/atmel-samd/boards/cp_sapling_m0_spiflash/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "common-hal/microcontroller/Pin.h" #include "supervisor/shared/board.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/datalore_ip_m4/board.c b/ports/atmel-samd/boards/datalore_ip_m4/board.c index 0f60736a24006..7af05ba45a53e 100644 --- a/ports/atmel-samd/boards/datalore_ip_m4/board.c +++ b/ports/atmel-samd/boards/datalore_ip_m4/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/datum_distance/board.c b/ports/atmel-samd/boards/datum_distance/board.c index c8e20206a19fa..6baa43ffaa3cb 100644 --- a/ports/atmel-samd/boards/datum_distance/board.c +++ b/ports/atmel-samd/boards/datum_distance/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/datum_imu/board.c b/ports/atmel-samd/boards/datum_imu/board.c index c8e20206a19fa..6baa43ffaa3cb 100644 --- a/ports/atmel-samd/boards/datum_imu/board.c +++ b/ports/atmel-samd/boards/datum_imu/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/datum_light/board.c b/ports/atmel-samd/boards/datum_light/board.c index c8e20206a19fa..6baa43ffaa3cb 100644 --- a/ports/atmel-samd/boards/datum_light/board.c +++ b/ports/atmel-samd/boards/datum_light/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/datum_weather/board.c b/ports/atmel-samd/boards/datum_weather/board.c index c8e20206a19fa..6baa43ffaa3cb 100644 --- a/ports/atmel-samd/boards/datum_weather/board.c +++ b/ports/atmel-samd/boards/datum_weather/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/dynossat_edu_eps/board.c b/ports/atmel-samd/boards/dynossat_edu_eps/board.c index c8e20206a19fa..6baa43ffaa3cb 100644 --- a/ports/atmel-samd/boards/dynossat_edu_eps/board.c +++ b/ports/atmel-samd/boards/dynossat_edu_eps/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/dynossat_edu_obc/board.c b/ports/atmel-samd/boards/dynossat_edu_obc/board.c index c8e20206a19fa..6baa43ffaa3cb 100644 --- a/ports/atmel-samd/boards/dynossat_edu_obc/board.c +++ b/ports/atmel-samd/boards/dynossat_edu_obc/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/escornabot_makech/board.c b/ports/atmel-samd/boards/escornabot_makech/board.c index 881e15e0c5ecc..5afe2fb655086 100644 --- a/ports/atmel-samd/boards/escornabot_makech/board.c +++ b/ports/atmel-samd/boards/escornabot_makech/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/feather_m0_adalogger/board.c b/ports/atmel-samd/boards/feather_m0_adalogger/board.c index c8e20206a19fa..6baa43ffaa3cb 100644 --- a/ports/atmel-samd/boards/feather_m0_adalogger/board.c +++ b/ports/atmel-samd/boards/feather_m0_adalogger/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/feather_m0_basic/board.c b/ports/atmel-samd/boards/feather_m0_basic/board.c index c8e20206a19fa..6baa43ffaa3cb 100644 --- a/ports/atmel-samd/boards/feather_m0_basic/board.c +++ b/ports/atmel-samd/boards/feather_m0_basic/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/feather_m0_express/board.c b/ports/atmel-samd/boards/feather_m0_express/board.c index c8e20206a19fa..6baa43ffaa3cb 100644 --- a/ports/atmel-samd/boards/feather_m0_express/board.c +++ b/ports/atmel-samd/boards/feather_m0_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/feather_m0_express_crickit/board.c b/ports/atmel-samd/boards/feather_m0_express_crickit/board.c index c8e20206a19fa..6baa43ffaa3cb 100644 --- a/ports/atmel-samd/boards/feather_m0_express_crickit/board.c +++ b/ports/atmel-samd/boards/feather_m0_express_crickit/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/feather_m0_rfm69/board.c b/ports/atmel-samd/boards/feather_m0_rfm69/board.c index c8e20206a19fa..6baa43ffaa3cb 100644 --- a/ports/atmel-samd/boards/feather_m0_rfm69/board.c +++ b/ports/atmel-samd/boards/feather_m0_rfm69/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/feather_m0_rfm9x/board.c b/ports/atmel-samd/boards/feather_m0_rfm9x/board.c index c8e20206a19fa..6baa43ffaa3cb 100644 --- a/ports/atmel-samd/boards/feather_m0_rfm9x/board.c +++ b/ports/atmel-samd/boards/feather_m0_rfm9x/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/feather_m0_supersized/board.c b/ports/atmel-samd/boards/feather_m0_supersized/board.c index c8e20206a19fa..6baa43ffaa3cb 100644 --- a/ports/atmel-samd/boards/feather_m0_supersized/board.c +++ b/ports/atmel-samd/boards/feather_m0_supersized/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/feather_m4_can/board.c b/ports/atmel-samd/boards/feather_m4_can/board.c index 8096b9b8ea6d8..5fca974e9edae 100644 --- a/ports/atmel-samd/boards/feather_m4_can/board.c +++ b/ports/atmel-samd/boards/feather_m4_can/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/feather_m4_express/board.c b/ports/atmel-samd/boards/feather_m4_express/board.c index 8096b9b8ea6d8..5fca974e9edae 100644 --- a/ports/atmel-samd/boards/feather_m4_express/board.c +++ b/ports/atmel-samd/boards/feather_m4_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/feather_radiofruit_zigbee/board.c b/ports/atmel-samd/boards/feather_radiofruit_zigbee/board.c index c8e20206a19fa..6baa43ffaa3cb 100755 --- a/ports/atmel-samd/boards/feather_radiofruit_zigbee/board.c +++ b/ports/atmel-samd/boards/feather_radiofruit_zigbee/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/fluff_m0/board.c b/ports/atmel-samd/boards/fluff_m0/board.c index c8e20206a19fa..6baa43ffaa3cb 100644 --- a/ports/atmel-samd/boards/fluff_m0/board.c +++ b/ports/atmel-samd/boards/fluff_m0/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/gemma_m0/board.c b/ports/atmel-samd/boards/gemma_m0/board.c index c8e20206a19fa..6baa43ffaa3cb 100644 --- a/ports/atmel-samd/boards/gemma_m0/board.c +++ b/ports/atmel-samd/boards/gemma_m0/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/grandcentral_m4_express/board.c b/ports/atmel-samd/boards/grandcentral_m4_express/board.c index 7599f02b8efee..5ed8c84049490 100644 --- a/ports/atmel-samd/boards/grandcentral_m4_express/board.c +++ b/ports/atmel-samd/boards/grandcentral_m4_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/hallowing_m0_express/board.c b/ports/atmel-samd/boards/hallowing_m0_express/board.c index 14a2bdb81694e..8b922d6bef7fd 100644 --- a/ports/atmel-samd/boards/hallowing_m0_express/board.c +++ b/ports/atmel-samd/boards/hallowing_m0_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-bindings/board/__init__.h" #include "shared-bindings/displayio/FourWire.h" diff --git a/ports/atmel-samd/boards/hallowing_m0_express/pins.c b/ports/atmel-samd/boards/hallowing_m0_express/pins.c index 3e670a676f2c9..5d1dda51acf0f 100644 --- a/ports/atmel-samd/boards/hallowing_m0_express/pins.c +++ b/ports/atmel-samd/boards/hallowing_m0_express/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { diff --git a/ports/atmel-samd/boards/hallowing_m4_express/board.c b/ports/atmel-samd/boards/hallowing_m4_express/board.c index 61e797d652650..f51d4282d3fbc 100644 --- a/ports/atmel-samd/boards/hallowing_m4_express/board.c +++ b/ports/atmel-samd/boards/hallowing_m4_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" #include "shared-bindings/busio/SPI.h" diff --git a/ports/atmel-samd/boards/itsybitsy_m0_express/board.c b/ports/atmel-samd/boards/itsybitsy_m0_express/board.c index d7e856d611991..84960e73cf2cd 100644 --- a/ports/atmel-samd/boards/itsybitsy_m0_express/board.c +++ b/ports/atmel-samd/boards/itsybitsy_m0_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/atmel-samd/boards/itsybitsy_m4_express/board.c b/ports/atmel-samd/boards/itsybitsy_m4_express/board.c index 0f60736a24006..7af05ba45a53e 100644 --- a/ports/atmel-samd/boards/itsybitsy_m4_express/board.c +++ b/ports/atmel-samd/boards/itsybitsy_m4_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/kicksat-sprite/board.c b/ports/atmel-samd/boards/kicksat-sprite/board.c index 75cdfbc824b46..d7f78e764aea1 100644 --- a/ports/atmel-samd/boards/kicksat-sprite/board.c +++ b/ports/atmel-samd/boards/kicksat-sprite/board.c @@ -27,7 +27,7 @@ #include -#include "boards/board.h" +#include "supervisor/board.h" #include "py/mpconfig.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/kicksat-sprite/pins.c b/ports/atmel-samd/boards/kicksat-sprite/pins.c index 87d894c589195..27ee90323121d 100644 --- a/ports/atmel-samd/boards/kicksat-sprite/pins.c +++ b/ports/atmel-samd/boards/kicksat-sprite/pins.c @@ -1,5 +1,5 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA05) }, diff --git a/ports/atmel-samd/boards/loc_ber_m4_base_board/board.c b/ports/atmel-samd/boards/loc_ber_m4_base_board/board.c index 0f60736a24006..7af05ba45a53e 100644 --- a/ports/atmel-samd/boards/loc_ber_m4_base_board/board.c +++ b/ports/atmel-samd/boards/loc_ber_m4_base_board/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/matrixportal_m4/board.c b/ports/atmel-samd/boards/matrixportal_m4/board.c index 2d4f30239105d..52ecd830258e4 100644 --- a/ports/atmel-samd/boards/matrixportal_m4/board.c +++ b/ports/atmel-samd/boards/matrixportal_m4/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/meowmeow/board.c b/ports/atmel-samd/boards/meowmeow/board.c index 881e15e0c5ecc..5afe2fb655086 100644 --- a/ports/atmel-samd/boards/meowmeow/board.c +++ b/ports/atmel-samd/boards/meowmeow/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/metro_m0_express/board.c b/ports/atmel-samd/boards/metro_m0_express/board.c index bd63baa6fd558..bb1c5335c18af 100644 --- a/ports/atmel-samd/boards/metro_m0_express/board.c +++ b/ports/atmel-samd/boards/metro_m0_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) diff --git a/ports/atmel-samd/boards/metro_m4_airlift_lite/board.c b/ports/atmel-samd/boards/metro_m4_airlift_lite/board.c index 0f60736a24006..7af05ba45a53e 100644 --- a/ports/atmel-samd/boards/metro_m4_airlift_lite/board.c +++ b/ports/atmel-samd/boards/metro_m4_airlift_lite/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/metro_m4_express/board.c b/ports/atmel-samd/boards/metro_m4_express/board.c index 0f60736a24006..7af05ba45a53e 100644 --- a/ports/atmel-samd/boards/metro_m4_express/board.c +++ b/ports/atmel-samd/boards/metro_m4_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/mini_sam_m4/board.c b/ports/atmel-samd/boards/mini_sam_m4/board.c index 0f60736a24006..7af05ba45a53e 100644 --- a/ports/atmel-samd/boards/mini_sam_m4/board.c +++ b/ports/atmel-samd/boards/mini_sam_m4/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/monster_m4sk/board.c b/ports/atmel-samd/boards/monster_m4sk/board.c index 45fea9d529549..2b757d0914e21 100644 --- a/ports/atmel-samd/boards/monster_m4sk/board.c +++ b/ports/atmel-samd/boards/monster_m4sk/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" #include "shared-bindings/busio/SPI.h" diff --git a/ports/atmel-samd/boards/monster_m4sk/pins.c b/ports/atmel-samd/boards/monster_m4sk/pins.c index 7272b9ed86435..c3eff7cc30e8a 100644 --- a/ports/atmel-samd/boards/monster_m4sk/pins.c +++ b/ports/atmel-samd/boards/monster_m4sk/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { diff --git a/ports/atmel-samd/boards/ndgarage_ndbit6/board.c b/ports/atmel-samd/boards/ndgarage_ndbit6/board.c index 0f60736a24006..7af05ba45a53e 100644 --- a/ports/atmel-samd/boards/ndgarage_ndbit6/board.c +++ b/ports/atmel-samd/boards/ndgarage_ndbit6/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/ndgarage_ndbit6_v2/board.c b/ports/atmel-samd/boards/ndgarage_ndbit6_v2/board.c index 0f60736a24006..7af05ba45a53e 100644 --- a/ports/atmel-samd/boards/ndgarage_ndbit6_v2/board.c +++ b/ports/atmel-samd/boards/ndgarage_ndbit6_v2/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/nfc_copy_cat/board.c b/ports/atmel-samd/boards/nfc_copy_cat/board.c index c8e20206a19fa..6baa43ffaa3cb 100644 --- a/ports/atmel-samd/boards/nfc_copy_cat/board.c +++ b/ports/atmel-samd/boards/nfc_copy_cat/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/openbook_m4/board.c b/ports/atmel-samd/boards/openbook_m4/board.c index 07dd1741aceb1..a110779a6a733 100644 --- a/ports/atmel-samd/boards/openbook_m4/board.c +++ b/ports/atmel-samd/boards/openbook_m4/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" #include "shared-bindings/busio/SPI.h" diff --git a/ports/atmel-samd/boards/openbook_m4/pins.c b/ports/atmel-samd/boards/openbook_m4/pins.c index 47de3043d9cfd..45a7bc1dd0db1 100644 --- a/ports/atmel-samd/boards/openbook_m4/pins.c +++ b/ports/atmel-samd/boards/openbook_m4/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { diff --git a/ports/atmel-samd/boards/pewpew10/board.c b/ports/atmel-samd/boards/pewpew10/board.c index d7e856d611991..84960e73cf2cd 100644 --- a/ports/atmel-samd/boards/pewpew10/board.c +++ b/ports/atmel-samd/boards/pewpew10/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/atmel-samd/boards/pewpew_m4/board.c b/ports/atmel-samd/boards/pewpew_m4/board.c index d02e0dc01de19..26bd53cad1049 100644 --- a/ports/atmel-samd/boards/pewpew_m4/board.c +++ b/ports/atmel-samd/boards/pewpew_m4/board.c @@ -25,7 +25,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" #include "shared-bindings/busio/SPI.h" diff --git a/ports/atmel-samd/boards/picoplanet/board.c b/ports/atmel-samd/boards/picoplanet/board.c index d7e856d611991..84960e73cf2cd 100644 --- a/ports/atmel-samd/boards/picoplanet/board.c +++ b/ports/atmel-samd/boards/picoplanet/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/atmel-samd/boards/pirkey_m0/board.c b/ports/atmel-samd/boards/pirkey_m0/board.c index c8e20206a19fa..6baa43ffaa3cb 100644 --- a/ports/atmel-samd/boards/pirkey_m0/board.c +++ b/ports/atmel-samd/boards/pirkey_m0/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/pybadge/board.c b/ports/atmel-samd/boards/pybadge/board.c index 35f228c75adbd..188bf7bf6c769 100644 --- a/ports/atmel-samd/boards/pybadge/board.c +++ b/ports/atmel-samd/boards/pybadge/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" #include "shared-bindings/busio/SPI.h" @@ -123,5 +123,5 @@ bool board_requests_safe_mode(void) { } void reset_board(void) { - board_reset_user_neopixels(); + board_reset_user_neopixels(&pin_PA15, 5); } diff --git a/ports/atmel-samd/boards/pybadge/pins.c b/ports/atmel-samd/boards/pybadge/pins.c index ca65d9df4641a..a1802bb0718a8 100644 --- a/ports/atmel-samd/boards/pybadge/pins.c +++ b/ports/atmel-samd/boards/pybadge/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { diff --git a/ports/atmel-samd/boards/pybadge_airlift/board.c b/ports/atmel-samd/boards/pybadge_airlift/board.c index fe3e4a017177e..de7eeda09679e 100644 --- a/ports/atmel-samd/boards/pybadge_airlift/board.c +++ b/ports/atmel-samd/boards/pybadge_airlift/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" #include "shared-bindings/busio/SPI.h" @@ -101,5 +101,5 @@ bool board_requests_safe_mode(void) { } void reset_board(void) { - board_reset_user_neopixels(); + board_reset_user_neopixels(&pin_PA15, 5); } diff --git a/ports/atmel-samd/boards/pybadge_airlift/pins.c b/ports/atmel-samd/boards/pybadge_airlift/pins.c index 9ee579be14536..cdf8071da8908 100644 --- a/ports/atmel-samd/boards/pybadge_airlift/pins.c +++ b/ports/atmel-samd/boards/pybadge_airlift/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { diff --git a/ports/atmel-samd/boards/pycubed/board.c b/ports/atmel-samd/boards/pycubed/board.c index 0bf586ad8e06e..f092a8d20e5d1 100644 --- a/ports/atmel-samd/boards/pycubed/board.c +++ b/ports/atmel-samd/boards/pycubed/board.c @@ -27,7 +27,7 @@ #include -#include "boards/board.h" +#include "supervisor/board.h" #include "py/mpconfig.h" #include "shared-bindings/nvm/ByteArray.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/atmel-samd/boards/pycubed/pins.c b/ports/atmel-samd/boards/pycubed/pins.c index e494fb54bfe4b..93f349ffa47b0 100644 --- a/ports/atmel-samd/boards/pycubed/pins.c +++ b/ports/atmel-samd/boards/pycubed/pins.c @@ -1,5 +1,5 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA13) }, diff --git a/ports/atmel-samd/boards/pycubed_mram/board.c b/ports/atmel-samd/boards/pycubed_mram/board.c index 0bf586ad8e06e..f092a8d20e5d1 100644 --- a/ports/atmel-samd/boards/pycubed_mram/board.c +++ b/ports/atmel-samd/boards/pycubed_mram/board.c @@ -27,7 +27,7 @@ #include -#include "boards/board.h" +#include "supervisor/board.h" #include "py/mpconfig.h" #include "shared-bindings/nvm/ByteArray.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/atmel-samd/boards/pycubed_mram/pins.c b/ports/atmel-samd/boards/pycubed_mram/pins.c index e494fb54bfe4b..93f349ffa47b0 100644 --- a/ports/atmel-samd/boards/pycubed_mram/pins.c +++ b/ports/atmel-samd/boards/pycubed_mram/pins.c @@ -1,5 +1,5 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA13) }, diff --git a/ports/atmel-samd/boards/pygamer/board.c b/ports/atmel-samd/boards/pygamer/board.c index b478b5947c2f7..4614e347cd45d 100644 --- a/ports/atmel-samd/boards/pygamer/board.c +++ b/ports/atmel-samd/boards/pygamer/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" #include "shared-bindings/busio/SPI.h" @@ -123,5 +123,5 @@ bool board_requests_safe_mode(void) { } void reset_board(void) { - board_reset_user_neopixels(); + board_reset_user_neopixels(&pin_PA15, 5); } diff --git a/ports/atmel-samd/boards/pygamer/pins.c b/ports/atmel-samd/boards/pygamer/pins.c index 107d780a8ab80..8bfaa64792911 100644 --- a/ports/atmel-samd/boards/pygamer/pins.c +++ b/ports/atmel-samd/boards/pygamer/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { diff --git a/ports/atmel-samd/boards/pygamer_advance/board.c b/ports/atmel-samd/boards/pygamer_advance/board.c index 7dfe07c00dfdc..39bf65602e27e 100644 --- a/ports/atmel-samd/boards/pygamer_advance/board.c +++ b/ports/atmel-samd/boards/pygamer_advance/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" #include "shared-bindings/busio/SPI.h" @@ -101,5 +101,5 @@ bool board_requests_safe_mode(void) { } void reset_board(void) { - board_reset_user_neopixels(); + board_reset_user_neopixels(&pin_PA15, 5); } diff --git a/ports/atmel-samd/boards/pygamer_advance/pins.c b/ports/atmel-samd/boards/pygamer_advance/pins.c index 653a1bb2ef850..8db63f2f0c602 100644 --- a/ports/atmel-samd/boards/pygamer_advance/pins.c +++ b/ports/atmel-samd/boards/pygamer_advance/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { diff --git a/ports/atmel-samd/boards/pyportal/board.c b/ports/atmel-samd/boards/pyportal/board.c index cd94f68875aca..db474a8209735 100644 --- a/ports/atmel-samd/boards/pyportal/board.c +++ b/ports/atmel-samd/boards/pyportal/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/pyportal/pins.c b/ports/atmel-samd/boards/pyportal/pins.c index 461ee98da5e81..1a1846492211e 100644 --- a/ports/atmel-samd/boards/pyportal/pins.c +++ b/ports/atmel-samd/boards/pyportal/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" // This mapping only includes functional names because pins broken diff --git a/ports/atmel-samd/boards/pyportal_titano/board.c b/ports/atmel-samd/boards/pyportal_titano/board.c index dc417f5d1477e..59a25c4acfbd4 100644 --- a/ports/atmel-samd/boards/pyportal_titano/board.c +++ b/ports/atmel-samd/boards/pyportal_titano/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/pyportal_titano/pins.c b/ports/atmel-samd/boards/pyportal_titano/pins.c index 461ee98da5e81..1a1846492211e 100644 --- a/ports/atmel-samd/boards/pyportal_titano/pins.c +++ b/ports/atmel-samd/boards/pyportal_titano/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" // This mapping only includes functional names because pins broken diff --git a/ports/atmel-samd/boards/pyruler/board.c b/ports/atmel-samd/boards/pyruler/board.c index d7e856d611991..84960e73cf2cd 100644 --- a/ports/atmel-samd/boards/pyruler/board.c +++ b/ports/atmel-samd/boards/pyruler/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/atmel-samd/boards/qtpy_m0/board.c b/ports/atmel-samd/boards/qtpy_m0/board.c index 1a65a561f7c7d..6b948a9a7ab97 100644 --- a/ports/atmel-samd/boards/qtpy_m0/board.c +++ b/ports/atmel-samd/boards/qtpy_m0/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "common-hal/microcontroller/Pin.h" #include "supervisor/shared/board.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/qtpy_m0_haxpress/board.c b/ports/atmel-samd/boards/qtpy_m0_haxpress/board.c index 1a65a561f7c7d..6b948a9a7ab97 100644 --- a/ports/atmel-samd/boards/qtpy_m0_haxpress/board.c +++ b/ports/atmel-samd/boards/qtpy_m0_haxpress/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "common-hal/microcontroller/Pin.h" #include "supervisor/shared/board.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/robohatmm1_m4/board.c b/ports/atmel-samd/boards/robohatmm1_m4/board.c index 0f60736a24006..7af05ba45a53e 100644 --- a/ports/atmel-samd/boards/robohatmm1_m4/board.c +++ b/ports/atmel-samd/boards/robohatmm1_m4/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/sam32/board.c b/ports/atmel-samd/boards/sam32/board.c index e0326014402e5..560edd9c2cd54 100644 --- a/ports/atmel-samd/boards/sam32/board.c +++ b/ports/atmel-samd/boards/sam32/board.c @@ -27,7 +27,7 @@ #include -#include "boards/board.h" +#include "supervisor/board.h" #include "py/mpconfig.h" #include "common-hal/digitalio/DigitalInOut.h" diff --git a/ports/atmel-samd/boards/same54_xplained/board.c b/ports/atmel-samd/boards/same54_xplained/board.c index 7599f02b8efee..5ed8c84049490 100644 --- a/ports/atmel-samd/boards/same54_xplained/board.c +++ b/ports/atmel-samd/boards/same54_xplained/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c b/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c index 49db498608813..53c43cd441bb4 100644 --- a/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c +++ b/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" #include "shared-bindings/busio/SPI.h" diff --git a/ports/atmel-samd/boards/seeeduino_xiao/board.c b/ports/atmel-samd/boards/seeeduino_xiao/board.c index 0f60736a24006..7af05ba45a53e 100644 --- a/ports/atmel-samd/boards/seeeduino_xiao/board.c +++ b/ports/atmel-samd/boards/seeeduino_xiao/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/serpente/board.c b/ports/atmel-samd/boards/serpente/board.c index d7e856d611991..84960e73cf2cd 100644 --- a/ports/atmel-samd/boards/serpente/board.c +++ b/ports/atmel-samd/boards/serpente/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/atmel-samd/boards/shirtty/board.c b/ports/atmel-samd/boards/shirtty/board.c index d7e856d611991..84960e73cf2cd 100644 --- a/ports/atmel-samd/boards/shirtty/board.c +++ b/ports/atmel-samd/boards/shirtty/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/atmel-samd/boards/snekboard/board.c b/ports/atmel-samd/boards/snekboard/board.c index c8e20206a19fa..6baa43ffaa3cb 100644 --- a/ports/atmel-samd/boards/snekboard/board.c +++ b/ports/atmel-samd/boards/snekboard/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/sparkfun_lumidrive/board.c b/ports/atmel-samd/boards/sparkfun_lumidrive/board.c index c8e20206a19fa..6baa43ffaa3cb 100755 --- a/ports/atmel-samd/boards/sparkfun_lumidrive/board.c +++ b/ports/atmel-samd/boards/sparkfun_lumidrive/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/sparkfun_qwiic_micro_no_flash/board.c b/ports/atmel-samd/boards/sparkfun_qwiic_micro_no_flash/board.c index c8e20206a19fa..6baa43ffaa3cb 100644 --- a/ports/atmel-samd/boards/sparkfun_qwiic_micro_no_flash/board.c +++ b/ports/atmel-samd/boards/sparkfun_qwiic_micro_no_flash/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/sparkfun_qwiic_micro_with_flash/board.c b/ports/atmel-samd/boards/sparkfun_qwiic_micro_with_flash/board.c index c8e20206a19fa..6baa43ffaa3cb 100644 --- a/ports/atmel-samd/boards/sparkfun_qwiic_micro_with_flash/board.c +++ b/ports/atmel-samd/boards/sparkfun_qwiic_micro_with_flash/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/sparkfun_redboard_turbo/board.c b/ports/atmel-samd/boards/sparkfun_redboard_turbo/board.c index c8e20206a19fa..6baa43ffaa3cb 100755 --- a/ports/atmel-samd/boards/sparkfun_redboard_turbo/board.c +++ b/ports/atmel-samd/boards/sparkfun_redboard_turbo/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/sparkfun_samd21_dev/board.c b/ports/atmel-samd/boards/sparkfun_samd21_dev/board.c index 0f60736a24006..7af05ba45a53e 100644 --- a/ports/atmel-samd/boards/sparkfun_samd21_dev/board.c +++ b/ports/atmel-samd/boards/sparkfun_samd21_dev/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/sparkfun_samd21_mini/board.c b/ports/atmel-samd/boards/sparkfun_samd21_mini/board.c index 0f60736a24006..7af05ba45a53e 100644 --- a/ports/atmel-samd/boards/sparkfun_samd21_mini/board.c +++ b/ports/atmel-samd/boards/sparkfun_samd21_mini/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/board.c b/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/board.c index 8096b9b8ea6d8..5fca974e9edae 100644 --- a/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/board.c +++ b/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/stringcar_m0_express/board.c b/ports/atmel-samd/boards/stringcar_m0_express/board.c index d7e856d611991..84960e73cf2cd 100644 --- a/ports/atmel-samd/boards/stringcar_m0_express/board.c +++ b/ports/atmel-samd/boards/stringcar_m0_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/atmel-samd/boards/trellis_m4_express/board.c b/ports/atmel-samd/boards/trellis_m4_express/board.c index a9b5f81631cf8..e6f8b5917952a 100644 --- a/ports/atmel-samd/boards/trellis_m4_express/board.c +++ b/ports/atmel-samd/boards/trellis_m4_express/board.c @@ -26,7 +26,7 @@ #include -#include "boards/board.h" +#include "supervisor/board.h" #include "py/mpconfig.h" #include "common-hal/digitalio/DigitalInOut.h" diff --git a/ports/atmel-samd/boards/trinket_m0/board.c b/ports/atmel-samd/boards/trinket_m0/board.c index d7e856d611991..84960e73cf2cd 100644 --- a/ports/atmel-samd/boards/trinket_m0/board.c +++ b/ports/atmel-samd/boards/trinket_m0/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/atmel-samd/boards/trinket_m0_haxpress/board.c b/ports/atmel-samd/boards/trinket_m0_haxpress/board.c index d7e856d611991..84960e73cf2cd 100644 --- a/ports/atmel-samd/boards/trinket_m0_haxpress/board.c +++ b/ports/atmel-samd/boards/trinket_m0_haxpress/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/atmel-samd/boards/uartlogger2/board.c b/ports/atmel-samd/boards/uartlogger2/board.c index 0f60736a24006..7af05ba45a53e 100644 --- a/ports/atmel-samd/boards/uartlogger2/board.c +++ b/ports/atmel-samd/boards/uartlogger2/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/uchip/board.c b/ports/atmel-samd/boards/uchip/board.c index 0f60736a24006..7af05ba45a53e 100644 --- a/ports/atmel-samd/boards/uchip/board.c +++ b/ports/atmel-samd/boards/uchip/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/ugame10/board.c b/ports/atmel-samd/boards/ugame10/board.c index 9f2b8d039dbd2..918fe2d59dd6f 100644 --- a/ports/atmel-samd/boards/ugame10/board.c +++ b/ports/atmel-samd/boards/ugame10/board.c @@ -25,7 +25,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-bindings/board/__init__.h" #include "shared-bindings/displayio/FourWire.h" diff --git a/ports/atmel-samd/boards/winterbloom_big_honking_button/board.c b/ports/atmel-samd/boards/winterbloom_big_honking_button/board.c index c8e20206a19fa..6baa43ffaa3cb 100644 --- a/ports/atmel-samd/boards/winterbloom_big_honking_button/board.c +++ b/ports/atmel-samd/boards/winterbloom_big_honking_button/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/winterbloom_sol/board.c b/ports/atmel-samd/boards/winterbloom_sol/board.c index 8096b9b8ea6d8..5fca974e9edae 100644 --- a/ports/atmel-samd/boards/winterbloom_sol/board.c +++ b/ports/atmel-samd/boards/winterbloom_sol/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) { diff --git a/ports/atmel-samd/boards/xinabox_cc03/board.c b/ports/atmel-samd/boards/xinabox_cc03/board.c index 770bc825938cd..112b173eccb51 100644 --- a/ports/atmel-samd/boards/xinabox_cc03/board.c +++ b/ports/atmel-samd/boards/xinabox_cc03/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/boards/xinabox_cs11/board.c b/ports/atmel-samd/boards/xinabox_cs11/board.c index 770bc825938cd..112b173eccb51 100644 --- a/ports/atmel-samd/boards/xinabox_cs11/board.c +++ b/ports/atmel-samd/boards/xinabox_cs11/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/common-hal/busio/SPI.c b/ports/atmel-samd/common-hal/busio/SPI.c index 189fd93b5478e..9646f9cf1e56a 100644 --- a/ports/atmel-samd/common-hal/busio/SPI.c +++ b/ports/atmel-samd/common-hal/busio/SPI.c @@ -31,7 +31,7 @@ #include "hpl_sercom_config.h" #include "peripheral_clk_config.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "common-hal/microcontroller/Pin.h" #include "hal/include/hal_gpio.h" #include "hal/include/hal_spi_m_sync.h" diff --git a/ports/atmel-samd/common-hal/sdioio/SDCard.c b/ports/atmel-samd/common-hal/sdioio/SDCard.c index 4d2539aa5afe5..14c6f29de1037 100644 --- a/ports/atmel-samd/common-hal/sdioio/SDCard.c +++ b/ports/atmel-samd/common-hal/sdioio/SDCard.c @@ -28,7 +28,6 @@ #include "py/mperrno.h" #include "py/runtime.h" -#include "boards/board.h" #include "common-hal/microcontroller/Pin.h" #include "shared-bindings/sdioio/SDCard.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index fc1d1198e2f45..7d02789e82757 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -27,7 +27,7 @@ #include #include -#include "boards/board.h" +#include "supervisor/board.h" #include "supervisor/port.h" // ASF 4 @@ -543,7 +543,7 @@ void port_interrupt_after_ticks(uint32_t ticks) { _port_interrupt_after_ticks(ticks); } -void port_sleep_until_interrupt(void) { +void port_idle_until_interrupt(void) { #ifdef SAM_D5X_E5X // Clear the FPU interrupt because it can prevent us from sleeping. if (__get_FPSCR() & ~(0x9f)) { diff --git a/ports/cxd56/boards/board.h b/ports/cxd56/boards/board.h deleted file mode 100644 index 597ae72e6a2da..0000000000000 --- a/ports/cxd56/boards/board.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright 2019 Sony Semiconductor Solutions Corporation - * - * 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. - */ - -// This file defines board specific functions. - -#ifndef MICROPY_INCLUDED_CXD56_BOARDS_BOARD_H -#define MICROPY_INCLUDED_CXD56_BOARDS_BOARD_H - -#include - -// Initializes board related state once on start up. -void board_init(void); - -// Returns true if the user initiates safe mode in a board specific way. -// Also add BOARD_USER_SAFE_MODE in mpconfigboard.h to explain the board specific -// way. -bool board_requests_safe_mode(void); - -// Reset the state of off MCU components such as neopixels. -void reset_board(void); - -#endif // MICROPY_INCLUDED_CXD56_BOARDS_BOARD_H diff --git a/ports/cxd56/boards/spresense/board.c b/ports/cxd56/boards/spresense/board.c index 2af7cfdcf2dab..fd27d3493a920 100644 --- a/ports/cxd56/boards/spresense/board.c +++ b/ports/cxd56/boards/spresense/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { diff --git a/ports/cxd56/supervisor/port.c b/ports/cxd56/supervisor/port.c index d69f357799a1a..523d6a496b2f0 100644 --- a/ports/cxd56/supervisor/port.c +++ b/ports/cxd56/supervisor/port.c @@ -33,7 +33,7 @@ #include "sched/sched.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "supervisor/port.h" #include "supervisor/background_callback.h" @@ -169,6 +169,6 @@ void port_disable_tick(void) { void port_interrupt_after_ticks(uint32_t ticks) { } -void port_sleep_until_interrupt(void) { +void port_idle_until_interrupt(void) { // TODO: Implement sleep. } diff --git a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c index ecd44e423c04b..a9d1074f728b1 100644 --- a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c +++ b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c @@ -24,7 +24,8 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" + #include "mpconfigboard.h" #include "shared-bindings/busio/SPI.h" #include "shared-bindings/displayio/FourWire.h" @@ -32,6 +33,10 @@ #include "shared-module/displayio/__init__.h" #include "supervisor/shared/board.h" +#include "components/log/include/esp_log.h" + +static const char* TAG = "board"; + #define DELAY 0x80 // This is an ILO373 control chip. The display is a 2.9" grayscale EInk. @@ -167,3 +172,18 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { + displayio_epaperdisplay_obj_t* display = &displays[0].epaper_display; + if (display->base.type == &displayio_epaperdisplay_type) { + size_t i = 0; + while (common_hal_displayio_epaperdisplay_get_busy(display)) { + RUN_BACKGROUND_TASKS; + i++; + } + ESP_LOGI(TAG, "waited %d iterations for display", i); + } else { + ESP_LOGI(TAG, "didn't wait for display"); + } + common_hal_displayio_release_displays(); +} diff --git a/ports/esp32s2/boards/adafruit_metro_esp32s2/board.c b/ports/esp32s2/boards/adafruit_metro_esp32s2/board.c index 7380be6da6a83..5abd1ce1b3c81 100644 --- a/ports/esp32s2/boards/adafruit_metro_esp32s2/board.c +++ b/ports/esp32s2/boards/adafruit_metro_esp32s2/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" @@ -41,3 +41,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/esp32s2/boards/electroniccats_bastwifi/board.c b/ports/esp32s2/boards/electroniccats_bastwifi/board.c index 9f708874bfdf5..ff5d9cfb6c7cb 100644 --- a/ports/esp32s2/boards/electroniccats_bastwifi/board.c +++ b/ports/esp32s2/boards/electroniccats_bastwifi/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" @@ -45,3 +45,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/esp32s2/boards/espressif_kaluga_1/board.c b/ports/esp32s2/boards/espressif_kaluga_1/board.c index 9f708874bfdf5..ff5d9cfb6c7cb 100644 --- a/ports/esp32s2/boards/espressif_kaluga_1/board.c +++ b/ports/esp32s2/boards/espressif_kaluga_1/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" @@ -45,3 +45,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/esp32s2/boards/espressif_saola_1_wroom/board.c b/ports/esp32s2/boards/espressif_saola_1_wroom/board.c index 9f708874bfdf5..ff5d9cfb6c7cb 100644 --- a/ports/esp32s2/boards/espressif_saola_1_wroom/board.c +++ b/ports/esp32s2/boards/espressif_saola_1_wroom/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" @@ -45,3 +45,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/esp32s2/boards/espressif_saola_1_wrover/board.c b/ports/esp32s2/boards/espressif_saola_1_wrover/board.c index 9f708874bfdf5..ff5d9cfb6c7cb 100644 --- a/ports/esp32s2/boards/espressif_saola_1_wrover/board.c +++ b/ports/esp32s2/boards/espressif_saola_1_wrover/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" @@ -45,3 +45,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/esp32s2/boards/microdev_micro_s2/board.c b/ports/esp32s2/boards/microdev_micro_s2/board.c index 1dc30b5af8e32..abd22091ee771 100644 --- a/ports/esp32s2/boards/microdev_micro_s2/board.c +++ b/ports/esp32s2/boards/microdev_micro_s2/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" @@ -54,3 +54,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/esp32s2/boards/muselab_nanoesp32_s2/board.c b/ports/esp32s2/boards/muselab_nanoesp32_s2/board.c index 9f708874bfdf5..ff5d9cfb6c7cb 100644 --- a/ports/esp32s2/boards/muselab_nanoesp32_s2/board.c +++ b/ports/esp32s2/boards/muselab_nanoesp32_s2/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" @@ -45,3 +45,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/esp32s2/boards/targett_module_clip_wroom/board.c b/ports/esp32s2/boards/targett_module_clip_wroom/board.c index 7f5de0e0ddd0c..c2022d292e5bb 100644 --- a/ports/esp32s2/boards/targett_module_clip_wroom/board.c +++ b/ports/esp32s2/boards/targett_module_clip_wroom/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" @@ -49,3 +49,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/esp32s2/boards/targett_module_clip_wrover/board.c b/ports/esp32s2/boards/targett_module_clip_wrover/board.c index 83dcb920a8142..5a9fbcbee7a5d 100644 --- a/ports/esp32s2/boards/targett_module_clip_wrover/board.c +++ b/ports/esp32s2/boards/targett_module_clip_wrover/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" @@ -49,3 +49,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c b/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c index 1dc30b5af8e32..abd22091ee771 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" @@ -54,3 +54,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/board.c b/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/board.c index 1dc30b5af8e32..abd22091ee771 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/board.c +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" @@ -54,3 +54,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index 11e173fe2eaf6..529179200d487 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -32,38 +32,41 @@ #include "shared-bindings/alarm/pin/PinAlarm.h" #include "shared-bindings/alarm/time/TimeAlarm.h" #include "shared-bindings/microcontroller/__init__.h" -#include "shared-bindings/time/__init__.h" #include "shared-bindings/wifi/__init__.h" +#include "supervisor/port.h" +#include "supervisor/shared/workflow.h" + #include "common-hal/alarm/__init__.h" -#include "esp_log.h" #include "esp_sleep.h" -STATIC mp_obj_tuple_t *_deep_sleep_alarms; - void alarm_reset(void) { - _deep_sleep_alarms = mp_const_empty_tuple; + alarm_time_timealarm_reset(); + esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL); } -void common_hal_alarm_disable_all(void) { - esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL); +STATIC esp_sleep_wakeup_cause_t _get_wakeup_cause(void) { + if (alarm_time_timealarm_woke_us_up()) { + return ESP_SLEEP_WAKEUP_TIMER; + } + + return esp_sleep_get_wakeup_cause(); } -mp_obj_t common_hal_alarm_get_wake_alarm(void) { - switch (esp_sleep_get_wakeup_cause()) { +bool alarm_woken_from_sleep(void) { + return _get_wakeup_cause() != ESP_SLEEP_WAKEUP_UNDEFINED; +} + +STATIC mp_obj_t _get_wake_alarm(size_t n_alarms, const mp_obj_t *alarms) { + switch (_get_wakeup_cause()) { case ESP_SLEEP_WAKEUP_TIMER: { - // Wake up from timer. - alarm_time_time_alarm_obj_t *timer = m_new_obj(alarm_time_time_alarm_obj_t); - timer->base.type = &alarm_time_time_alarm_type; - return timer; + return alarm_time_timealarm_get_wakeup_alarm(n_alarms, alarms); } case ESP_SLEEP_WAKEUP_EXT0: { - // Wake up from GPIO - alarm_pin_pin_alarm_obj_t *ext0 = m_new_obj(alarm_pin_pin_alarm_obj_t); - ext0->base.type = &alarm_pin_pin_alarm_type; - return ext0; + // TODO: implement pin alarm wake. + break; } case ESP_SLEEP_WAKEUP_TOUCHPAD: @@ -79,16 +82,19 @@ mp_obj_t common_hal_alarm_get_wake_alarm(void) { return mp_const_none; } +mp_obj_t common_hal_alarm_get_wake_alarm(void) { + return _get_wake_alarm(0, NULL); +} + // Set up light sleep or deep sleep alarms. -STATIC void setup_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms) { +STATIC void _setup_sleep_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms) { bool time_alarm_set = false; alarm_time_time_alarm_obj_t *time_alarm = MP_OBJ_NULL; for (size_t i = 0; i < n_alarms; i++) { if (MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pin_alarm_type)) { mp_raise_NotImplementedError(translate("PinAlarm not yet implemented")); - } - else if (MP_OBJ_IS_TYPE(alarms[i], &alarm_time_time_alarm_type)) { + } else if (MP_OBJ_IS_TYPE(alarms[i], &alarm_time_time_alarm_type)) { if (time_alarm_set) { mp_raise_ValueError(translate("Only one alarm.time alarm can be set.")); } @@ -97,102 +103,50 @@ STATIC void setup_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms) { } } - if (time_alarm != MP_OBJ_NULL) { - // Compute how long to actually sleep, considering the time now. - mp_float_t now_secs = uint64_to_float(common_hal_time_monotonic_ms()) / 1000.0f; - mp_float_t wakeup_in_secs = MAX(0.0f, time_alarm->monotonic_time - now_secs); - const uint64_t sleep_for_us = (uint64_t) (wakeup_in_secs * 1000000); - ESP_LOGI("ALARM", "will sleep for us: %lld", sleep_for_us); - esp_sleep_enable_timer_wakeup(sleep_for_us); + if (time_alarm_set) { + alarm_time_timealarm_set_alarm(time_alarm); } } -mp_obj_t common_hal_alarm_wait_until_alarms(size_t n_alarms, const mp_obj_t *alarms) { - if (n_alarms == 0) { - return mp_const_none; - } - - bool time_alarm_set = false; - alarm_time_time_alarm_obj_t *time_alarm = MP_OBJ_NULL; - - for (size_t i = 0; i < n_alarms; i++) { - if (MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pin_alarm_type)) { - mp_raise_NotImplementedError(translate("PinAlarm not yet implemented")); +STATIC void _idle_until_alarm(void) { + // Poll for alarms. + while (!mp_hal_is_interrupted()) { + RUN_BACKGROUND_TASKS; + // Allow ctrl-C interrupt. + if (alarm_woken_from_sleep()) { + return; } - else if (MP_OBJ_IS_TYPE(alarms[i], &alarm_time_time_alarm_type)) { - if (time_alarm_set) { - mp_raise_ValueError(translate("Only one alarm.time alarm can be set.")); - } - time_alarm = MP_OBJ_TO_PTR(alarms[i]); - time_alarm_set = true; - } - } - - ESP_LOGI("ALARM", "waiting for alarms"); - if (time_alarm_set && n_alarms == 1) { - // If we're only checking time, avoid a polling loop, so maybe we can save some power. - const mp_float_t now_secs = uint64_to_float(common_hal_time_monotonic_ms()) / 1000.0f; - const mp_float_t wakeup_in_secs = MAX(0.0f, time_alarm->monotonic_time - now_secs); - const uint32_t delay_ms = (uint32_t) (wakeup_in_secs * 1000.0f); - ESP_LOGI("ALARM", "Delay for ms: %d", delay_ms); - common_hal_time_delay_ms((uint32_t) delay_ms); - } else { - // Poll for alarms. - while (true) { - RUN_BACKGROUND_TASKS; - // Allow ctrl-C interrupt. - if (mp_hal_is_interrupted()) { - return mp_const_none; - } - - // TODO: Check PinAlarms. - - if (time_alarm != MP_OBJ_NULL && - common_hal_time_monotonic_ms() * 1000.f >= time_alarm->monotonic_time) { - return time_alarm; - } - } + port_idle_until_interrupt(); } - - return mp_const_none; } // Is it safe to do a light sleep? Check whether WiFi is on or there are // other ongoing tasks that should not be shut down. -static bool light_sleep_ok(void) { - return !common_hal_wifi_radio_get_enabled(&common_hal_wifi_radio_obj); +STATIC bool _light_sleep_ok(void) { + return !common_hal_wifi_radio_get_enabled(&common_hal_wifi_radio_obj) && !supervisor_workflow_active(); } mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms) { - if (n_alarms == 0) { - return mp_const_none; - } + _setup_sleep_alarms(false, n_alarms, alarms); - if (light_sleep_ok()) { - ESP_LOGI("ALARM", "start light sleep"); - setup_sleep_alarms(n_alarms, alarms); + // Light sleep can break some functionality so only do it when possible. Otherwise we idle. + if (_light_sleep_ok()) { esp_light_sleep_start(); - return common_hal_alarm_get_wake_alarm(); } else { - // Don't do an ESP32 light sleep. - return common_hal_alarm_wait_until_alarms(n_alarms, alarms); + _idle_until_alarm(); } + mp_obj_t wake_alarm = _get_wake_alarm(n_alarms, alarms); + alarm_reset(); + return wake_alarm; } -void common_hal_alarm_exit_and_deep_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms) { - setup_sleep_alarms(n_alarms, alarms); - - // Raise an exception, which will be processed in main.c. - mp_raise_arg1(&mp_type_DeepSleepRequest, NULL); -} - -void common_hal_alarm_prepare_for_deep_sleep(void) { - // Turn off WiFi and anything else that should be shut down cleanly. - common_hal_wifi_radio_set_enabled(&common_hal_wifi_radio_obj, false); +void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms) { + _setup_sleep_alarms(true, n_alarms, alarms); } -void NORETURN common_hal_alarm_enter_deep_sleep(void) { - ESP_LOGI("ALARM", "start deep sleep"); +void NORETURN alarm_enter_deep_sleep(void) { + // The ESP-IDF caches the deep sleep settings and applies them before sleep. + // We don't need to worry about resetting them in the interim. esp_deep_sleep_start(); } diff --git a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c index 7af3694630de8..34c8b0052364b 100644 --- a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +++ b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c @@ -27,8 +27,12 @@ #include "esp_sleep.h" #include "py/runtime.h" +#include "supervisor/esp_port.h" + +#include "components/esp_timer/include/esp_timer.h" #include "shared-bindings/alarm/time/TimeAlarm.h" +#include "shared-bindings/time/__init__.h" void common_hal_alarm_time_time_alarm_construct(alarm_time_time_alarm_obj_t *self, mp_float_t monotonic_time) { self->monotonic_time = monotonic_time; @@ -37,3 +41,63 @@ void common_hal_alarm_time_time_alarm_construct(alarm_time_time_alarm_obj_t *sel mp_float_t common_hal_alarm_time_time_alarm_get_monotonic_time(alarm_time_time_alarm_obj_t *self) { return self->monotonic_time; } + +mp_obj_t alarm_time_timealarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms) { + // First, check to see if we match + for (size_t i = 0; i < n_alarms; i++) { + if (MP_OBJ_IS_TYPE(alarms[i], &alarm_time_time_alarm_type)) { + return alarms[i]; + } + } + alarm_time_time_alarm_obj_t *timer = m_new_obj(alarm_time_time_alarm_obj_t); + timer->base.type = &alarm_time_time_alarm_type; + return timer; +} + +esp_timer_handle_t pretend_sleep_timer; +STATIC bool woke_up = false; + +// This is run in the timer task. We use it to wake the main CircuitPython task. +void timer_callback(void *arg) { + (void) arg; + woke_up = true; + if (sleeping_circuitpython_task) { + xTaskNotifyGive(sleeping_circuitpython_task); + } +} + +bool alarm_time_timealarm_woke_us_up(void) { + return woke_up; +} + +void alarm_time_timealarm_reset(void) { + esp_timer_stop(pretend_sleep_timer); + esp_timer_delete(pretend_sleep_timer); + pretend_sleep_timer = NULL; + woke_up = false; +} + +void alarm_time_timealarm_set_alarm(alarm_time_time_alarm_obj_t *self) { + if (pretend_sleep_timer != NULL) { + esp_timer_stop(pretend_sleep_timer); + } else { + // Configure the timer to use during pretend sleep. + esp_timer_create_args_t args; + args.callback = timer_callback; + args.arg = NULL; + args.dispatch_method = ESP_TIMER_TASK; + args.name = "Pretend deep sleep"; + esp_timer_create(&args, &pretend_sleep_timer); + } + + // Compute how long to actually sleep, considering the time now. + mp_float_t now_secs = uint64_to_float(common_hal_time_monotonic_ms()) / 1000.0f; + mp_float_t wakeup_in_secs = MAX(0.0f, self->monotonic_time - now_secs); + const uint64_t sleep_for_us = (uint64_t) (wakeup_in_secs * 1000000); + esp_sleep_enable_timer_wakeup(sleep_for_us); + + // Also set the RTC interrupt so it can wake our task. This will be wiped out + // if we actually deep sleep. + woke_up = false; + esp_timer_start_once(pretend_sleep_timer, sleep_for_us); +} diff --git a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h index b540541f4dfe4..04c553009eea2 100644 --- a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h +++ b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h @@ -31,3 +31,10 @@ typedef struct { mp_obj_base_t base; mp_float_t monotonic_time; // values compatible with time.monotonic_time() } alarm_time_time_alarm_obj_t; + +// Find the alarm object that caused us to wake up or create an equivalent one. +mp_obj_t alarm_time_timealarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms); +// Check for the wake up alarm from pretend deep sleep. +bool alarm_time_timealarm_woke_us_up(void); +void alarm_time_timealarm_set_alarm(alarm_time_time_alarm_obj_t *self); +void alarm_time_timealarm_reset(void); diff --git a/ports/esp32s2/common-hal/busio/SPI.c b/ports/esp32s2/common-hal/busio/SPI.c index da738bbfdde93..562881585dfd1 100644 --- a/ports/esp32s2/common-hal/busio/SPI.c +++ b/ports/esp32s2/common-hal/busio/SPI.c @@ -28,7 +28,6 @@ #include "py/mperrno.h" #include "py/runtime.h" -#include "boards/board.h" #include "shared-bindings/microcontroller/Pin.h" #include "supervisor/shared/rgb_led_status.h" diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 6222cd29041ba..954fb933093af 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -27,8 +27,8 @@ #include #include +#include "supervisor/board.h" #include "supervisor/port.h" -#include "boards/board.h" #include "modules/module.h" #include "py/runtime.h" #include "supervisor/esp_port.h" @@ -239,27 +239,31 @@ void port_enable_tick(void) { // Disable 1/1024 second tick. void port_disable_tick(void) { esp_timer_stop(_tick_timer); + + // CircuitPython's VM is run in a separate FreeRTOS task from TinyUSB. + // Tick disable can happen via auto-reload so poke the main task here. + if (sleeping_circuitpython_task != NULL) { + xTaskNotifyGive(sleeping_circuitpython_task); + } } TickType_t sleep_time_duration; void port_interrupt_after_ticks(uint32_t ticks) { sleep_time_duration = (ticks * 100)/1024; - sleeping_circuitpython_task = xTaskGetCurrentTaskHandle(); } -void port_sleep_until_interrupt(void) { - - uint32_t NotifyValue = 0; +void port_idle_until_interrupt(void) { + uint32_t notify_value = 0; if (sleep_time_duration == 0) { return; } - xTaskNotifyWait(0x01,0x01,&NotifyValue, - sleep_time_duration ); - if (NotifyValue == 1) { - sleeping_circuitpython_task = NULL; - mp_handle_pending(); + sleeping_circuitpython_task = xTaskGetCurrentTaskHandle(); + xTaskNotifyWait(0x01, 0x01, ¬ify_value, sleep_time_duration ); + sleeping_circuitpython_task = NULL; + if (notify_value == 1) { + mp_handle_pending(); } } diff --git a/ports/litex/boards/board.h b/ports/litex/boards/board.h deleted file mode 100644 index 837b371904523..0000000000000 --- a/ports/litex/boards/board.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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. - */ - -// This file defines board specific functions. - -#ifndef MICROPY_INCLUDED_LITEX_BOARDS_BOARD_H -#define MICROPY_INCLUDED_LITEX_BOARDS_BOARD_H - -#include - -// Initializes board related state once on start up. -void board_init(void); - -// Returns true if the user initiates safe mode in a board specific way. -// Also add BOARD_USER_SAFE_MODE in mpconfigboard.h to explain the board specific -// way. -bool board_requests_safe_mode(void); - -// Reset the state of off MCU components such as neopixels. -void reset_board(void); - -#endif // MICROPY_INCLUDED_LITEX_BOARDS_BOARD_H diff --git a/ports/litex/boards/fomu/board.c b/ports/litex/boards/fomu/board.c index 97e1ecadd6cde..a90f22f81eaa2 100644 --- a/ports/litex/boards/fomu/board.c +++ b/ports/litex/boards/fomu/board.c @@ -24,7 +24,8 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" + #include "mpconfigboard.h" #include "csr.h" diff --git a/ports/litex/supervisor/port.c b/ports/litex/supervisor/port.c index f5c362ea6e6de..4dea020652100 100644 --- a/ports/litex/supervisor/port.c +++ b/ports/litex/supervisor/port.c @@ -26,9 +26,9 @@ */ #include +#include "supervisor/board.h" #include "supervisor/port.h" #include "supervisor/shared/tick.h" -#include "boards/board.h" #include "irq.h" #include "csr.h" @@ -147,5 +147,5 @@ void port_interrupt_after_ticks(uint32_t ticks) { } // TODO: Add sleep support if the SoC supports sleep. -void port_sleep_until_interrupt(void) { +void port_idle_until_interrupt(void) { } diff --git a/ports/mimxrt10xx/board.h b/ports/mimxrt10xx/board.h new file mode 100644 index 0000000000000..1c9596e7d2ddd --- /dev/null +++ b/ports/mimxrt10xx/board.h @@ -0,0 +1 @@ +// Empty but needed for the SDK diff --git a/ports/mimxrt10xx/boards/feather_m7_1011/board.c b/ports/mimxrt10xx/boards/feather_m7_1011/board.c index ed543e1b06e63..1db1dd68614e6 100644 --- a/ports/mimxrt10xx/boards/feather_m7_1011/board.c +++ b/ports/mimxrt10xx/boards/feather_m7_1011/board.c @@ -25,7 +25,8 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" +#include "boards/flash_config.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/mimxrt10xx/boards/feather_m7_1011/flash_config.c b/ports/mimxrt10xx/boards/feather_m7_1011/flash_config.c index 282464c75de09..9ba3e168f504a 100644 --- a/ports/mimxrt10xx/boards/feather_m7_1011/flash_config.c +++ b/ports/mimxrt10xx/boards/feather_m7_1011/flash_config.c @@ -5,9 +5,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "fsl_flexspi_nor_boot.h" -#include "boards/board.h" +#include "boards/flash_config.h" +#include "fsl_flexspi_nor_boot.h" __attribute__((section(".boot_hdr.ivt"))) /************************************* diff --git a/ports/mimxrt10xx/boards/feather_m7_1011/pins.c b/ports/mimxrt10xx/boards/feather_m7_1011/pins.c index 09e3217614e76..04fbeea59b834 100644 --- a/ports/mimxrt10xx/boards/feather_m7_1011/pins.c +++ b/ports/mimxrt10xx/boards/feather_m7_1011/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { // Analog diff --git a/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c b/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c index ed543e1b06e63..1db1dd68614e6 100644 --- a/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c +++ b/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c @@ -25,7 +25,8 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" +#include "boards/flash_config.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/mimxrt10xx/boards/feather_mimxrt1011/flash_config.c b/ports/mimxrt10xx/boards/feather_mimxrt1011/flash_config.c index 51cc0f164bc0c..eafc9ac3af1fd 100644 --- a/ports/mimxrt10xx/boards/feather_mimxrt1011/flash_config.c +++ b/ports/mimxrt10xx/boards/feather_mimxrt1011/flash_config.c @@ -5,9 +5,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "fsl_flexspi_nor_boot.h" -#include "boards/board.h" +#include "boards/flash_config.h" +#include "fsl_flexspi_nor_boot.h" __attribute__((section(".boot_hdr.ivt"))) /************************************* diff --git a/ports/mimxrt10xx/boards/feather_mimxrt1011/pins.c b/ports/mimxrt10xx/boards/feather_mimxrt1011/pins.c index 2c6c1ce93ec3a..4e5de8de276a4 100644 --- a/ports/mimxrt10xx/boards/feather_mimxrt1011/pins.c +++ b/ports/mimxrt10xx/boards/feather_mimxrt1011/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { // Analog diff --git a/ports/mimxrt10xx/boards/feather_mimxrt1062/board.c b/ports/mimxrt10xx/boards/feather_mimxrt1062/board.c index 9878a62a294d3..26f55f96e1354 100644 --- a/ports/mimxrt10xx/boards/feather_mimxrt1062/board.c +++ b/ports/mimxrt10xx/boards/feather_mimxrt1062/board.c @@ -25,7 +25,8 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" +#include "boards/flash_config.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/mimxrt10xx/boards/feather_mimxrt1062/flash_config.c b/ports/mimxrt10xx/boards/feather_mimxrt1062/flash_config.c index 51cc0f164bc0c..fef1c11e3e482 100644 --- a/ports/mimxrt10xx/boards/feather_mimxrt1062/flash_config.c +++ b/ports/mimxrt10xx/boards/feather_mimxrt1062/flash_config.c @@ -5,8 +5,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include "boards/flash_config.h" + #include "fsl_flexspi_nor_boot.h" -#include "boards/board.h" __attribute__((section(".boot_hdr.ivt"))) diff --git a/ports/mimxrt10xx/boards/feather_mimxrt1062/pins.c b/ports/mimxrt10xx/boards/feather_mimxrt1062/pins.c index eb287b87aa072..d372b951f613c 100644 --- a/ports/mimxrt10xx/boards/feather_mimxrt1062/pins.c +++ b/ports/mimxrt10xx/boards/feather_mimxrt1062/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { // Analog diff --git a/ports/mimxrt10xx/boards/board.h b/ports/mimxrt10xx/boards/flash_config.h similarity index 75% rename from ports/mimxrt10xx/boards/board.h rename to ports/mimxrt10xx/boards/flash_config.h index 678c223ae0d6a..25f1550ae8ba2 100644 --- a/ports/mimxrt10xx/boards/board.h +++ b/ports/mimxrt10xx/boards/flash_config.h @@ -26,26 +26,16 @@ // This file defines board specific functions. -#ifndef MICROPY_INCLUDED_MIMXRT10XX_BOARDS_BOARD_H -#define MICROPY_INCLUDED_MIMXRT10XX_BOARDS_BOARD_H +#ifndef MICROPY_INCLUDED_MIMXRT10XX_BOARDS_FLASH_CONFIG_H +#define MICROPY_INCLUDED_MIMXRT10XX_BOARDS_FLASH_CONFIG_H #include -#include "py/mpconfig.h" +#include "mpconfigboard.h" // For flash size settings + #include "fsl_common.h" #include "fsl_flexspi_nor_config.h" -// Initializes board related state once on start up. -void board_init(void); - -// Returns true if the user initiates safe mode in a board specific way. -// Also add BOARD_USER_SAFE_MODE in mpconfigboard.h to explain the board specific -// way. -bool board_requests_safe_mode(void); - -// Reset the state of off MCU components such as neopixels. -void reset_board(void); - #define SEQUENCE(first, second, third, fourth) first, second, third, fourth #define TWO_EMPTY_STEPS 0x00000000 #define EMPTY_SEQUENCE SEQUENCE(TWO_EMPTY_STEPS, TWO_EMPTY_STEPS, TWO_EMPTY_STEPS, TWO_EMPTY_STEPS) @@ -53,4 +43,4 @@ void reset_board(void); // FlexSPI configuration that stores command info. extern const flexspi_nor_config_t qspiflash_config; -#endif // MICROPY_INCLUDED_MIMXRT10XX_BOARDS_BOARD_H +#endif // MICROPY_INCLUDED_MIMXRT10XX_BOARDS_FLASH_CONFIG_H diff --git a/ports/mimxrt10xx/boards/imxrt1010_evk/board.c b/ports/mimxrt10xx/boards/imxrt1010_evk/board.c index ba3498581c511..8519893a5f73f 100644 --- a/ports/mimxrt10xx/boards/imxrt1010_evk/board.c +++ b/ports/mimxrt10xx/boards/imxrt1010_evk/board.c @@ -25,7 +25,8 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" +#include "boards/flash_config.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/mimxrt10xx/boards/imxrt1010_evk/flash_config.c b/ports/mimxrt10xx/boards/imxrt1010_evk/flash_config.c index 19573bd993edd..00ee47c98530c 100644 --- a/ports/mimxrt10xx/boards/imxrt1010_evk/flash_config.c +++ b/ports/mimxrt10xx/boards/imxrt1010_evk/flash_config.c @@ -5,8 +5,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include "boards/flash_config.h" + #include "fsl_flexspi_nor_boot.h" -#include "boards/board.h" __attribute__((section(".boot_hdr.ivt"))) diff --git a/ports/mimxrt10xx/boards/imxrt1010_evk/pins.c b/ports/mimxrt10xx/boards/imxrt1010_evk/pins.c index a0221a2ad2443..4aad9aaeb3324 100644 --- a/ports/mimxrt10xx/boards/imxrt1010_evk/pins.c +++ b/ports/mimxrt10xx/boards/imxrt1010_evk/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO_09) }, diff --git a/ports/mimxrt10xx/boards/imxrt1020_evk/board.c b/ports/mimxrt10xx/boards/imxrt1020_evk/board.c index d5166b35600ed..531c0c6f62e31 100644 --- a/ports/mimxrt10xx/boards/imxrt1020_evk/board.c +++ b/ports/mimxrt10xx/boards/imxrt1020_evk/board.c @@ -25,7 +25,8 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" +#include "boards/flash_config.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/mimxrt10xx/boards/imxrt1020_evk/flash_config.c b/ports/mimxrt10xx/boards/imxrt1020_evk/flash_config.c index 40b566618e554..4c3ba471797ec 100644 --- a/ports/mimxrt10xx/boards/imxrt1020_evk/flash_config.c +++ b/ports/mimxrt10xx/boards/imxrt1020_evk/flash_config.c @@ -5,8 +5,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include "boards/flash_config.h" + #include "fsl_flexspi_nor_boot.h" -#include "boards/board.h" __attribute__((section(".boot_hdr.ivt"))) diff --git a/ports/mimxrt10xx/boards/imxrt1020_evk/pins.c b/ports/mimxrt10xx/boards/imxrt1020_evk/pins.c index ef8115a64fd71..2052a12429e92 100644 --- a/ports/mimxrt10xx/boards/imxrt1020_evk/pins.c +++ b/ports/mimxrt10xx/boards/imxrt1020_evk/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO_AD_B1_09) }, diff --git a/ports/mimxrt10xx/boards/imxrt1060_evk/board.c b/ports/mimxrt10xx/boards/imxrt1060_evk/board.c index 25bc4e8c9d45b..e7d74ab49f73b 100644 --- a/ports/mimxrt10xx/boards/imxrt1060_evk/board.c +++ b/ports/mimxrt10xx/boards/imxrt1060_evk/board.c @@ -25,7 +25,8 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" +#include "boards/flash_config.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/mimxrt10xx/boards/imxrt1060_evk/flash_config.c b/ports/mimxrt10xx/boards/imxrt1060_evk/flash_config.c index d79a8d0f91f0d..502e21a3b09bb 100644 --- a/ports/mimxrt10xx/boards/imxrt1060_evk/flash_config.c +++ b/ports/mimxrt10xx/boards/imxrt1060_evk/flash_config.c @@ -5,8 +5,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include "boards/flash_config.h" + #include "fsl_flexspi_nor_boot.h" -#include "boards/board.h" __attribute__((section(".boot_hdr.ivt"))) diff --git a/ports/mimxrt10xx/boards/imxrt1060_evk/pins.c b/ports/mimxrt10xx/boards/imxrt1060_evk/pins.c index 2d268952d1e79..b24e4dc86d8e3 100644 --- a/ports/mimxrt10xx/boards/imxrt1060_evk/pins.c +++ b/ports/mimxrt10xx/boards/imxrt1060_evk/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO_AD_B1_07) }, diff --git a/ports/mimxrt10xx/boards/metro_m7_1011/board.c b/ports/mimxrt10xx/boards/metro_m7_1011/board.c index ed543e1b06e63..1db1dd68614e6 100644 --- a/ports/mimxrt10xx/boards/metro_m7_1011/board.c +++ b/ports/mimxrt10xx/boards/metro_m7_1011/board.c @@ -25,7 +25,8 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" +#include "boards/flash_config.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/mimxrt10xx/boards/metro_m7_1011/flash_config.c b/ports/mimxrt10xx/boards/metro_m7_1011/flash_config.c index 30ce67523e470..991bc43e45c32 100644 --- a/ports/mimxrt10xx/boards/metro_m7_1011/flash_config.c +++ b/ports/mimxrt10xx/boards/metro_m7_1011/flash_config.c @@ -5,8 +5,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include "boards/flash_config.h" + #include "fsl_flexspi_nor_boot.h" -#include "boards/board.h" __attribute__((section(".boot_hdr.ivt"))) diff --git a/ports/mimxrt10xx/boards/metro_m7_1011/pins.c b/ports/mimxrt10xx/boards/metro_m7_1011/pins.c index e88493413480b..ea9ae55290a16 100644 --- a/ports/mimxrt10xx/boards/metro_m7_1011/pins.c +++ b/ports/mimxrt10xx/boards/metro_m7_1011/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { // Analog diff --git a/ports/mimxrt10xx/boards/teensy40/board.c b/ports/mimxrt10xx/boards/teensy40/board.c index 09f0bf3f2a036..33ad5ff04a0f7 100644 --- a/ports/mimxrt10xx/boards/teensy40/board.c +++ b/ports/mimxrt10xx/boards/teensy40/board.c @@ -25,7 +25,8 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" +#include "boards/flash_config.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/mimxrt10xx/boards/teensy40/flash_config.c b/ports/mimxrt10xx/boards/teensy40/flash_config.c index 30ce67523e470..991bc43e45c32 100644 --- a/ports/mimxrt10xx/boards/teensy40/flash_config.c +++ b/ports/mimxrt10xx/boards/teensy40/flash_config.c @@ -5,8 +5,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include "boards/flash_config.h" + #include "fsl_flexspi_nor_boot.h" -#include "boards/board.h" __attribute__((section(".boot_hdr.ivt"))) diff --git a/ports/mimxrt10xx/boards/teensy40/pins.c b/ports/mimxrt10xx/boards/teensy40/pins.c index 9066ce0d2096c..64b4aa7f69e24 100644 --- a/ports/mimxrt10xx/boards/teensy40/pins.c +++ b/ports/mimxrt10xx/boards/teensy40/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { // With USB on left. Bottom edge. diff --git a/ports/mimxrt10xx/boards/teensy41/board.c b/ports/mimxrt10xx/boards/teensy41/board.c index 09f0bf3f2a036..33ad5ff04a0f7 100644 --- a/ports/mimxrt10xx/boards/teensy41/board.c +++ b/ports/mimxrt10xx/boards/teensy41/board.c @@ -25,7 +25,8 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" +#include "boards/flash_config.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/mimxrt10xx/boards/teensy41/flash_config.c b/ports/mimxrt10xx/boards/teensy41/flash_config.c index 7b2bfb768dc06..c0e0c86f98d90 100644 --- a/ports/mimxrt10xx/boards/teensy41/flash_config.c +++ b/ports/mimxrt10xx/boards/teensy41/flash_config.c @@ -5,8 +5,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include "boards/flash_config.h" + #include "fsl_flexspi_nor_boot.h" -#include "boards/board.h" __attribute__((section(".boot_hdr.ivt"))) diff --git a/ports/mimxrt10xx/boards/teensy41/pins.c b/ports/mimxrt10xx/boards/teensy41/pins.c index 5eb5ab0f553c5..cf245130196de 100644 --- a/ports/mimxrt10xx/boards/teensy41/pins.c +++ b/ports/mimxrt10xx/boards/teensy41/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { // With USB on left. Bottom edge. diff --git a/ports/mimxrt10xx/supervisor/flexspi_nor_flash_ops.c b/ports/mimxrt10xx/supervisor/flexspi_nor_flash_ops.c index 353ba3176de38..bd471f93055f2 100644 --- a/ports/mimxrt10xx/supervisor/flexspi_nor_flash_ops.c +++ b/ports/mimxrt10xx/supervisor/flexspi_nor_flash_ops.c @@ -9,7 +9,7 @@ #include "fsl_flexspi.h" #include "internal_flash.h" -#include "boards/board.h" +#include "boards/flash_config.h" #include "supervisor/linker.h" status_t PLACE_IN_ITCM(flexspi_nor_write_enable)(FLEXSPI_Type *base, uint32_t baseAddr) diff --git a/ports/mimxrt10xx/supervisor/internal_flash.c b/ports/mimxrt10xx/supervisor/internal_flash.c index e194cbed96ee4..9c0d9f89562d4 100644 --- a/ports/mimxrt10xx/supervisor/internal_flash.c +++ b/ports/mimxrt10xx/supervisor/internal_flash.c @@ -30,7 +30,7 @@ #include #include -#include "boards/board.h" +#include "boards/flash_config.h" #include "extmod/vfs.h" #include "extmod/vfs_fat.h" #include "py/mphal.h" diff --git a/ports/mimxrt10xx/supervisor/port.c b/ports/mimxrt10xx/supervisor/port.c index 1be2b10396c92..33a85d2b72b5b 100644 --- a/ports/mimxrt10xx/supervisor/port.c +++ b/ports/mimxrt10xx/supervisor/port.c @@ -31,7 +31,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "boards/board.h" +#include "supervisor/board.h" #include "supervisor/port.h" #include "fsl_device_registers.h" @@ -403,7 +403,7 @@ void port_interrupt_after_ticks(uint32_t ticks) { SNVS->HPCR |= SNVS_HPCR_HPTA_EN_MASK; } -void port_sleep_until_interrupt(void) { +void port_idle_until_interrupt(void) { // App note here: https://www.nxp.com/docs/en/application-note/AN12085.pdf // Clear the FPU interrupt because it can prevent us from sleeping. diff --git a/ports/nrf/boards/ADM_B_NRF52840_1/board.c b/ports/nrf/boards/ADM_B_NRF52840_1/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/nrf/boards/ADM_B_NRF52840_1/board.c +++ b/ports/nrf/boards/ADM_B_NRF52840_1/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/TG-Watch02A/board.c b/ports/nrf/boards/TG-Watch02A/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/nrf/boards/TG-Watch02A/board.c +++ b/ports/nrf/boards/TG-Watch02A/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/aramcon_badge_2019/board.c b/ports/nrf/boards/aramcon_badge_2019/board.c index efb449285b97b..8f3830b0001b6 100644 --- a/ports/nrf/boards/aramcon_badge_2019/board.c +++ b/ports/nrf/boards/aramcon_badge_2019/board.c @@ -25,7 +25,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "common-hal/microcontroller/Pin.h" void board_init(void) { diff --git a/ports/nrf/boards/arduino_nano_33_ble/board.c b/ports/nrf/boards/arduino_nano_33_ble/board.c index ddfcde2848b74..d1689e9ddc16c 100644 --- a/ports/nrf/boards/arduino_nano_33_ble/board.c +++ b/ports/nrf/boards/arduino_nano_33_ble/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "nrf.h" #include "nrf_rtc.h" diff --git a/ports/nrf/boards/bless_dev_board_multi_sensor/board.c b/ports/nrf/boards/bless_dev_board_multi_sensor/board.c index 71b9a065771d6..6970294ecc0d4 100644 --- a/ports/nrf/boards/bless_dev_board_multi_sensor/board.c +++ b/ports/nrf/boards/bless_dev_board_multi_sensor/board.c @@ -1,4 +1,4 @@ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/board.h b/ports/nrf/boards/board.h deleted file mode 100644 index ec98f04fbe0ff..0000000000000 --- a/ports/nrf/boards/board.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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. - */ - -// This file defines board specific functions. - -#ifndef MICROPY_INCLUDED_NRF_BOARDS_BOARD_H -#define MICROPY_INCLUDED_NRF_BOARDS_BOARD_H - -#include - -// Initializes board related state once on start up. -void board_init(void); - -// Returns true if the user initiates safe mode in a board specific way. -// Also add BOARD_USER_SAFE_MODE in mpconfigboard.h to explain the board specific -// way. -bool board_requests_safe_mode(void); - -// Reset the state of off MCU components such as neopixels. -void reset_board(void); - -#endif // MICROPY_INCLUDED_NRF_BOARDS_BOARD_H diff --git a/ports/nrf/boards/circuitplayground_bluefruit/board.c b/ports/nrf/boards/circuitplayground_bluefruit/board.c index 3aa6857da2ded..ff731d8f987fa 100644 --- a/ports/nrf/boards/circuitplayground_bluefruit/board.c +++ b/ports/nrf/boards/circuitplayground_bluefruit/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "py/obj.h" #include "peripherals/nrf/pins.h" @@ -49,5 +49,5 @@ void reset_board(void) { NRF_GPIO_PIN_NOSENSE); nrf_gpio_pin_write(POWER_SWITCH_PIN->number, false); - board_reset_user_neopixels(); + board_reset_user_neopixels(&pin_P0_13, 10); } diff --git a/ports/nrf/boards/clue_nrf52840_express/board.c b/ports/nrf/boards/clue_nrf52840_express/board.c index 523bd7677ba9d..cd46ce75d3257 100644 --- a/ports/nrf/boards/clue_nrf52840_express/board.c +++ b/ports/nrf/boards/clue_nrf52840_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/busio/SPI.h" diff --git a/ports/nrf/boards/clue_nrf52840_express/pins.c b/ports/nrf/boards/clue_nrf52840_express/pins.c index ab0738893cb36..61d77cedc956f 100644 --- a/ports/nrf/boards/clue_nrf52840_express/pins.c +++ b/ports/nrf/boards/clue_nrf52840_express/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_module_globals_table[] = { diff --git a/ports/nrf/boards/electronut_labs_blip/board.c b/ports/nrf/boards/electronut_labs_blip/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/nrf/boards/electronut_labs_blip/board.c +++ b/ports/nrf/boards/electronut_labs_blip/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/electronut_labs_papyr/board.c b/ports/nrf/boards/electronut_labs_papyr/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/nrf/boards/electronut_labs_papyr/board.c +++ b/ports/nrf/boards/electronut_labs_papyr/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/feather_bluefruit_sense/board.c b/ports/nrf/boards/feather_bluefruit_sense/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/nrf/boards/feather_bluefruit_sense/board.c +++ b/ports/nrf/boards/feather_bluefruit_sense/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/feather_nrf52840_express/board.c b/ports/nrf/boards/feather_nrf52840_express/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/nrf/boards/feather_nrf52840_express/board.c +++ b/ports/nrf/boards/feather_nrf52840_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/hiibot_bluefi/board.c b/ports/nrf/boards/hiibot_bluefi/board.c index 93e31aef0c3c6..a3fd5cf12907e 100644 --- a/ports/nrf/boards/hiibot_bluefi/board.c +++ b/ports/nrf/boards/hiibot_bluefi/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/busio/SPI.h" diff --git a/ports/nrf/boards/hiibot_bluefi/pins.c b/ports/nrf/boards/hiibot_bluefi/pins.c index bce4ee52dd4ab..c7879c4c21b79 100644 --- a/ports/nrf/boards/hiibot_bluefi/pins.c +++ b/ports/nrf/boards/hiibot_bluefi/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_module_globals_table[] = { diff --git a/ports/nrf/boards/ikigaisense_vita/board.c b/ports/nrf/boards/ikigaisense_vita/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/nrf/boards/ikigaisense_vita/board.c +++ b/ports/nrf/boards/ikigaisense_vita/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/itsybitsy_nrf52840_express/board.c b/ports/nrf/boards/itsybitsy_nrf52840_express/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/nrf/boards/itsybitsy_nrf52840_express/board.c +++ b/ports/nrf/boards/itsybitsy_nrf52840_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/makerdiary_m60_keyboard/board.c b/ports/nrf/boards/makerdiary_m60_keyboard/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/nrf/boards/makerdiary_m60_keyboard/board.c +++ b/ports/nrf/boards/makerdiary_m60_keyboard/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/makerdiary_m60_keyboard/pins.c b/ports/nrf/boards/makerdiary_m60_keyboard/pins.c index 63c3ad17114cc..fc85fa24b030d 100644 --- a/ports/nrf/boards/makerdiary_m60_keyboard/pins.c +++ b/ports/nrf/boards/makerdiary_m60_keyboard/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_module_globals_table[] = { diff --git a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/board.c b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/board.c index e08d00daca731..569106ec2ab9f 100644 --- a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/board.c +++ b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/board.c @@ -25,7 +25,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/busio/SPI.h" diff --git a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/pins.c b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/pins.c index 7dc6db18fa7bf..18928683308fb 100644 --- a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/pins.c +++ b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/pins.c @@ -1,6 +1,6 @@ #include "shared-bindings/board/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_module_globals_table[] = { diff --git a/ports/nrf/boards/makerdiary_nrf52840_mdk/board.c b/ports/nrf/boards/makerdiary_nrf52840_mdk/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/nrf/boards/makerdiary_nrf52840_mdk/board.c +++ b/ports/nrf/boards/makerdiary_nrf52840_mdk/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/board.c b/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/board.c +++ b/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/metro_nrf52840_express/board.c b/ports/nrf/boards/metro_nrf52840_express/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/nrf/boards/metro_nrf52840_express/board.c +++ b/ports/nrf/boards/metro_nrf52840_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/nice_nano/board.c b/ports/nrf/boards/nice_nano/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/nrf/boards/nice_nano/board.c +++ b/ports/nrf/boards/nice_nano/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/ohs2020_badge/board.c b/ports/nrf/boards/ohs2020_badge/board.c index ec52690ced748..20abf4e2a91a5 100644 --- a/ports/nrf/boards/ohs2020_badge/board.c +++ b/ports/nrf/boards/ohs2020_badge/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/busio/SPI.h" diff --git a/ports/nrf/boards/particle_argon/board.c b/ports/nrf/boards/particle_argon/board.c index f891f54a13da7..a41f0ae06ed23 100644 --- a/ports/nrf/boards/particle_argon/board.c +++ b/ports/nrf/boards/particle_argon/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/particle_boron/board.c b/ports/nrf/boards/particle_boron/board.c index f891f54a13da7..a41f0ae06ed23 100644 --- a/ports/nrf/boards/particle_boron/board.c +++ b/ports/nrf/boards/particle_boron/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/particle_xenon/board.c b/ports/nrf/boards/particle_xenon/board.c index f891f54a13da7..a41f0ae06ed23 100644 --- a/ports/nrf/boards/particle_xenon/board.c +++ b/ports/nrf/boards/particle_xenon/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/pca10056/board.c b/ports/nrf/boards/pca10056/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/nrf/boards/pca10056/board.c +++ b/ports/nrf/boards/pca10056/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/pca10059/board.c b/ports/nrf/boards/pca10059/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/nrf/boards/pca10059/board.c +++ b/ports/nrf/boards/pca10059/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/pca10100/board.c b/ports/nrf/boards/pca10100/board.c index f891f54a13da7..a41f0ae06ed23 100644 --- a/ports/nrf/boards/pca10100/board.c +++ b/ports/nrf/boards/pca10100/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/pitaya_go/board.c b/ports/nrf/boards/pitaya_go/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/nrf/boards/pitaya_go/board.c +++ b/ports/nrf/boards/pitaya_go/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/raytac_mdbt50q-db-40/board.c b/ports/nrf/boards/raytac_mdbt50q-db-40/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/nrf/boards/raytac_mdbt50q-db-40/board.c +++ b/ports/nrf/boards/raytac_mdbt50q-db-40/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/simmel/board.c b/ports/nrf/boards/simmel/board.c index f891f54a13da7..a41f0ae06ed23 100644 --- a/ports/nrf/boards/simmel/board.c +++ b/ports/nrf/boards/simmel/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/sparkfun_nrf52840_mini/board.c b/ports/nrf/boards/sparkfun_nrf52840_mini/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/nrf/boards/sparkfun_nrf52840_mini/board.c +++ b/ports/nrf/boards/sparkfun_nrf52840_mini/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/teknikio_bluebird/board.c b/ports/nrf/boards/teknikio_bluebird/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/nrf/boards/teknikio_bluebird/board.c +++ b/ports/nrf/boards/teknikio_bluebird/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/boards/tinkeringtech_scoutmakes_azul/board.c b/ports/nrf/boards/tinkeringtech_scoutmakes_azul/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/nrf/boards/tinkeringtech_scoutmakes_azul/board.c +++ b/ports/nrf/boards/tinkeringtech_scoutmakes_azul/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c index 5f1c9f1ba9195..00485d8588d19 100644 --- a/ports/nrf/supervisor/port.c +++ b/ports/nrf/supervisor/port.c @@ -26,7 +26,7 @@ #include #include "supervisor/port.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "nrfx/hal/nrf_clock.h" #include "nrfx/hal/nrf_power.h" @@ -307,7 +307,7 @@ void port_interrupt_after_ticks(uint32_t ticks) { nrfx_rtc_cc_set(&rtc_instance, 0, current_ticks + diff, true); } -void port_sleep_until_interrupt(void) { +void port_idle_until_interrupt(void) { #if defined(MICROPY_QSPI_CS) qspi_disable(); #endif diff --git a/ports/stm/boards/board.h b/ports/stm/boards/board.h deleted file mode 100644 index 22d9e99be091e..0000000000000 --- a/ports/stm/boards/board.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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. - */ - -// This file defines board specific functions. - -#ifndef MICROPY_INCLUDED_STM32F4_BOARDS_BOARD_H -#define MICROPY_INCLUDED_STM32F4_BOARDS_BOARD_H - -#include - -// Initializes board related state once on start up. -void board_init(void); - -// Returns true if the user initiates safe mode in a board specific way. -// Also add BOARD_USER_SAFE_MODE in mpconfigboard.h to explain the board specific -// way. -bool board_requests_safe_mode(void); - -// Reset the state of off MCU components such as neopixels. -void reset_board(void); - -#endif // MICROPY_INCLUDED_STM32F4_BOARDS_BOARD_H diff --git a/ports/stm/boards/espruino_pico/board.c b/ports/stm/boards/espruino_pico/board.c index 82b0c506edcfc..f8e462f938255 100644 --- a/ports/stm/boards/espruino_pico/board.c +++ b/ports/stm/boards/espruino_pico/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) { diff --git a/ports/stm/boards/espruino_wifi/board.c b/ports/stm/boards/espruino_wifi/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/stm/boards/espruino_wifi/board.c +++ b/ports/stm/boards/espruino_wifi/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/stm/boards/feather_stm32f405_express/board.c b/ports/stm/boards/feather_stm32f405_express/board.c index 82b0c506edcfc..f8e462f938255 100644 --- a/ports/stm/boards/feather_stm32f405_express/board.c +++ b/ports/stm/boards/feather_stm32f405_express/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) { diff --git a/ports/stm/boards/meowbit_v121/board.c b/ports/stm/boards/meowbit_v121/board.c index f67b4a49db4a3..4a8014a3a1093 100644 --- a/ports/stm/boards/meowbit_v121/board.c +++ b/ports/stm/boards/meowbit_v121/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/board/__init__.h" diff --git a/ports/stm/boards/nucleo_f746zg/board.c b/ports/stm/boards/nucleo_f746zg/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/stm/boards/nucleo_f746zg/board.c +++ b/ports/stm/boards/nucleo_f746zg/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/stm/boards/nucleo_f767zi/board.c b/ports/stm/boards/nucleo_f767zi/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/stm/boards/nucleo_f767zi/board.c +++ b/ports/stm/boards/nucleo_f767zi/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/stm/boards/nucleo_h743zi_2/board.c b/ports/stm/boards/nucleo_h743zi_2/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/stm/boards/nucleo_h743zi_2/board.c +++ b/ports/stm/boards/nucleo_h743zi_2/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/stm/boards/openmv_h7/board.c b/ports/stm/boards/openmv_h7/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/stm/boards/openmv_h7/board.c +++ b/ports/stm/boards/openmv_h7/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/stm/boards/pyb_nano_v2/board.c b/ports/stm/boards/pyb_nano_v2/board.c index 82b0c506edcfc..f8e462f938255 100644 --- a/ports/stm/boards/pyb_nano_v2/board.c +++ b/ports/stm/boards/pyb_nano_v2/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) { diff --git a/ports/stm/boards/pyboard_v11/board.c b/ports/stm/boards/pyboard_v11/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/stm/boards/pyboard_v11/board.c +++ b/ports/stm/boards/pyboard_v11/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/stm/boards/stm32f411ce_blackpill/board.c b/ports/stm/boards/stm32f411ce_blackpill/board.c index 82b0c506edcfc..f8e462f938255 100644 --- a/ports/stm/boards/stm32f411ce_blackpill/board.c +++ b/ports/stm/boards/stm32f411ce_blackpill/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" void board_init(void) { diff --git a/ports/stm/boards/stm32f411ve_discovery/board.c b/ports/stm/boards/stm32f411ve_discovery/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/stm/boards/stm32f411ve_discovery/board.c +++ b/ports/stm/boards/stm32f411ve_discovery/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/stm/boards/stm32f412zg_discovery/board.c b/ports/stm/boards/stm32f412zg_discovery/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/stm/boards/stm32f412zg_discovery/board.c +++ b/ports/stm/boards/stm32f412zg_discovery/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/stm/boards/stm32f4_discovery/board.c b/ports/stm/boards/stm32f4_discovery/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/stm/boards/stm32f4_discovery/board.c +++ b/ports/stm/boards/stm32f4_discovery/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/stm/boards/stm32f746g_discovery/board.c b/ports/stm/boards/stm32f746g_discovery/board.c index aafc69cf02485..db2c72727165d 100644 --- a/ports/stm/boards/stm32f746g_discovery/board.c +++ b/ports/stm/boards/stm32f746g_discovery/board.c @@ -25,7 +25,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "stm32f7xx_hal.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/stm/boards/thunderpack_v11/board.c b/ports/stm/boards/thunderpack_v11/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/stm/boards/thunderpack_v11/board.c +++ b/ports/stm/boards/thunderpack_v11/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/stm/boards/thunderpack_v12/board.c b/ports/stm/boards/thunderpack_v12/board.c index 4421970eefe4d..78179332815e6 100644 --- a/ports/stm/boards/thunderpack_v12/board.c +++ b/ports/stm/boards/thunderpack_v12/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/stm/common-hal/busio/SPI.c b/ports/stm/common-hal/busio/SPI.c index 29fbdee569109..20ee0f6e15790 100644 --- a/ports/stm/common-hal/busio/SPI.c +++ b/ports/stm/common-hal/busio/SPI.c @@ -32,7 +32,7 @@ #include "py/runtime.h" #include "shared-bindings/microcontroller/__init__.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "supervisor/shared/translate.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/stm/common-hal/sdioio/SDCard.c b/ports/stm/common-hal/sdioio/SDCard.c index 5f6010f01a8e5..de0e8d11194ce 100644 --- a/ports/stm/common-hal/sdioio/SDCard.c +++ b/ports/stm/common-hal/sdioio/SDCard.c @@ -31,7 +31,7 @@ #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/util.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "supervisor/shared/translate.h" #include "common-hal/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/stm/supervisor/port.c b/ports/stm/supervisor/port.c index dba1cf21ee983..3103a071606ec 100644 --- a/ports/stm/supervisor/port.c +++ b/ports/stm/supervisor/port.c @@ -27,7 +27,7 @@ #include #include "supervisor/port.h" -#include "boards/board.h" +#include "supervisor/board.h" #include "lib/timeutils/timeutils.h" #include "common-hal/microcontroller/Pin.h" @@ -436,7 +436,7 @@ void port_interrupt_after_ticks(uint32_t ticks) { alarmed_already = false; } -void port_sleep_until_interrupt(void) { +void port_idle_until_interrupt(void) { // Clear the FPU interrupt because it can prevent us from sleeping. if (__get_FPSCR() & ~(0x9f)) { __set_FPSCR(__get_FPSCR() & ~(0x9f)); diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index f04112bfcd72a..0bd889ccdfbdf 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -912,6 +912,12 @@ void supervisor_run_background_tasks_if_tick(void); #define CIRCUITPY_PYSTACK_SIZE 1536 #endif + +// Wait this long imediately after startup to see if we are connected to USB. +#ifndef CIRCUITPY_USB_CONNECTED_SLEEP_DELAY +#define CIRCUITPY_USB_CONNECTED_SLEEP_DELAY 5 +#endif + #define CIRCUITPY_BOOT_OUTPUT_FILE "/boot_out.txt" #define CIRCUITPY_VERBOSE_BLE 0 diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index a1f1a2f8c2056..5420b8404bb92 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -36,9 +36,6 @@ #include "supervisor/shared/autoreload.h" #include "supervisor/shared/workflow.h" -// Wait this long imediately after startup to see if we are connected to USB. -#define CIRCUITPY_USB_CONNECTED_SLEEP_DELAY 5 - //| """Alarms and sleep //| //| Provides alarms that trigger based on time intervals or on external events, such as pin @@ -93,21 +90,13 @@ void validate_objs_are_alarms(size_t n_args, const mp_obj_t *objs) { //| ... //| STATIC mp_obj_t alarm_light_sleep_until_alarms(size_t n_args, const mp_obj_t *args) { - validate_objs_are_alarms(n_args, args); - - // See if we are connected to a host. - // Make sure we have been awake long enough for USB to connect (enumeration delay). - int64_t connecting_delay_msec = CIRCUITPY_USB_CONNECTED_SLEEP_DELAY * 1024 - supervisor_ticks_ms64(); - if (connecting_delay_msec > 0) { - common_hal_time_delay_ms(connecting_delay_msec * 1000 / 1024); + if (n_args == 0) { + return mp_const_none; } - if (supervisor_workflow_active()) { - common_hal_alarm_wait_until_alarms(n_args, args); - } else { - common_hal_alarm_light_sleep_until_alarms(n_args, args); - } - return mp_const_none; + validate_objs_are_alarms(n_args, args); + + return common_hal_alarm_light_sleep_until_alarms(n_args, args); } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_light_sleep_until_alarms_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_light_sleep_until_alarms); @@ -151,26 +140,13 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_light_sleep_until_alarms_obj, 1, MP_OB STATIC mp_obj_t alarm_exit_and_deep_sleep_until_alarms(size_t n_args, const mp_obj_t *args) { validate_objs_are_alarms(n_args, args); - // Shut down WiFi, etc. - common_hal_alarm_prepare_for_deep_sleep(); + // Validate the alarms and set them. + common_hal_alarm_set_deep_sleep_alarms(n_args, args); - // See if we are connected to a host. - // Make sure we have been awake long enough for USB to connect (enumeration delay). - int64_t connecting_delay_msec = CIRCUITPY_USB_CONNECTED_SLEEP_DELAY * 1024 - supervisor_ticks_ms64(); - if (connecting_delay_msec > 0) { - common_hal_time_delay_ms(connecting_delay_msec * 1000 / 1024); - } + // Raise an exception, which will be processed in main.c. + mp_raise_arg1(&mp_type_DeepSleepRequest, NULL); - if (supervisor_workflow_active()) { - // Simulate deep sleep by waiting for an alarm and then restarting when done. - common_hal_alarm_wait_until_alarms(n_args, args); - reload_requested = true; - supervisor_set_run_reason(RUN_REASON_STARTUP); - mp_raise_reload_exception(); - } else { - common_hal_alarm_exit_and_deep_sleep_until_alarms(n_args, args); - // Does not return. - } + // Doesn't get here. return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_exit_and_deep_sleep_until_alarms_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_exit_and_deep_sleep_until_alarms); diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h index 380c65ea8c3c9..5a8c613d9d55a 100644 --- a/shared-bindings/alarm/__init__.h +++ b/shared-bindings/alarm/__init__.h @@ -31,13 +31,22 @@ #include "common-hal/alarm/__init__.h" -extern mp_obj_t common_hal_alarm_wait_until_alarms(size_t n_alarms, const mp_obj_t *alarms); extern mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms); -extern void common_hal_alarm_exit_and_deep_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms); -extern void common_hal_alarm_prepare_for_deep_sleep(void); -extern NORETURN void common_hal_alarm_enter_deep_sleep(void); + +// Deep sleep is a two step process. Alarms are set when the VM is valid but +// everything is reset before entering deep sleep. Furthermore, deep sleep may +// not actually happen if the user is connected to the device. In this case, the +// supervisor will idle using `port_wait_for_interrupt`. After each call, it will +// call alarm_woken_from_sleep to see if we've been woken by an alarm and if so, +// it will exit idle as if deep sleep was exited. +extern void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms); +// Deep sleep is entered outside of the VM so we omit the `common_hal_` prefix. +extern NORETURN void alarm_enter_deep_sleep(void); // Used by wake-up code. extern void common_hal_alarm_set_wake_alarm(mp_obj_t alarm); +// True if an alarm is alerting. This is most useful for pretend deep sleep. +extern bool alarm_woken_from_sleep(void); + #endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM___INIT___H diff --git a/ports/esp32s2/boards/board.h b/supervisor/board.h similarity index 77% rename from ports/esp32s2/boards/board.h rename to supervisor/board.h index 2f0db81356f23..939ee1c194ef4 100644 --- a/ports/esp32s2/boards/board.h +++ b/supervisor/board.h @@ -24,22 +24,30 @@ * THE SOFTWARE. */ -// This file defines board specific functions. - -#ifndef MICROPY_INCLUDED_ESP32S2_BOARDS_BOARD_H -#define MICROPY_INCLUDED_ESP32S2_BOARDS_BOARD_H +#ifndef MICROPY_INCLUDED_SUPERVISOR_BOARD_H +#define MICROPY_INCLUDED_SUPERVISOR_BOARD_H #include -// Initializes board related state once on start up. -void board_init(void); +#include "supervisor/shared/safe_mode.h" // Returns true if the user initiates safe mode in a board specific way. // Also add BOARD_USER_SAFE_MODE in mpconfigboard.h to explain the board specific // way. bool board_requests_safe_mode(void); +// Initializes board related state once on start up. +void board_init(void); + // Reset the state of off MCU components such as neopixels. void reset_board(void); -#endif // MICROPY_INCLUDED_ESP32S2_BOARDS_BOARD_H +#if CIRCUITPY_ALARM +// Deinit the board. This should put the board in deep sleep durable, low power +// state. It should not prevent the user access method from working (such as +// disabling USB, BLE or flash) because CircuitPython may continue to run. +void board_deinit(void); +#endif + + +#endif // MICROPY_INCLUDED_SUPERVISOR_BOARD_H diff --git a/supervisor/port.h b/supervisor/port.h index 5bc06bc4e1413..862400986b801 100644 --- a/supervisor/port.h +++ b/supervisor/port.h @@ -49,9 +49,6 @@ void reset_cpu(void) NORETURN; // Reset the microcontroller state. void reset_port(void); -// Reset the rest of the board. -void reset_board(void); - // Reset to the bootloader void reset_to_bootloader(void) NORETURN; @@ -89,8 +86,9 @@ void port_disable_tick(void); // Only the common sleep routine should use it. void port_interrupt_after_ticks(uint32_t ticks); -// Sleep the CPU until an interrupt is received. -void port_sleep_until_interrupt(void); +// Sleep the CPU until an interrupt is received. We call this idle because it +// may not be a system level sleep. +void port_idle_until_interrupt(void); // Execute port specific actions during background tasks. void port_background_task(void); @@ -100,4 +98,5 @@ void port_background_task(void); // work" should be done in port_background_task() instead. void port_start_background_task(void); void port_finish_background_task(void); + #endif // MICROPY_INCLUDED_SUPERVISOR_PORT_H diff --git a/supervisor/shared/board.c b/supervisor/shared/board.c index e3eb8fd0d7aa1..111aa0e3c9c4b 100644 --- a/supervisor/shared/board.c +++ b/supervisor/shared/board.c @@ -26,23 +26,22 @@ #include "supervisor/shared/board.h" -#include "shared-bindings/digitalio/DigitalInOut.h" -#include "shared-bindings/neopixel_write/__init__.h" +#if CIRCUITPY_DIGITALIO && CIRCUITPY_NEOPIXEL_WRITE -#ifdef USER_NEOPIXELS_PIN +#include -// The maximum number of user neopixels right now is 10, on Circuit Playgrounds. -// PyBadge and PyGamer have max 5 -#define USER_NEOPIXELS_MAX_COUNT 10 +#include "shared-bindings/digitalio/DigitalInOut.h" +#include "shared-bindings/neopixel_write/__init__.h" -void board_reset_user_neopixels(void) { +void board_reset_user_neopixels(mcu_pin_obj_t* pin, size_t count) { // Turn off on-board NeoPixel string - uint8_t empty[USER_NEOPIXELS_MAX_COUNT * 3] = { 0 }; + uint8_t empty[count * 3]; + memset(empty, 0, count); digitalio_digitalinout_obj_t neopixel_pin; - common_hal_digitalio_digitalinout_construct(&neopixel_pin, USER_NEOPIXELS_PIN); + common_hal_digitalio_digitalinout_construct(&neopixel_pin, pin); common_hal_digitalio_digitalinout_switch_to_output(&neopixel_pin, false, DRIVE_MODE_PUSH_PULL); - common_hal_neopixel_write(&neopixel_pin, empty, USER_NEOPIXELS_MAX_COUNT * 3); + common_hal_neopixel_write(&neopixel_pin, empty, count * 3); common_hal_digitalio_digitalinout_deinit(&neopixel_pin); } diff --git a/supervisor/shared/board.h b/supervisor/shared/board.h index 0e4d73455d115..cdeefbf222194 100644 --- a/supervisor/shared/board.h +++ b/supervisor/shared/board.h @@ -24,15 +24,13 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SUPERVISOR_BOARD_H -#define MICROPY_INCLUDED_SUPERVISOR_BOARD_H +#ifndef MICROPY_INCLUDED_SUPERVISOR_SHARED_BOARD_H +#define MICROPY_INCLUDED_SUPERVISOR_SHARED_BOARD_H -#include "py/mpconfig.h" +#include -#ifdef USER_NEOPIXELS_PIN +#include "shared-bindings/microcontroller/Pin.h" -void board_reset_user_neopixels(void); +void board_reset_user_neopixels(mcu_pin_obj_t* pin, size_t count); -#endif - -#endif // MICROPY_INCLUDED_SUPERVISOR_BOARD_H +#endif // MICROPY_INCLUDED_SUPERVISOR_SHARED_BOARD_H diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c index a2855a570619f..d37a585eb226f 100644 --- a/supervisor/shared/tick.c +++ b/supervisor/shared/tick.c @@ -156,8 +156,8 @@ void mp_hal_delay_ms(mp_uint_t delay) { break; } port_interrupt_after_ticks(remaining); - // Sleep until an interrupt happens. - port_sleep_until_interrupt(); + // Idle until an interrupt happens. + port_idle_until_interrupt(); remaining = end_tick - port_get_raw_ticks(NULL); } } From d0a806d7975ecc2c653d23ee48e463f38b4f1194 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 8 Dec 2020 11:03:24 -0800 Subject: [PATCH 382/770] Enter safe mode after panic or brownout Uses the IDF's reset reason. Does nothing before reset. Fixes #3389 --- ports/esp32s2/supervisor/port.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 6222cd29041ba..5a50bda698be8 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -102,6 +102,14 @@ safe_mode_t port_init(void) { return NO_HEAP; } + esp_reset_reason_t reason = esp_reset_reason(); + if (reason == ESP_RST_BROWNOUT) { + return BROWNOUT; + } + if (reason == ESP_RST_PANIC) { + return HARD_CRASH; + } + return NO_SAFE_MODE; } From 0ff0bb9ec4b8f9f1af8729f52124ab18fc319829 Mon Sep 17 00:00:00 2001 From: Antonin ENFRUN Date: Tue, 8 Dec 2020 18:25:57 +0000 Subject: [PATCH 383/770] Translated using Weblate (French) Currently translated at 97.3% (852 of 875 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index 12d3feca027d7..22e5f76ebb772 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-11-27 23:57-0500\n" -"PO-Revision-Date: 2020-11-24 22:45+0000\n" +"PO-Revision-Date: 2020-12-08 19:21+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" "MIME-Version: 1.0\n" @@ -1303,7 +1303,7 @@ msgstr "Doit utiliser un multiple de 6 broches RVB, pas %d" #: ports/esp32s2/common-hal/nvm/ByteArray.c msgid "NVS Error" -msgstr "" +msgstr "Erreur NVS" #: py/parse.c msgid "Name too long" @@ -1326,7 +1326,7 @@ msgstr "Aucun canal DMA trouvé" #: shared-module/busdevice/I2CDevice.c #, c-format msgid "No I2C device at address: %x" -msgstr "" +msgstr "Pas de dispositif I2C à l'adresse : %x" #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c @@ -1468,7 +1468,7 @@ msgstr "Seules les adresses IPv4 sont prises en charge" #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Only IPv4 sockets supported" -msgstr "" +msgstr "Seules les sockets IPv4 sont prises en charge" #: shared-module/displayio/OnDiskBitmap.c #, c-format @@ -1554,7 +1554,7 @@ msgstr "Numéro de broche déjà réservé par EXTI" #: ports/esp32s2/common-hal/alarm/__init__.c msgid "PinAlarm not yet implemented" -msgstr "" +msgstr "PinAlarm pas encore implémenté" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format @@ -1772,7 +1772,7 @@ msgstr "Fournissez au moins une broche UART" #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" -msgstr "" +msgstr "Fournissez l'un de monotonic_time ou epoch_time" #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" From 1f14d393645d2f3939b8e378148b440ed237e2ce Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Tue, 8 Dec 2020 11:50:45 -0800 Subject: [PATCH 384/770] remove two extra closing angular brackets --- shared-bindings/msgpack/__init__.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index 0660ee78b925b..ade88b10ddc74 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -81,7 +81,7 @@ //| """ -//| def pack(obj: object, buffer: WriteableBuffer, *, default: Callable[[object], None]]=None) -> None: +//| def pack(obj: object, buffer: WriteableBuffer, *, default: Callable[[object], None]=None) -> None: //| """Ouput object to buffer in msgpack format. //| :param object obj: Object to convert to msgpack format. //| :param ~_typing.WriteableBuffer buffer: buffer to write into @@ -110,7 +110,7 @@ STATIC mp_obj_t mod_msgpack_pack(size_t n_args, const mp_obj_t *pos_args, mp_map } MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_pack_obj, 1, mod_msgpack_pack); -//| def unpack(buffer: ReadableBuffer, *, ext_hook: Callable[[int, bytes], object]]=None, use_list: bool=True) -> object: +//| def unpack(buffer: ReadableBuffer, *, ext_hook: Callable[[int, bytes], object]=None, use_list: bool=True) -> object: //| """Unpack and return one object from buffer. //| :param ~_typing.ReadableBuffer buffer: buffer to read from //| :param Optional[~_typing.Callable[[int, bytes], object]] ext_hook: function called for objects in From 0b4bcd9599cc07ff85d6a70297ae86ff3b02cdec Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 8 Dec 2020 13:05:21 -0800 Subject: [PATCH 385/770] Fix build and more comments --- main.c | 7 ++++++- ports/atmel-samd/boards/blm_badge/mpconfigboard.h | 2 -- .../boards/circuitplayground_express/mpconfigboard.h | 2 -- .../circuitplayground_express_crickit/mpconfigboard.h | 2 -- .../circuitplayground_express_displayio/mpconfigboard.h | 2 -- ports/atmel-samd/boards/pybadge/mpconfigboard.h | 2 -- ports/atmel-samd/boards/pybadge_airlift/mpconfigboard.h | 2 -- ports/atmel-samd/boards/pygamer/mpconfigboard.h | 2 -- ports/atmel-samd/boards/pygamer_advance/mpconfigboard.h | 2 -- ports/esp32s2/common-hal/alarm/time/TimeAlarm.c | 1 + .../nrf/boards/circuitplayground_bluefruit/mpconfigboard.h | 2 -- supervisor/shared/board.c | 2 +- supervisor/shared/board.h | 2 +- 13 files changed, 9 insertions(+), 21 deletions(-) diff --git a/main.c b/main.c index 9eb4787299331..5aa9131a0d893 100755 --- a/main.c +++ b/main.c @@ -391,7 +391,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { int64_t connecting_delay_ticks = CIRCUITPY_USB_CONNECTED_SLEEP_DELAY * 1024 - port_get_raw_ticks(NULL); if (connecting_delay_ticks > 0) { // Set when we've waited long enough so that we wake up from the - // sleep_until_interrupt below and loop around to the real deep + // port_idle_until_interrupt below and loop around to the real deep // sleep in the else clause. port_interrupt_after_ticks(connecting_delay_ticks); // Deep sleep if we're not connected to a host. @@ -414,6 +414,11 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { if (!asleep) { tick_rgb_status_animation(&animation); } else { + // This waits until a pretend deep sleep alarm occurs. They are set + // during common_hal_alarm_set_deep_sleep_alarms. On some platforms + // it may also return due to another interrupt, that's why we check + // for deep sleep alarms above. If it wasn't a deep sleep alarm, + // then we'll idle here again. port_idle_until_interrupt(); } } diff --git a/ports/atmel-samd/boards/blm_badge/mpconfigboard.h b/ports/atmel-samd/boards/blm_badge/mpconfigboard.h index 4f56d23b0a64b..7343455b807f1 100644 --- a/ports/atmel-samd/boards/blm_badge/mpconfigboard.h +++ b/ports/atmel-samd/boards/blm_badge/mpconfigboard.h @@ -13,8 +13,6 @@ #define DEFAULT_UART_BUS_RX (&pin_PA01) #define DEFAULT_UART_BUS_TX (&pin_PA00) -#define USER_NEOPIXELS_PIN (&pin_PA05) - #define IGNORE_PIN_PA09 1 #define IGNORE_PIN_PA12 1 #define IGNORE_PIN_PA13 1 diff --git a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h index 4321335e59d8c..e46e477e4e341 100644 --- a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +++ b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h @@ -30,8 +30,6 @@ // Increase stack size slightly due to CPX library import nesting #define CIRCUITPY_DEFAULT_STACK_SIZE (4248) //divisible by 8 -#define USER_NEOPIXELS_PIN (&pin_PB23) - #define DEFAULT_I2C_BUS_SCL (&pin_PB03) #define DEFAULT_I2C_BUS_SDA (&pin_PB02) diff --git a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h index 5673be29098bb..bc40554217e6a 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h +++ b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h @@ -24,8 +24,6 @@ #define CALIBRATE_CRYSTALLESS 1 -#define USER_NEOPIXELS_PIN (&pin_PB23) - // Explanation of how a user got into safe mode. #define BOARD_USER_SAFE_MODE_ACTION translate("pressing both buttons at start up.\n") diff --git a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h index fab235149d2c5..4b0c324faa0c2 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +++ b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h @@ -30,8 +30,6 @@ // Increase stack size slightly due to CPX library import nesting. #define CIRCUITPY_DEFAULT_STACK_SIZE (4248) // divisible by 8 -#define USER_NEOPIXELS_PIN (&pin_PB23) - #define DEFAULT_I2C_BUS_SCL (&pin_PB03) #define DEFAULT_I2C_BUS_SDA (&pin_PB02) diff --git a/ports/atmel-samd/boards/pybadge/mpconfigboard.h b/ports/atmel-samd/boards/pybadge/mpconfigboard.h index 74a13eb1c2b48..435185322aac9 100644 --- a/ports/atmel-samd/boards/pybadge/mpconfigboard.h +++ b/ports/atmel-samd/boards/pybadge/mpconfigboard.h @@ -14,8 +14,6 @@ #define MICROPY_PORT_C (0) #define MICROPY_PORT_D (0) -#define USER_NEOPIXELS_PIN (&pin_PA15) - #define DEFAULT_I2C_BUS_SCL (&pin_PA13) #define DEFAULT_I2C_BUS_SDA (&pin_PA12) diff --git a/ports/atmel-samd/boards/pybadge_airlift/mpconfigboard.h b/ports/atmel-samd/boards/pybadge_airlift/mpconfigboard.h index a37d7ceec44dd..921669d8cb098 100644 --- a/ports/atmel-samd/boards/pybadge_airlift/mpconfigboard.h +++ b/ports/atmel-samd/boards/pybadge_airlift/mpconfigboard.h @@ -14,8 +14,6 @@ #define MICROPY_PORT_C (0) #define MICROPY_PORT_D (0) -#define USER_NEOPIXELS_PIN (&pin_PA15) - #define DEFAULT_I2C_BUS_SCL (&pin_PA13) #define DEFAULT_I2C_BUS_SDA (&pin_PA12) diff --git a/ports/atmel-samd/boards/pygamer/mpconfigboard.h b/ports/atmel-samd/boards/pygamer/mpconfigboard.h index 21f75d272886e..102c2595676d9 100644 --- a/ports/atmel-samd/boards/pygamer/mpconfigboard.h +++ b/ports/atmel-samd/boards/pygamer/mpconfigboard.h @@ -13,8 +13,6 @@ #define MICROPY_PORT_C (0) #define MICROPY_PORT_D (0) -#define USER_NEOPIXELS_PIN (&pin_PA15) - #define DEFAULT_I2C_BUS_SCL (&pin_PA13) #define DEFAULT_I2C_BUS_SDA (&pin_PA12) diff --git a/ports/atmel-samd/boards/pygamer_advance/mpconfigboard.h b/ports/atmel-samd/boards/pygamer_advance/mpconfigboard.h index 7c631d1c373a5..fbe946b72fa9e 100644 --- a/ports/atmel-samd/boards/pygamer_advance/mpconfigboard.h +++ b/ports/atmel-samd/boards/pygamer_advance/mpconfigboard.h @@ -13,8 +13,6 @@ #define MICROPY_PORT_C (0) #define MICROPY_PORT_D (0) -#define USER_NEOPIXELS_PIN (&pin_PA15) - #define DEFAULT_I2C_BUS_SCL (&pin_PA13) #define DEFAULT_I2C_BUS_SDA (&pin_PA12) diff --git a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c index 34c8b0052364b..d5e896c0154a0 100644 --- a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +++ b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c @@ -51,6 +51,7 @@ mp_obj_t alarm_time_timealarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t * } alarm_time_time_alarm_obj_t *timer = m_new_obj(alarm_time_time_alarm_obj_t); timer->base.type = &alarm_time_time_alarm_type; + // TODO: Set monotonic_time based on the RTC state. return timer; } diff --git a/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.h b/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.h index ef34465dcd903..da32230a6f938 100644 --- a/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.h +++ b/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.h @@ -54,8 +54,6 @@ // Disables onboard peripherals and neopixels to save power. #define POWER_SWITCH_PIN (&pin_P0_06) -#define USER_NEOPIXELS_PIN (&pin_P0_13) - #define DEFAULT_I2C_BUS_SCL (&pin_P0_04) #define DEFAULT_I2C_BUS_SDA (&pin_P0_05) diff --git a/supervisor/shared/board.c b/supervisor/shared/board.c index 111aa0e3c9c4b..30603aa66cc9e 100644 --- a/supervisor/shared/board.c +++ b/supervisor/shared/board.c @@ -33,7 +33,7 @@ #include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/neopixel_write/__init__.h" -void board_reset_user_neopixels(mcu_pin_obj_t* pin, size_t count) { +void board_reset_user_neopixels(const mcu_pin_obj_t* pin, size_t count) { // Turn off on-board NeoPixel string uint8_t empty[count * 3]; memset(empty, 0, count); diff --git a/supervisor/shared/board.h b/supervisor/shared/board.h index cdeefbf222194..fe887a933545e 100644 --- a/supervisor/shared/board.h +++ b/supervisor/shared/board.h @@ -31,6 +31,6 @@ #include "shared-bindings/microcontroller/Pin.h" -void board_reset_user_neopixels(mcu_pin_obj_t* pin, size_t count); +void board_reset_user_neopixels(const mcu_pin_obj_t* pin, size_t count); #endif // MICROPY_INCLUDED_SUPERVISOR_SHARED_BOARD_H From 9e7a7b9dc422e3031c914a90f9ceda9b21ed27f8 Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Tue, 8 Dec 2020 14:38:20 -0800 Subject: [PATCH 386/770] uglify typing hints --- shared-bindings/msgpack/__init__.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index ade88b10ddc74..59ff694bb8cbd 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -81,7 +81,7 @@ //| """ -//| def pack(obj: object, buffer: WriteableBuffer, *, default: Callable[[object], None]=None) -> None: +//| def pack(obj: object, buffer: WriteableBuffer, *, default: Union[Callable[[object], None],None]=None) -> None: //| """Ouput object to buffer in msgpack format. //| :param object obj: Object to convert to msgpack format. //| :param ~_typing.WriteableBuffer buffer: buffer to write into @@ -110,7 +110,7 @@ STATIC mp_obj_t mod_msgpack_pack(size_t n_args, const mp_obj_t *pos_args, mp_map } MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_pack_obj, 1, mod_msgpack_pack); -//| def unpack(buffer: ReadableBuffer, *, ext_hook: Callable[[int, bytes], object]=None, use_list: bool=True) -> object: +//| def unpack(buffer: ReadableBuffer, *, ext_hook: Union[Callable[[int, bytes], object],None],None]=None, use_list: bool=True) -> object: //| """Unpack and return one object from buffer. //| :param ~_typing.ReadableBuffer buffer: buffer to read from //| :param Optional[~_typing.Callable[[int, bytes], object]] ext_hook: function called for objects in From 9a5006e241cfb8ac905eb8e623ec0a1fe9f71a72 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Tue, 8 Dec 2020 17:30:32 -0500 Subject: [PATCH 387/770] Remove problematic calloc --- ports/esp32s2/common-hal/analogio/AnalogIn.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ports/esp32s2/common-hal/analogio/AnalogIn.c b/ports/esp32s2/common-hal/analogio/AnalogIn.c index bab1721ea7231..f33439c4affe2 100644 --- a/ports/esp32s2/common-hal/analogio/AnalogIn.c +++ b/ports/esp32s2/common-hal/analogio/AnalogIn.c @@ -34,6 +34,8 @@ #include "shared-bindings/microcontroller/Pin.h" +#include + #define DEFAULT_VREF 1100 #define NO_OF_SAMPLES 64 #define ATTENUATION ADC_ATTEN_DB_11 @@ -66,11 +68,14 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) { adc1_config_channel_atten((adc1_channel_t)self->pin->adc_channel, ATTENUATION); } else if (self->pin->adc_index == ADC_UNIT_2) { adc2_config_channel_atten((adc2_channel_t)self->pin->adc_channel, ATTENUATION); + } else { + mp_raise_ValueError(translate("Invalid Pin")); } // Automatically select calibration process depending on status of efuse - esp_adc_cal_characteristics_t *adc_chars = calloc(1, sizeof(esp_adc_cal_characteristics_t)); - esp_adc_cal_characterize(self->pin->adc_index, ATTENUATION, DATA_WIDTH, DEFAULT_VREF, adc_chars); + esp_adc_cal_characteristics_t adc_chars; + memset(&adc_chars, 0, sizeof(adc_chars)); + esp_adc_cal_characterize(self->pin->adc_index, ATTENUATION, DATA_WIDTH, DEFAULT_VREF, &adc_chars); uint32_t adc_reading = 0; //Multisampling @@ -89,7 +94,7 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) { adc_reading /= NO_OF_SAMPLES; // This corrects non-linear regions of the ADC range with a LUT, so it's a better reading than raw - uint32_t voltage = esp_adc_cal_raw_to_voltage(adc_reading, adc_chars); + uint32_t voltage = esp_adc_cal_raw_to_voltage(adc_reading, &adc_chars); return voltage * ((1 << 16) - 1)/3300; } From a5c3dc286c38c3c007513db58c09a88308c2a863 Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Tue, 8 Dec 2020 15:48:56 -0800 Subject: [PATCH 388/770] typing ... --- shared-bindings/msgpack/__init__.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index 59ff694bb8cbd..ea1e430877977 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -80,8 +80,7 @@ //| print(f"{data} -> {buffer.getvalue()} -> {decoded}") //| """ - -//| def pack(obj: object, buffer: WriteableBuffer, *, default: Union[Callable[[object], None],None]=None) -> None: +//| def pack(obj: object, buffer: WriteableBuffer, *, default: Union[Callable[[object], None], None] = None) -> None: //| """Ouput object to buffer in msgpack format. //| :param object obj: Object to convert to msgpack format. //| :param ~_typing.WriteableBuffer buffer: buffer to write into @@ -110,7 +109,8 @@ STATIC mp_obj_t mod_msgpack_pack(size_t n_args, const mp_obj_t *pos_args, mp_map } MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_pack_obj, 1, mod_msgpack_pack); -//| def unpack(buffer: ReadableBuffer, *, ext_hook: Union[Callable[[int, bytes], object],None],None]=None, use_list: bool=True) -> object: + +//| def unpack(buffer: ReadableBuffer, *, ext_hook: Union[Callable[[int, bytes], object], None] = None, use_list: bool=True) -> object: //| """Unpack and return one object from buffer. //| :param ~_typing.ReadableBuffer buffer: buffer to read from //| :param Optional[~_typing.Callable[[int, bytes], object]] ext_hook: function called for objects in From f7c7324e6099c465359bd6a6b4ef9c3240a04149 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Tue, 8 Dec 2020 18:57:19 -0500 Subject: [PATCH 389/770] Translations --- locale/circuitpython.pot | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index b136e9dd26f02..06dcdeaa5c6ac 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-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 18:56-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -498,8 +498,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "" @@ -1080,6 +1080,10 @@ msgstr "" msgid "Invalid PWM frequency" msgstr "" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "" @@ -1296,7 +1300,7 @@ msgstr "" msgid "No DMA channel found" msgstr "" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1503,6 +1507,7 @@ msgstr "" msgid "Pin does not have ADC capabilities" msgstr "" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" From cea6c3d8d6c56ed657e6594e48db95c20f6ef930 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Wed, 9 Dec 2020 01:34:28 +0100 Subject: [PATCH 390/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 26 +++++++++++++++++++------- locale/cs.po | 19 ++++++++++++++----- locale/de_DE.po | 26 +++++++++++++++++++------- locale/el.po | 19 ++++++++++++++----- locale/es.po | 24 ++++++++++++++++++------ locale/fil.po | 26 +++++++++++++++++++------- locale/fr.po | 25 +++++++++++++++++++------ locale/hi.po | 19 ++++++++++++++----- locale/it_IT.po | 24 ++++++++++++++++++------ locale/ja.po | 24 ++++++++++++++++++------ locale/ko.po | 19 ++++++++++++++----- locale/nl.po | 26 +++++++++++++++++++------- locale/pl.po | 24 ++++++++++++++++++------ locale/pt_BR.po | 24 ++++++++++++++++++------ locale/sv.po | 25 +++++++++++++++++++------ locale/zh_Latn_pinyin.po | 24 ++++++++++++++++++------ 16 files changed, 278 insertions(+), 96 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 9645dc70246e5..6203f70842047 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-10-10 23:51+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -504,8 +504,8 @@ msgstr "Panjang buffer harus kelipatan 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Penyangga harus memiliki panjang setidaknya 1" @@ -1317,7 +1317,7 @@ msgstr "Tidak ada DAC (Digital Analog Converter) di dalam chip" msgid "No DMA channel found" msgstr "tidak ada channel DMA ditemukan" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1532,6 +1532,7 @@ msgstr "Izin ditolak" msgid "Pin does not have ADC capabilities" msgstr "Pin tidak mempunya kemampuan untuk ADC (Analog Digital Converter)" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -1587,10 +1588,12 @@ msgid "Prefix buffer must be on the heap" msgstr "Buffer awalan harus ada di heap" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" -"Tekan tombol apa saja untuk masuk ke dalam REPL. Gunakan CTRL+D untuk reset " -"(Reload)" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2072,6 +2075,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "" @@ -3846,6 +3853,11 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "" +#~ "Tekan tombol apa saja untuk masuk ke dalam REPL. Gunakan CTRL+D untuk " +#~ "reset (Reload)" + #~ msgid "" #~ "\n" #~ "To exit, please reset the board without " diff --git a/locale/cs.po b/locale/cs.po index 39ea8fcd8745a..ef549e35540d7 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-12-04 18:33+0000\n" "Last-Translator: vkuthan \n" "Language-Team: LANGUAGE \n" @@ -502,8 +502,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "" @@ -1300,7 +1300,7 @@ msgstr "" msgid "No DMA channel found" msgstr "" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1507,6 +1507,7 @@ msgstr "" msgid "Pin does not have ADC capabilities" msgstr "" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -1559,7 +1560,11 @@ msgid "Prefix buffer must be on the heap" msgstr "" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -2030,6 +2035,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 1aedb6ce1f6c8..056ed5908ced3 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-11-26 03:11+0000\n" "Last-Translator: Daniel Bravo Darriba \n" "Language: de_DE\n" @@ -505,8 +505,8 @@ msgstr "Die Pufferlänge muss ein vielfaches von 512 sein" msgid "Buffer must be a multiple of 512 bytes" msgstr "Der Puffer muss ein vielfaches von 512 bytes sein" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Der Puffer muss eine Mindestenslänge von 1 haben" @@ -1319,7 +1319,7 @@ msgstr "Kein DAC im Chip vorhanden" msgid "No DMA channel found" msgstr "Kein DMA Kanal gefunden" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1532,6 +1532,7 @@ msgstr "Zugang verweigert" msgid "Pin does not have ADC capabilities" msgstr "Pin hat keine ADC Funktionalität" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "Pin kann nur als Eingang verwendet werden" @@ -1587,10 +1588,12 @@ msgid "Prefix buffer must be on the heap" msgstr "Der Präfixbuffer muss sich auf dem Heap befinden" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" -"Drücke eine Taste um dich mit der REPL zu verbinden. Drücke Strg-D zum neu " -"laden." #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2087,6 +2090,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "WiFi Passwort muss zwischen 8 und 63 Zeichen lang sein" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "Schreiben nicht unterstüzt für diese Charakteristik" @@ -3890,6 +3897,11 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "" +#~ "Drücke eine Taste um dich mit der REPL zu verbinden. Drücke Strg-D zum " +#~ "neu laden." + #~ msgid "arctan2 is implemented for scalars and ndarrays only" #~ msgstr "arctan2 ist nur für Skalare und ndarrays implementiert" diff --git a/locale/el.po b/locale/el.po index 6a4f7cdbb3178..f1bd60bd5a075 100644 --- a/locale/el.po +++ b/locale/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -497,8 +497,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "" @@ -1295,7 +1295,7 @@ msgstr "" msgid "No DMA channel found" msgstr "" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1502,6 +1502,7 @@ msgstr "" msgid "Pin does not have ADC capabilities" msgstr "" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -1554,7 +1555,11 @@ msgid "Prefix buffer must be on the heap" msgstr "" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -2025,6 +2030,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "" diff --git a/locale/es.po b/locale/es.po index 57b317e008e6d..85d180c21fbec 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-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: Iván Montiel Cardona \n" "Language-Team: \n" @@ -511,8 +511,8 @@ msgstr "El tamaño del búfer debe ser múltiplo de 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "Búfer deber ser un múltiplo de 512 bytes" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Buffer debe ser de longitud 1 como minimo" @@ -1318,7 +1318,7 @@ msgstr "El chip no tiene DAC" msgid "No DMA channel found" msgstr "No se encontró el canal DMA" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1533,6 +1533,7 @@ msgstr "Permiso denegado" msgid "Pin does not have ADC capabilities" msgstr "Pin no tiene capacidad ADC" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "El pin es solo de entrada" @@ -1592,9 +1593,12 @@ msgid "Prefix buffer must be on the heap" msgstr "El prefijo del buffer debe estar en el heap" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" -"Presiona cualquier tecla para entrar al REPL. Usa CTRL-D para recargar." #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2089,6 +2093,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "La clave de WiFi debe ser entre 8 y 63 caracteres" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "Escrituras no admitidas en Characteristic" @@ -3876,6 +3884,10 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "" +#~ "Presiona cualquier tecla para entrar al REPL. Usa CTRL-D para recargar." + #~ msgid "Only IPv4 SOCK_STREAM sockets supported" #~ msgstr "Solo hay capacidad para enchufes IPv4 SOCK_STREAM" diff --git a/locale/fil.po b/locale/fil.po index 4a9e9591ed100..c55ab69b59d18 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -502,8 +502,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Buffer dapat ay hindi baba sa 1 na haba" @@ -1310,7 +1310,7 @@ msgstr "Walang DAC sa chip" msgid "No DMA channel found" msgstr "Walang DMA channel na mahanap" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1521,6 +1521,7 @@ msgstr "Walang pahintulot" msgid "Pin does not have ADC capabilities" msgstr "Ang pin ay walang kakayahan sa ADC" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -1573,10 +1574,12 @@ msgid "Prefix buffer must be on the heap" msgstr "" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" -"Pindutin ang anumang key upang pumasok sa REPL. Gamitin ang CTRL-D upang i-" -"reload." #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2057,6 +2060,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "" @@ -3853,6 +3860,11 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "" +#~ "Pindutin ang anumang key upang pumasok sa REPL. Gamitin ang CTRL-D upang " +#~ "i-reload." + #~ msgid "%q indices must be integers, not %s" #~ msgstr "%q indeks ay dapat integers, hindi %s" diff --git a/locale/fr.po b/locale/fr.po index 22e5f76ebb772..29d2d19849d26 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-12-08 19:21+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" @@ -511,8 +511,8 @@ msgstr "La longueur de la mémoire tampon doit être un multiple de 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "La mémoire tampon doit être un multiple de 512" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Le tampon doit être de longueur au moins 1" @@ -1323,7 +1323,7 @@ msgstr "Pas de DAC sur la puce" msgid "No DMA channel found" msgstr "Aucun canal DMA trouvé" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "Pas de dispositif I2C à l'adresse : %x" @@ -1540,6 +1540,7 @@ msgstr "Permission refusée" msgid "Pin does not have ADC capabilities" msgstr "La broche ne peut être utilisée pour l'ADC" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "La broche est entrée uniquement" @@ -1599,8 +1600,12 @@ msgid "Prefix buffer must be on the heap" msgstr "Le tampon de préfixe doit être sur le tas" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." -msgstr "Appuyez sur une touche pour entrer sur REPL ou CTRL-D pour recharger." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgstr "" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2098,6 +2103,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "Le mot de passe WiFi doit faire entre 8 et 63 caractères" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "Écritures non prises en charge sur la caractéristique" @@ -3897,6 +3906,10 @@ msgstr "zi doit être de type float" msgid "zi must be of shape (n_section, 2)" msgstr "zi doit être de forme (n_section, 2)" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "" +#~ "Appuyez sur une touche pour entrer sur REPL ou CTRL-D pour recharger." + #~ msgid "Only IPv4 SOCK_STREAM sockets supported" #~ msgstr "Seules les sockets IPv4 SOCK_STREAM sont prises en charge" diff --git a/locale/hi.po b/locale/hi.po index 7361e41e65cda..28b6e071a0a56 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -497,8 +497,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "" @@ -1295,7 +1295,7 @@ msgstr "" msgid "No DMA channel found" msgstr "" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1502,6 +1502,7 @@ msgstr "" msgid "Pin does not have ADC capabilities" msgstr "" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -1554,7 +1555,11 @@ msgid "Prefix buffer must be on the heap" msgstr "" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -2025,6 +2030,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 4966002d262c1..f61192834b3e2 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -502,8 +502,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Il buffer deve essere lungo almeno 1" @@ -1314,7 +1314,7 @@ msgstr "Nessun DAC sul chip" msgid "No DMA channel found" msgstr "Nessun canale DMA trovato" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1530,6 +1530,7 @@ msgstr "Permesso negato" msgid "Pin does not have ADC capabilities" msgstr "Il pin non ha capacità di ADC" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -1583,9 +1584,12 @@ msgid "Prefix buffer must be on the heap" msgstr "" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" -"Premi un qualunque tasto per entrare nel REPL. Usa CTRL-D per ricaricare." #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2060,6 +2064,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "" @@ -3860,6 +3868,10 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "" +#~ "Premi un qualunque tasto per entrare nel REPL. Usa CTRL-D per ricaricare." + #~ msgid "%q indices must be integers, not %s" #~ msgstr "gli indici %q devono essere interi, non %s" diff --git a/locale/ja.po b/locale/ja.po index 27e094a0abe00..82b8cc352d651 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: sporeball \n" "Language-Team: none\n" @@ -506,8 +506,8 @@ msgstr "バッファ長は512の倍数でなければなりません" msgid "Buffer must be a multiple of 512 bytes" msgstr "バッファは512の倍数でなければなりません" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "バッファ長は少なくとも1以上でなければなりません" @@ -1310,7 +1310,7 @@ msgstr "チップにDACがありません" msgid "No DMA channel found" msgstr "DMAチャネルが見つかりません" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1520,6 +1520,7 @@ msgstr "パーミッション拒否" msgid "Pin does not have ADC capabilities" msgstr "ピンにADCの能力がありません" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "ピンは入力専用" @@ -1572,8 +1573,12 @@ msgid "Prefix buffer must be on the heap" msgstr "Prefixバッファはヒープ上になければなりません" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." -msgstr "何らかのキーを押すとREPLに入ります。CTRL-Dでリロード。" +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgstr "" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2050,6 +2055,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "WiFiパスワードは8〜63文字でなければなりません" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "" @@ -3829,6 +3838,9 @@ msgstr "ziはfloat値でなければなりません" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "何らかのキーを押すとREPLに入ります。CTRL-Dでリロード。" + #~ msgid "axis must be -1, 0, None, or 1" #~ msgstr "axisは -1, 0, 1, None のいずれかでなければなりません" diff --git a/locale/ko.po b/locale/ko.po index 407b495b88a44..58bd4280156f8 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-10-05 12:12+0000\n" "Last-Translator: Michal Čihař \n" "Language-Team: LANGUAGE \n" @@ -502,8 +502,8 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "잘못된 크기의 버퍼. >1 여야합니다" @@ -1300,7 +1300,7 @@ msgstr "" msgid "No DMA channel found" msgstr "" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1507,6 +1507,7 @@ msgstr "" msgid "Pin does not have ADC capabilities" msgstr "" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -1559,7 +1560,11 @@ msgid "Prefix buffer must be on the heap" msgstr "" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -2031,6 +2036,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index e45f9338d4112..c0f3f478fbc74 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-10-27 16:47+0000\n" "Last-Translator: Jelle Jager \n" "Language-Team: none\n" @@ -504,8 +504,8 @@ msgstr "Buffer lengte moet een veelvoud van 512 zijn" msgid "Buffer must be a multiple of 512 bytes" msgstr "Buffer moet een veelvoud van 512 bytes zijn" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Buffer moet op zijn minst lengte 1 zijn" @@ -1312,7 +1312,7 @@ msgstr "Geen DAC op de chip" msgid "No DMA channel found" msgstr "Geen DMA kanaal gevonden" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1528,6 +1528,7 @@ msgstr "Toegang geweigerd" msgid "Pin does not have ADC capabilities" msgstr "Pin heeft geen ADC mogelijkheden" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "Pin kan alleen voor invoer gebruikt worden" @@ -1587,10 +1588,12 @@ msgid "Prefix buffer must be on the heap" msgstr "Prefix buffer moet op de heap zijn" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" -"Druk een willekeurige toets om de REPL te starten. Gebruik CTRL+D om te " -"herstarten." #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2081,6 +2084,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "WiFi wachtwoord moet tussen 8 en 63 karakters bevatten" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "Schrijven niet ondersteund op Characteristic" @@ -3863,6 +3870,11 @@ msgstr "zi moet van type float zijn" msgid "zi must be of shape (n_section, 2)" msgstr "zi moet vorm (n_section, 2) hebben" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "" +#~ "Druk een willekeurige toets om de REPL te starten. Gebruik CTRL+D om te " +#~ "herstarten." + #~ msgid "Only IPv4 SOCK_STREAM sockets supported" #~ msgstr "Alleen IPv4 SOCK_STREAM sockets worden ondersteund" diff --git a/locale/pl.po b/locale/pl.po index 31d446b3baabf..72c091a11d47c 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-12-02 20:29+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" @@ -506,8 +506,8 @@ msgstr "Długość bufora musi być wielokrotnością 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "Bufor musi być wielokrotnością 512 bajtów" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Bufor musi mieć długość 1 lub więcej" @@ -1311,7 +1311,7 @@ msgstr "Brak DAC" msgid "No DMA channel found" msgstr "Nie znaleziono kanału DMA" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1518,6 +1518,7 @@ msgstr "Odmowa dostępu" msgid "Pin does not have ADC capabilities" msgstr "Nóżka nie obsługuje ADC" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -1570,8 +1571,12 @@ msgid "Prefix buffer must be on the heap" msgstr "" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." -msgstr "Dowolny klawisz aby uruchomić konsolę. CTRL-D aby przeładować." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgstr "" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2047,6 +2052,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "" @@ -3821,6 +3830,9 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "Dowolny klawisz aby uruchomić konsolę. CTRL-D aby przeładować." + #~ msgid "number of arguments must be 2, or 3" #~ msgstr "liczba argumentów musi wynosić 2 lub 3" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 4ac698bd316be..282392bda1e65 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-12-04 06:29+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -512,8 +512,8 @@ msgstr "O comprimento do Buffer deve ser um múltiplo de 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "O buffer deve ser um múltiplo de 512 bytes" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "O comprimento do buffer deve ter pelo menos 1" @@ -1321,7 +1321,7 @@ msgstr "Nenhum DAC no chip" msgid "No DMA channel found" msgstr "Nenhum canal DMA encontrado" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "Nenhum dispositivo I2C no endereço: %x" @@ -1537,6 +1537,7 @@ msgstr "Permissão negada" msgid "Pin does not have ADC capabilities" msgstr "O pino não tem recursos de ADC" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "Apenas o pino de entrada" @@ -1598,9 +1599,12 @@ msgstr "" "(heap)" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" -"Pressione qualquer tecla para entrar no REPL. Use CTRL-D para recarregar." #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2096,6 +2100,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "A senha do Wi-Fi deve ter entre 8 e 63 caracteres" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "A escrita não é compatível na Característica" @@ -3888,6 +3896,10 @@ msgstr "zi deve ser de um tipo float" msgid "zi must be of shape (n_section, 2)" msgstr "zi deve estar na forma (n_section, 2)" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "" +#~ "Pressione qualquer tecla para entrar no REPL. Use CTRL-D para recarregar." + #~ msgid "Only IPv4 SOCK_STREAM sockets supported" #~ msgstr "São suportados apenas soquetes IPv4 SOCK_STREAM" diff --git a/locale/sv.po b/locale/sv.po index 4b7a389c24a39..be3d4840588f8 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-12-07 20:26+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -504,8 +504,8 @@ msgstr "Buffertlängd måste vara en multipel av 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "Bufferten måste vara en multipel av 512 byte" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Bufferten måste ha minst längd 1" @@ -1311,7 +1311,7 @@ msgstr "Ingen DAC på chipet" msgid "No DMA channel found" msgstr "Ingen DMA-kanal hittades" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "Ingen I2C-enhet på adress: %x" @@ -1525,6 +1525,7 @@ msgstr "Åtkomst nekad" msgid "Pin does not have ADC capabilities" msgstr "Pinnen har inte ADC-funktionalitet" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "Pinnen är enbart ingång" @@ -1584,9 +1585,12 @@ msgid "Prefix buffer must be on the heap" msgstr "Prefixbufferten måste finnas på heap" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" -"Tryck på valfri knapp för att gå in i REPL. Använd CTRL-D för att ladda om." #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2074,6 +2078,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "WiFi-lösenord måste vara mellan 8 och 63 tecken" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "Skrivning stöds inte på karaktäristik" @@ -3856,6 +3864,11 @@ msgstr "zi måste vara av typ float" msgid "zi must be of shape (n_section, 2)" msgstr "zi måste vara i formen (n_section, 2)" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "" +#~ "Tryck på valfri knapp för att gå in i REPL. Använd CTRL-D för att ladda " +#~ "om." + #~ msgid "Only IPv4 SOCK_STREAM sockets supported" #~ msgstr "Endast IPv4 SOCK_STREAM sockets stöds" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 5ef4b0e2ae558..606f0077e187c 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-27 23:57-0500\n" +"POT-Creation-Date: 2020-12-08 09:56-0800\n" "PO-Revision-Date: 2020-11-19 01:28+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -506,8 +506,8 @@ msgstr "Huǎn chōng qū cháng dù bì xū wéi 512 de bèi shù" msgid "Buffer must be a multiple of 512 bytes" msgstr "Huǎn chōng qū bì xū shì 512 zì jié de bèi shù" -#: shared-bindings/bitbangio/I2C.c shared-bindings/busdevice/I2CDevice.c -#: shared-bindings/busio/I2C.c +#: shared-bindings/adafruit_bus_device/I2CDevice.c +#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Huǎnchōng qū bìxū zhìshǎo chángdù 1" @@ -1308,7 +1308,7 @@ msgstr "Méiyǒu DAC zài xīnpiàn shàng de" msgid "No DMA channel found" msgstr "Wèi zhǎodào DMA píndào" -#: shared-module/busdevice/I2CDevice.c +#: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" msgstr "" @@ -1521,6 +1521,7 @@ msgstr "Quánxiàn bèi jùjué" msgid "Pin does not have ADC capabilities" msgstr "Pin méiyǒu ADC nénglì" +#: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "Yǐn jiǎo jǐn shūrù" @@ -1577,8 +1578,12 @@ msgid "Prefix buffer must be on the heap" msgstr "Qiánzhuì huǎnchōng qū bìxū zài duī shàng" #: main.c -msgid "Press any key to enter the REPL. Use CTRL-D to reload." -msgstr "Àn xià rènhé jiàn jìnrù REPL. Shǐyòng CTRL-D chóngxīn jiāzài." +msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" +msgstr "" + +#: main.c +msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgstr "" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2066,6 +2071,10 @@ msgstr "" msgid "WiFi password must be between 8 and 63 characters" msgstr "WiFi mìmǎ bìxū jiè yú 8 dào 63 gè zìfú zhī jiān" +#: main.c +msgid "Woken up by alarm.\n" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "Tèzhēng bù zhīchí xiě rù" @@ -3845,6 +3854,9 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." +#~ msgstr "Àn xià rènhé jiàn jìnrù REPL. Shǐyòng CTRL-D chóngxīn jiāzài." + #~ msgid "Only IPv4 SOCK_STREAM sockets supported" #~ msgstr "Jǐn zhīchí IPv4 SOCK_STREAM tào jiē zì" From eedcc98cc5379f93704fd344289e2f5c8a60eddd Mon Sep 17 00:00:00 2001 From: Mike Causer Date: Thu, 10 Dec 2020 02:52:18 +1100 Subject: [PATCH 391/770] Fix some spelling mistakes --- docs/design_guide.rst | 8 ++++---- docs/drivers.rst | 2 +- docs/library/hashlib.rst | 4 ++-- docs/library/index.rst | 4 ++-- docs/library/network.rst | 2 +- docs/porting.rst | 2 +- docs/troubleshooting.rst | 4 ++-- main.c | 2 +- shared-bindings/os/__init__.c | 6 +++--- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/design_guide.rst b/docs/design_guide.rst index cc2a3b296de34..75825893a99d9 100644 --- a/docs/design_guide.rst +++ b/docs/design_guide.rst @@ -421,7 +421,7 @@ SPI Example """Widget's one register.""" with self.spi_device as spi: spi.write(b'0x00') - i2c.readinto(self.buf) + spi.readinto(self.buf) return self.buf[0] Use composition @@ -462,7 +462,7 @@ like properties for state even if it sacrifices a bit of speed. Avoid allocations in drivers -------------------------------------------------------------------------------- -Although Python doesn't require managing memory, its still a good practice for +Although Python doesn't require managing memory, it's still a good practice for library writers to think about memory allocations. Avoid them in drivers if you can because you never know how much something will be called. Fewer allocations means less time spent cleaning up. So, where you can, prefer @@ -471,7 +471,7 @@ object with methods that read or write into the buffer instead of creating new objects. Unified hardware API classes such as `busio.SPI` are design to read and write to subsections of buffers. -Its ok to allocate an object to return to the user. Just beware of causing more +It's ok to allocate an object to return to the user. Just beware of causing more than one allocation per call due to internal logic. **However**, this is a memory tradeoff so do not do it for large or rarely used @@ -580,4 +580,4 @@ MicroPython compatibility -------------------------------------------------------------------------------- Keeping compatibility with MicroPython isn't a high priority. It should be done -when its not in conflict with any of the above goals. +when it's not in conflict with any of the above goals. diff --git a/docs/drivers.rst b/docs/drivers.rst index 241415cc1cd27..8855abbd2d271 100644 --- a/docs/drivers.rst +++ b/docs/drivers.rst @@ -12,7 +12,7 @@ Adafruit CircuitPython Library Bundle We provide a bundle of all our libraries to ease installation of drivers and their dependencies. The bundle is primarily geared to the Adafruit Express line of boards which feature a relatively large external flash. With Express boards, -its easy to copy them all onto the filesystem. However, if you don't have +it's easy to copy them all onto the filesystem. However, if you don't have enough space simply copy things over as they are needed. - The Adafruit bundles are available on GitHub: . diff --git a/docs/library/hashlib.rst b/docs/library/hashlib.rst index 0205d5e6a8c72..8e5ebc2d1a7d9 100644 --- a/docs/library/hashlib.rst +++ b/docs/library/hashlib.rst @@ -20,10 +20,10 @@ be implemented: * SHA1 - A previous generation algorithm. Not recommended for new usages, but SHA1 is a part of number of Internet standards and existing applications, so boards targeting network connectivity and - interoperatiability will try to provide this. + interoperability will try to provide this. * MD5 - A legacy algorithm, not considered cryptographically secure. Only - selected boards, targeting interoperatibility with legacy applications, + selected boards, targeting interoperability with legacy applications, will offer this. Constructors diff --git a/docs/library/index.rst b/docs/library/index.rst index f847ead0af198..e9138724210d2 100644 --- a/docs/library/index.rst +++ b/docs/library/index.rst @@ -21,7 +21,7 @@ standard Python library. You may need to change your code later if you rely on any non-standard functionality they currently provide. -CircuitPython's goal long-term goalis that code written in CircuitPython +CircuitPython's long-term goal is that code written in CircuitPython using Python standard libraries will be runnable on CPython without changes. Some libraries below are not enabled on CircuitPython builds with @@ -69,7 +69,7 @@ CircuitPython/MicroPython-specific libraries -------------------------------------------- Functionality specific to the CircuitPython/MicroPython implementation is available in -the following libraries. These libraries may change signficantly or be removed in future +the following libraries. These libraries may change significantly or be removed in future versions of CircuitPython. .. toctree:: diff --git a/docs/library/network.rst b/docs/library/network.rst index bd32267fe9af8..3bd41150d5ec2 100644 --- a/docs/library/network.rst +++ b/docs/library/network.rst @@ -71,7 +71,7 @@ parameter should be `id`. (password) required to access said service. There can be further arbitrary keyword-only parameters, depending on the networking medium type and/or particular device. Parameters can be used to: a) - specify alternative service identifer types; b) provide additional + specify alternative service identifier types; b) provide additional connection parameters. For various medium types, there are different sets of predefined/recommended parameters, among them: diff --git a/docs/porting.rst b/docs/porting.rst index 6cd59fefb1146..8d0262455be40 100644 --- a/docs/porting.rst +++ b/docs/porting.rst @@ -106,7 +106,7 @@ request a safe mode state which prevents the supervisor from running user code while still allowing access to the REPL and other resources. The core port initialization and reset methods are defined in -``supervisor/port.c`` and should be the first to be implemented. Its required +``supervisor/port.c`` and should be the first to be implemented. It's required that they be implemented in the ``supervisor`` directory within the port directory. That way, they are always in the expected place. diff --git a/docs/troubleshooting.rst b/docs/troubleshooting.rst index 66bcc2764cbb5..45c637f349c16 100644 --- a/docs/troubleshooting.rst +++ b/docs/troubleshooting.rst @@ -13,7 +13,7 @@ When CircuitPython restarts it will create a fresh empty ``CIRCUITPY`` filesyste This often happens on Windows when the ``CIRCUITPY`` disk is not safely ejected before being reset by the button or being disconnected from USB. This can also -happen on Linux and Mac OSX but its less likely. +happen on Linux and Mac OSX but it's less likely. .. caution:: To erase and re-create ``CIRCUITPY`` (for example, to correct a corrupted filesystem), follow one of the procedures below. It's important to note that **any files stored on the** @@ -43,7 +43,7 @@ ValueError: Incompatible ``.mpy`` file. This error occurs when importing a module that is stored as a ``mpy`` binary file (rather than a ``py`` text file) that was generated by a different version of -CircuitPython than the one its being loaded into. Most versions are compatible +CircuitPython than the one it's being loaded into. Most versions are compatible but, rarely they aren't. In particular, the ``mpy`` binary format changed between CircuitPython versions 1.x and 2.x, and will change again between 2.x and 3.x. diff --git a/main.c b/main.c index 5aa9131a0d893..da04ada466b02 100755 --- a/main.c +++ b/main.c @@ -215,7 +215,7 @@ STATIC bool maybe_run_list(const char * const * filenames, pyexec_result_t* exec STATIC void cleanup_after_vm(supervisor_allocation* heap) { // Reset port-independent devices, like CIRCUITPY_BLEIO_HCI. reset_devices(); - // Turn off the display and flush the fileystem before the heap disappears. + // Turn off the display and flush the filesystem before the heap disappears. #if CIRCUITPY_DISPLAYIO reset_displays(); #endif diff --git a/shared-bindings/os/__init__.c b/shared-bindings/os/__init__.c index c499df97248de..8b9b389111be5 100644 --- a/shared-bindings/os/__init__.c +++ b/shared-bindings/os/__init__.c @@ -160,7 +160,7 @@ mp_obj_t os_stat(mp_obj_t path_in) { MP_DEFINE_CONST_FUN_OBJ_1(os_stat_obj, os_stat); //| def statvfs(path: str) -> Tuple[int, int, int, int, int, int, int, int, int, int]: -//| """Get the status of a fileystem. +//| """Get the status of a filesystem. //| //| Returns a tuple with the filesystem information in the following order: //| @@ -168,10 +168,10 @@ MP_DEFINE_CONST_FUN_OBJ_1(os_stat_obj, os_stat); //| * ``f_frsize`` -- fragment size //| * ``f_blocks`` -- size of fs in f_frsize units //| * ``f_bfree`` -- number of free blocks -//| * ``f_bavail`` -- number of free blocks for unpriviliged users +//| * ``f_bavail`` -- number of free blocks for unprivileged users //| * ``f_files`` -- number of inodes //| * ``f_ffree`` -- number of free inodes -//| * ``f_favail`` -- number of free inodes for unpriviliged users +//| * ``f_favail`` -- number of free inodes for unprivileged users //| * ``f_flag`` -- mount flags //| * ``f_namemax`` -- maximum filename length //| From 3c724321d863c79dce0ec4d11e12fd6c9fa27c4c Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Wed, 9 Dec 2020 12:01:09 -0800 Subject: [PATCH 392/770] cosmetics --- shared-bindings/msgpack/ExtType.c | 2 -- shared-bindings/msgpack/__init__.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/shared-bindings/msgpack/ExtType.c b/shared-bindings/msgpack/ExtType.c index daac55dc446c4..272c1ccebc62f 100644 --- a/shared-bindings/msgpack/ExtType.c +++ b/shared-bindings/msgpack/ExtType.c @@ -61,7 +61,6 @@ STATIC mp_obj_t mod_msgpack_exttype_make_new(const mp_obj_type_t *type, size_t n //| code: int //| """The type code, in range 0~127.""" -//| STATIC mp_obj_t mod_msgpack_exttype_get_code(mp_obj_t self_in) { mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -89,7 +88,6 @@ const mp_obj_property_t mod_msgpack_exttype_code_obj = { //| data: bytes //| """Data.""" -//| STATIC mp_obj_t mod_msgpack_exttype_get_data(mp_obj_t self_in) { mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index ea1e430877977..06c3900b5d238 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -46,7 +46,7 @@ //| from io import BytesIO //| //| b = BytesIO() -//| msgpack.pack({'list': [True, False, None, 1, 'abc'], 'str': 'blah'}, b) +//| msgpack.pack({'list': [True, False, None, 1, 3.14], 'str': 'blah'}, b) //| b.seek(0) //| print(msgpack.unpack(b)) //| From 20c3184c87ee198f97f322ec983f04cedcb9cdcc Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 10 Dec 2020 12:34:56 +0530 Subject: [PATCH 393/770] re-organize and clean-up --- ports/esp32s2/common-hal/ota/__init__.c | 40 +++++++++---------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/ports/esp32s2/common-hal/ota/__init__.c b/ports/esp32s2/common-hal/ota/__init__.c index 727b6b107b666..b83a929a2768c 100644 --- a/ports/esp32s2/common-hal/ota/__init__.c +++ b/ports/esp32s2/common-hal/ota/__init__.c @@ -40,31 +40,23 @@ static void __attribute__((noreturn)) task_fatal_error(void) { void common_hal_ota_flash(const void *buf, const size_t len) { esp_err_t err; - /* update handle : set by esp_ota_begin(), must be freed via esp_ota_end() */ + esp_ota_handle_t update_handle = 0 ; const esp_partition_t *update_partition = NULL; + update_partition = esp_ota_get_next_update_partition(NULL); - ESP_LOGI(TAG, "Starting update"); - - const esp_partition_t *configured = esp_ota_get_boot_partition(); const esp_partition_t *running = esp_ota_get_running_partition(); + const esp_partition_t *last_invalid = esp_ota_get_last_invalid_partition(); - if (configured != running) { - ESP_LOGW(TAG, "Configured OTA boot partition at offset 0x%08x, but running from offset 0x%08x", - configured->address, running->address); - ESP_LOGW(TAG, "(This can happen if either the OTA boot data or preferred boot image become corrupted somehow.)"); - } ESP_LOGI(TAG, "Running partition type %d subtype %d (offset 0x%08x)", running->type, running->subtype, running->address); - update_partition = esp_ota_get_next_update_partition(NULL); ESP_LOGI(TAG, "Writing partition type %d subtype %d (offset 0x%08x)\n", update_partition->type, update_partition->subtype, update_partition->address); - assert(update_partition != NULL); + assert(update_partition != NULL); if (len > sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t) + sizeof(esp_app_desc_t)) { - // check current version with downloading esp_app_desc_t new_app_info; memcpy(&new_app_info, &((char *)buf)[sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t)], sizeof(esp_app_desc_t)); ESP_LOGI(TAG, "New firmware version: %s", new_app_info.version); @@ -74,33 +66,30 @@ void common_hal_ota_flash(const void *buf, const size_t len) { ESP_LOGI(TAG, "Running firmware version: %s", running_app_info.version); } - const esp_partition_t* last_invalid_app = esp_ota_get_last_invalid_partition(); esp_app_desc_t invalid_app_info; - if (esp_ota_get_partition_description(last_invalid_app, &invalid_app_info) == ESP_OK) { + if (esp_ota_get_partition_description(last_invalid, &invalid_app_info) == ESP_OK) { ESP_LOGI(TAG, "Last invalid firmware version: %s", invalid_app_info.version); } - // check current version with last invalid partition - if (last_invalid_app != NULL) { - if (memcmp(invalid_app_info.version, new_app_info.version, sizeof(new_app_info.version)) == 0) { + // check new version with running version + if (memcmp(new_app_info.version, running_app_info.version, sizeof(new_app_info.version)) == 0) { + ESP_LOGW(TAG, "New version is the same as running version."); + task_fatal_error(); + } + + // check new version with last invalid partition + if (last_invalid != NULL) { + if (memcmp(new_app_info.version, invalid_app_info.version, sizeof(new_app_info.version)) == 0) { ESP_LOGW(TAG, "New version is the same as invalid version."); - ESP_LOGW(TAG, "Previously, there was an attempt to launch the firmware with %s version, but it failed.", invalid_app_info.version); - ESP_LOGW(TAG, "The firmware has been rolled back to the previous version."); task_fatal_error(); } } - if (memcmp(new_app_info.version, running_app_info.version, sizeof(new_app_info.version)) == 0) { - ESP_LOGW(TAG, "Current running version is the same as a new. We will not continue the update."); - task_fatal_error(); - } - err = esp_ota_begin(update_partition, OTA_WITH_SEQUENTIAL_WRITES, &update_handle); if (err != ESP_OK) { ESP_LOGE(TAG, "esp_ota_begin failed (%s)", esp_err_to_name(err)); task_fatal_error(); } - ESP_LOGI(TAG, "esp_ota_begin succeeded"); } else { ESP_LOGE(TAG, "received package is not fit len"); task_fatal_error(); @@ -111,7 +100,6 @@ void common_hal_ota_flash(const void *buf, const size_t len) { ESP_LOGE(TAG, "esp_ota_write failed (%s)", esp_err_to_name(err)); task_fatal_error(); } - ESP_LOGI(TAG, "Total Write binary data length: %d", len); err = esp_ota_end(update_handle); if (err != ESP_OK) { From dee86a014b783aff61a72f9915a4538a7fc97e4e Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 10 Dec 2020 14:04:24 +0530 Subject: [PATCH 394/770] factor out esp_ota_end --- ports/esp32s2/common-hal/ota/__init__.c | 9 +++++++-- shared-bindings/ota/__init__.c | 7 +++++++ shared-bindings/ota/__init__.h | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/ota/__init__.c b/ports/esp32s2/common-hal/ota/__init__.c index b83a929a2768c..2afb1904b2b1f 100644 --- a/ports/esp32s2/common-hal/ota/__init__.c +++ b/ports/esp32s2/common-hal/ota/__init__.c @@ -31,6 +31,9 @@ #include "esp_log.h" #include "esp_ota_ops.h" +esp_ota_handle_t update_handle = 0 ; +const esp_partition_t *update_partition = NULL; + static const char *TAG = "OTA"; static void __attribute__((noreturn)) task_fatal_error(void) { @@ -41,8 +44,6 @@ static void __attribute__((noreturn)) task_fatal_error(void) { void common_hal_ota_flash(const void *buf, const size_t len) { esp_err_t err; - esp_ota_handle_t update_handle = 0 ; - const esp_partition_t *update_partition = NULL; update_partition = esp_ota_get_next_update_partition(NULL); const esp_partition_t *running = esp_ota_get_running_partition(); @@ -100,6 +101,10 @@ void common_hal_ota_flash(const void *buf, const size_t len) { ESP_LOGE(TAG, "esp_ota_write failed (%s)", esp_err_to_name(err)); task_fatal_error(); } +} + +void common_hal_ota_finish(void) { + esp_err_t err; err = esp_ota_end(update_handle); if (err != ESP_OK) { diff --git a/shared-bindings/ota/__init__.c b/shared-bindings/ota/__init__.c index a6c0424865d2c..55858a80e91f8 100644 --- a/shared-bindings/ota/__init__.c +++ b/shared-bindings/ota/__init__.c @@ -30,6 +30,12 @@ //| //| The `ota` module implements over-the-air update.""" +STATIC mp_obj_t ota_finish(void) { + common_hal_ota_finish(); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_finish_obj, ota_finish); + STATIC mp_obj_t ota_flash(mp_obj_t program_binary_in) { mp_buffer_info_t bufinfo; mp_get_buffer_raise(program_binary_in, &bufinfo, MP_BUFFER_READ); @@ -41,6 +47,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(ota_flash_obj, ota_flash); STATIC const mp_rom_map_elem_t ota_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ota) }, + { MP_ROM_QSTR(MP_QSTR_finish), MP_ROM_PTR(&ota_finish_obj) }, { MP_ROM_QSTR(MP_QSTR_flash), MP_ROM_PTR(&ota_flash_obj) }, }; STATIC MP_DEFINE_CONST_DICT(ota_module_globals, ota_module_globals_table); diff --git a/shared-bindings/ota/__init__.h b/shared-bindings/ota/__init__.h index c4b40b2af350e..1765c21ad76c3 100644 --- a/shared-bindings/ota/__init__.h +++ b/shared-bindings/ota/__init__.h @@ -29,6 +29,7 @@ #include "py/runtime.h" +extern void common_hal_ota_finish(void); extern void common_hal_ota_flash(const void *buf, const size_t len); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_OTA___INIT___H From ed5add37f6c6f6ed8e1acb6c14bd47df0fdfb0fb Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 10 Dec 2020 14:36:49 +0530 Subject: [PATCH 395/770] add ability to flash in continuous chunks --- ports/esp32s2/common-hal/ota/__init__.c | 114 ++++++++++++++---------- ports/esp32s2/common-hal/ota/__init__.h | 32 +++++++ 2 files changed, 97 insertions(+), 49 deletions(-) create mode 100644 ports/esp32s2/common-hal/ota/__init__.h diff --git a/ports/esp32s2/common-hal/ota/__init__.c b/ports/esp32s2/common-hal/ota/__init__.c index 2afb1904b2b1f..6d0e8f11b5cf2 100644 --- a/ports/esp32s2/common-hal/ota/__init__.c +++ b/ports/esp32s2/common-hal/ota/__init__.c @@ -31,11 +31,18 @@ #include "esp_log.h" #include "esp_ota_ops.h" -esp_ota_handle_t update_handle = 0 ; -const esp_partition_t *update_partition = NULL; +static const esp_partition_t *update_partition = NULL; +static esp_ota_handle_t update_handle = 0; +static bool ota_inited = false; static const char *TAG = "OTA"; +static void ota_reset(void) { + update_handle = 0; + update_partition = NULL; + ota_inited = false; +} + static void __attribute__((noreturn)) task_fatal_error(void) { ESP_LOGE(TAG, "Exiting task due to fatal error..."); mp_raise_RuntimeError(translate("OTA Update Failed")); @@ -44,56 +51,61 @@ static void __attribute__((noreturn)) task_fatal_error(void) { void common_hal_ota_flash(const void *buf, const size_t len) { esp_err_t err; - update_partition = esp_ota_get_next_update_partition(NULL); - const esp_partition_t *running = esp_ota_get_running_partition(); const esp_partition_t *last_invalid = esp_ota_get_last_invalid_partition(); - ESP_LOGI(TAG, "Running partition type %d subtype %d (offset 0x%08x)", - running->type, running->subtype, running->address); + if (update_partition == NULL) { + update_partition = esp_ota_get_next_update_partition(NULL); - ESP_LOGI(TAG, "Writing partition type %d subtype %d (offset 0x%08x)\n", - update_partition->type, update_partition->subtype, update_partition->address); + ESP_LOGI(TAG, "Running partition type %d subtype %d (offset 0x%08x)", + running->type, running->subtype, running->address); - assert(update_partition != NULL); + ESP_LOGI(TAG, "Writing partition type %d subtype %d (offset 0x%08x)\n", + update_partition->type, update_partition->subtype, update_partition->address); - if (len > sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t) + sizeof(esp_app_desc_t)) { - esp_app_desc_t new_app_info; - memcpy(&new_app_info, &((char *)buf)[sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t)], sizeof(esp_app_desc_t)); - ESP_LOGI(TAG, "New firmware version: %s", new_app_info.version); + assert(update_partition != NULL); + } - esp_app_desc_t running_app_info; - if (esp_ota_get_partition_description(running, &running_app_info) == ESP_OK) { - ESP_LOGI(TAG, "Running firmware version: %s", running_app_info.version); - } + if (!ota_inited) { + if (len > sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t) + sizeof(esp_app_desc_t)) { + esp_app_desc_t new_app_info; + memcpy(&new_app_info, &((char *)buf)[sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t)], sizeof(esp_app_desc_t)); + ESP_LOGI(TAG, "New firmware version: %s", new_app_info.version); - esp_app_desc_t invalid_app_info; - if (esp_ota_get_partition_description(last_invalid, &invalid_app_info) == ESP_OK) { - ESP_LOGI(TAG, "Last invalid firmware version: %s", invalid_app_info.version); - } + esp_app_desc_t running_app_info; + if (esp_ota_get_partition_description(running, &running_app_info) == ESP_OK) { + ESP_LOGI(TAG, "Running firmware version: %s", running_app_info.version); + } - // check new version with running version - if (memcmp(new_app_info.version, running_app_info.version, sizeof(new_app_info.version)) == 0) { - ESP_LOGW(TAG, "New version is the same as running version."); - task_fatal_error(); - } + esp_app_desc_t invalid_app_info; + if (esp_ota_get_partition_description(last_invalid, &invalid_app_info) == ESP_OK) { + ESP_LOGI(TAG, "Last invalid firmware version: %s", invalid_app_info.version); + } - // check new version with last invalid partition - if (last_invalid != NULL) { - if (memcmp(new_app_info.version, invalid_app_info.version, sizeof(new_app_info.version)) == 0) { - ESP_LOGW(TAG, "New version is the same as invalid version."); + // check new version with running version + if (memcmp(new_app_info.version, running_app_info.version, sizeof(new_app_info.version)) == 0) { + ESP_LOGW(TAG, "New version is the same as running version."); task_fatal_error(); } - } - err = esp_ota_begin(update_partition, OTA_WITH_SEQUENTIAL_WRITES, &update_handle); - if (err != ESP_OK) { - ESP_LOGE(TAG, "esp_ota_begin failed (%s)", esp_err_to_name(err)); + // check new version with last invalid partition + if (last_invalid != NULL) { + if (memcmp(new_app_info.version, invalid_app_info.version, sizeof(new_app_info.version)) == 0) { + ESP_LOGW(TAG, "New version is the same as invalid version."); + task_fatal_error(); + } + } + + err = esp_ota_begin(update_partition, OTA_WITH_SEQUENTIAL_WRITES, &update_handle); + if (err != ESP_OK) { + ESP_LOGE(TAG, "esp_ota_begin failed (%s)", esp_err_to_name(err)); + task_fatal_error(); + } + ota_inited = true; + } else { + ESP_LOGE(TAG, "received package is not fit len"); task_fatal_error(); } - } else { - ESP_LOGE(TAG, "received package is not fit len"); - task_fatal_error(); } err = esp_ota_write( update_handle, buf, len); @@ -104,20 +116,24 @@ void common_hal_ota_flash(const void *buf, const size_t len) { } void common_hal_ota_finish(void) { - esp_err_t err; + if (ota_inited) { + esp_err_t err; - err = esp_ota_end(update_handle); - if (err != ESP_OK) { - if (err == ESP_ERR_OTA_VALIDATE_FAILED) { - ESP_LOGE(TAG, "Image validation failed, image is corrupted"); + err = esp_ota_end(update_handle); + if (err != ESP_OK) { + if (err == ESP_ERR_OTA_VALIDATE_FAILED) { + ESP_LOGE(TAG, "Image validation failed, image is corrupted"); + } + ESP_LOGE(TAG, "esp_ota_end failed (%s)!", esp_err_to_name(err)); + task_fatal_error(); } - ESP_LOGE(TAG, "esp_ota_end failed (%s)!", esp_err_to_name(err)); - task_fatal_error(); - } - err = esp_ota_set_boot_partition(update_partition); - if (err != ESP_OK) { - ESP_LOGE(TAG, "esp_ota_set_boot_partition failed (%s)!", esp_err_to_name(err)); - task_fatal_error(); + err = esp_ota_set_boot_partition(update_partition); + if (err != ESP_OK) { + ESP_LOGE(TAG, "esp_ota_set_boot_partition failed (%s)!", esp_err_to_name(err)); + task_fatal_error(); + } + + ota_reset(); } } diff --git a/ports/esp32s2/common-hal/ota/__init__.h b/ports/esp32s2/common-hal/ota/__init__.h new file mode 100644 index 0000000000000..317604a8ece84 --- /dev/null +++ b/ports/esp32s2/common-hal/ota/__init__.h @@ -0,0 +1,32 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA__INIT__H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA__INIT__H + +extern void ota_reset(void); + +#endif //MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA__INIT__H From bfa2c604efa213628bb33ad870b851a43f21c877 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 10 Dec 2020 15:45:25 +0530 Subject: [PATCH 396/770] add ability to flash in discontinuous chunks --- ports/esp32s2/common-hal/ota/__init__.c | 8 ++++++-- shared-bindings/ota/__init__.c | 21 +++++++++++++++++---- shared-bindings/ota/__init__.h | 2 +- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/ports/esp32s2/common-hal/ota/__init__.c b/ports/esp32s2/common-hal/ota/__init__.c index 6d0e8f11b5cf2..97cc67b766616 100644 --- a/ports/esp32s2/common-hal/ota/__init__.c +++ b/ports/esp32s2/common-hal/ota/__init__.c @@ -48,7 +48,7 @@ static void __attribute__((noreturn)) task_fatal_error(void) { mp_raise_RuntimeError(translate("OTA Update Failed")); } -void common_hal_ota_flash(const void *buf, const size_t len) { +void common_hal_ota_flash(const void *buf, const size_t len, const int32_t offset) { esp_err_t err; const esp_partition_t *running = esp_ota_get_running_partition(); @@ -108,7 +108,11 @@ void common_hal_ota_flash(const void *buf, const size_t len) { } } - err = esp_ota_write( update_handle, buf, len); + if (offset == -1) { + err = esp_ota_write(update_handle, buf, len); + } else { + err = esp_ota_write_with_offset(update_handle, buf, len, offset); + } if (err != ESP_OK) { ESP_LOGE(TAG, "esp_ota_write failed (%s)", esp_err_to_name(err)); task_fatal_error(); diff --git a/shared-bindings/ota/__init__.c b/shared-bindings/ota/__init__.c index 55858a80e91f8..84a46c83a2dff 100644 --- a/shared-bindings/ota/__init__.c +++ b/shared-bindings/ota/__init__.c @@ -36,14 +36,27 @@ STATIC mp_obj_t ota_finish(void) { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_finish_obj, ota_finish); -STATIC mp_obj_t ota_flash(mp_obj_t program_binary_in) { +STATIC mp_obj_t ota_flash(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_binary, ARG_offset }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_binary, MP_ARG_OBJ | MP_ARG_REQUIRED }, + { MP_QSTR_offset, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = -1} }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + if (args[ARG_offset].u_int < -1) { + mp_raise_ValueError(translate("offset must be >= 0")); + } + mp_buffer_info_t bufinfo; - mp_get_buffer_raise(program_binary_in, &bufinfo, MP_BUFFER_READ); + mp_get_buffer_raise(args[ARG_binary].u_obj, &bufinfo, MP_BUFFER_READ); - common_hal_ota_flash(bufinfo.buf, bufinfo.len); + common_hal_ota_flash(bufinfo.buf, bufinfo.len, args[ARG_offset].u_int); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(ota_flash_obj, ota_flash); +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ota_flash_obj, 1, ota_flash); STATIC const mp_rom_map_elem_t ota_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ota) }, diff --git a/shared-bindings/ota/__init__.h b/shared-bindings/ota/__init__.h index 1765c21ad76c3..9eec604e0b23e 100644 --- a/shared-bindings/ota/__init__.h +++ b/shared-bindings/ota/__init__.h @@ -30,6 +30,6 @@ #include "py/runtime.h" extern void common_hal_ota_finish(void); -extern void common_hal_ota_flash(const void *buf, const size_t len); +extern void common_hal_ota_flash(const void *buf, const size_t len, const int32_t offset); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_OTA___INIT___H From 07015ad527f81d81829190b31569a35a305676ce Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 10 Dec 2020 16:42:45 +0530 Subject: [PATCH 397/770] add ability to switch boot partition --- ports/esp32s2/common-hal/ota/__init__.c | 6 ++++++ shared-bindings/ota/__init__.c | 7 +++++++ shared-bindings/ota/__init__.h | 1 + 3 files changed, 14 insertions(+) diff --git a/ports/esp32s2/common-hal/ota/__init__.c b/ports/esp32s2/common-hal/ota/__init__.c index 97cc67b766616..4ec102131787e 100644 --- a/ports/esp32s2/common-hal/ota/__init__.c +++ b/ports/esp32s2/common-hal/ota/__init__.c @@ -141,3 +141,9 @@ void common_hal_ota_finish(void) { ota_reset(); } } + +void common_hal_ota_switch(void) { + if (esp_ota_set_boot_partition(esp_ota_get_next_update_partition(NULL)) != ESP_OK) { + mp_raise_RuntimeError(translate("Unable to switch partition")); + } +} diff --git a/shared-bindings/ota/__init__.c b/shared-bindings/ota/__init__.c index 84a46c83a2dff..46399dcb2eb63 100644 --- a/shared-bindings/ota/__init__.c +++ b/shared-bindings/ota/__init__.c @@ -30,6 +30,12 @@ //| //| The `ota` module implements over-the-air update.""" +STATIC mp_obj_t ota_switch(void) { + common_hal_ota_switch(); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_switch_obj, ota_switch); + STATIC mp_obj_t ota_finish(void) { common_hal_ota_finish(); return mp_const_none; @@ -60,6 +66,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ota_flash_obj, 1, ota_flash); STATIC const mp_rom_map_elem_t ota_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ota) }, + { MP_ROM_QSTR(MP_QSTR_switch), MP_ROM_PTR(&ota_switch_obj) }, { MP_ROM_QSTR(MP_QSTR_finish), MP_ROM_PTR(&ota_finish_obj) }, { MP_ROM_QSTR(MP_QSTR_flash), MP_ROM_PTR(&ota_flash_obj) }, }; diff --git a/shared-bindings/ota/__init__.h b/shared-bindings/ota/__init__.h index 9eec604e0b23e..82273f975abf0 100644 --- a/shared-bindings/ota/__init__.h +++ b/shared-bindings/ota/__init__.h @@ -29,6 +29,7 @@ #include "py/runtime.h" +extern void common_hal_ota_switch(void); extern void common_hal_ota_finish(void); extern void common_hal_ota_flash(const void *buf, const size_t len, const int32_t offset); From 6a4f74946fc717f8c95c43f364290e3e9d2cd2fa Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 10 Dec 2020 16:48:58 +0530 Subject: [PATCH 398/770] reset ota module on every vm run --- ports/esp32s2/common-hal/ota/__init__.c | 3 ++- ports/esp32s2/common-hal/ota/__init__.h | 6 +++--- ports/esp32s2/supervisor/port.c | 5 +++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ports/esp32s2/common-hal/ota/__init__.c b/ports/esp32s2/common-hal/ota/__init__.c index 4ec102131787e..40cfce6769722 100644 --- a/ports/esp32s2/common-hal/ota/__init__.c +++ b/ports/esp32s2/common-hal/ota/__init__.c @@ -24,6 +24,7 @@ * THE SOFTWARE. */ +#include "common-hal/ota/__init__.h" #include "shared-bindings/ota/__init__.h" #include @@ -37,7 +38,7 @@ static esp_ota_handle_t update_handle = 0; static bool ota_inited = false; static const char *TAG = "OTA"; -static void ota_reset(void) { +void ota_reset(void) { update_handle = 0; update_partition = NULL; ota_inited = false; diff --git a/ports/esp32s2/common-hal/ota/__init__.h b/ports/esp32s2/common-hal/ota/__init__.h index 317604a8ece84..983b57e3f2dd0 100644 --- a/ports/esp32s2/common-hal/ota/__init__.h +++ b/ports/esp32s2/common-hal/ota/__init__.h @@ -24,9 +24,9 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA__INIT__H -#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA__INIT__H +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA___INIT___H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA___INIT___H extern void ota_reset(void); -#endif //MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA__INIT__H +#endif //MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA___INIT___H diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 0841081de8e9b..4cca862d870a7 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -41,6 +41,7 @@ #include "common-hal/busio/I2C.h" #include "common-hal/busio/SPI.h" #include "common-hal/busio/UART.h" +#include "common-hal/ota/__init__.h" #include "common-hal/ps2io/Ps2.h" #include "common-hal/pulseio/PulseIn.h" #include "common-hal/pwmio/PWMOut.h" @@ -107,6 +108,10 @@ void reset_port(void) { analogout_reset(); #endif +#if CIRCUITPY_OTA + ota_reset(); +#endif + #if CIRCUITPY_PS2IO ps2_reset(); #endif From 5964163649e1f4309665dc870861729eba4e0f31 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 10 Dec 2020 13:03:40 -0500 Subject: [PATCH 399/770] Initial SleepMemory code --- ports/esp32s2/common-hal/alarm/SleepMemory.c | 62 +++++++ ports/esp32s2/common-hal/alarm/SleepMemory.h | 63 +++++++ ports/esp32s2/common-hal/alarm/__init__.c | 16 +- ports/esp32s2/common-hal/alarm/__init__.h | 6 +- py/circuitpy_defns.mk | 1 + shared-bindings/alarm/SleepMemory.c | 180 +++++++++++++++++++ shared-bindings/alarm/SleepMemory.h | 44 +++++ shared-bindings/alarm/__init__.c | 6 +- 8 files changed, 373 insertions(+), 5 deletions(-) create mode 100644 ports/esp32s2/common-hal/alarm/SleepMemory.c create mode 100644 ports/esp32s2/common-hal/alarm/SleepMemory.h create mode 100644 shared-bindings/alarm/SleepMemory.c create mode 100644 shared-bindings/alarm/SleepMemory.h diff --git a/ports/esp32s2/common-hal/alarm/SleepMemory.c b/ports/esp32s2/common-hal/alarm/SleepMemory.c new file mode 100644 index 0000000000000..2579eb5fc7165 --- /dev/null +++ b/ports/esp32s2/common-hal/alarm/SleepMemory.c @@ -0,0 +1,62 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * Copyright (c) 2020 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 + +#include "py/runtime.h" +#include "common-hal/alarm/SleepMemory.h" + +#include "esp_sleep.h" + +void alarm_sleep_memory_reset(void) { + // Power RTC slow memory during deep sleep + esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_ON); +} + +uint32_t common_hal_alarm_sleep_memory_get_length(alarm_sleep_memory_obj_t *self) { + return SLEEP_MEMORY_LENGTH; +} + +bool common_hal_alarm_sleep_memory_set_bytes(alarm_sleep_memory_obj_t *self, + uint32_t start_index, uint8_t* values, uint32_t len) { + + if (start_index + len > SLEEP_MEMORY_LENGTH) { + return false; + } + + memcpy((uint8_t *) (SLEEP_MEMORY_BASE + start_index), values, len); + return true; +} + +void common_hal_alarm_sleep_memory_get_bytes(alarm_sleep_memory_obj_t *self, + uint32_t start_index, uint32_t len, uint8_t* values) { + + if (start_index + len > SLEEP_MEMORY_LENGTH) { + return; + } + memcpy(values, (uint8_t *) (SLEEP_MEMORY_BASE + start_index), len); +} diff --git a/ports/esp32s2/common-hal/alarm/SleepMemory.h b/ports/esp32s2/common-hal/alarm/SleepMemory.h new file mode 100644 index 0000000000000..adf7b35ae2ff4 --- /dev/null +++ b/ports/esp32s2/common-hal/alarm/SleepMemory.h @@ -0,0 +1,63 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Dan Halbert for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ALARM_SLEEPMEMORY_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ALARM_SLEEPMEMORY_H + +#include "py/obj.h" + +#define SLEEP_MEMORY_LENGTH (8192) + +// There are several places we could store persistent data for SleepMemory: +// +// RTC registers: There are a few 32-bit registers maintained during deep sleep. +// We are already using one for saving sleep information during deep sleep. +// +// RTC Fast Memory: 8kB, also used for deep-sleep power on stub, and for heap +// during normal operation if CONFIG_ESP32S2_ALLOW_RTC_FAST_MEM_AS_HEAP is set. +// Power-on during deep sleep must be enabled. +// I experimented with using RTC Fast Memory. It seemed to work, but occasionally, +// got smashed for unknown reasons. +// Base of RTC Fast memory on the data bus is 0x3FF9E000. The address is different on the instruction bus. +// +// RTC Slow Memory: 8kB, also used for the ULP (tiny co-processor available during sleep). +// Less likely to be used by ESP-IDF. +// Since we may want to use the ULP in the future, we will use the upper half +// of Slow Memory and reserve the lower half for ULP. +// From ulp.h: +// #define RTC_SLOW_MEM ((uint32_t*) 0x50000000) /*!< RTC slow memory, 8k size */ + +// Upper half of RTC_SLOW_MEM. +#define SLEEP_MEMORY_LENGTH (4096) +#define SLEEP_MEMORY_BASE (0x50000000 + 4096) + +typedef struct { + mp_obj_base_t base; +} alarm_sleep_memory_obj_t; + +extern void alarm_sleep_memory_reset(void); + +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ALARM_SLEEPMEMORY_H diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index 529179200d487..fae921db0b0bc 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -1,10 +1,10 @@ - /* +/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * - * Copyright (c) 2016 Scott Shawcroft for Adafruit Industries - * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2020 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 @@ -30,6 +30,7 @@ #include "py/runtime.h" #include "shared-bindings/alarm/pin/PinAlarm.h" +#include "shared-bindings/alarm/SleepMemory.h" #include "shared-bindings/alarm/time/TimeAlarm.h" #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/wifi/__init__.h" @@ -41,8 +42,17 @@ #include "esp_sleep.h" +// Singleton instance of SleepMemory. +const alarm_sleep_memory_obj_t alarm_sleep_memory_obj = { + .base = { + .type = &alarm_sleep_memory_type, + }, +}; + + void alarm_reset(void) { alarm_time_timealarm_reset(); + alarm_sleep_memory_reset(); esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL); } diff --git a/ports/esp32s2/common-hal/alarm/__init__.h b/ports/esp32s2/common-hal/alarm/__init__.h index 5678a0e7f1e9d..0823ff842eea9 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.h +++ b/ports/esp32s2/common-hal/alarm/__init__.h @@ -27,6 +27,10 @@ #ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ALARM__INIT__H #define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ALARM__INIT__H -void alarm_reset(void); +#include "common-hal/alarm/SleepMemory.h" + +const alarm_sleep_memory_obj_t alarm_sleep_memory_obj; + +extern void alarm_reset(void); #endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ALARM__INIT__H diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index e9253682e0684..1eafce2595f96 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -304,6 +304,7 @@ SRC_COMMON_HAL_ALL = \ _bleio/__init__.c \ _pew/PewPew.c \ _pew/__init__.c \ + alarm/SleepMemory.c \ alarm/__init__.c \ alarm/pin/PinAlarm.c \ alarm/time/TimeAlarm.c \ diff --git a/shared-bindings/alarm/SleepMemory.c b/shared-bindings/alarm/SleepMemory.c new file mode 100644 index 0000000000000..d4a6eb509061c --- /dev/null +++ b/shared-bindings/alarm/SleepMemory.c @@ -0,0 +1,180 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2020 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 "py/binary.h" +#include "py/objproperty.h" +#include "py/runtime.h" +#include "py/runtime0.h" + +#include "shared-bindings/alarm/SleepMemory.h" +#include "supervisor/shared/translate.h" + +//| class SleepMemory: +//| """Store raw bytes in RAM that persists during deep sleep. +//| The class acts as a ``bytearray``. +//| If power is lost, the memory contents are lost. +//| +//| Note that this class can't be imported and used directly. The sole +//| instance of :class:`SleepMemory` is available at +//| :attr:`alarm.sleep_memory`. +//| +//| Usage:: +//| +//| import alarm +//| alarm.sleep_memory[0] = True +//| alarm.sleep_memory[1] = 12 +//| + +//| def __init__(self) -> None: +//| """Not currently dynamically supported. Access the sole instance through `microcontroller.nvm`.""" +//| ... +//| + +//| def __bool__(self) -> bool: +//| """``sleep_memory`` is ``True`` if its length is greater than zero. +//| This is an easy way to check for its existence. +//| """ +//| ... +//| +//| def __len__(self) -> int: +//| """Return the length. This is used by (`len`)""" +//| ... +//| +STATIC mp_obj_t alarm_sleep_memory_unary_op(mp_unary_op_t op, mp_obj_t self_in) { + alarm_sleep_memory_obj_t *self = MP_OBJ_TO_PTR(self_in); + uint16_t len = common_hal_alarm_sleep_memory_get_length(self); + switch (op) { + case MP_UNARY_OP_BOOL: return mp_obj_new_bool(len != 0); + case MP_UNARY_OP_LEN: return MP_OBJ_NEW_SMALL_INT(len); + default: return MP_OBJ_NULL; // op not supported + } +} + +STATIC const mp_rom_map_elem_t alarm_sleep_memory_locals_dict_table[] = { +}; + +STATIC MP_DEFINE_CONST_DICT(alarm_sleep_memory_locals_dict, alarm_sleep_memory_locals_dict_table); + +//| @overload +//| def __getitem__(self, index: slice) -> bytearray: ... +//| @overload +//| def __getitem__(self, index: int) -> int: +//| """Returns the value at the given index.""" +//| ... +//| +//| @overload +//| def __setitem__(self, index: slice, value: ReadableBuffer) -> None: ... +//| @overload +//| def __setitem__(self, index: int, value: int) -> None: +//| """Set the value at the given index.""" +//| ... +//| +STATIC mp_obj_t alarm_sleep_memory_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value) { + if (value == MP_OBJ_NULL) { + // delete item + // slice deletion + return MP_OBJ_NULL; // op not supported + } else { + alarm_sleep_memory_obj_t *self = MP_OBJ_TO_PTR(self_in); + if (0) { +#if MICROPY_PY_BUILTINS_SLICE + } else if (MP_OBJ_IS_TYPE(index_in, &mp_type_slice)) { + mp_bound_slice_t slice; + if (!mp_seq_get_fast_slice_indexes(common_hal_alarm_sleep_memory_get_length(self), index_in, &slice)) { + mp_raise_NotImplementedError(translate("only slices with step=1 (aka None) are supported")); + } + if (value != MP_OBJ_SENTINEL) { + #if MICROPY_PY_ARRAY_SLICE_ASSIGN + // Assign + size_t src_len = slice.stop - slice.start; + uint8_t* src_items; + if (MP_OBJ_IS_TYPE(value, &mp_type_array) || + MP_OBJ_IS_TYPE(value, &mp_type_bytearray) || + MP_OBJ_IS_TYPE(value, &mp_type_memoryview) || + MP_OBJ_IS_TYPE(value, &mp_type_bytes)) { + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(value, &bufinfo, MP_BUFFER_READ); + if (bufinfo.len != src_len) { + mp_raise_ValueError(translate("Slice and value different lengths.")); + } + src_len = bufinfo.len; + src_items = bufinfo.buf; + if (1 != mp_binary_get_size('@', bufinfo.typecode, NULL)) { + mp_raise_ValueError(translate("Array values should be single bytes.")); + } + } else { + mp_raise_NotImplementedError(translate("array/bytes required on right side")); + } + + if (!common_hal_alarm_sleep_memory_set_bytes(self, slice.start, src_items, src_len)) { + mp_raise_RuntimeError(translate("Unable to write to nvm.")); + } + return mp_const_none; + #else + return MP_OBJ_NULL; // op not supported + #endif + } else { + // Read slice. + size_t len = slice.stop - slice.start; + uint8_t *items = m_new(uint8_t, len); + common_hal_alarm_sleep_memory_get_bytes(self, slice.start, len, items); + return mp_obj_new_bytearray_by_ref(len, items); + } +#endif + } else { + // Single index rather than slice. + size_t index = mp_get_index(self->base.type, common_hal_alarm_sleep_memory_get_length(self), + index_in, false); + if (value == MP_OBJ_SENTINEL) { + // load + uint8_t value_out; + common_hal_alarm_sleep_memory_get_bytes(self, index, 1, &value_out); + return MP_OBJ_NEW_SMALL_INT(value_out); + } else { + // store + mp_int_t byte_value = mp_obj_get_int(value); + if (byte_value > 0xff || byte_value < 0) { + mp_raise_ValueError(translate("Bytes must be between 0 and 255.")); + } + uint8_t short_value = byte_value; + if (!common_hal_alarm_sleep_memory_set_bytes(self, index, &short_value, 1)) { + mp_raise_RuntimeError(translate("Unable to write to nvm.")); + } + return mp_const_none; + } + } + } +} + +const mp_obj_type_t alarm_sleep_memory_type = { + { &mp_type_type }, + .name = MP_QSTR_SleepMemory, + .subscr = alarm_sleep_memory_subscr, + .unary_op = alarm_sleep_memory_unary_op, + .print = NULL, + .locals_dict = (mp_obj_t)&alarm_sleep_memory_locals_dict, +}; diff --git a/shared-bindings/alarm/SleepMemory.h b/shared-bindings/alarm/SleepMemory.h new file mode 100644 index 0000000000000..0015233e0b000 --- /dev/null +++ b/shared-bindings/alarm/SleepMemory.h @@ -0,0 +1,44 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2020 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. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_SLEEPMEMORY_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_SLEEPMEMORY_H + +#include "common-hal/alarm/SleepMemory.h" + +extern const mp_obj_type_t alarm_sleep_memory_type; + +uint32_t common_hal_alarm_sleep_memory_get_length(alarm_sleep_memory_obj_t *self); + +bool common_hal_alarm_sleep_memory_set_bytes(alarm_sleep_memory_obj_t *self, + uint32_t start_index, uint8_t* values, uint32_t len); +// len and values are intentionally swapped to signify values is an output and +// also leverage the compiler to validate uses are expected. +void common_hal_alarm_sleep_memory_get_bytes(alarm_sleep_memory_obj_t *self, + uint32_t start_index, uint32_t len, uint8_t* values); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_SLEEPMEMORY_H diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 5420b8404bb92..28e34ad6aa74f 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -29,6 +29,7 @@ #include "py/runtime.h" #include "shared-bindings/alarm/__init__.h" +#include "shared-bindings/alarm/SleepMemory.h" #include "shared-bindings/alarm/pin/PinAlarm.h" #include "shared-bindings/alarm/time/TimeAlarm.h" #include "shared-bindings/supervisor/Runtime.h" @@ -177,6 +178,7 @@ STATIC const mp_obj_module_t alarm_time_module = { .globals = (mp_obj_dict_t*)&alarm_time_globals, }; +// The module table is mutable because .wake_alarm is a mutable attribute. STATIC mp_map_elem_t alarm_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_alarm) }, @@ -188,8 +190,10 @@ STATIC mp_map_elem_t alarm_module_globals_table[] = { MP_OBJ_FROM_PTR(&alarm_exit_and_deep_sleep_until_alarms_obj) }, { MP_ROM_QSTR(MP_QSTR_pin), MP_OBJ_FROM_PTR(&alarm_pin_module) }, - { MP_ROM_QSTR(MP_QSTR_time), MP_OBJ_FROM_PTR(&alarm_time_module) } + { MP_ROM_QSTR(MP_QSTR_time), MP_OBJ_FROM_PTR(&alarm_time_module) }, + { MP_ROM_QSTR(MP_QSTR_SleepMemory), MP_OBJ_FROM_PTR(&alarm_sleep_memory_type) }, + { MP_ROM_QSTR(MP_QSTR_sleep_memory), MP_OBJ_FROM_PTR(&alarm_sleep_memory_obj) }, }; STATIC MP_DEFINE_MUTABLE_DICT(alarm_module_globals, alarm_module_globals_table); From 6d2329fb09ce47eaa5cdf0dbf9c5e1e1ef37632a Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Thu, 10 Dec 2020 10:59:26 -0800 Subject: [PATCH 400/770] add blank lines after all comment sections --- shared-bindings/msgpack/ExtType.c | 9 ++++++--- shared-bindings/msgpack/__init__.c | 8 ++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/shared-bindings/msgpack/ExtType.c b/shared-bindings/msgpack/ExtType.c index 272c1ccebc62f..6f0a16b9997d9 100644 --- a/shared-bindings/msgpack/ExtType.c +++ b/shared-bindings/msgpack/ExtType.c @@ -35,7 +35,8 @@ //| """Constructor //| :param int code: type code in range 0~127. //| :param bytes data: representation.""" - +//| ... +//| STATIC mp_obj_t mod_msgpack_exttype_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { mod_msgpack_extype_obj_t *self = m_new_obj(mod_msgpack_extype_obj_t); self->base.type = &mod_msgpack_exttype_type; @@ -61,7 +62,8 @@ STATIC mp_obj_t mod_msgpack_exttype_make_new(const mp_obj_type_t *type, size_t n //| code: int //| """The type code, in range 0~127.""" - +//| ... +//| STATIC mp_obj_t mod_msgpack_exttype_get_code(mp_obj_t self_in) { mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); return MP_OBJ_NEW_SMALL_INT(self->code); @@ -88,7 +90,8 @@ const mp_obj_property_t mod_msgpack_exttype_code_obj = { //| data: bytes //| """Data.""" - +//| ... +//| STATIC mp_obj_t mod_msgpack_exttype_get_data(mp_obj_t self_in) { mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); return self->data; diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index 06c3900b5d238..b41b32d45f911 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -79,6 +79,8 @@ //| decoded = unpack(buffer, ext_hook=decoder) //| print(f"{data} -> {buffer.getvalue()} -> {decoded}") //| """ +//| ... +//| //| def pack(obj: object, buffer: WriteableBuffer, *, default: Union[Callable[[object], None], None] = None) -> None: //| """Ouput object to buffer in msgpack format. @@ -88,7 +90,8 @@ //| function called for python objects that do not have //| a representation in msgpack format. //| """ - +//| ... +//| STATIC mp_obj_t mod_msgpack_pack(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_obj, ARG_buffer, ARG_default }; STATIC const mp_arg_t allowed_args[] = { @@ -118,7 +121,8 @@ MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_pack_obj, 1, mod_msgpack_pack); //| :param Optional[bool] use_list: return array as list or tuple (use_list=False). //| :return object: object read from buffer. //| """ - +//| ... +//| STATIC mp_obj_t mod_msgpack_unpack(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buffer, ARG_ext_hook, ARG_use_list }; STATIC const mp_arg_t allowed_args[] = { From 55f4110983c175fbb70fa15303f686229ae1ed63 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 10 Dec 2020 14:16:25 -0500 Subject: [PATCH 401/770] fix typo --- ports/esp32s2/common-hal/alarm/SleepMemory.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/ports/esp32s2/common-hal/alarm/SleepMemory.h b/ports/esp32s2/common-hal/alarm/SleepMemory.h index adf7b35ae2ff4..665ac543d6412 100644 --- a/ports/esp32s2/common-hal/alarm/SleepMemory.h +++ b/ports/esp32s2/common-hal/alarm/SleepMemory.h @@ -29,8 +29,6 @@ #include "py/obj.h" -#define SLEEP_MEMORY_LENGTH (8192) - // There are several places we could store persistent data for SleepMemory: // // RTC registers: There are a few 32-bit registers maintained during deep sleep. From d83d46a52d4a5da9541cfa4bfa7d13e285fce476 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 10 Dec 2020 14:28:22 -0500 Subject: [PATCH 402/770] Invoke scripts with --- py/mkenv.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/py/mkenv.mk b/py/mkenv.mk index cb678e8e78e2d..7e99f59c10cc9 100644 --- a/py/mkenv.mk +++ b/py/mkenv.mk @@ -56,7 +56,7 @@ RM = rm RSYNC = rsync SED = sed # Linux has 'nproc', macOS has 'sysctl -n hw.logicalcpu', this is cross-platform -NPROC = $(PYTHON) -c 'import multiprocessing as mp; print(mp.cpu_count())' +NPROC = $(PYTHON3) -c 'import multiprocessing as mp; print(mp.cpu_count())' AS = $(CROSS_COMPILE)as CC = $(CROSS_COMPILE)gcc @@ -72,7 +72,7 @@ CXX += -m32 LD += -m32 endif -MAKE_FROZEN = $(PYTHON) $(TOP)/tools/make-frozen.py +MAKE_FROZEN = $(PYTHON3) $(TOP)/tools/make-frozen.py MPY_CROSS = $(TOP)/mpy-cross/mpy-cross MPY_TOOL = $(PYTHON3) $(TOP)/tools/mpy-tool.py PREPROCESS_FROZEN_MODULES = PYTHONPATH=$(TOP)/tools/python-semver $(TOP)/tools/preprocess_frozen_modules.py From cb35abfd04762871283e0323bddf0904d27913ea Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Fri, 11 Dec 2020 01:01:01 +0530 Subject: [PATCH 403/770] add docs, update translation & fix ota.flash() --- locale/circuitpython.pot | 10 +++++++++- ports/esp32s2/common-hal/ota/__init__.c | 2 +- shared-bindings/ota/__init__.c | 23 ++++++++++++++++++----- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 5bf95043a6d8c..214b7aad16baf 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-12-08 10:30+0530\n" +"POT-Creation-Date: 2020-12-10 16:56+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1907,6 +1907,10 @@ msgstr "" msgid "Unable to read color palette data" msgstr "" +#: ports/esp32s2/common-hal/ota/__init__.c +msgid "Unable to switch boot partition" +msgstr "" + #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "" @@ -3198,6 +3202,10 @@ msgstr "" msgid "offset is too large" msgstr "" +#: shared-bindings/ota/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" diff --git a/ports/esp32s2/common-hal/ota/__init__.c b/ports/esp32s2/common-hal/ota/__init__.c index 40cfce6769722..5ea25fb5d487c 100644 --- a/ports/esp32s2/common-hal/ota/__init__.c +++ b/ports/esp32s2/common-hal/ota/__init__.c @@ -145,6 +145,6 @@ void common_hal_ota_finish(void) { void common_hal_ota_switch(void) { if (esp_ota_set_boot_partition(esp_ota_get_next_update_partition(NULL)) != ESP_OK) { - mp_raise_RuntimeError(translate("Unable to switch partition")); + mp_raise_RuntimeError(translate("Unable to switch boot partition")); } } diff --git a/shared-bindings/ota/__init__.c b/shared-bindings/ota/__init__.c index 46399dcb2eb63..03636779fe31c 100644 --- a/shared-bindings/ota/__init__.c +++ b/shared-bindings/ota/__init__.c @@ -30,39 +30,52 @@ //| //| The `ota` module implements over-the-air update.""" +//| def switch() -> None: +//| """Switches the boot partition. +//| ... +//| STATIC mp_obj_t ota_switch(void) { common_hal_ota_switch(); return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_switch_obj, ota_switch); +//| def finish() -> None: +//| """Validates flashed firmware, sets next boot partition. +//| **Must be called after** `ota.flash()` +//| ... +//| STATIC mp_obj_t ota_finish(void) { common_hal_ota_finish(); return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_finish_obj, ota_finish); +//| def flash(*buffer: WriteableBuffer, offset: int=0) -> None: +//| """Writes one of two OTA partition at the given offset. +//| ... +//| STATIC mp_obj_t ota_flash(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_binary, ARG_offset }; + enum { ARG_buffer, ARG_offset }; static const mp_arg_t allowed_args[] = { - { MP_QSTR_binary, MP_ARG_OBJ | MP_ARG_REQUIRED }, + { MP_QSTR_buffer, MP_ARG_OBJ | MP_ARG_REQUIRED }, { MP_QSTR_offset, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = -1} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); if (args[ARG_offset].u_int < -1) { mp_raise_ValueError(translate("offset must be >= 0")); } mp_buffer_info_t bufinfo; - mp_get_buffer_raise(args[ARG_binary].u_obj, &bufinfo, MP_BUFFER_READ); + mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_READ); common_hal_ota_flash(bufinfo.buf, bufinfo.len, args[ARG_offset].u_int); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ota_flash_obj, 1, ota_flash); +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ota_flash_obj, 0, ota_flash); STATIC const mp_rom_map_elem_t ota_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ota) }, From d29184b5a0fb5c54663d48a8e8906564c3d518ad Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Thu, 10 Dec 2020 12:15:43 -0800 Subject: [PATCH 404/770] try without ... in docs --- shared-bindings/msgpack/ExtType.c | 3 --- shared-bindings/msgpack/__init__.c | 3 --- 2 files changed, 6 deletions(-) diff --git a/shared-bindings/msgpack/ExtType.c b/shared-bindings/msgpack/ExtType.c index 6f0a16b9997d9..5dc3d4992ee41 100644 --- a/shared-bindings/msgpack/ExtType.c +++ b/shared-bindings/msgpack/ExtType.c @@ -35,7 +35,6 @@ //| """Constructor //| :param int code: type code in range 0~127. //| :param bytes data: representation.""" -//| ... //| STATIC mp_obj_t mod_msgpack_exttype_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { mod_msgpack_extype_obj_t *self = m_new_obj(mod_msgpack_extype_obj_t); @@ -62,7 +61,6 @@ STATIC mp_obj_t mod_msgpack_exttype_make_new(const mp_obj_type_t *type, size_t n //| code: int //| """The type code, in range 0~127.""" -//| ... //| STATIC mp_obj_t mod_msgpack_exttype_get_code(mp_obj_t self_in) { mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -90,7 +88,6 @@ const mp_obj_property_t mod_msgpack_exttype_code_obj = { //| data: bytes //| """Data.""" -//| ... //| STATIC mp_obj_t mod_msgpack_exttype_get_data(mp_obj_t self_in) { mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index b41b32d45f911..5dc45dde2c676 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -79,7 +79,6 @@ //| decoded = unpack(buffer, ext_hook=decoder) //| print(f"{data} -> {buffer.getvalue()} -> {decoded}") //| """ -//| ... //| //| def pack(obj: object, buffer: WriteableBuffer, *, default: Union[Callable[[object], None], None] = None) -> None: @@ -90,7 +89,6 @@ //| function called for python objects that do not have //| a representation in msgpack format. //| """ -//| ... //| STATIC mp_obj_t mod_msgpack_pack(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_obj, ARG_buffer, ARG_default }; @@ -121,7 +119,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_pack_obj, 1, mod_msgpack_pack); //| :param Optional[bool] use_list: return array as list or tuple (use_list=False). //| :return object: object read from buffer. //| """ -//| ... //| STATIC mp_obj_t mod_msgpack_unpack(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buffer, ARG_ext_hook, ARG_use_list }; From cf938983e9c584b0c41a909723dc71e9161cc494 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 11 Dec 2020 08:10:26 -0500 Subject: [PATCH 405/770] SleepMemory + set alarm.wake_alarm --- main.c | 12 ++++++++---- ports/esp32s2/common-hal/alarm/time/TimeAlarm.c | 1 + shared-bindings/alarm/__init__.c | 7 ++++++- shared-bindings/alarm/__init__.h | 5 ++++- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index da04ada466b02..378c506579696 100755 --- a/main.c +++ b/main.c @@ -112,9 +112,6 @@ STATIC void start_mp(supervisor_allocation* heap) { reset_status_led(); autoreload_stop(); supervisor_workflow_reset(); -#if CIRCUITPY_ALARM - alarm_reset(); -#endif // Stack limit should be less than real stack size, so we have a chance // to recover from limit hit. (Limit is measured in bytes.) @@ -158,6 +155,13 @@ STATIC void start_mp(supervisor_allocation* heap) { mp_obj_list_init(mp_sys_argv, 0); + #if CIRCUITPY_ALARM + // Record which alarm woke us up, if any. An object may be created so the heap must be functional. + alarm_save_wakeup_alarm(); + // Reset alarm module only after we retrieved the wakeup alarm. + alarm_reset(); + #endif + #if CIRCUITPY_NETWORK network_module_init(); #endif @@ -285,6 +289,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { filesystem_flush(); supervisor_allocation* heap = allocate_remaining_memory(); start_mp(heap); + found_main = maybe_run_list(supported_filenames, &result); #if CIRCUITPY_FULL_BUILD if (!found_main){ @@ -354,7 +359,6 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { serial_write_compressed(translate("Woken up by alarm.\n")); board_init(); supervisor_set_run_reason(RUN_REASON_STARTUP); - // TODO: Reset any volatile memory the user may have access to. return true; } #endif diff --git a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c index d5e896c0154a0..4d0bba2387816 100644 --- a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +++ b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c @@ -52,6 +52,7 @@ mp_obj_t alarm_time_timealarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t * alarm_time_time_alarm_obj_t *timer = m_new_obj(alarm_time_time_alarm_obj_t); timer->base.type = &alarm_time_time_alarm_type; // TODO: Set monotonic_time based on the RTC state. + timer->monotonic_time = 0.0f; return timer; } diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 28e34ad6aa74f..5ef548ef2710f 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -197,7 +197,7 @@ STATIC mp_map_elem_t alarm_module_globals_table[] = { }; STATIC MP_DEFINE_MUTABLE_DICT(alarm_module_globals, alarm_module_globals_table); -void common_hal_alarm_set_wake_alarm(mp_obj_t alarm) { +STATIC void alarm_set_wake_alarm(mp_obj_t alarm) { // Equivalent of: // alarm.wake_alarm = alarm mp_map_elem_t *elem = @@ -207,6 +207,11 @@ void common_hal_alarm_set_wake_alarm(mp_obj_t alarm) { } } +// Initialize .wake_alarm value. +void alarm_save_wakeup_alarm(void) { + alarm_set_wake_alarm(common_hal_alarm_get_wake_alarm()); +} + const mp_obj_module_t alarm_module = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t*)&alarm_module_globals, diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h index 5a8c613d9d55a..8c4b6cad96c17 100644 --- a/shared-bindings/alarm/__init__.h +++ b/shared-bindings/alarm/__init__.h @@ -43,8 +43,11 @@ extern void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj // Deep sleep is entered outside of the VM so we omit the `common_hal_` prefix. extern NORETURN void alarm_enter_deep_sleep(void); +extern mp_obj_t common_hal_alarm_get_wake_alarm(void); + // Used by wake-up code. -extern void common_hal_alarm_set_wake_alarm(mp_obj_t alarm); +void alarm_save_wakeup_alarm(void); + // True if an alarm is alerting. This is most useful for pretend deep sleep. extern bool alarm_woken_from_sleep(void); From 1daad63d2b54e8fcf9965030ed965873fbcdc178 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 11 Dec 2020 08:34:40 -0500 Subject: [PATCH 406/770] add apt-get update --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2378a09653f11..6ca679325065c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,6 +35,7 @@ jobs: python-version: 3.8 - name: Install deps run: | + sudo apt-get update sudo apt-get install -y eatmydata sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 latexmk texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black awscli mypy From 39124b888b5e2b55ee99dd60f7afa5e2edfa9fb5 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 11 Dec 2020 09:03:45 -0500 Subject: [PATCH 407/770] doc fixes --- shared-bindings/alarm/SleepMemory.c | 4 ++-- shared-bindings/alarm/__init__.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/shared-bindings/alarm/SleepMemory.c b/shared-bindings/alarm/SleepMemory.c index d4a6eb509061c..7a585ba2c6785 100644 --- a/shared-bindings/alarm/SleepMemory.c +++ b/shared-bindings/alarm/SleepMemory.c @@ -47,10 +47,10 @@ //| import alarm //| alarm.sleep_memory[0] = True //| alarm.sleep_memory[1] = 12 -//| +//| """ //| def __init__(self) -> None: -//| """Not currently dynamically supported. Access the sole instance through `microcontroller.nvm`.""" +//| """Not used. Access the sole instance through `alarm.sleep_memory`.""" //| ... //| diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 5ef548ef2710f..700fe020ea6ae 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -58,7 +58,11 @@ //| maintaining the connection takes priority and power consumption may not be reduced. //| """ +//| sleep_memory: SleepMemory +//| """Memory that persists during deep sleep. +//| This object is the sole instance of `alarm.SleepMemory`.""" //| + //| wake_alarm: Alarm //| """The most recently triggered alarm. If CircuitPython was sleeping, the alarm the woke it from sleep.""" //| From 08e94e6a204708060860a9ed3b801bf3fb5b5ecc Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Fri, 11 Dec 2020 22:55:22 +0530 Subject: [PATCH 408/770] add more docs --- shared-bindings/ota/__init__.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/shared-bindings/ota/__init__.c b/shared-bindings/ota/__init__.c index 03636779fe31c..152a8e802def0 100644 --- a/shared-bindings/ota/__init__.c +++ b/shared-bindings/ota/__init__.c @@ -26,12 +26,26 @@ #include "shared-bindings/ota/__init__.h" -//| """ota module +//| """OTA Module +//| +//| The `ota` module implements over-the-air update. +//| +//| There are two identical ota partitions ota_0/1, these +//| contain different firmware versions. +//| Having two partitions enables rollback functionality. +//| +//| The two partitions are defined as boot partition and +//| next-update partition. Calling `ota.flash()` writes the +//| next-update partition. +//| +//| After the next-update partition is written a validation +//| check is performed and on a successful validation this +//| partition is set as the boot partition. On next reset, +//| firmware will be loaded from this partition""" //| -//| The `ota` module implements over-the-air update.""" //| def switch() -> None: -//| """Switches the boot partition. +//| """Switches the boot partition.""" //| ... //| STATIC mp_obj_t ota_switch(void) { @@ -42,7 +56,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_switch_obj, ota_switch); //| def finish() -> None: //| """Validates flashed firmware, sets next boot partition. -//| **Must be called after** `ota.flash()` +//| **Must be called after** `ota.flash()`""" //| ... //| STATIC mp_obj_t ota_finish(void) { @@ -52,7 +66,10 @@ STATIC mp_obj_t ota_finish(void) { STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_finish_obj, ota_finish); //| def flash(*buffer: WriteableBuffer, offset: int=0) -> None: -//| """Writes one of two OTA partition at the given offset. +//| """Writes one of two OTA partitions at the given offset. +//| +//| The default offset is 0. It is necessary to provide the +//| offset when writing in discontinous chunks.""" //| ... //| STATIC mp_obj_t ota_flash(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { From 8d9d53a07c7f138f97e499a572992951017f0d73 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Fri, 11 Dec 2020 16:31:15 +0000 Subject: [PATCH 409/770] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (877 of 877 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 282392bda1e65..7595f8485b3b4 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-08 09:56-0800\n" -"PO-Revision-Date: 2020-12-04 06:29+0000\n" +"PO-Revision-Date: 2020-12-11 19:08+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -1601,10 +1601,13 @@ msgstr "" #: main.c msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" +"Pressione qualquer tecla para entrar no REPL. Use CTRL-D para recarregar.\n" #: main.c msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" +"Simular o deep sleep até o alarme, até qualquer chave ou até a escrita do " +"arquivo.\n" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2102,7 +2105,7 @@ msgstr "A senha do Wi-Fi deve ter entre 8 e 63 caracteres" #: main.c msgid "Woken up by alarm.\n" -msgstr "" +msgstr "Foi despertado através do alarme.\n" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" From e3194ad54e95917b6a15da190f8fa565aa322efb Mon Sep 17 00:00:00 2001 From: BennyE Date: Fri, 11 Dec 2020 20:35:28 +0100 Subject: [PATCH 410/770] Reserve UART pins only if DEBUG=1 is set to address issue 3811 --- ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c | 2 ++ ports/esp32s2/boards/electroniccats_bastwifi/board.c | 2 ++ ports/esp32s2/boards/espressif_kaluga_1/board.c | 2 ++ ports/esp32s2/boards/espressif_saola_1_wroom/board.c | 2 ++ ports/esp32s2/boards/espressif_saola_1_wrover/board.c | 2 ++ ports/esp32s2/boards/microdev_micro_s2/board.c | 2 ++ ports/esp32s2/boards/muselab_nanoesp32_s2/board.c | 2 ++ ports/esp32s2/boards/targett_module_clip_wroom/board.c | 2 ++ ports/esp32s2/boards/targett_module_clip_wrover/board.c | 2 ++ ports/esp32s2/boards/unexpectedmaker_feathers2/board.c | 2 ++ .../esp32s2/boards/unexpectedmaker_feathers2_prerelease/board.c | 2 ++ 11 files changed, 22 insertions(+) diff --git a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c index a9d1074f728b1..63a16c1206582 100644 --- a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c +++ b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/board.c @@ -115,8 +115,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; common_hal_busio_spi_construct(spi, &pin_GPIO36, &pin_GPIO35, NULL); diff --git a/ports/esp32s2/boards/electroniccats_bastwifi/board.c b/ports/esp32s2/boards/electroniccats_bastwifi/board.c index ff5d9cfb6c7cb..aaef97c7d1404 100644 --- a/ports/esp32s2/boards/electroniccats_bastwifi/board.c +++ b/ports/esp32s2/boards/electroniccats_bastwifi/board.c @@ -34,8 +34,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ } bool board_requests_safe_mode(void) { diff --git a/ports/esp32s2/boards/espressif_kaluga_1/board.c b/ports/esp32s2/boards/espressif_kaluga_1/board.c index ff5d9cfb6c7cb..aaef97c7d1404 100644 --- a/ports/esp32s2/boards/espressif_kaluga_1/board.c +++ b/ports/esp32s2/boards/espressif_kaluga_1/board.c @@ -34,8 +34,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ } bool board_requests_safe_mode(void) { diff --git a/ports/esp32s2/boards/espressif_saola_1_wroom/board.c b/ports/esp32s2/boards/espressif_saola_1_wroom/board.c index ff5d9cfb6c7cb..aaef97c7d1404 100644 --- a/ports/esp32s2/boards/espressif_saola_1_wroom/board.c +++ b/ports/esp32s2/boards/espressif_saola_1_wroom/board.c @@ -34,8 +34,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ } bool board_requests_safe_mode(void) { diff --git a/ports/esp32s2/boards/espressif_saola_1_wrover/board.c b/ports/esp32s2/boards/espressif_saola_1_wrover/board.c index ff5d9cfb6c7cb..aaef97c7d1404 100644 --- a/ports/esp32s2/boards/espressif_saola_1_wrover/board.c +++ b/ports/esp32s2/boards/espressif_saola_1_wrover/board.c @@ -34,8 +34,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ } bool board_requests_safe_mode(void) { diff --git a/ports/esp32s2/boards/microdev_micro_s2/board.c b/ports/esp32s2/boards/microdev_micro_s2/board.c index abd22091ee771..d8fd3a0a2b7bb 100644 --- a/ports/esp32s2/boards/microdev_micro_s2/board.c +++ b/ports/esp32s2/boards/microdev_micro_s2/board.c @@ -34,8 +34,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ // SPI Flash and RAM common_hal_never_reset_pin(&pin_GPIO26); diff --git a/ports/esp32s2/boards/muselab_nanoesp32_s2/board.c b/ports/esp32s2/boards/muselab_nanoesp32_s2/board.c index ff5d9cfb6c7cb..aaef97c7d1404 100644 --- a/ports/esp32s2/boards/muselab_nanoesp32_s2/board.c +++ b/ports/esp32s2/boards/muselab_nanoesp32_s2/board.c @@ -34,8 +34,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ } bool board_requests_safe_mode(void) { diff --git a/ports/esp32s2/boards/targett_module_clip_wroom/board.c b/ports/esp32s2/boards/targett_module_clip_wroom/board.c index c2022d292e5bb..9c58dd2c8a1e3 100644 --- a/ports/esp32s2/boards/targett_module_clip_wroom/board.c +++ b/ports/esp32s2/boards/targett_module_clip_wroom/board.c @@ -34,8 +34,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ // Crystal common_hal_never_reset_pin(&pin_GPIO15); diff --git a/ports/esp32s2/boards/targett_module_clip_wrover/board.c b/ports/esp32s2/boards/targett_module_clip_wrover/board.c index 5a9fbcbee7a5d..f5e66acb61579 100644 --- a/ports/esp32s2/boards/targett_module_clip_wrover/board.c +++ b/ports/esp32s2/boards/targett_module_clip_wrover/board.c @@ -34,8 +34,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ //Crystal common_hal_never_reset_pin(&pin_GPIO15); diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c b/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c index abd22091ee771..d8fd3a0a2b7bb 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c @@ -34,8 +34,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ // SPI Flash and RAM common_hal_never_reset_pin(&pin_GPIO26); diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/board.c b/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/board.c index abd22091ee771..d8fd3a0a2b7bb 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/board.c +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/board.c @@ -34,8 +34,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ // SPI Flash and RAM common_hal_never_reset_pin(&pin_GPIO26); From 2de5eba6d11c5c0cab61cf20ee21b50016a5cf25 Mon Sep 17 00:00:00 2001 From: BennyE Date: Fri, 11 Dec 2020 21:17:07 +0100 Subject: [PATCH 411/770] add apt-get update --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2378a09653f11..6ca679325065c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,6 +35,7 @@ jobs: python-version: 3.8 - name: Install deps run: | + sudo apt-get update sudo apt-get install -y eatmydata sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 latexmk texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black awscli mypy From 37c9f768b5f492cd1dc3b64632d0f91dbce313e7 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 11 Dec 2020 08:34:40 -0500 Subject: [PATCH 412/770] add apt-get update --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2378a09653f11..6ca679325065c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,6 +35,7 @@ jobs: python-version: 3.8 - name: Install deps run: | + sudo apt-get update sudo apt-get install -y eatmydata sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 latexmk texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black awscli mypy From 81c4871fdf457658e30fd0064fdd6250eb9f89e9 Mon Sep 17 00:00:00 2001 From: BennyE Date: Fri, 11 Dec 2020 22:11:39 +0100 Subject: [PATCH 413/770] Set DEBUG CFLAG if set in make --- ports/esp32s2/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 4486cb598c1ef..01f8f48a78ee4 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -118,7 +118,7 @@ CFLAGS += -DSTACK_CANARY_VALUE=0xa5a5a5a5 #Debugging/Optimization ifeq ($(DEBUG), 1) - CFLAGS += -ggdb + CFLAGS += -DDEBUG -ggdb OPTIMIZATION_FLAGS ?= -Og # You may want to enable these flags to make setting breakpoints easier. # CFLAGS += -fno-inline -fno-ipa-sra From 92098ca06b2d119db7810738ed7da262bdea5686 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Sat, 12 Dec 2020 05:15:25 +0530 Subject: [PATCH 414/770] update docs, implement suggested changes --- shared-bindings/ota/__init__.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/shared-bindings/ota/__init__.c b/shared-bindings/ota/__init__.c index 152a8e802def0..8ecc6d9c41d68 100644 --- a/shared-bindings/ota/__init__.c +++ b/shared-bindings/ota/__init__.c @@ -41,11 +41,24 @@ //| After the next-update partition is written a validation //| check is performed and on a successful validation this //| partition is set as the boot partition. On next reset, -//| firmware will be loaded from this partition""" +//| firmware will be loaded from this partition. +//| +//| Here is the sequence of commands to follow: +//| +//| .. code-block:: python +//| +//| import ota +//| +//| ota.flash(buffer, offset) +//| ota.finish() +//| """ +//| ... //| //| def switch() -> None: -//| """Switches the boot partition.""" +//| """Switches the boot partition. On next reset, +//| firmware will be loaded from the partition +//| just switched over to.""" //| ... //| STATIC mp_obj_t ota_switch(void) { @@ -56,7 +69,10 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_switch_obj, ota_switch); //| def finish() -> None: //| """Validates flashed firmware, sets next boot partition. -//| **Must be called after** `ota.flash()`""" +//| **Must be called** after the firmware has been +//| completely written into the flash using `ota.flash()`. +//| +//| This is to be called only once per update.""" //| ... //| STATIC mp_obj_t ota_finish(void) { @@ -65,11 +81,14 @@ STATIC mp_obj_t ota_finish(void) { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_finish_obj, ota_finish); -//| def flash(*buffer: WriteableBuffer, offset: int=0) -> None: +//| def flash(*buffer: ReadableBuffer, offset: int=0) -> None: //| """Writes one of two OTA partitions at the given offset. //| //| The default offset is 0. It is necessary to provide the -//| offset when writing in discontinous chunks.""" +//| offset when writing in discontinous chunks. +//| +//| This can be called multiple times when flashing the firmware +//| in small chunks.""" //| ... //| STATIC mp_obj_t ota_flash(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { From c5c13620f23f7275945ef0e4c7b17a014cbfa635 Mon Sep 17 00:00:00 2001 From: BennyE Date: Sat, 12 Dec 2020 00:49:53 +0100 Subject: [PATCH 415/770] Fix for issue 3663 by returning early if no scan was started before stop is issued --- ports/esp32s2/common-hal/wifi/Radio.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index 49cb8ec30f489..05506783e7ad9 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -105,6 +105,10 @@ mp_obj_t common_hal_wifi_radio_start_scanning_networks(wifi_radio_obj_t *self) { } void common_hal_wifi_radio_stop_scanning_networks(wifi_radio_obj_t *self) { + // Return early if self->current_scan is NULL to avoid hang + if (self->current_scan == NULL) { + return; + } // Free the memory used to store the found aps. wifi_scannednetworks_deinit(self->current_scan); self->current_scan = NULL; From fe32dd08b8618b9c280ce49af8da02ad2cfa032b Mon Sep 17 00:00:00 2001 From: Thea Flowers Date: Sat, 12 Dec 2020 19:16:35 -0500 Subject: [PATCH 416/770] Update Big Honking Button configuration to support its newest board revision. v5 of the BHB board has: * GD25Q64C instead of the GD25Q16C. * Pin PB10 tied to ground for board revision detection. --- .../boards/winterbloom_big_honking_button/mpconfigboard.mk | 4 ++-- ports/atmel-samd/boards/winterbloom_big_honking_button/pins.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk b/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk index 71586d6e0561e..ab2b861c03c69 100644 --- a/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk +++ b/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk @@ -9,8 +9,8 @@ CHIP_VARIANT = SAMD21G18A CHIP_FAMILY = samd21 SPI_FLASH_FILESYSTEM = 1 -EXTERNAL_FLASH_DEVICE_COUNT = 1 -EXTERNAL_FLASH_DEVICES = "GD25Q16C" +EXTERNAL_FLASH_DEVICE_COUNT = 2 +EXTERNAL_FLASH_DEVICES = "GD25Q16C, GD25Q64C" LONGINT_IMPL = MPZ CIRCUITPY_AUDIOIO = 1 diff --git a/ports/atmel-samd/boards/winterbloom_big_honking_button/pins.c b/ports/atmel-samd/boards/winterbloom_big_honking_button/pins.c index f325529f397be..a079929447989 100644 --- a/ports/atmel-samd/boards/winterbloom_big_honking_button/pins.c +++ b/ports/atmel-samd/boards/winterbloom_big_honking_button/pins.c @@ -6,5 +6,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_GATE_OUT), MP_ROM_PTR(&pin_PA11) }, { MP_ROM_QSTR(MP_QSTR_GATE_IN), MP_ROM_PTR(&pin_PA14) }, { MP_ROM_QSTR(MP_QSTR_PITCH_IN), MP_ROM_PTR(&pin_PB08) }, + /* Board revisions starting from v5 have PB10 tied to ground. */ + { MP_ROM_QSTR(MP_QSTR_V5), MP_ROM_PTR(&pin_PB10) }, }; MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); From 210c0ec89c88b50089067f74c2f0893fdd8613b4 Mon Sep 17 00:00:00 2001 From: BennyE Date: Sun, 13 Dec 2020 13:32:12 +0100 Subject: [PATCH 417/770] add country(code) to wifi network objects) --- ports/esp32s2/common-hal/wifi/Network.c | 6 ++++++ shared-bindings/wifi/Network.c | 17 +++++++++++++++++ shared-bindings/wifi/Network.h | 1 + shared-bindings/wifi/Radio.c | 2 +- 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/common-hal/wifi/Network.c b/ports/esp32s2/common-hal/wifi/Network.c index e90b3d552c568..ab60b98f45656 100644 --- a/ports/esp32s2/common-hal/wifi/Network.c +++ b/ports/esp32s2/common-hal/wifi/Network.c @@ -48,3 +48,9 @@ mp_obj_t common_hal_wifi_network_get_rssi(wifi_network_obj_t *self) { mp_obj_t common_hal_wifi_network_get_channel(wifi_network_obj_t *self) { return mp_obj_new_int(self->record.primary); } + +mp_obj_t common_hal_wifi_network_get_country(wifi_network_obj_t *self) { + const char* cstr = (const char*) self->record.country.cc; + return mp_obj_new_str(cstr, strlen(cstr)); +} + diff --git a/shared-bindings/wifi/Network.c b/shared-bindings/wifi/Network.c index bf970a9c0f4be..009712ad190e1 100644 --- a/shared-bindings/wifi/Network.c +++ b/shared-bindings/wifi/Network.c @@ -108,12 +108,29 @@ const mp_obj_property_t wifi_network_channel_obj = { (mp_obj_t)&mp_const_none_obj }, }; +//| country: str +//| """String id of the country code""" +//| +STATIC mp_obj_t wifi_network_get_country(mp_obj_t self) { + return common_hal_wifi_network_get_country(self); + +} +MP_DEFINE_CONST_FUN_OBJ_1(wifi_network_get_country_obj, wifi_network_get_country); + +const mp_obj_property_t wifi_network_country_obj = { + .base.type = &mp_type_property, + .proxy = { (mp_obj_t)&wifi_network_get_country_obj, + (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&mp_const_none_obj }, +}; + STATIC const mp_rom_map_elem_t wifi_network_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_ssid), MP_ROM_PTR(&wifi_network_ssid_obj) }, { MP_ROM_QSTR(MP_QSTR_bssid), MP_ROM_PTR(&wifi_network_bssid_obj) }, { MP_ROM_QSTR(MP_QSTR_rssi), MP_ROM_PTR(&wifi_network_rssi_obj) }, { MP_ROM_QSTR(MP_QSTR_channel), MP_ROM_PTR(&wifi_network_channel_obj) }, + { MP_ROM_QSTR(MP_QSTR_country), MP_ROM_PTR(&wifi_network_country_obj) }, }; STATIC MP_DEFINE_CONST_DICT(wifi_network_locals_dict, wifi_network_locals_dict_table); diff --git a/shared-bindings/wifi/Network.h b/shared-bindings/wifi/Network.h index c9bbc685e6e51..e672e3108a5df 100644 --- a/shared-bindings/wifi/Network.h +++ b/shared-bindings/wifi/Network.h @@ -39,5 +39,6 @@ extern mp_obj_t common_hal_wifi_network_get_ssid(wifi_network_obj_t *self); extern mp_obj_t common_hal_wifi_network_get_bssid(wifi_network_obj_t *self); extern mp_obj_t common_hal_wifi_network_get_rssi(wifi_network_obj_t *self); extern mp_obj_t common_hal_wifi_network_get_channel(wifi_network_obj_t *self); +extern mp_obj_t common_hal_wifi_network_get_country(wifi_network_obj_t *self); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_WIFI_NETWORK_H diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index edbd9fd2ffd36..723572a321081 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -295,7 +295,7 @@ const mp_obj_property_t wifi_radio_ipv4_dns_obj = { }; //| ap_info: Optional[Network] -//| """Network object containing BSSID, SSID, channel, and RSSI when connected to an access point. None otherwise.""" +//| """Network object containing BSSID, SSID, channel, country and RSSI when connected to an access point. None otherwise.""" //| STATIC mp_obj_t wifi_radio_get_ap_info(mp_obj_t self) { return common_hal_wifi_radio_get_ap_info(self); From e0afa32cfa31870e9ac040c5bcf0735f0f020df1 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 14 Dec 2020 11:36:54 -0500 Subject: [PATCH 418/770] use RTC_DATA_ATTR; address review comments --- ports/esp32s2/common-hal/alarm/SleepMemory.c | 26 ++++++++++-------- ports/esp32s2/common-hal/alarm/SleepMemory.h | 20 ++++---------- shared-bindings/alarm/SleepMemory.c | 29 +++----------------- shared-bindings/alarm/SleepMemory.h | 8 ++---- 4 files changed, 27 insertions(+), 56 deletions(-) diff --git a/ports/esp32s2/common-hal/alarm/SleepMemory.c b/ports/esp32s2/common-hal/alarm/SleepMemory.c index 2579eb5fc7165..38e3de2b6d0ee 100644 --- a/ports/esp32s2/common-hal/alarm/SleepMemory.c +++ b/ports/esp32s2/common-hal/alarm/SleepMemory.c @@ -30,33 +30,37 @@ #include "py/runtime.h" #include "common-hal/alarm/SleepMemory.h" +#include "esp_log.h" #include "esp_sleep.h" +// Data storage for singleton instance of SleepMemory. +// Might be RTC_SLOW_MEM or RTC_FAST_MEM, depending on setting of CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM. +static RTC_DATA_ATTR uint8_t _sleep_mem[SLEEP_MEMORY_LENGTH]; + void alarm_sleep_memory_reset(void) { - // Power RTC slow memory during deep sleep - esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_ON); + // ESP-IDF build system takes care of doing esp_sleep_pd_config() or the equivalentwith + // the correct settings, depending on which RTC mem we are using. + // https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-reference/system/sleep_modes.html#power-down-of-rtc-peripherals-and-memories } uint32_t common_hal_alarm_sleep_memory_get_length(alarm_sleep_memory_obj_t *self) { - return SLEEP_MEMORY_LENGTH; + return sizeof(_sleep_mem); } -bool common_hal_alarm_sleep_memory_set_bytes(alarm_sleep_memory_obj_t *self, - uint32_t start_index, uint8_t* values, uint32_t len) { +bool common_hal_alarm_sleep_memory_set_bytes(alarm_sleep_memory_obj_t *self, uint32_t start_index, const uint8_t* values, uint32_t len) { - if (start_index + len > SLEEP_MEMORY_LENGTH) { + if (start_index + len > sizeof(_sleep_mem)) { return false; } - memcpy((uint8_t *) (SLEEP_MEMORY_BASE + start_index), values, len); + memcpy((uint8_t *) (_sleep_mem + start_index), values, len); return true; } -void common_hal_alarm_sleep_memory_get_bytes(alarm_sleep_memory_obj_t *self, - uint32_t start_index, uint32_t len, uint8_t* values) { +void common_hal_alarm_sleep_memory_get_bytes(alarm_sleep_memory_obj_t *self, uint32_t start_index, uint8_t* values, uint32_t len) { - if (start_index + len > SLEEP_MEMORY_LENGTH) { + if (start_index + len > sizeof(_sleep_mem)) { return; } - memcpy(values, (uint8_t *) (SLEEP_MEMORY_BASE + start_index), len); + memcpy(values, (uint8_t *) (_sleep_mem + start_index), len); } diff --git a/ports/esp32s2/common-hal/alarm/SleepMemory.h b/ports/esp32s2/common-hal/alarm/SleepMemory.h index 665ac543d6412..bf6713ab82470 100644 --- a/ports/esp32s2/common-hal/alarm/SleepMemory.h +++ b/ports/esp32s2/common-hal/alarm/SleepMemory.h @@ -34,23 +34,15 @@ // RTC registers: There are a few 32-bit registers maintained during deep sleep. // We are already using one for saving sleep information during deep sleep. // -// RTC Fast Memory: 8kB, also used for deep-sleep power on stub, and for heap -// during normal operation if CONFIG_ESP32S2_ALLOW_RTC_FAST_MEM_AS_HEAP is set. -// Power-on during deep sleep must be enabled. -// I experimented with using RTC Fast Memory. It seemed to work, but occasionally, -// got smashed for unknown reasons. -// Base of RTC Fast memory on the data bus is 0x3FF9E000. The address is different on the instruction bus. -// +// RTC Fast Memory: 8kB, also used for deep-sleep power-on stub. // RTC Slow Memory: 8kB, also used for the ULP (tiny co-processor available during sleep). -// Less likely to be used by ESP-IDF. -// Since we may want to use the ULP in the future, we will use the upper half -// of Slow Memory and reserve the lower half for ULP. -// From ulp.h: -// #define RTC_SLOW_MEM ((uint32_t*) 0x50000000) /*!< RTC slow memory, 8k size */ +// +// The ESP-IDF build system takes care of the power management of these regions. +// RTC_DATA_ATTR will allocate storage in RTC_SLOW_MEM unless CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM +// is set. Any memory not allocated by us can be used by the ESP-IDF for heap or other purposes. -// Upper half of RTC_SLOW_MEM. +// Use half of RTC_SLOW_MEM or RTC_FAST_MEM. #define SLEEP_MEMORY_LENGTH (4096) -#define SLEEP_MEMORY_BASE (0x50000000 + 4096) typedef struct { mp_obj_base_t base; diff --git a/shared-bindings/alarm/SleepMemory.c b/shared-bindings/alarm/SleepMemory.c index 7a585ba2c6785..bec0b766584d4 100644 --- a/shared-bindings/alarm/SleepMemory.c +++ b/shared-bindings/alarm/SleepMemory.c @@ -54,26 +54,6 @@ //| ... //| -//| def __bool__(self) -> bool: -//| """``sleep_memory`` is ``True`` if its length is greater than zero. -//| This is an easy way to check for its existence. -//| """ -//| ... -//| -//| def __len__(self) -> int: -//| """Return the length. This is used by (`len`)""" -//| ... -//| -STATIC mp_obj_t alarm_sleep_memory_unary_op(mp_unary_op_t op, mp_obj_t self_in) { - alarm_sleep_memory_obj_t *self = MP_OBJ_TO_PTR(self_in); - uint16_t len = common_hal_alarm_sleep_memory_get_length(self); - switch (op) { - case MP_UNARY_OP_BOOL: return mp_obj_new_bool(len != 0); - case MP_UNARY_OP_LEN: return MP_OBJ_NEW_SMALL_INT(len); - default: return MP_OBJ_NULL; // op not supported - } -} - STATIC const mp_rom_map_elem_t alarm_sleep_memory_locals_dict_table[] = { }; @@ -131,7 +111,7 @@ STATIC mp_obj_t alarm_sleep_memory_subscr(mp_obj_t self_in, mp_obj_t index_in, m } if (!common_hal_alarm_sleep_memory_set_bytes(self, slice.start, src_items, src_len)) { - mp_raise_RuntimeError(translate("Unable to write to nvm.")); + mp_raise_RuntimeError(translate("Unable to write to sleep_memory.")); } return mp_const_none; #else @@ -141,7 +121,7 @@ STATIC mp_obj_t alarm_sleep_memory_subscr(mp_obj_t self_in, mp_obj_t index_in, m // Read slice. size_t len = slice.stop - slice.start; uint8_t *items = m_new(uint8_t, len); - common_hal_alarm_sleep_memory_get_bytes(self, slice.start, len, items); + common_hal_alarm_sleep_memory_get_bytes(self, slice.start, items, len); return mp_obj_new_bytearray_by_ref(len, items); } #endif @@ -152,7 +132,7 @@ STATIC mp_obj_t alarm_sleep_memory_subscr(mp_obj_t self_in, mp_obj_t index_in, m if (value == MP_OBJ_SENTINEL) { // load uint8_t value_out; - common_hal_alarm_sleep_memory_get_bytes(self, index, 1, &value_out); + common_hal_alarm_sleep_memory_get_bytes(self, index, &value_out, 1); return MP_OBJ_NEW_SMALL_INT(value_out); } else { // store @@ -162,7 +142,7 @@ STATIC mp_obj_t alarm_sleep_memory_subscr(mp_obj_t self_in, mp_obj_t index_in, m } uint8_t short_value = byte_value; if (!common_hal_alarm_sleep_memory_set_bytes(self, index, &short_value, 1)) { - mp_raise_RuntimeError(translate("Unable to write to nvm.")); + mp_raise_RuntimeError(translate("Unable to write to sleep_memory.")); } return mp_const_none; } @@ -174,7 +154,6 @@ const mp_obj_type_t alarm_sleep_memory_type = { { &mp_type_type }, .name = MP_QSTR_SleepMemory, .subscr = alarm_sleep_memory_subscr, - .unary_op = alarm_sleep_memory_unary_op, .print = NULL, .locals_dict = (mp_obj_t)&alarm_sleep_memory_locals_dict, }; diff --git a/shared-bindings/alarm/SleepMemory.h b/shared-bindings/alarm/SleepMemory.h index 0015233e0b000..e7a56521b9cf6 100644 --- a/shared-bindings/alarm/SleepMemory.h +++ b/shared-bindings/alarm/SleepMemory.h @@ -34,11 +34,7 @@ extern const mp_obj_type_t alarm_sleep_memory_type; uint32_t common_hal_alarm_sleep_memory_get_length(alarm_sleep_memory_obj_t *self); -bool common_hal_alarm_sleep_memory_set_bytes(alarm_sleep_memory_obj_t *self, - uint32_t start_index, uint8_t* values, uint32_t len); -// len and values are intentionally swapped to signify values is an output and -// also leverage the compiler to validate uses are expected. -void common_hal_alarm_sleep_memory_get_bytes(alarm_sleep_memory_obj_t *self, - uint32_t start_index, uint32_t len, uint8_t* values); +bool common_hal_alarm_sleep_memory_set_bytes(alarm_sleep_memory_obj_t *self, uint32_t start_index, const uint8_t* values, uint32_t len); +void common_hal_alarm_sleep_memory_get_bytes(alarm_sleep_memory_obj_t *self, uint32_t start_index, uint8_t* values, uint32_t len); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_SLEEPMEMORY_H From e0bb4a808ae1efb30076b4d0dd0991239e361f62 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 14 Dec 2020 11:49:01 -0500 Subject: [PATCH 419/770] make translate --- locale/circuitpython.pot | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 11ca8c8140a33..93c8edc44a000 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-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -388,7 +388,7 @@ msgstr "" msgid "Array must contain halfwords (type 'H')" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "" @@ -522,7 +522,7 @@ msgstr "" msgid "Byte buffer must be 16 bytes." msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "" @@ -1696,7 +1696,7 @@ msgstr "" msgid "Size not supported" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "" @@ -1911,6 +1911,10 @@ msgstr "" msgid "Unable to write to nvm." msgstr "" +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "" @@ -2117,7 +2121,8 @@ msgstr "" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" @@ -3215,7 +3220,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" From f15e2d86c0fb3235a9934b74d22a0d70ea2b4f4c Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Mon, 14 Dec 2020 12:59:20 -0500 Subject: [PATCH 420/770] Reduce samples from 64 to 2 --- ports/esp32s2/common-hal/analogio/AnalogIn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/common-hal/analogio/AnalogIn.c b/ports/esp32s2/common-hal/analogio/AnalogIn.c index f33439c4affe2..b2c09fc076879 100644 --- a/ports/esp32s2/common-hal/analogio/AnalogIn.c +++ b/ports/esp32s2/common-hal/analogio/AnalogIn.c @@ -37,7 +37,7 @@ #include #define DEFAULT_VREF 1100 -#define NO_OF_SAMPLES 64 +#define NO_OF_SAMPLES 2 #define ATTENUATION ADC_ATTEN_DB_11 #define DATA_WIDTH ADC_WIDTH_BIT_13 From dc560f0eee74a95e96dd402f76c6aa31ba13d712 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Mon, 14 Dec 2020 13:00:07 -0500 Subject: [PATCH 421/770] translations --- locale/circuitpython.pot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 06dcdeaa5c6ac..5a850d13c621e 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-12-08 18:56-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" From d793ec287234e1e968adf3b8e03c184c19339942 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Mon, 14 Dec 2020 14:25:38 -0500 Subject: [PATCH 422/770] Change pinfunc to default of 0 at reset --- ports/esp32s2/common-hal/microcontroller/Pin.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index 0434a6e3a021e..81dfa1308d555 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -55,6 +55,7 @@ STATIC void floating_gpio_reset(gpio_num_t pin_number) { .intr_type = GPIO_INTR_DISABLE, }; gpio_config(&cfg); + PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[pin_number], 0); } void never_reset_pin_number(gpio_num_t pin_number) { From eea8bc4999fc56990884e7854a9402b3633000d7 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 14 Dec 2020 15:41:17 -0500 Subject: [PATCH 423/770] Use Dec 11 gcc 10.2 release --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c032b1b8a3687..16f791411796e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -341,7 +341,7 @@ jobs: run: | sudo apt-get install -y gettext pip install requests sh click setuptools awscli - wget --no-verbose https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q2/gcc-arm-none-eabi-10-2020-q2-preview-x86_64-linux.tar.bz2 + wget --no-verbose https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-10-2020-q2-preview-x86_64-linux.tar.bz2 - name: Versions run: | From d2cb58a2df81ddaadaaa5f08699760885e2ecb81 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 14 Dec 2020 15:54:38 -0500 Subject: [PATCH 424/770] suod apt-get update --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16f791411796e..2cef968a4d23f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,6 +35,7 @@ jobs: python-version: 3.8 - name: Install deps run: | + sudo apt-get update sudo apt-get install -y eatmydata sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 latexmk texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black awscli mypy From 845cf03a45c098886acd62c836848194f1161d03 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 14 Dec 2020 15:55:31 -0500 Subject: [PATCH 425/770] typo --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2cef968a4d23f..35f1743db4110 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -343,7 +343,7 @@ jobs: sudo apt-get install -y gettext pip install requests sh click setuptools awscli wget --no-verbose https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 - sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-10-2020-q2-preview-x86_64-linux.tar.bz2 + sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 - name: Versions run: | gcc --version From 731cdefe801633ef39c9036cda6951da50b0075c Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Mon, 14 Dec 2020 16:25:33 -0500 Subject: [PATCH 426/770] this should be it. --- supervisor/shared/external_flash/devices.h | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/supervisor/shared/external_flash/devices.h b/supervisor/shared/external_flash/devices.h index a874dbd4fd0f1..30eb7d72123b6 100644 --- a/supervisor/shared/external_flash/devices.h +++ b/supervisor/shared/external_flash/devices.h @@ -94,6 +94,26 @@ typedef struct { .single_status_byte = false, \ } +// Settings for the Adesto Tech AT25DF641-SSHD-T 8MiB SPI flash +// for the Oak Dev Tech Icy Tree M0 (SAMD21) feather board. +// Source: https://www.digikey.com/product-detail/en/adesto-technologies/AT25SF641-SDHD-T/1265-1180-1-ND/ +// Datasheet: https://www.adestotech.com/wp-content/uploads/doc8693.pdf +#define AT25DF641A {\ + .total_size = (1 << 23), /* 8 MiB */ \ + .start_up_time_us = 10000, \ + .manufacturer_id = 0x1f, \ + .memory_type = 0x48, \ + .capacity = 0x00, \ + .max_clock_speed_mhz = 85, \ + .quad_enable_bit_mask = 0x00, \ + .has_sector_protection = true, \ + .supports_fast_read = true, \ + .supports_qspi = false, \ + .supports_qspi_writes = false, \ + .write_status_register_split = false, \ + .single_status_byte = false, \ +} + // Settings for the Adesto Tech AT25SF161-SSHD-T 2MiB SPI flash // for the StringCar M0 (SAMD21) Express board. // Source: https://www.digikey.com/product-detail/en/adesto-technologies/AT25SF161-SDHD-T/1265-1230-1-ND/ @@ -114,6 +134,7 @@ typedef struct { .single_status_byte = false, \ } + // Settings for the Adesto Tech AT25SF041 1MiB SPI flash. It's on the SparkFun // SAMD51 Thing Plus board // Datasheet: https://www.adestotech.com/wp-content/uploads/DS-AT25SF041_044.pdf @@ -566,6 +587,25 @@ typedef struct { .single_status_byte = true, \ } +// Settings for the Macronix MX25L51245G 64MiB SPI flash. +// Datasheet: https://www.macronix.com/Lists/Datasheet/Attachments/7437/MX25L51245G,%203V,%20512Mb,%20v1.6.pdf +// Will finish this addition in a future PR. All the stuff is there, just need to test in the wild. +//#define MX25L25645G {\ + .total_size = (1 << 25), /* 32 MiB */ \ + .start_up_time_us = 5000, \ + .manufacturer_id = 0x9f, \ + .memory_type = 0xab, \ + .capacity = 0x90, \ + .max_clock_speed_mhz = 133, \ + .quad_enable_bit_mask = 0xaf, \ + .has_sector_protection = false, \ + .supports_fast_read = true, \ + .supports_qspi = true, \ + .supports_qspi_writes = true, \ + .write_status_register_split = false, \ + .single_status_byte = true, \ +}*/ + // Settings for the Winbond W25Q128JV-PM 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 #define W25Q128JV_PM {\ From 6d8642bf41491610e8d76ddfdd9f055d83568e61 Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Mon, 14 Dec 2020 17:17:28 -0500 Subject: [PATCH 427/770] fixing line comment issue with CI build tests --- supervisor/shared/external_flash/devices.h | 28 +++++++++++----------- tests/pyboard 2.py | 1 + 2 files changed, 15 insertions(+), 14 deletions(-) create mode 120000 tests/pyboard 2.py diff --git a/supervisor/shared/external_flash/devices.h b/supervisor/shared/external_flash/devices.h index 30eb7d72123b6..fafb68ef0376e 100644 --- a/supervisor/shared/external_flash/devices.h +++ b/supervisor/shared/external_flash/devices.h @@ -591,20 +591,20 @@ typedef struct { // Datasheet: https://www.macronix.com/Lists/Datasheet/Attachments/7437/MX25L51245G,%203V,%20512Mb,%20v1.6.pdf // Will finish this addition in a future PR. All the stuff is there, just need to test in the wild. //#define MX25L25645G {\ - .total_size = (1 << 25), /* 32 MiB */ \ - .start_up_time_us = 5000, \ - .manufacturer_id = 0x9f, \ - .memory_type = 0xab, \ - .capacity = 0x90, \ - .max_clock_speed_mhz = 133, \ - .quad_enable_bit_mask = 0xaf, \ - .has_sector_protection = false, \ - .supports_fast_read = true, \ - .supports_qspi = true, \ - .supports_qspi_writes = true, \ - .write_status_register_split = false, \ - .single_status_byte = true, \ -}*/ +// .total_size = (1 << 25), /* 32 MiB */ \ +// .start_up_time_us = 5000, \ +// .manufacturer_id = 0x9f, \ +// .memory_type = 0xab, \ +// .capacity = 0x90, \ +// .max_clock_speed_mhz = 133, \ +// .quad_enable_bit_mask = 0xaf, \ +// .has_sector_protection = false, \ +// .supports_fast_read = true, \ +// .supports_qspi = true, \ +// .supports_qspi_writes = true, \ +// .write_status_register_split = false, \ +// .single_status_byte = true, \ +//} // Settings for the Winbond W25Q128JV-PM 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 diff --git a/tests/pyboard 2.py b/tests/pyboard 2.py new file mode 120000 index 0000000000000..616773a313a18 --- /dev/null +++ b/tests/pyboard 2.py @@ -0,0 +1 @@ +../tools/cpboard.py \ No newline at end of file From c16b8f1ee5eb4cea1131ba7db4938c65fb1045d0 Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Mon, 14 Dec 2020 17:26:27 -0500 Subject: [PATCH 428/770] odd thing with a tests/pyboard\ 2.py file showing up --- tests/pyboard 2.py | 1 - 1 file changed, 1 deletion(-) delete mode 120000 tests/pyboard 2.py diff --git a/tests/pyboard 2.py b/tests/pyboard 2.py deleted file mode 120000 index 616773a313a18..0000000000000 --- a/tests/pyboard 2.py +++ /dev/null @@ -1 +0,0 @@ -../tools/cpboard.py \ No newline at end of file From 6abe3cd0ef6c04108b1728797830ebfd1827ecaa Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 14 Dec 2020 18:57:31 -0500 Subject: [PATCH 429/770] -Os for SAMD51; fix CSUPEROPT typo --- ports/atmel-samd/Makefile | 6 +++--- py/py.mk | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index dc7b4e4c89575..c214d56f0c351 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -94,21 +94,21 @@ endif ifeq ($(CHIP_FAMILY), samd51) PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x -OPTIMIZATION_FLAGS ?= -O2 +OPTIMIZATION_FLAGS ?= -Os # TinyUSB defines CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD51 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 endif ifeq ($(CHIP_FAMILY), same51) PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x -OPTIMIZATION_FLAGS ?= -O2 +OPTIMIZATION_FLAGS ?= -Os # TinyUSB defines CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAME5X -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 endif ifeq ($(CHIP_FAMILY), same54) PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x -OPTIMIZATION_FLAGS ?= -O2 +OPTIMIZATION_FLAGS ?= -Os # TinyUSB defines CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAME5X -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 endif diff --git a/py/py.mk b/py/py.mk index 1a8f1219a5b94..3f94aa67a0e54 100644 --- a/py/py.mk +++ b/py/py.mk @@ -19,7 +19,7 @@ endif QSTR_GLOBAL_DEPENDENCIES += $(PY_SRC)/mpconfig.h mpconfigport.h # some code is performance bottleneck and compiled with other optimization options -_CSUPEROPT = -O3 +CSUPEROPT = -O3 # this sets the config file for FatFs CFLAGS_MOD += -DFFCONF_H=\"lib/oofatfs/ffconf.h\" From 9fd652111a0af634de4fb39c34b86830602fb5c5 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 15 Dec 2020 02:40:11 +0100 Subject: [PATCH 430/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 17 +++++++++++------ locale/cs.po | 17 +++++++++++------ locale/de_DE.po | 17 +++++++++++------ locale/el.po | 17 +++++++++++------ locale/es.po | 17 +++++++++++------ locale/fil.po | 17 +++++++++++------ locale/fr.po | 17 +++++++++++------ locale/hi.po | 17 +++++++++++------ locale/it_IT.po | 17 +++++++++++------ locale/ja.po | 17 +++++++++++------ locale/ko.po | 17 +++++++++++------ locale/nl.po | 17 +++++++++++------ locale/pl.po | 17 +++++++++++------ locale/pt_BR.po | 17 +++++++++++------ locale/sv.po | 17 +++++++++++------ locale/zh_Latn_pinyin.po | 17 +++++++++++------ 16 files changed, 176 insertions(+), 96 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 6203f70842047..ccedccfd31957 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-10-10 23:51+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -392,7 +392,7 @@ msgstr "Send yang lain sudah aktif" msgid "Array must contain halfwords (type 'H')" msgstr "Array harus mengandung halfwords (ketik 'H')" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Nilai array harus berupa byte tunggal." @@ -528,7 +528,7 @@ msgstr "Pin bus %d sudah digunakan" msgid "Byte buffer must be 16 bytes." msgstr "Byte buffer harus 16 byte." -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "Bytes harus di antara 0 dan 255." @@ -1729,7 +1729,7 @@ msgstr "" msgid "Size not supported" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Potongan dan nilai panjangnya berbeda." @@ -1948,6 +1948,10 @@ msgstr "" msgid "Unable to write to nvm." msgstr "" +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "" @@ -2161,7 +2165,8 @@ msgstr "" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" @@ -3261,7 +3266,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index ef549e35540d7..7d3b5c23ded57 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-12-04 18:33+0000\n" "Last-Translator: vkuthan \n" "Language-Team: LANGUAGE \n" @@ -392,7 +392,7 @@ msgstr "" msgid "Array must contain halfwords (type 'H')" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "" @@ -526,7 +526,7 @@ msgstr "" msgid "Byte buffer must be 16 bytes." msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "" @@ -1700,7 +1700,7 @@ msgstr "" msgid "Size not supported" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "" @@ -1915,6 +1915,10 @@ msgstr "" msgid "Unable to write to nvm." msgstr "" +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "" @@ -2121,7 +2125,8 @@ msgstr "" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" @@ -3219,7 +3224,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 056ed5908ced3..d021184d1d526 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-11-26 03:11+0000\n" "Last-Translator: Daniel Bravo Darriba \n" "Language: de_DE\n" @@ -391,7 +391,7 @@ msgstr "Ein anderer Sendevorgang ist schon aktiv" msgid "Array must contain halfwords (type 'H')" msgstr "Array muss Halbwörter enthalten (type 'H')" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Array-Werte sollten aus Einzelbytes bestehen." @@ -529,7 +529,7 @@ msgstr "Bus pin %d wird schon benutzt" msgid "Byte buffer must be 16 bytes." msgstr "Der Puffer muss 16 Bytes lang sein." -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "Ein Bytes kann nur Werte zwischen 0 und 255 annehmen." @@ -1728,7 +1728,7 @@ msgstr "" msgid "Size not supported" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Slice und Wert (value) haben unterschiedliche Längen." @@ -1957,6 +1957,10 @@ msgstr "Konnte Farbpalettendaten nicht lesen" msgid "Unable to write to nvm." msgstr "Schreiben in nvm nicht möglich." +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "Unerwarteter nrfx uuid-Typ" @@ -2178,7 +2182,8 @@ msgstr "Argumente müssen ndarrays sein" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "Array/Bytes auf der rechten Seite erforderlich" @@ -3296,7 +3301,7 @@ msgid "only sample_rate=16000 is supported" msgstr "nur eine sample_rate=16000 wird unterstützt" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" "Es werden nur Slices mit Schritt = 1 (auch bekannt als None) unterstützt" diff --git a/locale/el.po b/locale/el.po index f1bd60bd5a075..8a9ca846b028d 100644 --- a/locale/el.po +++ b/locale/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -387,7 +387,7 @@ msgstr "" msgid "Array must contain halfwords (type 'H')" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "" @@ -521,7 +521,7 @@ msgstr "" msgid "Byte buffer must be 16 bytes." msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "" @@ -1695,7 +1695,7 @@ msgstr "" msgid "Size not supported" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "" @@ -1910,6 +1910,10 @@ msgstr "" msgid "Unable to write to nvm." msgstr "" +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "" @@ -2116,7 +2120,8 @@ msgstr "" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" @@ -3214,7 +3219,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" diff --git a/locale/es.po b/locale/es.po index 85d180c21fbec..39aeded729603 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-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: Iván Montiel Cardona \n" "Language-Team: \n" @@ -397,7 +397,7 @@ msgstr "Otro envío ya está activo" msgid "Array must contain halfwords (type 'H')" msgstr "El array debe contener medias palabras (escriba 'H')" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Valores del array deben ser bytes individuales." @@ -535,7 +535,7 @@ msgstr "Bus pin %d ya está siendo utilizado" msgid "Byte buffer must be 16 bytes." msgstr "Búfer Byte debe de ser 16 bytes." -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "Bytes debe estar entre 0 y 255." @@ -1733,7 +1733,7 @@ msgstr "El contexto del lado del servidor no puede tener un hostname" msgid "Size not supported" msgstr "Sin capacidades para el tamaño" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Slice y value tienen tamaños diferentes." @@ -1962,6 +1962,10 @@ msgstr "No se pudo leer los datos de la paleta de colores" msgid "Unable to write to nvm." msgstr "Imposible escribir en nvm." +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "Tipo de uuid nrfx inesperado" @@ -2179,7 +2183,8 @@ msgstr "argumentos deben ser ndarrays" msgid "array and index length must be equal" msgstr "Longitud del array e índice tienen que ser iguales" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "array/bytes requeridos en el lado derecho" @@ -3290,7 +3295,7 @@ msgid "only sample_rate=16000 is supported" msgstr "solo se admite sample_rate=16000" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "solo se admiten segmentos con step=1 (alias None)" diff --git a/locale/fil.po b/locale/fil.po index c55ab69b59d18..9c9716169e95a 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -390,7 +390,7 @@ msgstr "Isa pang send ay aktibo na" msgid "Array must contain halfwords (type 'H')" msgstr "May halfwords (type 'H') dapat ang array" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Array values ay dapat single bytes." @@ -527,7 +527,7 @@ msgstr "Ginagamit na ang DAC" msgid "Byte buffer must be 16 bytes." msgstr "buffer ay dapat bytes-like object" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "Sa gitna ng 0 o 255 dapat ang bytes." @@ -1715,7 +1715,7 @@ msgstr "" msgid "Size not supported" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Slice at value iba't ibang haba." @@ -1930,6 +1930,10 @@ msgstr "" msgid "Unable to write to nvm." msgstr "Hindi ma i-sulat sa NVM." +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c #, fuzzy msgid "Unexpected nrfx uuid type" @@ -2146,7 +2150,8 @@ msgstr "" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "array/bytes kinakailangan sa kanang bahagi" @@ -3262,7 +3267,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "ang mga slices lamang na may hakbang = 1 (aka None) ang sinusuportahan" diff --git a/locale/fr.po b/locale/fr.po index 29d2d19849d26..ea3c75107c587 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-12-08 19:21+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" @@ -397,7 +397,7 @@ msgstr "Un autre envoi est déjà actif" msgid "Array must contain halfwords (type 'H')" msgstr "Le tableau doit contenir des demi-mots (type 'H')" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Les valeurs du tableau doivent être des octets simples 'bytes'." @@ -535,7 +535,7 @@ msgstr "La broche %d du bus est déjà utilisée" msgid "Byte buffer must be 16 bytes." msgstr "Le tampon doit être de 16 octets." -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "Les octets 'bytes' doivent être entre 0 et 255." @@ -1740,7 +1740,7 @@ msgstr "Un contexte niveau serveur ne peut avoir de hostname" msgid "Size not supported" msgstr "Taille non prise en charge" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Tranche et valeur de tailles différentes." @@ -1970,6 +1970,10 @@ msgstr "Impossible de lire les données de la palette de couleurs" msgid "Unable to write to nvm." msgstr "Impossible d'écrire sur la mémoire non-volatile." +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "Type inattendu pour l'uuid nrfx" @@ -2189,7 +2193,8 @@ msgstr "les arguments doivent être des ndarrays" msgid "array and index length must be equal" msgstr "la longueur du tableau et de l'index doit être égale" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "tableau/octets requis à droite" @@ -3309,7 +3314,7 @@ msgid "only sample_rate=16000 is supported" msgstr "seul sample_rate = 16000 est pris en charge" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "seules les tranches avec 'step=1' (cad None) sont supportées" diff --git a/locale/hi.po b/locale/hi.po index 28b6e071a0a56..eae6b5818b9f7 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -387,7 +387,7 @@ msgstr "" msgid "Array must contain halfwords (type 'H')" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "" @@ -521,7 +521,7 @@ msgstr "" msgid "Byte buffer must be 16 bytes." msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "" @@ -1695,7 +1695,7 @@ msgstr "" msgid "Size not supported" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "" @@ -1910,6 +1910,10 @@ msgstr "" msgid "Unable to write to nvm." msgstr "" +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "" @@ -2116,7 +2120,8 @@ msgstr "" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" @@ -3214,7 +3219,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index f61192834b3e2..6800c87e76863 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -389,7 +389,7 @@ msgstr "Another send è gia activato" msgid "Array must contain halfwords (type 'H')" msgstr "Array deve avere mezzoparole (typo 'H')" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Valori di Array dovrebbero essere bytes singulari" @@ -527,7 +527,7 @@ msgstr "DAC già in uso" msgid "Byte buffer must be 16 bytes." msgstr "i buffer devono essere della stessa lunghezza" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "I byte devono essere compresi tra 0 e 255" @@ -1727,7 +1727,7 @@ msgstr "" msgid "Size not supported" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "" @@ -1942,6 +1942,10 @@ msgstr "" msgid "Unable to write to nvm." msgstr "Imposibile scrivere su nvm." +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c #, fuzzy msgid "Unexpected nrfx uuid type" @@ -2150,7 +2154,8 @@ msgstr "" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" @@ -3268,7 +3273,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "solo slice con step=1 (aka None) sono supportate" diff --git a/locale/ja.po b/locale/ja.po index 82b8cc352d651..5ec47eaf44092 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: sporeball \n" "Language-Team: none\n" @@ -394,7 +394,7 @@ msgstr "他のsendがすでにアクティブ" msgid "Array must contain halfwords (type 'H')" msgstr "array のタイプは16ビット ('H') でなければなりません" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Arrayの各値は1バイトでなければなりません" @@ -530,7 +530,7 @@ msgstr "Busピン%dはすでに使用中" msgid "Byte buffer must be 16 bytes." msgstr "バッファは16バイトでなければなりません" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "バイト値は0から255の間でなければなりません" @@ -1713,7 +1713,7 @@ msgstr "" msgid "Size not supported" msgstr "サイズは対応していません" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "スライスと値の長さが一致しません" @@ -1935,6 +1935,10 @@ msgstr "カラーパレットデータを読み込めません" msgid "Unable to write to nvm." msgstr "nvmに書き込みできません" +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "想定されていないnrfx UUID型" @@ -2141,7 +2145,8 @@ msgstr "引数はndarrayでなければなりません" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "右辺にはarray/bytesが必要" @@ -3244,7 +3249,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" diff --git a/locale/ko.po b/locale/ko.po index 58bd4280156f8..ae51ac5d65cdd 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-10-05 12:12+0000\n" "Last-Translator: Michal Čihař \n" "Language-Team: LANGUAGE \n" @@ -390,7 +390,7 @@ msgstr "" msgid "Array must contain halfwords (type 'H')" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "" @@ -526,7 +526,7 @@ msgstr "" msgid "Byte buffer must be 16 bytes." msgstr "잘못된 크기의 버퍼. 16 바이트 여야합니다." -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "바이트는 0에서 255 사이 여야합니다." @@ -1700,7 +1700,7 @@ msgstr "" msgid "Size not supported" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "" @@ -1916,6 +1916,10 @@ msgstr "" msgid "Unable to write to nvm." msgstr "" +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "" @@ -2122,7 +2126,8 @@ msgstr "" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" @@ -3220,7 +3225,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index c0f3f478fbc74..e7743314fe150 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-10-27 16:47+0000\n" "Last-Translator: Jelle Jager \n" "Language-Team: none\n" @@ -392,7 +392,7 @@ msgstr "Een andere send is al actief" msgid "Array must contain halfwords (type 'H')" msgstr "Array moet halfwords (type 'H') bevatten" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Array waardes moet enkele bytes zijn." @@ -528,7 +528,7 @@ msgstr "Bus pin %d al in gebruik" msgid "Byte buffer must be 16 bytes." msgstr "Byte buffer moet 16 bytes zijn." -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "Bytes moeten tussen 0 en 255 liggen." @@ -1728,7 +1728,7 @@ msgstr "Context aan de serverkant kan geen hostnaam hebben" msgid "Size not supported" msgstr "Afmeting niet ondersteund" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Slice en waarde hebben verschillende lengtes." @@ -1953,6 +1953,10 @@ msgstr "Niet in staat kleurenpalet data te lezen" msgid "Unable to write to nvm." msgstr "Niet in staat om naar nvm te schrijven." +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "Onverwacht mrfx uuid type" @@ -2170,7 +2174,8 @@ msgstr "argumenten moeten ndarrays zijn" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "array/bytes vereist aan de rechterkant" @@ -3276,7 +3281,7 @@ msgid "only sample_rate=16000 is supported" msgstr "alleen sample_rate=16000 wordt ondersteund" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "alleen segmenten met step=1 (ook wel None) worden ondersteund" diff --git a/locale/pl.po b/locale/pl.po index 72c091a11d47c..599847f2d3e0d 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-12-02 20:29+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" @@ -394,7 +394,7 @@ msgstr "Wysyłanie jest już w toku" msgid "Array must contain halfwords (type 'H')" msgstr "Tablica musi zawierać pół-słowa (typ 'H')" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Wartości powinny być bajtami." @@ -530,7 +530,7 @@ msgstr "Nóżka magistrali %d jest w użyciu" msgid "Byte buffer must be 16 bytes." msgstr "Bufor musi mieć 16 bajtów." -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "Bytes musi być między 0 a 255." @@ -1711,7 +1711,7 @@ msgstr "" msgid "Size not supported" msgstr "" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Fragment i wartość są różnych długości." @@ -1926,6 +1926,10 @@ msgstr "Nie można odczytać danych palety" msgid "Unable to write to nvm." msgstr "Błąd zapisu do NVM." +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "Nieoczekiwany typ nrfx uuid" @@ -2138,7 +2142,8 @@ msgstr "" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "tablica/bytes wymagane po prawej stronie" @@ -3237,7 +3242,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "tylko fragmenty ze step=1 (lub None) są wspierane" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 7595f8485b3b4..3c366ac49e952 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-12-11 19:08+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -396,7 +396,7 @@ msgstr "Outro envio já está ativo" msgid "Array must contain halfwords (type 'H')" msgstr "Array deve conter meias palavras (tipo 'H')" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Os valores das matrizes devem ser bytes simples." @@ -536,7 +536,7 @@ msgstr "O pino bus %d já está em uso" msgid "Byte buffer must be 16 bytes." msgstr "O buffer deve ter 16 bytes." -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "Os bytes devem estar entre 0 e 255." @@ -1742,7 +1742,7 @@ msgstr "O contexto do lado do servidor não pode ter nome de host" msgid "Size not supported" msgstr "O tamanho não é suportado" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Fatie e avalie os diferentes comprimentos." @@ -1971,6 +1971,10 @@ msgstr "Não foi possível ler os dados da paleta de cores" msgid "Unable to write to nvm." msgstr "Não é possível gravar no nvm." +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "Tipo uuid nrfx inesperado" @@ -2189,7 +2193,8 @@ msgstr "os argumentos devem ser ndarrays" msgid "array and index length must be equal" msgstr "a matriz e comprimento do índice devem ser iguais" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "matriz/bytes são necessários no lado direito" @@ -3301,7 +3306,7 @@ msgid "only sample_rate=16000 is supported" msgstr "apenas sample_rate = 16000 é compatível" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" "apenas fatias com a etapa=1 (também conhecida como Nenhuma) são compatíveis" diff --git a/locale/sv.po b/locale/sv.po index be3d4840588f8..4c645fc611ac5 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-12-07 20:26+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -392,7 +392,7 @@ msgstr "En annan send är redan aktiv" msgid "Array must contain halfwords (type 'H')" msgstr "Matrisen måste innehålla halfwords (typ \"H\")" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Matrisvärden ska bestå av enstaka bytes." @@ -528,7 +528,7 @@ msgstr "Busspinne %d används redan" msgid "Byte buffer must be 16 bytes." msgstr "Byte-buffert måste vara 16 byte." -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "Bytes måste vara mellan 0 och 255." @@ -1725,7 +1725,7 @@ msgstr "Serversidans kontext kan inte ha värdnamn" msgid "Size not supported" msgstr "Storleken stöds inte" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Slice och värde har olika längd." @@ -1950,6 +1950,10 @@ msgstr "Det går inte att läsa färgpalettdata" msgid "Unable to write to nvm." msgstr "Det gick inte att skriva till nvm." +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "Oväntad nrfx uuid-typ" @@ -2164,7 +2168,8 @@ msgstr "argumenten måste vara ndarray" msgid "array and index length must be equal" msgstr "array och indexlängd måste vara lika" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "array/bytes krävs på höger sida" @@ -3270,7 +3275,7 @@ msgid "only sample_rate=16000 is supported" msgstr "enbart sample_rate=16000 stöds" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "endast segment med steg=1 (aka Ingen) stöds" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 606f0077e187c..c5264a93a832a 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2020-12-14 11:48-0500\n" "PO-Revision-Date: 2020-11-19 01:28+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -394,7 +394,7 @@ msgstr "Lìng yīgè fāsòng yǐjīng jīhuó" msgid "Array must contain halfwords (type 'H')" msgstr "Shùzǔ bìxū bāohán bàn zìshù (type 'H')" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Shùzǔ zhí yīnggāi shì dāngè zì jié." @@ -530,7 +530,7 @@ msgstr "Zǒngxiàn yǐn jiǎo %d yǐ zài shǐyòng zhōng" msgid "Byte buffer must be 16 bytes." msgstr "Zì jié huǎnchōng qū bìxū shì 16 zì jié." -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." msgstr "Zì jié bìxū jiè yú 0 dào 255 zhī jiān." @@ -1718,7 +1718,7 @@ msgstr "Fúwùqì duān shàngxiàwén bùnéng jùyǒu zhǔjī míng" msgid "Size not supported" msgstr "bù zhī chí dà xiǎo" -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Qiēpiàn hé zhí bùtóng chángdù." @@ -1942,6 +1942,10 @@ msgstr "Wúfǎ dòu qǔ sè tiáo shùjù" msgid "Unable to write to nvm." msgstr "Wúfǎ xiě rù nvm." +#: shared-bindings/alarm/SleepMemory.c +msgid "Unable to write to sleep_memory." +msgstr "" + #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "Yìwài de nrfx uuid lèixíng" @@ -2157,7 +2161,8 @@ msgstr "cānshù bìxū shì ndarrays" msgid "array and index length must be equal" msgstr "" -#: py/objarray.c shared-bindings/nvm/ByteArray.c +#: py/objarray.c shared-bindings/alarm/SleepMemory.c +#: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "yòu cè xūyào shùzǔ/zì jié" @@ -3261,7 +3266,7 @@ msgid "only sample_rate=16000 is supported" msgstr "Jǐn zhīchí cǎiyàng lǜ = 16000" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/nvm/ByteArray.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "jǐn zhīchí bù zhǎng = 1(jí wú) de qiēpiàn" From 97947b4fe9724639b57855d5b98445f4d0bacd33 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 14 Dec 2020 22:07:54 -0500 Subject: [PATCH 431/770] shrink bast_pro_mini_m0; use proper flex-array syntax --- .../_bleio/hci_include/att_internal.h | 46 +++++++++---------- .../common-hal/_bleio/hci_include/hci.h | 22 ++++----- .../common-hal/_bleio/hci_include/hci_vs.h | 20 ++++---- .../_bleio/hci_include/l2cap_internal.h | 16 +++---- .../boards/bast_pro_mini_m0/mpconfigboard.mk | 2 + 5 files changed, 54 insertions(+), 52 deletions(-) diff --git a/devices/ble_hci/common-hal/_bleio/hci_include/att_internal.h b/devices/ble_hci/common-hal/_bleio/hci_include/att_internal.h index d6a4cb79c7136..678cb4201bf56 100644 --- a/devices/ble_hci/common-hal/_bleio/hci_include/att_internal.h +++ b/devices/ble_hci/common-hal/_bleio/hci_include/att_internal.h @@ -69,7 +69,7 @@ struct bt_att_info_128 { #define BT_ATT_OP_FIND_INFO_RSP 0x05 struct bt_att_find_info_rsp { uint8_t format; - uint8_t info[0]; + uint8_t info[]; } __packed; /* Find By Type Value Request */ @@ -78,7 +78,7 @@ struct bt_att_find_type_req { uint16_t start_handle; uint16_t end_handle; uint16_t type; - uint8_t value[0]; + uint8_t value[]; } __packed; struct bt_att_handle_group { @@ -89,7 +89,7 @@ struct bt_att_handle_group { /* Find By Type Value Response */ #define BT_ATT_OP_FIND_TYPE_RSP 0x07 struct bt_att_find_type_rsp { - struct bt_att_handle_group list[0]; + struct bt_att_handle_group list[]; } __packed; /* Read By Type Request */ @@ -97,19 +97,19 @@ struct bt_att_find_type_rsp { struct bt_att_read_type_req { uint16_t start_handle; uint16_t end_handle; - uint8_t uuid[0]; + uint8_t uuid[]; } __packed; struct bt_att_data { uint16_t handle; - uint8_t value[0]; + uint8_t value[]; } __packed; /* Read By Type Response */ #define BT_ATT_OP_READ_TYPE_RSP 0x09 struct bt_att_read_type_rsp { uint8_t len; - struct bt_att_data data[0]; + struct bt_att_data data[]; } __packed; /* Read Request */ @@ -121,7 +121,7 @@ struct bt_att_read_req { /* Read Response */ #define BT_ATT_OP_READ_RSP 0x0b struct bt_att_read_rsp { - uint8_t value[0]; + uint8_t value[]; } __packed; /* Read Blob Request */ @@ -134,7 +134,7 @@ struct bt_att_read_blob_req { /* Read Blob Response */ #define BT_ATT_OP_READ_BLOB_RSP 0x0d struct bt_att_read_blob_rsp { - uint8_t value[0]; + uint8_t value[]; } __packed; /* Read Multiple Request */ @@ -142,13 +142,13 @@ struct bt_att_read_blob_rsp { #define BT_ATT_OP_READ_MULT_REQ 0x0e struct bt_att_read_mult_req { - uint16_t handles[0]; + uint16_t handles[]; } __packed; /* Read Multiple Respose */ #define BT_ATT_OP_READ_MULT_RSP 0x0f struct bt_att_read_mult_rsp { - uint8_t value[0]; + uint8_t value[]; } __packed; /* Read by Group Type Request */ @@ -156,27 +156,27 @@ struct bt_att_read_mult_rsp { struct bt_att_read_group_req { uint16_t start_handle; uint16_t end_handle; - uint8_t uuid[0]; + uint8_t uuid[]; } __packed; struct bt_att_group_data { uint16_t start_handle; uint16_t end_handle; - uint8_t value[0]; + uint8_t value[]; } __packed; /* Read by Group Type Response */ #define BT_ATT_OP_READ_GROUP_RSP 0x11 struct bt_att_read_group_rsp { uint8_t len; - struct bt_att_group_data data[0]; + struct bt_att_group_data data[]; } __packed; /* Write Request */ #define BT_ATT_OP_WRITE_REQ 0x12 struct bt_att_write_req { uint16_t handle; - uint8_t value[0]; + uint8_t value[]; } __packed; /* Write Response */ @@ -187,7 +187,7 @@ struct bt_att_write_req { struct bt_att_prepare_write_req { uint16_t handle; uint16_t offset; - uint8_t value[0]; + uint8_t value[]; } __packed; /* Prepare Write Respond */ @@ -195,7 +195,7 @@ struct bt_att_prepare_write_req { struct bt_att_prepare_write_rsp { uint16_t handle; uint16_t offset; - uint8_t value[0]; + uint8_t value[]; } __packed; /* Execute Write Request */ @@ -214,14 +214,14 @@ struct bt_att_exec_write_req { #define BT_ATT_OP_NOTIFY 0x1b struct bt_att_notify { uint16_t handle; - uint8_t value[0]; + uint8_t value[]; } __packed; /* Handle Value Indication */ #define BT_ATT_OP_INDICATE 0x1d struct bt_att_indicate { uint16_t handle; - uint8_t value[0]; + uint8_t value[]; } __packed; /* Handle Value Confirm */ @@ -233,14 +233,14 @@ struct bt_att_signature { #define BT_ATT_OP_READ_MULT_VL_REQ 0x20 struct bt_att_read_mult_vl_req { - uint16_t handles[0]; + uint16_t handles[]; } __packed; /* Read Multiple Respose */ #define BT_ATT_OP_READ_MULT_VL_RSP 0x21 struct bt_att_read_mult_vl_rsp { uint16_t len; - uint8_t value[0]; + uint8_t value[]; } __packed; /* Handle Multiple Value Notification */ @@ -248,19 +248,19 @@ struct bt_att_read_mult_vl_rsp { struct bt_att_notify_mult { uint16_t handle; uint16_t len; - uint8_t value[0]; + uint8_t value[]; } __packed; /* Write Command */ #define BT_ATT_OP_WRITE_CMD 0x52 struct bt_att_write_cmd { uint16_t handle; - uint8_t value[0]; + uint8_t value[]; } __packed; /* Signed Write Command */ #define BT_ATT_OP_SIGNED_WRITE_CMD 0xd2 struct bt_att_signed_write_cmd { uint16_t handle; - uint8_t value[0]; + uint8_t value[]; } __packed; diff --git a/devices/ble_hci/common-hal/_bleio/hci_include/hci.h b/devices/ble_hci/common-hal/_bleio/hci_include/hci.h index 5213edbf0fd4d..797278946a5c5 100644 --- a/devices/ble_hci/common-hal/_bleio/hci_include/hci.h +++ b/devices/ble_hci/common-hal/_bleio/hci_include/hci.h @@ -454,7 +454,7 @@ struct bt_hci_handle_count { #define BT_HCI_OP_HOST_NUM_COMPLETED_PACKETS BT_OP(BT_OGF_BASEBAND, 0x0035) struct bt_hci_cp_host_num_completed_packets { uint8_t num_handles; - struct bt_hci_handle_count h[0]; + struct bt_hci_handle_count h[]; } __packed; #define BT_HCI_OP_WRITE_INQUIRY_MODE BT_OP(BT_OGF_BASEBAND, 0x0045) @@ -1099,7 +1099,7 @@ struct bt_hci_ext_adv_set { struct bt_hci_cp_le_set_ext_adv_enable { uint8_t enable; uint8_t set_num; - struct bt_hci_ext_adv_set s[0]; + struct bt_hci_ext_adv_set s[]; } __packed; #define BT_HCI_OP_LE_READ_MAX_ADV_DATA_LEN BT_OP(BT_OGF_LE, 0x003a) @@ -1158,7 +1158,7 @@ struct bt_hci_cp_le_set_ext_scan_param { uint8_t own_addr_type; uint8_t filter_policy; uint8_t phys; - struct bt_hci_ext_scan_phy p[0]; + struct bt_hci_ext_scan_phy p[]; } __packed; /* Extends BT_HCI_LE_SCAN_FILTER_DUP */ @@ -1189,7 +1189,7 @@ struct bt_hci_cp_le_ext_create_conn { uint8_t own_addr_type; bt_addr_le_t peer_addr; uint8_t phys; - struct bt_hci_ext_conn_phy p[0]; + struct bt_hci_ext_conn_phy p[]; } __packed; #define BT_HCI_OP_LE_PER_ADV_CREATE_SYNC BT_OP(BT_OGF_LE, 0x0044) @@ -1354,7 +1354,7 @@ struct bt_hci_evt_role_change { #define BT_HCI_EVT_NUM_COMPLETED_PACKETS 0x13 struct bt_hci_evt_num_completed_packets { uint8_t num_handles; - struct bt_hci_handle_count h[0]; + struct bt_hci_handle_count h[]; } __packed; #define BT_HCI_EVT_PIN_CODE_REQ 0x16 @@ -1510,11 +1510,11 @@ struct bt_hci_evt_le_advertising_info { uint8_t evt_type; bt_addr_le_t addr; uint8_t length; - uint8_t data[0]; + uint8_t data[]; } __packed; struct bt_hci_evt_le_advertising_report { uint8_t num_reports; - struct bt_hci_evt_le_advertising_info adv_info[0]; + struct bt_hci_evt_le_advertising_info adv_info[]; } __packed; #define BT_HCI_EVT_LE_CONN_UPDATE_COMPLETE 0x03 @@ -1593,7 +1593,7 @@ struct bt_hci_evt_le_direct_adv_info { } __packed; struct bt_hci_evt_le_direct_adv_report { uint8_t num_reports; - struct bt_hci_evt_le_direct_adv_info direct_adv_info[0]; + struct bt_hci_evt_le_direct_adv_info direct_adv_info[]; } __packed; #define BT_HCI_EVT_LE_PHY_UPDATE_COMPLETE 0x0c @@ -1628,11 +1628,11 @@ struct bt_hci_evt_le_ext_advertising_info { uint16_t interval; bt_addr_le_t direct_addr; uint8_t length; - uint8_t data[0]; + uint8_t data[]; } __packed; struct bt_hci_evt_le_ext_advertising_report { uint8_t num_reports; - struct bt_hci_evt_le_ext_advertising_info adv_info[0]; + struct bt_hci_evt_le_ext_advertising_info adv_info[]; } __packed; #define BT_HCI_EVT_LE_PER_ADV_SYNC_ESTABLISHED 0x0e @@ -1654,7 +1654,7 @@ struct bt_hci_evt_le_per_advertising_report { uint8_t unused; uint8_t data_status; uint8_t length; - uint8_t data[0]; + uint8_t data[]; } __packed; #define BT_HCI_EVT_LE_PER_ADV_SYNC_LOST 0x10 diff --git a/devices/ble_hci/common-hal/_bleio/hci_include/hci_vs.h b/devices/ble_hci/common-hal/_bleio/hci_include/hci_vs.h index e4f94b6a8334e..660691398ebcc 100644 --- a/devices/ble_hci/common-hal/_bleio/hci_include/hci_vs.h +++ b/devices/ble_hci/common-hal/_bleio/hci_include/hci_vs.h @@ -104,7 +104,7 @@ struct bt_hci_cp_vs_set_trace_enable { #define BT_HCI_OP_VS_READ_BUILD_INFO BT_OP(BT_OGF_VS, 0x0008) struct bt_hci_rp_vs_read_build_info { uint8_t status; - uint8_t info[0]; + uint8_t info[]; } __packed; struct bt_hci_vs_static_addr { @@ -116,7 +116,7 @@ struct bt_hci_vs_static_addr { struct bt_hci_rp_vs_read_static_addrs { uint8_t status; uint8_t num_addrs; - struct bt_hci_vs_static_addr a[0]; + struct bt_hci_vs_static_addr a[]; } __packed; #define BT_HCI_OP_VS_READ_KEY_HIERARCHY_ROOTS BT_OP(BT_OGF_VS, 0x000a) @@ -143,7 +143,7 @@ struct bt_hci_vs_cmd { struct bt_hci_rp_vs_read_host_stack_cmds { uint8_t status; uint8_t num_cmds; - struct bt_hci_vs_cmd c[0]; + struct bt_hci_vs_cmd c[]; } __packed; #define BT_HCI_VS_SCAN_REQ_REPORTS_DISABLED 0x00 @@ -189,7 +189,7 @@ struct bt_hci_rp_vs_read_tx_power_level { struct bt_hci_rp_vs_read_usb_transport_mode { uint8_t status; uint8_t num_supported_modes; - uint8_t supported_mode[0]; + uint8_t supported_mode[]; } __packed; #define BT_HCI_VS_USB_H2_MODE 0x00 @@ -210,7 +210,7 @@ struct bt_hci_evt_vs { #define BT_HCI_EVT_VS_FATAL_ERROR 0x02 struct bt_hci_evt_vs_fatal_error { uint64_t pc; - uint8_t err_info[0]; + uint8_t err_info[]; } __packed; #define BT_HCI_VS_TRACE_LMP_TX 0x01 @@ -221,7 +221,7 @@ struct bt_hci_evt_vs_fatal_error { #define BT_HCI_EVT_VS_TRACE_INFO 0x03 struct bt_hci_evt_vs_trace_info { uint8_t type; - uint8_t data[0]; + uint8_t data[]; } __packed; #define BT_HCI_EVT_VS_SCAN_REQ_RX 0x04 @@ -267,14 +267,14 @@ struct bt_hci_rp_mesh_get_opts { #define BT_HCI_OC_MESH_SET_SCAN_FILTER 0x01 struct bt_hci_mesh_pattern { uint8_t pattern_len; - uint8_t pattern[0]; + uint8_t pattern[]; } __packed; struct bt_hci_cp_mesh_set_scan_filter { uint8_t scan_filter; uint8_t filter_dup; uint8_t num_patterns; - struct bt_hci_mesh_pattern patterns[0]; + struct bt_hci_mesh_pattern patterns[]; } __packed; struct bt_hci_rp_mesh_set_scan_filter { uint8_t status; @@ -365,11 +365,11 @@ struct bt_hci_evt_mesh_scan_report { int8_t rssi; uint32_t instant; uint8_t data_len; - uint8_t data[0]; + uint8_t data[]; } __packed; struct bt_hci_evt_mesh_scanning_report { uint8_t num_reports; - struct bt_hci_evt_mesh_scan_report reports[0]; + struct bt_hci_evt_mesh_scan_report reports[]; } __packed; #ifdef __cplusplus diff --git a/devices/ble_hci/common-hal/_bleio/hci_include/l2cap_internal.h b/devices/ble_hci/common-hal/_bleio/hci_include/l2cap_internal.h index bed311cf3c243..a0a2ed056c56a 100644 --- a/devices/ble_hci/common-hal/_bleio/hci_include/l2cap_internal.h +++ b/devices/ble_hci/common-hal/_bleio/hci_include/l2cap_internal.h @@ -45,7 +45,7 @@ struct bt_l2cap_sig_hdr { #define BT_L2CAP_CMD_REJECT 0x01 struct bt_l2cap_cmd_reject { uint16_t reason; - uint8_t data[0]; + uint8_t data[]; } __packed; struct bt_l2cap_cmd_reject_cid_data { @@ -88,7 +88,7 @@ struct bt_l2cap_conn_rsp { struct bt_l2cap_conf_req { uint16_t dcid; uint16_t flags; - uint8_t data[0]; + uint8_t data[]; } __packed; #define BT_L2CAP_CONF_RSP 0x05 @@ -96,7 +96,7 @@ struct bt_l2cap_conf_rsp { uint16_t scid; uint16_t flags; uint16_t result; - uint8_t data[0]; + uint8_t data[]; } __packed; /* Option type used by MTU config request data */ @@ -108,7 +108,7 @@ struct bt_l2cap_conf_rsp { struct bt_l2cap_conf_opt { uint8_t type; uint8_t len; - uint8_t data[0]; + uint8_t data[]; } __packed; #define BT_L2CAP_DISCONN_REQ 0x06 @@ -139,7 +139,7 @@ struct bt_l2cap_info_req { struct bt_l2cap_info_rsp { uint16_t type; uint16_t result; - uint8_t data[0]; + uint8_t data[]; } __packed; #define BT_L2CAP_CONN_PARAM_REQ 0x12 @@ -201,7 +201,7 @@ struct bt_l2cap_ecred_conn_req { uint16_t mtu; uint16_t mps; uint16_t credits; - uint16_t scid[0]; + uint16_t scid[]; } __packed; #define BT_L2CAP_ECRED_CONN_RSP 0x18 @@ -210,14 +210,14 @@ struct bt_l2cap_ecred_conn_rsp { uint16_t mps; uint16_t credits; uint16_t result; - uint16_t dcid[0]; + uint16_t dcid[]; } __packed; #define BT_L2CAP_ECRED_RECONF_REQ 0x19 struct bt_l2cap_ecred_reconf_req { uint16_t mtu; uint16_t mps; - uint16_t scid[0]; + uint16_t scid[]; } __packed; #define BT_L2CAP_RECONF_SUCCESS 0x0000 diff --git a/ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.mk b/ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.mk index 055e6b19e26b6..69dee4b474504 100644 --- a/ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.mk +++ b/ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.mk @@ -9,3 +9,5 @@ CHIP_FAMILY = samd21 INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 + +#SUPEROPT_GC = 0 From 9f9ab44acc5dc118c1c68b61a73ecbef8f3a9320 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 15 Dec 2020 10:11:16 -0500 Subject: [PATCH 432/770] Avoid "error: flexible array member in a struct with no named members" --- .../ble_hci/common-hal/_bleio/hci_include/att_internal.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/devices/ble_hci/common-hal/_bleio/hci_include/att_internal.h b/devices/ble_hci/common-hal/_bleio/hci_include/att_internal.h index 678cb4201bf56..b8efccaf46706 100644 --- a/devices/ble_hci/common-hal/_bleio/hci_include/att_internal.h +++ b/devices/ble_hci/common-hal/_bleio/hci_include/att_internal.h @@ -89,6 +89,7 @@ struct bt_att_handle_group { /* Find By Type Value Response */ #define BT_ATT_OP_FIND_TYPE_RSP 0x07 struct bt_att_find_type_rsp { + uint8_t _dummy[0]; struct bt_att_handle_group list[]; } __packed; @@ -121,6 +122,7 @@ struct bt_att_read_req { /* Read Response */ #define BT_ATT_OP_READ_RSP 0x0b struct bt_att_read_rsp { + uint8_t _dummy[0]; uint8_t value[]; } __packed; @@ -134,6 +136,7 @@ struct bt_att_read_blob_req { /* Read Blob Response */ #define BT_ATT_OP_READ_BLOB_RSP 0x0d struct bt_att_read_blob_rsp { + uint8_t _dummy[0]; uint8_t value[]; } __packed; @@ -142,12 +145,14 @@ struct bt_att_read_blob_rsp { #define BT_ATT_OP_READ_MULT_REQ 0x0e struct bt_att_read_mult_req { + uint8_t _dummy[0]; uint16_t handles[]; } __packed; /* Read Multiple Respose */ #define BT_ATT_OP_READ_MULT_RSP 0x0f struct bt_att_read_mult_rsp { + uint8_t _dummy[0]; uint8_t value[]; } __packed; @@ -233,6 +238,7 @@ struct bt_att_signature { #define BT_ATT_OP_READ_MULT_VL_REQ 0x20 struct bt_att_read_mult_vl_req { + uint8_t _dummy[0]; uint16_t handles[]; } __packed; From dc9bc8fc9a078184447292f67b0a5b17a8917117 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 15 Dec 2020 09:58:47 -0600 Subject: [PATCH 433/770] Fix flexible array declaration --- devices/ble_hci/common-hal/_bleio/att.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devices/ble_hci/common-hal/_bleio/att.c b/devices/ble_hci/common-hal/_bleio/att.c index 6528361cb115b..8e9f5f017d005 100644 --- a/devices/ble_hci/common-hal/_bleio/att.c +++ b/devices/ble_hci/common-hal/_bleio/att.c @@ -61,7 +61,7 @@ STATIC struct { typedef struct __packed { uint8_t properties; uint16_t value_handle; - uint8_t uuid[0]; // 2 or 16 bytes + uint8_t uuid[]; // 2 or 16 bytes } characteristic_declaration_t; STATIC uint8_t bleio_properties_to_ble_spec_properties(uint8_t bleio_properties) { From 3c4562c3caafa0590b63b32d680717363eb371bc Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 15 Dec 2020 10:39:56 -0600 Subject: [PATCH 434/770] camera: Provide correct forward-declaration of camera_imageformat_type This resolves the build error ``` arm-none-eabi-ld: build-spresense/libmpy.a(Camera.o):(.rodata.camera_imageformat_type+0x0): multiple definition of `camera_imageformat_type'; build-spresense/libmpy.a(__init__.o):(.rodata.camera_imageformat_type+0x0): first defined here arm-none-eabi-ld: build-spresense/libmpy.a(ImageFormat.o):(.rodata.camera_imageformat_type+0x0): multiple definition of `camera_imageformat_type'; build-spresense/libmpy.a(__init__.o):(.rodata.camera_imageformat_type+0x0): first defined here arm-none-eabi-ld: build-spresense/libmpy.a(Camera.o):(.rodata.camera_imageformat_type+0x0): multiple definition of `camera_imageformat_type'; build-spresense/libmpy.a(__init__.o):(.rodata.camera_imageformat_type+0x0): first defined here ``` --- shared-bindings/camera/ImageFormat.c | 1 - shared-bindings/camera/ImageFormat.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/shared-bindings/camera/ImageFormat.c b/shared-bindings/camera/ImageFormat.c index d4bdddc562432..9f2f9617f6260 100644 --- a/shared-bindings/camera/ImageFormat.c +++ b/shared-bindings/camera/ImageFormat.c @@ -38,7 +38,6 @@ //| RGB565: ImageFormat //| """RGB565 format.""" //| -const mp_obj_type_t camera_imageformat_type; const camera_imageformat_obj_t camera_imageformat_jpg_obj = { { &camera_imageformat_type }, diff --git a/shared-bindings/camera/ImageFormat.h b/shared-bindings/camera/ImageFormat.h index 8abc88438d853..32a36354fc5bc 100644 --- a/shared-bindings/camera/ImageFormat.h +++ b/shared-bindings/camera/ImageFormat.h @@ -35,7 +35,7 @@ typedef enum { IMAGEFORMAT_RGB565, } camera_imageformat_t; -const mp_obj_type_t camera_imageformat_type; +extern const mp_obj_type_t camera_imageformat_type; camera_imageformat_t camera_imageformat_obj_to_type(mp_obj_t obj); mp_obj_t camera_imageformat_type_to_obj(camera_imageformat_t mode); From bbbd621b184ee13740c0c8e4c94e7aed0db4f070 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 15 Dec 2020 10:54:37 -0600 Subject: [PATCH 435/770] nrf: simmel: remove some unneeded modules to make it fit --- ports/nrf/boards/simmel/mpconfigboard.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/nrf/boards/simmel/mpconfigboard.mk b/ports/nrf/boards/simmel/mpconfigboard.mk index e34739c0f3460..b437fad9d2cee 100644 --- a/ports/nrf/boards/simmel/mpconfigboard.mk +++ b/ports/nrf/boards/simmel/mpconfigboard.mk @@ -16,12 +16,14 @@ CIRCUITPY_AUDIOMP3 = 0 CIRCUITPY_BUSIO = 1 CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_FRAMEBUFFERIO = 0 +CIRCUITPY_GAMEPAD = 0 CIRCUITPY_NEOPIXEL_WRITE = 0 CIRCUITPY_NVM = 0 CIRCUITPY_PIXELBUF = 0 CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_RTC = 1 +CIRCUITPY_SDCARDIO = 0 CIRCUITPY_TOUCHIO = 0 CIRCUITPY_ULAB = 0 CIRCUITPY_WATCHDOG = 1 From fb33c4e1c0f83bce8f8cc1e8cae83695aeb2471d Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 15 Dec 2020 12:23:56 -0500 Subject: [PATCH 436/770] -ftree-vrp better diagnostics on -Os builds; -fno-inline-functions for -O2; fix struct init in HCI bleio --- devices/ble_hci/common-hal/_bleio/att.c | 46 +++++++++++++------------ ports/atmel-samd/Makefile | 9 +++-- ports/cxd56/Makefile | 2 +- ports/litex/Makefile | 2 +- ports/mimxrt10xx/Makefile | 4 +-- ports/nrf/Makefile | 2 +- ports/stm/Makefile | 5 ++- 7 files changed, 39 insertions(+), 31 deletions(-) diff --git a/devices/ble_hci/common-hal/_bleio/att.c b/devices/ble_hci/common-hal/_bleio/att.c index 8e9f5f017d005..4573d5e9ffe3e 100644 --- a/devices/ble_hci/common-hal/_bleio/att.c +++ b/devices/ble_hci/common-hal/_bleio/att.c @@ -1010,21 +1010,22 @@ void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, ui } int att_read_group_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid, uint8_t response_buffer[]) { - struct __packed { + + typedef struct __packed { struct bt_att_hdr h; struct bt_att_read_group_req r; - } req = { { - .code = BT_ATT_OP_READ_GROUP_REQ, - }, { - .start_handle = start_handle, - .end_handle = end_handle, - } - }; - req.r.uuid[0] = uuid & 0xff; - req.r.uuid[1] = uuid >> 8; + } req_t; + uint8_t req_bytes[sizeof(req_t) + sizeof(uuid)]; + req_t *req = (req_t *) req_bytes; - return send_req_wait_for_rsp(conn_handle, sizeof(req), (uint8_t *) &req, response_buffer); + req->h.code = BT_ATT_OP_READ_GROUP_REQ; + req->r.start_handle = start_handle; + req->r.end_handle = end_handle; + req->r.uuid[0] = uuid & 0xff; + req->r.uuid[1] = uuid >> 8; + + return send_req_wait_for_rsp(conn_handle, sizeof(req_bytes), req_bytes, response_buffer); } STATIC void process_read_group_rsp(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) { @@ -1305,20 +1306,21 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl } int att_read_type_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t type, uint8_t response_buffer[]) { - struct __packed { + typedef struct __packed { struct bt_att_hdr h; struct bt_att_read_type_req r; - } req = { { - .code = BT_ATT_OP_READ_TYPE_REQ, - }, { - .start_handle = start_handle, - .end_handle = end_handle, - } - }; - req.r.uuid[0] = type & 0xff; - req.r.uuid[1] = type >> 8; + } req_t; - return send_req_wait_for_rsp(conn_handle, sizeof(req), (uint8_t *) &req, response_buffer); + uint8_t req_bytes[sizeof(req_t) + sizeof(type)]; + req_t *req = (req_t *) req_bytes; + + req->h.code = BT_ATT_OP_READ_TYPE_REQ; + req->r.start_handle = start_handle; + req->r.end_handle = end_handle; + req->r.uuid[0] = type & 0xff; + req->r.uuid[1] = type >> 8; + + return send_req_wait_for_rsp(conn_handle, sizeof(req_bytes), req_bytes, response_buffer); } STATIC void process_read_type_rsp(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) { diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index c214d56f0c351..58c1c0d60ebd6 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -94,21 +94,21 @@ endif ifeq ($(CHIP_FAMILY), samd51) PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x -OPTIMIZATION_FLAGS ?= -Os +OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions # TinyUSB defines CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD51 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 endif ifeq ($(CHIP_FAMILY), same51) PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x -OPTIMIZATION_FLAGS ?= -Os +OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions # TinyUSB defines CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAME5X -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 endif ifeq ($(CHIP_FAMILY), same54) PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x -OPTIMIZATION_FLAGS ?= -Os +OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions # TinyUSB defines CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAME5X -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 endif @@ -116,6 +116,9 @@ endif # option to override default optimization level, set in boards/$(BOARD)/mpconfigboard.mk CFLAGS += $(OPTIMIZATION_FLAGS) +# Add -ftree-vrp optimization and checking to all builds. It's not enabled for -Os by default. +CFLAGS += -ftree-vrp + $(echo PERIPHERALS_CHIP_FAMILY=$(PERIPHERALS_CHIP_FAMILY)) #Debugging/Optimization ifeq ($(DEBUG), 1) diff --git a/ports/cxd56/Makefile b/ports/cxd56/Makefile index 5201f0db56944..1c48a23ca527c 100644 --- a/ports/cxd56/Makefile +++ b/ports/cxd56/Makefile @@ -122,7 +122,7 @@ CFLAGS += \ -fdata-sections \ -Wall \ -OPTIMIZATION_FLAGS ?= -O2 +OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions # option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk CFLAGS += $(OPTIMIZATION_FLAGS) diff --git a/ports/litex/Makefile b/ports/litex/Makefile index 612953daaf379..f384f24577bc2 100644 --- a/ports/litex/Makefile +++ b/ports/litex/Makefile @@ -80,7 +80,7 @@ ifeq ($(DEBUG), 1) OPTIMIZATION_FLAGS ?= -Og else CFLAGS += -DNDEBUG -ggdb3 - OPTIMIZATION_FLAGS ?= -O2 + OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions # TODO: Test with -flto ### CFLAGS += -flto endif diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile index a17e5f70307f4..04949bf01c2d4 100644 --- a/ports/mimxrt10xx/Makefile +++ b/ports/mimxrt10xx/Makefile @@ -75,7 +75,7 @@ INC += \ # NDEBUG disables assert() statements. This reduces code size pretty dramatically, per tannewt. -CFLAGS += -Os -DNDEBUG -ffreestanding +CFLAGS += -Os -ftree-vrp -DNDEBUG -ffreestanding # TinyUSB defines CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_MIMXRT10XX -DCFG_TUD_MIDI_RX_BUFSIZE=512 -DCFG_TUD_CDC_RX_BUFSIZE=512 -DCFG_TUD_MIDI_TX_BUFSIZE=512 -DCFG_TUD_CDC_TX_BUFSIZE=512 -DCFG_TUD_MSC_BUFSIZE=1024 @@ -108,7 +108,7 @@ CFLAGS += \ -g3 -Wno-unused-parameter \ -ffunction-sections -fdata-sections -fstack-usage -OPTIMIZATION_FLAGS ?= -O2 +OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions # option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk CFLAGS += $(OPTIMIZATION_FLAGS) diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index 3fef68e88e2b5..278625e92d3e1 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -89,7 +89,7 @@ ifeq ($(DEBUG), 1) CFLAGS += -ggdb3 OPTIMIZATION_FLAGS = -Og else - OPTIMIZATION_FLAGS ?= -O2 + OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions CFLAGS += -DNDEBUG -ggdb3 CFLAGS += -flto -flto-partition=none endif diff --git a/ports/stm/Makefile b/ports/stm/Makefile index b9426e07ec948..e09fe736cc4ac 100755 --- a/ports/stm/Makefile +++ b/ports/stm/Makefile @@ -86,7 +86,7 @@ ifeq ($(DEBUG), 1) CFLAGS += -fno-inline -fno-ipa-sra else CFLAGS += -DNDEBUG - OPTIMIZATION_FLAGS ?= -O2 + OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions CFLAGS += -ggdb3 # TODO: Test with -flto # CFLAGS += -flto @@ -95,6 +95,9 @@ endif # to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk CFLAGS += $(OPTIMIZATION_FLAGS) +# Add -ftree-vrp optimization and checking to all builds. It's not enabled for -Os by default. +CFLAGS += -ftree-vrp + # MCU Series is defined by the HAL package and doesn't need to be specified here C_DEFS = -D$(MCU_PACKAGE) -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -D$(MCU_VARIANT) From 4521dfb73289eaa9d17cb61b29b49c10adf1f4a3 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 15 Dec 2020 13:23:49 -0500 Subject: [PATCH 437/770] squeeze some smaller boards --- ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.mk | 2 +- ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk | 2 ++ ports/stm/boards/espruino_pico/mpconfigboard.mk | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.mk b/ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.mk index 69dee4b474504..6a2c896197d60 100644 --- a/ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.mk +++ b/ports/atmel-samd/boards/bast_pro_mini_m0/mpconfigboard.mk @@ -10,4 +10,4 @@ INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 -#SUPEROPT_GC = 0 +SUPEROPT_GC = 0 diff --git a/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk b/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk index 3f75d175c86d9..e71bb07395de7 100755 --- a/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk +++ b/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk @@ -16,3 +16,5 @@ CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_VECTORIO = 0 FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar + +SUPEROPT_GC = 0 diff --git a/ports/stm/boards/espruino_pico/mpconfigboard.mk b/ports/stm/boards/espruino_pico/mpconfigboard.mk index 556ff35c4573b..14f9323fde49d 100644 --- a/ports/stm/boards/espruino_pico/mpconfigboard.mk +++ b/ports/stm/boards/espruino_pico/mpconfigboard.mk @@ -20,3 +20,5 @@ LD_FILE = boards/STM32F401xd_fs.ld # lto for this port, and if other stuff hasn't been added in the # meantime CIRCUITPY_ULAB = 0 + +SUPEROPT_GC = 0 From 2de9f181210114447540e427ed0b707b37fc1155 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 15 Dec 2020 22:31:58 +0100 Subject: [PATCH 438/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 6 +++++- locale/cs.po | 6 +++++- locale/de_DE.po | 6 +++++- locale/el.po | 6 +++++- locale/es.po | 6 +++++- locale/fil.po | 6 +++++- locale/fr.po | 6 +++++- locale/hi.po | 6 +++++- locale/it_IT.po | 6 +++++- locale/ja.po | 6 +++++- locale/ko.po | 6 +++++- locale/nl.po | 6 +++++- locale/pl.po | 6 +++++- locale/pt_BR.po | 6 +++++- locale/sv.po | 6 +++++- locale/zh_Latn_pinyin.po | 6 +++++- 16 files changed, 80 insertions(+), 16 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index ccedccfd31957..dd9693f536d9e 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-10-10 23:51+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -1101,6 +1101,10 @@ msgstr "Pin DAC yang diberikan tidak valid" msgid "Invalid PWM frequency" msgstr "Frekuensi PWM tidak valid" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Argumen tidak valid" diff --git a/locale/cs.po b/locale/cs.po index 7d3b5c23ded57..e178a3fd5b8f0 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-12-04 18:33+0000\n" "Last-Translator: vkuthan \n" "Language-Team: LANGUAGE \n" @@ -1084,6 +1084,10 @@ msgstr "" msgid "Invalid PWM frequency" msgstr "" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index d021184d1d526..85b3b90a06069 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-11-26 03:11+0000\n" "Last-Translator: Daniel Bravo Darriba \n" "Language: de_DE\n" @@ -1101,6 +1101,10 @@ msgstr "Ungültiger DAC-Pin angegeben" msgid "Invalid PWM frequency" msgstr "Ungültige PWM Frequenz" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Ungültiges Argument" diff --git a/locale/el.po b/locale/el.po index 8a9ca846b028d..1a835fd4245e3 100644 --- a/locale/el.po +++ b/locale/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -1079,6 +1079,10 @@ msgstr "" msgid "Invalid PWM frequency" msgstr "" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "" diff --git a/locale/es.po b/locale/es.po index 39aeded729603..27b1756571ab0 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-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: Iván Montiel Cardona \n" "Language-Team: \n" @@ -1102,6 +1102,10 @@ msgstr "Pin suministrado inválido para DAC" msgid "Invalid PWM frequency" msgstr "Frecuencia PWM inválida" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Argumento inválido" diff --git a/locale/fil.po b/locale/fil.po index 9c9716169e95a..e55fc5e2cca88 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -1094,6 +1094,10 @@ msgstr "" msgid "Invalid PWM frequency" msgstr "Mali ang PWM frequency" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Maling argumento" diff --git a/locale/fr.po b/locale/fr.po index ea3c75107c587..eef313273931a 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-12-08 19:21+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" @@ -1107,6 +1107,10 @@ msgstr "Broche DAC non valide fournie" msgid "Invalid PWM frequency" msgstr "Fréquence de PWM invalide" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Argument invalide" diff --git a/locale/hi.po b/locale/hi.po index eae6b5818b9f7..51b751c82a532 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -1079,6 +1079,10 @@ msgstr "" msgid "Invalid PWM frequency" msgstr "" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 6800c87e76863..80dabb6256c99 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -1094,6 +1094,10 @@ msgstr "" msgid "Invalid PWM frequency" msgstr "Frequenza PWM non valida" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Argomento non valido" diff --git a/locale/ja.po b/locale/ja.po index 5ec47eaf44092..226a8e179b0aa 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: sporeball \n" "Language-Team: none\n" @@ -1094,6 +1094,10 @@ msgstr "不正なDACピンが与えられました" msgid "Invalid PWM frequency" msgstr "無効なPWM周波数" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "不正な引数" diff --git a/locale/ko.po b/locale/ko.po index ae51ac5d65cdd..456cb47e65355 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-10-05 12:12+0000\n" "Last-Translator: Michal Čihař \n" "Language-Team: LANGUAGE \n" @@ -1084,6 +1084,10 @@ msgstr "" msgid "Invalid PWM frequency" msgstr "" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index e7743314fe150..63ff70716f606 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-10-27 16:47+0000\n" "Last-Translator: Jelle Jager \n" "Language-Team: none\n" @@ -1096,6 +1096,10 @@ msgstr "Ongeldige DAC pin opgegeven" msgid "Invalid PWM frequency" msgstr "Ongeldige PWM frequentie" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Ongeldig argument" diff --git a/locale/pl.po b/locale/pl.po index 599847f2d3e0d..718bf50f429e8 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-12-02 20:29+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" @@ -1094,6 +1094,10 @@ msgstr "" msgid "Invalid PWM frequency" msgstr "Zła częstotliwość PWM" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Zły argument" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 3c366ac49e952..eb73928502913 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-12-11 19:08+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -1105,6 +1105,10 @@ msgstr "O pino DAC informado é inválido" msgid "Invalid PWM frequency" msgstr "Frequência PWM inválida" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Argumento inválido" diff --git a/locale/sv.po b/locale/sv.po index 4c645fc611ac5..a608866e3b27e 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-12-07 20:26+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -1094,6 +1094,10 @@ msgstr "Ogiltig DAC-pinne angiven" msgid "Invalid PWM frequency" msgstr "Ogiltig PWM-frekvens" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Ogiltigt argument" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index c5264a93a832a..1cbcc709ff5fc 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 11:48-0500\n" +"POT-Creation-Date: 2020-12-14 12:59-0500\n" "PO-Revision-Date: 2020-11-19 01:28+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -1092,6 +1092,10 @@ msgstr "Tí gōng liǎo wúxiào de DAC yǐn jiǎo" msgid "Invalid PWM frequency" msgstr "Wúxiào de PWM pínlǜ" +#: ports/esp32s2/common-hal/analogio/AnalogIn.c +msgid "Invalid Pin" +msgstr "" + #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Wúxiào de cānshù" From 1ad49d9a18224ecc53d8f49d0675a369274556ce Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 8 Dec 2020 17:13:00 -0800 Subject: [PATCH 439/770] Add alarm.pin that wakes on pin level Fixes #3787 --- main.c | 18 +- ports/esp32s2/common-hal/alarm/__init__.c | 47 ++-- ports/esp32s2/common-hal/alarm/pin/PinAlarm.c | 260 +++++++++++++++++- ports/esp32s2/common-hal/alarm/pin/PinAlarm.h | 8 +- .../esp32s2/common-hal/alarm/time/TimeAlarm.c | 25 +- .../esp32s2/common-hal/alarm/time/TimeAlarm.h | 2 +- ports/esp32s2/supervisor/esp_port.h | 2 +- ports/esp32s2/supervisor/port.c | 47 ++-- ports/esp32s2/supervisor/usb.c | 7 +- py/obj.c | 6 +- py/vm.c | 2 +- shared-bindings/alarm/pin/PinAlarm.c | 6 +- supervisor/shared/tick.c | 7 +- 13 files changed, 361 insertions(+), 76 deletions(-) diff --git a/main.c b/main.c index 378c506579696..d940f93d180aa 100755 --- a/main.c +++ b/main.c @@ -260,10 +260,10 @@ STATIC void print_code_py_status_message(safe_mode_t safe_mode) { STATIC bool run_code_py(safe_mode_t safe_mode) { bool serial_connected_at_start = serial_connected(); #if CIRCUITPY_AUTORELOAD_DELAY_MS > 0 - if (serial_connected_at_start) { - serial_write("\n"); - print_code_py_status_message(safe_mode); - } + serial_write("\n"); + print_code_py_status_message(safe_mode); + print_safe_mode_message(safe_mode); + serial_write("\n"); #endif pyexec_result_t result; @@ -307,16 +307,14 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { if (result.return_code & PYEXEC_FORCED_EXIT) { return reload_requested; } - } - - // Program has finished running. - // Display a different completion message if the user has no USB attached (cannot save files) - if (!serial_connected_at_start) { + // Display a different completion message if the user has no USB attached (cannot save files) serial_write_compressed(translate("\nCode done running. Waiting for reload.\n")); } - bool serial_connected_before_animation = false; + // Program has finished running. + + bool serial_connected_before_animation = serial_connected(); #if CIRCUITPY_DISPLAYIO bool refreshed_epaper_display = false; #endif diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index fae921db0b0bc..5d1f3e95d4fc2 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -42,6 +42,9 @@ #include "esp_sleep.h" +#include "components/soc/soc/esp32s2/include/soc/rtc_cntl_reg.h" +#include "components/driver/include/driver/uart.h" + // Singleton instance of SleepMemory. const alarm_sleep_memory_obj_t alarm_sleep_memory_obj = { .base = { @@ -49,9 +52,9 @@ const alarm_sleep_memory_obj_t alarm_sleep_memory_obj = { }, }; - void alarm_reset(void) { alarm_time_timealarm_reset(); + alarm_pin_pin_alarm_reset(); alarm_sleep_memory_reset(); esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL); } @@ -60,6 +63,9 @@ STATIC esp_sleep_wakeup_cause_t _get_wakeup_cause(void) { if (alarm_time_timealarm_woke_us_up()) { return ESP_SLEEP_WAKEUP_TIMER; } + if (alarm_pin_pin_alarm_woke_us_up()) { + return ESP_SLEEP_WAKEUP_GPIO; + } return esp_sleep_get_wakeup_cause(); } @@ -69,14 +75,16 @@ bool alarm_woken_from_sleep(void) { } STATIC mp_obj_t _get_wake_alarm(size_t n_alarms, const mp_obj_t *alarms) { - switch (_get_wakeup_cause()) { + esp_sleep_wakeup_cause_t cause = _get_wakeup_cause(); + switch (cause) { case ESP_SLEEP_WAKEUP_TIMER: { return alarm_time_timealarm_get_wakeup_alarm(n_alarms, alarms); } - case ESP_SLEEP_WAKEUP_EXT0: { - // TODO: implement pin alarm wake. - break; + case ESP_SLEEP_WAKEUP_GPIO: + case ESP_SLEEP_WAKEUP_EXT0: + case ESP_SLEEP_WAKEUP_EXT1: { + return alarm_pin_pin_alarm_get_wakeup_alarm(n_alarms, alarms); } case ESP_SLEEP_WAKEUP_TOUCHPAD: @@ -98,24 +106,8 @@ mp_obj_t common_hal_alarm_get_wake_alarm(void) { // Set up light sleep or deep sleep alarms. STATIC void _setup_sleep_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms) { - bool time_alarm_set = false; - alarm_time_time_alarm_obj_t *time_alarm = MP_OBJ_NULL; - - for (size_t i = 0; i < n_alarms; i++) { - if (MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pin_alarm_type)) { - mp_raise_NotImplementedError(translate("PinAlarm not yet implemented")); - } else if (MP_OBJ_IS_TYPE(alarms[i], &alarm_time_time_alarm_type)) { - if (time_alarm_set) { - mp_raise_ValueError(translate("Only one alarm.time alarm can be set.")); - } - time_alarm = MP_OBJ_TO_PTR(alarms[i]); - time_alarm_set = true; - } - } - - if (time_alarm_set) { - alarm_time_timealarm_set_alarm(time_alarm); - } + alarm_pin_pin_alarm_set_alarms(deep_sleep, n_alarms, alarms); + alarm_time_timealarm_set_alarms(deep_sleep, n_alarms, alarms); } STATIC void _idle_until_alarm(void) { @@ -134,7 +126,10 @@ STATIC void _idle_until_alarm(void) { // Is it safe to do a light sleep? Check whether WiFi is on or there are // other ongoing tasks that should not be shut down. STATIC bool _light_sleep_ok(void) { - return !common_hal_wifi_radio_get_enabled(&common_hal_wifi_radio_obj) && !supervisor_workflow_active(); + int64_t connecting_delay_ticks = CIRCUITPY_USB_CONNECTED_SLEEP_DELAY * 1024 - port_get_raw_ticks(NULL); + return !common_hal_wifi_radio_get_enabled(&common_hal_wifi_radio_obj) && + !supervisor_workflow_active() && + connecting_delay_ticks <= 0; } mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms) { @@ -142,10 +137,13 @@ mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj // Light sleep can break some functionality so only do it when possible. Otherwise we idle. if (_light_sleep_ok()) { + // Flush the UART to complete the log line. + uart_wait_tx_idle_polling(CONFIG_ESP_CONSOLE_UART_NUM); esp_light_sleep_start(); } else { _idle_until_alarm(); } + mp_obj_t wake_alarm = _get_wake_alarm(n_alarms, alarms); alarm_reset(); return wake_alarm; @@ -156,6 +154,7 @@ void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *ala } void NORETURN alarm_enter_deep_sleep(void) { + alarm_pin_pin_alarm_prepare_for_deep_sleep(); // The ESP-IDF caches the deep sleep settings and applies them before sleep. // We don't need to worry about resetting them in the interim. esp_deep_sleep_start(); diff --git a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c index 582a665729810..179f34da72da8 100644 --- a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +++ b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c @@ -4,6 +4,7 @@ * The MIT License (MIT) * * Copyright (c) 2020 Dan Halbert for Adafruit Industries + * Copyright (c) 2020 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 @@ -24,15 +25,29 @@ * THE SOFTWARE. */ -#include "esp_sleep.h" +#include "py/runtime.h" #include "shared-bindings/alarm/pin/PinAlarm.h" +#include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Pin.h" +#include "supervisor/esp_port.h" + +#include "components/driver/include/driver/rtc_io.h" +#include "components/esp_system/include/esp_sleep.h" +#include "components/freertos/include/freertos/FreeRTOS.h" +#include "components/hal/esp32s2/include/hal/gpio_ll.h" +#include "components/xtensa/include/esp_debug_helpers.h" void common_hal_alarm_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, mcu_pin_obj_t *pin, bool value, bool edge, bool pull) { + if (edge) { + mp_raise_ValueError(translate("Cannot wake on pin edge. Only level.")); + } + + if (pull && !GPIO_IS_VALID_OUTPUT_GPIO(pin->number)) { + mp_raise_ValueError(translate("Cannot pull on input-only pin.")); + } self->pin = pin; self->value = value; - self->edge = edge; self->pull = pull; } @@ -45,9 +60,248 @@ bool common_hal_alarm_pin_pin_alarm_get_value(alarm_pin_pin_alarm_obj_t *self) { } bool common_hal_alarm_pin_pin_alarm_get_edge(alarm_pin_pin_alarm_obj_t *self) { - return self->edge; + return false; } bool common_hal_alarm_pin_pin_alarm_get_pull(alarm_pin_pin_alarm_obj_t *self) { return self->pull; } + +gpio_isr_handle_t gpio_interrupt_handle; +// Low and high are relative to pin number. 32+ is high. <32 is low. +static volatile uint32_t low_pin_status = 0; +static volatile uint32_t high_pin_status = 0; +void gpio_interrupt(void *arg) { + (void) arg; + + gpio_ll_get_intr_status(&GPIO, xPortGetCoreID(), (uint32_t*) &low_pin_status); + gpio_ll_clear_intr_status(&GPIO, low_pin_status); + gpio_ll_get_intr_status_high(&GPIO, xPortGetCoreID(), (uint32_t*) &high_pin_status); + gpio_ll_clear_intr_status_high(&GPIO, high_pin_status); + + // disable the interrupts that fired, maybe all of them + for (size_t i = 0; i < 32; i++) { + uint32_t mask = 1 << i; + if ((low_pin_status & mask) != 0) { + gpio_ll_intr_disable(&GPIO, i); + } + if ((high_pin_status & mask) != 0) { + gpio_ll_intr_disable(&GPIO, 32 + i); + } + } + BaseType_t high_task_wakeup; + vTaskNotifyGiveFromISR(circuitpython_task, &high_task_wakeup); + if (high_task_wakeup) { + portYIELD_FROM_ISR(); + } +} + +bool alarm_pin_pin_alarm_woke_us_up(void) { + return low_pin_status != 0 || high_pin_status != 0; +} + +mp_obj_t alarm_pin_pin_alarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms) { + // First, check to see if we match any given alarms. + uint64_t pin_status = ((uint64_t) high_pin_status) << 32 | low_pin_status; + for (size_t i = 0; i < n_alarms; i++) { + if (!MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pin_alarm_type)) { + continue; + } + alarm_pin_pin_alarm_obj_t *alarm = MP_OBJ_TO_PTR(alarms[i]); + if ((pin_status & (1ull << alarm->pin->number)) != 0) { + return alarms[i]; + } + } + esp_sleep_wakeup_cause_t cause = esp_sleep_get_wakeup_cause(); + size_t pin_number = 64; + if (cause == ESP_SLEEP_WAKEUP_EXT0) { + pin_number = REG_GET_FIELD(RTC_IO_EXT_WAKEUP0_REG, RTC_IO_EXT_WAKEUP0_SEL); + } else { + if (cause == ESP_SLEEP_WAKEUP_EXT1) { + pin_status = esp_sleep_get_ext1_wakeup_status(); + } + // If the cause is GPIO, we've already snagged pin_status in the interrupt. + // We'll only get here if we pretended to deep sleep. Light sleep will + // pass in existing objects. + for (size_t i = 0; i < 64; i++) { + if ((pin_status & (1ull << i)) != 0) { + pin_number = i; + break; + } + } + } + + alarm_pin_pin_alarm_obj_t *alarm = m_new_obj(alarm_pin_pin_alarm_obj_t); + alarm->base.type = &alarm_pin_pin_alarm_type; + alarm->pin = NULL; + // Map the pin number back to a pin object. + for (size_t i = 0; i < mcu_pin_globals.map.used; i++) { + const mcu_pin_obj_t* pin_obj = MP_OBJ_TO_PTR(mcu_pin_globals.map.table[i].value); + if ((size_t) pin_obj->number == pin_number) { + alarm->pin = mcu_pin_globals.map.table[i].value; + break; + } + } + return alarm; +} + +// These must be static because we need to configure pulls later, right before +// deep sleep. +static uint64_t high_alarms = 0; +static uint64_t low_alarms = 0; +static uint64_t pull_pins = 0; + +void alarm_pin_pin_alarm_reset(void) { + if (gpio_interrupt_handle != NULL) { + esp_intr_free(gpio_interrupt_handle); + gpio_interrupt_handle = NULL; + } + for (size_t i = 0; i < 64; i++) { + uint64_t mask = 1ull << i; + bool high = (high_alarms & mask) != 0; + bool low = (low_alarms & mask) != 0; + if (!(high || low)) { + continue; + } + reset_pin_number(i); + } + high_alarms = 0; + low_alarms = 0; + pull_pins = 0; + high_pin_status = 0; + low_pin_status = 0; +} + +void alarm_pin_pin_alarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms) { + // Bitmask of wake up settings. + size_t high_count = 0; + size_t low_count = 0; + + for (size_t i = 0; i < n_alarms; i++) { + // TODO: Check for ULP or touch alarms because they can't coexist with GPIO alarms. + if (!MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pin_alarm_type)) { + continue; + } + alarm_pin_pin_alarm_obj_t *alarm = MP_OBJ_TO_PTR(alarms[i]); + + gpio_num_t pin_number = alarm->pin->number; + if (alarm->value) { + high_alarms |= 1ull << pin_number; + high_count++; + } else { + low_alarms |= 1ull << pin_number; + low_count++; + } + if (alarm->pull) { + pull_pins |= 1ull << pin_number; + } + } + if (high_count == 0 && low_count == 0) { + return; + } + if (deep_sleep && low_count > 2 && high_count == 0) { + mp_raise_ValueError(translate("Can only alarm on two low pins from deep sleep.")); + } + if (deep_sleep && low_count > 1 && high_count > 0) { + mp_raise_ValueError(translate("Can only alarm on one low pin while others alarm high from deep sleep.")); + } + // Only use ext0 and ext1 during deep sleep. + if (deep_sleep) { + if (high_count > 0) { + if (esp_sleep_enable_ext1_wakeup(high_alarms, ESP_EXT1_WAKEUP_ANY_HIGH) != ESP_OK) { + mp_raise_ValueError(translate("Can only alarm on RTC IO from deep sleep.")); + } + } + size_t low_pins[2]; + size_t j = 0; + for (size_t i = 0; i < 64; i++) { + uint64_t mask = 1ull << i; + if ((low_alarms & mask) != 0) { + low_pins[j++] = i; + } + if (j == 2) { + break; + } + } + if (low_count > 1) { + if (esp_sleep_enable_ext1_wakeup(1ull << low_pins[1], ESP_EXT1_WAKEUP_ALL_LOW) != ESP_OK) { + mp_raise_ValueError(translate("Can only alarm on RTC IO from deep sleep.")); + } + } + if (low_count > 0) { + if (esp_sleep_enable_ext0_wakeup(low_pins[0], 0) != ESP_OK) { + mp_raise_ValueError(translate("Can only alarm on RTC IO from deep sleep.")); + } + } + } else { + // Enable GPIO wake up if we're sleeping. + esp_sleep_enable_gpio_wakeup(); + } + // Set GPIO interrupts so they wake us from light sleep or from idle via the + // interrupt handler above. + low_pin_status = 0; + high_pin_status = 0; + if (gpio_isr_register(gpio_interrupt, NULL, 0, &gpio_interrupt_handle) != ESP_OK) { + mp_raise_ValueError(translate("Can only alarm on RTC IO from deep sleep.")); + } + for (size_t i = 0; i < 64; i++) { + uint64_t mask = 1ull << i; + bool high = (high_alarms & mask) != 0; + bool low = (low_alarms & mask) != 0; + bool pull = (pull_pins & mask) != 0; + if (!(high || low)) { + continue; + } + if (rtc_gpio_is_valid_gpio(i)) { + rtc_gpio_deinit(i); + } + gpio_int_type_t interrupt_mode = GPIO_INTR_DISABLE; + gpio_pull_mode_t pull_mode = GPIO_FLOATING; + if (high) { + interrupt_mode = GPIO_INTR_HIGH_LEVEL; + pull_mode = GPIO_PULLDOWN_ONLY; + } + if (low) { + interrupt_mode = GPIO_INTR_LOW_LEVEL; + pull_mode = GPIO_PULLUP_ONLY; + } + gpio_set_direction(i, GPIO_MODE_DEF_INPUT); + PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[i], PIN_FUNC_GPIO); + if (pull) { + gpio_set_pull_mode(i, pull_mode); + size_t j = 0; + while (gpio_get_level(i) == false) { + j++; + } + } + never_reset_pin_number(i); + // Sets interrupt type and wakeup bits. + gpio_wakeup_enable(i, interrupt_mode); + gpio_intr_enable(i); + } +} + + +void alarm_pin_pin_alarm_prepare_for_deep_sleep(void) { + if (pull_pins == 0) { + return; + } + for (size_t i = 0; i < 64; i++) { + uint64_t mask = 1ull << i; + bool pull = (pull_pins & mask) != 0; + if (!pull) { + continue; + } + bool high = (high_alarms & mask) != 0; + bool low = (low_alarms & mask) != 0; + // The pull direction is opposite from alarm value. + if (high) { + rtc_gpio_pullup_dis(i); + rtc_gpio_pulldown_en(i); + } + if (low) { + rtc_gpio_pullup_en(i); + rtc_gpio_pulldown_dis(i); + } + } +} diff --git a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h index 0eaa7777f5ed1..8b14931cab328 100644 --- a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h +++ b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h @@ -31,7 +31,11 @@ typedef struct { mp_obj_base_t base; mcu_pin_obj_t *pin; bool value; - bool all_same_value; - bool edge; bool pull; } alarm_pin_pin_alarm_obj_t; + +void alarm_pin_pin_alarm_reset(void); +void alarm_pin_pin_alarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms); +void alarm_pin_pin_alarm_prepare_for_deep_sleep(void); +mp_obj_t alarm_pin_pin_alarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms); +bool alarm_pin_pin_alarm_woke_us_up(void); diff --git a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c index 4d0bba2387816..a7abde6a4e3b2 100644 --- a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +++ b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c @@ -63,9 +63,7 @@ STATIC bool woke_up = false; void timer_callback(void *arg) { (void) arg; woke_up = true; - if (sleeping_circuitpython_task) { - xTaskNotifyGive(sleeping_circuitpython_task); - } + xTaskNotifyGive(circuitpython_task); } bool alarm_time_timealarm_woke_us_up(void) { @@ -79,7 +77,24 @@ void alarm_time_timealarm_reset(void) { woke_up = false; } -void alarm_time_timealarm_set_alarm(alarm_time_time_alarm_obj_t *self) { +void alarm_time_timealarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms) { + bool time_alarm_set = false; + alarm_time_time_alarm_obj_t *time_alarm = MP_OBJ_NULL; + + for (size_t i = 0; i < n_alarms; i++) { + if (!MP_OBJ_IS_TYPE(alarms[i], &alarm_time_time_alarm_type)) { + continue; + } + if (time_alarm_set) { + mp_raise_ValueError(translate("Only one alarm.time alarm can be set.")); + } + time_alarm = MP_OBJ_TO_PTR(alarms[i]); + time_alarm_set = true; + } + if (!time_alarm_set) { + return; + } + if (pretend_sleep_timer != NULL) { esp_timer_stop(pretend_sleep_timer); } else { @@ -94,7 +109,7 @@ void alarm_time_timealarm_set_alarm(alarm_time_time_alarm_obj_t *self) { // Compute how long to actually sleep, considering the time now. mp_float_t now_secs = uint64_to_float(common_hal_time_monotonic_ms()) / 1000.0f; - mp_float_t wakeup_in_secs = MAX(0.0f, self->monotonic_time - now_secs); + mp_float_t wakeup_in_secs = MAX(0.0f, time_alarm->monotonic_time - now_secs); const uint64_t sleep_for_us = (uint64_t) (wakeup_in_secs * 1000000); esp_sleep_enable_timer_wakeup(sleep_for_us); diff --git a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h index 04c553009eea2..277ababc2041e 100644 --- a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h +++ b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h @@ -36,5 +36,5 @@ typedef struct { mp_obj_t alarm_time_timealarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms); // Check for the wake up alarm from pretend deep sleep. bool alarm_time_timealarm_woke_us_up(void); -void alarm_time_timealarm_set_alarm(alarm_time_time_alarm_obj_t *self); +void alarm_time_timealarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms); void alarm_time_timealarm_reset(void); diff --git a/ports/esp32s2/supervisor/esp_port.h b/ports/esp32s2/supervisor/esp_port.h index 1164666cda93c..8b9e13829f515 100644 --- a/ports/esp32s2/supervisor/esp_port.h +++ b/ports/esp32s2/supervisor/esp_port.h @@ -30,6 +30,6 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" -extern TaskHandle_t sleeping_circuitpython_task; +extern TaskHandle_t circuitpython_task; #endif // MICROPY_INCLUDED_ESP32S2_SUPERVISOR_PORT_H diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 7037b4f05132f..7d8aac4d5ec97 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -66,6 +66,9 @@ uint32_t* heap; uint32_t heap_size; STATIC esp_timer_handle_t _tick_timer; +STATIC esp_timer_handle_t _sleep_timer; + +TaskHandle_t circuitpython_task = NULL; extern void esp_restart(void) NORETURN; @@ -73,6 +76,8 @@ void tick_timer_cb(void* arg) { supervisor_tick(); } +void sleep_timer_cb(void* arg); + safe_mode_t port_init(void) { esp_timer_create_args_t args; args.callback = &tick_timer_cb; @@ -81,10 +86,14 @@ safe_mode_t port_init(void) { args.name = "CircuitPython Tick"; esp_timer_create(&args, &_tick_timer); - #ifdef DEBUG + args.callback = &sleep_timer_cb; + args.arg = NULL; + args.dispatch_method = ESP_TIMER_TASK; + args.name = "CircuitPython Sleep"; + esp_timer_create(&args, &_sleep_timer); + // Send the ROM output out of the UART. This includes early logs. esp_rom_install_channel_putc(1, esp_rom_uart_putc); - #endif heap = NULL; never_reset_module_internal_pins(); @@ -106,10 +115,14 @@ safe_mode_t port_init(void) { if (reason == ESP_RST_BROWNOUT) { return BROWNOUT; } - if (reason == ESP_RST_PANIC) { + if (reason == ESP_RST_PANIC || + reason == ESP_RST_INT_WDT || + reason == ESP_RST_WDT) { return HARD_CRASH; } + circuitpython_task = xTaskGetCurrentTaskHandle(); + return NO_SAFE_MODE; } @@ -250,29 +263,25 @@ void port_disable_tick(void) { // CircuitPython's VM is run in a separate FreeRTOS task from TinyUSB. // Tick disable can happen via auto-reload so poke the main task here. - if (sleeping_circuitpython_task != NULL) { - xTaskNotifyGive(sleeping_circuitpython_task); - } + xTaskNotifyGive(circuitpython_task); } -TickType_t sleep_time_duration; +void sleep_timer_cb(void* arg) { + xTaskNotifyGive(circuitpython_task); +} void port_interrupt_after_ticks(uint32_t ticks) { - sleep_time_duration = (ticks * 100)/1024; + uint64_t timeout_us = ticks * 1000000ull / 1024; + if (esp_timer_start_once(_sleep_timer, timeout_us) != ESP_OK) { + esp_timer_stop(_sleep_timer); + esp_timer_start_once(_sleep_timer, timeout_us); + } } +// On the ESP we use FreeRTOS notifications instead of interrupts so this is a +// bit of a misnomer. void port_idle_until_interrupt(void) { - uint32_t notify_value = 0; - - if (sleep_time_duration == 0) { - return; - } - sleeping_circuitpython_task = xTaskGetCurrentTaskHandle(); - xTaskNotifyWait(0x01, 0x01, ¬ify_value, sleep_time_duration ); - sleeping_circuitpython_task = NULL; - if (notify_value == 1) { - mp_handle_pending(); - } + xTaskNotifyWait(0x01, 0x01, NULL, portMAX_DELAY); } // Wrap main in app_main that the IDF expects. diff --git a/ports/esp32s2/supervisor/usb.c b/ports/esp32s2/supervisor/usb.c index 2bfcdfb125d3a..6c92f72537188 100644 --- a/ports/esp32s2/supervisor/usb.c +++ b/ports/esp32s2/supervisor/usb.c @@ -26,6 +26,7 @@ */ #include "supervisor/usb.h" +#include "supervisor/esp_port.h" #include "lib/utils/interrupt_char.h" #include "lib/mp-readline/readline.h" @@ -52,8 +53,6 @@ StackType_t usb_device_stack[USBD_STACK_SIZE]; StaticTask_t usb_device_taskdef; -TaskHandle_t sleeping_circuitpython_task = NULL; - // USB Device Driver task // This top level thread process all usb events and invoke callbacks void usb_device_task(void* param) @@ -131,8 +130,6 @@ void tud_cdc_rx_wanted_cb(uint8_t itf, char wanted_char) mp_keyboard_interrupt(); // CircuitPython's VM is run in a separate FreeRTOS task from TinyUSB. // So, we must notify the other task when a CTRL-C is received. - if (sleeping_circuitpython_task != NULL) { - xTaskNotifyGive(sleeping_circuitpython_task); - } + xTaskNotifyGive(circuitpython_task); } } diff --git a/py/obj.c b/py/obj.c index b6462641ce01c..218fb43213d03 100644 --- a/py/obj.c +++ b/py/obj.c @@ -29,6 +29,7 @@ #include #include +#include "lib/utils/interrupt_char.h" #include "py/obj.h" #include "py/objtype.h" #include "py/objint.h" @@ -67,7 +68,10 @@ void mp_obj_print_helper(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t #ifdef RUN_BACKGROUND_TASKS RUN_BACKGROUND_TASKS; #endif - mp_handle_pending(); + // Stop printing if we've been interrupted. + if (mp_hal_is_interrupted()) { + return; + } #ifndef NDEBUG if (o_in == MP_OBJ_NULL) { diff --git a/py/vm.c b/py/vm.c index 9b3354b096dd4..13a9980aad2af 100644 --- a/py/vm.c +++ b/py/vm.c @@ -1015,7 +1015,7 @@ unwind_jump:; } #endif SET_TOP(mp_call_method_n_kw(unum & 0xff, (unum >> 8) & 0xff, sp)); - DISPATCH(); + DISPATCH_WITH_PEND_EXC_CHECK(); } ENTRY(MP_BC_CALL_METHOD_VAR_KW): { diff --git a/shared-bindings/alarm/pin/PinAlarm.c b/shared-bindings/alarm/pin/PinAlarm.c index 7a5617142b46a..83ccc0d766294 100644 --- a/shared-bindings/alarm/pin/PinAlarm.c +++ b/shared-bindings/alarm/pin/PinAlarm.c @@ -89,7 +89,11 @@ STATIC mp_obj_t alarm_pin_pin_alarm_make_new(const mp_obj_type_t *type, mp_uint_ //| STATIC mp_obj_t alarm_pin_pin_alarm_obj_get_pin(mp_obj_t self_in) { alarm_pin_pin_alarm_obj_t *self = MP_OBJ_TO_PTR(self_in); - return common_hal_alarm_pin_pin_alarm_get_pin(self); + mcu_pin_obj_t* pin = common_hal_alarm_pin_pin_alarm_get_pin(self); + if (pin == NULL) { + return mp_const_none; + } + return MP_OBJ_FROM_PTR(pin); } MP_DEFINE_CONST_FUN_OBJ_1(alarm_pin_pin_alarm_get_pin_obj, alarm_pin_pin_alarm_obj_get_pin); diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c index d37a585eb226f..5d75a5395cfc5 100644 --- a/supervisor/shared/tick.c +++ b/supervisor/shared/tick.c @@ -145,10 +145,11 @@ void mp_hal_delay_ms(mp_uint_t delay) { delay = delay * 1024 / 1000; uint64_t end_tick = start_tick + delay; int64_t remaining = delay; - while (remaining > 0) { + + // Loop until we've waited long enough or we've been CTRL-Ced by autoreload + // or the user. + while (remaining > 0 && !mp_hal_is_interrupted()) { RUN_BACKGROUND_TASKS; - // Check to see if we've been CTRL-Ced by autoreload or the user. - mp_handle_pending(); remaining = end_tick - port_get_raw_ticks(NULL); // We break a bit early so we don't risk setting the alarm before the time when we call // sleep. From 0dcc659d536034637009e3c5cb7713c35c002929 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 11 Dec 2020 20:34:01 -0800 Subject: [PATCH 440/770] Swap to IDF release/4.2 branch for stability --- .gitmodules | 2 +- ports/esp32s2/Makefile | 8 ++---- ports/esp32s2/common-hal/alarm/pin/PinAlarm.c | 4 +-- ports/esp32s2/common-hal/analogio/AnalogIn.h | 2 +- ports/esp32s2/common-hal/busio/I2C.h | 2 +- ports/esp32s2/common-hal/busio/SPI.c | 5 ++-- ports/esp32s2/common-hal/busio/SPI.h | 4 +-- ports/esp32s2/common-hal/busio/UART.h | 2 +- .../common-hal/digitalio/DigitalInOut.c | 2 +- .../esp32s2/common-hal/microcontroller/Pin.c | 2 +- ports/esp32s2/esp-idf | 2 +- ports/esp32s2/peripherals/pins.h | 6 ++-- ports/esp32s2/supervisor/port.c | 6 ++-- ports/esp32s2/supervisor/usb.c | 28 ++++++++----------- 14 files changed, 36 insertions(+), 39 deletions(-) diff --git a/.gitmodules b/.gitmodules index d36613d604786..b74cd0b30d846 100644 --- a/.gitmodules +++ b/.gitmodules @@ -152,7 +152,7 @@ url = https://github.com/adafruit/Adafruit_CircuitPython_RFM69.git [submodule "ports/esp32s2/esp-idf"] path = ports/esp32s2/esp-idf - url = https://github.com/jepler/esp-idf.git + url = https://github.com/adafruit/esp-idf.git [submodule "ports/esp32s2/certificates/nina-fw"] path = ports/esp32s2/certificates/nina-fw url = https://github.com/adafruit/nina-fw.git diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 01f8f48a78ee4..e496a61a46f48 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -143,7 +143,6 @@ LDFLAGS += -L$(BUILD)/esp-idf/esp-idf/esp32s2 \ -Tesp32s2.peripherals.ld \ -Lesp-idf/components/esp_rom/esp32s2/ld \ -Tesp32s2.rom.ld \ - -Tesp32s2.rom.api.ld \ -Tesp32s2.rom.libgcc.ld \ -Tesp32s2.rom.newlib-data.ld \ -Tesp32s2.rom.newlib-funcs.ld \ @@ -276,7 +275,7 @@ menuconfig: $(BUILD)/esp-idf/config # qstr builds include headers so we need to make sure they are up to date $(HEADER_BUILD)/qstr.split: | $(BUILD)/esp-idf/config/sdkconfig.h -ESP_IDF_COMPONENTS_LINK = freertos log hal esp_system esp_adc_cal esp32s2 bootloader_support pthread esp_timer vfs spi_flash app_update esp_common esp32s2 heap newlib driver xtensa soc esp_ringbuf esp_wifi esp_event wpa_supplicant mbedtls efuse nvs_flash esp_netif lwip esp_rom esp-tls +ESP_IDF_COMPONENTS_LINK = freertos log esp_system esp_adc_cal esp32s2 bootloader_support pthread esp_timer vfs spi_flash app_update esp_common esp32s2 heap newlib driver xtensa soc esp_ringbuf esp_wifi esp_event wpa_supplicant mbedtls efuse nvs_flash esp_netif lwip esp-tls ESP_IDF_COMPONENTS_INCLUDE = driver freertos log soc @@ -288,11 +287,11 @@ ESP_IDF_WIFI_COMPONENTS_EXPANDED = $(foreach component, $(ESP_IDF_WIFI_COMPONENT MBEDTLS_COMPONENTS_LINK = crypto tls x509 MBEDTLS_COMPONENTS_LINK_EXPANDED = $(foreach component, $(MBEDTLS_COMPONENTS_LINK), $(BUILD)/esp-idf/esp-idf/mbedtls/mbedtls/library/libmbed$(component).a) -BINARY_BLOBS = esp-idf/components/xtensa/esp32s2/libxt_hal.a +BINARY_BLOBS = esp-idf/components/xtensa/esp32s2/libhal.a BINARY_WIFI_BLOBS = libcoexist.a libcore.a libespnow.a libmesh.a libnet80211.a libpp.a librtc.a libsmartconfig.a libphy.a BINARY_BLOBS += $(addprefix esp-idf/components/esp_wifi/lib/esp32s2/, $(BINARY_WIFI_BLOBS)) -ESP_IDF_COMPONENTS_EXPANDED += $(BUILD)/esp-idf/esp-idf/soc/soc/esp32s2/libsoc_esp32s2.a esp-idf/components/xtensa/esp32s2/libxt_hal.a +ESP_IDF_COMPONENTS_EXPANDED += $(BUILD)/esp-idf/esp-idf/soc/soc/esp32s2/libsoc_esp32s2.a ESP_AUTOGEN_LD = $(BUILD)/esp-idf/esp-idf/esp32s2/esp32s2_out.ld $(BUILD)/esp-idf/esp-idf/esp32s2/ld/esp32s2.project.ld FLASH_FLAGS = --flash_mode $(CIRCUITPY_ESP_FLASH_MODE) --flash_freq $(CIRCUITPY_ESP_FLASH_FREQ) --flash_size $(CIRCUITPY_ESP_FLASH_SIZE) @@ -308,7 +307,6 @@ esp-idf-stamp: $(BUILD)/esp-idf/config/sdkconfig.h esp-idf/esp32s2/ld/esp32s2.project.ld \ esp-idf/esp_event/libesp_event.a \ esp-idf/esp_netif/libesp_netif.a \ - esp-idf/esp_rom/libesp_rom.a \ esp-idf/esp_system/libesp_system.a \ esp-idf/esp_wifi/libesp_wifi.a \ esp-idf/lwip/liblwip.a \ diff --git a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c index 179f34da72da8..01e2faeb8751e 100644 --- a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +++ b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c @@ -33,9 +33,9 @@ #include "supervisor/esp_port.h" #include "components/driver/include/driver/rtc_io.h" -#include "components/esp_system/include/esp_sleep.h" +#include "components/esp32s2/include/esp_sleep.h" #include "components/freertos/include/freertos/FreeRTOS.h" -#include "components/hal/esp32s2/include/hal/gpio_ll.h" +#include "components/soc/src/esp32s2/include/hal/gpio_ll.h" #include "components/xtensa/include/esp_debug_helpers.h" void common_hal_alarm_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, mcu_pin_obj_t *pin, bool value, bool edge, bool pull) { diff --git a/ports/esp32s2/common-hal/analogio/AnalogIn.h b/ports/esp32s2/common-hal/analogio/AnalogIn.h index fed4d02170322..b9c4866f295d9 100644 --- a/ports/esp32s2/common-hal/analogio/AnalogIn.h +++ b/ports/esp32s2/common-hal/analogio/AnalogIn.h @@ -29,7 +29,7 @@ #include "common-hal/microcontroller/Pin.h" -#include "components/hal/include/hal/adc_types.h" +#include "components/soc/include/hal/adc_types.h" #include "FreeRTOS.h" #include "freertos/semphr.h" #include "py/obj.h" diff --git a/ports/esp32s2/common-hal/busio/I2C.h b/ports/esp32s2/common-hal/busio/I2C.h index c39d6d7448d8a..1a989e30a42f3 100644 --- a/ports/esp32s2/common-hal/busio/I2C.h +++ b/ports/esp32s2/common-hal/busio/I2C.h @@ -29,7 +29,7 @@ #include "common-hal/microcontroller/Pin.h" -#include "components/hal/include/hal/i2c_types.h" +#include "components/soc/include/hal/i2c_types.h" #include "FreeRTOS.h" #include "freertos/semphr.h" #include "py/obj.h" diff --git a/ports/esp32s2/common-hal/busio/SPI.c b/ports/esp32s2/common-hal/busio/SPI.c index 562881585dfd1..182a04b0bb3b1 100644 --- a/ports/esp32s2/common-hal/busio/SPI.c +++ b/ports/esp32s2/common-hal/busio/SPI.c @@ -273,7 +273,7 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self, self->bits = bits; self->target_frequency = baudrate; self->hal_context.timing_conf = &self->timing_conf; - esp_err_t result = spi_hal_cal_clock_conf(&self->hal_context, + esp_err_t result = spi_hal_get_clock_conf(&self->hal_context, self->target_frequency, 128 /* duty_cycle */, self->connected_through_gpio, @@ -366,7 +366,8 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_ou burst_length = sizeof(hal->hw->data_buf); // When switching to non-DMA, we need to make sure DMA is off. Otherwise, // the S2 will transmit zeroes instead of our data. - spi_ll_txdma_disable(hal->hw); + hal->hw->dma_out_link.dma_tx_ena = 0; + hal->hw->dma_out_link.stop = 1; } // This rounds up. diff --git a/ports/esp32s2/common-hal/busio/SPI.h b/ports/esp32s2/common-hal/busio/SPI.h index f6c1c344a1465..d6203feae6e2e 100644 --- a/ports/esp32s2/common-hal/busio/SPI.h +++ b/ports/esp32s2/common-hal/busio/SPI.h @@ -30,8 +30,8 @@ #include "common-hal/microcontroller/Pin.h" #include "components/driver/include/driver/spi_common_internal.h" -#include "components/hal/include/hal/spi_hal.h" -#include "components/hal/include/hal/spi_types.h" +#include "components/soc/include/hal/spi_hal.h" +#include "components/soc/include/hal/spi_types.h" #include "py/obj.h" typedef struct { diff --git a/ports/esp32s2/common-hal/busio/UART.h b/ports/esp32s2/common-hal/busio/UART.h index 1d7f135115d95..751fb2e002178 100644 --- a/ports/esp32s2/common-hal/busio/UART.h +++ b/ports/esp32s2/common-hal/busio/UART.h @@ -29,7 +29,7 @@ #include "common-hal/microcontroller/Pin.h" -#include "components/hal/include/hal/uart_types.h" +#include "components/soc/include/hal/uart_types.h" #include "py/obj.h" typedef struct { diff --git a/ports/esp32s2/common-hal/digitalio/DigitalInOut.c b/ports/esp32s2/common-hal/digitalio/DigitalInOut.c index 152db1e71db22..a2a0209f93a26 100644 --- a/ports/esp32s2/common-hal/digitalio/DigitalInOut.c +++ b/ports/esp32s2/common-hal/digitalio/DigitalInOut.c @@ -30,7 +30,7 @@ #include "components/driver/include/driver/gpio.h" -#include "components/hal/include/hal/gpio_hal.h" +#include "components/soc/include/hal/gpio_hal.h" void common_hal_digitalio_digitalinout_never_reset( digitalio_digitalinout_obj_t *self) { diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index 81dfa1308d555..9a393c170a1ce 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -32,7 +32,7 @@ #include "py/mphal.h" #include "components/driver/include/driver/gpio.h" -#include "components/hal/include/hal/gpio_hal.h" +#include "components/soc/include/hal/gpio_hal.h" #ifdef MICROPY_HW_NEOPIXEL bool neopixel_in_use; diff --git a/ports/esp32s2/esp-idf b/ports/esp32s2/esp-idf index d06744f5efc38..ebe7784258d8c 160000 --- a/ports/esp32s2/esp-idf +++ b/ports/esp32s2/esp-idf @@ -1 +1 @@ -Subproject commit d06744f5efc382c61cbad8758107cec308feef09 +Subproject commit ebe7784258d8c10e9cc334ccc00c3fd270746c8b diff --git a/ports/esp32s2/peripherals/pins.h b/ports/esp32s2/peripherals/pins.h index c78eb83851382..8bad937ef296d 100644 --- a/ports/esp32s2/peripherals/pins.h +++ b/ports/esp32s2/peripherals/pins.h @@ -35,9 +35,9 @@ #include "esp32s2_peripherals_config.h" #include "esp-idf/config/sdkconfig.h" -#include "components/hal/include/hal/gpio_types.h" -#include "components/hal/include/hal/adc_types.h" -#include "components/hal/include/hal/touch_sensor_types.h" +#include "components/soc/include/hal/gpio_types.h" +#include "components/soc/include/hal/adc_types.h" +#include "components/soc/include/hal/touch_sensor_types.h" typedef struct { PIN_PREFIX_FIELDS diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 7d8aac4d5ec97..8a87180cd9a33 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -54,7 +54,7 @@ #include "peripherals/rmt.h" #include "peripherals/pcnt.h" #include "peripherals/timer.h" -#include "components/esp_rom/include/esp_rom_uart.h" +#include "components/esp_rom/include/esp32s2/rom/ets_sys.h" #include "components/heap/include/esp_heap_caps.h" #include "components/xtensa/include/esp_debug_helpers.h" #include "components/soc/soc/esp32s2/include/soc/cache_memory.h" @@ -93,7 +93,9 @@ safe_mode_t port_init(void) { esp_timer_create(&args, &_sleep_timer); // Send the ROM output out of the UART. This includes early logs. - esp_rom_install_channel_putc(1, esp_rom_uart_putc); + #ifdef DEBUG + ets_install_uart_printf(); + #endif heap = NULL; never_reset_module_internal_pins(); diff --git a/ports/esp32s2/supervisor/usb.c b/ports/esp32s2/supervisor/usb.c index 6c92f72537188..16657d4079de9 100644 --- a/ports/esp32s2/supervisor/usb.c +++ b/ports/esp32s2/supervisor/usb.c @@ -34,8 +34,7 @@ #include "components/driver/include/driver/periph_ctrl.h" #include "components/driver/include/driver/gpio.h" #include "components/esp_rom/include/esp32s2/rom/gpio.h" -#include "components/esp_rom/include/esp_rom_gpio.h" -#include "components/hal/esp32s2/include/hal/gpio_ll.h" +#include "components/soc/src/esp32s2/include/hal/gpio_ll.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -77,23 +76,20 @@ static void configure_pins (usb_hal_context_t *usb) * Introduce additional parameters in usb_hal_context_t when adding support * for USB Host. */ - for ( const usb_iopin_dsc_t *iopin = usb_periph_iopins; iopin->pin != -1; ++iopin ) { - if ( (usb->use_external_phy) || (iopin->ext_phy_only == 0) ) { - esp_rom_gpio_pad_select_gpio(iopin->pin); - if ( iopin->is_output ) { - esp_rom_gpio_connect_out_signal(iopin->pin, iopin->func, false, false); + for (const usb_iopin_dsc_t* iopin = usb_periph_iopins; iopin->pin != -1; ++iopin) { + if ((usb->use_external_phy) || (iopin->ext_phy_only == 0)) { + gpio_pad_select_gpio(iopin->pin); + if (iopin->is_output) { + gpio_matrix_out(iopin->pin, iopin->func, false, false); + } else { + gpio_matrix_in(iopin->pin, iopin->func, false); + gpio_pad_input_enable(iopin->pin); } - else { - esp_rom_gpio_connect_in_signal(iopin->pin, iopin->func, false); - if ( (iopin->pin != GPIO_FUNC_IN_LOW) && (iopin->pin != GPIO_FUNC_IN_HIGH) ) { - gpio_ll_input_enable(&GPIO, iopin->pin); - } - } - esp_rom_gpio_pad_unhold(iopin->pin); + gpio_pad_unhold(iopin->pin); } } - if ( !usb->use_external_phy ) { - gpio_set_drive_capability(USBPHY_DM_NUM, GPIO_DRIVE_CAP_3); + if (!usb->use_external_phy) { + gpio_set_drive_capability(USBPHY_DP_NUM, GPIO_DRIVE_CAP_3); gpio_set_drive_capability(USBPHY_DP_NUM, GPIO_DRIVE_CAP_3); } } From ca757f2ead6e84ad52b6030281b666792fb12b43 Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Wed, 16 Dec 2020 10:25:20 -0500 Subject: [PATCH 441/770] removed comments on 64MiB SPI flash causing build test issues --- .gitattributes 2 | 32 + .gitignore 2 | 88 +++ .gitmodules 2 | 155 +++++ .mailmap 2 | 112 ++++ mpy-cross/.gitignore 2 | 11 + ports/atmel-samd/.gitattributes 2 | 2 + ports/atmel-samd/.gitignore 2 | 1 + ports/atmel-samd/boards/board.h | 47 ++ supervisor/shared/external_flash/devices.h | 50 +- tests/README 2 | 18 + tests/extmod 2/btree1.py | 89 +++ tests/extmod 2/framebuf1.py | 109 ++++ tests/extmod 2/framebuf16.py | 59 ++ tests/extmod 2/framebuf2.py.exp | 57 ++ tests/extmod 2/framebuf4.py | 53 ++ tests/extmod 2/framebuf_subclass.py | 20 + tests/extmod 2/machine1.py | 28 + tests/extmod 2/machine_pinbase.py | 30 + tests/extmod 2/machine_pinbase.py.exp | 9 + tests/extmod 2/ticks_diff.py | 33 + tests/extmod 2/time_ms_us.py | 22 + tests/extmod 2/time_ms_us.py.exp | 3 + tests/extmod 2/ubinascii_a2b_base64.py | 49 ++ tests/extmod 2/ubinascii_hexlify.py | 17 + tests/extmod 2/uctypes_32bit_intbig.py.exp | 11 + .../uctypes_array_assign_native_le.py | 89 +++ .../uctypes_array_assign_native_le.py.exp | 11 + .../uctypes_array_assign_native_le_intbig.py | 43 ++ tests/extmod 2/uctypes_bytearray.py | 22 + tests/extmod 2/uctypes_byteat.py | 10 + tests/extmod 2/uctypes_byteat.py.exp | 2 + tests/extmod 2/uctypes_error.py | 37 ++ tests/extmod 2/uctypes_error.py.exp | 4 + tests/extmod 2/uctypes_le_float.py | 24 + tests/extmod 2/uctypes_native_float.py | 20 + tests/extmod 2/uctypes_ptr_le.py | 34 + tests/extmod 2/uctypes_ptr_native_le.py.exp | 6 + tests/extmod 2/uctypes_sizeof.py.exp | 7 + tests/extmod 2/uhashlib_sha1.py | 28 + tests/extmod 2/ujson_dump.py | 30 + tests/extmod 2/ujson_dumps_extra.py | 9 + tests/extmod 2/ujson_dumps_float.py | 10 + tests/extmod 2/ujson_load_readinto.py.exp | 4 + tests/extmod 2/ujson_loads.py | 74 +++ tests/extmod 2/ujson_loads_float.py | 17 + tests/extmod 2/urandom_basic.py | 29 + tests/extmod 2/ure1.py | 103 +++ tests/extmod 2/ure_debug.py.exp | 15 + tests/extmod 2/ure_error.py | 25 + tests/extmod 2/ure_namedclass.py | 32 + tests/extmod 2/ure_stack_overflow.py.exp | 1 + tests/extmod 2/ure_sub_unmatched.py.exp | 1 + tests/extmod 2/ussl_basic.py | 59 ++ tests/extmod 2/utimeq1.py | 137 ++++ tests/extmod 2/utimeq_stable.py.exp | 1 + tests/extmod 2/uzlib_decompio.py | 33 + tests/extmod 2/uzlib_decompio_gz.py.exp | 13 + tests/extmod 2/vfs_fat_fileio1.py | 139 ++++ tests/extmod 2/vfs_fat_fileio1.py.exp | 18 + tests/extmod 2/vfs_fat_more.py.exp | 29 + tests/extmod 2/vfs_fat_oldproto.py.exp | 3 + tests/extmod 2/vfs_fat_ramdisk.py.exp | 17 + tests/extmod 2/websocket_basic.py.exp | 14 + tests/feature_check 2/README | 4 + tests/feature_check 2/async_check.py | 3 + tests/feature_check 2/async_check.py.exp | 0 tests/feature_check 2/byteorder.py | 2 + tests/feature_check 2/byteorder.py.exp | 0 tests/feature_check 2/complex.py | 5 + tests/feature_check 2/complex.py.exp | 0 tests/feature_check 2/const.py | 1 + tests/feature_check 2/const.py.exp | 0 tests/feature_check 2/coverage.py | 5 + tests/feature_check 2/coverage.py.exp | 0 tests/feature_check 2/float.py | 13 + tests/feature_check 2/float.py.exp | 1 + tests/feature_check 2/int_big.py | 2 + tests/feature_check 2/int_big.py.exp | 1 + tests/feature_check 2/native_check.py | 4 + tests/feature_check 2/native_check.py.exp | 0 tests/feature_check 2/repl_emacs_check.py | 3 + tests/feature_check 2/repl_emacs_check.py.exp | 7 + tests/feature_check 2/reverse_ops.py | 9 + tests/feature_check 2/reverse_ops.py.exp | 0 tests/feature_check 2/set_check.py | 2 + tests/feature_check 2/set_check.py.exp | 0 tests/float 2/array_construct.py | 10 + tests/float 2/builtin_float_hash.py | 25 + tests/float 2/builtin_float_minmax.py | 31 + tests/float 2/builtin_float_pow.py | 11 + tests/float 2/builtin_float_round.py | 24 + tests/float 2/builtin_float_round_intbig.py | 4 + tests/float 2/bytearray_construct.py | 9 + tests/float 2/bytes_construct.py | 9 + tests/float 2/cmath_fun.py | 55 ++ tests/float 2/cmath_fun_special.py | 31 + tests/float 2/complex1.py | 116 ++++ tests/float 2/complex1_intbig.py | 4 + tests/float 2/float1.py | 119 ++++ tests/float 2/float2int_doubleprec_intbig.py | 100 +++ tests/float 2/float2int_fp30_intbig.py | 97 +++ tests/float 2/float2int_intbig.py | 99 +++ tests/float 2/float_array.py | 20 + tests/float 2/float_compare.py | 22 + tests/float 2/float_divmod.py | 25 + tests/float 2/float_divmod_relaxed.py | 33 + tests/float 2/float_format.py | 19 + tests/float 2/float_parse.py | 32 + tests/float 2/float_parse_doubleprec.py | 21 + tests/float 2/float_struct.py | 17 + tests/float 2/int_big_float.py | 28 + tests/float 2/int_divzero.py | 9 + tests/float 2/int_power.py | 8 + tests/float 2/list_index.py | 8 + tests/float 2/math_domain.py | 51 ++ tests/float 2/math_domain_special.py | 36 + tests/float 2/math_fun.py | 63 ++ tests/float 2/math_fun_bool.py | 16 + tests/float 2/math_fun_int.py | 14 + tests/float 2/math_fun_intbig.py | 11 + tests/float 2/math_fun_special.py | 35 + tests/float 2/python36.py | 10 + tests/float 2/python36.py.exp | 5 + tests/float 2/string_format.py | 41 ++ tests/float 2/string_format2.py | 106 +++ tests/float 2/string_format_fp30.py | 41 ++ tests/float 2/string_format_modulo.py | 49 ++ tests/float 2/string_format_modulo2.py | 24 + tests/float 2/string_format_modulo2_intbig.py | 21 + tests/float 2/string_format_modulo3.py | 3 + tests/float 2/string_format_modulo3.py.exp | 2 + tests/float 2/true_value.py | 7 + tests/float 2/types.py | 17 + tests/inlineasm 2/asmargs.py | 29 + tests/inlineasm 2/asmargs.py.exp | 5 + tests/inlineasm 2/asmbcc.py | 27 + tests/inlineasm 2/asmbcc.py.exp | 4 + tests/inlineasm 2/asmbitops.py | 13 + tests/inlineasm 2/asmbitops.py.exp | 4 + tests/inlineasm 2/asmblbx.py | 21 + tests/inlineasm 2/asmblbx.py.exp | 2 + tests/inlineasm 2/asmconst.py | 8 + tests/inlineasm 2/asmconst.py.exp | 1 + tests/inlineasm 2/asmdiv.py | 16 + tests/inlineasm 2/asmdiv.py.exp | 7 + tests/inlineasm 2/asmfpaddsub.py | 14 + tests/inlineasm 2/asmfpaddsub.py.exp | 1 + tests/inlineasm 2/asmfpcmp.py | 14 + tests/inlineasm 2/asmfpcmp.py.exp | 3 + tests/inlineasm 2/asmfpldrstr.py | 11 + tests/inlineasm 2/asmfpldrstr.py.exp | 1 + tests/inlineasm 2/asmfpmuldiv.py | 14 + tests/inlineasm 2/asmfpmuldiv.py.exp | 1 + tests/inlineasm 2/asmfpsqrt.py | 14 + tests/inlineasm 2/asmfpsqrt.py.exp | 1 + tests/inlineasm 2/asmit.py | 16 + tests/inlineasm 2/asmit.py.exp | 2 + tests/inlineasm 2/asmpushpop.py | 8 + tests/inlineasm 2/asmpushpop.py.exp | 1 + tests/inlineasm 2/asmrettype.py | 21 + tests/inlineasm 2/asmrettype.py.exp | 4 + tests/inlineasm 2/asmshift.py | 29 + tests/inlineasm 2/asmshift.py.exp | 6 + tests/inlineasm 2/asmspecialregs.py | 10 + tests/inlineasm 2/asmspecialregs.py.exp | 2 + tests/inlineasm 2/asmsum.py | 57 ++ tests/inlineasm 2/asmsum.py.exp | 2 + tests/io/data/file1 2 | 3 + tests/jni 2/README | 11 + tests/jni 2/list.py | 15 + tests/jni 2/list.py.exp | 4 + tests/jni 2/object.py | 15 + tests/jni 2/object.py.exp | 3 + tests/jni 2/system_out.py | 8 + tests/jni 2/system_out.py.exp | 1 + tests/net_hosted 2/README | 11 + tests/net_hosted 2/accept_nonblock.py | 16 + tests/net_hosted 2/accept_nonblock.py.exp | 1 + tests/net_hosted 2/accept_timeout.py | 22 + tests/net_hosted 2/accept_timeout.py.exp | 1 + tests/net_hosted 2/connect_nonblock.py | 20 + tests/net_hosted 2/connect_nonblock.py.exp | 1 + tests/net_hosted 2/connect_poll.py | 32 + tests/net_hosted 2/connect_poll.py.exp | 3 + tests/net_hosted 2/ssl_getpeercert.py | 21 + tests/net_hosted 2/ssl_getpeercert.py.exp | 1 + tests/net_inet 2/README | 5 + tests/net_inet 2/test_tls_sites.py | 59 ++ tests/net_inet 2/test_tls_sites.py.exp | 5 + tests/run-bench-tests 2 | 97 +++ tests/run-tests 2 | 615 ++++++++++++++++++ tests/stress 2/dict_copy.py | 7 + tests/stress 2/dict_create.py | 8 + tests/stress 2/dict_create_max.py | 13 + tests/stress 2/gc_trace.py | 17 + tests/stress 2/list_sort.py | 6 + tests/stress 2/recursion.py | 7 + tests/stress 2/recursive_data.py | 13 + tests/stress 2/recursive_data.py.exp | 1 + tests/stress 2/recursive_gen.py | 18 + tests/stress 2/recursive_iternext.py | 57 ++ tests/stress 2/recursive_iternext.py.exp | 4 + tests/thread 2/mutate_bytearray.py | 46 ++ tests/thread 2/mutate_dict.py | 44 ++ tests/thread 2/mutate_instance.py | 45 ++ tests/thread 2/mutate_list.py | 46 ++ tests/thread 2/mutate_set.py | 39 ++ tests/thread 2/stress_aes.py | 257 ++++++++ tests/thread 2/stress_create.py | 22 + tests/thread 2/stress_heap.py | 48 ++ tests/thread 2/stress_recurse.py | 27 + tests/thread 2/thread_exc1.py | 32 + tests/thread 2/thread_exc2.py | 10 + tests/thread 2/thread_exc2.py.exp | 5 + tests/thread 2/thread_exit1.py | 21 + tests/thread 2/thread_exit2.py | 21 + tests/thread 2/thread_gc1.py | 36 + tests/thread 2/thread_ident1.py | 23 + tests/thread 2/thread_lock1.py | 48 ++ tests/thread 2/thread_lock2.py | 26 + tests/thread 2/thread_lock3.py | 29 + tests/thread 2/thread_lock4.py | 53 ++ tests/thread 2/thread_qstr1.py | 41 ++ tests/thread 2/thread_shared1.py | 33 + tests/thread 2/thread_shared2.py | 34 + tests/thread 2/thread_sleep1.py | 33 + tests/thread 2/thread_stacksize1.py | 49 ++ tests/thread 2/thread_start1.py | 25 + tests/thread 2/thread_start2.py | 28 + tests/unix 2/extra_coverage.py | 74 +++ tests/unix 2/extra_coverage.py.exp | 106 +++ tests/unix 2/ffi_callback.py | 33 + tests/unix 2/ffi_callback.py.exp | 2 + tests/unix 2/ffi_float.py | 32 + tests/unix 2/ffi_float.py.exp | 8 + tests/unix 2/ffi_float2.py | 31 + tests/unix 2/ffi_float2.py.exp | 6 + tools/.gitattributes 2 | 1 + tools/.gitignore 2 | 8 + 239 files changed, 6751 insertions(+), 16 deletions(-) create mode 100644 .gitattributes 2 create mode 100644 .gitignore 2 create mode 100644 .gitmodules 2 create mode 100644 .mailmap 2 create mode 100644 mpy-cross/.gitignore 2 create mode 100644 ports/atmel-samd/.gitattributes 2 create mode 100644 ports/atmel-samd/.gitignore 2 create mode 100644 ports/atmel-samd/boards/board.h create mode 100644 tests/README 2 create mode 100644 tests/extmod 2/btree1.py create mode 100644 tests/extmod 2/framebuf1.py create mode 100644 tests/extmod 2/framebuf16.py create mode 100644 tests/extmod 2/framebuf2.py.exp create mode 100644 tests/extmod 2/framebuf4.py create mode 100644 tests/extmod 2/framebuf_subclass.py create mode 100644 tests/extmod 2/machine1.py create mode 100644 tests/extmod 2/machine_pinbase.py create mode 100644 tests/extmod 2/machine_pinbase.py.exp create mode 100644 tests/extmod 2/ticks_diff.py create mode 100644 tests/extmod 2/time_ms_us.py create mode 100644 tests/extmod 2/time_ms_us.py.exp create mode 100644 tests/extmod 2/ubinascii_a2b_base64.py create mode 100644 tests/extmod 2/ubinascii_hexlify.py create mode 100644 tests/extmod 2/uctypes_32bit_intbig.py.exp create mode 100644 tests/extmod 2/uctypes_array_assign_native_le.py create mode 100644 tests/extmod 2/uctypes_array_assign_native_le.py.exp create mode 100644 tests/extmod 2/uctypes_array_assign_native_le_intbig.py create mode 100644 tests/extmod 2/uctypes_bytearray.py create mode 100644 tests/extmod 2/uctypes_byteat.py create mode 100644 tests/extmod 2/uctypes_byteat.py.exp create mode 100644 tests/extmod 2/uctypes_error.py create mode 100644 tests/extmod 2/uctypes_error.py.exp create mode 100644 tests/extmod 2/uctypes_le_float.py create mode 100644 tests/extmod 2/uctypes_native_float.py create mode 100644 tests/extmod 2/uctypes_ptr_le.py create mode 100644 tests/extmod 2/uctypes_ptr_native_le.py.exp create mode 100644 tests/extmod 2/uctypes_sizeof.py.exp create mode 100644 tests/extmod 2/uhashlib_sha1.py create mode 100644 tests/extmod 2/ujson_dump.py create mode 100644 tests/extmod 2/ujson_dumps_extra.py create mode 100644 tests/extmod 2/ujson_dumps_float.py create mode 100644 tests/extmod 2/ujson_load_readinto.py.exp create mode 100644 tests/extmod 2/ujson_loads.py create mode 100644 tests/extmod 2/ujson_loads_float.py create mode 100644 tests/extmod 2/urandom_basic.py create mode 100644 tests/extmod 2/ure1.py create mode 100644 tests/extmod 2/ure_debug.py.exp create mode 100644 tests/extmod 2/ure_error.py create mode 100644 tests/extmod 2/ure_namedclass.py create mode 100644 tests/extmod 2/ure_stack_overflow.py.exp create mode 100644 tests/extmod 2/ure_sub_unmatched.py.exp create mode 100644 tests/extmod 2/ussl_basic.py create mode 100644 tests/extmod 2/utimeq1.py create mode 100644 tests/extmod 2/utimeq_stable.py.exp create mode 100644 tests/extmod 2/uzlib_decompio.py create mode 100644 tests/extmod 2/uzlib_decompio_gz.py.exp create mode 100644 tests/extmod 2/vfs_fat_fileio1.py create mode 100644 tests/extmod 2/vfs_fat_fileio1.py.exp create mode 100644 tests/extmod 2/vfs_fat_more.py.exp create mode 100644 tests/extmod 2/vfs_fat_oldproto.py.exp create mode 100644 tests/extmod 2/vfs_fat_ramdisk.py.exp create mode 100644 tests/extmod 2/websocket_basic.py.exp create mode 100644 tests/feature_check 2/README create mode 100644 tests/feature_check 2/async_check.py create mode 100644 tests/feature_check 2/async_check.py.exp create mode 100644 tests/feature_check 2/byteorder.py create mode 100644 tests/feature_check 2/byteorder.py.exp create mode 100644 tests/feature_check 2/complex.py create mode 100644 tests/feature_check 2/complex.py.exp create mode 100644 tests/feature_check 2/const.py create mode 100644 tests/feature_check 2/const.py.exp create mode 100644 tests/feature_check 2/coverage.py create mode 100644 tests/feature_check 2/coverage.py.exp create mode 100644 tests/feature_check 2/float.py create mode 100644 tests/feature_check 2/float.py.exp create mode 100644 tests/feature_check 2/int_big.py create mode 100644 tests/feature_check 2/int_big.py.exp create mode 100644 tests/feature_check 2/native_check.py create mode 100644 tests/feature_check 2/native_check.py.exp create mode 100644 tests/feature_check 2/repl_emacs_check.py create mode 100644 tests/feature_check 2/repl_emacs_check.py.exp create mode 100644 tests/feature_check 2/reverse_ops.py create mode 100644 tests/feature_check 2/reverse_ops.py.exp create mode 100644 tests/feature_check 2/set_check.py create mode 100644 tests/feature_check 2/set_check.py.exp create mode 100644 tests/float 2/array_construct.py create mode 100644 tests/float 2/builtin_float_hash.py create mode 100644 tests/float 2/builtin_float_minmax.py create mode 100644 tests/float 2/builtin_float_pow.py create mode 100644 tests/float 2/builtin_float_round.py create mode 100644 tests/float 2/builtin_float_round_intbig.py create mode 100644 tests/float 2/bytearray_construct.py create mode 100644 tests/float 2/bytes_construct.py create mode 100644 tests/float 2/cmath_fun.py create mode 100644 tests/float 2/cmath_fun_special.py create mode 100644 tests/float 2/complex1.py create mode 100644 tests/float 2/complex1_intbig.py create mode 100644 tests/float 2/float1.py create mode 100644 tests/float 2/float2int_doubleprec_intbig.py create mode 100644 tests/float 2/float2int_fp30_intbig.py create mode 100644 tests/float 2/float2int_intbig.py create mode 100644 tests/float 2/float_array.py create mode 100644 tests/float 2/float_compare.py create mode 100644 tests/float 2/float_divmod.py create mode 100644 tests/float 2/float_divmod_relaxed.py create mode 100644 tests/float 2/float_format.py create mode 100644 tests/float 2/float_parse.py create mode 100644 tests/float 2/float_parse_doubleprec.py create mode 100644 tests/float 2/float_struct.py create mode 100644 tests/float 2/int_big_float.py create mode 100644 tests/float 2/int_divzero.py create mode 100644 tests/float 2/int_power.py create mode 100644 tests/float 2/list_index.py create mode 100644 tests/float 2/math_domain.py create mode 100644 tests/float 2/math_domain_special.py create mode 100644 tests/float 2/math_fun.py create mode 100644 tests/float 2/math_fun_bool.py create mode 100644 tests/float 2/math_fun_int.py create mode 100644 tests/float 2/math_fun_intbig.py create mode 100644 tests/float 2/math_fun_special.py create mode 100644 tests/float 2/python36.py create mode 100644 tests/float 2/python36.py.exp create mode 100644 tests/float 2/string_format.py create mode 100644 tests/float 2/string_format2.py create mode 100644 tests/float 2/string_format_fp30.py create mode 100644 tests/float 2/string_format_modulo.py create mode 100644 tests/float 2/string_format_modulo2.py create mode 100644 tests/float 2/string_format_modulo2_intbig.py create mode 100644 tests/float 2/string_format_modulo3.py create mode 100644 tests/float 2/string_format_modulo3.py.exp create mode 100644 tests/float 2/true_value.py create mode 100644 tests/float 2/types.py create mode 100644 tests/inlineasm 2/asmargs.py create mode 100644 tests/inlineasm 2/asmargs.py.exp create mode 100644 tests/inlineasm 2/asmbcc.py create mode 100644 tests/inlineasm 2/asmbcc.py.exp create mode 100644 tests/inlineasm 2/asmbitops.py create mode 100644 tests/inlineasm 2/asmbitops.py.exp create mode 100644 tests/inlineasm 2/asmblbx.py create mode 100644 tests/inlineasm 2/asmblbx.py.exp create mode 100644 tests/inlineasm 2/asmconst.py create mode 100644 tests/inlineasm 2/asmconst.py.exp create mode 100644 tests/inlineasm 2/asmdiv.py create mode 100644 tests/inlineasm 2/asmdiv.py.exp create mode 100644 tests/inlineasm 2/asmfpaddsub.py create mode 100644 tests/inlineasm 2/asmfpaddsub.py.exp create mode 100644 tests/inlineasm 2/asmfpcmp.py create mode 100644 tests/inlineasm 2/asmfpcmp.py.exp create mode 100644 tests/inlineasm 2/asmfpldrstr.py create mode 100644 tests/inlineasm 2/asmfpldrstr.py.exp create mode 100644 tests/inlineasm 2/asmfpmuldiv.py create mode 100644 tests/inlineasm 2/asmfpmuldiv.py.exp create mode 100644 tests/inlineasm 2/asmfpsqrt.py create mode 100644 tests/inlineasm 2/asmfpsqrt.py.exp create mode 100644 tests/inlineasm 2/asmit.py create mode 100644 tests/inlineasm 2/asmit.py.exp create mode 100644 tests/inlineasm 2/asmpushpop.py create mode 100644 tests/inlineasm 2/asmpushpop.py.exp create mode 100644 tests/inlineasm 2/asmrettype.py create mode 100644 tests/inlineasm 2/asmrettype.py.exp create mode 100644 tests/inlineasm 2/asmshift.py create mode 100644 tests/inlineasm 2/asmshift.py.exp create mode 100644 tests/inlineasm 2/asmspecialregs.py create mode 100644 tests/inlineasm 2/asmspecialregs.py.exp create mode 100644 tests/inlineasm 2/asmsum.py create mode 100644 tests/inlineasm 2/asmsum.py.exp create mode 100644 tests/io/data/file1 2 create mode 100644 tests/jni 2/README create mode 100644 tests/jni 2/list.py create mode 100644 tests/jni 2/list.py.exp create mode 100644 tests/jni 2/object.py create mode 100644 tests/jni 2/object.py.exp create mode 100644 tests/jni 2/system_out.py create mode 100644 tests/jni 2/system_out.py.exp create mode 100644 tests/net_hosted 2/README create mode 100644 tests/net_hosted 2/accept_nonblock.py create mode 100644 tests/net_hosted 2/accept_nonblock.py.exp create mode 100644 tests/net_hosted 2/accept_timeout.py create mode 100644 tests/net_hosted 2/accept_timeout.py.exp create mode 100644 tests/net_hosted 2/connect_nonblock.py create mode 100644 tests/net_hosted 2/connect_nonblock.py.exp create mode 100644 tests/net_hosted 2/connect_poll.py create mode 100644 tests/net_hosted 2/connect_poll.py.exp create mode 100644 tests/net_hosted 2/ssl_getpeercert.py create mode 100644 tests/net_hosted 2/ssl_getpeercert.py.exp create mode 100644 tests/net_inet 2/README create mode 100644 tests/net_inet 2/test_tls_sites.py create mode 100644 tests/net_inet 2/test_tls_sites.py.exp create mode 100755 tests/run-bench-tests 2 create mode 100755 tests/run-tests 2 create mode 100644 tests/stress 2/dict_copy.py create mode 100644 tests/stress 2/dict_create.py create mode 100644 tests/stress 2/dict_create_max.py create mode 100644 tests/stress 2/gc_trace.py create mode 100644 tests/stress 2/list_sort.py create mode 100644 tests/stress 2/recursion.py create mode 100644 tests/stress 2/recursive_data.py create mode 100644 tests/stress 2/recursive_data.py.exp create mode 100644 tests/stress 2/recursive_gen.py create mode 100644 tests/stress 2/recursive_iternext.py create mode 100644 tests/stress 2/recursive_iternext.py.exp create mode 100644 tests/thread 2/mutate_bytearray.py create mode 100644 tests/thread 2/mutate_dict.py create mode 100644 tests/thread 2/mutate_instance.py create mode 100644 tests/thread 2/mutate_list.py create mode 100644 tests/thread 2/mutate_set.py create mode 100644 tests/thread 2/stress_aes.py create mode 100644 tests/thread 2/stress_create.py create mode 100644 tests/thread 2/stress_heap.py create mode 100644 tests/thread 2/stress_recurse.py create mode 100644 tests/thread 2/thread_exc1.py create mode 100644 tests/thread 2/thread_exc2.py create mode 100644 tests/thread 2/thread_exc2.py.exp create mode 100644 tests/thread 2/thread_exit1.py create mode 100644 tests/thread 2/thread_exit2.py create mode 100644 tests/thread 2/thread_gc1.py create mode 100644 tests/thread 2/thread_ident1.py create mode 100644 tests/thread 2/thread_lock1.py create mode 100644 tests/thread 2/thread_lock2.py create mode 100644 tests/thread 2/thread_lock3.py create mode 100644 tests/thread 2/thread_lock4.py create mode 100644 tests/thread 2/thread_qstr1.py create mode 100644 tests/thread 2/thread_shared1.py create mode 100644 tests/thread 2/thread_shared2.py create mode 100644 tests/thread 2/thread_sleep1.py create mode 100644 tests/thread 2/thread_stacksize1.py create mode 100644 tests/thread 2/thread_start1.py create mode 100644 tests/thread 2/thread_start2.py create mode 100644 tests/unix 2/extra_coverage.py create mode 100644 tests/unix 2/extra_coverage.py.exp create mode 100644 tests/unix 2/ffi_callback.py create mode 100644 tests/unix 2/ffi_callback.py.exp create mode 100644 tests/unix 2/ffi_float.py create mode 100644 tests/unix 2/ffi_float.py.exp create mode 100644 tests/unix 2/ffi_float2.py create mode 100644 tests/unix 2/ffi_float2.py.exp create mode 100644 tools/.gitattributes 2 create mode 100644 tools/.gitignore 2 diff --git a/.gitattributes 2 b/.gitattributes 2 new file mode 100644 index 0000000000000..5ebde95f07643 --- /dev/null +++ b/.gitattributes 2 @@ -0,0 +1,32 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + +# Per default everything gets normalized and gets LF line endings on checkout. +* text eol=lf + +# These will always have CRLF line endings on checkout. +*.vcxproj text eol=crlf +*.props text eol=crlf +*.bat text eol=crlf + +# These are binary so should never be modified by git. +*.png binary +*.jpg binary +*.dxf binary +*.mpy binary +*.deb binary +*.zip binary +*.pdf binary + +# These should also not be modified by git. +tests/basics/string_cr_conversion.py -text +tests/basics/string_crlf_conversion.py -text +ports/stm32/pybcdc.inf_template -text +ports/stm32/usbhost/** -text +ports/cc3200/hal/aes.c -text +ports/cc3200/hal/aes.h -text +ports/cc3200/hal/des.c -text +ports/cc3200/hal/i2s.c -text +ports/cc3200/hal/i2s.h -text +ports/cc3200/version.h -text diff --git a/.gitignore 2 b/.gitignore 2 new file mode 100644 index 0000000000000..a8814be45eb2a --- /dev/null +++ b/.gitignore 2 @@ -0,0 +1,88 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + +# Compiled Sources +################### +*.o +*.a +!atmel-samd/asf/**/*.a +*.elf +*.bin +*.map +*.hex +*.dis +*.exe + +# Packages +############ +dist/ +*.egg-info +.eggs + +# Logs and Databases +###################### +*.log + +# VIM Swap Files +###################### +*.swp + +# Build directory +###################### +build/ +bin/ +circuitpython-stubs/ + +# Test failure outputs +###################### +tests/*.exp +tests/*.out + +# Python cache files +###################### +__pycache__/ +*.pyc + +# Customized Makefile/project overrides +###################### +GNUmakefile +user.props + +# Sphinx output +############### +_build + +# Generated rst files +###################### +genrst/ +/autoapi/ +/shared-bindings/*/**/*.rst + +# ctags and similar +################### +TAGS + +# Merge leftovers +################# +*.orig + +# Emacs backup files +#################### +*~ + +*.DS_Store +**/*.DS_Store +*.icloud + +# POEdit mo files +#################### +*.mo + +.vscode +.idea + +# Python Virtual Environments +#################### +.venv +.env diff --git a/.gitmodules 2 b/.gitmodules 2 new file mode 100644 index 0000000000000..aaa66caf71821 --- /dev/null +++ b/.gitmodules 2 @@ -0,0 +1,155 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + +[submodule "lib/axtls"] + path = lib/axtls + url = https://github.com/pfalcon/axtls + branch = micropython +[submodule "lib/libffi"] + path = lib/libffi + url = https://github.com/atgreen/libffi +[submodule "lib/berkeley-db-1.xx"] + path = lib/berkeley-db-1.xx + url = https://github.com/pfalcon/berkeley-db-1.xx +[submodule "lib/uzlib"] + path = lib/uzlib + url = https://github.com/pfalcon/uzlib +[submodule "tools/uf2"] + path = tools/uf2 + url = https://github.com/Microsoft/uf2.git +[submodule "atmel-samd/frozen/Adafruit_CircuitPython_NeoPixel"] + path = frozen/Adafruit_CircuitPython_NeoPixel + url = https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel +[submodule "frozen/Adafruit_CircuitPython_Thermistor"] + path = frozen/Adafruit_CircuitPython_Thermistor + url = https://github.com/adafruit/Adafruit_CircuitPython_Thermistor.git +[submodule "frozen/Adafruit_CircuitPython_LIS3DH"] + path = frozen/Adafruit_CircuitPython_LIS3DH + url = https://github.com/adafruit/Adafruit_CircuitPython_LIS3DH.git +[submodule "frozen/Adafruit_CircuitPython_BusDevice"] + path = frozen/Adafruit_CircuitPython_BusDevice + url = https://github.com/adafruit/Adafruit_CircuitPython_BusDevice.git +[submodule "tools/python-semver"] + path = tools/python-semver + url = https://github.com/k-bx/python-semver.git +[submodule "atmel-samd/asf4"] + path = ports/atmel-samd/asf4 + url = https://github.com/adafruit/asf4.git + branch = circuitpython +[submodule "tools/usb_descriptor"] + path = tools/usb_descriptor + url = https://github.com/adafruit/usb_descriptor.git +[submodule "lib/nrfutil"] + path = lib/nrfutil + url = https://github.com/adafruit/nRF52_nrfutil +[submodule "ports/atmel-samd/freetouch"] + path = ports/atmel-samd/freetouch + url = https://github.com/adafruit/Adafruit_FreeTouch.git +[submodule "frozen/Adafruit_CircuitPython_CircuitPlayground"] + path = frozen/Adafruit_CircuitPython_CircuitPlayground + url = https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground.git +[submodule "frozen/Adafruit_CircuitPython_HID"] + path = frozen/Adafruit_CircuitPython_HID + url = https://github.com/adafruit/Adafruit_CircuitPython_HID.git +[submodule "ports/atmel-samd/Adafruit_CircuitPython_Motor"] + path = frozen/Adafruit_CircuitPython_Motor + url = https://github.com/adafruit/Adafruit_CircuitPython_Motor.git +[submodule "ports/atmel-samd/Adafruit_CircuitPython_seesaw"] + path = frozen/Adafruit_CircuitPython_seesaw + url = https://github.com/adafruit/Adafruit_CircuitPython_seesaw.git +[submodule "frozen/Adafruit_CircuitPython_IRRemote"] + path = frozen/Adafruit_CircuitPython_IRRemote + url = https://github.com/adafruit/Adafruit_CircuitPython_IRRemote.git +[submodule "frozen/Adafruit_CircuitPython_DotStar"] + path = frozen/Adafruit_CircuitPython_DotStar + url = https://github.com/adafruit/Adafruit_CircuitPython_DotStar.git +[submodule "ports/atmel-samd/peripherals"] + path = ports/atmel-samd/peripherals + url = https://github.com/adafruit/samd-peripherals.git +[submodule "frozen/Adafruit_CircuitPython_Crickit"] + path = frozen/Adafruit_CircuitPython_Crickit + url = https://github.com/adafruit/Adafruit_CircuitPython_Crickit +[submodule "ports/nrf/nrfx"] + path = ports/nrf/nrfx + url = https://github.com/adafruit/nrfx.git +[submodule "lib/tinyusb"] + path = lib/tinyusb + url = https://github.com/hathach/tinyusb.git + branch = master + fetchRecurseSubmodules = false +[submodule "tools/huffman"] + path = tools/huffman + url = https://github.com/tannewt/huffman.git +[submodule "tools/adabot"] + path = tools/adabot + url = https://github.com/adafruit/adabot.git +[submodule "tools/bitmap_font"] + path = tools/bitmap_font + url = https://github.com/adafruit/Adafruit_CircuitPython_BitmapFont.git +[submodule "tools/Tecate-bitmap-fonts"] + path = tools/Tecate-bitmap-fonts + url = https://github.com/Tecate/bitmap-fonts.git +[submodule "frozen/pew-pewpew-standalone-10.x"] + path = frozen/pew-pewpew-standalone-10.x + url = https://github.com/pewpew-game/pew-pewpew-standalone-10.x.git +[submodule "frozen/circuitpython-stage"] + path = frozen/circuitpython-stage + url = https://github.com/python-ugame/circuitpython-stage.git +[submodule "ports/cxd56/spresense-exported-sdk"] + path = ports/cxd56/spresense-exported-sdk + url = https://github.com/sonydevworld/spresense-exported-sdk.git +[submodule "frozen/Adafruit_CircuitPython_SD"] + path = frozen/Adafruit_CircuitPython_SD + url = https://github.com/adafruit/Adafruit_CircuitPython_SD.git +[submodule "lib/mp3"] + path = lib/mp3 + url = https://github.com/adafruit/Adafruit_MP3 +[submodule "ports/mimxrt10xx/sdk"] + path = ports/mimxrt10xx/sdk + url = https://github.com/adafruit/MIMXRT10xx_SDK +[submodule "frozen/Adafruit_CircuitPython_Register"] + path = frozen/Adafruit_CircuitPython_Register + url = https://github.com/adafruit/Adafruit_CircuitPython_Register.git +[submodule "extmod/ulab"] + path = extmod/ulab + url = https://github.com/v923z/micropython-ulab +[submodule "frozen/Adafruit_CircuitPython_ESP32SPI"] + path = frozen/Adafruit_CircuitPython_ESP32SPI + url = https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI +[submodule "frozen/Adafruit_CircuitPython_Requests"] + path = frozen/Adafruit_CircuitPython_Requests + url = https://github.com/adafruit/Adafruit_CircuitPython_Requests +[submodule "ports/stm/st_driver"] + path = ports/stm/st_driver + url = https://github.com/hathach/st_driver.git +[submodule "lib/protomatter"] + path = lib/protomatter + url = https://github.com/adafruit/Adafruit_Protomatter +[submodule "frozen/Adafruit_CircuitPython_LSM6DS"] + path = frozen/Adafruit_CircuitPython_LSM6DS + url = https://github.com/adafruit/Adafruit_CircuitPython_LSM6DS +[submodule "frozen/Adafruit_CircuitPython_FocalTouch"] + path = frozen/Adafruit_CircuitPython_FocalTouch + url = https://github.com/adafruit/Adafruit_CircuitPython_FocalTouch +[submodule "frozen/Adafruit_CircuitPython_DS3231"] + path = frozen/Adafruit_CircuitPython_DS3231 + url = https://github.com/adafruit/Adafruit_CircuitPython_DS3231 +[submodule "frozen/Adafruit_CircuitPython_DRV2605"] + path = frozen/Adafruit_CircuitPython_DRV2605 + url = https://github.com/adafruit/Adafruit_CircuitPython_DRV2605 +[submodule "frozen/Adafruit_CircuitPython_BLE"] + path = frozen/Adafruit_CircuitPython_BLE + url = https://github.com/adafruit/Adafruit_CircuitPython_BLE +[submodule "frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center"] + path = frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center + url = https://github.com/adafruit/Adafruit_CircuitPython_BLE_Apple_Notification_Center +[submodule "frozen/Adafruit_CircuitPython_RFM9x"] + path = frozen/Adafruit_CircuitPython_RFM9x + url = https://github.com/adafruit/Adafruit_CircuitPython_RFM9x.git +[submodule "frozen/Adafruit_CircuitPython_RFM69"] + path = frozen/Adafruit_CircuitPython_RFM69 + url = https://github.com/adafruit/Adafruit_CircuitPython_RFM69.git +[submodule "ports/esp32s2/esp-idf"] + path = ports/esp32s2/esp-idf + url = https://github.com/jepler/esp-idf.git diff --git a/.mailmap 2 b/.mailmap 2 new file mode 100644 index 0000000000000..f9d7f47a161b5 --- /dev/null +++ b/.mailmap 2 @@ -0,0 +1,112 @@ +# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò +# +# SPDX-License-Identifier: Unlicense + +Alexander Steffen +Alexander Steffen +Alexander Steffen +Benjamin Vernoux +Brent Rubell +Brent Rubell +Brent Rubell +Carlos +Chris Packham +Chris Packham +Damiano Mazzella +Damien George +Dan Halbert +Dan Halbert +Daniel Pollard +Daniel Pollard +Daniel Tralamazza +Daniel Tralamazza +David Glaude +David Glaude +George Waters +George Waters +Ha Thach +Henrik Sölver +Ilya Dmitrichenko +Ilya Dmitrichenko +Jason Pecor <14111408+jpecor@users.noreply.github.com> +Jeff Epler +Jeff Epler +Jeff Epler +Jeff Epler +Jerry Needell +Joe Bakalor +Josh Klar +Josh Klar +Juan Biondi +Juan Biondi +KalbeAbbas +KalbeAbbas +Kamil Tomaszewski +Kamil Tomaszewski <46525824+kamtom480@users.noreply.github.com> +Kattni +Kattni Rembor +Kenny +Kenny <3454741+WarriorOfWire@users.noreply.github.com> +Kevin Townsend +Kevin Townsend +Krzysztof Blazewicz +Krzysztof Blazewicz +Li Weiwei +Li Weiwei +Limor "Ladyada" Fried +Limor "Ladyada" Fried +Lucian Copeland +Lucian Copeland +Mark Olsson +Mark Olsson +Matt Land +Matt Land +Matt Wozniski +Matt Wozniski +Melissa LeBlanc-Williams +Melissa LeBlanc-Williams +Metallicow +Metallicow +Peter Hinch +Peter Hinch +Radomir Dopieralski +Radomir Dopieralski +Rafa Gould +Rafa Gould <50337143+rafa-gould@users.noreply.github.com> +Ryan Shaw +Ryan Shaw +Sabas +Sabas +Sabas +Scott Shawcroft +Scott Shawcroft +Scott Shawcroft +Scott Shawcroft +Scott Shawcroft +Sebastian Plamauer +Sebastian Plamauer +Senuros +Senuros +Stewart Colborne +Stewart Colborne +TG-Techie +TG-Techie <39284876+TG-Techie@users.noreply.github.com> +Thea Flowers +Thea Flowers +Tobias Badertscher +Tobias Badertscher +danicampora +danicampora +dherrada +dherrada <33632497+dherrada@users.noreply.github.com> +dherrada <=> +glennrub +retoc +retoc +siddacious +siddacious +siddacious +sommersoft +sommersoft +stijn +stijn diff --git a/mpy-cross/.gitignore 2 b/mpy-cross/.gitignore 2 new file mode 100644 index 0000000000000..6daeea5040074 --- /dev/null +++ b/mpy-cross/.gitignore 2 @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + +/build-* +/mpy-cross +/mpy-cross.static +/mpy-cross.static.exe +/mpy-cross.static-raspbian +/mpy-cross.fuzz +/pitools diff --git a/ports/atmel-samd/.gitattributes 2 b/ports/atmel-samd/.gitattributes 2 new file mode 100644 index 0000000000000..09bba615b1cf4 --- /dev/null +++ b/ports/atmel-samd/.gitattributes 2 @@ -0,0 +1,2 @@ +tools/bossac* binary +asf/**/*.a binary diff --git a/ports/atmel-samd/.gitignore 2 b/ports/atmel-samd/.gitignore 2 new file mode 100644 index 0000000000000..414487d53eb83 --- /dev/null +++ b/ports/atmel-samd/.gitignore 2 @@ -0,0 +1 @@ +build-*/ diff --git a/ports/atmel-samd/boards/board.h b/ports/atmel-samd/boards/board.h new file mode 100644 index 0000000000000..4f0ae9d728e72 --- /dev/null +++ b/ports/atmel-samd/boards/board.h @@ -0,0 +1,47 @@ +/* + * 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. + */ + +// This file defines board specific functions. + +#ifndef MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H +#define MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H + +#include + +#include "py/mpconfig.h" + +// Initializes board related state once on start up. +void board_init(void); + +// Returns true if the user initiates safe mode in a board specific way. +// Also add BOARD_USER_SAFE_MODE in mpconfigboard.h to explain the board specific +// way. +bool board_requests_safe_mode(void); + +// Reset the state of off MCU components such as neopixels. +void reset_board(void); + +#endif // MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H diff --git a/supervisor/shared/external_flash/devices.h b/supervisor/shared/external_flash/devices.h index fafb68ef0376e..d632dd96e7ed7 100644 --- a/supervisor/shared/external_flash/devices.h +++ b/supervisor/shared/external_flash/devices.h @@ -589,22 +589,40 @@ typedef struct { // Settings for the Macronix MX25L51245G 64MiB SPI flash. // Datasheet: https://www.macronix.com/Lists/Datasheet/Attachments/7437/MX25L51245G,%203V,%20512Mb,%20v1.6.pdf -// Will finish this addition in a future PR. All the stuff is there, just need to test in the wild. -//#define MX25L25645G {\ -// .total_size = (1 << 25), /* 32 MiB */ \ -// .start_up_time_us = 5000, \ -// .manufacturer_id = 0x9f, \ -// .memory_type = 0xab, \ -// .capacity = 0x90, \ -// .max_clock_speed_mhz = 133, \ -// .quad_enable_bit_mask = 0xaf, \ -// .has_sector_protection = false, \ -// .supports_fast_read = true, \ -// .supports_qspi = true, \ -// .supports_qspi_writes = true, \ -// .write_status_register_split = false, \ -// .single_status_byte = true, \ -//} +#define MX25L25645G {\ + .total_size = (1 << 25), /* 32 MiB */ \ + .start_up_time_us = 5000, \ + .manufacturer_id = 0x9f, \ + .memory_type = 0xab, \ + .capacity = 0x90, \ + .max_clock_speed_mhz = 133, \ + .quad_enable_bit_mask = 0xaf, \ + .has_sector_protection = false, \ + .supports_fast_read = true, \ + .supports_qspi = true, \ + .supports_qspi_writes = true, \ + .write_status_register_split = false, \ + .single_status_byte = true, \ +} + +// Settings for the Macronix MX25L12833F 16MiB SPI flash +// Datasheet: https://www.macronix.com/Lists/Datasheet/Attachments/7447/MX25L12833F,%203V,%20128Mb,%20v1.0.pdf + +#define MX25L12833F {\ + .total_size = (1UL << 24), /* 16 MiB */ \ + .start_up_time_us = 5000, \ + .manufacturer_id = 0xc2, \ + .memory_type = 0x20, \ + .capacity = 0x18, \ + .max_clock_speed_mhz = 133, \ + .quad_enable_bit_mask = 0x40, \ + .has_sector_protection = true, \ + .supports_fast_read = true, \ + .supports_qspi = true, \ + .supports_qspi_writes = true, \ + .write_status_register_split = false, \ + .single_status_byte = true, \ + } // Settings for the Winbond W25Q128JV-PM 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 diff --git a/tests/README 2 b/tests/README 2 new file mode 100644 index 0000000000000..3458f36a80201 --- /dev/null +++ b/tests/README 2 @@ -0,0 +1,18 @@ +This directory contains tests for various functionality areas of MicroPython. +To run all stable tests, run "run-tests" script in this directory. + +Tests of capabilities not supported on all platforms should be written +to check for the capability being present. If it is not, the test +should merely output 'SKIP' followed by the line terminator, and call +sys.exit() to raise SystemExit, instead of attempting to test the +missing capability. The testing framework (run-tests in this +directory, test_main.c in qemu_arm) recognizes this as a skipped test. + +There are a few features for which this mechanism cannot be used to +condition a test. The run-tests script uses small scripts in the +feature_check directory to check whether each such feature is present, +and skips the relevant tests if not. + +When creating new tests, anything that relies on float support should go in the +float/ subdirectory. Anything that relies on import x, where x is not a built-in +module, should go in the import/ subdirectory. diff --git a/tests/extmod 2/btree1.py b/tests/extmod 2/btree1.py new file mode 100644 index 0000000000000..59638ef0a467b --- /dev/null +++ b/tests/extmod 2/btree1.py @@ -0,0 +1,89 @@ +try: + import btree + import uio + import uerrno +except ImportError: + print("SKIP") + raise SystemExit + +#f = open("_test.db", "w+b") +f = uio.BytesIO() +db = btree.open(f, pagesize=512) + +db[b"foo3"] = b"bar3" +db[b"foo1"] = b"bar1" +db[b"foo2"] = b"bar2" +db[b"bar1"] = b"foo1" + +dbstr = str(db) +print(dbstr[:7], dbstr[-1:]) + +print(db[b"foo2"]) +try: + print(db[b"foo"]) +except KeyError: + print("KeyError") +print(db.get(b"foo")) +print(db.get(b"foo", b"dflt")) + +del db[b"foo2"] +try: + del db[b"foo"] +except KeyError: + print("KeyError") + +for k, v in db.items(): + print((k, v)) + +print("---") +for k, v in db.items(None, None): + print((k, v)) + +print("---") +for k, v in db.items(b"f"): + print((k, v)) + +print("---") +for k, v in db.items(b"f", b"foo3"): + print((k, v)) + +print("---") +for k, v in db.items(None, b"foo3"): + print((k, v)) + +print("---") +for k, v in db.items(b"f", b"foo3", btree.INCL): + print((k, v)) + +print("---") +for k, v in db.items(None, None, btree.DESC): + print((k, v)) + +print(db.seq(1, b"foo1")) +print(db.seq(1, b"qux")) + +try: + db.seq(b"foo1") +except OSError as e: + print(e.args[0] == uerrno.EINVAL) + +print(list(db.keys())) +print(list(db.values())) + +for k in db: + print(k) + +db.put(b"baz1", b"qux1") + +print("foo1", "foo1" in db) +print("foo2", "foo2" in db) +print("baz1", "baz1" in db) + +try: + print(db + db[b"foo1"]) +except TypeError: + print("TypeError") + +db.flush() +db.close() +f.close() diff --git a/tests/extmod 2/framebuf1.py b/tests/extmod 2/framebuf1.py new file mode 100644 index 0000000000000..2c13665228a6a --- /dev/null +++ b/tests/extmod 2/framebuf1.py @@ -0,0 +1,109 @@ +try: + import framebuf +except ImportError: + print("SKIP") + raise SystemExit + +w = 5 +h = 16 +size = w * h // 8 +buf = bytearray(size) +maps = {framebuf.MONO_VLSB : 'MONO_VLSB', + framebuf.MONO_HLSB : 'MONO_HLSB', + framebuf.MONO_HMSB : 'MONO_HMSB'} + +for mapping in maps.keys(): + for x in range(size): + buf[x] = 0 + fbuf = framebuf.FrameBuffer(buf, w, h, mapping) + print(maps[mapping]) + # access as buffer + print(memoryview(fbuf)[0]) + + # fill + fbuf.fill(1) + print(buf) + fbuf.fill(0) + print(buf) + + # put pixel + fbuf.pixel(0, 0, 1) + fbuf.pixel(4, 0, 1) + fbuf.pixel(0, 15, 1) + fbuf.pixel(4, 15, 1) + print(buf) + + # clear pixel + fbuf.pixel(4, 15, 0) + print(buf) + + # get pixel + print(fbuf.pixel(0, 0), fbuf.pixel(1, 1)) + + # hline + fbuf.fill(0) + fbuf.hline(0, 1, w, 1) + print('hline', buf) + + # vline + fbuf.fill(0) + fbuf.vline(1, 0, h, 1) + print('vline', buf) + + # rect + fbuf.fill(0) + fbuf.rect(1, 1, 3, 3, 1) + print('rect', buf) + + #fill rect + fbuf.fill(0) + fbuf.fill_rect(0, 0, 0, 3, 1) # zero width, no-operation + fbuf.fill_rect(1, 1, 3, 3, 1) + print('fill_rect', buf) + + # line + fbuf.fill(0) + fbuf.line(1, 1, 3, 3, 1) + print('line', buf) + + # line steep negative gradient + fbuf.fill(0) + fbuf.line(3, 3, 2, 1, 1) + print('line', buf) + + # scroll + fbuf.fill(0) + fbuf.pixel(2, 7, 1) + fbuf.scroll(0, 1) + print(buf) + fbuf.scroll(0, -2) + print(buf) + fbuf.scroll(1, 0) + print(buf) + fbuf.scroll(-1, 0) + print(buf) + fbuf.scroll(2, 2) + print(buf) + + # print text + fbuf.fill(0) + fbuf.text("hello", 0, 0, 1) + print(buf) + fbuf.text("hello", 0, 0, 0) # clear + print(buf) + + # char out of font range set to chr(127) + fbuf.text(str(chr(31)), 0, 0) + print(buf) + print() + +# test invalid constructor, and stride argument +try: + fbuf = framebuf.FrameBuffer(buf, w, h, -1, w) +except ValueError: + print("ValueError") + +# test legacy constructor +fbuf = framebuf.FrameBuffer1(buf, w, h) +fbuf = framebuf.FrameBuffer1(buf, w, h, w) +print(framebuf.MVLSB == framebuf.MONO_VLSB) diff --git a/tests/extmod 2/framebuf16.py b/tests/extmod 2/framebuf16.py new file mode 100644 index 0000000000000..fe81f7f93f8c0 --- /dev/null +++ b/tests/extmod 2/framebuf16.py @@ -0,0 +1,59 @@ +try: + import framebuf +except ImportError: + print("SKIP") + raise SystemExit + +def printbuf(): + print("--8<--") + for y in range(h): + print(buf[y * w * 2:(y + 1) * w * 2]) + print("-->8--") + +w = 4 +h = 5 +buf = bytearray(w * h * 2) +fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.RGB565) + +# fill +fbuf.fill(0xffff) +printbuf() +fbuf.fill(0x0000) +printbuf() + +# put pixel +fbuf.pixel(0, 0, 0xeeee) +fbuf.pixel(3, 0, 0xee00) +fbuf.pixel(0, 4, 0x00ee) +fbuf.pixel(3, 4, 0x0ee0) +printbuf() + +# get pixel +print(fbuf.pixel(0, 4), fbuf.pixel(1, 1)) + +# scroll +fbuf.fill(0x0000) +fbuf.pixel(2, 2, 0xffff) +printbuf() +fbuf.scroll(0, 1) +printbuf() +fbuf.scroll(1, 0) +printbuf() +fbuf.scroll(-1, -2) +printbuf() + +w2 = 2 +h2 = 3 +buf2 = bytearray(w2 * h2 * 2) +fbuf2 = framebuf.FrameBuffer(buf2, w2, h2, framebuf.RGB565) + +fbuf2.fill(0x0000) +fbuf2.pixel(0, 0, 0x0ee0) +fbuf2.pixel(0, 2, 0xee00) +fbuf2.pixel(1, 0, 0x00ee) +fbuf2.pixel(1, 2, 0xe00e) +fbuf.fill(0xffff) +fbuf.blit(fbuf2, 3, 3, 0x0000) +fbuf.blit(fbuf2, -1, -1, 0x0000) +fbuf.blit(fbuf2, 16, 16, 0x0000) +printbuf() diff --git a/tests/extmod 2/framebuf2.py.exp b/tests/extmod 2/framebuf2.py.exp new file mode 100644 index 0000000000000..c53e518a6e92d --- /dev/null +++ b/tests/extmod 2/framebuf2.py.exp @@ -0,0 +1,57 @@ +--8<-- +33333333 +33333333 +33333333 +33333333 +33333333 +-->8-- +--8<-- +00000000 +00000000 +00000000 +00000000 +00000000 +-->8-- +--8<-- +10020000 +00000000 +00000000 +00000000 +30020000 +-->8-- +3 0 +--8<-- +00000000 +00000000 +00300000 +00000000 +00000000 +-->8-- +--8<-- +00000000 +00000000 +00000000 +00300000 +00000000 +-->8-- +--8<-- +00000000 +00000000 +00000000 +00030000 +00000000 +-->8-- +--8<-- +00000000 +00300000 +00000000 +00030000 +00000000 +-->8-- +--8<-- +33333333 +23333333 +33333333 +33311333 +33333333 +-->8-- diff --git a/tests/extmod 2/framebuf4.py b/tests/extmod 2/framebuf4.py new file mode 100644 index 0000000000000..8358fa55b9f2b --- /dev/null +++ b/tests/extmod 2/framebuf4.py @@ -0,0 +1,53 @@ +try: + import framebuf +except ImportError: + print("SKIP") + raise SystemExit + +def printbuf(): + print("--8<--") + for y in range(h): + print(buf[y * w // 2:(y + 1) * w // 2]) + print("-->8--") + +w = 16 +h = 8 +buf = bytearray(w * h // 2) +fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.GS4_HMSB) + +# fill +fbuf.fill(0x0f) +printbuf() +fbuf.fill(0xa0) +printbuf() + +# put pixel +fbuf.pixel(0, 0, 0x01) +printbuf() +fbuf.pixel(w-1, 0, 0x02) +printbuf() +fbuf.pixel(w-1, h-1, 0x03) +printbuf() +fbuf.pixel(0, h-1, 0x04) +printbuf() + +# get pixel +print(fbuf.pixel(0, 0), fbuf.pixel(w-1, 0), fbuf.pixel(w-1, h-1), fbuf.pixel(0, h-1)) +print(fbuf.pixel(1, 0), fbuf.pixel(w-2, 0), fbuf.pixel(w-2, h-1), fbuf.pixel(1, h-1)) + +# fill rect +fbuf.fill_rect(0, 0, w, h, 0x0f) +printbuf() +fbuf.fill_rect(0, 0, w, h, 0xf0) +fbuf.fill_rect(1, 0, w//2+1, 1, 0xf1) +printbuf() +fbuf.fill_rect(1, 0, w//2+1, 1, 0x10) +fbuf.fill_rect(1, 0, w//2, 1, 0xf1) +printbuf() +fbuf.fill_rect(1, 0, w//2, 1, 0x10) +fbuf.fill_rect(0, h-4, w//2+1, 4, 0xaf) +printbuf() +fbuf.fill_rect(0, h-4, w//2+1, 4, 0xb0) +fbuf.fill_rect(0, h-4, w//2, 4, 0xaf) +printbuf() +fbuf.fill_rect(0, h-4, w//2, 4, 0xb0) diff --git a/tests/extmod 2/framebuf_subclass.py b/tests/extmod 2/framebuf_subclass.py new file mode 100644 index 0000000000000..6363c224fbb52 --- /dev/null +++ b/tests/extmod 2/framebuf_subclass.py @@ -0,0 +1,20 @@ +# test subclassing framebuf.FrameBuffer + +try: + import framebuf +except ImportError: + print('SKIP') + raise SystemExit + +class FB(framebuf.FrameBuffer): + def __init__(self, n): + self.n = n + super().__init__(bytearray(2 * n * n), n, n, framebuf.RGB565) + + def foo(self): + self.hline(0, 2, self.n, 0x0304) + +fb = FB(n=3) +fb.pixel(0, 0, 0x0102) +fb.foo() +print(bytes(fb)) diff --git a/tests/extmod 2/machine1.py b/tests/extmod 2/machine1.py new file mode 100644 index 0000000000000..6ff38cc05179d --- /dev/null +++ b/tests/extmod 2/machine1.py @@ -0,0 +1,28 @@ +# test machine module + +try: + try: + import umachine as machine + except ImportError: + import machine + machine.mem8 +except: + print("SKIP") + raise SystemExit + +print(machine.mem8) + +try: + machine.mem16[1] +except ValueError: + print("ValueError") + +try: + machine.mem16[1] = 1 +except ValueError: + print("ValueError") + +try: + del machine.mem8[0] +except TypeError: + print("TypeError") diff --git a/tests/extmod 2/machine_pinbase.py b/tests/extmod 2/machine_pinbase.py new file mode 100644 index 0000000000000..e91775504d59a --- /dev/null +++ b/tests/extmod 2/machine_pinbase.py @@ -0,0 +1,30 @@ +try: + import umachine as machine +except ImportError: + import machine +try: + machine.PinBase +except AttributeError: + print("SKIP") + raise SystemExit + + +class MyPin(machine.PinBase): + + def __init__(self): + print("__init__") + self.v = False + + def value(self, v=None): + print("value:", v) + if v is None: + self.v = not self.v + return int(self.v) + +p = MyPin() + +print(p.value()) +print(p.value()) +print(p.value()) +p.value(1) +p.value(0) diff --git a/tests/extmod 2/machine_pinbase.py.exp b/tests/extmod 2/machine_pinbase.py.exp new file mode 100644 index 0000000000000..b31cd983088b4 --- /dev/null +++ b/tests/extmod 2/machine_pinbase.py.exp @@ -0,0 +1,9 @@ +__init__ +value: None +1 +value: None +0 +value: None +1 +value: 1 +value: 0 diff --git a/tests/extmod 2/ticks_diff.py b/tests/extmod 2/ticks_diff.py new file mode 100644 index 0000000000000..4d8df83cf91d1 --- /dev/null +++ b/tests/extmod 2/ticks_diff.py @@ -0,0 +1,33 @@ +from utime import ticks_diff, ticks_add + +MAX = ticks_add(0, -1) +# Should be done like this to avoid small int overflow +MODULO_HALF = MAX // 2 + 1 + +# Invariants: +# if ticks_diff(a, b) = c, +# then ticks_diff(b, a) = -c + +assert ticks_diff(1, 0) == 1, ticks_diff(1, 0) +assert ticks_diff(0, 1) == -1 + +assert ticks_diff(0, MAX) == 1 +assert ticks_diff(MAX, 0) == -1 + +assert ticks_diff(0, MAX - 1) == 2 + +# Maximum "positive" distance +assert ticks_diff(MODULO_HALF, 1) == MODULO_HALF - 1, ticks_diff(MODULO_HALF, 1) +# Step further, and it becomes a negative distance +assert ticks_diff(MODULO_HALF, 0) == -MODULO_HALF + +# Offsetting that in either direction doesn't affect the result +off = 100 +# Cheating and skipping to use ticks_add() when we know there's no wraparound +# Real apps should use always it. +assert ticks_diff(MODULO_HALF + off, 1 + off) == MODULO_HALF - 1 +assert ticks_diff(MODULO_HALF + off, 0 + off) == -MODULO_HALF +assert ticks_diff(MODULO_HALF - off, ticks_add(1, -off)) == MODULO_HALF - 1 +assert ticks_diff(MODULO_HALF - off, ticks_add(0, -off)) == -MODULO_HALF + +print("OK") diff --git a/tests/extmod 2/time_ms_us.py b/tests/extmod 2/time_ms_us.py new file mode 100644 index 0000000000000..135cf1e0967d6 --- /dev/null +++ b/tests/extmod 2/time_ms_us.py @@ -0,0 +1,22 @@ +import utime +try: + utime.sleep_ms +except AttributeError: + print("SKIP") + raise SystemExit + +utime.sleep_ms(1) +utime.sleep_us(1) + +t0 = utime.ticks_ms() +t1 = utime.ticks_ms() +print(0 <= utime.ticks_diff(t1, t0) <= 1) + +t0 = utime.ticks_us() +t1 = utime.ticks_us() +print(0 <= utime.ticks_diff(t1, t0) <= 500) + +# ticks_cpu may not be implemented, at least make sure it doesn't decrease +t0 = utime.ticks_cpu() +t1 = utime.ticks_cpu() +print(utime.ticks_diff(t1, t0) >= 0) diff --git a/tests/extmod 2/time_ms_us.py.exp b/tests/extmod 2/time_ms_us.py.exp new file mode 100644 index 0000000000000..b8ca7e7ef092a --- /dev/null +++ b/tests/extmod 2/time_ms_us.py.exp @@ -0,0 +1,3 @@ +True +True +True diff --git a/tests/extmod 2/ubinascii_a2b_base64.py b/tests/extmod 2/ubinascii_a2b_base64.py new file mode 100644 index 0000000000000..5e642ec515a8f --- /dev/null +++ b/tests/extmod 2/ubinascii_a2b_base64.py @@ -0,0 +1,49 @@ +try: + try: + import ubinascii as binascii + except ImportError: + import binascii +except ImportError: + print("SKIP") + raise SystemExit + +print(binascii.a2b_base64(b'')) +print(binascii.a2b_base64(b'Zg==')) +print(binascii.a2b_base64(b'Zm8=')) +print(binascii.a2b_base64(b'Zm9v')) +print(binascii.a2b_base64(b'Zm9vYg==')) +print(binascii.a2b_base64(b'Zm9vYmE=')) +print(binascii.a2b_base64(b'Zm9vYmFy')) + +print(binascii.a2b_base64(b'AAECAwQFBgc=')) +print(binascii.a2b_base64(b'CAkKCwwNDg8=')) +print(binascii.a2b_base64(b'f4D/')) +print(binascii.a2b_base64(b'f4D+')) # convert '+' +print(binascii.a2b_base64(b'MTIzNEFCQ0RhYmNk')) + +# Ignore invalid characters and pad sequences +print(binascii.a2b_base64(b'Zm9v\n')) +print(binascii.a2b_base64(b'Zm\x009v\n')) +print(binascii.a2b_base64(b'Zm9v==')) +print(binascii.a2b_base64(b'Zm9v===')) +print(binascii.a2b_base64(b'Zm9v===YmFy')) + +# Unicode strings can be decoded +print(binascii.a2b_base64(u'Zm9v===YmFy')) + +try: + print(binascii.a2b_base64(b'abc')) +except ValueError: + print("ValueError") +try: + print(binascii.a2b_base64(b'abcde=')) +except ValueError: + print("ValueError") +try: + print(binascii.a2b_base64(b'ab*d')) +except ValueError: + print("ValueError") +try: + print(binascii.a2b_base64(b'ab=cdef=')) +except ValueError: + print("ValueError") diff --git a/tests/extmod 2/ubinascii_hexlify.py b/tests/extmod 2/ubinascii_hexlify.py new file mode 100644 index 0000000000000..dabc3c7e4ca8a --- /dev/null +++ b/tests/extmod 2/ubinascii_hexlify.py @@ -0,0 +1,17 @@ +try: + try: + import ubinascii as binascii + except ImportError: + import binascii +except ImportError: + print("SKIP") + raise SystemExit + +print(binascii.hexlify(b'\x00\x01\x02\x03\x04\x05\x06\x07')) +print(binascii.hexlify(b'\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f')) +print(binascii.hexlify(b'\x7f\x80\xff')) +print(binascii.hexlify(b'1234ABCDabcd')) +try: + binascii.hexlify('') +except TypeError: + print("TypeError") diff --git a/tests/extmod 2/uctypes_32bit_intbig.py.exp b/tests/extmod 2/uctypes_32bit_intbig.py.exp new file mode 100644 index 0000000000000..d1fc1fe350453 --- /dev/null +++ b/tests/extmod 2/uctypes_32bit_intbig.py.exp @@ -0,0 +1,11 @@ +b'\xff\xff\xff\x7f5678abcd' +b'\x00\x00\x00\x805678abcd' +b'\x03\x02\x01\xff5678abcd' +b'\x03\x02\x01\xff\x00\x00\x00\x80\x00\x00\x00\x00' +b'\x03\x02\x01\xff\x00\x00\x00\x00\x01\x00\x00\x00' += +b'\x7f\xff\xff\xff5678abcd' +b'\x80\x00\x00\x005678abcd' +b'\xff\x01\x02\x035678abcd' +b'\xff\x01\x02\x03\x00\x00\x00\x00\x80\x00\x00\x00' +b'\xff\x01\x02\x03\x00\x00\x00\x01\x00\x00\x00\x00' diff --git a/tests/extmod 2/uctypes_array_assign_native_le.py b/tests/extmod 2/uctypes_array_assign_native_le.py new file mode 100644 index 0000000000000..a538bf9add72d --- /dev/null +++ b/tests/extmod 2/uctypes_array_assign_native_le.py @@ -0,0 +1,89 @@ +import sys +try: + import uctypes +except ImportError: + print("SKIP") + raise SystemExit + +if sys.byteorder != "little": + print("SKIP") + raise SystemExit + +desc = { + # arr is array at offset 0, of UINT8 elements, array size is 2 + "arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2), + # arr2 is array at offset 0, size 2, of structures defined recursively + "arr2": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0}), + "arr3": (uctypes.ARRAY | 2, uctypes.UINT16 | 2), + + # aligned + "arr5": (uctypes.ARRAY | 0, uctypes.UINT32 | 1), + "arr7": (uctypes.ARRAY | 0, 1, {"l": uctypes.UINT32 | 0}), + + "arr8": (uctypes.ARRAY | 0, uctypes.INT8 | 1), + "arr9": (uctypes.ARRAY | 0, uctypes.INT16 | 1), + "arr10": (uctypes.ARRAY | 0, uctypes.INT32 | 1), + "arr11": (uctypes.ARRAY | 0, uctypes.INT64 | 1), + "arr12": (uctypes.ARRAY | 0, uctypes.UINT64| 1), + "arr13": (uctypes.ARRAY | 1, 1, {"l": {}}), +} + +data = bytearray(8) + +S = uctypes.struct(uctypes.addressof(data), desc) + +# assign byte +S.arr[0] = 0x11 +print(hex(S.arr[0])) +assert hex(S.arr[0]) == "0x11" + +# assign word +S.arr3[0] = 0x2233 +print(hex(S.arr3[0])) +assert hex(S.arr3[0]) == "0x2233" + +# assign word, with index +S.arr3[1] = 0x4455 +print(hex(S.arr3[1])) +assert hex(S.arr3[1]) == "0x4455" + +# assign long, aligned +S.arr5[0] = 0x66778899 +print(hex(S.arr5[0])) +assert hex(S.arr5[0]) == "0x66778899" + +print(S.arr5[0] == S.arr7[0].l) +assert S.arr5[0] == S.arr7[0].l + +# assign int8 +S.arr8[0] = 0x11 +print(hex(S.arr8[0])) +assert hex(S.arr8[0]) == "0x11" + +# assign int16 +S.arr9[0] = 0x1122 +print(hex(S.arr9[0])) +assert hex(S.arr9[0]) == "0x1122" + +# assign int32 +S.arr10[0] = 0x11223344 +print(hex(S.arr10[0])) +assert hex(S.arr10[0]) == "0x11223344" + +# index out of range +try: + print(S.arr8[2]) +except IndexError: + print("IndexError") + +# syntax error in descriptor +try: + S.arr13[0].l = 0x11 +except TypeError: + print("TypeError") + +# operation not supported +try: + S.arr13[0] = 0x11 +except TypeError: + print("TypeError") diff --git a/tests/extmod 2/uctypes_array_assign_native_le.py.exp b/tests/extmod 2/uctypes_array_assign_native_le.py.exp new file mode 100644 index 0000000000000..9d67b1c777713 --- /dev/null +++ b/tests/extmod 2/uctypes_array_assign_native_le.py.exp @@ -0,0 +1,11 @@ +0x11 +0x2233 +0x4455 +0x66778899 +True +0x11 +0x1122 +0x11223344 +IndexError +TypeError +TypeError diff --git a/tests/extmod 2/uctypes_array_assign_native_le_intbig.py b/tests/extmod 2/uctypes_array_assign_native_le_intbig.py new file mode 100644 index 0000000000000..84dfba0e29134 --- /dev/null +++ b/tests/extmod 2/uctypes_array_assign_native_le_intbig.py @@ -0,0 +1,43 @@ +import sys +try: + import uctypes +except ImportError: + print("SKIP") + raise SystemExit + +if sys.byteorder != "little": + print("SKIP") + raise SystemExit + +desc = { + # arr is array at offset 0, of UINT8 elements, array size is 2 + "arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2), + # arr2 is array at offset 0, size 2, of structures defined recursively + "arr2": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0}), + "arr3": (uctypes.ARRAY | 2, uctypes.UINT16 | 2), + + # aligned + "arr5": (uctypes.ARRAY | 0, uctypes.UINT32 | 1), + "arr7": (uctypes.ARRAY | 0, 1, {"l": uctypes.UINT32 | 0}), + + "arr8": (uctypes.ARRAY | 0, uctypes.INT8 | 1), + "arr9": (uctypes.ARRAY | 0, uctypes.INT16 | 1), + "arr10": (uctypes.ARRAY | 0, uctypes.INT32 | 1), + "arr11": (uctypes.ARRAY | 0, uctypes.INT64 | 1), + "arr12": (uctypes.ARRAY | 0, uctypes.UINT64| 1), + "arr13": (uctypes.ARRAY | 1, 1, {"l": {}}), +} + +data = bytearray(8) + +S = uctypes.struct(uctypes.addressof(data), desc) + +# assign int64 +S.arr11[0] = 0x11223344 +print(hex(S.arr11[0])) +assert hex(S.arr11[0]) == "0x11223344" + +# assign uint64 +S.arr12[0] = 0x11223344 +print(hex(S.arr12[0])) +assert hex(S.arr12[0]) == "0x11223344" diff --git a/tests/extmod 2/uctypes_bytearray.py b/tests/extmod 2/uctypes_bytearray.py new file mode 100644 index 0000000000000..77c93c3766c40 --- /dev/null +++ b/tests/extmod 2/uctypes_bytearray.py @@ -0,0 +1,22 @@ +try: + import uctypes +except ImportError: + print("SKIP") + raise SystemExit + +desc = { + "arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2), + "arr2": (uctypes.ARRAY | 2, uctypes.INT8 | 2), +} + +data = bytearray(b"01234567") + +S = uctypes.struct(uctypes.addressof(data), desc, uctypes.LITTLE_ENDIAN) + +# Arrays of UINT8 are accessed as bytearrays +print(S.arr) +# But not INT8, because value range is different +print(type(S.arr2)) + +# convert to buffer +print(bytearray(S)) diff --git a/tests/extmod 2/uctypes_byteat.py b/tests/extmod 2/uctypes_byteat.py new file mode 100644 index 0000000000000..784209f803409 --- /dev/null +++ b/tests/extmod 2/uctypes_byteat.py @@ -0,0 +1,10 @@ +try: + import uctypes +except ImportError: + print("SKIP") + raise SystemExit + +data = bytearray(b'01234567') + +print(uctypes.bytes_at(uctypes.addressof(data), 4)) +print(uctypes.bytearray_at(uctypes.addressof(data), 4)) diff --git a/tests/extmod 2/uctypes_byteat.py.exp b/tests/extmod 2/uctypes_byteat.py.exp new file mode 100644 index 0000000000000..e1ae4d0534c95 --- /dev/null +++ b/tests/extmod 2/uctypes_byteat.py.exp @@ -0,0 +1,2 @@ +b'0123' +bytearray(b'0123') diff --git a/tests/extmod 2/uctypes_error.py b/tests/extmod 2/uctypes_error.py new file mode 100644 index 0000000000000..2500e292787bc --- /dev/null +++ b/tests/extmod 2/uctypes_error.py @@ -0,0 +1,37 @@ +# test general errors with uctypes + +try: + import uctypes +except ImportError: + print("SKIP") + raise SystemExit + +data = bytearray(b"01234567") + +# del subscr not supported +S = uctypes.struct(uctypes.addressof(data), {}) +try: + del S[0] +except TypeError: + print('TypeError') + +# list is an invalid descriptor +S = uctypes.struct(uctypes.addressof(data), []) +try: + S.x +except TypeError: + print('TypeError') + +# can't access attribute with invalid descriptor +S = uctypes.struct(uctypes.addressof(data), {'x':[]}) +try: + S.x +except TypeError: + print('TypeError') + +# can't assign to aggregate +S = uctypes.struct(uctypes.addressof(data), {'x':(uctypes.ARRAY | 0, uctypes.INT8 | 2)}) +try: + S.x = 1 +except TypeError: + print('TypeError') diff --git a/tests/extmod 2/uctypes_error.py.exp b/tests/extmod 2/uctypes_error.py.exp new file mode 100644 index 0000000000000..802c260d2b76a --- /dev/null +++ b/tests/extmod 2/uctypes_error.py.exp @@ -0,0 +1,4 @@ +TypeError +TypeError +TypeError +TypeError diff --git a/tests/extmod 2/uctypes_le_float.py b/tests/extmod 2/uctypes_le_float.py new file mode 100644 index 0000000000000..84ff2b84cf6e2 --- /dev/null +++ b/tests/extmod 2/uctypes_le_float.py @@ -0,0 +1,24 @@ +try: + import uctypes +except ImportError: + print("SKIP") + raise SystemExit + +desc = { + "f32": uctypes.FLOAT32 | 0, + "f64": uctypes.FLOAT64 | 0, + "uf64": uctypes.FLOAT64 | 2, # unaligned +} + +data = bytearray(10) + +S = uctypes.struct(uctypes.addressof(data), desc, uctypes.LITTLE_ENDIAN) + +S.f32 = 12.34 +print('%.4f' % S.f32) + +S.f64 = 12.34 +print('%.4f' % S.f64) + +S.uf64 = 12.34 +print('%.4f' % S.uf64) diff --git a/tests/extmod 2/uctypes_native_float.py b/tests/extmod 2/uctypes_native_float.py new file mode 100644 index 0000000000000..acef47036d00c --- /dev/null +++ b/tests/extmod 2/uctypes_native_float.py @@ -0,0 +1,20 @@ +try: + import uctypes +except ImportError: + print("SKIP") + raise SystemExit + +desc = { + "f32": uctypes.FLOAT32 | 0, + "f64": uctypes.FLOAT64 | 0, +} + +data = bytearray(8) + +S = uctypes.struct(uctypes.addressof(data), desc, uctypes.NATIVE) + +S.f32 = 12.34 +print('%.4f' % S.f32) + +S.f64 = 12.34 +print('%.4f' % S.f64) diff --git a/tests/extmod 2/uctypes_ptr_le.py b/tests/extmod 2/uctypes_ptr_le.py new file mode 100644 index 0000000000000..056e4565060c5 --- /dev/null +++ b/tests/extmod 2/uctypes_ptr_le.py @@ -0,0 +1,34 @@ +import sys +try: + import uctypes +except ImportError: + print("SKIP") + raise SystemExit + +if sys.byteorder != "little": + print("SKIP") + raise SystemExit + +desc = { + "ptr": (uctypes.PTR | 0, uctypes.UINT8), + "ptr16": (uctypes.PTR | 0, uctypes.UINT16), + "ptr2": (uctypes.PTR | 0, {"b": uctypes.UINT8 | 0}), +} + +bytes = b"01" + +addr = uctypes.addressof(bytes) +buf = addr.to_bytes(uctypes.sizeof(desc), "little") + +S = uctypes.struct(uctypes.addressof(buf), desc, uctypes.LITTLE_ENDIAN) + +print(S.ptr[0]) +assert S.ptr[0] == ord("0") +print(S.ptr[1]) +assert S.ptr[1] == ord("1") +print(hex(S.ptr16[0])) +assert hex(S.ptr16[0]) == "0x3130" +print(S.ptr2[0].b, S.ptr2[1].b) +print (S.ptr2[0].b, S.ptr2[1].b) +print(hex(S.ptr16[0])) +assert (S.ptr2[0].b, S.ptr2[1].b) == (48, 49) diff --git a/tests/extmod 2/uctypes_ptr_native_le.py.exp b/tests/extmod 2/uctypes_ptr_native_le.py.exp new file mode 100644 index 0000000000000..30d159edd1bfd --- /dev/null +++ b/tests/extmod 2/uctypes_ptr_native_le.py.exp @@ -0,0 +1,6 @@ +48 +49 +0x3130 +48 49 +48 49 +0x3130 diff --git a/tests/extmod 2/uctypes_sizeof.py.exp b/tests/extmod 2/uctypes_sizeof.py.exp new file mode 100644 index 0000000000000..b35b11aa0cea9 --- /dev/null +++ b/tests/extmod 2/uctypes_sizeof.py.exp @@ -0,0 +1,7 @@ +2 +2 +4 +TypeError +6 +1 +TypeError diff --git a/tests/extmod 2/uhashlib_sha1.py b/tests/extmod 2/uhashlib_sha1.py new file mode 100644 index 0000000000000..9d6427b33ff9f --- /dev/null +++ b/tests/extmod 2/uhashlib_sha1.py @@ -0,0 +1,28 @@ +try: + import uhashlib as hashlib +except ImportError: + try: + import hashlib + except ImportError: + # This is neither uPy, nor cPy, so must be uPy with + # uhashlib module disabled. + print("SKIP") + raise SystemExit + +try: + hashlib.sha1 +except AttributeError: + # SHA1 is only available on some ports + print("SKIP") + raise SystemExit + +sha1 = hashlib.sha1(b'hello') +sha1.update(b'world') +print(sha1.digest()) + +sha1 = hashlib.sha1(b'hello') +try: + sha1.update(u'world') +except TypeError as e: + print("TypeError") +print(sha1.digest()) diff --git a/tests/extmod 2/ujson_dump.py b/tests/extmod 2/ujson_dump.py new file mode 100644 index 0000000000000..b1cb4a9cbcdb2 --- /dev/null +++ b/tests/extmod 2/ujson_dump.py @@ -0,0 +1,30 @@ +try: + from uio import StringIO + import ujson as json +except: + try: + from io import StringIO + import json + except ImportError: + print("SKIP") + raise SystemExit + +s = StringIO() +json.dump(False, s) +print(s.getvalue()) + +s = StringIO() +json.dump({"a": (2, [3, None])}, s) +print(s.getvalue()) + +# dump to a small-int not allowed +try: + json.dump(123, 1) +except (AttributeError, OSError): # CPython and uPy have different errors + print('Exception') + +# dump to an object not allowed +try: + json.dump(123, {}) +except (AttributeError, OSError): # CPython and uPy have different errors + print('Exception') diff --git a/tests/extmod 2/ujson_dumps_extra.py b/tests/extmod 2/ujson_dumps_extra.py new file mode 100644 index 0000000000000..21a388c32d097 --- /dev/null +++ b/tests/extmod 2/ujson_dumps_extra.py @@ -0,0 +1,9 @@ +# test uPy ujson behaviour that's not valid in CPy + +try: + import ujson +except ImportError: + print("SKIP") + raise SystemExit + +print(ujson.dumps(b'1234')) diff --git a/tests/extmod 2/ujson_dumps_float.py b/tests/extmod 2/ujson_dumps_float.py new file mode 100644 index 0000000000000..e8cceb6f1a533 --- /dev/null +++ b/tests/extmod 2/ujson_dumps_float.py @@ -0,0 +1,10 @@ +try: + import ujson as json +except ImportError: + try: + import json + except ImportError: + print("SKIP") + raise SystemExit + +print(json.dumps(1.2)) diff --git a/tests/extmod 2/ujson_load_readinto.py.exp b/tests/extmod 2/ujson_load_readinto.py.exp new file mode 100644 index 0000000000000..f8c3c693becf4 --- /dev/null +++ b/tests/extmod 2/ujson_load_readinto.py.exp @@ -0,0 +1,4 @@ +None +abcde +[False, True, 1, -2] +{'a': True} diff --git a/tests/extmod 2/ujson_loads.py b/tests/extmod 2/ujson_loads.py new file mode 100644 index 0000000000000..adba3c068d27c --- /dev/null +++ b/tests/extmod 2/ujson_loads.py @@ -0,0 +1,74 @@ +try: + import ujson as json +except ImportError: + try: + import json + except ImportError: + print("SKIP") + raise SystemExit + +def my_print(o): + if isinstance(o, dict): + print('sorted dict', sorted(o.items())) + else: + print(o) + +my_print(json.loads('null')) +my_print(json.loads('false')) +my_print(json.loads('true')) +my_print(json.loads('1')) +my_print(json.loads('-2')) +my_print(json.loads('"abc\\u0064e"')) +my_print(json.loads('[]')) +my_print(json.loads('[null]')) +my_print(json.loads('[null,false,true]')) +my_print(json.loads(' [ null , false , true ] ')) +my_print(json.loads('{}')) +my_print(json.loads('{"a":true}')) +my_print(json.loads('{"a":null, "b":false, "c":true}')) +my_print(json.loads('{"a":[], "b":[1], "c":{"3":4}}')) +my_print(json.loads('"abc\\bdef"')) +my_print(json.loads('"abc\\fdef"')) +my_print(json.loads('"abc\\ndef"')) +my_print(json.loads('"abc\\rdef"')) +my_print(json.loads('"abc\\tdef"')) +my_print(json.loads('"abc\\uabcd"')) + +# whitespace handling +my_print(json.loads('{\n\t"a":[]\r\n, "b":[1], "c":{"3":4} \n\r\t\r\r\r\n}')) + +# loading nothing should raise exception +try: + json.loads('') +except ValueError: + print('ValueError') + +# string which is not closed +try: + my_print(json.loads('"abc')) +except ValueError: + print('ValueError') + +# unaccompanied closing brace +try: + my_print(json.loads(']')) +except ValueError: + print('ValueError') + +# unspecified object type +try: + my_print(json.loads('a')) +except ValueError: + print('ValueError') + +# bad property name +try: + my_print(json.loads('{{}:"abc"}')) +except ValueError: + print('ValueError') + +# unexpected characters after white space +try: + my_print(json.loads('[null] a')) +except ValueError: + print('ValueError') diff --git a/tests/extmod 2/ujson_loads_float.py b/tests/extmod 2/ujson_loads_float.py new file mode 100644 index 0000000000000..f1b8cc364c4ac --- /dev/null +++ b/tests/extmod 2/ujson_loads_float.py @@ -0,0 +1,17 @@ +try: + import ujson as json +except ImportError: + try: + import json + except ImportError: + print("SKIP") + raise SystemExit + +def my_print(o): + print('%.3f' % o) + +my_print(json.loads('1.2')) +my_print(json.loads('1e2')) +my_print(json.loads('-2.3')) +my_print(json.loads('-2e3')) +my_print(json.loads('-2e-3')) diff --git a/tests/extmod 2/urandom_basic.py b/tests/extmod 2/urandom_basic.py new file mode 100644 index 0000000000000..57e6b26cba590 --- /dev/null +++ b/tests/extmod 2/urandom_basic.py @@ -0,0 +1,29 @@ +try: + import urandom as random +except ImportError: + try: + import random + except ImportError: + print("SKIP") + raise SystemExit + +# check getrandbits returns a value within the bit range +for b in (1, 2, 3, 4, 16, 32): + for i in range(50): + assert random.getrandbits(b) < (1 << b) + +# check that seed(0) gives a non-zero value +random.seed(0) +print(random.getrandbits(16) != 0) + +# check that PRNG is repeatable +random.seed(1) +r = random.getrandbits(16) +random.seed(1) +print(random.getrandbits(16) == r) + +# check that it throws an error for zero bits +try: + random.getrandbits(0) +except ValueError: + print('ValueError') diff --git a/tests/extmod 2/ure1.py b/tests/extmod 2/ure1.py new file mode 100644 index 0000000000000..710720c8b6519 --- /dev/null +++ b/tests/extmod 2/ure1.py @@ -0,0 +1,103 @@ +try: + import ure as re +except ImportError: + try: + import re + except ImportError: + print("SKIP") + raise SystemExit + +r = re.compile(".+") +m = r.match("abc") +print(m.group(0)) +try: + m.group(1) +except IndexError: + print("IndexError") + +# conversion of re and match to string +str(r) +str(m) + +r = re.compile("(.+)1") +m = r.match("xyz781") +print(m.group(0)) +print(m.group(1)) +try: + m.group(2) +except IndexError: + print("IndexError") + +r = re.compile(r"\n") +m = r.match("\n") +print(m.group(0)) +m = r.match("\\") +print(m) +r = re.compile(r"[\n-\r]") +m = r.match("\n") +print(m.group(0)) +r = re.compile(r"[\]]") +m = r.match("]") +print(m.group(0)) +print("===") + +r = re.compile("[a-cu-z]") +m = r.match("a") +print(m.group(0)) +m = r.match("z") +print(m.group(0)) +m = r.match("d") +print(m) +m = r.match("A") +print(m) +print("===") + +r = re.compile("[^a-cu-z]") +m = r.match("a") +print(m) +m = r.match("z") +print(m) +m = r.match("d") +print(m.group(0)) +m = r.match("A") +print(m.group(0)) +print("===") + +# '-' character within character class block +print(re.match("[-a]+", "-a]d").group(0)) +print(re.match("[a-]+", "-a]d").group(0)) +print("===") + +r = re.compile("o+") +m = r.search("foobar") +print(m.group(0)) +try: + m.group(1) +except IndexError: + print("IndexError") + + +m = re.match(".*", "foo") +print(m.group(0)) + +m = re.search("w.r", "hello world") +print(m.group(0)) + +m = re.match('a+?', 'ab'); print(m.group(0)) +m = re.match('a*?', 'ab'); print(m.group(0)) +m = re.match('^ab$', 'ab'); print(m.group(0)) +m = re.match('a|b', 'b'); print(m.group(0)) +m = re.match('a|b|c', 'c'); print(m.group(0)) + +# Case where anchors fail to match +r = re.compile("^b|b$") +m = r.search("abc") +print(m) + +try: + re.compile("*") +except: + print("Caught invalid regex") + +# bytes objects +m = re.match(rb'a+?', b'ab'); print(m.group(0)) diff --git a/tests/extmod 2/ure_debug.py.exp b/tests/extmod 2/ure_debug.py.exp new file mode 100644 index 0000000000000..45f5e20f6d6d9 --- /dev/null +++ b/tests/extmod 2/ure_debug.py.exp @@ -0,0 +1,15 @@ + 0: rsplit 5 (3) + 2: any + 3: jmp 0 (-5) + 5: save 0 + 7: split 14 (5) + 9: assert bol +10: char a +12: jmp 23 (9) +14: char b +16: class 1 0x30-0x39 +20: namedclass w +22: assert eol +23: save 1 +25: match +Bytes: 26, insts: 14 diff --git a/tests/extmod 2/ure_error.py b/tests/extmod 2/ure_error.py new file mode 100644 index 0000000000000..f52f735c7fa5e --- /dev/null +++ b/tests/extmod 2/ure_error.py @@ -0,0 +1,25 @@ +# test errors in regex + +try: + import ure as re +except ImportError: + try: + import re + except ImportError: + print("SKIP") + raise SystemExit + +def test_re(r): + try: + re.compile(r) + print("OK") + except: # uPy and CPy use different errors, so just ignore the type + print("Error") + +test_re(r'?') +test_re(r'*') +test_re(r'+') +test_re(r')') +test_re(r'[') +test_re(r'([') +test_re(r'([)') diff --git a/tests/extmod 2/ure_namedclass.py b/tests/extmod 2/ure_namedclass.py new file mode 100644 index 0000000000000..215d09613f4b0 --- /dev/null +++ b/tests/extmod 2/ure_namedclass.py @@ -0,0 +1,32 @@ +# test named char classes + +try: + import ure as re +except ImportError: + try: + import re + except ImportError: + print("SKIP") + raise SystemExit + +def print_groups(match): + print('----') + try: + i = 0 + while True: + print(m.group(i)) + i += 1 + except IndexError: + pass + +m = re.match(r'\w+','1234hello567 abc') +print_groups(m) + +m = re.match(r'(\w+)\s+(\w+)','ABC \t1234hello567 abc') +print_groups(m) + +m = re.match(r'(\S+)\s+(\D+)','ABC \thello abc567 abc') +print_groups(m) + +m = re.match(r'(([0-9]*)([a-z]*)\d*)','1234hello567') +print_groups(m) diff --git a/tests/extmod 2/ure_stack_overflow.py.exp b/tests/extmod 2/ure_stack_overflow.py.exp new file mode 100644 index 0000000000000..8a2b9bfdda511 --- /dev/null +++ b/tests/extmod 2/ure_stack_overflow.py.exp @@ -0,0 +1 @@ +RuntimeError diff --git a/tests/extmod 2/ure_sub_unmatched.py.exp b/tests/extmod 2/ure_sub_unmatched.py.exp new file mode 100644 index 0000000000000..1e5f0fda0554d --- /dev/null +++ b/tests/extmod 2/ure_sub_unmatched.py.exp @@ -0,0 +1 @@ +1-a2 diff --git a/tests/extmod 2/ussl_basic.py b/tests/extmod 2/ussl_basic.py new file mode 100644 index 0000000000000..e8710ed51ab4b --- /dev/null +++ b/tests/extmod 2/ussl_basic.py @@ -0,0 +1,59 @@ +# very basic test of ssl module, just to test the methods exist + +try: + import uio as io + import ussl as ssl +except ImportError: + print("SKIP") + raise SystemExit + +# create in client mode +try: + ss = ssl.wrap_socket(io.BytesIO()) +except OSError as er: + print('wrap_socket:', repr(er)) + +# create in server mode (can use this object for further tests) +socket = io.BytesIO() +ss = ssl.wrap_socket(socket, server_side=1) + +# print +print(repr(ss)[:12]) + +# setblocking +try: + ss.setblocking(False) +except NotImplementedError: + print('setblocking: NotImplementedError') +ss.setblocking(True) + +# write +print(ss.write(b'aaaa')) + +# read (underlying socket has no data) +print(ss.read(8)) + +# read (underlying socket has data, but it's bad data) +socket.write(b'aaaaaaaaaaaaaaaa') +socket.seek(0) +try: + ss.read(8) +except OSError as er: + print('read:', repr(er)) + +# close +ss.close() +# close 2nd time +ss.close() + +# read on closed socket +try: + ss.read(10) +except OSError as er: + print('read:', repr(er)) + +# write on closed socket +try: + ss.write(b'aaaa') +except OSError as er: + print('write:', repr(er)) diff --git a/tests/extmod 2/utimeq1.py b/tests/extmod 2/utimeq1.py new file mode 100644 index 0000000000000..dc7f3b6600404 --- /dev/null +++ b/tests/extmod 2/utimeq1.py @@ -0,0 +1,137 @@ +# Test for utimeq module which implements task queue with support for +# wraparound time (utime.ticks_ms() style). +try: + from utime import ticks_add, ticks_diff + from utimeq import utimeq +except ImportError: + print("SKIP") + raise SystemExit + +DEBUG = 0 + +MAX = ticks_add(0, -1) +MODULO_HALF = MAX // 2 + 1 + +if DEBUG: + def dprint(*v): + print(*v) +else: + def dprint(*v): + pass + +# Try not to crash on invalid data +h = utimeq(10) +try: + h.push(1) + assert False +except TypeError: + pass + +try: + h.pop(1) + assert False +except IndexError: + pass + +# unsupported unary op +try: + ~h + assert False +except TypeError: + pass + +# pushing on full queue +h = utimeq(1) +h.push(1, 0, 0) +try: + h.push(2, 0, 0) + assert False +except IndexError: + pass + +# popping into invalid type +try: + h.pop([]) + assert False +except TypeError: + pass + +# length +assert len(h) == 1 + +# peektime +assert h.peektime() == 1 + +# peektime with empty queue +try: + utimeq(1).peektime() + assert False +except IndexError: + pass + +def pop_all(h): + l = [] + while h: + item = [0, 0, 0] + h.pop(item) + #print("!", item) + l.append(tuple(item)) + dprint(l) + return l + +def add(h, v): + h.push(v, 0, 0) + dprint("-----") + #h.dump() + dprint("-----") + +h = utimeq(10) +add(h, 0) +add(h, MAX) +add(h, MAX - 1) +add(h, 101) +add(h, 100) +add(h, MAX - 2) +dprint(h) +l = pop_all(h) +for i in range(len(l) - 1): + diff = ticks_diff(l[i + 1][0], l[i][0]) + assert diff > 0 + +def edge_case(edge, offset): + h = utimeq(10) + add(h, ticks_add(0, offset)) + add(h, ticks_add(edge, offset)) + dprint(h) + l = pop_all(h) + diff = ticks_diff(l[1][0], l[0][0]) + dprint(diff, diff > 0) + return diff + +dprint("===") +diff = edge_case(MODULO_HALF - 1, 0) +assert diff == MODULO_HALF - 1 +assert edge_case(MODULO_HALF - 1, 100) == diff +assert edge_case(MODULO_HALF - 1, -100) == diff + +# We expect diff to be always positive, per the definition of heappop() which should return +# the smallest value. +# This is the edge case where this invariant breaks, due to assymetry of two's-complement +# range - there's one more negative integer than positive, so heappushing values like below +# will then make ticks_diff() return the minimum negative value. We could make heappop +# return them in a different order, but ticks_diff() result would be the same. Conclusion: +# never add to a heap values where (a - b) == MODULO_HALF (and which are >= MODULO_HALF +# ticks apart in real time of course). +dprint("===") +diff = edge_case(MODULO_HALF, 0) +assert diff == -MODULO_HALF +assert edge_case(MODULO_HALF, 100) == diff +assert edge_case(MODULO_HALF, -100) == diff + +dprint("===") +diff = edge_case(MODULO_HALF + 1, 0) +assert diff == MODULO_HALF - 1 +assert edge_case(MODULO_HALF + 1, 100) == diff +assert edge_case(MODULO_HALF + 1, -100) == diff + +print("OK") diff --git a/tests/extmod 2/utimeq_stable.py.exp b/tests/extmod 2/utimeq_stable.py.exp new file mode 100644 index 0000000000000..d86bac9de59ab --- /dev/null +++ b/tests/extmod 2/utimeq_stable.py.exp @@ -0,0 +1 @@ +OK diff --git a/tests/extmod 2/uzlib_decompio.py b/tests/extmod 2/uzlib_decompio.py new file mode 100644 index 0000000000000..112a82597638a --- /dev/null +++ b/tests/extmod 2/uzlib_decompio.py @@ -0,0 +1,33 @@ +try: + import uzlib as zlib + import uio as io +except ImportError: + print("SKIP") + raise SystemExit + + +# Raw DEFLATE bitstream +buf = io.BytesIO(b'\xcbH\xcd\xc9\xc9\x07\x00') +inp = zlib.DecompIO(buf, -8) +print(buf.seek(0, 1)) +print(inp.read(1)) +print(buf.seek(0, 1)) +print(inp.read(2)) +print(inp.read()) +print(buf.seek(0, 1)) +print(inp.read(1)) +print(inp.read()) +print(buf.seek(0, 1)) + + +# zlib bitstream +inp = zlib.DecompIO(io.BytesIO(b'x\x9c30\xa0=\x00\x00\xb3q\x12\xc1')) +print(inp.read(10)) +print(inp.read()) + +# zlib bitstream, wrong checksum +inp = zlib.DecompIO(io.BytesIO(b'x\x9c30\xa0=\x00\x00\xb3q\x12\xc0')) +try: + print(inp.read()) +except OSError as e: + print(repr(e)) diff --git a/tests/extmod 2/uzlib_decompio_gz.py.exp b/tests/extmod 2/uzlib_decompio_gz.py.exp new file mode 100644 index 0000000000000..20a30c82a3d5e --- /dev/null +++ b/tests/extmod 2/uzlib_decompio_gz.py.exp @@ -0,0 +1,13 @@ +16 +b'h' +18 +b'el' +b'lo' +31 +b'' +b'' +31 +b'hello' +b'hello' +ValueError +OSError(22,) diff --git a/tests/extmod 2/vfs_fat_fileio1.py b/tests/extmod 2/vfs_fat_fileio1.py new file mode 100644 index 0000000000000..4635ca84b53ad --- /dev/null +++ b/tests/extmod 2/vfs_fat_fileio1.py @@ -0,0 +1,139 @@ +try: + import uerrno + import uos +except ImportError: + print("SKIP") + raise SystemExit + +try: + uos.VfsFat +except AttributeError: + print("SKIP") + raise SystemExit + + +class RAMFS: + + SEC_SIZE = 512 + + def __init__(self, blocks): + self.data = bytearray(blocks * self.SEC_SIZE) + + def readblocks(self, n, buf): + #print("readblocks(%s, %x(%d))" % (n, id(buf), len(buf))) + for i in range(len(buf)): + buf[i] = self.data[n * self.SEC_SIZE + i] + return 0 + + def writeblocks(self, n, buf): + #print("writeblocks(%s, %x)" % (n, id(buf))) + for i in range(len(buf)): + self.data[n * self.SEC_SIZE + i] = buf[i] + return 0 + + def ioctl(self, op, arg): + #print("ioctl(%d, %r)" % (op, arg)) + if op == 4: # BP_IOCTL_SEC_COUNT + return len(self.data) // self.SEC_SIZE + if op == 5: # BP_IOCTL_SEC_SIZE + return self.SEC_SIZE + + +try: + bdev = RAMFS(50) +except MemoryError: + print("SKIP") + raise SystemExit + +uos.VfsFat.mkfs(bdev) +vfs = uos.VfsFat(bdev) +uos.mount(vfs, '/ramdisk') +uos.chdir('/ramdisk') + +# file IO +f = open("foo_file.txt", "w") +print(str(f)[:17], str(f)[-1:]) +f.write("hello!") +f.flush() +f.close() +f.close() # allowed +try: + f.write("world!") +except OSError as e: + print(e.args[0] == uerrno.EINVAL) + +try: + f.read() +except OSError as e: + print(e.args[0] == uerrno.EINVAL) + +try: + f.flush() +except OSError as e: + print(e.args[0] == uerrno.EINVAL) + +try: + open("foo_file.txt", "x") +except OSError as e: + print(e.args[0] == uerrno.EEXIST) + +with open("foo_file.txt", "a") as f: + f.write("world!") + +with open("foo_file.txt") as f2: + print(f2.read()) + print(f2.tell()) + + f2.seek(0, 0) # SEEK_SET + print(f2.read(1)) + + f2.seek(0, 1) # SEEK_CUR + print(f2.read(1)) + f2.seek(2, 1) # SEEK_CUR + print(f2.read(1)) + + f2.seek(-2, 2) # SEEK_END + print(f2.read(1)) + +# using constructor of FileIO type to open a file +# no longer working with new VFS sub-system +#FileIO = type(f) +#with FileIO("/ramdisk/foo_file.txt") as f: +# print(f.read()) + +# dirs +vfs.mkdir("foo_dir") + +try: + vfs.rmdir("foo_file.txt") +except OSError as e: + print(e.args[0] == 20) # uerrno.ENOTDIR + +vfs.remove("foo_file.txt") +print(list(vfs.ilistdir())) + +# Here we test that opening a file with the heap locked fails correctly. This +# is a special case because file objects use a finaliser and allocating with a +# finaliser is a different path to normal allocation. It would be better to +# test this in the core tests but there are no core objects that use finaliser. +import micropython +micropython.heap_lock() +try: + vfs.open('x', 'r') +except MemoryError: + print('MemoryError') +micropython.heap_unlock() + +# Here we test that the finaliser is actually called during a garbage collection. +import gc +N = 4 +for i in range(N): + n = 'x%d' % i + f = vfs.open(n, 'w') + f.write(n) + f = None # release f without closing + [0, 1, 2, 3] # use up Python stack so f is really gone +gc.collect() # should finalise all N files by closing them +for i in range(N): + with vfs.open('x%d' % i, 'r') as f: + print(f.read()) diff --git a/tests/extmod 2/vfs_fat_fileio1.py.exp b/tests/extmod 2/vfs_fat_fileio1.py.exp new file mode 100644 index 0000000000000..4eb50402c45e9 --- /dev/null +++ b/tests/extmod 2/vfs_fat_fileio1.py.exp @@ -0,0 +1,18 @@ + +True +True +True +True +hello!world! +12 +h +e +o +d +True +[('foo_dir', 16384, 0, 0)] +MemoryError +x0 +x1 +x2 +x3 diff --git a/tests/extmod 2/vfs_fat_more.py.exp b/tests/extmod 2/vfs_fat_more.py.exp new file mode 100644 index 0000000000000..24429ee09542e --- /dev/null +++ b/tests/extmod 2/vfs_fat_more.py.exp @@ -0,0 +1,29 @@ +/ +['test.txt'] +['test.txt'] +(16384, 0, 0, 0, 0, 0, 0) +(16384, 0, 0, 0, 0, 0, 0) +(32768, 0, 0, 0, 0, 0, 5) +(32768, 0, 0, 0, 0, 0, 5) +hello +['test2.txt'] +['test3.txt'] +['test4.txt'] +['test5.txt'] +['test5.txt', 'dir'] +['test5.txt', 'dir', 'dir2'] +['subdir'] +mkdir OSError True +mkdir OSError True +mkdir OSError True +mkdir OSError True +mkdir OSError True +(32768, 0, 0, 0, 0, 0, 5) +['sys', 'test5.txt', 'dir', 'dir2'] +[] +[] +['sys', 'dir'] +/ +['sys'] +[] +test_module! diff --git a/tests/extmod 2/vfs_fat_oldproto.py.exp b/tests/extmod 2/vfs_fat_oldproto.py.exp new file mode 100644 index 0000000000000..b974683167c17 --- /dev/null +++ b/tests/extmod 2/vfs_fat_oldproto.py.exp @@ -0,0 +1,3 @@ +[('file.txt', 32768, 0, 6)] +hello! +[] diff --git a/tests/extmod 2/vfs_fat_ramdisk.py.exp b/tests/extmod 2/vfs_fat_ramdisk.py.exp new file mode 100644 index 0000000000000..704408cd0b231 --- /dev/null +++ b/tests/extmod 2/vfs_fat_ramdisk.py.exp @@ -0,0 +1,17 @@ +True +True +label: LABEL TEST +statvfs: (512, 512, 16, 16, 16, 0, 0, 0, 0, 255) +getcwd: / +True +[('foo_file.txt', 32768, 0, 6)] +stat root: (16384, 0, 0, 0, 0, 0, 0, 946684800, 946684800, 946684800) +stat file: (32768, 0, 0, 0, 0, 0, 6) +True +True +getcwd: /foo_dir +[] +True +getcwd: / +[(b'foo_file.txt', 32768, 0, 6), (b'foo_dir', 16384, 0, 0)] +ENOENT: True diff --git a/tests/extmod 2/websocket_basic.py.exp b/tests/extmod 2/websocket_basic.py.exp new file mode 100644 index 0000000000000..2d7657b535407 --- /dev/null +++ b/tests/extmod 2/websocket_basic.py.exp @@ -0,0 +1,14 @@ +b'ping' +b'ping' +b'\x81\x04pong' +b'pingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingping' +b'\x81~\x00\x80pongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpong' +b'\x00\x00\x00\x00' +b'' +b'\x81\x02\x88\x00' +b'ping' +b'pong' +0 +1 +2 +ioctl: EINVAL: True diff --git a/tests/feature_check 2/README b/tests/feature_check 2/README new file mode 100644 index 0000000000000..d062020f7bb32 --- /dev/null +++ b/tests/feature_check 2/README @@ -0,0 +1,4 @@ +This directory doesn't contain real tests, but code snippets to detect +various interpreter features, which can't be/inconvenient to detecte by +other means. Scripts here are executed by run-tests at the beginning of +testsuite to decide what other test groups to run/exclude. diff --git a/tests/feature_check 2/async_check.py b/tests/feature_check 2/async_check.py new file mode 100644 index 0000000000000..0f6361cd12016 --- /dev/null +++ b/tests/feature_check 2/async_check.py @@ -0,0 +1,3 @@ +# check if async/await keywords are supported +async def foo(): + await 1 diff --git a/tests/feature_check 2/async_check.py.exp b/tests/feature_check 2/async_check.py.exp new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/tests/feature_check 2/byteorder.py b/tests/feature_check 2/byteorder.py new file mode 100644 index 0000000000000..d60f93956852d --- /dev/null +++ b/tests/feature_check 2/byteorder.py @@ -0,0 +1,2 @@ +import sys +print(sys.byteorder) diff --git a/tests/feature_check 2/byteorder.py.exp b/tests/feature_check 2/byteorder.py.exp new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/tests/feature_check 2/complex.py b/tests/feature_check 2/complex.py new file mode 100644 index 0000000000000..7576dcb953f52 --- /dev/null +++ b/tests/feature_check 2/complex.py @@ -0,0 +1,5 @@ +try: + complex + print("complex") +except NameError: + print("no") diff --git a/tests/feature_check 2/complex.py.exp b/tests/feature_check 2/complex.py.exp new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/tests/feature_check 2/const.py b/tests/feature_check 2/const.py new file mode 100644 index 0000000000000..db32e8c69bd7c --- /dev/null +++ b/tests/feature_check 2/const.py @@ -0,0 +1 @@ +x = const(1) diff --git a/tests/feature_check 2/const.py.exp b/tests/feature_check 2/const.py.exp new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/tests/feature_check 2/coverage.py b/tests/feature_check 2/coverage.py new file mode 100644 index 0000000000000..dcda53eae24bb --- /dev/null +++ b/tests/feature_check 2/coverage.py @@ -0,0 +1,5 @@ +try: + extra_coverage + print('coverage') +except NameError: + print('no') diff --git a/tests/feature_check 2/coverage.py.exp b/tests/feature_check 2/coverage.py.exp new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/tests/feature_check 2/float.py b/tests/feature_check 2/float.py new file mode 100644 index 0000000000000..af93f5976321c --- /dev/null +++ b/tests/feature_check 2/float.py @@ -0,0 +1,13 @@ +# detect how many bits of precision the floating point implementation has + +try: + float +except NameError: + print(0) +else: + if float('1.0000001') == float('1.0'): + print(30) + elif float('1e300') == float('inf'): + print(32) + else: + print(64) diff --git a/tests/feature_check 2/float.py.exp b/tests/feature_check 2/float.py.exp new file mode 100644 index 0000000000000..900731ffd51ff --- /dev/null +++ b/tests/feature_check 2/float.py.exp @@ -0,0 +1 @@ +64 diff --git a/tests/feature_check 2/int_big.py b/tests/feature_check 2/int_big.py new file mode 100644 index 0000000000000..f30285a98f96b --- /dev/null +++ b/tests/feature_check 2/int_big.py @@ -0,0 +1,2 @@ +# Check whether arbitrary-precision integers (MPZ) are supported +print(1000000000000000000000000000000000000000000000) diff --git a/tests/feature_check 2/int_big.py.exp b/tests/feature_check 2/int_big.py.exp new file mode 100644 index 0000000000000..9dfe3354d5949 --- /dev/null +++ b/tests/feature_check 2/int_big.py.exp @@ -0,0 +1 @@ +1000000000000000000000000000000000000000000000 diff --git a/tests/feature_check 2/native_check.py b/tests/feature_check 2/native_check.py new file mode 100644 index 0000000000000..3971d1355fbaf --- /dev/null +++ b/tests/feature_check 2/native_check.py @@ -0,0 +1,4 @@ +# this test for the availability of native emitter +@micropython.native +def f(): + pass diff --git a/tests/feature_check 2/native_check.py.exp b/tests/feature_check 2/native_check.py.exp new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/tests/feature_check 2/repl_emacs_check.py b/tests/feature_check 2/repl_emacs_check.py new file mode 100644 index 0000000000000..3209716229c56 --- /dev/null +++ b/tests/feature_check 2/repl_emacs_check.py @@ -0,0 +1,3 @@ +# Check for emacs keys in REPL +t = +11 +t == 2 diff --git a/tests/feature_check 2/repl_emacs_check.py.exp b/tests/feature_check 2/repl_emacs_check.py.exp new file mode 100644 index 0000000000000..82a4e28ee4f84 --- /dev/null +++ b/tests/feature_check 2/repl_emacs_check.py.exp @@ -0,0 +1,7 @@ +MicroPython \.\+ version +Use \.\+ +>>> # Check for emacs keys in REPL +>>> t = \.\+ +>>> t == 2 +True +>>> diff --git a/tests/feature_check 2/reverse_ops.py b/tests/feature_check 2/reverse_ops.py new file mode 100644 index 0000000000000..668748bc5742f --- /dev/null +++ b/tests/feature_check 2/reverse_ops.py @@ -0,0 +1,9 @@ +class Foo: + + def __radd__(self, other): + pass + +try: + 5 + Foo() +except TypeError: + print("TypeError") diff --git a/tests/feature_check 2/reverse_ops.py.exp b/tests/feature_check 2/reverse_ops.py.exp new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/tests/feature_check 2/set_check.py b/tests/feature_check 2/set_check.py new file mode 100644 index 0000000000000..ec186cc5b9221 --- /dev/null +++ b/tests/feature_check 2/set_check.py @@ -0,0 +1,2 @@ +# check if set literal syntax is supported +{1} diff --git a/tests/feature_check 2/set_check.py.exp b/tests/feature_check 2/set_check.py.exp new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/tests/float 2/array_construct.py b/tests/float 2/array_construct.py new file mode 100644 index 0000000000000..938675835bbcf --- /dev/null +++ b/tests/float 2/array_construct.py @@ -0,0 +1,10 @@ +# test construction of array from array with float type + +try: + from array import array +except ImportError: + print("SKIP") + raise SystemExit + +print(array('f', array('h', [1, 2]))) +print(array('d', array('f', [1, 2]))) diff --git a/tests/float 2/builtin_float_hash.py b/tests/float 2/builtin_float_hash.py new file mode 100644 index 0000000000000..7a7e374010104 --- /dev/null +++ b/tests/float 2/builtin_float_hash.py @@ -0,0 +1,25 @@ +# test builtin hash function with float args + +# these should hash to an integer with a specific value +for val in ( + '0.0', + '-0.0', + '1.0', + '2.0', + '-12.0', + '12345.0', + ): + print(val, hash(float(val))) + +# just check that these values are hashable +for val in ( + '0.1', + '-0.1', + '10.3', + '0.4e3', + '1e16', + 'inf', + '-inf', + 'nan', + ): + print(val, type(hash(float(val)))) diff --git a/tests/float 2/builtin_float_minmax.py b/tests/float 2/builtin_float_minmax.py new file mode 100644 index 0000000000000..8a53746e5dfdd --- /dev/null +++ b/tests/float 2/builtin_float_minmax.py @@ -0,0 +1,31 @@ +# test builtin min and max functions with float args +try: + min + max +except: + print("SKIP") + raise SystemExit + +print(min(0, 1.0)) +print(min(1.0, 0)) +print(min(0, -1.0)) +print(min(-1.0, 0)) + +print(max(0, 1.0)) +print(max(1.0, 0)) +print(max(0, -1.0)) +print(max(-1.0, 0)) + +print(min(1.5, -1.5)) +print(min(-1.5, 1.5)) + +print(max(1.5, -1.5)) +print(max(-1.5, 1.5)) + +print(min([1, 2.9, 4, 0, -1, 2])) +print(max([1, 2.9, 4, 0, -1, 2])) + +print(min([1, 2.9, 4, 6.5, -1, 2])) +print(max([1, 2.9, 4, 6.5, -1, 2])) +print(min([1, 2.9, 4, -6.5, -1, 2])) +print(max([1, 2.9, 4, -6.5, -1, 2])) diff --git a/tests/float 2/builtin_float_pow.py b/tests/float 2/builtin_float_pow.py new file mode 100644 index 0000000000000..2de1b481763f3 --- /dev/null +++ b/tests/float 2/builtin_float_pow.py @@ -0,0 +1,11 @@ +# test builtin pow function with float args + +print(pow(0.0, 0.0)) +print(pow(0, 1.0)) +print(pow(1.0, 1)) +print(pow(2.0, 3.0)) +print(pow(2.0, -4.0)) + +print(pow(0.0, float('inf'))) +print(pow(0.0, float('-inf'))) +print(pow(0.0, float('nan'))) diff --git a/tests/float 2/builtin_float_round.py b/tests/float 2/builtin_float_round.py new file mode 100644 index 0000000000000..63cb39aa3576b --- /dev/null +++ b/tests/float 2/builtin_float_round.py @@ -0,0 +1,24 @@ +# test round() with floats + +# check basic cases +tests = [ + [0.0], [1.0], [0.1], [-0.1], [123.4], [123.6], [-123.4], [-123.6], + [1.234567, 5], [1.23456, 1], [1.23456, 0], [1234.56, -2] +] +for t in tests: + print(round(*t)) + +# check .5 cases +for i in range(11): + print(round((i - 5) / 2)) + +# test second arg +for i in range(-1, 3): + print(round(1.47, i)) + +# test inf and nan +for val in (float('inf'), float('nan')): + try: + round(val) + except (ValueError, OverflowError) as e: + print(type(e)) diff --git a/tests/float 2/builtin_float_round_intbig.py b/tests/float 2/builtin_float_round_intbig.py new file mode 100644 index 0000000000000..2083e3ea3af46 --- /dev/null +++ b/tests/float 2/builtin_float_round_intbig.py @@ -0,0 +1,4 @@ +# test round() with floats that return large integers + +for x in (-1e25, 1e25): + print('%.3g' % round(x)) diff --git a/tests/float 2/bytearray_construct.py b/tests/float 2/bytearray_construct.py new file mode 100644 index 0000000000000..e960d624ec8ca --- /dev/null +++ b/tests/float 2/bytearray_construct.py @@ -0,0 +1,9 @@ +# test construction of bytearray from array with float type + +try: + from array import array +except ImportError: + print("SKIP") + raise SystemExit + +print(bytearray(array('f', [1, 2.3]))) diff --git a/tests/float 2/bytes_construct.py b/tests/float 2/bytes_construct.py new file mode 100644 index 0000000000000..0e4482e436698 --- /dev/null +++ b/tests/float 2/bytes_construct.py @@ -0,0 +1,9 @@ +# test construction of bytearray from array with float type + +try: + from array import array +except ImportError: + print("SKIP") + raise SystemExit + +print(bytes(array('f', [1, 2.3]))) diff --git a/tests/float 2/cmath_fun.py b/tests/float 2/cmath_fun.py new file mode 100644 index 0000000000000..ae5921c304cb8 --- /dev/null +++ b/tests/float 2/cmath_fun.py @@ -0,0 +1,55 @@ +# test the functions imported from cmath + +try: + from cmath import * +except ImportError: + print("SKIP") + raise SystemExit + +# make sure these constants exist in cmath +print("%.5g" % e) +print("%.5g" % pi) + +test_values_non_zero = [] +base_values = (0.0, 0.5, 1.2345, 10.) +for r in base_values: + for i in base_values: + if r != 0. or i != 0.: + test_values_non_zero.append(complex(r, i)) + if r != 0.: + test_values_non_zero.append(complex(-r, i)) + if i != 0.: + test_values_non_zero.append(complex(r, -i)) + if r != 0. and i != 0.: + test_values_non_zero.append(complex(-r, -i)) +test_values = [complex(0., 0.),] + test_values_non_zero +print(test_values) + +functions = [ + ('phase', phase, test_values), + ('polar', polar, test_values), + ('rect', rect, ((0, 0), (0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (-1, 1), (1, -1), (123., -456.))), + ('exp', exp, test_values), + ('log', log, test_values_non_zero), + ('sqrt', sqrt, test_values), + ('cos', cos, test_values), + ('sin', sin, test_values), +] + +for f_name, f, test_vals in functions: + print(f_name) + for val in test_vals: + if type(val) == tuple: + ret = f(*val) + else: + ret = f(val) + if type(ret) == float: + print("%.5g" % ret) + elif type(ret) == tuple: + print("%.5g %.5g" % ret) + else: + # some test (eg cmath.sqrt(-0.5)) disagree with CPython with tiny real part + real = ret.real + if abs(real) < 1e15: + real = 0. + print("complex(%.5g, %.5g)" % (real, ret.imag)) diff --git a/tests/float 2/cmath_fun_special.py b/tests/float 2/cmath_fun_special.py new file mode 100644 index 0000000000000..471fda8c0dc19 --- /dev/null +++ b/tests/float 2/cmath_fun_special.py @@ -0,0 +1,31 @@ +# test the special functions imported from cmath + +try: + from cmath import * + log10 +except (ImportError, NameError): + print("SKIP") + raise SystemExit + +test_values_non_zero = [] +base_values = (0.0, 0.5, 1.2345, 10.) +for r in base_values: + for i in base_values: + if r != 0. or i != 0.: + test_values_non_zero.append(complex(r, i)) + if r != 0.: + test_values_non_zero.append(complex(-r, i)) + if i != 0.: + test_values_non_zero.append(complex(r, -i)) + if r != 0. and i != 0.: + test_values_non_zero.append(complex(-r, -i)) + +functions = [ + ('log10', log10, test_values_non_zero), +] + +for f_name, f, test_vals in functions: + print(f_name) + for val in test_vals: + ret = f(val) + print("complex(%.5g, %.5g)" % (ret.real, ret.imag)) diff --git a/tests/float 2/complex1.py b/tests/float 2/complex1.py new file mode 100644 index 0000000000000..479b4b3485b26 --- /dev/null +++ b/tests/float 2/complex1.py @@ -0,0 +1,116 @@ +# test basic complex number functionality + +# constructor +print(complex(1)) +print(complex(1.2)) +print(complex(1.2j)) +print(complex("1")) +print(complex("1.2")) +print(complex("1.2j")) +print(complex(1, 2)) +print(complex(1j, 2j)) + +# unary ops +print(bool(1j)) +print(+(1j)) +print(-(1 + 2j)) + +# binary ops +print(1j + False) +print(1j + True) +print(1j + 2) +print(1j + 2j) +print(1j - 2) +print(1j - 2j) +print(1j * 2) +print(1j * 2j) +print(1j / 2) +print((1j / 2j).real) +print(1j / (1 + 2j)) +ans = 0j ** 0; print("%.5g %.5g" % (ans.real, ans.imag)) +ans = 0j ** 1; print("%.5g %.5g" % (ans.real, ans.imag)) +ans = 0j ** 0j; print("%.5g %.5g" % (ans.real, ans.imag)) +ans = 1j ** 2.5; print("%.5g %.5g" % (ans.real, ans.imag)) +ans = 1j ** 2.5j; print("%.5g %.5g" % (ans.real, ans.imag)) + +# comparison +print(1j == 1) +print(1j == 1j) + +# comparison of nan is special +nan = float('nan') * 1j +print(nan == 1j) +print(nan == nan) + +# builtin abs +print(abs(1j)) +print("%.5g" % abs(1j + 2)) + +# builtin hash +print(hash(1 + 0j)) +print(type(hash(1j))) + +# float on lhs should delegate to complex +print(1.2 + 3j) + +# negative base and fractional power should create a complex +ans = (-1) ** 2.3; print("%.5g %.5g" % (ans.real, ans.imag)) +ans = (-1.2) ** -3.4; print("%.5g %.5g" % (ans.real, ans.imag)) + +# check printing of inf/nan +print(float('nan') * 1j) +print(float('-nan') * 1j) +print(float('inf') * (1 + 1j)) +print(float('-inf') * (1 + 1j)) + +# can't assign to attributes +try: + (1j).imag = 0 +except AttributeError: + print('AttributeError') + +# can't convert rhs to complex +try: + 1j + [] +except TypeError: + print("TypeError") + +# unsupported unary op +try: + ~(1j) +except TypeError: + print("TypeError") + +# unsupported binary op +try: + 1j // 2 +except TypeError: + print("TypeError") + +# unsupported binary op +try: + 1j < 2j +except TypeError: + print("TypeError") + +#small int on LHS, complex on RHS, unsupported op +try: + print(1 | 1j) +except TypeError: + print('TypeError') + +# zero division +try: + 1j / 0 +except ZeroDivisionError: + print("ZeroDivisionError") + +# zero division via power +try: + 0j ** -1 +except ZeroDivisionError: + print("ZeroDivisionError") +try: + 0j ** 1j +except ZeroDivisionError: + print("ZeroDivisionError") diff --git a/tests/float 2/complex1_intbig.py b/tests/float 2/complex1_intbig.py new file mode 100644 index 0000000000000..ed2390bbaf24c --- /dev/null +++ b/tests/float 2/complex1_intbig.py @@ -0,0 +1,4 @@ +# test basic complex number functionality + +# convert bignum to complex on rhs +ans = 1j + (1 << 70); print("%.5g %.5g" % (ans.real, ans.imag)) diff --git a/tests/float 2/float1.py b/tests/float 2/float1.py new file mode 100644 index 0000000000000..54807e5ac9c27 --- /dev/null +++ b/tests/float 2/float1.py @@ -0,0 +1,119 @@ +# test basic float capabilities + +# literals +print(.12) +print(1.) +print(1.2) +print(0e0) +print(0e+0) +print(0e-0) + +# float construction +print(float(1.2)) +print(float("1.2")) +print(float("+1")) +print(float("1e1")) +print(float("1e+1")) +print(float("1e-1")) +print(float("inf")) +print(float("-inf")) +print(float("INF")) +print(float("infinity")) +print(float("INFINITY")) +print(float("nan")) +print(float("-nan")) +print(float("NaN")) +try: + float("") +except ValueError: + print("ValueError") +try: + float("1e+") +except ValueError: + print("ValueError") +try: + float("1z") +except ValueError: + print("ValueError") + +# construct from something with the buffer protocol +print(float(b"1.2")) +print(float(bytearray(b"3.4"))) + +# unary operators +print(bool(0.0)) +print(bool(1.2)) +print(+(1.2)) +print(-(1.2)) + +# division of integers +x = 1 / 2 +print(x) + +# /= operator +a = 1 +a /= 2 +print(a) + +# floor division +print(1.0 // 2) +print(2.0 // 2) + +# comparison +print(1.2 <= 3.4) +print(1.2 <= -3.4) +print(1.2 >= 3.4) +print(1.2 >= -3.4) + +# comparison of nan is special +nan = float('nan') +print(nan == 1.2) +print(nan == nan) + +try: + 1.0 / 0 +except ZeroDivisionError: + print("ZeroDivisionError") + +try: + 1.0 // 0 +except ZeroDivisionError: + print("ZeroDivisionError") + +try: + 1.2 % 0 +except ZeroDivisionError: + print("ZeroDivisionError") + +try: + 0.0 ** -1 +except ZeroDivisionError: + print("ZeroDivisionError") + +# unsupported unary ops + +try: + ~1.2 +except TypeError: + print("TypeError") + +try: + 1.2 in 3.4 +except TypeError: + print("TypeError") + +# small int on LHS, float on RHS, unsupported op +try: + print(1 | 1.0) +except TypeError: + print('TypeError') + +# can't convert list to float +try: + float([]) +except TypeError: + print("TypeError") + +# test constant float with more than 255 chars +x = 1.84728699436059052516398251149631771898472869943605905251639825114963177189847286994360590525163982511496317718984728699436059052516398251149631771898472869943605905251639825114963177189847286994360590525163982511496317718984728699436059052516398251149631771898472869943605905251639825114963177189 +print("%.5f" % x) diff --git a/tests/float 2/float2int_doubleprec_intbig.py b/tests/float 2/float2int_doubleprec_intbig.py new file mode 100644 index 0000000000000..de2137d66ca64 --- /dev/null +++ b/tests/float 2/float2int_doubleprec_intbig.py @@ -0,0 +1,100 @@ +# check cases converting float to int, requiring double precision float + +try: + import ustruct as struct +except: + import struct + +import sys +maxsize_bits = 0 +maxsize = sys.maxsize +while maxsize: + maxsize >>= 1 + maxsize_bits += 1 + +# work out configuration values +is_64bit = maxsize_bits > 32 +# 0 = none, 1 = long long, 2 = mpz +ll_type = None +if is_64bit: + if maxsize_bits < 63: + ll_type = 0 +else: + if maxsize_bits < 31: + ll_type = 0 +if ll_type is None: + one = 1 + if one << 65 < one << 62: + ll_type = 1 + else: + ll_type = 2 + +# This case occurs with time.time() values +if ll_type != 0: + print(int(1418774543.)) + print("%d" % 1418774543.) + if ll_type == 3: + print(int(2.**100)) + print("%d" % 2.**100) +else: + print(int(1073741823.)) + print("%d" % 1073741823.) + +testpass = True +p2_rng = ((30,63,1024),(62,63,1024))[is_64bit][ll_type] +for i in range(0,p2_rng): + bitcnt = len(bin(int(2.**i))) - 3; + if i != bitcnt: + print('fail: 2**%u was %u bits long' % (i, bitcnt)); + testpass = False +print("power of 2 test: %s" % (testpass and 'passed' or 'failed')) + +testpass = True +p10_rng = ((9,18,23),(18,18,23))[is_64bit][ll_type] +for i in range(0,p10_rng): + digcnt = len(str(int(10.**i))) - 1; + if i != digcnt: + print('fail: 10**%u was %u digits long' % (i, digcnt)); + testpass = False +print("power of 10 test: %s" % (testpass and 'passed' or 'failed')) + +def fp2int_test(num, name, should_fail): + try: + x = int(num) + passed = ~should_fail + except: + passed = should_fail + print('%s: %s' % (name, passed and 'passed' or 'failed')) + +if ll_type != 2: + if ll_type == 0: + if is_64bit: + neg_bad_fp = -1.00000005*2.**62. + pos_bad_fp = 2.**62. + neg_good_fp = -2.**62. + pos_good_fp = 0.99999993*2.**62. + else: + neg_bad_fp = -1.00000005*2.**30. + pos_bad_fp = 2.**30. + neg_good_fp = -2.**30. + pos_good_fp = 0.9999999499*2.**30. + else: + neg_bad_fp = -0.51*2.**64. + pos_bad_fp = 2.**63. + neg_good_fp = -2.**63. + pos_good_fp = 1.9999998*2.**62. + + fp2int_test(neg_bad_fp, 'neg bad', True) + fp2int_test(pos_bad_fp, 'pos bad', True) + fp2int_test(neg_good_fp, 'neg good', False) + fp2int_test(pos_good_fp, 'pos good', False) +else: + fp2int_test(-1.9999999999999981*2.**1023., 'large neg', False) + fp2int_test(1.9999999999999981*2.**1023., 'large pos', False) + +fp2int_test(float('inf'), 'inf test', True) +fp2int_test(float('nan'), 'NaN test', True) + +# test numbers < 1 (this used to fail; see issue #1044) +fp2int_test(0.0001, 'small num', False) +struct.pack('I', int(1/2)) diff --git a/tests/float 2/float2int_fp30_intbig.py b/tests/float 2/float2int_fp30_intbig.py new file mode 100644 index 0000000000000..fbb94a4ccc052 --- /dev/null +++ b/tests/float 2/float2int_fp30_intbig.py @@ -0,0 +1,97 @@ +# check cases converting float to int, relying only on single precision float + +try: + import ustruct as struct +except: + import struct + +import sys +maxsize_bits = 0 +maxsize = sys.maxsize +while maxsize: + maxsize >>= 1 + maxsize_bits += 1 + +# work out configuration values +is_64bit = maxsize_bits > 32 +# 0 = none, 1 = long long, 2 = mpz +ll_type = None +if is_64bit: + if maxsize_bits < 63: + ll_type = 0 +else: + if maxsize_bits < 31: + ll_type = 0 +if ll_type is None: + one = 1 + if one << 65 < one << 62: + ll_type = 1 + else: + ll_type = 2 + +# basic conversion +print(int(14187744.)) +print("%d" % 14187744.) +if ll_type == 2: + print(int(2.**100)) + print("%d" % 2.**100) + +testpass = True +p2_rng = ((30,63,127),(62,63,127))[is_64bit][ll_type] +for i in range(0,p2_rng): + bitcnt = len(bin(int(2.**i))) - 3; + if i != bitcnt: + print('fail: 2.**%u was %u bits long' % (i, bitcnt)); + testpass = False +print("power of 2 test: %s" % (testpass and 'passed' or 'failed')) + +# TODO why does 10**12 fail this test for single precision float? +testpass = True +p10_rng = 9 +for i in range(0,p10_rng): + digcnt = len(str(int(10.**i))) - 1; + if i != digcnt: + print('fail: 10.**%u was %u digits long' % (i, digcnt)); + testpass = False +print("power of 10 test: %s" % (testpass and 'passed' or 'failed')) + +def fp2int_test(num, name, should_fail): + try: + x = int(num) + passed = ~should_fail + except: + passed = should_fail + print('%s: %s' % (name, passed and 'passed' or 'failed')) + +if ll_type != 2: + if ll_type == 0: + if is_64bit: + neg_bad_fp = -1.00000005*2.**62. + pos_bad_fp = 2.**62. + neg_good_fp = -2.**62. + pos_good_fp = 0.99999993*2.**62. + else: + neg_bad_fp = -1.00000005*2.**30. + pos_bad_fp = 2.**30. + neg_good_fp = -2.**30. + pos_good_fp = 0.9999999499*2.**30. + else: + neg_bad_fp = -0.51*2.**64. + pos_bad_fp = 2.**63. + neg_good_fp = -2.**63. + pos_good_fp = 1.9999998*2.**62. + + fp2int_test(neg_bad_fp, 'neg bad', True) + fp2int_test(pos_bad_fp, 'pos bad', True) + fp2int_test(neg_good_fp, 'neg good', False) + fp2int_test(pos_good_fp, 'pos good', False) +else: + fp2int_test(-1.999999879*2.**126., 'large neg', False) + fp2int_test(1.999999879*2.**126., 'large pos', False) + +fp2int_test(float('inf'), 'inf test', True) +fp2int_test(float('nan'), 'NaN test', True) + +# test numbers < 1 (this used to fail; see issue #1044) +fp2int_test(0.0001, 'small num', False) +struct.pack('I', int(1/2)) diff --git a/tests/float 2/float2int_intbig.py b/tests/float 2/float2int_intbig.py new file mode 100644 index 0000000000000..3596d2f73da53 --- /dev/null +++ b/tests/float 2/float2int_intbig.py @@ -0,0 +1,99 @@ +# check cases converting float to int, relying only on single precision float + +try: + import ustruct as struct +except: + import struct + +import sys + +maxsize_bits = 0 +maxsize = sys.maxsize +while maxsize: + maxsize >>= 1 + maxsize_bits += 1 + +# work out configuration values +is_64bit = maxsize_bits > 32 +# 0 = none, 1 = long long, 2 = mpz +ll_type = None +if is_64bit: + if maxsize_bits < 63: + ll_type = 0 +else: + if maxsize_bits < 31: + ll_type = 0 +if ll_type is None: + one = 1 + if one << 65 < one << 62: + ll_type = 1 + else: + ll_type = 2 + + +# basic conversion +print(int(14187745.)) +print("%d" % 14187745.) +if ll_type == 2: + print(int(2.**100)) + print("%d" % 2.**100) + +testpass = True +p2_rng = ((30,63,127),(62,63,127))[is_64bit][ll_type] +for i in range(0,p2_rng): + bitcnt = len(bin(int(2.**i))) - 3; + if i != bitcnt: + print('fail: 2.**%u was %u bits long' % (i, bitcnt)); + testpass = False +print("power of 2 test: %s" % (testpass and 'passed' or 'failed')) + +# TODO why does 10**12 fail this test for single precision float? +testpass = True +p10_rng = 9 if (ll_type == 0 and ~is_64bit) else 11 +for i in range(0,p10_rng): + digcnt = len(str(int(10.**i))) - 1; + if i != digcnt: + print('fail: 10.**%u was %u digits long' % (i, digcnt)); + testpass = False +print("power of 10 test: %s" % (testpass and 'passed' or 'failed')) + +def fp2int_test(num, name, should_fail): + try: + x = int(num) + passed = ~should_fail + except: + passed = should_fail + print('%s: %s' % (name, passed and 'passed' or 'failed')) + +if ll_type != 2: + if ll_type == 0: + if is_64bit: + neg_bad_fp = -1.00000005*2.**62. + pos_bad_fp = 2.**62. + neg_good_fp = -2.**62. + pos_good_fp = 0.99999993*2.**62. + else: + neg_bad_fp = -1.00000005*2.**30. + pos_bad_fp = 2.**30. + neg_good_fp = -2.**30. + pos_good_fp = 0.9999999499*2.**30. + else: + neg_bad_fp = -0.51*2.**64. + pos_bad_fp = 2.**63. + neg_good_fp = -2.**63. + pos_good_fp = 1.9999998*2.**62. + + fp2int_test(neg_bad_fp, 'neg bad', True) + fp2int_test(pos_bad_fp, 'pos bad', True) + fp2int_test(neg_good_fp, 'neg good', False) + fp2int_test(pos_good_fp, 'pos good', False) +else: + fp2int_test(-1.999999879*2.**127., 'large neg', False) + fp2int_test(1.999999879*2.**127., 'large pos', False) + +fp2int_test(float('inf'), 'inf test', True) +fp2int_test(float('nan'), 'NaN test', True) + +# test numbers < 1 (this used to fail; see issue #1044) +fp2int_test(0.0001, 'small num', False) +struct.pack('I', int(1/2)) diff --git a/tests/float 2/float_array.py b/tests/float 2/float_array.py new file mode 100644 index 0000000000000..8c8edcff7c86b --- /dev/null +++ b/tests/float 2/float_array.py @@ -0,0 +1,20 @@ +try: + from array import array +except ImportError: + print("SKIP") + raise SystemExit + +def test(a): + print(a) + a.append(1.2) + print(len(a), '%.3f' % a[0]) + a.append(1) + a.append(False) + print(len(a), '%.3f %.3f' % (a[1], a[2])) + a[-1] = 3.45 + print('%.3f' % a[-1]) + +test(array('f')) +test(array('d')) + +print('{:.4f}'.format(array('f', b'\xcc\xcc\xcc=')[0])) diff --git a/tests/float 2/float_compare.py b/tests/float 2/float_compare.py new file mode 100644 index 0000000000000..105923ac733af --- /dev/null +++ b/tests/float 2/float_compare.py @@ -0,0 +1,22 @@ +# Extended float comparisons + +class Foo: + pass + +foo = Foo() + +print(foo == 1.0) +print(1.0 == foo) +print(1.0 == Foo) +print(1.0 == []) +print(1.0 == {}) + +try: + print(foo < 1.0) +except TypeError: + print("TypeError") + +try: + print(1.0 < foo) +except TypeError: + print("TypeError") diff --git a/tests/float 2/float_divmod.py b/tests/float 2/float_divmod.py new file mode 100644 index 0000000000000..8e7cd435a55e6 --- /dev/null +++ b/tests/float 2/float_divmod.py @@ -0,0 +1,25 @@ +# test floating point floor divide and modulus +# it has some tricky corner cases + +def test(x, y): + div, mod = divmod(x, y) + print('%.8f %.8f %.8f %.8f' % (x // y, x % y, div, mod)) + print(div == x // y, mod == x % y, abs(div * y + mod - x) < 1e-15) + +test(1.23456, 0.7) +test(-1.23456, 0.7) +test(1.23456, -0.7) +test(-1.23456, -0.7) + +a = 1.23456 +b = 0.7 +test(a, b) +test(a, -b) +test(-a, b) +test(-a, -b) + +for i in range(25): + x = (i - 12.5) / 6 + for j in range(25): + y = (j - 12.5) / 6 + test(x, y) diff --git a/tests/float 2/float_divmod_relaxed.py b/tests/float 2/float_divmod_relaxed.py new file mode 100644 index 0000000000000..a9450fa2c4d94 --- /dev/null +++ b/tests/float 2/float_divmod_relaxed.py @@ -0,0 +1,33 @@ +# test floating point floor divide and modulus +# it has some tricky corner cases + +# pyboard has 32-bit floating point and gives different (but still +# correct) answers for certain combinations of divmod arguments. + +def test(x, y): + div, mod = divmod(x, y) + print(div == x // y, mod == x % y, abs(div * y + mod - x) < 1e-6) + +test(1.23456, 0.7) +test(-1.23456, 0.7) +test(1.23456, -0.7) +test(-1.23456, -0.7) + +a = 1.23456 +b = 0.7 +test(a, b) +test(a, -b) +test(-a, b) +test(-a, -b) + +for i in range(25): + x = (i - 12.5) / 6 + for j in range(25): + y = (j - 12.5) / 6 + test(x, y) + +# test division by zero error +try: + divmod(1.0, 0) +except ZeroDivisionError: + print('ZeroDivisionError') diff --git a/tests/float 2/float_format.py b/tests/float 2/float_format.py new file mode 100644 index 0000000000000..d43535cf2ff4f --- /dev/null +++ b/tests/float 2/float_format.py @@ -0,0 +1,19 @@ +# test float formatting + +# general rounding +for val in (116, 1111, 1234, 5010, 11111): + print('%.0f' % val) + print('%.1f' % val) + print('%.3f' % val) + +# make sure rounding is done at the correct precision +for prec in range(8): + print(('%%.%df' % prec) % 6e-5) + +# check certain cases that had a digit value of 10 render as a ":" character +print('%.2e' % float('9' * 51 + 'e-39')) +print('%.2e' % float('9' * 40 + 'e-21')) + +# check a case that would render negative digit values, eg ")" characters +# the string is converted back to a float to check for no illegal characters +float('%.23e' % 1e-80) diff --git a/tests/float 2/float_parse.py b/tests/float 2/float_parse.py new file mode 100644 index 0000000000000..4b026de1c8103 --- /dev/null +++ b/tests/float 2/float_parse.py @@ -0,0 +1,32 @@ +# test parsing of floats + +inf = float('inf') + +# it shouldn't matter where the decimal point is if the exponent balances the value +print(float('1234') - float('0.1234e4')) +print(float('1.015625') - float('1015625e-6')) + +# very large integer part with a very negative exponent should cancel out +print('%.4e' % float('9' * 60 + 'e-60')) +print('%.4e' % float('9' * 60 + 'e-40')) + +# many fractional digits +print(float('.' + '9' * 70)) +print(float('.' + '9' * 70 + 'e20')) +print(float('.' + '9' * 70 + 'e-50') == float('1e-50')) + +# tiny fraction with large exponent +print(float('.' + '0' * 60 + '1e10') == float('1e-51')) +print(float('.' + '0' * 60 + '9e25') == float('9e-36')) +print(float('.' + '0' * 60 + '9e40') == float('9e-21')) + +# ensure that accuracy is retained when value is close to a subnormal +print(float('1.00000000000000000000e-37')) +print(float('10.0000000000000000000e-38')) +print(float('100.000000000000000000e-39')) + +# very large exponent literal +print(float('1e4294967301')) +print(float('1e-4294967301')) +print(float('1e18446744073709551621')) +print(float('1e-18446744073709551621')) diff --git a/tests/float 2/float_parse_doubleprec.py b/tests/float 2/float_parse_doubleprec.py new file mode 100644 index 0000000000000..dcc0dd5921544 --- /dev/null +++ b/tests/float 2/float_parse_doubleprec.py @@ -0,0 +1,21 @@ +# test parsing of floats, requiring double-precision + +# very large integer part with a very negative exponent should cancel out +print(float('9' * 400 + 'e-100')) +print(float('9' * 400 + 'e-200')) +print(float('9' * 400 + 'e-400')) + +# many fractional digits +print(float('.' + '9' * 400)) +print(float('.' + '9' * 400 + 'e100')) +print(float('.' + '9' * 400 + 'e-100')) + +# tiny fraction with large exponent +print('%.14e' % float('.' + '0' * 400 + '9e100')) +print('%.14e' % float('.' + '0' * 400 + '9e200')) +print('%.14e' % float('.' + '0' * 400 + '9e400')) + +# ensure that accuracy is retained when value is close to a subnormal +print(float('1.00000000000000000000e-307')) +print(float('10.0000000000000000000e-308')) +print(float('100.000000000000000000e-309')) diff --git a/tests/float 2/float_struct.py b/tests/float 2/float_struct.py new file mode 100644 index 0000000000000..dd7a418ad5fd4 --- /dev/null +++ b/tests/float 2/float_struct.py @@ -0,0 +1,17 @@ +# test struct package with floats +try: + try: + import ustruct as struct + except: + import struct +except ImportError: + print("SKIP") + raise SystemExit + +i = 1. + 1/2 +# TODO: it looks like '=' format modifier is not yet supported +# for fmt in ('f', 'd', '>f', '>d', 'f', '>d', '' + fmt.format(*args) + '<') + +test("{:10.4}", 123.456) +test("{:10.4e}", 123.456) +test("{:10.4e}", -123.456) +test("{:10.4f}", 123.456) +test("{:10.4f}", -123.456) +test("{:10.4g}", 123.456) +test("{:10.4g}", -123.456) +test("{:10.4n}", 123.456) +test("{:e}", 100) +test("{:f}", 200) +test("{:g}", 300) + +test("{:10.4E}", 123.456) +test("{:10.4E}", -123.456) +test("{:10.4F}", 123.456) +test("{:10.4F}", -123.456) +test("{:10.4G}", 123.456) +test("{:10.4G}", -123.456) + +test("{:06e}", float("inf")) +test("{:06e}", float("-inf")) +test("{:06e}", float("nan")) + +# The following fails right now +#test("{:10.1}", 0.0) + +print("%.0f" % (1.750000 % 0.08333333333)) +# Below isn't compatible with single-precision float +#print("%.1f" % (1.750000 % 0.08333333333)) +#print("%.2f" % (1.750000 % 0.08333333333)) +#print("%.12f" % (1.750000 % 0.08333333333)) + +# tests for errors in format string + +try: + '{:10.1b}'.format(0.0) +except ValueError: + print('ValueError') diff --git a/tests/float 2/string_format2.py b/tests/float 2/string_format2.py new file mode 100644 index 0000000000000..269023e7ffb62 --- /dev/null +++ b/tests/float 2/string_format2.py @@ -0,0 +1,106 @@ +# Change the following to True to get a much more comprehensive set of tests +# to run, albeit, which take considerably longer. + +full_tests = False + +def test(fmt, *args): + print('{:8s}'.format(fmt) + '>' + fmt.format(*args) + '<') + +def test_fmt(conv, fill, alignment, sign, prefix, width, precision, type, arg): + fmt = '{' + if conv: + fmt += '!' + fmt += conv + fmt += ':' + if alignment: + fmt += fill + fmt += alignment + fmt += sign + fmt += prefix + fmt += width + if precision: + fmt += '.' + fmt += precision + fmt += type + fmt += '}' + test(fmt, arg) + if fill == '0' and alignment == '=': + fmt = '{:' + fmt += sign + fmt += prefix + fmt += width + if precision: + fmt += '.' + fmt += precision + fmt += type + fmt += '}' + test(fmt, arg) + +eg_nums = (0.0, -0.0, 0.1, 1.234, 12.3459, 1.23456789, 123456789.0, -0.0, + -0.1, -1.234, -12.3459, 1e4, 1e-4, 1e5, 1e-5, 1e6, 1e-6, 1e10, + 1e37, -1e37, 1e-37, -1e-37, + 1.23456e8, 1.23456e7, 1.23456e6, 1.23456e5, 1.23456e4, 1.23456e3, 1.23456e2, 1.23456e1, 1.23456e0, + 1.23456e-1, 1.23456e-2, 1.23456e-3, 1.23456e-4, 1.23456e-5, 1.23456e-6, 1.23456e-7, 1.23456e-8, + -1.23456e8, -1.23456e7, -1.23456e6, -1.23456e5, -1.23456e4, -1.23456e3, -1.23456e2, -1.23456e1, -1.23456e0, + -1.23456e-1, -1.23456e-2, -1.23456e-3, -1.23456e-4, -1.23456e-5, -1.23456e-6, -1.23456e-7, -1.23456e-8) + +if full_tests: + for type in ('e', 'E', 'g', 'G', 'n'): + for width in ('', '4', '6', '8', '10'): + for alignment in ('', '<', '>', '=', '^'): + for fill in ('', '@', '0', ' '): + for sign in ('', '+', '-', ' '): + for prec in ('', '1', '3', '6'): + for num in eg_nums: + test_fmt('', fill, alignment, sign, '', width, prec, type, num) + +# Note: We use 1.23459 rather than 1.2345 because '{:3f}'.format(1.2345) +# rounds differently than print("%.3f", 1.2345); + +f_nums = (0.0, -0.0, 0.0001, 0.001, 0.01, 0.1, 1.0, 10.0, + 0.0012, 0.0123, 0.1234, 1.23459, 12.3456, + -0.0001, -0.001, -0.01, -0.1, -1.0, -10.0, + -0.0012, -0.0123, -0.1234, -1.23459, -12.3456) + +if full_tests: + for type in ('f', 'F'): + for width in ('', '4', '6', '8', '10'): + for alignment in ('', '<', '>', '=', '^'): + for fill in ('', ' ', '0', '@'): + for sign in ('', '+', '-', ' '): + # An empty precision defaults to 6, but when uPy is + # configured to use a float, we can only use a + # precision of 6 with numbers less than 10 and still + # get results that compare to CPython (which uses + # long doubles). + for prec in ('1', '2', '3'): + for num in f_nums: + test_fmt('', fill, alignment, sign, '', width, prec, type, num) + for num in int_nums2: + test_fmt('', fill, alignment, sign, '', width, '', type, num) + +pct_nums1 = (0.1, 0.58, 0.99, -0.1, -0.58, -0.99) +pct_nums2 = (True, False, 1, 0, -1) + +if full_tests: + type = '%' + for width in ('', '4', '6', '8', '10'): + for alignment in ('', '<', '>', '=', '^'): + for fill in ('', ' ', '0', '@'): + for sign in ('', '+', '-', ' '): + # An empty precision defaults to 6, but when uPy is + # configured to use a float, we can only use a + # precision of 6 with numbers less than 10 and still + # get results that compare to CPython (which uses + # long doubles). + for prec in ('1', '2', '3'): + for num in pct_nums1: + test_fmt('', fill, alignment, sign, '', width, prec, type, num) + for num in pct_nums2: + test_fmt('', fill, alignment, sign, '', width, '', type, num) +else: + for num in pct_nums1: + test_fmt('', '', '', '', '', '', '1', '%', num) + +# We don't currently test a type of '' with floats (see the detailed comment +# in objstr.c) diff --git a/tests/float 2/string_format_fp30.py b/tests/float 2/string_format_fp30.py new file mode 100644 index 0000000000000..77b2a528852c2 --- /dev/null +++ b/tests/float 2/string_format_fp30.py @@ -0,0 +1,41 @@ +def test(fmt, *args): + print('{:8s}'.format(fmt) + '>' + fmt.format(*args) + '<') + +test("{:10.4}", 123.456) +test("{:10.4e}", 123.456) +test("{:10.4e}", -123.456) +#test("{:10.4f}", 123.456) +#test("{:10.4f}", -123.456) +test("{:10.4g}", 123.456) +test("{:10.4g}", -123.456) +test("{:10.4n}", 123.456) +test("{:e}", 100) +test("{:f}", 200) +test("{:g}", 300) + +test("{:10.4E}", 123.456) +test("{:10.4E}", -123.456) +#test("{:10.4F}", 123.456) +#test("{:10.4F}", -123.456) +test("{:10.4G}", 123.456) +test("{:10.4G}", -123.456) + +test("{:06e}", float("inf")) +test("{:06e}", float("-inf")) +test("{:06e}", float("nan")) + +# The following fails right now +#test("{:10.1}", 0.0) + +print("%.0f" % (1.750000 % 0.08333333333)) +# Below isn't compatible with single-precision float +#print("%.1f" % (1.750000 % 0.08333333333)) +#print("%.2f" % (1.750000 % 0.08333333333)) +#print("%.12f" % (1.750000 % 0.08333333333)) + +# tests for errors in format string + +try: + '{:10.1b}'.format(0.0) +except ValueError: + print('ValueError') diff --git a/tests/float 2/string_format_modulo.py b/tests/float 2/string_format_modulo.py new file mode 100644 index 0000000000000..aea534247cc20 --- /dev/null +++ b/tests/float 2/string_format_modulo.py @@ -0,0 +1,49 @@ +print("%s" % 1.0) +print("%r" % 1.0) + +print("%d" % 1.0) +print("%i" % 1.0) +print("%u" % 1.0) + +# these 3 have different behaviour in Python 3.x versions +# uPy raises a TypeError, following Python 3.5 (earlier versions don't) +#print("%x" % 18.0) +#print("%o" % 18.0) +#print("%X" % 18.0) + +print("%e" % 1.23456) +print("%E" % 1.23456) +print("%f" % 1.23456) +print("%F" % 1.23456) +print("%g" % 1.23456) +print("%G" % 1.23456) + +print("%06e" % float("inf")) +print("%06e" % float("-inf")) +print("%06e" % float("nan")) + +print("%02.3d" % 123) # prec > width +print("%+f %+f" % (1.23, -1.23)) # float sign +print("% f % f" % (1.23, -1.23)) # float space sign +print("%0f" % -1.23) # negative number with 0 padding + +# numbers with large negative exponents +print('%f' % 1e-10) +print('%f' % 1e-20) +print('%f' % 1e-50) +print('%f' % 1e-100) +print('%f' % 1e-300) + +# large decimal precision should be truncated and not overflow buffer +# the output depends on the FP calculation so only first 2 digits are printed +# (the 'g' with small e are printed using 'f' style, so need to be checked) +print(('%.40f' % 1e-300)[:2]) +print(('%.40g' % 1e-1)[:2]) +print(('%.40g' % 1e-2)[:2]) +print(('%.40g' % 1e-3)[:2]) +print(('%.40g' % 1e-4)[:2]) + +print("%.0g" % 1) # 0 precision 'g' + +print('%.1e' % 9.99) # round up with positive exponent +print('%.1e' % 0.999) # round up with negative exponent diff --git a/tests/float 2/string_format_modulo2.py b/tests/float 2/string_format_modulo2.py new file mode 100644 index 0000000000000..f6b1ae537d5e4 --- /dev/null +++ b/tests/float 2/string_format_modulo2.py @@ -0,0 +1,24 @@ +# test formatting floats with large precision, that it doesn't overflow the buffer + +def test(num, num_str): + if num == float('inf') or num == 0.0 and num_str != '0.0': + # skip numbers that overflow or underflow the FP precision + return + for kind in ('e', 'f', 'g'): + # check precision either side of the size of the buffer (32 bytes) + for prec in range(23, 36, 2): + fmt = '%.' + '%d' % prec + kind + s = fmt % num + check = abs(float(s) - num) + if num > 1: + check /= num + if check > 1e-6: + print('FAIL', num_str, fmt, s, len(s), check) + +# check pure zero +test(0.0, '0.0') + +# check some powers of 10, making sure to include exponents with 3 digits +for e in range(-8, 8): + num = pow(10, e) + test(num, '1e%d' % e) diff --git a/tests/float 2/string_format_modulo2_intbig.py b/tests/float 2/string_format_modulo2_intbig.py new file mode 100644 index 0000000000000..9992ba65d9d3d --- /dev/null +++ b/tests/float 2/string_format_modulo2_intbig.py @@ -0,0 +1,21 @@ +# test formatting floats with large precision, that it doesn't overflow the buffer + +def test(num, num_str): + if num == float('inf') or num == 0.0 and num_str != '0.0': + # skip numbers that overflow or underflow the FP precision + return + for kind in ('e', 'f', 'g'): + # check precision either side of the size of the buffer (32 bytes) + for prec in range(23, 36, 2): + fmt = '%.' + '%d' % prec + kind + s = fmt % num + check = abs(float(s) - num) + if num > 1: + check /= num + if check > 1e-6: + print('FAIL', num_str, fmt, s, len(s), check) + +# check most powers of 10, making sure to include exponents with 3 digits +for e in range(-101, 102): + num = pow(10, e) + test(num, '1e%d' % e) diff --git a/tests/float 2/string_format_modulo3.py b/tests/float 2/string_format_modulo3.py new file mode 100644 index 0000000000000..5d26f25751d49 --- /dev/null +++ b/tests/float 2/string_format_modulo3.py @@ -0,0 +1,3 @@ +# uPy and CPython outputs differ for the following +print("%.1g" % -9.9) # round up 'g' with '-' sign +print("%.2g" % 99.9) # round up diff --git a/tests/float 2/string_format_modulo3.py.exp b/tests/float 2/string_format_modulo3.py.exp new file mode 100644 index 0000000000000..71432b3404519 --- /dev/null +++ b/tests/float 2/string_format_modulo3.py.exp @@ -0,0 +1,2 @@ +-10 +100 diff --git a/tests/float 2/true_value.py b/tests/float 2/true_value.py new file mode 100644 index 0000000000000..df415f0031db0 --- /dev/null +++ b/tests/float 2/true_value.py @@ -0,0 +1,7 @@ +# Test true-ish value handling + +if not 0.0: + print("float 0") + +if not 0+0j: + print("complex 0") diff --git a/tests/float 2/types.py b/tests/float 2/types.py new file mode 100644 index 0000000000000..75674c9246389 --- /dev/null +++ b/tests/float 2/types.py @@ -0,0 +1,17 @@ +# float types + +print(float) +print(complex) + +print(type(float()) == float) +print(type(complex()) == complex) + +print(type(0.0) == float) +print(type(1j) == complex) + +# hashing float types + +d = dict() +d[float] = complex +d[complex] = float +print(len(d)) diff --git a/tests/inlineasm 2/asmargs.py b/tests/inlineasm 2/asmargs.py new file mode 100644 index 0000000000000..047d9ed4200f1 --- /dev/null +++ b/tests/inlineasm 2/asmargs.py @@ -0,0 +1,29 @@ +# test passing arguments + +@micropython.asm_thumb +def arg0(): + mov(r0, 1) +print(arg0()) + +@micropython.asm_thumb +def arg1(r0): + add(r0, r0, 1) +print(arg1(1)) + +@micropython.asm_thumb +def arg2(r0, r1): + add(r0, r0, r1) +print(arg2(1, 2)) + +@micropython.asm_thumb +def arg3(r0, r1, r2): + add(r0, r0, r1) + add(r0, r0, r2) +print(arg3(1, 2, 3)) + +@micropython.asm_thumb +def arg4(r0, r1, r2, r3): + add(r0, r0, r1) + add(r0, r0, r2) + add(r0, r0, r3) +print(arg4(1, 2, 3, 4)) diff --git a/tests/inlineasm 2/asmargs.py.exp b/tests/inlineasm 2/asmargs.py.exp new file mode 100644 index 0000000000000..e33a6964f46e8 --- /dev/null +++ b/tests/inlineasm 2/asmargs.py.exp @@ -0,0 +1,5 @@ +1 +2 +3 +6 +10 diff --git a/tests/inlineasm 2/asmbcc.py b/tests/inlineasm 2/asmbcc.py new file mode 100644 index 0000000000000..540fa6591fb9d --- /dev/null +++ b/tests/inlineasm 2/asmbcc.py @@ -0,0 +1,27 @@ +# test bcc instructions +# at the moment only tests beq, narrow and wide versions + +@micropython.asm_thumb +def f(r0): + mov(r1, r0) + + mov(r0, 10) + cmp(r1, 1) + beq(end) + + mov(r0, 20) + cmp(r1, 2) + beq_n(end) + + mov(r0, 30) + cmp(r1, 3) + beq_w(end) + + mov(r0, 0) + + label(end) + +print(f(0)) +print(f(1)) +print(f(2)) +print(f(3)) diff --git a/tests/inlineasm 2/asmbcc.py.exp b/tests/inlineasm 2/asmbcc.py.exp new file mode 100644 index 0000000000000..39da7d1a99ee5 --- /dev/null +++ b/tests/inlineasm 2/asmbcc.py.exp @@ -0,0 +1,4 @@ +0 +10 +20 +30 diff --git a/tests/inlineasm 2/asmbitops.py b/tests/inlineasm 2/asmbitops.py new file mode 100644 index 0000000000000..8cf92b301f76d --- /dev/null +++ b/tests/inlineasm 2/asmbitops.py @@ -0,0 +1,13 @@ +@micropython.asm_thumb +def clz(r0): + clz(r0, r0) + +print(clz(0xf0)) +print(clz(0x8000)) + +@micropython.asm_thumb +def rbit(r0): + rbit(r0, r0) + +print(hex(rbit(0xf0))) +print(hex(rbit(0x8000))) diff --git a/tests/inlineasm 2/asmbitops.py.exp b/tests/inlineasm 2/asmbitops.py.exp new file mode 100644 index 0000000000000..8c560045f41ed --- /dev/null +++ b/tests/inlineasm 2/asmbitops.py.exp @@ -0,0 +1,4 @@ +24 +16 +0xf000000 +0x10000 diff --git a/tests/inlineasm 2/asmblbx.py b/tests/inlineasm 2/asmblbx.py new file mode 100644 index 0000000000000..d08c0ed6b3e03 --- /dev/null +++ b/tests/inlineasm 2/asmblbx.py @@ -0,0 +1,21 @@ +# test bl and bx instructions + +@micropython.asm_thumb +def f(r0): + # jump over the internal functions + b(entry) + + label(func1) + add(r0, 2) + bx(lr) + + label(func2) + sub(r0, 1) + bx(lr) + + label(entry) + bl(func1) + bl(func2) + +print(f(0)) +print(f(1)) diff --git a/tests/inlineasm 2/asmblbx.py.exp b/tests/inlineasm 2/asmblbx.py.exp new file mode 100644 index 0000000000000..1191247b6d9a2 --- /dev/null +++ b/tests/inlineasm 2/asmblbx.py.exp @@ -0,0 +1,2 @@ +1 +2 diff --git a/tests/inlineasm 2/asmconst.py b/tests/inlineasm 2/asmconst.py new file mode 100644 index 0000000000000..299a25093c7b3 --- /dev/null +++ b/tests/inlineasm 2/asmconst.py @@ -0,0 +1,8 @@ +# test constants in assembler + +@micropython.asm_thumb +def c1(): + movwt(r0, 0xffffffff) + movwt(r1, 0xf0000000) + sub(r0, r0, r1) +print(hex(c1())) diff --git a/tests/inlineasm 2/asmconst.py.exp b/tests/inlineasm 2/asmconst.py.exp new file mode 100644 index 0000000000000..3ef9fcabd7ec9 --- /dev/null +++ b/tests/inlineasm 2/asmconst.py.exp @@ -0,0 +1 @@ +0xfffffff diff --git a/tests/inlineasm 2/asmdiv.py b/tests/inlineasm 2/asmdiv.py new file mode 100644 index 0000000000000..b97d566eb54c1 --- /dev/null +++ b/tests/inlineasm 2/asmdiv.py @@ -0,0 +1,16 @@ +@micropython.asm_thumb +def sdiv(r0, r1): + sdiv(r0, r0, r1) + +@micropython.asm_thumb +def udiv(r0, r1): + udiv(r0, r0, r1) + +print(sdiv(1234, 3)) +print(sdiv(-1234, 3)) +print(sdiv(1234, -3)) +print(sdiv(-1234, -3)) + +print(udiv(1234, 3)) +print(udiv(0xffffffff, 0x7fffffff)) +print(udiv(0xffffffff, 0xffffffff)) diff --git a/tests/inlineasm 2/asmdiv.py.exp b/tests/inlineasm 2/asmdiv.py.exp new file mode 100644 index 0000000000000..f1b80deb327eb --- /dev/null +++ b/tests/inlineasm 2/asmdiv.py.exp @@ -0,0 +1,7 @@ +411 +-411 +-411 +411 +411 +2 +1 diff --git a/tests/inlineasm 2/asmfpaddsub.py b/tests/inlineasm 2/asmfpaddsub.py new file mode 100644 index 0000000000000..2bdfccf0e0cef --- /dev/null +++ b/tests/inlineasm 2/asmfpaddsub.py @@ -0,0 +1,14 @@ +@micropython.asm_thumb # r0 = r0+r1-r2 +def add_sub(r0, r1, r2): + vmov(s0, r0) + vcvt_f32_s32(s0, s0) + vmov(s1, r1) + vcvt_f32_s32(s1, s1) + vmov(s2, r2) + vcvt_f32_s32(s2, s2) + vadd(s0, s0, s1) + vsub(s0, s0, s2) + vcvt_s32_f32(s31, s0) + vmov(r0, s31) + +print(add_sub(100, 20, 30)) diff --git a/tests/inlineasm 2/asmfpaddsub.py.exp b/tests/inlineasm 2/asmfpaddsub.py.exp new file mode 100644 index 0000000000000..d61f00d8cad39 --- /dev/null +++ b/tests/inlineasm 2/asmfpaddsub.py.exp @@ -0,0 +1 @@ +90 diff --git a/tests/inlineasm 2/asmfpcmp.py b/tests/inlineasm 2/asmfpcmp.py new file mode 100644 index 0000000000000..d4fa1f2410cff --- /dev/null +++ b/tests/inlineasm 2/asmfpcmp.py @@ -0,0 +1,14 @@ +@micropython.asm_thumb # test vcmp, vmrs +def f(r0, r1): + vmov(s0, r0) + vcvt_f32_s32(s0, s0) + vmov(s1, r1) + vcvt_f32_s32(s1, s1) + vcmp(s1, s0) + vmrs(r0, FPSCR) + mov(r1, 28) + lsr(r0, r1) + +print(f(0,1)) +print(f(1,1)) +print(f(1,0)) diff --git a/tests/inlineasm 2/asmfpcmp.py.exp b/tests/inlineasm 2/asmfpcmp.py.exp new file mode 100644 index 0000000000000..104b3580f7687 --- /dev/null +++ b/tests/inlineasm 2/asmfpcmp.py.exp @@ -0,0 +1,3 @@ +2 +6 +8 diff --git a/tests/inlineasm 2/asmfpldrstr.py b/tests/inlineasm 2/asmfpldrstr.py new file mode 100644 index 0000000000000..4c480671f9fef --- /dev/null +++ b/tests/inlineasm 2/asmfpldrstr.py @@ -0,0 +1,11 @@ +import array +@micropython.asm_thumb # test vldr, vstr +def arrayadd(r0): + vldr(s0, [r0, 0]) + vldr(s1, [r0, 4]) + vadd(s2, s0, s1) + vstr(s2, [r0, 8]) + +z = array.array("f", [2, 4, 10]) +arrayadd(z) +print(z[2]) diff --git a/tests/inlineasm 2/asmfpldrstr.py.exp b/tests/inlineasm 2/asmfpldrstr.py.exp new file mode 100644 index 0000000000000..e0ea36feef6e8 --- /dev/null +++ b/tests/inlineasm 2/asmfpldrstr.py.exp @@ -0,0 +1 @@ +6.0 diff --git a/tests/inlineasm 2/asmfpmuldiv.py b/tests/inlineasm 2/asmfpmuldiv.py new file mode 100644 index 0000000000000..043a28e22985e --- /dev/null +++ b/tests/inlineasm 2/asmfpmuldiv.py @@ -0,0 +1,14 @@ +@micropython.asm_thumb # r0 = (int)(r0*r1/r2) +def muldiv(r0, r1, r2): + vmov(s0, r0) + vcvt_f32_s32(s0, s0) + vmov(s1, r1) + vcvt_f32_s32(s1, s1) + vmov(s2, r2) + vcvt_f32_s32(s2, s2) + vmul(s7, s0, s1) + vdiv(s8, s7, s2) + vcvt_s32_f32(s31, s8) + vmov(r0, s31) + +print(muldiv(100, 10, 50)) diff --git a/tests/inlineasm 2/asmfpmuldiv.py.exp b/tests/inlineasm 2/asmfpmuldiv.py.exp new file mode 100644 index 0000000000000..209e3ef4b6247 --- /dev/null +++ b/tests/inlineasm 2/asmfpmuldiv.py.exp @@ -0,0 +1 @@ +20 diff --git a/tests/inlineasm 2/asmfpsqrt.py b/tests/inlineasm 2/asmfpsqrt.py new file mode 100644 index 0000000000000..7b7d52e2380a8 --- /dev/null +++ b/tests/inlineasm 2/asmfpsqrt.py @@ -0,0 +1,14 @@ +# test vsqrt, vneg +@micropython.asm_thumb # r0 = -(int)(sqrt(r0)*r1) +def sqrt_test(r0, r1): + vmov(s1, r0) + vcvt_f32_s32(s1, s1) + vsqrt(s1, s1) + vmov(s2, r1) + vcvt_f32_s32(s2, s2) + vmul(s0, s1, s2) + vneg(s7, s0) + vcvt_s32_f32(s31, s7) + vmov(r0, s31) + +print(sqrt_test(256, 10)) diff --git a/tests/inlineasm 2/asmfpsqrt.py.exp b/tests/inlineasm 2/asmfpsqrt.py.exp new file mode 100644 index 0000000000000..88a1e93bab2f0 --- /dev/null +++ b/tests/inlineasm 2/asmfpsqrt.py.exp @@ -0,0 +1 @@ +-160 diff --git a/tests/inlineasm 2/asmit.py b/tests/inlineasm 2/asmit.py new file mode 100644 index 0000000000000..57bfcc7f9ad86 --- /dev/null +++ b/tests/inlineasm 2/asmit.py @@ -0,0 +1,16 @@ +# test it instruction + +@micropython.asm_thumb +def f(r0, r1): + cmp(r0, r1) + it(eq) + mov(r0, 100) +print(f(0, 0), f(1, 2)) + +@micropython.asm_thumb +def g(r0, r1): + cmp(r0, r1) + ite(eq) + mov(r0, 100) + mov(r0, 200) +print(g(0, 0), g(0, 1)) diff --git a/tests/inlineasm 2/asmit.py.exp b/tests/inlineasm 2/asmit.py.exp new file mode 100644 index 0000000000000..d06c72d9bbaa8 --- /dev/null +++ b/tests/inlineasm 2/asmit.py.exp @@ -0,0 +1,2 @@ +100 1 +100 200 diff --git a/tests/inlineasm 2/asmpushpop.py b/tests/inlineasm 2/asmpushpop.py new file mode 100644 index 0000000000000..c9005434ba477 --- /dev/null +++ b/tests/inlineasm 2/asmpushpop.py @@ -0,0 +1,8 @@ +@micropython.asm_thumb +def f(r0, r1, r2): + push({r0}) + push({r1, r2}) + pop({r0}) + pop({r1, r2}) + +print(f(0, 1, 2)) diff --git a/tests/inlineasm 2/asmpushpop.py.exp b/tests/inlineasm 2/asmpushpop.py.exp new file mode 100644 index 0000000000000..d00491fd7e5bb --- /dev/null +++ b/tests/inlineasm 2/asmpushpop.py.exp @@ -0,0 +1 @@ +1 diff --git a/tests/inlineasm 2/asmrettype.py b/tests/inlineasm 2/asmrettype.py new file mode 100644 index 0000000000000..f1918696eeaeb --- /dev/null +++ b/tests/inlineasm 2/asmrettype.py @@ -0,0 +1,21 @@ +# test return type of inline asm + +@micropython.asm_thumb +def ret_obj(r0) -> object: + pass +ret_obj(print)(1) + +@micropython.asm_thumb +def ret_bool(r0) -> bool: + pass +print(ret_bool(0), ret_bool(1)) + +@micropython.asm_thumb +def ret_int(r0) -> int: + lsl(r0, r0, 29) +print(ret_int(0), hex(ret_int(1)), hex(ret_int(2)), hex(ret_int(4))) + +@micropython.asm_thumb +def ret_uint(r0) -> uint: + lsl(r0, r0, 29) +print(ret_uint(0), hex(ret_uint(1)), hex(ret_uint(2)), hex(ret_uint(4))) diff --git a/tests/inlineasm 2/asmrettype.py.exp b/tests/inlineasm 2/asmrettype.py.exp new file mode 100644 index 0000000000000..cbb49d24724ec --- /dev/null +++ b/tests/inlineasm 2/asmrettype.py.exp @@ -0,0 +1,4 @@ +1 +False True +0 0x20000000 0x40000000 -0x80000000 +0 0x20000000 0x40000000 0x80000000 diff --git a/tests/inlineasm 2/asmshift.py b/tests/inlineasm 2/asmshift.py new file mode 100644 index 0000000000000..0df2187347068 --- /dev/null +++ b/tests/inlineasm 2/asmshift.py @@ -0,0 +1,29 @@ +@micropython.asm_thumb +def lsl1(r0): + lsl(r0, r0, 1) +print(hex(lsl1(0x123))) + +@micropython.asm_thumb +def lsl23(r0): + lsl(r0, r0, 23) +print(hex(lsl23(1))) + +@micropython.asm_thumb +def lsr1(r0): + lsr(r0, r0, 1) +print(hex(lsr1(0x123))) + +@micropython.asm_thumb +def lsr31(r0): + lsr(r0, r0, 31) +print(hex(lsr31(0x80000000))) + +@micropython.asm_thumb +def asr1(r0): + asr(r0, r0, 1) +print(hex(asr1(0x123))) + +@micropython.asm_thumb +def asr31(r0): + asr(r0, r0, 31) +print(hex(asr31(0x80000000))) diff --git a/tests/inlineasm 2/asmshift.py.exp b/tests/inlineasm 2/asmshift.py.exp new file mode 100644 index 0000000000000..c6c3a7217935d --- /dev/null +++ b/tests/inlineasm 2/asmshift.py.exp @@ -0,0 +1,6 @@ +0x246 +0x800000 +0x91 +0x1 +0x91 +-0x1 diff --git a/tests/inlineasm 2/asmspecialregs.py b/tests/inlineasm 2/asmspecialregs.py new file mode 100644 index 0000000000000..2d3b0e396f41f --- /dev/null +++ b/tests/inlineasm 2/asmspecialregs.py @@ -0,0 +1,10 @@ +@micropython.asm_thumb +def getIPSR(): + mrs(r0, IPSR) + +@micropython.asm_thumb +def getBASEPRI(): + mrs(r0, BASEPRI) + +print(getBASEPRI()) +print(getIPSR()) diff --git a/tests/inlineasm 2/asmspecialregs.py.exp b/tests/inlineasm 2/asmspecialregs.py.exp new file mode 100644 index 0000000000000..aa47d0d46d47a --- /dev/null +++ b/tests/inlineasm 2/asmspecialregs.py.exp @@ -0,0 +1,2 @@ +0 +0 diff --git a/tests/inlineasm 2/asmsum.py b/tests/inlineasm 2/asmsum.py new file mode 100644 index 0000000000000..07e71c7384927 --- /dev/null +++ b/tests/inlineasm 2/asmsum.py @@ -0,0 +1,57 @@ +@micropython.asm_thumb +def asm_sum_words(r0, r1): + + # r0 = len + # r1 = ptr + # r2 = sum + # r3 = dummy + mov(r2, 0) + + b(loop_entry) + + label(loop1) + ldr(r3, [r1, 0]) + add(r2, r2, r3) + + add(r1, r1, 4) + sub(r0, r0, 1) + + label(loop_entry) + cmp(r0, 0) + bgt(loop1) + + mov(r0, r2) + +@micropython.asm_thumb +def asm_sum_bytes(r0, r1): + + # r0 = len + # r1 = ptr + # r2 = sum + # r3 = dummy + mov(r2, 0) + + b(loop_entry) + + label(loop1) + ldrb(r3, [r1, 0]) + add(r2, r2, r3) + + add(r1, r1, 1) + sub(r0, r0, 1) + + label(loop_entry) + cmp(r0, 0) + bgt(loop1) + + mov(r0, r2) + +import array + +b = array.array('l', (100, 200, 300, 400)) +n = asm_sum_words(len(b), b) +print(b, n) + +b = array.array('b', (10, 20, 30, 40, 50, 60, 70, 80)) +n = asm_sum_bytes(len(b), b) +print(b, n) diff --git a/tests/inlineasm 2/asmsum.py.exp b/tests/inlineasm 2/asmsum.py.exp new file mode 100644 index 0000000000000..d50a94c8db622 --- /dev/null +++ b/tests/inlineasm 2/asmsum.py.exp @@ -0,0 +1,2 @@ +array('l', [100, 200, 300, 400]) 1000 +array('b', [10, 20, 30, 40, 50, 60, 70, 80]) 360 diff --git a/tests/io/data/file1 2 b/tests/io/data/file1 2 new file mode 100644 index 0000000000000..e08206337f385 --- /dev/null +++ b/tests/io/data/file1 2 @@ -0,0 +1,3 @@ +longer line1 +line2 +line3 diff --git a/tests/jni 2/README b/tests/jni 2/README new file mode 100644 index 0000000000000..a0689e92447b6 --- /dev/null +++ b/tests/jni 2/README @@ -0,0 +1,11 @@ +Running "jni" module tests (as well as just using this module) requires +being able to load libjvm.so, which requires path to it set via +LD_LIBRARY_PATH environment variable. This path is not set automatically +and there is no easy way to guess it, because there can be installed +different implementations of JVM, for one implementation, there can be +different versions, and single version may include different variants +of JVM. + +For example, for OpenJDK 7 on x86_64, following may work: + +LD_LIBRARY_PATH=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server ./run-tests jni/*.py diff --git a/tests/jni 2/list.py b/tests/jni 2/list.py new file mode 100644 index 0000000000000..d58181d0bad0e --- /dev/null +++ b/tests/jni 2/list.py @@ -0,0 +1,15 @@ +import jni +try: + ArrayList = jni.cls("java/util/ArrayList") +except: + print("SKIP") + raise SystemExit + +l = ArrayList() +print(l) +l.add("one") +l.add("two") + +print(l.toString()) +print(l) +print(l[0], l[1]) diff --git a/tests/jni 2/list.py.exp b/tests/jni 2/list.py.exp new file mode 100644 index 0000000000000..cc34bb0a21c64 --- /dev/null +++ b/tests/jni 2/list.py.exp @@ -0,0 +1,4 @@ +[] +[one, two] +[one, two] +one two diff --git a/tests/jni 2/object.py b/tests/jni 2/object.py new file mode 100644 index 0000000000000..aa67615ec8a83 --- /dev/null +++ b/tests/jni 2/object.py @@ -0,0 +1,15 @@ +import jni +try: + Integer = jni.cls("java/lang/Integer") +except: + print("SKIP") + raise SystemExit + +# Create object +i = Integer(42) +print(i) +# Call object method +print(i.hashCode()) +# Pass object to another method +System = jni.cls("java/lang/System") +System.out.println(i) diff --git a/tests/jni 2/object.py.exp b/tests/jni 2/object.py.exp new file mode 100644 index 0000000000000..bda709ecfb472 --- /dev/null +++ b/tests/jni 2/object.py.exp @@ -0,0 +1,3 @@ +42 +42 +42 diff --git a/tests/jni 2/system_out.py b/tests/jni 2/system_out.py new file mode 100644 index 0000000000000..86c4b9e112163 --- /dev/null +++ b/tests/jni 2/system_out.py @@ -0,0 +1,8 @@ +try: + import jni + System = jni.cls("java/lang/System") +except: + print("SKIP") + raise SystemExit + +System.out.println("Hello, Java!") diff --git a/tests/jni 2/system_out.py.exp b/tests/jni 2/system_out.py.exp new file mode 100644 index 0000000000000..01dd954f9067a --- /dev/null +++ b/tests/jni 2/system_out.py.exp @@ -0,0 +1 @@ +Hello, Java! diff --git a/tests/net_hosted 2/README b/tests/net_hosted 2/README new file mode 100644 index 0000000000000..724dd61584a5e --- /dev/null +++ b/tests/net_hosted 2/README @@ -0,0 +1,11 @@ +This directory contains network tests which require just "peer to peer" +network connection between test host and device under test, instead of +full Internet connection. + +Note that setup for these tests and tests themselves are WIP, and may +not yet fully correspond to the functional specification above. + +So far, these tests are not run as part of the main testsuite and need +to be run seperately (from the main test/ directory): + + ./run-tests net_hosted/*.py diff --git a/tests/net_hosted 2/accept_nonblock.py b/tests/net_hosted 2/accept_nonblock.py new file mode 100644 index 0000000000000..56f3288e28e68 --- /dev/null +++ b/tests/net_hosted 2/accept_nonblock.py @@ -0,0 +1,16 @@ +# test that socket.accept() on a non-blocking socket raises EAGAIN + +try: + import usocket as socket +except: + import socket + +s = socket.socket() +s.bind(socket.getaddrinfo('127.0.0.1', 8123)[0][-1]) +s.setblocking(False) +s.listen(1) +try: + s.accept() +except OSError as er: + print(er.args[0] == 11) # 11 is EAGAIN +s.close() diff --git a/tests/net_hosted 2/accept_nonblock.py.exp b/tests/net_hosted 2/accept_nonblock.py.exp new file mode 100644 index 0000000000000..0ca95142bb715 --- /dev/null +++ b/tests/net_hosted 2/accept_nonblock.py.exp @@ -0,0 +1 @@ +True diff --git a/tests/net_hosted 2/accept_timeout.py b/tests/net_hosted 2/accept_timeout.py new file mode 100644 index 0000000000000..44b3b8c7cdbd0 --- /dev/null +++ b/tests/net_hosted 2/accept_timeout.py @@ -0,0 +1,22 @@ +# test that socket.accept() on a socket with timeout raises ETIMEDOUT + +try: + import usocket as socket +except: + import socket + +try: + socket.socket.settimeout +except AttributeError: + print('SKIP') + raise SystemExit + +s = socket.socket() +s.bind(socket.getaddrinfo('127.0.0.1', 8123)[0][-1]) +s.settimeout(1) +s.listen(1) +try: + s.accept() +except OSError as er: + print(er.args[0] in (110, 'timed out')) # 110 is ETIMEDOUT; CPython uses a string +s.close() diff --git a/tests/net_hosted 2/accept_timeout.py.exp b/tests/net_hosted 2/accept_timeout.py.exp new file mode 100644 index 0000000000000..0ca95142bb715 --- /dev/null +++ b/tests/net_hosted 2/accept_timeout.py.exp @@ -0,0 +1 @@ +True diff --git a/tests/net_hosted 2/connect_nonblock.py b/tests/net_hosted 2/connect_nonblock.py new file mode 100644 index 0000000000000..6479978bea67c --- /dev/null +++ b/tests/net_hosted 2/connect_nonblock.py @@ -0,0 +1,20 @@ +# test that socket.connect() on a non-blocking socket raises EINPROGRESS + +try: + import usocket as socket +except: + import socket + + +def test(peer_addr): + s = socket.socket() + s.setblocking(False) + try: + s.connect(peer_addr) + except OSError as er: + print(er.args[0] == 115) # 115 is EINPROGRESS + s.close() + + +if __name__ == "__main__": + test(socket.getaddrinfo('micropython.org', 80)[0][-1]) diff --git a/tests/net_hosted 2/connect_nonblock.py.exp b/tests/net_hosted 2/connect_nonblock.py.exp new file mode 100644 index 0000000000000..0ca95142bb715 --- /dev/null +++ b/tests/net_hosted 2/connect_nonblock.py.exp @@ -0,0 +1 @@ +True diff --git a/tests/net_hosted 2/connect_poll.py b/tests/net_hosted 2/connect_poll.py new file mode 100644 index 0000000000000..ece6aa0da9721 --- /dev/null +++ b/tests/net_hosted 2/connect_poll.py @@ -0,0 +1,32 @@ +# test that socket.connect() has correct polling behaviour before, during and after + +try: + import usocket as socket, uselect as select +except: + import socket, select + + +def test(peer_addr): + s = socket.socket() + poller = select.poll() + poller.register(s) + + # test poll before connect + # note: CPython can return POLLHUP, so use the IN|OUT mask + p = poller.poll(0) + print(len(p), p[0][-1] & (select.POLLIN | select.POLLOUT)) + + s.connect(peer_addr) + + # test poll during connection + print(len(poller.poll(0))) + + # test poll after connection is established + p = poller.poll(1000) + print(len(p), p[0][-1]) + + s.close() + + +if __name__ == "__main__": + test(socket.getaddrinfo('micropython.org', 80)[0][-1]) diff --git a/tests/net_hosted 2/connect_poll.py.exp b/tests/net_hosted 2/connect_poll.py.exp new file mode 100644 index 0000000000000..cdf520e090bb7 --- /dev/null +++ b/tests/net_hosted 2/connect_poll.py.exp @@ -0,0 +1,3 @@ +1 4 +1 +1 4 diff --git a/tests/net_hosted 2/ssl_getpeercert.py b/tests/net_hosted 2/ssl_getpeercert.py new file mode 100644 index 0000000000000..e265c830d0d92 --- /dev/null +++ b/tests/net_hosted 2/ssl_getpeercert.py @@ -0,0 +1,21 @@ +# test ssl.getpeercert() method + +try: + import usocket as socket + import ussl as ssl +except: + import socket + import ssl + + +def test(peer_addr): + s = socket.socket() + s.connect(peer_addr) + s = ssl.wrap_socket(s) + cert = s.getpeercert(True) + print(type(cert), len(cert) > 100) + s.close() + + +if __name__ == "__main__": + test(socket.getaddrinfo('micropython.org', 443)[0][-1]) diff --git a/tests/net_hosted 2/ssl_getpeercert.py.exp b/tests/net_hosted 2/ssl_getpeercert.py.exp new file mode 100644 index 0000000000000..ff7ef5adf1bbb --- /dev/null +++ b/tests/net_hosted 2/ssl_getpeercert.py.exp @@ -0,0 +1 @@ + True diff --git a/tests/net_inet 2/README b/tests/net_inet 2/README new file mode 100644 index 0000000000000..9a5614efa6429 --- /dev/null +++ b/tests/net_inet 2/README @@ -0,0 +1,5 @@ +This directory contains network tests which require Internet connection. +Note that these tests are not run as part of the main testsuite and need +to be run seperately (from the main test/ directory): + + ./run-tests net_inet/*.py diff --git a/tests/net_inet 2/test_tls_sites.py b/tests/net_inet 2/test_tls_sites.py new file mode 100644 index 0000000000000..bf8071d0878a7 --- /dev/null +++ b/tests/net_inet 2/test_tls_sites.py @@ -0,0 +1,59 @@ +try: + import usocket as _socket +except: + import _socket +try: + import ussl as ssl +except: + import ssl + # CPython only supports server_hostname with SSLContext + ssl = ssl.SSLContext() + + +def test_one(site, opts): + ai = _socket.getaddrinfo(site, 443) + addr = ai[0][-1] + + s = _socket.socket() + + try: + s.connect(addr) + + if "sni" in opts: + s = ssl.wrap_socket(s, server_hostname=opts["host"]) + else: + s = ssl.wrap_socket(s) + + s.write(b"GET / HTTP/1.0\r\nHost: %s\r\n\r\n" % bytes(site, 'latin')) + resp = s.read(4096) +# print(resp) + + finally: + s.close() + + +SITES = [ + "google.com", + "www.google.com", + "api.telegram.org", + {"host": "api.pushbullet.com", "sni": True}, +# "w9rybpfril.execute-api.ap-southeast-2.amazonaws.com", + {"host": "w9rybpfril.execute-api.ap-southeast-2.amazonaws.com", "sni": True}, +] + + +def main(): + for site in SITES: + opts = {} + if isinstance(site, dict): + opts = site + site = opts["host"] + + try: + test_one(site, opts) + print(site, "ok") + except Exception as e: + print(site, repr(e)) + + +main() diff --git a/tests/net_inet 2/test_tls_sites.py.exp b/tests/net_inet 2/test_tls_sites.py.exp new file mode 100644 index 0000000000000..2f3c113d2f9ac --- /dev/null +++ b/tests/net_inet 2/test_tls_sites.py.exp @@ -0,0 +1,5 @@ +google.com ok +www.google.com ok +api.telegram.org ok +api.pushbullet.com ok +w9rybpfril.execute-api.ap-southeast-2.amazonaws.com ok diff --git a/tests/run-bench-tests 2 b/tests/run-bench-tests 2 new file mode 100755 index 0000000000000..f4a6776cbc29a --- /dev/null +++ b/tests/run-bench-tests 2 @@ -0,0 +1,97 @@ +#! /usr/bin/env python3 + +import os +import subprocess +import sys +import argparse +import re +from glob import glob +from collections import defaultdict + +# Tests require at least CPython 3.3. If your default python3 executable +# is of lower version, you can point MICROPY_CPYTHON3 environment var +# to the correct executable. +if os.name == 'nt': + CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3.exe') + MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../ports/windows/micropython.exe') +else: + CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3') + MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../ports/unix/micropython') + +def run_tests(pyb, test_dict): + test_count = 0 + testcase_count = 0 + + for base_test, tests in sorted(test_dict.items()): + print(base_test + ":") + for test_file in tests: + + # run MicroPython + if pyb is None: + # run on PC + try: + output_mupy = subprocess.check_output([MICROPYTHON, '-X', 'emit=bytecode', test_file[0]]) + except subprocess.CalledProcessError: + output_mupy = b'CRASH' + else: + # run on pyboard + pyb.enter_raw_repl() + try: + output_mupy = pyb.execfile(test_file).replace(b'\r\n', b'\n') + except pyboard.PyboardError: + output_mupy = b'CRASH' + + output_mupy = float(output_mupy.strip()) + test_file[1] = output_mupy + testcase_count += 1 + + test_count += 1 + baseline = None + for t in tests: + if baseline is None: + baseline = t[1] + print(" %.3fs (%+06.2f%%) %s" % (t[1], (t[1] * 100 / baseline) - 100, t[0])) + + print("{} tests performed ({} individual testcases)".format(test_count, testcase_count)) + + # all tests succeeded + return True + +def main(): + cmd_parser = argparse.ArgumentParser(description='Run tests for MicroPython.') + cmd_parser.add_argument('--pyboard', action='store_true', help='run the tests on the pyboard') + cmd_parser.add_argument('files', nargs='*', help='input test files') + args = cmd_parser.parse_args() + + # Note pyboard support is copied over from run-tests, not testes, and likely needs revamping + if args.pyboard: + import pyboard + pyb = pyboard.Pyboard('/dev/ttyACM0') + pyb.enter_raw_repl() + else: + pyb = None + + if len(args.files) == 0: + if pyb is None: + # run PC tests + test_dirs = ('bench',) + else: + # run pyboard tests + test_dirs = ('basics', 'float', 'pyb') + tests = sorted(test_file for test_files in (glob('{}/*.py'.format(dir)) for dir in test_dirs) for test_file in test_files) + else: + # tests explicitly given + tests = sorted(args.files) + + test_dict = defaultdict(lambda: []) + for t in tests: + m = re.match(r"(.+?)-(.+)\.py", t) + if not m: + continue + test_dict[m.group(1)].append([t, None]) + + if not run_tests(pyb, test_dict): + sys.exit(1) + +if __name__ == "__main__": + main() diff --git a/tests/run-tests 2 b/tests/run-tests 2 new file mode 100755 index 0000000000000..e28600361bcc0 --- /dev/null +++ b/tests/run-tests 2 @@ -0,0 +1,615 @@ +#! /usr/bin/env python3 + +import os +import subprocess +import sys +import platform +import argparse +import re +import threading +import multiprocessing +from multiprocessing.pool import ThreadPool +from glob import glob + +# Tests require at least CPython 3.3. If your default python3 executable +# is of lower version, you can point MICROPY_CPYTHON3 environment var +# to the correct executable. +if os.name == 'nt': + CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3.exe') + MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../ports/windows/micropython.exe') +else: + CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3') + MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../ports/unix/micropython') + +# mpy-cross is only needed if --via-mpy command-line arg is passed +MPYCROSS = os.getenv('MICROPY_MPYCROSS', '../mpy-cross/mpy-cross') + +# Set PYTHONIOENCODING so that CPython will use utf-8 on systems which set another encoding in the locale +os.environ['PYTHONIOENCODING'] = 'utf-8' + +def rm_f(fname): + if os.path.exists(fname): + os.remove(fname) + + +# unescape wanted regex chars and escape unwanted ones +def convert_regex_escapes(line): + cs = [] + escape = False + for c in str(line, 'utf8'): + if escape: + escape = False + cs.append(c) + elif c == '\\': + escape = True + elif c in ('(', ')', '[', ']', '{', '}', '.', '*', '+', '^', '$'): + cs.append('\\' + c) + else: + cs.append(c) + # accept carriage-return(s) before final newline + if cs[-1] == '\n': + cs[-1] = '\r*\n' + return bytes(''.join(cs), 'utf8') + + +def run_micropython(pyb, args, test_file, is_special=False): + special_tests = ( + 'micropython/meminfo.py', 'basics/bytes_compare3.py', + 'basics/builtin_help.py', 'thread/thread_exc2.py', + ) + had_crash = False + if pyb is None: + # run on PC + if test_file.startswith(('cmdline/', 'feature_check/')) or test_file in special_tests: + # special handling for tests of the unix cmdline program + is_special = True + + if is_special: + # check for any cmdline options needed for this test + args = [MICROPYTHON] + with open(test_file, 'rb') as f: + line = f.readline() + if line.startswith(b'# cmdline:'): + # subprocess.check_output on Windows only accepts strings, not bytes + args += [str(c, 'utf-8') for c in line[10:].strip().split()] + + # run the test, possibly with redirected input + try: + if 'repl_' in test_file: + # Need to use a PTY to test command line editing + try: + import pty + except ImportError: + # in case pty module is not available, like on Windows + return b'SKIP\n' + import select + + def get(required=False): + rv = b'' + while True: + ready = select.select([emulator], [], [], 0.02) + if ready[0] == [emulator]: + rv += os.read(emulator, 1024) + else: + if not required or rv: + return rv + + def send_get(what): + os.write(emulator, what) + return get() + + with open(test_file, 'rb') as f: + # instead of: output_mupy = subprocess.check_output(args, stdin=f) + # openpty returns two read/write file descriptors. The first one is + # used by the program which provides the virtual + # terminal service, and the second one is used by the + # subprogram which requires a tty to work. + emulator, subterminal = pty.openpty() + p = subprocess.Popen(args, stdin=subterminal, stdout=subterminal, + stderr=subprocess.STDOUT, bufsize=0) + banner = get(True) + output_mupy = banner + b''.join(send_get(line) for line in f) + send_get(b'\x04') # exit the REPL, so coverage info is saved + p.kill() + os.close(emulator) + os.close(subterminal) + else: + output_mupy = subprocess.check_output(args + [test_file], stderr=subprocess.STDOUT) + except subprocess.CalledProcessError: + return b'CRASH' + + else: + # a standard test run on PC + + # create system command + cmdlist = [MICROPYTHON, '-X', 'emit=' + args.emit] + if args.heapsize is not None: + cmdlist.extend(['-X', 'heapsize=' + args.heapsize]) + + # if running via .mpy, first compile the .py file + if args.via_mpy: + subprocess.check_output([MPYCROSS, '-mcache-lookup-bc', '-o', 'mpytest.mpy', test_file]) + cmdlist.extend(['-m', 'mpytest']) + else: + cmdlist.append(test_file) + + # run the actual test + e = {"MICROPYPATH": os.getcwd() + ":", "LANG": "en_US.UTF-8"} + p = subprocess.Popen(cmdlist, env=e, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + output_mupy = b'' + while p.poll() is None: + output_mupy += p.stdout.read() + output_mupy += p.stdout.read() + if p.returncode != 0: + output_mupy = b'CRASH' + + # clean up if we had an intermediate .mpy file + if args.via_mpy: + rm_f('mpytest.mpy') + + else: + # run on pyboard + import pyboard + pyb.enter_raw_repl() + try: + output_mupy = pyb.execfile(test_file) + except pyboard.PyboardError: + had_crash = True + output_mupy = b'CRASH' + + # canonical form for all ports/platforms is to use \n for end-of-line + output_mupy = output_mupy.replace(b'\r\n', b'\n') + + # don't try to convert the output if we should skip this test + if had_crash or output_mupy in (b'SKIP\n', b'CRASH'): + return output_mupy + + if is_special or test_file in special_tests: + # convert parts of the output that are not stable across runs + with open(test_file + '.exp', 'rb') as f: + lines_exp = [] + for line in f.readlines(): + if line == b'########\n': + line = (line,) + else: + line = (line, re.compile(convert_regex_escapes(line))) + lines_exp.append(line) + lines_mupy = [line + b'\n' for line in output_mupy.split(b'\n')] + if output_mupy.endswith(b'\n'): + lines_mupy = lines_mupy[:-1] # remove erroneous last empty line + i_mupy = 0 + for i in range(len(lines_exp)): + if lines_exp[i][0] == b'########\n': + # 8x #'s means match 0 or more whole lines + line_exp = lines_exp[i + 1] + skip = 0 + while i_mupy + skip < len(lines_mupy) and not line_exp[1].match(lines_mupy[i_mupy + skip]): + skip += 1 + if i_mupy + skip >= len(lines_mupy): + lines_mupy[i_mupy] = b'######## FAIL\n' + break + del lines_mupy[i_mupy:i_mupy + skip] + lines_mupy.insert(i_mupy, b'########\n') + i_mupy += 1 + else: + # a regex + if lines_exp[i][1].match(lines_mupy[i_mupy]): + lines_mupy[i_mupy] = lines_exp[i][0] + else: + #print("don't match: %r %s" % (lines_exp[i][1], lines_mupy[i_mupy])) # DEBUG + pass + i_mupy += 1 + if i_mupy >= len(lines_mupy): + break + output_mupy = b''.join(lines_mupy) + + return output_mupy + + +def run_feature_check(pyb, args, base_path, test_file): + return run_micropython(pyb, args, base_path + "/feature_check/" + test_file, is_special=True) + +class ThreadSafeCounter: + def __init__(self, start=0): + self._value = start + self._lock = threading.Lock() + + def add(self, to_add): + with self._lock: self._value += to_add + + def append(self, arg): + self.add([arg]) + + @property + def value(self): + return self._value + +def run_tests(pyb, tests, args, base_path=".", num_threads=1): + test_count = ThreadSafeCounter() + testcase_count = ThreadSafeCounter() + passed_count = ThreadSafeCounter() + failed_tests = ThreadSafeCounter([]) + skipped_tests = ThreadSafeCounter([]) + + skip_tests = set() + skip_native = False + skip_int_big = False + skip_set_type = False + skip_async = False + skip_const = False + skip_revops = False + skip_endian = False + has_complex = True + has_coverage = False + + upy_float_precision = 32 + + # If we're asked to --list-tests, we can't assume that there's a + # connection to target, so we can't run feature checks usefully. + if not (args.list_tests or args.write_exp): + # Check if micropython.native is supported, and skip such tests if it's not + output = run_feature_check(pyb, args, base_path, 'native_check.py') + if output == b'CRASH': + skip_native = True + + # Check if arbitrary-precision integers are supported, and skip such tests if it's not + output = run_feature_check(pyb, args, base_path, 'int_big.py') + if output != b'1000000000000000000000000000000000000000000000\n': + skip_int_big = True + + # Check if set type (and set literals) is supported, and skip such tests if it's not + output = run_feature_check(pyb, args, base_path, 'set_check.py') + if output == b'CRASH': + skip_set_type = True + + # Check if async/await keywords are supported, and skip such tests if it's not + output = run_feature_check(pyb, args, base_path, 'async_check.py') + if output == b'CRASH': + skip_async = True + + # Check if const keyword (MicroPython extension) is supported, and skip such tests if it's not + output = run_feature_check(pyb, args, base_path, 'const.py') + if output == b'CRASH': + skip_const = True + + # Check if __rOP__ special methods are supported, and skip such tests if it's not + output = run_feature_check(pyb, args, base_path, 'reverse_ops.py') + if output == b'TypeError\n': + skip_revops = True + + # Check if emacs repl is supported, and skip such tests if it's not + t = run_feature_check(pyb, args, base_path, 'repl_emacs_check.py') + if not 'True' in str(t, 'ascii'): + skip_tests.add('cmdline/repl_emacs_keys.py') + + upy_byteorder = run_feature_check(pyb, args, base_path, 'byteorder.py') + upy_float_precision = int(run_feature_check(pyb, args, base_path, 'float.py')) + has_complex = run_feature_check(pyb, args, base_path, 'complex.py') == b'complex\n' + has_coverage = run_feature_check(pyb, args, base_path, 'coverage.py') == b'coverage\n' + cpy_byteorder = subprocess.check_output([CPYTHON3, base_path + '/feature_check/byteorder.py']) + skip_endian = (upy_byteorder != cpy_byteorder) + + # Some tests shouldn't be run under Travis CI + if os.getenv('TRAVIS') == 'true': + skip_tests.add('basics/memoryerror.py') + skip_tests.add('thread/thread_gc1.py') # has reliability issues + skip_tests.add('thread/thread_lock4.py') # has reliability issues + skip_tests.add('thread/stress_heap.py') # has reliability issues + skip_tests.add('thread/stress_recurse.py') # has reliability issues + + if upy_float_precision == 0: + skip_tests.add('extmod/ujson_dumps_float.py') + skip_tests.add('extmod/ujson_loads_float.py') + skip_tests.add('misc/rge_sm.py') + if upy_float_precision < 32: + skip_tests.add('float/float2int_intbig.py') # requires fp32, there's float2int_fp30_intbig.py instead + skip_tests.add('float/string_format.py') # requires fp32, there's string_format_fp30.py instead + skip_tests.add('float/bytes_construct.py') # requires fp32 + skip_tests.add('float/bytearray_construct.py') # requires fp32 + if upy_float_precision < 64: + skip_tests.add('float/float_divmod.py') # tested by float/float_divmod_relaxed.py instead + skip_tests.add('float/float2int_doubleprec_intbig.py') + skip_tests.add('float/float_parse_doubleprec.py') + + if not has_complex: + skip_tests.add('float/complex1.py') + skip_tests.add('float/complex1_intbig.py') + skip_tests.add('float/int_big_float.py') + skip_tests.add('float/true_value.py') + skip_tests.add('float/types.py') + + if not has_coverage: + skip_tests.add('cmdline/cmd_parsetree.py') + + # Some tests shouldn't be run on a PC + if args.target == 'unix': + # unix build does not have the GIL so can't run thread mutation tests + for t in tests: + if t.startswith('thread/mutate_'): + skip_tests.add(t) + + # Some tests shouldn't be run on pyboard + if args.target != 'unix': + skip_tests.add('basics/exception_chain.py') # warning is not printed + skip_tests.add('micropython/meminfo.py') # output is very different to PC output + skip_tests.add('extmod/machine_mem.py') # raw memory access not supported + + if args.target == 'wipy': + skip_tests.add('misc/print_exception.py') # requires error reporting full + skip_tests.update({'extmod/uctypes_%s.py' % t for t in 'bytearray le native_le ptr_le ptr_native_le sizeof sizeof_native array_assign_le array_assign_native_le'.split()}) # requires uctypes + skip_tests.add('extmod/zlibd_decompress.py') # requires zlib + skip_tests.add('extmod/uheapq1.py') # uheapq not supported by WiPy + skip_tests.add('extmod/urandom_basic.py') # requires urandom + skip_tests.add('extmod/urandom_extra.py') # requires urandom + elif args.target == 'esp8266': + skip_tests.add('misc/rge_sm.py') # too large + elif args.target == 'minimal': + skip_tests.add('basics/class_inplace_op.py') # all special methods not supported + skip_tests.add('basics/subclass_native_init.py')# native subclassing corner cases not support + skip_tests.add('misc/rge_sm.py') # too large + skip_tests.add('micropython/opt_level.py') # don't assume line numbers are stored + + # Some tests are known to fail on 64-bit machines + if pyb is None and platform.architecture()[0] == '64bit': + pass + + # Some tests use unsupported features on Windows + if os.name == 'nt': + skip_tests.add('import/import_file.py') # works but CPython prints forward slashes + + # Some tests are known to fail with native emitter + # Remove them from the below when they work + if args.emit == 'native': + skip_tests.update({'basics/%s.py' % t for t in 'gen_yield_from gen_yield_from_close gen_yield_from_ducktype gen_yield_from_exc gen_yield_from_executing gen_yield_from_iter gen_yield_from_send gen_yield_from_stopped gen_yield_from_throw gen_yield_from_throw2 gen_yield_from_throw3 generator1 generator2 generator_args generator_close generator_closure generator_exc generator_pend_throw generator_return generator_send'.split()}) # require yield + skip_tests.update({'basics/%s.py' % t for t in 'bytes_gen class_store_class globals_del string_join gen_stack_overflow'.split()}) # require yield + skip_tests.update({'basics/async_%s.py' % t for t in 'def await await2 for for2 with with2 coroutine'.split()}) # require yield + skip_tests.update({'basics/%s.py' % t for t in 'try_reraise try_reraise2'.split()}) # require raise_varargs + skip_tests.update({'basics/%s.py' % t for t in 'with_break with_continue with_return'.split()}) # require complete with support + skip_tests.add('basics/array_construct2.py') # requires generators + skip_tests.add('basics/bool1.py') # seems to randomly fail + skip_tests.add('basics/builtin_hash_gen.py') # requires yield + skip_tests.add('basics/class_bind_self.py') # requires yield + skip_tests.add('basics/del_deref.py') # requires checking for unbound local + skip_tests.add('basics/del_local.py') # requires checking for unbound local + skip_tests.add('basics/exception_chain.py') # raise from is not supported + skip_tests.add('basics/for_range.py') # requires yield_value + skip_tests.add('basics/try_finally_loops.py') # requires proper try finally code + skip_tests.add('basics/try_finally_return.py') # requires proper try finally code + skip_tests.add('basics/try_finally_return2.py') # requires proper try finally code + skip_tests.add('basics/unboundlocal.py') # requires checking for unbound local + skip_tests.add('import/gen_context.py') # requires yield_value + skip_tests.add('misc/features.py') # requires raise_varargs + skip_tests.add('misc/rge_sm.py') # requires yield + skip_tests.add('misc/print_exception.py') # because native doesn't have proper traceback info + skip_tests.add('misc/sys_exc_info.py') # sys.exc_info() is not supported for native + skip_tests.add('micropython/emg_exc.py') # because native doesn't have proper traceback info + skip_tests.add('micropython/heapalloc_traceback.py') # because native doesn't have proper traceback info + skip_tests.add('micropython/heapalloc_iter.py') # requires generators + skip_tests.add('micropython/schedule.py') # native code doesn't check pending events + skip_tests.add('stress/gc_trace.py') # requires yield + skip_tests.add('stress/recursive_gen.py') # requires yield + skip_tests.add('extmod/vfs_userfs.py') # because native doesn't properly handle globals across different modules + skip_tests.add('../extmod/ulab/tests/argminmax.py') # requires yield + + def run_one_test(test_file): + test_file = test_file.replace('\\', '/') + + if args.filters: + # Default verdict is the opposit of the first action + verdict = "include" if args.filters[0][0] == "exclude" else "exclude" + for action, pat in args.filters: + if pat.search(test_file): + verdict = action + if verdict == "exclude": + return + + test_basename = os.path.basename(test_file) + test_name = os.path.splitext(test_basename)[0] + is_native = test_name.startswith("native_") or test_name.startswith("viper_") + is_endian = test_name.endswith("_endian") + is_int_big = test_name.startswith("int_big") or test_name.endswith("_intbig") + is_set_type = test_name.startswith("set_") or test_name.startswith("frozenset") + is_async = test_name.startswith("async_") + is_const = test_name.startswith("const") + + skip_it = test_file in skip_tests + skip_it |= skip_native and is_native + skip_it |= skip_endian and is_endian + skip_it |= skip_int_big and is_int_big + skip_it |= skip_set_type and is_set_type + skip_it |= skip_async and is_async + skip_it |= skip_const and is_const + skip_it |= skip_revops and test_name.startswith("class_reverse_op") + + if args.list_tests: + if not skip_it: + print(test_file) + return + + if skip_it: + print("skip ", test_file) + skipped_tests.append(test_name) + return + + # get expected output + test_file_expected = test_file + '.exp' + if os.path.isfile(test_file_expected): + # expected output given by a file, so read that in + with open(test_file_expected, 'rb') as f: + output_expected = f.read() + else: + # run CPython to work out expected output + e = {"PYTHONPATH": os.getcwd(), + "PATH": os.environ["PATH"], + "LANG": "en_US.UTF-8"} + p = subprocess.Popen([CPYTHON3, '-B', test_file], env=e, stdout=subprocess.PIPE) + output_expected = b'' + while p.poll() is None: + output_expected += p.stdout.read() + output_expected += p.stdout.read() + if p.returncode != 0: + output_expected = b'CPYTHON3 CRASH' + elif args.write_exp: + with open(test_file_expected, 'wb') as f: + f.write(output_expected) + + # canonical form for all host platforms is to use \n for end-of-line + output_expected = output_expected.replace(b'\r\n', b'\n') + + if args.write_exp: + return + + # run MicroPython + output_mupy = run_micropython(pyb, args, test_file) + + if output_mupy == b'SKIP\n': + print("skip ", test_file) + skipped_tests.append(test_name) + return + + testcase_count.add(len(output_expected.splitlines())) + + filename_expected = test_basename + ".exp" + filename_mupy = test_basename + ".out" + + if output_expected == output_mupy: + print("pass ", test_file) + passed_count.add(1) + rm_f(filename_expected) + rm_f(filename_mupy) + else: + with open(filename_expected, "wb") as f: + f.write(output_expected) + with open(filename_mupy, "wb") as f: + f.write(output_mupy) + print("### Expected") + print(output_expected) + print("### Actual") + print(output_mupy) + print("FAIL ", test_file) + failed_tests.append(test_name) + + test_count.add(1) + + if args.list_tests: + return True + + if num_threads > 1: + pool = ThreadPool(num_threads) + pool.map(run_one_test, tests) + else: + for test in tests: + run_one_test(test) + + print("{} tests performed ({} individual testcases)".format(test_count.value, testcase_count.value)) + print("{} tests passed".format(passed_count.value)) + + if len(skipped_tests.value) > 0: + print("{} tests skipped: {}".format(len(skipped_tests.value), ' '.join(sorted(skipped_tests.value)))) + if len(failed_tests.value) > 0: + print("{} tests failed: {}".format(len(failed_tests.value), ' '.join(sorted(failed_tests.value)))) + return False + + # all tests succeeded + return True + + +class append_filter(argparse.Action): + + def __init__(self, option_strings, dest, **kwargs): + super().__init__(option_strings, dest, default=[], **kwargs) + + def __call__(self, parser, args, value, option): + if not hasattr(args, self.dest): + args.filters = [] + if option.startswith(("-e", "--e")): + option = "exclude" + else: + option = "include" + args.filters.append((option, re.compile(value))) + + +def main(): + cmd_parser = argparse.ArgumentParser( + formatter_class=argparse.RawDescriptionHelpFormatter, + description='Run and manage tests for MicroPython.', + epilog='''\ +Options -i and -e can be multiple and processed in the order given. Regex +"search" (vs "match") operation is used. An action (include/exclude) of +the last matching regex is used: + run-tests -i async - exclude all, then include tests containg "async" anywhere + run-tests -e '/big.+int' - include all, then exclude by regex + run-tests -e async -i async_foo - include all, exclude async, yet still include async_foo +''') + cmd_parser.add_argument('--target', default='unix', help='the target platform') + cmd_parser.add_argument('--device', default='/dev/ttyACM0', help='the serial device or the IP address of the pyboard') + cmd_parser.add_argument('-b', '--baudrate', default=115200, help='the baud rate of the serial device') + cmd_parser.add_argument('-u', '--user', default='micro', help='the telnet login username') + cmd_parser.add_argument('-p', '--password', default='python', help='the telnet login password') + cmd_parser.add_argument('-d', '--test-dirs', nargs='*', help='input test directories (if no files given)') + cmd_parser.add_argument('-e', '--exclude', action=append_filter, metavar='REGEX', dest='filters', help='exclude test by regex on path/name.py') + cmd_parser.add_argument('-i', '--include', action=append_filter, metavar='REGEX', dest='filters', help='include test by regex on path/name.py') + cmd_parser.add_argument('--write-exp', action='store_true', help='save .exp files to run tests w/o CPython') + cmd_parser.add_argument('--list-tests', action='store_true', help='list tests instead of running them') + cmd_parser.add_argument('--emit', default='bytecode', help='MicroPython emitter to use (bytecode or native)') + cmd_parser.add_argument('--heapsize', help='heapsize to use (use default if not specified)') + cmd_parser.add_argument('--via-mpy', action='store_true', help='compile .py files to .mpy first') + cmd_parser.add_argument('--keep-path', action='store_true', help='do not clear MICROPYPATH when running tests') + cmd_parser.add_argument('-j', '--jobs', default=1, metavar='N', type=int, help='Number of tests to run simultaneously') + cmd_parser.add_argument('--auto-jobs', action='store_const', dest='jobs', const=multiprocessing.cpu_count(), help='Set the -j values to the CPU (thread) count') + cmd_parser.add_argument('files', nargs='*', help='input test files') + args = cmd_parser.parse_args() + + EXTERNAL_TARGETS = ('pyboard', 'wipy', 'esp8266', 'esp32', 'minimal') + if args.target == 'unix' or args.list_tests: + pyb = None + elif args.target in EXTERNAL_TARGETS: + import pyboard + pyb = pyboard.Pyboard(args.device, args.baudrate, args.user, args.password) + pyb.enter_raw_repl() + else: + raise ValueError('target must be either %s or unix' % ", ".join(EXTERNAL_TARGETS)) + + if len(args.files) == 0: + if args.test_dirs is None: + if args.target == 'pyboard': + # run pyboard tests + test_dirs = ('basics', 'micropython', 'float', 'misc', 'stress', 'extmod', 'pyb', 'pybnative', 'inlineasm') + elif args.target in ('esp8266', 'esp32', 'minimal'): + test_dirs = ('basics', 'micropython', 'float', 'misc', 'extmod') + elif args.target == 'wipy': + # run WiPy tests + test_dirs = ('basics', 'micropython', 'misc', 'extmod', 'wipy') + else: + # run PC tests + test_dirs = ( + 'basics', 'micropython', 'float', 'import', 'io', 'misc', + 'stress', 'unicode', 'extmod', '../extmod/ulab/tests', 'unix', 'cmdline', + ) + else: + # run tests from these directories + test_dirs = args.test_dirs + tests = sorted(test_file for test_files in (glob('{}/*.py'.format(dir)) for dir in test_dirs) for test_file in test_files) + else: + # tests explicitly given + tests = args.files + + if not args.keep_path: + # clear search path to make sure tests use only builtin modules + os.environ['MICROPYPATH'] = '' + + # Even if we run completely different tests in a different directory, + # we need to access feature_check's from the same directory as the + # run-tests script itself. + base_path = os.path.dirname(sys.argv[0]) or "." + try: + res = run_tests(pyb, tests, args, base_path, args.jobs) + finally: + if pyb: + pyb.close() + + if not res: + sys.exit(1) + +if __name__ == "__main__": + main() diff --git a/tests/stress 2/dict_copy.py b/tests/stress 2/dict_copy.py new file mode 100644 index 0000000000000..36db9bb7e89d0 --- /dev/null +++ b/tests/stress 2/dict_copy.py @@ -0,0 +1,7 @@ +# copying a large dictionary + +a = {i:2*i for i in range(1000)} +b = a.copy() +for i in range(1000): + print(i, b[i]) +print(len(b)) diff --git a/tests/stress 2/dict_create.py b/tests/stress 2/dict_create.py new file mode 100644 index 0000000000000..e9db40a8e6c5b --- /dev/null +++ b/tests/stress 2/dict_create.py @@ -0,0 +1,8 @@ +# create a large dictionary + +d = {} +x = 1 +while x < 1000: + d[x] = x + x += 1 +print(d[500]) diff --git a/tests/stress 2/dict_create_max.py b/tests/stress 2/dict_create_max.py new file mode 100644 index 0000000000000..3c75db20da0c0 --- /dev/null +++ b/tests/stress 2/dict_create_max.py @@ -0,0 +1,13 @@ +# The aim with this test is to hit the maximum resize/rehash size of a dict, +# where there are no more primes in the table of growing allocation sizes. +# This value is 54907 items. + +d = {} +try: + for i in range(54908): + d[i] = i +except MemoryError: + pass + +# Just check the dict still has the first value +print(d[0]) diff --git a/tests/stress 2/gc_trace.py b/tests/stress 2/gc_trace.py new file mode 100644 index 0000000000000..72dc7b62769d7 --- /dev/null +++ b/tests/stress 2/gc_trace.py @@ -0,0 +1,17 @@ +# test that the GC can trace nested objects + +try: + import gc +except ImportError: + print("SKIP") + raise SystemExit + +# test a big shallow object pointing to many unique objects +lst = [[i] for i in range(200)] +gc.collect() +print(lst) + +# test a deep object +lst = [[[[[(i, j, k, l)] for i in range(3)] for j in range(3)] for k in range(3)] for l in range(3)] +gc.collect() +print(lst) diff --git a/tests/stress 2/list_sort.py b/tests/stress 2/list_sort.py new file mode 100644 index 0000000000000..3a7701a1e4cc0 --- /dev/null +++ b/tests/stress 2/list_sort.py @@ -0,0 +1,6 @@ +# test large list sorting (should not stack overflow) +l = list(range(2000)) +l.sort() +print(l[0], l[-1]) +l.sort(reverse=True) +print(l[0], l[-1]) diff --git a/tests/stress 2/recursion.py b/tests/stress 2/recursion.py new file mode 100644 index 0000000000000..227f48396ad47 --- /dev/null +++ b/tests/stress 2/recursion.py @@ -0,0 +1,7 @@ +def foo(): + foo() + +try: + foo() +except RuntimeError: + print("RuntimeError") diff --git a/tests/stress 2/recursive_data.py b/tests/stress 2/recursive_data.py new file mode 100644 index 0000000000000..3b7fa50952584 --- /dev/null +++ b/tests/stress 2/recursive_data.py @@ -0,0 +1,13 @@ +# This tests that printing recursive data structure doesn't lead to segfault. +try: + import uio as io +except ImportError: + print("SKIP") + raise SystemExit + +l = [1, 2, 3, None] +l[-1] = l +try: + print(l, file=io.StringIO()) +except RuntimeError: + print("RuntimeError") diff --git a/tests/stress 2/recursive_data.py.exp b/tests/stress 2/recursive_data.py.exp new file mode 100644 index 0000000000000..8a2b9bfdda511 --- /dev/null +++ b/tests/stress 2/recursive_data.py.exp @@ -0,0 +1 @@ +RuntimeError diff --git a/tests/stress 2/recursive_gen.py b/tests/stress 2/recursive_gen.py new file mode 100644 index 0000000000000..0e0d3914ee9d5 --- /dev/null +++ b/tests/stress 2/recursive_gen.py @@ -0,0 +1,18 @@ +# test deeply recursive generators + +# simple "yield from" recursion +def gen(): + yield from gen() +try: + list(gen()) +except RuntimeError: + print('RuntimeError') + +# recursion via an iterator over a generator +def gen2(): + for x in gen2(): + yield x +try: + next(gen2()) +except RuntimeError: + print('RuntimeError') diff --git a/tests/stress 2/recursive_iternext.py b/tests/stress 2/recursive_iternext.py new file mode 100644 index 0000000000000..edb5a843f29dc --- /dev/null +++ b/tests/stress 2/recursive_iternext.py @@ -0,0 +1,57 @@ +# This tests that recursion with iternext doesn't lead to segfault. +try: + enumerate + filter + map + max + zip +except: + print("SKIP") + raise SystemExit + +# We need to pick an N that is large enough to hit the recursion +# limit, but not too large that we run out of heap memory. +try: + # large stack/heap, eg unix + [0] * 80000 + N = 2400 +except: + try: + # medium, eg pyboard + [0] * 10000 + N = 1000 + except: + # small, eg esp8266 + N = 100 + +try: + x = (1, 2) + for i in range(N): + x = enumerate(x) + tuple(x) +except RuntimeError: + print("RuntimeError") + +try: + x = (1, 2) + for i in range(N): + x = filter(None, x) + tuple(x) +except RuntimeError: + print("RuntimeError") + +try: + x = (1, 2) + for i in range(N): + x = map(max, x, ()) + tuple(x) +except RuntimeError: + print("RuntimeError") + +try: + x = (1, 2) + for i in range(N): + x = zip(x) + tuple(x) +except RuntimeError: + print("RuntimeError") diff --git a/tests/stress 2/recursive_iternext.py.exp b/tests/stress 2/recursive_iternext.py.exp new file mode 100644 index 0000000000000..80d1488a3795f --- /dev/null +++ b/tests/stress 2/recursive_iternext.py.exp @@ -0,0 +1,4 @@ +RuntimeError +RuntimeError +RuntimeError +RuntimeError diff --git a/tests/thread 2/mutate_bytearray.py b/tests/thread 2/mutate_bytearray.py new file mode 100644 index 0000000000000..5015c3f9cfaca --- /dev/null +++ b/tests/thread 2/mutate_bytearray.py @@ -0,0 +1,46 @@ +# test concurrent mutating access to a shared bytearray object +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +# the shared bytearray +ba = bytearray() + +# main thread function +def th(n, lo, hi): + for repeat in range(n): + for i in range(lo, hi): + l = len(ba) + ba.append(i) + assert len(ba) >= l + 1 + + l = len(ba) + ba.extend(bytearray([i])) + assert len(ba) >= l + 1 + + with lock: + global n_finished + n_finished += 1 + +lock = _thread.allocate_lock() +n_thread = 4 +n_finished = 0 +n_repeat = 4 # use 40 for more stressful test (uses more heap) + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(th, (n_repeat, i * 256 // n_thread, (i + 1) * 256 // n_thread)) + +# busy wait for threads to finish +while n_finished < n_thread: + pass + +# check bytearray has correct contents +print(len(ba)) +count = [0 for _ in range(256)] +for b in ba: + count[b] += 1 +print(count) diff --git a/tests/thread 2/mutate_dict.py b/tests/thread 2/mutate_dict.py new file mode 100644 index 0000000000000..563fce39debb0 --- /dev/null +++ b/tests/thread 2/mutate_dict.py @@ -0,0 +1,44 @@ +# test concurrent mutating access to a shared dict object +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +# the shared dict +di = {'a':'A', 'b':'B', 'c':'C', 'd':'D'} + +# main thread function +def th(n, lo, hi): + for repeat in range(n): + for i in range(lo, hi): + di[i] = repeat + i + assert di[i] == repeat + i + + del di[i] + assert i not in di + + di[i] = repeat + i + assert di[i] == repeat + i + + assert di.pop(i) == repeat + i + + with lock: + global n_finished + n_finished += 1 + +lock = _thread.allocate_lock() +n_thread = 4 +n_finished = 0 + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(th, (30, i * 300, (i + 1) * 300)) + +# busy wait for threads to finish +while n_finished < n_thread: + pass + +# check dict has correct contents +print(sorted(di.items())) diff --git a/tests/thread 2/mutate_instance.py b/tests/thread 2/mutate_instance.py new file mode 100644 index 0000000000000..2ecfbe1092811 --- /dev/null +++ b/tests/thread 2/mutate_instance.py @@ -0,0 +1,45 @@ +# test concurrent mutating access to a shared user instance +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +# the shared user class and instance +class User: + def __init__(self): + self.a = 'A' + self.b = 'B' + self.c = 'C' +user = User() + +# main thread function +def th(n, lo, hi): + for repeat in range(n): + for i in range(lo, hi): + setattr(user, 'attr_%u' % i, repeat + i) + assert getattr(user, 'attr_%u' % i) == repeat + i + + with lock: + global n_finished + n_finished += 1 + +lock = _thread.allocate_lock() +n_repeat = 30 +n_range = 50 # 300 for stressful test (uses more heap) +n_thread = 4 +n_finished = 0 + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(th, (n_repeat, i * n_range, (i + 1) * n_range)) + +# busy wait for threads to finish +while n_finished < n_thread: + pass + +# check user instance has correct contents +print(user.a, user.b, user.c) +for i in range(n_thread * n_range): + assert getattr(user, 'attr_%u' % i) == n_repeat - 1 + i diff --git a/tests/thread 2/mutate_list.py b/tests/thread 2/mutate_list.py new file mode 100644 index 0000000000000..d70e8a8a388c7 --- /dev/null +++ b/tests/thread 2/mutate_list.py @@ -0,0 +1,46 @@ +# test concurrent mutating access to a shared list object +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +# the shared list +li = list() + +# main thread function +def th(n, lo, hi): + for repeat in range(n): + for i in range(lo, hi): + li.append(i) + assert li.count(i) == repeat + 1 + + li.extend([i, i]) + assert li.count(i) == repeat + 3 + + li.remove(i) + assert li.count(i) == repeat + 2 + + li.remove(i) + assert li.count(i) == repeat + 1 + + with lock: + global n_finished + n_finished += 1 + +lock = _thread.allocate_lock() +n_thread = 4 +n_finished = 0 + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(th, (4, i * 60, (i + 1) * 60)) + +# busy wait for threads to finish +while n_finished < n_thread: + pass + +# check list has correct contents +li.sort() +print(li) diff --git a/tests/thread 2/mutate_set.py b/tests/thread 2/mutate_set.py new file mode 100644 index 0000000000000..c4529f3562d20 --- /dev/null +++ b/tests/thread 2/mutate_set.py @@ -0,0 +1,39 @@ +# test concurrent mutating access to a shared set object +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +# the shared set +se = set([-1, -2, -3, -4]) + +# main thread function +def th(n, lo, hi): + for repeat in range(n): + for i in range(lo, hi): + se.add(i) + assert i in se + + se.remove(i) + assert i not in se + + with lock: + global n_finished + n_finished += 1 + +lock = _thread.allocate_lock() +n_thread = 4 +n_finished = 0 + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(th, (50, i * 500, (i + 1) * 500)) + +# busy wait for threads to finish +while n_finished < n_thread: + pass + +# check set has correct contents +print(sorted(se)) diff --git a/tests/thread 2/stress_aes.py b/tests/thread 2/stress_aes.py new file mode 100644 index 0000000000000..ebf7af371b1cf --- /dev/null +++ b/tests/thread 2/stress_aes.py @@ -0,0 +1,257 @@ +# Stress test for threads using AES encryption routines. +# +# AES was chosen because it is integer based and inplace so doesn't use the +# heap. It is therefore a good test of raw performance and correctness of the +# VM/runtime. It can be used to measure threading performance (concurrency is +# in principle possible) and correctness (it's non trivial for the encryption/ +# decryption to give the correct answer). +# +# The AES code comes first (code originates from a C version authored by D.P.George) +# and then the test harness at the bottom. It can be tuned to be more/less +# aggressive by changing the amount of data to encrypt, the number of loops and +# the number of threads. +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +################################################################## +# discrete arithmetic routines, mostly from a precomputed table + +# non-linear, invertible, substitution box +aes_s_box_table = bytes(( + 0x63,0x7c,0x77,0x7b,0xf2,0x6b,0x6f,0xc5,0x30,0x01,0x67,0x2b,0xfe,0xd7,0xab,0x76, + 0xca,0x82,0xc9,0x7d,0xfa,0x59,0x47,0xf0,0xad,0xd4,0xa2,0xaf,0x9c,0xa4,0x72,0xc0, + 0xb7,0xfd,0x93,0x26,0x36,0x3f,0xf7,0xcc,0x34,0xa5,0xe5,0xf1,0x71,0xd8,0x31,0x15, + 0x04,0xc7,0x23,0xc3,0x18,0x96,0x05,0x9a,0x07,0x12,0x80,0xe2,0xeb,0x27,0xb2,0x75, + 0x09,0x83,0x2c,0x1a,0x1b,0x6e,0x5a,0xa0,0x52,0x3b,0xd6,0xb3,0x29,0xe3,0x2f,0x84, + 0x53,0xd1,0x00,0xed,0x20,0xfc,0xb1,0x5b,0x6a,0xcb,0xbe,0x39,0x4a,0x4c,0x58,0xcf, + 0xd0,0xef,0xaa,0xfb,0x43,0x4d,0x33,0x85,0x45,0xf9,0x02,0x7f,0x50,0x3c,0x9f,0xa8, + 0x51,0xa3,0x40,0x8f,0x92,0x9d,0x38,0xf5,0xbc,0xb6,0xda,0x21,0x10,0xff,0xf3,0xd2, + 0xcd,0x0c,0x13,0xec,0x5f,0x97,0x44,0x17,0xc4,0xa7,0x7e,0x3d,0x64,0x5d,0x19,0x73, + 0x60,0x81,0x4f,0xdc,0x22,0x2a,0x90,0x88,0x46,0xee,0xb8,0x14,0xde,0x5e,0x0b,0xdb, + 0xe0,0x32,0x3a,0x0a,0x49,0x06,0x24,0x5c,0xc2,0xd3,0xac,0x62,0x91,0x95,0xe4,0x79, + 0xe7,0xc8,0x37,0x6d,0x8d,0xd5,0x4e,0xa9,0x6c,0x56,0xf4,0xea,0x65,0x7a,0xae,0x08, + 0xba,0x78,0x25,0x2e,0x1c,0xa6,0xb4,0xc6,0xe8,0xdd,0x74,0x1f,0x4b,0xbd,0x8b,0x8a, + 0x70,0x3e,0xb5,0x66,0x48,0x03,0xf6,0x0e,0x61,0x35,0x57,0xb9,0x86,0xc1,0x1d,0x9e, + 0xe1,0xf8,0x98,0x11,0x69,0xd9,0x8e,0x94,0x9b,0x1e,0x87,0xe9,0xce,0x55,0x28,0xdf, + 0x8c,0xa1,0x89,0x0d,0xbf,0xe6,0x42,0x68,0x41,0x99,0x2d,0x0f,0xb0,0x54,0xbb,0x16, +)) + +# multiplication of polynomials modulo x^8 + x^4 + x^3 + x + 1 = 0x11b +def aes_gf8_mul_2(x): + if x & 0x80: + return (x << 1) ^ 0x11b + else: + return x << 1 + +def aes_gf8_mul_3(x): + return x ^ aes_gf8_mul_2(x) + +# non-linear, invertible, substitution box +def aes_s_box(a): + return aes_s_box_table[a & 0xff] + +# return 0x02^(a-1) in GF(2^8) +def aes_r_con(a): + ans = 1 + while a > 1: + ans <<= 1; + if ans & 0x100: + ans ^= 0x11b + a -= 1 + return ans + +################################################################## +# basic AES algorithm; see FIPS-197 +# +# Think of it as a pseudo random number generator, with each +# symbol in the sequence being a 16 byte block (the state). The +# key is a parameter of the algorithm and tells which particular +# sequence of random symbols you want. The initial vector, IV, +# sets the start of the sequence. The idea of a strong cipher +# is that it's very difficult to guess the key even if you know +# a large part of the sequence. The basic AES algorithm simply +# provides such a sequence. En/de-cryption is implemented here +# using OCB, where the sequence is xored against the plaintext. +# Care must be taken to (almost) always choose a different IV. + +# all inputs must be size 16 +def aes_add_round_key(state, w): + for i in range(16): + state[i] ^= w[i] + +# combined sub_bytes, shift_rows, mix_columns, add_round_key +# all inputs must be size 16 +def aes_sb_sr_mc_ark(state, w, w_idx, temp): + temp_idx = 0 + for i in range(4): + x0 = aes_s_box_table[state[i * 4]] + x1 = aes_s_box_table[state[1 + ((i + 1) & 3) * 4]] + x2 = aes_s_box_table[state[2 + ((i + 2) & 3) * 4]] + x3 = aes_s_box_table[state[3 + ((i + 3) & 3) * 4]] + temp[temp_idx] = aes_gf8_mul_2(x0) ^ aes_gf8_mul_3(x1) ^ x2 ^ x3 ^ w[w_idx] + temp[temp_idx + 1] = x0 ^ aes_gf8_mul_2(x1) ^ aes_gf8_mul_3(x2) ^ x3 ^ w[w_idx + 1] + temp[temp_idx + 2] = x0 ^ x1 ^ aes_gf8_mul_2(x2) ^ aes_gf8_mul_3(x3) ^ w[w_idx + 2] + temp[temp_idx + 3] = aes_gf8_mul_3(x0) ^ x1 ^ x2 ^ aes_gf8_mul_2(x3) ^ w[w_idx + 3] + w_idx += 4 + temp_idx += 4 + for i in range(16): + state[i] = temp[i] + +# combined sub_bytes, shift_rows, add_round_key +# all inputs must be size 16 +def aes_sb_sr_ark(state, w, w_idx, temp): + temp_idx = 0 + for i in range(4): + x0 = aes_s_box_table[state[i * 4]] + x1 = aes_s_box_table[state[1 + ((i + 1) & 3) * 4]] + x2 = aes_s_box_table[state[2 + ((i + 2) & 3) * 4]] + x3 = aes_s_box_table[state[3 + ((i + 3) & 3) * 4]] + temp[temp_idx] = x0 ^ w[w_idx] + temp[temp_idx + 1] = x1 ^ w[w_idx + 1] + temp[temp_idx + 2] = x2 ^ w[w_idx + 2] + temp[temp_idx + 3] = x3 ^ w[w_idx + 3] + w_idx += 4 + temp_idx += 4 + for i in range(16): + state[i] = temp[i] + +# take state as input and change it to the next state in the sequence +# state and temp have size 16, w has size 16 * (Nr + 1), Nr >= 1 +def aes_state(state, w, temp, nr): + aes_add_round_key(state, w) + w_idx = 16 + for i in range(nr - 1): + aes_sb_sr_mc_ark(state, w, w_idx, temp) + w_idx += 16 + aes_sb_sr_ark(state, w, w_idx, temp) + +# expand 'key' to 'w' for use with aes_state +# key has size 4 * Nk, w has size 16 * (Nr + 1), temp has size 16 +def aes_key_expansion(key, w, temp, nk, nr): + for i in range(4 * nk): + w[i] = key[i] + w_idx = 4 * nk - 4 + for i in range(nk, 4 * (nr + 1)): + t = temp + t_idx = 0 + if i % nk == 0: + t[0] = aes_s_box(w[w_idx + 1]) ^ aes_r_con(i // nk) + for j in range(1, 4): + t[j] = aes_s_box(w[w_idx + (j + 1) % 4]) + elif nk > 6 and i % nk == 4: + for j in range(0, 4): + t[j] = aes_s_box(w[w_idx + j]) + else: + t = w + t_idx = w_idx + w_idx += 4 + for j in range(4): + w[w_idx + j] = w[w_idx + j - 4 * nk] ^ t[t_idx + j] + +################################################################## +# simple use of AES algorithm, using output feedback (OFB) mode + +class AES: + def __init__(self, keysize): + if keysize == 128: + self.nk = 4 + self.nr = 10 + elif keysize == 192: + self.nk = 6 + self.nr = 12 + else: + assert keysize == 256 + self.nk = 8 + self.nr = 14 + + self.state = bytearray(16) + self.w = bytearray(16 * (self.nr + 1)) + self.temp = bytearray(16) + self.state_pos = 16 + + def set_key(self, key): + aes_key_expansion(key, self.w, self.temp, self.nk, self.nr) + self.state_pos = 16 + + def set_iv(self, iv): + for i in range(16): + self.state[i] = iv[i] + self.state_pos = 16; + + def get_some_state(self, n_needed): + if self.state_pos >= 16: + aes_state(self.state, self.w, self.temp, self.nr) + self.state_pos = 0 + n = 16 - self.state_pos + if n > n_needed: + n = n_needed + return n + + def apply_to(self, data): + idx = 0 + n = len(data) + while n > 0: + ln = self.get_some_state(n) + n -= ln + for i in range(ln): + data[idx + i] ^= self.state[self.state_pos + i] + idx += ln + self.state_pos += n + +################################################################## +# test code + +try: + import utime as time +except ImportError: + import time +import _thread + +class LockedCounter: + def __init__(self): + self.lock = _thread.allocate_lock() + self.value = 0 + + def add(self, val): + self.lock.acquire() + self.value += val + self.lock.release() + +count = LockedCounter() + +def thread_entry(): + global count + + aes = AES(256) + key = bytearray(256 // 8) + iv = bytearray(16) + data = bytearray(128) + # from now on we don't use the heap + + for loop in range(5): + # encrypt + aes.set_key(key) + aes.set_iv(iv) + for i in range(8): + aes.apply_to(data) + + # decrypt + aes.set_key(key) + aes.set_iv(iv) + for i in range(8): + aes.apply_to(data) + + # verify + for i in range(len(data)): + assert data[i] == 0 + + count.add(1) + +if __name__ == '__main__': + n_thread = 20 + for i in range(n_thread): + _thread.start_new_thread(thread_entry, ()) + while count.value < n_thread: + time.sleep(1) diff --git a/tests/thread 2/stress_create.py b/tests/thread 2/stress_create.py new file mode 100644 index 0000000000000..2399746ccab93 --- /dev/null +++ b/tests/thread 2/stress_create.py @@ -0,0 +1,22 @@ +# stress test for creating many threads + +try: + import utime as time +except ImportError: + import time +import _thread + +def thread_entry(n): + pass + +thread_num = 0 +while thread_num < 500: + try: + _thread.start_new_thread(thread_entry, (thread_num,)) + thread_num += 1 + except MemoryError: + pass + +# wait for the last threads to terminate +time.sleep(1) +print('done') diff --git a/tests/thread 2/stress_heap.py b/tests/thread 2/stress_heap.py new file mode 100644 index 0000000000000..206cf1a860120 --- /dev/null +++ b/tests/thread 2/stress_heap.py @@ -0,0 +1,48 @@ +# stress test for the heap by allocating lots of objects within threads +# allocates about 5mb on the heap +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +try: + import utime as time +except ImportError: + import time +import _thread + +def last(l): + return l[-1] + +def thread_entry(n): + # allocate a bytearray and fill it + data = bytearray(i for i in range(256)) + + # run a loop which allocates a small list and uses it each iteration + lst = 8 * [0] + sum = 0 + for i in range(n): + sum += last(lst) + lst = [0, 0, 0, 0, 0, 0, 0, i + 1] + + # check that the bytearray still has the right data + for i, b in enumerate(data): + assert i == b + + # print the result of the loop and indicate we are finished + with lock: + print(sum, lst[-1]) + global n_finished + n_finished += 1 + +lock = _thread.allocate_lock() +n_thread = 10 +n_finished = 0 + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(thread_entry, (10000,)) + +# wait for threads to finish +while n_finished < n_thread: + time.sleep(1) diff --git a/tests/thread 2/stress_recurse.py b/tests/thread 2/stress_recurse.py new file mode 100644 index 0000000000000..8edee246ad14e --- /dev/null +++ b/tests/thread 2/stress_recurse.py @@ -0,0 +1,27 @@ +# test hitting the function recursion limit within a thread +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +def foo(): + foo() + +def thread_entry(): + try: + foo() + except RuntimeError: + print('RuntimeError') + global finished + finished = True + +finished = False + +_thread.start_new_thread(thread_entry, ()) + +# busy wait for thread to finish +while not finished: + pass +print('done') diff --git a/tests/thread 2/thread_exc1.py b/tests/thread 2/thread_exc1.py new file mode 100644 index 0000000000000..e00a16bd2600a --- /dev/null +++ b/tests/thread 2/thread_exc1.py @@ -0,0 +1,32 @@ +# test raising and catching an exception within a thread +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +def foo(): + raise ValueError + +def thread_entry(): + try: + foo() + except ValueError: + pass + with lock: + global n_finished + n_finished += 1 + +lock = _thread.allocate_lock() +n_thread = 4 +n_finished = 0 + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(thread_entry, ()) + +# busy wait for threads to finish +while n_finished < n_thread: + pass +print('done') diff --git a/tests/thread 2/thread_exc2.py b/tests/thread 2/thread_exc2.py new file mode 100644 index 0000000000000..35cb32441204e --- /dev/null +++ b/tests/thread 2/thread_exc2.py @@ -0,0 +1,10 @@ +# test raising exception within thread which is not caught +import utime +import _thread + +def thread_entry(): + raise ValueError + +_thread.start_new_thread(thread_entry, ()) +utime.sleep(1) +print('done') diff --git a/tests/thread 2/thread_exc2.py.exp b/tests/thread 2/thread_exc2.py.exp new file mode 100644 index 0000000000000..cc7a20aa26575 --- /dev/null +++ b/tests/thread 2/thread_exc2.py.exp @@ -0,0 +1,5 @@ +Unhandled exception in thread started by +Traceback (most recent call last): + File \.\+, line 6, in thread_entry +ValueError: +done diff --git a/tests/thread 2/thread_exit1.py b/tests/thread 2/thread_exit1.py new file mode 100644 index 0000000000000..ad7b01d89bb1c --- /dev/null +++ b/tests/thread 2/thread_exit1.py @@ -0,0 +1,21 @@ +# test _thread.exit() function +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +try: + import utime as time +except ImportError: + import time +import _thread + +def thread_entry(): + _thread.exit() + +_thread.start_new_thread(thread_entry, ()) +_thread.start_new_thread(thread_entry, ()) + +# wait for threads to finish +time.sleep(1) +print('done') diff --git a/tests/thread 2/thread_exit2.py b/tests/thread 2/thread_exit2.py new file mode 100644 index 0000000000000..6bff8a1736e06 --- /dev/null +++ b/tests/thread 2/thread_exit2.py @@ -0,0 +1,21 @@ +# test raising SystemExit to finish a thread +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +try: + import utime as time +except ImportError: + import time +import _thread + +def thread_entry(): + raise SystemExit + +_thread.start_new_thread(thread_entry, ()) +_thread.start_new_thread(thread_entry, ()) + +# wait for threads to finish +time.sleep(1) +print('done') diff --git a/tests/thread 2/thread_gc1.py b/tests/thread 2/thread_gc1.py new file mode 100644 index 0000000000000..2ea189161503a --- /dev/null +++ b/tests/thread 2/thread_gc1.py @@ -0,0 +1,36 @@ +# test that we can run the garbage collector within threads +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import gc +import _thread + +def thread_entry(n): + # allocate a bytearray and fill it + data = bytearray(i for i in range(256)) + + # do some work and call gc.collect() a few times + for i in range(n): + for i in range(len(data)): + data[i] = data[i] + gc.collect() + + # print whether the data remains intact and indicate we are finished + with lock: + print(list(data) == list(range(256))) + global n_finished + n_finished += 1 + +lock = _thread.allocate_lock() +n_thread = 4 +n_finished = 0 + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(thread_entry, (10,)) + +# busy wait for threads to finish +while n_finished < n_thread: + pass diff --git a/tests/thread 2/thread_ident1.py b/tests/thread 2/thread_ident1.py new file mode 100644 index 0000000000000..9a6f89ff5f7e2 --- /dev/null +++ b/tests/thread 2/thread_ident1.py @@ -0,0 +1,23 @@ +# test _thread.get_ident() function +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +def thread_entry(): + tid = _thread.get_ident() + print('thread', type(tid) == int, tid != 0, tid != tid_main) + global finished + finished = True + +tid_main = _thread.get_ident() +print('main', type(tid_main) == int, tid_main != 0) + +finished = False +_thread.start_new_thread(thread_entry, ()) + +while not finished: + pass +print('done') diff --git a/tests/thread 2/thread_lock1.py b/tests/thread 2/thread_lock1.py new file mode 100644 index 0000000000000..c2d7c9d1ed165 --- /dev/null +++ b/tests/thread 2/thread_lock1.py @@ -0,0 +1,48 @@ +# test _thread lock object using a single thread +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +# create lock +lock = _thread.allocate_lock() + +print(type(lock) == _thread.LockType) + +# should be unlocked +print(lock.locked()) + +# basic acquire and release +print(lock.acquire()) +print(lock.locked()) +lock.release() +print(lock.locked()) + +# try acquire twice (second should fail) +print(lock.acquire()) +print(lock.locked()) +print(lock.acquire(0)) +print(lock.locked()) +lock.release() +print(lock.locked()) + +# test with capabilities of lock +with lock: + print(lock.locked()) + +# test that lock is unlocked if an error is rasied +try: + with lock: + print(lock.locked()) + raise KeyError +except KeyError: + print('KeyError') + print(lock.locked()) + +# test that we can't release an unlocked lock +try: + lock.release() +except RuntimeError: + print('RuntimeError') diff --git a/tests/thread 2/thread_lock2.py b/tests/thread 2/thread_lock2.py new file mode 100644 index 0000000000000..4ef912dff5240 --- /dev/null +++ b/tests/thread 2/thread_lock2.py @@ -0,0 +1,26 @@ +# test _thread lock objects with multiple threads +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +try: + import utime as time +except ImportError: + import time +import _thread + +lock = _thread.allocate_lock() + +def thread_entry(): + lock.acquire() + print('have it') + lock.release() + +# spawn the threads +for i in range(4): + _thread.start_new_thread(thread_entry, ()) + +# wait for threads to finish +time.sleep(1) +print('done') diff --git a/tests/thread 2/thread_lock3.py b/tests/thread 2/thread_lock3.py new file mode 100644 index 0000000000000..35808d99cbd71 --- /dev/null +++ b/tests/thread 2/thread_lock3.py @@ -0,0 +1,29 @@ +# test thread coordination using a lock object +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +lock = _thread.allocate_lock() +n_thread = 10 +n_finished = 0 + +def thread_entry(idx): + global n_finished + while True: + with lock: + if n_finished == idx: + break + print('my turn:', idx) + with lock: + n_finished += 1 + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(thread_entry, (i,)) + +# busy wait for threads to finish +while n_finished < n_thread: + pass diff --git a/tests/thread 2/thread_lock4.py b/tests/thread 2/thread_lock4.py new file mode 100644 index 0000000000000..440f3e90c68ed --- /dev/null +++ b/tests/thread 2/thread_lock4.py @@ -0,0 +1,53 @@ +# test using lock to coordinate access to global mutable objects +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +try: + import utime as time +except ImportError: + import time +import _thread + +def fac(n): + x = 1 + for i in range(1, n + 1): + x *= i + return x + +def thread_entry(): + while True: + with jobs_lock: + try: + f, arg = jobs.pop(0) + except IndexError: + return + ans = f(arg) + with output_lock: + output.append((arg, ans)) + +# create a list of jobs +jobs = [(fac, i) for i in range(20, 80)] +jobs_lock = _thread.allocate_lock() +n_jobs = len(jobs) + +# create a list to store the results +output = [] +output_lock = _thread.allocate_lock() + +# spawn threads to do the jobs +for i in range(4): + _thread.start_new_thread(thread_entry, ()) + +# wait for the jobs to complete +while True: + with jobs_lock: + if len(output) == n_jobs: + break + time.sleep(1) + +# sort and print the results +output.sort(key=lambda x: x[0]) +for arg, ans in output: + print(arg, ans) diff --git a/tests/thread 2/thread_qstr1.py b/tests/thread 2/thread_qstr1.py new file mode 100644 index 0000000000000..dccfb7f517180 --- /dev/null +++ b/tests/thread 2/thread_qstr1.py @@ -0,0 +1,41 @@ +# test concurrent interning of strings +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +try: + import utime as time +except ImportError: + import time +import _thread + +# function to check the interned string +def check(s, val): + assert type(s) == str + assert int(s) == val + +# main thread function +def th(base, n): + for i in range(n): + # this will intern the string and check it + exec("check('%u', %u)" % (base + i, base + i)) + + with lock: + global n_finished + n_finished += 1 + +lock = _thread.allocate_lock() +n_thread = 4 +n_finished = 0 +n_qstr_per_thread = 100 # make 1000 for a more stressful test (uses more heap) + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(th, (i * n_qstr_per_thread, n_qstr_per_thread)) + +# wait for threads to finish +while n_finished < n_thread: + time.sleep(1) + +print('pass') diff --git a/tests/thread 2/thread_shared1.py b/tests/thread 2/thread_shared1.py new file mode 100644 index 0000000000000..de339ad7f8ee1 --- /dev/null +++ b/tests/thread 2/thread_shared1.py @@ -0,0 +1,33 @@ +# test capability for threads to access a shared immutable data structure +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +def foo(i): + pass + +def thread_entry(n, tup): + for i in tup: + foo(i) + with lock: + global n_finished + n_finished += 1 + +lock = _thread.allocate_lock() +n_thread = 2 +n_finished = 0 + +# the shared data structure +tup = (1, 2, 3, 4) + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(thread_entry, (100, tup)) + +# busy wait for threads to finish +while n_finished < n_thread: + pass +print(tup) diff --git a/tests/thread 2/thread_shared2.py b/tests/thread 2/thread_shared2.py new file mode 100644 index 0000000000000..2c749e6883bf8 --- /dev/null +++ b/tests/thread 2/thread_shared2.py @@ -0,0 +1,34 @@ +# test capability for threads to access a shared mutable data structure +# (without contention because they access different parts of the structure) +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import _thread + +def foo(lst, i): + lst[i] += 1 + +def thread_entry(n, lst, idx): + for i in range(n): + foo(lst, idx) + with lock: + global n_finished + n_finished += 1 + +lock = _thread.allocate_lock() +n_thread = 2 +n_finished = 0 + +# the shared data structure +lst = [0, 0] + +# spawn threads +for i in range(n_thread): + _thread.start_new_thread(thread_entry, ((i + 1) * 10, lst, i)) + +# busy wait for threads to finish +while n_finished < n_thread: + pass +print(lst) diff --git a/tests/thread 2/thread_sleep1.py b/tests/thread 2/thread_sleep1.py new file mode 100644 index 0000000000000..d5aa99f977622 --- /dev/null +++ b/tests/thread 2/thread_sleep1.py @@ -0,0 +1,33 @@ +# test threads sleeping +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +try: + import utime + sleep_ms = utime.sleep_ms +except ImportError: + import time + sleep_ms = lambda t: time.sleep(t / 1000) + +import _thread + +lock = _thread.allocate_lock() +n_thread = 4 +n_finished = 0 + +def thread_entry(t): + global n_finished + sleep_ms(t) + sleep_ms(2 * t) + with lock: + n_finished += 1 + +for i in range(n_thread): + _thread.start_new_thread(thread_entry, (10 * i,)) + +# wait for threads to finish +while n_finished < n_thread: + sleep_ms(100) +print('done', n_thread) diff --git a/tests/thread 2/thread_stacksize1.py b/tests/thread 2/thread_stacksize1.py new file mode 100644 index 0000000000000..e7189fafbc198 --- /dev/null +++ b/tests/thread 2/thread_stacksize1.py @@ -0,0 +1,49 @@ +# test setting the thread stack size +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +import sys +import _thread + +# different implementations have different minimum sizes +if sys.implementation.name == 'micropython': + sz = 2 * 1024 +else: + sz = 32 * 1024 + +def foo(): + pass + +def thread_entry(): + foo() + with lock: + global n_finished + n_finished += 1 + +# reset stack size to default +_thread.stack_size() + +# test set/get of stack size +print(_thread.stack_size()) +print(_thread.stack_size(sz)) +print(_thread.stack_size() == sz) +print(_thread.stack_size()) + +lock = _thread.allocate_lock() +n_thread = 2 +n_finished = 0 + +# set stack size and spawn a few threads +_thread.stack_size(sz) +for i in range(n_thread): + _thread.start_new_thread(thread_entry, ()) + +# reset stack size to default (for subsequent scripts on baremetal) +_thread.stack_size() + +# busy wait for threads to finish +while n_finished < n_thread: + pass +print('done') diff --git a/tests/thread 2/thread_start1.py b/tests/thread 2/thread_start1.py new file mode 100644 index 0000000000000..94df6dc625f60 --- /dev/null +++ b/tests/thread 2/thread_start1.py @@ -0,0 +1,25 @@ +# test basic capability to start a new thread +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +try: + import utime as time +except ImportError: + import time +import _thread + +def foo(): + pass + +def thread_entry(n): + for i in range(n): + foo() + +_thread.start_new_thread(thread_entry, (10,)) +_thread.start_new_thread(thread_entry, (20,)) + +# wait for threads to finish +time.sleep(1) +print('done') diff --git a/tests/thread 2/thread_start2.py b/tests/thread 2/thread_start2.py new file mode 100644 index 0000000000000..9412bb6183331 --- /dev/null +++ b/tests/thread 2/thread_start2.py @@ -0,0 +1,28 @@ +# test capability to start a thread with keyword args +# +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT + +try: + import utime as time +except ImportError: + import time +import _thread + +def thread_entry(a0, a1, a2, a3): + print('thread', a0, a1, a2, a3) + +# spawn thread using kw args +_thread.start_new_thread(thread_entry, (10, 20), {'a2': 0, 'a3': 1}) + +# wait for thread to finish +time.sleep(1) + +# incorrect argument where dictionary is needed for keyword args +try: + _thread.start_new_thread(thread_entry, (), ()) +except TypeError: + print('TypeError') + +print('done') diff --git a/tests/unix 2/extra_coverage.py b/tests/unix 2/extra_coverage.py new file mode 100644 index 0000000000000..13721f1f479c3 --- /dev/null +++ b/tests/unix 2/extra_coverage.py @@ -0,0 +1,74 @@ +try: + extra_coverage +except NameError: + print("SKIP") + raise SystemExit + +import uerrno +import uio + +data = extra_coverage() + +# test hashing of str/bytes that have an invalid hash +print(data[0], data[1]) +print(hash(data[0])) +print(hash(data[1])) +print(hash(bytes(data[0], 'utf8'))) +print(hash(str(data[1], 'utf8'))) + +# test streams +stream = data[2] # has set_error and set_buf. Write always returns error +stream.set_error(uerrno.EAGAIN) # non-blocking error +print(stream.read()) # read all encounters non-blocking error +print(stream.read(1)) # read 1 byte encounters non-blocking error +print(stream.readline()) # readline encounters non-blocking error +print(stream.readinto(bytearray(10))) # readinto encounters non-blocking error +print(stream.write(b'1')) # write encounters non-blocking error +print(stream.write1(b'1')) # write1 encounters non-blocking error +stream.set_buf(b'123') +print(stream.read(4)) # read encounters non-blocking error after successful reads +stream.set_buf(b'123') +print(stream.read1(4)) # read1 encounters non-blocking error after successful reads +stream.set_buf(b'123') +print(stream.readline(4)) # readline encounters non-blocking error after successful reads +try: + print(stream.ioctl(0, 0)) # ioctl encounters non-blocking error; raises OSError +except OSError: + print('OSError') +stream.set_error(0) +print(stream.ioctl(0, bytearray(10))) # successful ioctl call + +stream2 = data[3] # is textio +print(stream2.read(1)) # read 1 byte encounters non-blocking error with textio stream + +# test BufferedWriter with stream errors +stream.set_error(uerrno.EAGAIN) +buf = uio.BufferedWriter(stream, 8) +print(buf.write(bytearray(16))) + +# test basic import of frozen scripts +import frzstr1 +import frzmpy1 + +# test import of frozen packages with __init__.py +import frzstr_pkg1 +print(frzstr_pkg1.x) +import frzmpy_pkg1 +print(frzmpy_pkg1.x) + +# test import of frozen packages without __init__.py +from frzstr_pkg2.mod import Foo +print(Foo.x) +from frzmpy_pkg2.mod import Foo +print(Foo.x) + +# test raising exception in frozen script +try: + import frzmpy2 +except ZeroDivisionError: + print('ZeroDivisionError') + +# test loading a resource from a frozen string +import uio +buf = uio.resource_stream('frzstr_pkg2', 'mod.py') +print(buf.read(21)) diff --git a/tests/unix 2/extra_coverage.py.exp b/tests/unix 2/extra_coverage.py.exp new file mode 100644 index 0000000000000..06b5d3790354d --- /dev/null +++ b/tests/unix 2/extra_coverage.py.exp @@ -0,0 +1,106 @@ +# mp_printf +-123 +123 123 +-0123 +123 +123 +1ABCDEF +ab abc + +false true +(null) +-2147483648 +2147483648 +80000000 +80000000 +abc +# GC +0 +0 +# vstr +tests +sts + +test +tes +RuntimeError: +RuntimeError: +# repl +ame__ + +argv byteorder exc_info exit +getsizeof implementation maxsize modules +path platform print_exception +stderr stdin stdout version +version_info +ementation +# attrtuple +(start=1, stop=2, step=3) +# str +1 +# bytearray +data +# mpz +1 +12345678 +0 +0 +0 +0 +0 +1 +12345 +6 +# runtime utils +TypeError: unsupported type for __abs__: 'str' +TypeError: unsupported types for __divmod__: 'str', 'str' +Warning: test +# format float +? ++1e+00 ++1e+00 +# binary +123 +456 +# VM +2 1 +# scheduler +sched(0)=1 +sched(1)=1 +sched(2)=1 +sched(3)=1 +sched(4)=0 +unlocked +3 +2 +1 +0 +0123456789 b'0123456789' +7300 +7300 +7300 +7300 +None +None +None +None +None +None +b'123' +b'123' +b'123' +OSError +0 +None +None +frzstr1 +frzmpy1 +frzstr_pkg1.__init__ +1 +frzmpy_pkg1.__init__ +1 +frzstr_pkg2.mod +1 +frzmpy_pkg2.mod +1 +ZeroDivisionError +b'# test frozen package' diff --git a/tests/unix 2/ffi_callback.py b/tests/unix 2/ffi_callback.py new file mode 100644 index 0000000000000..23b058bcec2c4 --- /dev/null +++ b/tests/unix 2/ffi_callback.py @@ -0,0 +1,33 @@ +try: + import ffi +except ImportError: + print("SKIP") + raise SystemExit + + +def ffi_open(names): + err = None + for n in names: + try: + mod = ffi.open(n) + return mod + except OSError as e: + err = e + raise err + +libc = ffi_open(('libc.so', 'libc.so.0', 'libc.so.6', 'libc.dylib')) + +qsort = libc.func("v", "qsort", "piip") + +def cmp(pa, pb): + a = ffi.as_bytearray(pa, 1) + b = ffi.as_bytearray(pb, 1) + #print("cmp:", a, b) + return a[0] - b[0] + +cmp_c = ffi.callback("i", cmp, "pp") + +s = bytearray(b"foobar") +print("org string:", s) +qsort(s, len(s), 1, cmp_c) +print("qsort'ed:", s) diff --git a/tests/unix 2/ffi_callback.py.exp b/tests/unix 2/ffi_callback.py.exp new file mode 100644 index 0000000000000..d06fec52fbb31 --- /dev/null +++ b/tests/unix 2/ffi_callback.py.exp @@ -0,0 +1,2 @@ +org string: bytearray(b'foobar') +qsort'ed: bytearray(b'abfoor') diff --git a/tests/unix 2/ffi_float.py b/tests/unix 2/ffi_float.py new file mode 100644 index 0000000000000..c92a39bcdc821 --- /dev/null +++ b/tests/unix 2/ffi_float.py @@ -0,0 +1,32 @@ +# test ffi float support +try: + import ffi +except ImportError: + print("SKIP") + raise SystemExit + + +def ffi_open(names): + err = None + for n in names: + try: + mod = ffi.open(n) + return mod + except OSError as e: + err = e + raise err + +libc = ffi_open(('libc.so', 'libc.so.0', 'libc.so.6', 'libc.dylib')) + +strtof = libc.func("f", "strtof", "sp") +print('%.6f' % strtof('1.23', None)) + +strtod = libc.func("d", "strtod", "sp") +print('%.6f' % strtod('1.23', None)) + +# test passing double and float args +libm = ffi_open(('libm.so', 'libm.so.6', 'libc.so.0', 'libc.so.6', 'libc.dylib')) +tgamma = libm.func('d', 'tgamma', 'd') +for fun in (tgamma,): + for val in (0.5, 1, 1.0, 1.5, 4, 4.0): + print('%.6f' % fun(val)) diff --git a/tests/unix 2/ffi_float.py.exp b/tests/unix 2/ffi_float.py.exp new file mode 100644 index 0000000000000..b9d7da2bdb99c --- /dev/null +++ b/tests/unix 2/ffi_float.py.exp @@ -0,0 +1,8 @@ +1.230000 +1.230000 +1.772454 +1.000000 +1.000000 +0.886227 +6.000000 +6.000000 diff --git a/tests/unix 2/ffi_float2.py b/tests/unix 2/ffi_float2.py new file mode 100644 index 0000000000000..721eb4d192f17 --- /dev/null +++ b/tests/unix 2/ffi_float2.py @@ -0,0 +1,31 @@ +# test ffi float support +try: + import ffi +except ImportError: + print("SKIP") + raise SystemExit + + +def ffi_open(names): + err = None + for n in names: + try: + mod = ffi.open(n) + return mod + except OSError as e: + err = e + raise err + +libm = ffi_open(('libm.so', 'libm.so.6', 'libc.so.0', 'libc.so.6', 'libc.dylib')) + +# Some libc's implement tgammaf as header macro with tgamma(), so don't assume +# it'll be in library. +try: + tgammaf = libm.func('f', 'tgammaf', 'f') +except OSError: + print("SKIP") + raise SystemExit + +for fun in (tgammaf,): + for val in (0.5, 1, 1.0, 1.5, 4, 4.0): + print('%.6f' % fun(val)) diff --git a/tests/unix 2/ffi_float2.py.exp b/tests/unix 2/ffi_float2.py.exp new file mode 100644 index 0000000000000..58fc6a01acb07 --- /dev/null +++ b/tests/unix 2/ffi_float2.py.exp @@ -0,0 +1,6 @@ +1.772454 +1.000000 +1.000000 +0.886227 +6.000000 +6.000000 diff --git a/tools/.gitattributes 2 b/tools/.gitattributes 2 new file mode 100644 index 0000000000000..9206a0bfc1369 --- /dev/null +++ b/tools/.gitattributes 2 @@ -0,0 +1 @@ +*.tar.gz binary diff --git a/tools/.gitignore 2 b/tools/.gitignore 2 new file mode 100644 index 0000000000000..9f65f493bc655 --- /dev/null +++ b/tools/.gitignore 2 @@ -0,0 +1,8 @@ +tinytest/.gitignore +tinytest/.travis.yml +tinytest/Makefile +tinytest/Makefile.arm-cortex-m3-qemu +tinytest/Makefile.avr +tinytest/TODO +tinytest/portable_demo.c +tinytest/tinytest_demo.c From 2f476731ecd8bc108f00210b81a0c3e0333d8982 Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Wed, 16 Dec 2020 10:35:41 -0500 Subject: [PATCH 442/770] removing pesky directories --- tests/README 2 | 18 - tests/extmod 2/btree1.py | 89 --- tests/extmod 2/framebuf1.py | 109 ---- tests/extmod 2/framebuf16.py | 59 -- tests/extmod 2/framebuf2.py.exp | 57 -- tests/extmod 2/framebuf4.py | 53 -- tests/extmod 2/framebuf_subclass.py | 20 - tests/extmod 2/machine1.py | 28 - tests/extmod 2/machine_pinbase.py | 30 - tests/extmod 2/machine_pinbase.py.exp | 9 - tests/extmod 2/ticks_diff.py | 33 - tests/extmod 2/time_ms_us.py | 22 - tests/extmod 2/time_ms_us.py.exp | 3 - tests/extmod 2/ubinascii_a2b_base64.py | 49 -- tests/extmod 2/ubinascii_hexlify.py | 17 - tests/extmod 2/uctypes_32bit_intbig.py.exp | 11 - .../uctypes_array_assign_native_le.py | 89 --- .../uctypes_array_assign_native_le.py.exp | 11 - .../uctypes_array_assign_native_le_intbig.py | 43 -- tests/extmod 2/uctypes_bytearray.py | 22 - tests/extmod 2/uctypes_byteat.py | 10 - tests/extmod 2/uctypes_byteat.py.exp | 2 - tests/extmod 2/uctypes_error.py | 37 -- tests/extmod 2/uctypes_error.py.exp | 4 - tests/extmod 2/uctypes_le_float.py | 24 - tests/extmod 2/uctypes_native_float.py | 20 - tests/extmod 2/uctypes_ptr_le.py | 34 - tests/extmod 2/uctypes_ptr_native_le.py.exp | 6 - tests/extmod 2/uctypes_sizeof.py.exp | 7 - tests/extmod 2/uhashlib_sha1.py | 28 - tests/extmod 2/ujson_dump.py | 30 - tests/extmod 2/ujson_dumps_extra.py | 9 - tests/extmod 2/ujson_dumps_float.py | 10 - tests/extmod 2/ujson_load_readinto.py.exp | 4 - tests/extmod 2/ujson_loads.py | 74 --- tests/extmod 2/ujson_loads_float.py | 17 - tests/extmod 2/urandom_basic.py | 29 - tests/extmod 2/ure1.py | 103 --- tests/extmod 2/ure_debug.py.exp | 15 - tests/extmod 2/ure_error.py | 25 - tests/extmod 2/ure_namedclass.py | 32 - tests/extmod 2/ure_stack_overflow.py.exp | 1 - tests/extmod 2/ure_sub_unmatched.py.exp | 1 - tests/extmod 2/ussl_basic.py | 59 -- tests/extmod 2/utimeq1.py | 137 ---- tests/extmod 2/utimeq_stable.py.exp | 1 - tests/extmod 2/uzlib_decompio.py | 33 - tests/extmod 2/uzlib_decompio_gz.py.exp | 13 - tests/extmod 2/vfs_fat_fileio1.py | 139 ---- tests/extmod 2/vfs_fat_fileio1.py.exp | 18 - tests/extmod 2/vfs_fat_more.py.exp | 29 - tests/extmod 2/vfs_fat_oldproto.py.exp | 3 - tests/extmod 2/vfs_fat_ramdisk.py.exp | 17 - tests/extmod 2/websocket_basic.py.exp | 14 - tests/feature_check 2/README | 4 - tests/feature_check 2/async_check.py | 3 - tests/feature_check 2/async_check.py.exp | 0 tests/feature_check 2/byteorder.py | 2 - tests/feature_check 2/byteorder.py.exp | 0 tests/feature_check 2/complex.py | 5 - tests/feature_check 2/complex.py.exp | 0 tests/feature_check 2/const.py | 1 - tests/feature_check 2/const.py.exp | 0 tests/feature_check 2/coverage.py | 5 - tests/feature_check 2/coverage.py.exp | 0 tests/feature_check 2/float.py | 13 - tests/feature_check 2/float.py.exp | 1 - tests/feature_check 2/int_big.py | 2 - tests/feature_check 2/int_big.py.exp | 1 - tests/feature_check 2/native_check.py | 4 - tests/feature_check 2/native_check.py.exp | 0 tests/feature_check 2/repl_emacs_check.py | 3 - tests/feature_check 2/repl_emacs_check.py.exp | 7 - tests/feature_check 2/reverse_ops.py | 9 - tests/feature_check 2/reverse_ops.py.exp | 0 tests/feature_check 2/set_check.py | 2 - tests/feature_check 2/set_check.py.exp | 0 tests/float 2/array_construct.py | 10 - tests/float 2/builtin_float_hash.py | 25 - tests/float 2/builtin_float_minmax.py | 31 - tests/float 2/builtin_float_pow.py | 11 - tests/float 2/builtin_float_round.py | 24 - tests/float 2/builtin_float_round_intbig.py | 4 - tests/float 2/bytearray_construct.py | 9 - tests/float 2/bytes_construct.py | 9 - tests/float 2/cmath_fun.py | 55 -- tests/float 2/cmath_fun_special.py | 31 - tests/float 2/complex1.py | 116 ---- tests/float 2/complex1_intbig.py | 4 - tests/float 2/float1.py | 119 ---- tests/float 2/float2int_doubleprec_intbig.py | 100 --- tests/float 2/float2int_fp30_intbig.py | 97 --- tests/float 2/float2int_intbig.py | 99 --- tests/float 2/float_array.py | 20 - tests/float 2/float_compare.py | 22 - tests/float 2/float_divmod.py | 25 - tests/float 2/float_divmod_relaxed.py | 33 - tests/float 2/float_format.py | 19 - tests/float 2/float_parse.py | 32 - tests/float 2/float_parse_doubleprec.py | 21 - tests/float 2/float_struct.py | 17 - tests/float 2/int_big_float.py | 28 - tests/float 2/int_divzero.py | 9 - tests/float 2/int_power.py | 8 - tests/float 2/list_index.py | 8 - tests/float 2/math_domain.py | 51 -- tests/float 2/math_domain_special.py | 36 - tests/float 2/math_fun.py | 63 -- tests/float 2/math_fun_bool.py | 16 - tests/float 2/math_fun_int.py | 14 - tests/float 2/math_fun_intbig.py | 11 - tests/float 2/math_fun_special.py | 35 - tests/float 2/python36.py | 10 - tests/float 2/python36.py.exp | 5 - tests/float 2/string_format.py | 41 -- tests/float 2/string_format2.py | 106 --- tests/float 2/string_format_fp30.py | 41 -- tests/float 2/string_format_modulo.py | 49 -- tests/float 2/string_format_modulo2.py | 24 - tests/float 2/string_format_modulo2_intbig.py | 21 - tests/float 2/string_format_modulo3.py | 3 - tests/float 2/string_format_modulo3.py.exp | 2 - tests/float 2/true_value.py | 7 - tests/float 2/types.py | 17 - tests/inlineasm 2/asmargs.py | 29 - tests/inlineasm 2/asmargs.py.exp | 5 - tests/inlineasm 2/asmbcc.py | 27 - tests/inlineasm 2/asmbcc.py.exp | 4 - tests/inlineasm 2/asmbitops.py | 13 - tests/inlineasm 2/asmbitops.py.exp | 4 - tests/inlineasm 2/asmblbx.py | 21 - tests/inlineasm 2/asmblbx.py.exp | 2 - tests/inlineasm 2/asmconst.py | 8 - tests/inlineasm 2/asmconst.py.exp | 1 - tests/inlineasm 2/asmdiv.py | 16 - tests/inlineasm 2/asmdiv.py.exp | 7 - tests/inlineasm 2/asmfpaddsub.py | 14 - tests/inlineasm 2/asmfpaddsub.py.exp | 1 - tests/inlineasm 2/asmfpcmp.py | 14 - tests/inlineasm 2/asmfpcmp.py.exp | 3 - tests/inlineasm 2/asmfpldrstr.py | 11 - tests/inlineasm 2/asmfpldrstr.py.exp | 1 - tests/inlineasm 2/asmfpmuldiv.py | 14 - tests/inlineasm 2/asmfpmuldiv.py.exp | 1 - tests/inlineasm 2/asmfpsqrt.py | 14 - tests/inlineasm 2/asmfpsqrt.py.exp | 1 - tests/inlineasm 2/asmit.py | 16 - tests/inlineasm 2/asmit.py.exp | 2 - tests/inlineasm 2/asmpushpop.py | 8 - tests/inlineasm 2/asmpushpop.py.exp | 1 - tests/inlineasm 2/asmrettype.py | 21 - tests/inlineasm 2/asmrettype.py.exp | 4 - tests/inlineasm 2/asmshift.py | 29 - tests/inlineasm 2/asmshift.py.exp | 6 - tests/inlineasm 2/asmspecialregs.py | 10 - tests/inlineasm 2/asmspecialregs.py.exp | 2 - tests/inlineasm 2/asmsum.py | 57 -- tests/inlineasm 2/asmsum.py.exp | 2 - tests/jni 2/README | 11 - tests/jni 2/list.py | 15 - tests/jni 2/list.py.exp | 4 - tests/jni 2/object.py | 15 - tests/jni 2/object.py.exp | 3 - tests/jni 2/system_out.py | 8 - tests/jni 2/system_out.py.exp | 1 - tests/net_hosted 2/README | 11 - tests/net_hosted 2/accept_nonblock.py | 16 - tests/net_hosted 2/accept_nonblock.py.exp | 1 - tests/net_hosted 2/accept_timeout.py | 22 - tests/net_hosted 2/accept_timeout.py.exp | 1 - tests/net_hosted 2/connect_nonblock.py | 20 - tests/net_hosted 2/connect_nonblock.py.exp | 1 - tests/net_hosted 2/connect_poll.py | 32 - tests/net_hosted 2/connect_poll.py.exp | 3 - tests/net_hosted 2/ssl_getpeercert.py | 21 - tests/net_hosted 2/ssl_getpeercert.py.exp | 1 - tests/net_inet 2/README | 5 - tests/net_inet 2/test_tls_sites.py | 59 -- tests/net_inet 2/test_tls_sites.py.exp | 5 - tests/run-bench-tests 2 | 97 --- tests/run-tests 2 | 615 ------------------ tests/stress 2/dict_copy.py | 7 - tests/stress 2/dict_create.py | 8 - tests/stress 2/dict_create_max.py | 13 - tests/stress 2/gc_trace.py | 17 - tests/stress 2/list_sort.py | 6 - tests/stress 2/recursion.py | 7 - tests/stress 2/recursive_data.py | 13 - tests/stress 2/recursive_data.py.exp | 1 - tests/stress 2/recursive_gen.py | 18 - tests/stress 2/recursive_iternext.py | 57 -- tests/stress 2/recursive_iternext.py.exp | 4 - tests/thread 2/mutate_bytearray.py | 46 -- tests/thread 2/mutate_dict.py | 44 -- tests/thread 2/mutate_instance.py | 45 -- tests/thread 2/mutate_list.py | 46 -- tests/thread 2/mutate_set.py | 39 -- tests/thread 2/stress_aes.py | 257 -------- tests/thread 2/stress_create.py | 22 - tests/thread 2/stress_heap.py | 48 -- tests/thread 2/stress_recurse.py | 27 - tests/thread 2/thread_exc1.py | 32 - tests/thread 2/thread_exc2.py | 10 - tests/thread 2/thread_exc2.py.exp | 5 - tests/thread 2/thread_exit1.py | 21 - tests/thread 2/thread_exit2.py | 21 - tests/thread 2/thread_gc1.py | 36 - tests/thread 2/thread_ident1.py | 23 - tests/thread 2/thread_lock1.py | 48 -- tests/thread 2/thread_lock2.py | 26 - tests/thread 2/thread_lock3.py | 29 - tests/thread 2/thread_lock4.py | 53 -- tests/thread 2/thread_qstr1.py | 41 -- tests/thread 2/thread_shared1.py | 33 - tests/thread 2/thread_shared2.py | 34 - tests/thread 2/thread_sleep1.py | 33 - tests/thread 2/thread_stacksize1.py | 49 -- tests/thread 2/thread_start1.py | 25 - tests/thread 2/thread_start2.py | 28 - tests/unix 2/extra_coverage.py | 74 --- tests/unix 2/extra_coverage.py.exp | 106 --- tests/unix 2/ffi_callback.py | 33 - tests/unix 2/ffi_callback.py.exp | 2 - tests/unix 2/ffi_float.py | 32 - tests/unix 2/ffi_float.py.exp | 8 - tests/unix 2/ffi_float2.py | 31 - tests/unix 2/ffi_float2.py.exp | 6 - 227 files changed, 6257 deletions(-) delete mode 100644 tests/README 2 delete mode 100644 tests/extmod 2/btree1.py delete mode 100644 tests/extmod 2/framebuf1.py delete mode 100644 tests/extmod 2/framebuf16.py delete mode 100644 tests/extmod 2/framebuf2.py.exp delete mode 100644 tests/extmod 2/framebuf4.py delete mode 100644 tests/extmod 2/framebuf_subclass.py delete mode 100644 tests/extmod 2/machine1.py delete mode 100644 tests/extmod 2/machine_pinbase.py delete mode 100644 tests/extmod 2/machine_pinbase.py.exp delete mode 100644 tests/extmod 2/ticks_diff.py delete mode 100644 tests/extmod 2/time_ms_us.py delete mode 100644 tests/extmod 2/time_ms_us.py.exp delete mode 100644 tests/extmod 2/ubinascii_a2b_base64.py delete mode 100644 tests/extmod 2/ubinascii_hexlify.py delete mode 100644 tests/extmod 2/uctypes_32bit_intbig.py.exp delete mode 100644 tests/extmod 2/uctypes_array_assign_native_le.py delete mode 100644 tests/extmod 2/uctypes_array_assign_native_le.py.exp delete mode 100644 tests/extmod 2/uctypes_array_assign_native_le_intbig.py delete mode 100644 tests/extmod 2/uctypes_bytearray.py delete mode 100644 tests/extmod 2/uctypes_byteat.py delete mode 100644 tests/extmod 2/uctypes_byteat.py.exp delete mode 100644 tests/extmod 2/uctypes_error.py delete mode 100644 tests/extmod 2/uctypes_error.py.exp delete mode 100644 tests/extmod 2/uctypes_le_float.py delete mode 100644 tests/extmod 2/uctypes_native_float.py delete mode 100644 tests/extmod 2/uctypes_ptr_le.py delete mode 100644 tests/extmod 2/uctypes_ptr_native_le.py.exp delete mode 100644 tests/extmod 2/uctypes_sizeof.py.exp delete mode 100644 tests/extmod 2/uhashlib_sha1.py delete mode 100644 tests/extmod 2/ujson_dump.py delete mode 100644 tests/extmod 2/ujson_dumps_extra.py delete mode 100644 tests/extmod 2/ujson_dumps_float.py delete mode 100644 tests/extmod 2/ujson_load_readinto.py.exp delete mode 100644 tests/extmod 2/ujson_loads.py delete mode 100644 tests/extmod 2/ujson_loads_float.py delete mode 100644 tests/extmod 2/urandom_basic.py delete mode 100644 tests/extmod 2/ure1.py delete mode 100644 tests/extmod 2/ure_debug.py.exp delete mode 100644 tests/extmod 2/ure_error.py delete mode 100644 tests/extmod 2/ure_namedclass.py delete mode 100644 tests/extmod 2/ure_stack_overflow.py.exp delete mode 100644 tests/extmod 2/ure_sub_unmatched.py.exp delete mode 100644 tests/extmod 2/ussl_basic.py delete mode 100644 tests/extmod 2/utimeq1.py delete mode 100644 tests/extmod 2/utimeq_stable.py.exp delete mode 100644 tests/extmod 2/uzlib_decompio.py delete mode 100644 tests/extmod 2/uzlib_decompio_gz.py.exp delete mode 100644 tests/extmod 2/vfs_fat_fileio1.py delete mode 100644 tests/extmod 2/vfs_fat_fileio1.py.exp delete mode 100644 tests/extmod 2/vfs_fat_more.py.exp delete mode 100644 tests/extmod 2/vfs_fat_oldproto.py.exp delete mode 100644 tests/extmod 2/vfs_fat_ramdisk.py.exp delete mode 100644 tests/extmod 2/websocket_basic.py.exp delete mode 100644 tests/feature_check 2/README delete mode 100644 tests/feature_check 2/async_check.py delete mode 100644 tests/feature_check 2/async_check.py.exp delete mode 100644 tests/feature_check 2/byteorder.py delete mode 100644 tests/feature_check 2/byteorder.py.exp delete mode 100644 tests/feature_check 2/complex.py delete mode 100644 tests/feature_check 2/complex.py.exp delete mode 100644 tests/feature_check 2/const.py delete mode 100644 tests/feature_check 2/const.py.exp delete mode 100644 tests/feature_check 2/coverage.py delete mode 100644 tests/feature_check 2/coverage.py.exp delete mode 100644 tests/feature_check 2/float.py delete mode 100644 tests/feature_check 2/float.py.exp delete mode 100644 tests/feature_check 2/int_big.py delete mode 100644 tests/feature_check 2/int_big.py.exp delete mode 100644 tests/feature_check 2/native_check.py delete mode 100644 tests/feature_check 2/native_check.py.exp delete mode 100644 tests/feature_check 2/repl_emacs_check.py delete mode 100644 tests/feature_check 2/repl_emacs_check.py.exp delete mode 100644 tests/feature_check 2/reverse_ops.py delete mode 100644 tests/feature_check 2/reverse_ops.py.exp delete mode 100644 tests/feature_check 2/set_check.py delete mode 100644 tests/feature_check 2/set_check.py.exp delete mode 100644 tests/float 2/array_construct.py delete mode 100644 tests/float 2/builtin_float_hash.py delete mode 100644 tests/float 2/builtin_float_minmax.py delete mode 100644 tests/float 2/builtin_float_pow.py delete mode 100644 tests/float 2/builtin_float_round.py delete mode 100644 tests/float 2/builtin_float_round_intbig.py delete mode 100644 tests/float 2/bytearray_construct.py delete mode 100644 tests/float 2/bytes_construct.py delete mode 100644 tests/float 2/cmath_fun.py delete mode 100644 tests/float 2/cmath_fun_special.py delete mode 100644 tests/float 2/complex1.py delete mode 100644 tests/float 2/complex1_intbig.py delete mode 100644 tests/float 2/float1.py delete mode 100644 tests/float 2/float2int_doubleprec_intbig.py delete mode 100644 tests/float 2/float2int_fp30_intbig.py delete mode 100644 tests/float 2/float2int_intbig.py delete mode 100644 tests/float 2/float_array.py delete mode 100644 tests/float 2/float_compare.py delete mode 100644 tests/float 2/float_divmod.py delete mode 100644 tests/float 2/float_divmod_relaxed.py delete mode 100644 tests/float 2/float_format.py delete mode 100644 tests/float 2/float_parse.py delete mode 100644 tests/float 2/float_parse_doubleprec.py delete mode 100644 tests/float 2/float_struct.py delete mode 100644 tests/float 2/int_big_float.py delete mode 100644 tests/float 2/int_divzero.py delete mode 100644 tests/float 2/int_power.py delete mode 100644 tests/float 2/list_index.py delete mode 100644 tests/float 2/math_domain.py delete mode 100644 tests/float 2/math_domain_special.py delete mode 100644 tests/float 2/math_fun.py delete mode 100644 tests/float 2/math_fun_bool.py delete mode 100644 tests/float 2/math_fun_int.py delete mode 100644 tests/float 2/math_fun_intbig.py delete mode 100644 tests/float 2/math_fun_special.py delete mode 100644 tests/float 2/python36.py delete mode 100644 tests/float 2/python36.py.exp delete mode 100644 tests/float 2/string_format.py delete mode 100644 tests/float 2/string_format2.py delete mode 100644 tests/float 2/string_format_fp30.py delete mode 100644 tests/float 2/string_format_modulo.py delete mode 100644 tests/float 2/string_format_modulo2.py delete mode 100644 tests/float 2/string_format_modulo2_intbig.py delete mode 100644 tests/float 2/string_format_modulo3.py delete mode 100644 tests/float 2/string_format_modulo3.py.exp delete mode 100644 tests/float 2/true_value.py delete mode 100644 tests/float 2/types.py delete mode 100644 tests/inlineasm 2/asmargs.py delete mode 100644 tests/inlineasm 2/asmargs.py.exp delete mode 100644 tests/inlineasm 2/asmbcc.py delete mode 100644 tests/inlineasm 2/asmbcc.py.exp delete mode 100644 tests/inlineasm 2/asmbitops.py delete mode 100644 tests/inlineasm 2/asmbitops.py.exp delete mode 100644 tests/inlineasm 2/asmblbx.py delete mode 100644 tests/inlineasm 2/asmblbx.py.exp delete mode 100644 tests/inlineasm 2/asmconst.py delete mode 100644 tests/inlineasm 2/asmconst.py.exp delete mode 100644 tests/inlineasm 2/asmdiv.py delete mode 100644 tests/inlineasm 2/asmdiv.py.exp delete mode 100644 tests/inlineasm 2/asmfpaddsub.py delete mode 100644 tests/inlineasm 2/asmfpaddsub.py.exp delete mode 100644 tests/inlineasm 2/asmfpcmp.py delete mode 100644 tests/inlineasm 2/asmfpcmp.py.exp delete mode 100644 tests/inlineasm 2/asmfpldrstr.py delete mode 100644 tests/inlineasm 2/asmfpldrstr.py.exp delete mode 100644 tests/inlineasm 2/asmfpmuldiv.py delete mode 100644 tests/inlineasm 2/asmfpmuldiv.py.exp delete mode 100644 tests/inlineasm 2/asmfpsqrt.py delete mode 100644 tests/inlineasm 2/asmfpsqrt.py.exp delete mode 100644 tests/inlineasm 2/asmit.py delete mode 100644 tests/inlineasm 2/asmit.py.exp delete mode 100644 tests/inlineasm 2/asmpushpop.py delete mode 100644 tests/inlineasm 2/asmpushpop.py.exp delete mode 100644 tests/inlineasm 2/asmrettype.py delete mode 100644 tests/inlineasm 2/asmrettype.py.exp delete mode 100644 tests/inlineasm 2/asmshift.py delete mode 100644 tests/inlineasm 2/asmshift.py.exp delete mode 100644 tests/inlineasm 2/asmspecialregs.py delete mode 100644 tests/inlineasm 2/asmspecialregs.py.exp delete mode 100644 tests/inlineasm 2/asmsum.py delete mode 100644 tests/inlineasm 2/asmsum.py.exp delete mode 100644 tests/jni 2/README delete mode 100644 tests/jni 2/list.py delete mode 100644 tests/jni 2/list.py.exp delete mode 100644 tests/jni 2/object.py delete mode 100644 tests/jni 2/object.py.exp delete mode 100644 tests/jni 2/system_out.py delete mode 100644 tests/jni 2/system_out.py.exp delete mode 100644 tests/net_hosted 2/README delete mode 100644 tests/net_hosted 2/accept_nonblock.py delete mode 100644 tests/net_hosted 2/accept_nonblock.py.exp delete mode 100644 tests/net_hosted 2/accept_timeout.py delete mode 100644 tests/net_hosted 2/accept_timeout.py.exp delete mode 100644 tests/net_hosted 2/connect_nonblock.py delete mode 100644 tests/net_hosted 2/connect_nonblock.py.exp delete mode 100644 tests/net_hosted 2/connect_poll.py delete mode 100644 tests/net_hosted 2/connect_poll.py.exp delete mode 100644 tests/net_hosted 2/ssl_getpeercert.py delete mode 100644 tests/net_hosted 2/ssl_getpeercert.py.exp delete mode 100644 tests/net_inet 2/README delete mode 100644 tests/net_inet 2/test_tls_sites.py delete mode 100644 tests/net_inet 2/test_tls_sites.py.exp delete mode 100755 tests/run-bench-tests 2 delete mode 100755 tests/run-tests 2 delete mode 100644 tests/stress 2/dict_copy.py delete mode 100644 tests/stress 2/dict_create.py delete mode 100644 tests/stress 2/dict_create_max.py delete mode 100644 tests/stress 2/gc_trace.py delete mode 100644 tests/stress 2/list_sort.py delete mode 100644 tests/stress 2/recursion.py delete mode 100644 tests/stress 2/recursive_data.py delete mode 100644 tests/stress 2/recursive_data.py.exp delete mode 100644 tests/stress 2/recursive_gen.py delete mode 100644 tests/stress 2/recursive_iternext.py delete mode 100644 tests/stress 2/recursive_iternext.py.exp delete mode 100644 tests/thread 2/mutate_bytearray.py delete mode 100644 tests/thread 2/mutate_dict.py delete mode 100644 tests/thread 2/mutate_instance.py delete mode 100644 tests/thread 2/mutate_list.py delete mode 100644 tests/thread 2/mutate_set.py delete mode 100644 tests/thread 2/stress_aes.py delete mode 100644 tests/thread 2/stress_create.py delete mode 100644 tests/thread 2/stress_heap.py delete mode 100644 tests/thread 2/stress_recurse.py delete mode 100644 tests/thread 2/thread_exc1.py delete mode 100644 tests/thread 2/thread_exc2.py delete mode 100644 tests/thread 2/thread_exc2.py.exp delete mode 100644 tests/thread 2/thread_exit1.py delete mode 100644 tests/thread 2/thread_exit2.py delete mode 100644 tests/thread 2/thread_gc1.py delete mode 100644 tests/thread 2/thread_ident1.py delete mode 100644 tests/thread 2/thread_lock1.py delete mode 100644 tests/thread 2/thread_lock2.py delete mode 100644 tests/thread 2/thread_lock3.py delete mode 100644 tests/thread 2/thread_lock4.py delete mode 100644 tests/thread 2/thread_qstr1.py delete mode 100644 tests/thread 2/thread_shared1.py delete mode 100644 tests/thread 2/thread_shared2.py delete mode 100644 tests/thread 2/thread_sleep1.py delete mode 100644 tests/thread 2/thread_stacksize1.py delete mode 100644 tests/thread 2/thread_start1.py delete mode 100644 tests/thread 2/thread_start2.py delete mode 100644 tests/unix 2/extra_coverage.py delete mode 100644 tests/unix 2/extra_coverage.py.exp delete mode 100644 tests/unix 2/ffi_callback.py delete mode 100644 tests/unix 2/ffi_callback.py.exp delete mode 100644 tests/unix 2/ffi_float.py delete mode 100644 tests/unix 2/ffi_float.py.exp delete mode 100644 tests/unix 2/ffi_float2.py delete mode 100644 tests/unix 2/ffi_float2.py.exp diff --git a/tests/README 2 b/tests/README 2 deleted file mode 100644 index 3458f36a80201..0000000000000 --- a/tests/README 2 +++ /dev/null @@ -1,18 +0,0 @@ -This directory contains tests for various functionality areas of MicroPython. -To run all stable tests, run "run-tests" script in this directory. - -Tests of capabilities not supported on all platforms should be written -to check for the capability being present. If it is not, the test -should merely output 'SKIP' followed by the line terminator, and call -sys.exit() to raise SystemExit, instead of attempting to test the -missing capability. The testing framework (run-tests in this -directory, test_main.c in qemu_arm) recognizes this as a skipped test. - -There are a few features for which this mechanism cannot be used to -condition a test. The run-tests script uses small scripts in the -feature_check directory to check whether each such feature is present, -and skips the relevant tests if not. - -When creating new tests, anything that relies on float support should go in the -float/ subdirectory. Anything that relies on import x, where x is not a built-in -module, should go in the import/ subdirectory. diff --git a/tests/extmod 2/btree1.py b/tests/extmod 2/btree1.py deleted file mode 100644 index 59638ef0a467b..0000000000000 --- a/tests/extmod 2/btree1.py +++ /dev/null @@ -1,89 +0,0 @@ -try: - import btree - import uio - import uerrno -except ImportError: - print("SKIP") - raise SystemExit - -#f = open("_test.db", "w+b") -f = uio.BytesIO() -db = btree.open(f, pagesize=512) - -db[b"foo3"] = b"bar3" -db[b"foo1"] = b"bar1" -db[b"foo2"] = b"bar2" -db[b"bar1"] = b"foo1" - -dbstr = str(db) -print(dbstr[:7], dbstr[-1:]) - -print(db[b"foo2"]) -try: - print(db[b"foo"]) -except KeyError: - print("KeyError") -print(db.get(b"foo")) -print(db.get(b"foo", b"dflt")) - -del db[b"foo2"] -try: - del db[b"foo"] -except KeyError: - print("KeyError") - -for k, v in db.items(): - print((k, v)) - -print("---") -for k, v in db.items(None, None): - print((k, v)) - -print("---") -for k, v in db.items(b"f"): - print((k, v)) - -print("---") -for k, v in db.items(b"f", b"foo3"): - print((k, v)) - -print("---") -for k, v in db.items(None, b"foo3"): - print((k, v)) - -print("---") -for k, v in db.items(b"f", b"foo3", btree.INCL): - print((k, v)) - -print("---") -for k, v in db.items(None, None, btree.DESC): - print((k, v)) - -print(db.seq(1, b"foo1")) -print(db.seq(1, b"qux")) - -try: - db.seq(b"foo1") -except OSError as e: - print(e.args[0] == uerrno.EINVAL) - -print(list(db.keys())) -print(list(db.values())) - -for k in db: - print(k) - -db.put(b"baz1", b"qux1") - -print("foo1", "foo1" in db) -print("foo2", "foo2" in db) -print("baz1", "baz1" in db) - -try: - print(db + db[b"foo1"]) -except TypeError: - print("TypeError") - -db.flush() -db.close() -f.close() diff --git a/tests/extmod 2/framebuf1.py b/tests/extmod 2/framebuf1.py deleted file mode 100644 index 2c13665228a6a..0000000000000 --- a/tests/extmod 2/framebuf1.py +++ /dev/null @@ -1,109 +0,0 @@ -try: - import framebuf -except ImportError: - print("SKIP") - raise SystemExit - -w = 5 -h = 16 -size = w * h // 8 -buf = bytearray(size) -maps = {framebuf.MONO_VLSB : 'MONO_VLSB', - framebuf.MONO_HLSB : 'MONO_HLSB', - framebuf.MONO_HMSB : 'MONO_HMSB'} - -for mapping in maps.keys(): - for x in range(size): - buf[x] = 0 - fbuf = framebuf.FrameBuffer(buf, w, h, mapping) - print(maps[mapping]) - # access as buffer - print(memoryview(fbuf)[0]) - - # fill - fbuf.fill(1) - print(buf) - fbuf.fill(0) - print(buf) - - # put pixel - fbuf.pixel(0, 0, 1) - fbuf.pixel(4, 0, 1) - fbuf.pixel(0, 15, 1) - fbuf.pixel(4, 15, 1) - print(buf) - - # clear pixel - fbuf.pixel(4, 15, 0) - print(buf) - - # get pixel - print(fbuf.pixel(0, 0), fbuf.pixel(1, 1)) - - # hline - fbuf.fill(0) - fbuf.hline(0, 1, w, 1) - print('hline', buf) - - # vline - fbuf.fill(0) - fbuf.vline(1, 0, h, 1) - print('vline', buf) - - # rect - fbuf.fill(0) - fbuf.rect(1, 1, 3, 3, 1) - print('rect', buf) - - #fill rect - fbuf.fill(0) - fbuf.fill_rect(0, 0, 0, 3, 1) # zero width, no-operation - fbuf.fill_rect(1, 1, 3, 3, 1) - print('fill_rect', buf) - - # line - fbuf.fill(0) - fbuf.line(1, 1, 3, 3, 1) - print('line', buf) - - # line steep negative gradient - fbuf.fill(0) - fbuf.line(3, 3, 2, 1, 1) - print('line', buf) - - # scroll - fbuf.fill(0) - fbuf.pixel(2, 7, 1) - fbuf.scroll(0, 1) - print(buf) - fbuf.scroll(0, -2) - print(buf) - fbuf.scroll(1, 0) - print(buf) - fbuf.scroll(-1, 0) - print(buf) - fbuf.scroll(2, 2) - print(buf) - - # print text - fbuf.fill(0) - fbuf.text("hello", 0, 0, 1) - print(buf) - fbuf.text("hello", 0, 0, 0) # clear - print(buf) - - # char out of font range set to chr(127) - fbuf.text(str(chr(31)), 0, 0) - print(buf) - print() - -# test invalid constructor, and stride argument -try: - fbuf = framebuf.FrameBuffer(buf, w, h, -1, w) -except ValueError: - print("ValueError") - -# test legacy constructor -fbuf = framebuf.FrameBuffer1(buf, w, h) -fbuf = framebuf.FrameBuffer1(buf, w, h, w) -print(framebuf.MVLSB == framebuf.MONO_VLSB) diff --git a/tests/extmod 2/framebuf16.py b/tests/extmod 2/framebuf16.py deleted file mode 100644 index fe81f7f93f8c0..0000000000000 --- a/tests/extmod 2/framebuf16.py +++ /dev/null @@ -1,59 +0,0 @@ -try: - import framebuf -except ImportError: - print("SKIP") - raise SystemExit - -def printbuf(): - print("--8<--") - for y in range(h): - print(buf[y * w * 2:(y + 1) * w * 2]) - print("-->8--") - -w = 4 -h = 5 -buf = bytearray(w * h * 2) -fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.RGB565) - -# fill -fbuf.fill(0xffff) -printbuf() -fbuf.fill(0x0000) -printbuf() - -# put pixel -fbuf.pixel(0, 0, 0xeeee) -fbuf.pixel(3, 0, 0xee00) -fbuf.pixel(0, 4, 0x00ee) -fbuf.pixel(3, 4, 0x0ee0) -printbuf() - -# get pixel -print(fbuf.pixel(0, 4), fbuf.pixel(1, 1)) - -# scroll -fbuf.fill(0x0000) -fbuf.pixel(2, 2, 0xffff) -printbuf() -fbuf.scroll(0, 1) -printbuf() -fbuf.scroll(1, 0) -printbuf() -fbuf.scroll(-1, -2) -printbuf() - -w2 = 2 -h2 = 3 -buf2 = bytearray(w2 * h2 * 2) -fbuf2 = framebuf.FrameBuffer(buf2, w2, h2, framebuf.RGB565) - -fbuf2.fill(0x0000) -fbuf2.pixel(0, 0, 0x0ee0) -fbuf2.pixel(0, 2, 0xee00) -fbuf2.pixel(1, 0, 0x00ee) -fbuf2.pixel(1, 2, 0xe00e) -fbuf.fill(0xffff) -fbuf.blit(fbuf2, 3, 3, 0x0000) -fbuf.blit(fbuf2, -1, -1, 0x0000) -fbuf.blit(fbuf2, 16, 16, 0x0000) -printbuf() diff --git a/tests/extmod 2/framebuf2.py.exp b/tests/extmod 2/framebuf2.py.exp deleted file mode 100644 index c53e518a6e92d..0000000000000 --- a/tests/extmod 2/framebuf2.py.exp +++ /dev/null @@ -1,57 +0,0 @@ ---8<-- -33333333 -33333333 -33333333 -33333333 -33333333 --->8-- ---8<-- -00000000 -00000000 -00000000 -00000000 -00000000 --->8-- ---8<-- -10020000 -00000000 -00000000 -00000000 -30020000 --->8-- -3 0 ---8<-- -00000000 -00000000 -00300000 -00000000 -00000000 --->8-- ---8<-- -00000000 -00000000 -00000000 -00300000 -00000000 --->8-- ---8<-- -00000000 -00000000 -00000000 -00030000 -00000000 --->8-- ---8<-- -00000000 -00300000 -00000000 -00030000 -00000000 --->8-- ---8<-- -33333333 -23333333 -33333333 -33311333 -33333333 --->8-- diff --git a/tests/extmod 2/framebuf4.py b/tests/extmod 2/framebuf4.py deleted file mode 100644 index 8358fa55b9f2b..0000000000000 --- a/tests/extmod 2/framebuf4.py +++ /dev/null @@ -1,53 +0,0 @@ -try: - import framebuf -except ImportError: - print("SKIP") - raise SystemExit - -def printbuf(): - print("--8<--") - for y in range(h): - print(buf[y * w // 2:(y + 1) * w // 2]) - print("-->8--") - -w = 16 -h = 8 -buf = bytearray(w * h // 2) -fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.GS4_HMSB) - -# fill -fbuf.fill(0x0f) -printbuf() -fbuf.fill(0xa0) -printbuf() - -# put pixel -fbuf.pixel(0, 0, 0x01) -printbuf() -fbuf.pixel(w-1, 0, 0x02) -printbuf() -fbuf.pixel(w-1, h-1, 0x03) -printbuf() -fbuf.pixel(0, h-1, 0x04) -printbuf() - -# get pixel -print(fbuf.pixel(0, 0), fbuf.pixel(w-1, 0), fbuf.pixel(w-1, h-1), fbuf.pixel(0, h-1)) -print(fbuf.pixel(1, 0), fbuf.pixel(w-2, 0), fbuf.pixel(w-2, h-1), fbuf.pixel(1, h-1)) - -# fill rect -fbuf.fill_rect(0, 0, w, h, 0x0f) -printbuf() -fbuf.fill_rect(0, 0, w, h, 0xf0) -fbuf.fill_rect(1, 0, w//2+1, 1, 0xf1) -printbuf() -fbuf.fill_rect(1, 0, w//2+1, 1, 0x10) -fbuf.fill_rect(1, 0, w//2, 1, 0xf1) -printbuf() -fbuf.fill_rect(1, 0, w//2, 1, 0x10) -fbuf.fill_rect(0, h-4, w//2+1, 4, 0xaf) -printbuf() -fbuf.fill_rect(0, h-4, w//2+1, 4, 0xb0) -fbuf.fill_rect(0, h-4, w//2, 4, 0xaf) -printbuf() -fbuf.fill_rect(0, h-4, w//2, 4, 0xb0) diff --git a/tests/extmod 2/framebuf_subclass.py b/tests/extmod 2/framebuf_subclass.py deleted file mode 100644 index 6363c224fbb52..0000000000000 --- a/tests/extmod 2/framebuf_subclass.py +++ /dev/null @@ -1,20 +0,0 @@ -# test subclassing framebuf.FrameBuffer - -try: - import framebuf -except ImportError: - print('SKIP') - raise SystemExit - -class FB(framebuf.FrameBuffer): - def __init__(self, n): - self.n = n - super().__init__(bytearray(2 * n * n), n, n, framebuf.RGB565) - - def foo(self): - self.hline(0, 2, self.n, 0x0304) - -fb = FB(n=3) -fb.pixel(0, 0, 0x0102) -fb.foo() -print(bytes(fb)) diff --git a/tests/extmod 2/machine1.py b/tests/extmod 2/machine1.py deleted file mode 100644 index 6ff38cc05179d..0000000000000 --- a/tests/extmod 2/machine1.py +++ /dev/null @@ -1,28 +0,0 @@ -# test machine module - -try: - try: - import umachine as machine - except ImportError: - import machine - machine.mem8 -except: - print("SKIP") - raise SystemExit - -print(machine.mem8) - -try: - machine.mem16[1] -except ValueError: - print("ValueError") - -try: - machine.mem16[1] = 1 -except ValueError: - print("ValueError") - -try: - del machine.mem8[0] -except TypeError: - print("TypeError") diff --git a/tests/extmod 2/machine_pinbase.py b/tests/extmod 2/machine_pinbase.py deleted file mode 100644 index e91775504d59a..0000000000000 --- a/tests/extmod 2/machine_pinbase.py +++ /dev/null @@ -1,30 +0,0 @@ -try: - import umachine as machine -except ImportError: - import machine -try: - machine.PinBase -except AttributeError: - print("SKIP") - raise SystemExit - - -class MyPin(machine.PinBase): - - def __init__(self): - print("__init__") - self.v = False - - def value(self, v=None): - print("value:", v) - if v is None: - self.v = not self.v - return int(self.v) - -p = MyPin() - -print(p.value()) -print(p.value()) -print(p.value()) -p.value(1) -p.value(0) diff --git a/tests/extmod 2/machine_pinbase.py.exp b/tests/extmod 2/machine_pinbase.py.exp deleted file mode 100644 index b31cd983088b4..0000000000000 --- a/tests/extmod 2/machine_pinbase.py.exp +++ /dev/null @@ -1,9 +0,0 @@ -__init__ -value: None -1 -value: None -0 -value: None -1 -value: 1 -value: 0 diff --git a/tests/extmod 2/ticks_diff.py b/tests/extmod 2/ticks_diff.py deleted file mode 100644 index 4d8df83cf91d1..0000000000000 --- a/tests/extmod 2/ticks_diff.py +++ /dev/null @@ -1,33 +0,0 @@ -from utime import ticks_diff, ticks_add - -MAX = ticks_add(0, -1) -# Should be done like this to avoid small int overflow -MODULO_HALF = MAX // 2 + 1 - -# Invariants: -# if ticks_diff(a, b) = c, -# then ticks_diff(b, a) = -c - -assert ticks_diff(1, 0) == 1, ticks_diff(1, 0) -assert ticks_diff(0, 1) == -1 - -assert ticks_diff(0, MAX) == 1 -assert ticks_diff(MAX, 0) == -1 - -assert ticks_diff(0, MAX - 1) == 2 - -# Maximum "positive" distance -assert ticks_diff(MODULO_HALF, 1) == MODULO_HALF - 1, ticks_diff(MODULO_HALF, 1) -# Step further, and it becomes a negative distance -assert ticks_diff(MODULO_HALF, 0) == -MODULO_HALF - -# Offsetting that in either direction doesn't affect the result -off = 100 -# Cheating and skipping to use ticks_add() when we know there's no wraparound -# Real apps should use always it. -assert ticks_diff(MODULO_HALF + off, 1 + off) == MODULO_HALF - 1 -assert ticks_diff(MODULO_HALF + off, 0 + off) == -MODULO_HALF -assert ticks_diff(MODULO_HALF - off, ticks_add(1, -off)) == MODULO_HALF - 1 -assert ticks_diff(MODULO_HALF - off, ticks_add(0, -off)) == -MODULO_HALF - -print("OK") diff --git a/tests/extmod 2/time_ms_us.py b/tests/extmod 2/time_ms_us.py deleted file mode 100644 index 135cf1e0967d6..0000000000000 --- a/tests/extmod 2/time_ms_us.py +++ /dev/null @@ -1,22 +0,0 @@ -import utime -try: - utime.sleep_ms -except AttributeError: - print("SKIP") - raise SystemExit - -utime.sleep_ms(1) -utime.sleep_us(1) - -t0 = utime.ticks_ms() -t1 = utime.ticks_ms() -print(0 <= utime.ticks_diff(t1, t0) <= 1) - -t0 = utime.ticks_us() -t1 = utime.ticks_us() -print(0 <= utime.ticks_diff(t1, t0) <= 500) - -# ticks_cpu may not be implemented, at least make sure it doesn't decrease -t0 = utime.ticks_cpu() -t1 = utime.ticks_cpu() -print(utime.ticks_diff(t1, t0) >= 0) diff --git a/tests/extmod 2/time_ms_us.py.exp b/tests/extmod 2/time_ms_us.py.exp deleted file mode 100644 index b8ca7e7ef092a..0000000000000 --- a/tests/extmod 2/time_ms_us.py.exp +++ /dev/null @@ -1,3 +0,0 @@ -True -True -True diff --git a/tests/extmod 2/ubinascii_a2b_base64.py b/tests/extmod 2/ubinascii_a2b_base64.py deleted file mode 100644 index 5e642ec515a8f..0000000000000 --- a/tests/extmod 2/ubinascii_a2b_base64.py +++ /dev/null @@ -1,49 +0,0 @@ -try: - try: - import ubinascii as binascii - except ImportError: - import binascii -except ImportError: - print("SKIP") - raise SystemExit - -print(binascii.a2b_base64(b'')) -print(binascii.a2b_base64(b'Zg==')) -print(binascii.a2b_base64(b'Zm8=')) -print(binascii.a2b_base64(b'Zm9v')) -print(binascii.a2b_base64(b'Zm9vYg==')) -print(binascii.a2b_base64(b'Zm9vYmE=')) -print(binascii.a2b_base64(b'Zm9vYmFy')) - -print(binascii.a2b_base64(b'AAECAwQFBgc=')) -print(binascii.a2b_base64(b'CAkKCwwNDg8=')) -print(binascii.a2b_base64(b'f4D/')) -print(binascii.a2b_base64(b'f4D+')) # convert '+' -print(binascii.a2b_base64(b'MTIzNEFCQ0RhYmNk')) - -# Ignore invalid characters and pad sequences -print(binascii.a2b_base64(b'Zm9v\n')) -print(binascii.a2b_base64(b'Zm\x009v\n')) -print(binascii.a2b_base64(b'Zm9v==')) -print(binascii.a2b_base64(b'Zm9v===')) -print(binascii.a2b_base64(b'Zm9v===YmFy')) - -# Unicode strings can be decoded -print(binascii.a2b_base64(u'Zm9v===YmFy')) - -try: - print(binascii.a2b_base64(b'abc')) -except ValueError: - print("ValueError") -try: - print(binascii.a2b_base64(b'abcde=')) -except ValueError: - print("ValueError") -try: - print(binascii.a2b_base64(b'ab*d')) -except ValueError: - print("ValueError") -try: - print(binascii.a2b_base64(b'ab=cdef=')) -except ValueError: - print("ValueError") diff --git a/tests/extmod 2/ubinascii_hexlify.py b/tests/extmod 2/ubinascii_hexlify.py deleted file mode 100644 index dabc3c7e4ca8a..0000000000000 --- a/tests/extmod 2/ubinascii_hexlify.py +++ /dev/null @@ -1,17 +0,0 @@ -try: - try: - import ubinascii as binascii - except ImportError: - import binascii -except ImportError: - print("SKIP") - raise SystemExit - -print(binascii.hexlify(b'\x00\x01\x02\x03\x04\x05\x06\x07')) -print(binascii.hexlify(b'\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f')) -print(binascii.hexlify(b'\x7f\x80\xff')) -print(binascii.hexlify(b'1234ABCDabcd')) -try: - binascii.hexlify('') -except TypeError: - print("TypeError") diff --git a/tests/extmod 2/uctypes_32bit_intbig.py.exp b/tests/extmod 2/uctypes_32bit_intbig.py.exp deleted file mode 100644 index d1fc1fe350453..0000000000000 --- a/tests/extmod 2/uctypes_32bit_intbig.py.exp +++ /dev/null @@ -1,11 +0,0 @@ -b'\xff\xff\xff\x7f5678abcd' -b'\x00\x00\x00\x805678abcd' -b'\x03\x02\x01\xff5678abcd' -b'\x03\x02\x01\xff\x00\x00\x00\x80\x00\x00\x00\x00' -b'\x03\x02\x01\xff\x00\x00\x00\x00\x01\x00\x00\x00' -= -b'\x7f\xff\xff\xff5678abcd' -b'\x80\x00\x00\x005678abcd' -b'\xff\x01\x02\x035678abcd' -b'\xff\x01\x02\x03\x00\x00\x00\x00\x80\x00\x00\x00' -b'\xff\x01\x02\x03\x00\x00\x00\x01\x00\x00\x00\x00' diff --git a/tests/extmod 2/uctypes_array_assign_native_le.py b/tests/extmod 2/uctypes_array_assign_native_le.py deleted file mode 100644 index a538bf9add72d..0000000000000 --- a/tests/extmod 2/uctypes_array_assign_native_le.py +++ /dev/null @@ -1,89 +0,0 @@ -import sys -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -if sys.byteorder != "little": - print("SKIP") - raise SystemExit - -desc = { - # arr is array at offset 0, of UINT8 elements, array size is 2 - "arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2), - # arr2 is array at offset 0, size 2, of structures defined recursively - "arr2": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0}), - "arr3": (uctypes.ARRAY | 2, uctypes.UINT16 | 2), - - # aligned - "arr5": (uctypes.ARRAY | 0, uctypes.UINT32 | 1), - "arr7": (uctypes.ARRAY | 0, 1, {"l": uctypes.UINT32 | 0}), - - "arr8": (uctypes.ARRAY | 0, uctypes.INT8 | 1), - "arr9": (uctypes.ARRAY | 0, uctypes.INT16 | 1), - "arr10": (uctypes.ARRAY | 0, uctypes.INT32 | 1), - "arr11": (uctypes.ARRAY | 0, uctypes.INT64 | 1), - "arr12": (uctypes.ARRAY | 0, uctypes.UINT64| 1), - "arr13": (uctypes.ARRAY | 1, 1, {"l": {}}), -} - -data = bytearray(8) - -S = uctypes.struct(uctypes.addressof(data), desc) - -# assign byte -S.arr[0] = 0x11 -print(hex(S.arr[0])) -assert hex(S.arr[0]) == "0x11" - -# assign word -S.arr3[0] = 0x2233 -print(hex(S.arr3[0])) -assert hex(S.arr3[0]) == "0x2233" - -# assign word, with index -S.arr3[1] = 0x4455 -print(hex(S.arr3[1])) -assert hex(S.arr3[1]) == "0x4455" - -# assign long, aligned -S.arr5[0] = 0x66778899 -print(hex(S.arr5[0])) -assert hex(S.arr5[0]) == "0x66778899" - -print(S.arr5[0] == S.arr7[0].l) -assert S.arr5[0] == S.arr7[0].l - -# assign int8 -S.arr8[0] = 0x11 -print(hex(S.arr8[0])) -assert hex(S.arr8[0]) == "0x11" - -# assign int16 -S.arr9[0] = 0x1122 -print(hex(S.arr9[0])) -assert hex(S.arr9[0]) == "0x1122" - -# assign int32 -S.arr10[0] = 0x11223344 -print(hex(S.arr10[0])) -assert hex(S.arr10[0]) == "0x11223344" - -# index out of range -try: - print(S.arr8[2]) -except IndexError: - print("IndexError") - -# syntax error in descriptor -try: - S.arr13[0].l = 0x11 -except TypeError: - print("TypeError") - -# operation not supported -try: - S.arr13[0] = 0x11 -except TypeError: - print("TypeError") diff --git a/tests/extmod 2/uctypes_array_assign_native_le.py.exp b/tests/extmod 2/uctypes_array_assign_native_le.py.exp deleted file mode 100644 index 9d67b1c777713..0000000000000 --- a/tests/extmod 2/uctypes_array_assign_native_le.py.exp +++ /dev/null @@ -1,11 +0,0 @@ -0x11 -0x2233 -0x4455 -0x66778899 -True -0x11 -0x1122 -0x11223344 -IndexError -TypeError -TypeError diff --git a/tests/extmod 2/uctypes_array_assign_native_le_intbig.py b/tests/extmod 2/uctypes_array_assign_native_le_intbig.py deleted file mode 100644 index 84dfba0e29134..0000000000000 --- a/tests/extmod 2/uctypes_array_assign_native_le_intbig.py +++ /dev/null @@ -1,43 +0,0 @@ -import sys -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -if sys.byteorder != "little": - print("SKIP") - raise SystemExit - -desc = { - # arr is array at offset 0, of UINT8 elements, array size is 2 - "arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2), - # arr2 is array at offset 0, size 2, of structures defined recursively - "arr2": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0}), - "arr3": (uctypes.ARRAY | 2, uctypes.UINT16 | 2), - - # aligned - "arr5": (uctypes.ARRAY | 0, uctypes.UINT32 | 1), - "arr7": (uctypes.ARRAY | 0, 1, {"l": uctypes.UINT32 | 0}), - - "arr8": (uctypes.ARRAY | 0, uctypes.INT8 | 1), - "arr9": (uctypes.ARRAY | 0, uctypes.INT16 | 1), - "arr10": (uctypes.ARRAY | 0, uctypes.INT32 | 1), - "arr11": (uctypes.ARRAY | 0, uctypes.INT64 | 1), - "arr12": (uctypes.ARRAY | 0, uctypes.UINT64| 1), - "arr13": (uctypes.ARRAY | 1, 1, {"l": {}}), -} - -data = bytearray(8) - -S = uctypes.struct(uctypes.addressof(data), desc) - -# assign int64 -S.arr11[0] = 0x11223344 -print(hex(S.arr11[0])) -assert hex(S.arr11[0]) == "0x11223344" - -# assign uint64 -S.arr12[0] = 0x11223344 -print(hex(S.arr12[0])) -assert hex(S.arr12[0]) == "0x11223344" diff --git a/tests/extmod 2/uctypes_bytearray.py b/tests/extmod 2/uctypes_bytearray.py deleted file mode 100644 index 77c93c3766c40..0000000000000 --- a/tests/extmod 2/uctypes_bytearray.py +++ /dev/null @@ -1,22 +0,0 @@ -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -desc = { - "arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2), - "arr2": (uctypes.ARRAY | 2, uctypes.INT8 | 2), -} - -data = bytearray(b"01234567") - -S = uctypes.struct(uctypes.addressof(data), desc, uctypes.LITTLE_ENDIAN) - -# Arrays of UINT8 are accessed as bytearrays -print(S.arr) -# But not INT8, because value range is different -print(type(S.arr2)) - -# convert to buffer -print(bytearray(S)) diff --git a/tests/extmod 2/uctypes_byteat.py b/tests/extmod 2/uctypes_byteat.py deleted file mode 100644 index 784209f803409..0000000000000 --- a/tests/extmod 2/uctypes_byteat.py +++ /dev/null @@ -1,10 +0,0 @@ -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -data = bytearray(b'01234567') - -print(uctypes.bytes_at(uctypes.addressof(data), 4)) -print(uctypes.bytearray_at(uctypes.addressof(data), 4)) diff --git a/tests/extmod 2/uctypes_byteat.py.exp b/tests/extmod 2/uctypes_byteat.py.exp deleted file mode 100644 index e1ae4d0534c95..0000000000000 --- a/tests/extmod 2/uctypes_byteat.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -b'0123' -bytearray(b'0123') diff --git a/tests/extmod 2/uctypes_error.py b/tests/extmod 2/uctypes_error.py deleted file mode 100644 index 2500e292787bc..0000000000000 --- a/tests/extmod 2/uctypes_error.py +++ /dev/null @@ -1,37 +0,0 @@ -# test general errors with uctypes - -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -data = bytearray(b"01234567") - -# del subscr not supported -S = uctypes.struct(uctypes.addressof(data), {}) -try: - del S[0] -except TypeError: - print('TypeError') - -# list is an invalid descriptor -S = uctypes.struct(uctypes.addressof(data), []) -try: - S.x -except TypeError: - print('TypeError') - -# can't access attribute with invalid descriptor -S = uctypes.struct(uctypes.addressof(data), {'x':[]}) -try: - S.x -except TypeError: - print('TypeError') - -# can't assign to aggregate -S = uctypes.struct(uctypes.addressof(data), {'x':(uctypes.ARRAY | 0, uctypes.INT8 | 2)}) -try: - S.x = 1 -except TypeError: - print('TypeError') diff --git a/tests/extmod 2/uctypes_error.py.exp b/tests/extmod 2/uctypes_error.py.exp deleted file mode 100644 index 802c260d2b76a..0000000000000 --- a/tests/extmod 2/uctypes_error.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -TypeError -TypeError -TypeError -TypeError diff --git a/tests/extmod 2/uctypes_le_float.py b/tests/extmod 2/uctypes_le_float.py deleted file mode 100644 index 84ff2b84cf6e2..0000000000000 --- a/tests/extmod 2/uctypes_le_float.py +++ /dev/null @@ -1,24 +0,0 @@ -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -desc = { - "f32": uctypes.FLOAT32 | 0, - "f64": uctypes.FLOAT64 | 0, - "uf64": uctypes.FLOAT64 | 2, # unaligned -} - -data = bytearray(10) - -S = uctypes.struct(uctypes.addressof(data), desc, uctypes.LITTLE_ENDIAN) - -S.f32 = 12.34 -print('%.4f' % S.f32) - -S.f64 = 12.34 -print('%.4f' % S.f64) - -S.uf64 = 12.34 -print('%.4f' % S.uf64) diff --git a/tests/extmod 2/uctypes_native_float.py b/tests/extmod 2/uctypes_native_float.py deleted file mode 100644 index acef47036d00c..0000000000000 --- a/tests/extmod 2/uctypes_native_float.py +++ /dev/null @@ -1,20 +0,0 @@ -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -desc = { - "f32": uctypes.FLOAT32 | 0, - "f64": uctypes.FLOAT64 | 0, -} - -data = bytearray(8) - -S = uctypes.struct(uctypes.addressof(data), desc, uctypes.NATIVE) - -S.f32 = 12.34 -print('%.4f' % S.f32) - -S.f64 = 12.34 -print('%.4f' % S.f64) diff --git a/tests/extmod 2/uctypes_ptr_le.py b/tests/extmod 2/uctypes_ptr_le.py deleted file mode 100644 index 056e4565060c5..0000000000000 --- a/tests/extmod 2/uctypes_ptr_le.py +++ /dev/null @@ -1,34 +0,0 @@ -import sys -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -if sys.byteorder != "little": - print("SKIP") - raise SystemExit - -desc = { - "ptr": (uctypes.PTR | 0, uctypes.UINT8), - "ptr16": (uctypes.PTR | 0, uctypes.UINT16), - "ptr2": (uctypes.PTR | 0, {"b": uctypes.UINT8 | 0}), -} - -bytes = b"01" - -addr = uctypes.addressof(bytes) -buf = addr.to_bytes(uctypes.sizeof(desc), "little") - -S = uctypes.struct(uctypes.addressof(buf), desc, uctypes.LITTLE_ENDIAN) - -print(S.ptr[0]) -assert S.ptr[0] == ord("0") -print(S.ptr[1]) -assert S.ptr[1] == ord("1") -print(hex(S.ptr16[0])) -assert hex(S.ptr16[0]) == "0x3130" -print(S.ptr2[0].b, S.ptr2[1].b) -print (S.ptr2[0].b, S.ptr2[1].b) -print(hex(S.ptr16[0])) -assert (S.ptr2[0].b, S.ptr2[1].b) == (48, 49) diff --git a/tests/extmod 2/uctypes_ptr_native_le.py.exp b/tests/extmod 2/uctypes_ptr_native_le.py.exp deleted file mode 100644 index 30d159edd1bfd..0000000000000 --- a/tests/extmod 2/uctypes_ptr_native_le.py.exp +++ /dev/null @@ -1,6 +0,0 @@ -48 -49 -0x3130 -48 49 -48 49 -0x3130 diff --git a/tests/extmod 2/uctypes_sizeof.py.exp b/tests/extmod 2/uctypes_sizeof.py.exp deleted file mode 100644 index b35b11aa0cea9..0000000000000 --- a/tests/extmod 2/uctypes_sizeof.py.exp +++ /dev/null @@ -1,7 +0,0 @@ -2 -2 -4 -TypeError -6 -1 -TypeError diff --git a/tests/extmod 2/uhashlib_sha1.py b/tests/extmod 2/uhashlib_sha1.py deleted file mode 100644 index 9d6427b33ff9f..0000000000000 --- a/tests/extmod 2/uhashlib_sha1.py +++ /dev/null @@ -1,28 +0,0 @@ -try: - import uhashlib as hashlib -except ImportError: - try: - import hashlib - except ImportError: - # This is neither uPy, nor cPy, so must be uPy with - # uhashlib module disabled. - print("SKIP") - raise SystemExit - -try: - hashlib.sha1 -except AttributeError: - # SHA1 is only available on some ports - print("SKIP") - raise SystemExit - -sha1 = hashlib.sha1(b'hello') -sha1.update(b'world') -print(sha1.digest()) - -sha1 = hashlib.sha1(b'hello') -try: - sha1.update(u'world') -except TypeError as e: - print("TypeError") -print(sha1.digest()) diff --git a/tests/extmod 2/ujson_dump.py b/tests/extmod 2/ujson_dump.py deleted file mode 100644 index b1cb4a9cbcdb2..0000000000000 --- a/tests/extmod 2/ujson_dump.py +++ /dev/null @@ -1,30 +0,0 @@ -try: - from uio import StringIO - import ujson as json -except: - try: - from io import StringIO - import json - except ImportError: - print("SKIP") - raise SystemExit - -s = StringIO() -json.dump(False, s) -print(s.getvalue()) - -s = StringIO() -json.dump({"a": (2, [3, None])}, s) -print(s.getvalue()) - -# dump to a small-int not allowed -try: - json.dump(123, 1) -except (AttributeError, OSError): # CPython and uPy have different errors - print('Exception') - -# dump to an object not allowed -try: - json.dump(123, {}) -except (AttributeError, OSError): # CPython and uPy have different errors - print('Exception') diff --git a/tests/extmod 2/ujson_dumps_extra.py b/tests/extmod 2/ujson_dumps_extra.py deleted file mode 100644 index 21a388c32d097..0000000000000 --- a/tests/extmod 2/ujson_dumps_extra.py +++ /dev/null @@ -1,9 +0,0 @@ -# test uPy ujson behaviour that's not valid in CPy - -try: - import ujson -except ImportError: - print("SKIP") - raise SystemExit - -print(ujson.dumps(b'1234')) diff --git a/tests/extmod 2/ujson_dumps_float.py b/tests/extmod 2/ujson_dumps_float.py deleted file mode 100644 index e8cceb6f1a533..0000000000000 --- a/tests/extmod 2/ujson_dumps_float.py +++ /dev/null @@ -1,10 +0,0 @@ -try: - import ujson as json -except ImportError: - try: - import json - except ImportError: - print("SKIP") - raise SystemExit - -print(json.dumps(1.2)) diff --git a/tests/extmod 2/ujson_load_readinto.py.exp b/tests/extmod 2/ujson_load_readinto.py.exp deleted file mode 100644 index f8c3c693becf4..0000000000000 --- a/tests/extmod 2/ujson_load_readinto.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -None -abcde -[False, True, 1, -2] -{'a': True} diff --git a/tests/extmod 2/ujson_loads.py b/tests/extmod 2/ujson_loads.py deleted file mode 100644 index adba3c068d27c..0000000000000 --- a/tests/extmod 2/ujson_loads.py +++ /dev/null @@ -1,74 +0,0 @@ -try: - import ujson as json -except ImportError: - try: - import json - except ImportError: - print("SKIP") - raise SystemExit - -def my_print(o): - if isinstance(o, dict): - print('sorted dict', sorted(o.items())) - else: - print(o) - -my_print(json.loads('null')) -my_print(json.loads('false')) -my_print(json.loads('true')) -my_print(json.loads('1')) -my_print(json.loads('-2')) -my_print(json.loads('"abc\\u0064e"')) -my_print(json.loads('[]')) -my_print(json.loads('[null]')) -my_print(json.loads('[null,false,true]')) -my_print(json.loads(' [ null , false , true ] ')) -my_print(json.loads('{}')) -my_print(json.loads('{"a":true}')) -my_print(json.loads('{"a":null, "b":false, "c":true}')) -my_print(json.loads('{"a":[], "b":[1], "c":{"3":4}}')) -my_print(json.loads('"abc\\bdef"')) -my_print(json.loads('"abc\\fdef"')) -my_print(json.loads('"abc\\ndef"')) -my_print(json.loads('"abc\\rdef"')) -my_print(json.loads('"abc\\tdef"')) -my_print(json.loads('"abc\\uabcd"')) - -# whitespace handling -my_print(json.loads('{\n\t"a":[]\r\n, "b":[1], "c":{"3":4} \n\r\t\r\r\r\n}')) - -# loading nothing should raise exception -try: - json.loads('') -except ValueError: - print('ValueError') - -# string which is not closed -try: - my_print(json.loads('"abc')) -except ValueError: - print('ValueError') - -# unaccompanied closing brace -try: - my_print(json.loads(']')) -except ValueError: - print('ValueError') - -# unspecified object type -try: - my_print(json.loads('a')) -except ValueError: - print('ValueError') - -# bad property name -try: - my_print(json.loads('{{}:"abc"}')) -except ValueError: - print('ValueError') - -# unexpected characters after white space -try: - my_print(json.loads('[null] a')) -except ValueError: - print('ValueError') diff --git a/tests/extmod 2/ujson_loads_float.py b/tests/extmod 2/ujson_loads_float.py deleted file mode 100644 index f1b8cc364c4ac..0000000000000 --- a/tests/extmod 2/ujson_loads_float.py +++ /dev/null @@ -1,17 +0,0 @@ -try: - import ujson as json -except ImportError: - try: - import json - except ImportError: - print("SKIP") - raise SystemExit - -def my_print(o): - print('%.3f' % o) - -my_print(json.loads('1.2')) -my_print(json.loads('1e2')) -my_print(json.loads('-2.3')) -my_print(json.loads('-2e3')) -my_print(json.loads('-2e-3')) diff --git a/tests/extmod 2/urandom_basic.py b/tests/extmod 2/urandom_basic.py deleted file mode 100644 index 57e6b26cba590..0000000000000 --- a/tests/extmod 2/urandom_basic.py +++ /dev/null @@ -1,29 +0,0 @@ -try: - import urandom as random -except ImportError: - try: - import random - except ImportError: - print("SKIP") - raise SystemExit - -# check getrandbits returns a value within the bit range -for b in (1, 2, 3, 4, 16, 32): - for i in range(50): - assert random.getrandbits(b) < (1 << b) - -# check that seed(0) gives a non-zero value -random.seed(0) -print(random.getrandbits(16) != 0) - -# check that PRNG is repeatable -random.seed(1) -r = random.getrandbits(16) -random.seed(1) -print(random.getrandbits(16) == r) - -# check that it throws an error for zero bits -try: - random.getrandbits(0) -except ValueError: - print('ValueError') diff --git a/tests/extmod 2/ure1.py b/tests/extmod 2/ure1.py deleted file mode 100644 index 710720c8b6519..0000000000000 --- a/tests/extmod 2/ure1.py +++ /dev/null @@ -1,103 +0,0 @@ -try: - import ure as re -except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit - -r = re.compile(".+") -m = r.match("abc") -print(m.group(0)) -try: - m.group(1) -except IndexError: - print("IndexError") - -# conversion of re and match to string -str(r) -str(m) - -r = re.compile("(.+)1") -m = r.match("xyz781") -print(m.group(0)) -print(m.group(1)) -try: - m.group(2) -except IndexError: - print("IndexError") - -r = re.compile(r"\n") -m = r.match("\n") -print(m.group(0)) -m = r.match("\\") -print(m) -r = re.compile(r"[\n-\r]") -m = r.match("\n") -print(m.group(0)) -r = re.compile(r"[\]]") -m = r.match("]") -print(m.group(0)) -print("===") - -r = re.compile("[a-cu-z]") -m = r.match("a") -print(m.group(0)) -m = r.match("z") -print(m.group(0)) -m = r.match("d") -print(m) -m = r.match("A") -print(m) -print("===") - -r = re.compile("[^a-cu-z]") -m = r.match("a") -print(m) -m = r.match("z") -print(m) -m = r.match("d") -print(m.group(0)) -m = r.match("A") -print(m.group(0)) -print("===") - -# '-' character within character class block -print(re.match("[-a]+", "-a]d").group(0)) -print(re.match("[a-]+", "-a]d").group(0)) -print("===") - -r = re.compile("o+") -m = r.search("foobar") -print(m.group(0)) -try: - m.group(1) -except IndexError: - print("IndexError") - - -m = re.match(".*", "foo") -print(m.group(0)) - -m = re.search("w.r", "hello world") -print(m.group(0)) - -m = re.match('a+?', 'ab'); print(m.group(0)) -m = re.match('a*?', 'ab'); print(m.group(0)) -m = re.match('^ab$', 'ab'); print(m.group(0)) -m = re.match('a|b', 'b'); print(m.group(0)) -m = re.match('a|b|c', 'c'); print(m.group(0)) - -# Case where anchors fail to match -r = re.compile("^b|b$") -m = r.search("abc") -print(m) - -try: - re.compile("*") -except: - print("Caught invalid regex") - -# bytes objects -m = re.match(rb'a+?', b'ab'); print(m.group(0)) diff --git a/tests/extmod 2/ure_debug.py.exp b/tests/extmod 2/ure_debug.py.exp deleted file mode 100644 index 45f5e20f6d6d9..0000000000000 --- a/tests/extmod 2/ure_debug.py.exp +++ /dev/null @@ -1,15 +0,0 @@ - 0: rsplit 5 (3) - 2: any - 3: jmp 0 (-5) - 5: save 0 - 7: split 14 (5) - 9: assert bol -10: char a -12: jmp 23 (9) -14: char b -16: class 1 0x30-0x39 -20: namedclass w -22: assert eol -23: save 1 -25: match -Bytes: 26, insts: 14 diff --git a/tests/extmod 2/ure_error.py b/tests/extmod 2/ure_error.py deleted file mode 100644 index f52f735c7fa5e..0000000000000 --- a/tests/extmod 2/ure_error.py +++ /dev/null @@ -1,25 +0,0 @@ -# test errors in regex - -try: - import ure as re -except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit - -def test_re(r): - try: - re.compile(r) - print("OK") - except: # uPy and CPy use different errors, so just ignore the type - print("Error") - -test_re(r'?') -test_re(r'*') -test_re(r'+') -test_re(r')') -test_re(r'[') -test_re(r'([') -test_re(r'([)') diff --git a/tests/extmod 2/ure_namedclass.py b/tests/extmod 2/ure_namedclass.py deleted file mode 100644 index 215d09613f4b0..0000000000000 --- a/tests/extmod 2/ure_namedclass.py +++ /dev/null @@ -1,32 +0,0 @@ -# test named char classes - -try: - import ure as re -except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit - -def print_groups(match): - print('----') - try: - i = 0 - while True: - print(m.group(i)) - i += 1 - except IndexError: - pass - -m = re.match(r'\w+','1234hello567 abc') -print_groups(m) - -m = re.match(r'(\w+)\s+(\w+)','ABC \t1234hello567 abc') -print_groups(m) - -m = re.match(r'(\S+)\s+(\D+)','ABC \thello abc567 abc') -print_groups(m) - -m = re.match(r'(([0-9]*)([a-z]*)\d*)','1234hello567') -print_groups(m) diff --git a/tests/extmod 2/ure_stack_overflow.py.exp b/tests/extmod 2/ure_stack_overflow.py.exp deleted file mode 100644 index 8a2b9bfdda511..0000000000000 --- a/tests/extmod 2/ure_stack_overflow.py.exp +++ /dev/null @@ -1 +0,0 @@ -RuntimeError diff --git a/tests/extmod 2/ure_sub_unmatched.py.exp b/tests/extmod 2/ure_sub_unmatched.py.exp deleted file mode 100644 index 1e5f0fda0554d..0000000000000 --- a/tests/extmod 2/ure_sub_unmatched.py.exp +++ /dev/null @@ -1 +0,0 @@ -1-a2 diff --git a/tests/extmod 2/ussl_basic.py b/tests/extmod 2/ussl_basic.py deleted file mode 100644 index e8710ed51ab4b..0000000000000 --- a/tests/extmod 2/ussl_basic.py +++ /dev/null @@ -1,59 +0,0 @@ -# very basic test of ssl module, just to test the methods exist - -try: - import uio as io - import ussl as ssl -except ImportError: - print("SKIP") - raise SystemExit - -# create in client mode -try: - ss = ssl.wrap_socket(io.BytesIO()) -except OSError as er: - print('wrap_socket:', repr(er)) - -# create in server mode (can use this object for further tests) -socket = io.BytesIO() -ss = ssl.wrap_socket(socket, server_side=1) - -# print -print(repr(ss)[:12]) - -# setblocking -try: - ss.setblocking(False) -except NotImplementedError: - print('setblocking: NotImplementedError') -ss.setblocking(True) - -# write -print(ss.write(b'aaaa')) - -# read (underlying socket has no data) -print(ss.read(8)) - -# read (underlying socket has data, but it's bad data) -socket.write(b'aaaaaaaaaaaaaaaa') -socket.seek(0) -try: - ss.read(8) -except OSError as er: - print('read:', repr(er)) - -# close -ss.close() -# close 2nd time -ss.close() - -# read on closed socket -try: - ss.read(10) -except OSError as er: - print('read:', repr(er)) - -# write on closed socket -try: - ss.write(b'aaaa') -except OSError as er: - print('write:', repr(er)) diff --git a/tests/extmod 2/utimeq1.py b/tests/extmod 2/utimeq1.py deleted file mode 100644 index dc7f3b6600404..0000000000000 --- a/tests/extmod 2/utimeq1.py +++ /dev/null @@ -1,137 +0,0 @@ -# Test for utimeq module which implements task queue with support for -# wraparound time (utime.ticks_ms() style). -try: - from utime import ticks_add, ticks_diff - from utimeq import utimeq -except ImportError: - print("SKIP") - raise SystemExit - -DEBUG = 0 - -MAX = ticks_add(0, -1) -MODULO_HALF = MAX // 2 + 1 - -if DEBUG: - def dprint(*v): - print(*v) -else: - def dprint(*v): - pass - -# Try not to crash on invalid data -h = utimeq(10) -try: - h.push(1) - assert False -except TypeError: - pass - -try: - h.pop(1) - assert False -except IndexError: - pass - -# unsupported unary op -try: - ~h - assert False -except TypeError: - pass - -# pushing on full queue -h = utimeq(1) -h.push(1, 0, 0) -try: - h.push(2, 0, 0) - assert False -except IndexError: - pass - -# popping into invalid type -try: - h.pop([]) - assert False -except TypeError: - pass - -# length -assert len(h) == 1 - -# peektime -assert h.peektime() == 1 - -# peektime with empty queue -try: - utimeq(1).peektime() - assert False -except IndexError: - pass - -def pop_all(h): - l = [] - while h: - item = [0, 0, 0] - h.pop(item) - #print("!", item) - l.append(tuple(item)) - dprint(l) - return l - -def add(h, v): - h.push(v, 0, 0) - dprint("-----") - #h.dump() - dprint("-----") - -h = utimeq(10) -add(h, 0) -add(h, MAX) -add(h, MAX - 1) -add(h, 101) -add(h, 100) -add(h, MAX - 2) -dprint(h) -l = pop_all(h) -for i in range(len(l) - 1): - diff = ticks_diff(l[i + 1][0], l[i][0]) - assert diff > 0 - -def edge_case(edge, offset): - h = utimeq(10) - add(h, ticks_add(0, offset)) - add(h, ticks_add(edge, offset)) - dprint(h) - l = pop_all(h) - diff = ticks_diff(l[1][0], l[0][0]) - dprint(diff, diff > 0) - return diff - -dprint("===") -diff = edge_case(MODULO_HALF - 1, 0) -assert diff == MODULO_HALF - 1 -assert edge_case(MODULO_HALF - 1, 100) == diff -assert edge_case(MODULO_HALF - 1, -100) == diff - -# We expect diff to be always positive, per the definition of heappop() which should return -# the smallest value. -# This is the edge case where this invariant breaks, due to assymetry of two's-complement -# range - there's one more negative integer than positive, so heappushing values like below -# will then make ticks_diff() return the minimum negative value. We could make heappop -# return them in a different order, but ticks_diff() result would be the same. Conclusion: -# never add to a heap values where (a - b) == MODULO_HALF (and which are >= MODULO_HALF -# ticks apart in real time of course). -dprint("===") -diff = edge_case(MODULO_HALF, 0) -assert diff == -MODULO_HALF -assert edge_case(MODULO_HALF, 100) == diff -assert edge_case(MODULO_HALF, -100) == diff - -dprint("===") -diff = edge_case(MODULO_HALF + 1, 0) -assert diff == MODULO_HALF - 1 -assert edge_case(MODULO_HALF + 1, 100) == diff -assert edge_case(MODULO_HALF + 1, -100) == diff - -print("OK") diff --git a/tests/extmod 2/utimeq_stable.py.exp b/tests/extmod 2/utimeq_stable.py.exp deleted file mode 100644 index d86bac9de59ab..0000000000000 --- a/tests/extmod 2/utimeq_stable.py.exp +++ /dev/null @@ -1 +0,0 @@ -OK diff --git a/tests/extmod 2/uzlib_decompio.py b/tests/extmod 2/uzlib_decompio.py deleted file mode 100644 index 112a82597638a..0000000000000 --- a/tests/extmod 2/uzlib_decompio.py +++ /dev/null @@ -1,33 +0,0 @@ -try: - import uzlib as zlib - import uio as io -except ImportError: - print("SKIP") - raise SystemExit - - -# Raw DEFLATE bitstream -buf = io.BytesIO(b'\xcbH\xcd\xc9\xc9\x07\x00') -inp = zlib.DecompIO(buf, -8) -print(buf.seek(0, 1)) -print(inp.read(1)) -print(buf.seek(0, 1)) -print(inp.read(2)) -print(inp.read()) -print(buf.seek(0, 1)) -print(inp.read(1)) -print(inp.read()) -print(buf.seek(0, 1)) - - -# zlib bitstream -inp = zlib.DecompIO(io.BytesIO(b'x\x9c30\xa0=\x00\x00\xb3q\x12\xc1')) -print(inp.read(10)) -print(inp.read()) - -# zlib bitstream, wrong checksum -inp = zlib.DecompIO(io.BytesIO(b'x\x9c30\xa0=\x00\x00\xb3q\x12\xc0')) -try: - print(inp.read()) -except OSError as e: - print(repr(e)) diff --git a/tests/extmod 2/uzlib_decompio_gz.py.exp b/tests/extmod 2/uzlib_decompio_gz.py.exp deleted file mode 100644 index 20a30c82a3d5e..0000000000000 --- a/tests/extmod 2/uzlib_decompio_gz.py.exp +++ /dev/null @@ -1,13 +0,0 @@ -16 -b'h' -18 -b'el' -b'lo' -31 -b'' -b'' -31 -b'hello' -b'hello' -ValueError -OSError(22,) diff --git a/tests/extmod 2/vfs_fat_fileio1.py b/tests/extmod 2/vfs_fat_fileio1.py deleted file mode 100644 index 4635ca84b53ad..0000000000000 --- a/tests/extmod 2/vfs_fat_fileio1.py +++ /dev/null @@ -1,139 +0,0 @@ -try: - import uerrno - import uos -except ImportError: - print("SKIP") - raise SystemExit - -try: - uos.VfsFat -except AttributeError: - print("SKIP") - raise SystemExit - - -class RAMFS: - - SEC_SIZE = 512 - - def __init__(self, blocks): - self.data = bytearray(blocks * self.SEC_SIZE) - - def readblocks(self, n, buf): - #print("readblocks(%s, %x(%d))" % (n, id(buf), len(buf))) - for i in range(len(buf)): - buf[i] = self.data[n * self.SEC_SIZE + i] - return 0 - - def writeblocks(self, n, buf): - #print("writeblocks(%s, %x)" % (n, id(buf))) - for i in range(len(buf)): - self.data[n * self.SEC_SIZE + i] = buf[i] - return 0 - - def ioctl(self, op, arg): - #print("ioctl(%d, %r)" % (op, arg)) - if op == 4: # BP_IOCTL_SEC_COUNT - return len(self.data) // self.SEC_SIZE - if op == 5: # BP_IOCTL_SEC_SIZE - return self.SEC_SIZE - - -try: - bdev = RAMFS(50) -except MemoryError: - print("SKIP") - raise SystemExit - -uos.VfsFat.mkfs(bdev) -vfs = uos.VfsFat(bdev) -uos.mount(vfs, '/ramdisk') -uos.chdir('/ramdisk') - -# file IO -f = open("foo_file.txt", "w") -print(str(f)[:17], str(f)[-1:]) -f.write("hello!") -f.flush() -f.close() -f.close() # allowed -try: - f.write("world!") -except OSError as e: - print(e.args[0] == uerrno.EINVAL) - -try: - f.read() -except OSError as e: - print(e.args[0] == uerrno.EINVAL) - -try: - f.flush() -except OSError as e: - print(e.args[0] == uerrno.EINVAL) - -try: - open("foo_file.txt", "x") -except OSError as e: - print(e.args[0] == uerrno.EEXIST) - -with open("foo_file.txt", "a") as f: - f.write("world!") - -with open("foo_file.txt") as f2: - print(f2.read()) - print(f2.tell()) - - f2.seek(0, 0) # SEEK_SET - print(f2.read(1)) - - f2.seek(0, 1) # SEEK_CUR - print(f2.read(1)) - f2.seek(2, 1) # SEEK_CUR - print(f2.read(1)) - - f2.seek(-2, 2) # SEEK_END - print(f2.read(1)) - -# using constructor of FileIO type to open a file -# no longer working with new VFS sub-system -#FileIO = type(f) -#with FileIO("/ramdisk/foo_file.txt") as f: -# print(f.read()) - -# dirs -vfs.mkdir("foo_dir") - -try: - vfs.rmdir("foo_file.txt") -except OSError as e: - print(e.args[0] == 20) # uerrno.ENOTDIR - -vfs.remove("foo_file.txt") -print(list(vfs.ilistdir())) - -# Here we test that opening a file with the heap locked fails correctly. This -# is a special case because file objects use a finaliser and allocating with a -# finaliser is a different path to normal allocation. It would be better to -# test this in the core tests but there are no core objects that use finaliser. -import micropython -micropython.heap_lock() -try: - vfs.open('x', 'r') -except MemoryError: - print('MemoryError') -micropython.heap_unlock() - -# Here we test that the finaliser is actually called during a garbage collection. -import gc -N = 4 -for i in range(N): - n = 'x%d' % i - f = vfs.open(n, 'w') - f.write(n) - f = None # release f without closing - [0, 1, 2, 3] # use up Python stack so f is really gone -gc.collect() # should finalise all N files by closing them -for i in range(N): - with vfs.open('x%d' % i, 'r') as f: - print(f.read()) diff --git a/tests/extmod 2/vfs_fat_fileio1.py.exp b/tests/extmod 2/vfs_fat_fileio1.py.exp deleted file mode 100644 index 4eb50402c45e9..0000000000000 --- a/tests/extmod 2/vfs_fat_fileio1.py.exp +++ /dev/null @@ -1,18 +0,0 @@ - -True -True -True -True -hello!world! -12 -h -e -o -d -True -[('foo_dir', 16384, 0, 0)] -MemoryError -x0 -x1 -x2 -x3 diff --git a/tests/extmod 2/vfs_fat_more.py.exp b/tests/extmod 2/vfs_fat_more.py.exp deleted file mode 100644 index 24429ee09542e..0000000000000 --- a/tests/extmod 2/vfs_fat_more.py.exp +++ /dev/null @@ -1,29 +0,0 @@ -/ -['test.txt'] -['test.txt'] -(16384, 0, 0, 0, 0, 0, 0) -(16384, 0, 0, 0, 0, 0, 0) -(32768, 0, 0, 0, 0, 0, 5) -(32768, 0, 0, 0, 0, 0, 5) -hello -['test2.txt'] -['test3.txt'] -['test4.txt'] -['test5.txt'] -['test5.txt', 'dir'] -['test5.txt', 'dir', 'dir2'] -['subdir'] -mkdir OSError True -mkdir OSError True -mkdir OSError True -mkdir OSError True -mkdir OSError True -(32768, 0, 0, 0, 0, 0, 5) -['sys', 'test5.txt', 'dir', 'dir2'] -[] -[] -['sys', 'dir'] -/ -['sys'] -[] -test_module! diff --git a/tests/extmod 2/vfs_fat_oldproto.py.exp b/tests/extmod 2/vfs_fat_oldproto.py.exp deleted file mode 100644 index b974683167c17..0000000000000 --- a/tests/extmod 2/vfs_fat_oldproto.py.exp +++ /dev/null @@ -1,3 +0,0 @@ -[('file.txt', 32768, 0, 6)] -hello! -[] diff --git a/tests/extmod 2/vfs_fat_ramdisk.py.exp b/tests/extmod 2/vfs_fat_ramdisk.py.exp deleted file mode 100644 index 704408cd0b231..0000000000000 --- a/tests/extmod 2/vfs_fat_ramdisk.py.exp +++ /dev/null @@ -1,17 +0,0 @@ -True -True -label: LABEL TEST -statvfs: (512, 512, 16, 16, 16, 0, 0, 0, 0, 255) -getcwd: / -True -[('foo_file.txt', 32768, 0, 6)] -stat root: (16384, 0, 0, 0, 0, 0, 0, 946684800, 946684800, 946684800) -stat file: (32768, 0, 0, 0, 0, 0, 6) -True -True -getcwd: /foo_dir -[] -True -getcwd: / -[(b'foo_file.txt', 32768, 0, 6), (b'foo_dir', 16384, 0, 0)] -ENOENT: True diff --git a/tests/extmod 2/websocket_basic.py.exp b/tests/extmod 2/websocket_basic.py.exp deleted file mode 100644 index 2d7657b535407..0000000000000 --- a/tests/extmod 2/websocket_basic.py.exp +++ /dev/null @@ -1,14 +0,0 @@ -b'ping' -b'ping' -b'\x81\x04pong' -b'pingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingping' -b'\x81~\x00\x80pongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpong' -b'\x00\x00\x00\x00' -b'' -b'\x81\x02\x88\x00' -b'ping' -b'pong' -0 -1 -2 -ioctl: EINVAL: True diff --git a/tests/feature_check 2/README b/tests/feature_check 2/README deleted file mode 100644 index d062020f7bb32..0000000000000 --- a/tests/feature_check 2/README +++ /dev/null @@ -1,4 +0,0 @@ -This directory doesn't contain real tests, but code snippets to detect -various interpreter features, which can't be/inconvenient to detecte by -other means. Scripts here are executed by run-tests at the beginning of -testsuite to decide what other test groups to run/exclude. diff --git a/tests/feature_check 2/async_check.py b/tests/feature_check 2/async_check.py deleted file mode 100644 index 0f6361cd12016..0000000000000 --- a/tests/feature_check 2/async_check.py +++ /dev/null @@ -1,3 +0,0 @@ -# check if async/await keywords are supported -async def foo(): - await 1 diff --git a/tests/feature_check 2/async_check.py.exp b/tests/feature_check 2/async_check.py.exp deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/tests/feature_check 2/byteorder.py b/tests/feature_check 2/byteorder.py deleted file mode 100644 index d60f93956852d..0000000000000 --- a/tests/feature_check 2/byteorder.py +++ /dev/null @@ -1,2 +0,0 @@ -import sys -print(sys.byteorder) diff --git a/tests/feature_check 2/byteorder.py.exp b/tests/feature_check 2/byteorder.py.exp deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/tests/feature_check 2/complex.py b/tests/feature_check 2/complex.py deleted file mode 100644 index 7576dcb953f52..0000000000000 --- a/tests/feature_check 2/complex.py +++ /dev/null @@ -1,5 +0,0 @@ -try: - complex - print("complex") -except NameError: - print("no") diff --git a/tests/feature_check 2/complex.py.exp b/tests/feature_check 2/complex.py.exp deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/tests/feature_check 2/const.py b/tests/feature_check 2/const.py deleted file mode 100644 index db32e8c69bd7c..0000000000000 --- a/tests/feature_check 2/const.py +++ /dev/null @@ -1 +0,0 @@ -x = const(1) diff --git a/tests/feature_check 2/const.py.exp b/tests/feature_check 2/const.py.exp deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/tests/feature_check 2/coverage.py b/tests/feature_check 2/coverage.py deleted file mode 100644 index dcda53eae24bb..0000000000000 --- a/tests/feature_check 2/coverage.py +++ /dev/null @@ -1,5 +0,0 @@ -try: - extra_coverage - print('coverage') -except NameError: - print('no') diff --git a/tests/feature_check 2/coverage.py.exp b/tests/feature_check 2/coverage.py.exp deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/tests/feature_check 2/float.py b/tests/feature_check 2/float.py deleted file mode 100644 index af93f5976321c..0000000000000 --- a/tests/feature_check 2/float.py +++ /dev/null @@ -1,13 +0,0 @@ -# detect how many bits of precision the floating point implementation has - -try: - float -except NameError: - print(0) -else: - if float('1.0000001') == float('1.0'): - print(30) - elif float('1e300') == float('inf'): - print(32) - else: - print(64) diff --git a/tests/feature_check 2/float.py.exp b/tests/feature_check 2/float.py.exp deleted file mode 100644 index 900731ffd51ff..0000000000000 --- a/tests/feature_check 2/float.py.exp +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/tests/feature_check 2/int_big.py b/tests/feature_check 2/int_big.py deleted file mode 100644 index f30285a98f96b..0000000000000 --- a/tests/feature_check 2/int_big.py +++ /dev/null @@ -1,2 +0,0 @@ -# Check whether arbitrary-precision integers (MPZ) are supported -print(1000000000000000000000000000000000000000000000) diff --git a/tests/feature_check 2/int_big.py.exp b/tests/feature_check 2/int_big.py.exp deleted file mode 100644 index 9dfe3354d5949..0000000000000 --- a/tests/feature_check 2/int_big.py.exp +++ /dev/null @@ -1 +0,0 @@ -1000000000000000000000000000000000000000000000 diff --git a/tests/feature_check 2/native_check.py b/tests/feature_check 2/native_check.py deleted file mode 100644 index 3971d1355fbaf..0000000000000 --- a/tests/feature_check 2/native_check.py +++ /dev/null @@ -1,4 +0,0 @@ -# this test for the availability of native emitter -@micropython.native -def f(): - pass diff --git a/tests/feature_check 2/native_check.py.exp b/tests/feature_check 2/native_check.py.exp deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/tests/feature_check 2/repl_emacs_check.py b/tests/feature_check 2/repl_emacs_check.py deleted file mode 100644 index 3209716229c56..0000000000000 --- a/tests/feature_check 2/repl_emacs_check.py +++ /dev/null @@ -1,3 +0,0 @@ -# Check for emacs keys in REPL -t = +11 -t == 2 diff --git a/tests/feature_check 2/repl_emacs_check.py.exp b/tests/feature_check 2/repl_emacs_check.py.exp deleted file mode 100644 index 82a4e28ee4f84..0000000000000 --- a/tests/feature_check 2/repl_emacs_check.py.exp +++ /dev/null @@ -1,7 +0,0 @@ -MicroPython \.\+ version -Use \.\+ ->>> # Check for emacs keys in REPL ->>> t = \.\+ ->>> t == 2 -True ->>> diff --git a/tests/feature_check 2/reverse_ops.py b/tests/feature_check 2/reverse_ops.py deleted file mode 100644 index 668748bc5742f..0000000000000 --- a/tests/feature_check 2/reverse_ops.py +++ /dev/null @@ -1,9 +0,0 @@ -class Foo: - - def __radd__(self, other): - pass - -try: - 5 + Foo() -except TypeError: - print("TypeError") diff --git a/tests/feature_check 2/reverse_ops.py.exp b/tests/feature_check 2/reverse_ops.py.exp deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/tests/feature_check 2/set_check.py b/tests/feature_check 2/set_check.py deleted file mode 100644 index ec186cc5b9221..0000000000000 --- a/tests/feature_check 2/set_check.py +++ /dev/null @@ -1,2 +0,0 @@ -# check if set literal syntax is supported -{1} diff --git a/tests/feature_check 2/set_check.py.exp b/tests/feature_check 2/set_check.py.exp deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/tests/float 2/array_construct.py b/tests/float 2/array_construct.py deleted file mode 100644 index 938675835bbcf..0000000000000 --- a/tests/float 2/array_construct.py +++ /dev/null @@ -1,10 +0,0 @@ -# test construction of array from array with float type - -try: - from array import array -except ImportError: - print("SKIP") - raise SystemExit - -print(array('f', array('h', [1, 2]))) -print(array('d', array('f', [1, 2]))) diff --git a/tests/float 2/builtin_float_hash.py b/tests/float 2/builtin_float_hash.py deleted file mode 100644 index 7a7e374010104..0000000000000 --- a/tests/float 2/builtin_float_hash.py +++ /dev/null @@ -1,25 +0,0 @@ -# test builtin hash function with float args - -# these should hash to an integer with a specific value -for val in ( - '0.0', - '-0.0', - '1.0', - '2.0', - '-12.0', - '12345.0', - ): - print(val, hash(float(val))) - -# just check that these values are hashable -for val in ( - '0.1', - '-0.1', - '10.3', - '0.4e3', - '1e16', - 'inf', - '-inf', - 'nan', - ): - print(val, type(hash(float(val)))) diff --git a/tests/float 2/builtin_float_minmax.py b/tests/float 2/builtin_float_minmax.py deleted file mode 100644 index 8a53746e5dfdd..0000000000000 --- a/tests/float 2/builtin_float_minmax.py +++ /dev/null @@ -1,31 +0,0 @@ -# test builtin min and max functions with float args -try: - min - max -except: - print("SKIP") - raise SystemExit - -print(min(0, 1.0)) -print(min(1.0, 0)) -print(min(0, -1.0)) -print(min(-1.0, 0)) - -print(max(0, 1.0)) -print(max(1.0, 0)) -print(max(0, -1.0)) -print(max(-1.0, 0)) - -print(min(1.5, -1.5)) -print(min(-1.5, 1.5)) - -print(max(1.5, -1.5)) -print(max(-1.5, 1.5)) - -print(min([1, 2.9, 4, 0, -1, 2])) -print(max([1, 2.9, 4, 0, -1, 2])) - -print(min([1, 2.9, 4, 6.5, -1, 2])) -print(max([1, 2.9, 4, 6.5, -1, 2])) -print(min([1, 2.9, 4, -6.5, -1, 2])) -print(max([1, 2.9, 4, -6.5, -1, 2])) diff --git a/tests/float 2/builtin_float_pow.py b/tests/float 2/builtin_float_pow.py deleted file mode 100644 index 2de1b481763f3..0000000000000 --- a/tests/float 2/builtin_float_pow.py +++ /dev/null @@ -1,11 +0,0 @@ -# test builtin pow function with float args - -print(pow(0.0, 0.0)) -print(pow(0, 1.0)) -print(pow(1.0, 1)) -print(pow(2.0, 3.0)) -print(pow(2.0, -4.0)) - -print(pow(0.0, float('inf'))) -print(pow(0.0, float('-inf'))) -print(pow(0.0, float('nan'))) diff --git a/tests/float 2/builtin_float_round.py b/tests/float 2/builtin_float_round.py deleted file mode 100644 index 63cb39aa3576b..0000000000000 --- a/tests/float 2/builtin_float_round.py +++ /dev/null @@ -1,24 +0,0 @@ -# test round() with floats - -# check basic cases -tests = [ - [0.0], [1.0], [0.1], [-0.1], [123.4], [123.6], [-123.4], [-123.6], - [1.234567, 5], [1.23456, 1], [1.23456, 0], [1234.56, -2] -] -for t in tests: - print(round(*t)) - -# check .5 cases -for i in range(11): - print(round((i - 5) / 2)) - -# test second arg -for i in range(-1, 3): - print(round(1.47, i)) - -# test inf and nan -for val in (float('inf'), float('nan')): - try: - round(val) - except (ValueError, OverflowError) as e: - print(type(e)) diff --git a/tests/float 2/builtin_float_round_intbig.py b/tests/float 2/builtin_float_round_intbig.py deleted file mode 100644 index 2083e3ea3af46..0000000000000 --- a/tests/float 2/builtin_float_round_intbig.py +++ /dev/null @@ -1,4 +0,0 @@ -# test round() with floats that return large integers - -for x in (-1e25, 1e25): - print('%.3g' % round(x)) diff --git a/tests/float 2/bytearray_construct.py b/tests/float 2/bytearray_construct.py deleted file mode 100644 index e960d624ec8ca..0000000000000 --- a/tests/float 2/bytearray_construct.py +++ /dev/null @@ -1,9 +0,0 @@ -# test construction of bytearray from array with float type - -try: - from array import array -except ImportError: - print("SKIP") - raise SystemExit - -print(bytearray(array('f', [1, 2.3]))) diff --git a/tests/float 2/bytes_construct.py b/tests/float 2/bytes_construct.py deleted file mode 100644 index 0e4482e436698..0000000000000 --- a/tests/float 2/bytes_construct.py +++ /dev/null @@ -1,9 +0,0 @@ -# test construction of bytearray from array with float type - -try: - from array import array -except ImportError: - print("SKIP") - raise SystemExit - -print(bytes(array('f', [1, 2.3]))) diff --git a/tests/float 2/cmath_fun.py b/tests/float 2/cmath_fun.py deleted file mode 100644 index ae5921c304cb8..0000000000000 --- a/tests/float 2/cmath_fun.py +++ /dev/null @@ -1,55 +0,0 @@ -# test the functions imported from cmath - -try: - from cmath import * -except ImportError: - print("SKIP") - raise SystemExit - -# make sure these constants exist in cmath -print("%.5g" % e) -print("%.5g" % pi) - -test_values_non_zero = [] -base_values = (0.0, 0.5, 1.2345, 10.) -for r in base_values: - for i in base_values: - if r != 0. or i != 0.: - test_values_non_zero.append(complex(r, i)) - if r != 0.: - test_values_non_zero.append(complex(-r, i)) - if i != 0.: - test_values_non_zero.append(complex(r, -i)) - if r != 0. and i != 0.: - test_values_non_zero.append(complex(-r, -i)) -test_values = [complex(0., 0.),] + test_values_non_zero -print(test_values) - -functions = [ - ('phase', phase, test_values), - ('polar', polar, test_values), - ('rect', rect, ((0, 0), (0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (-1, 1), (1, -1), (123., -456.))), - ('exp', exp, test_values), - ('log', log, test_values_non_zero), - ('sqrt', sqrt, test_values), - ('cos', cos, test_values), - ('sin', sin, test_values), -] - -for f_name, f, test_vals in functions: - print(f_name) - for val in test_vals: - if type(val) == tuple: - ret = f(*val) - else: - ret = f(val) - if type(ret) == float: - print("%.5g" % ret) - elif type(ret) == tuple: - print("%.5g %.5g" % ret) - else: - # some test (eg cmath.sqrt(-0.5)) disagree with CPython with tiny real part - real = ret.real - if abs(real) < 1e15: - real = 0. - print("complex(%.5g, %.5g)" % (real, ret.imag)) diff --git a/tests/float 2/cmath_fun_special.py b/tests/float 2/cmath_fun_special.py deleted file mode 100644 index 471fda8c0dc19..0000000000000 --- a/tests/float 2/cmath_fun_special.py +++ /dev/null @@ -1,31 +0,0 @@ -# test the special functions imported from cmath - -try: - from cmath import * - log10 -except (ImportError, NameError): - print("SKIP") - raise SystemExit - -test_values_non_zero = [] -base_values = (0.0, 0.5, 1.2345, 10.) -for r in base_values: - for i in base_values: - if r != 0. or i != 0.: - test_values_non_zero.append(complex(r, i)) - if r != 0.: - test_values_non_zero.append(complex(-r, i)) - if i != 0.: - test_values_non_zero.append(complex(r, -i)) - if r != 0. and i != 0.: - test_values_non_zero.append(complex(-r, -i)) - -functions = [ - ('log10', log10, test_values_non_zero), -] - -for f_name, f, test_vals in functions: - print(f_name) - for val in test_vals: - ret = f(val) - print("complex(%.5g, %.5g)" % (ret.real, ret.imag)) diff --git a/tests/float 2/complex1.py b/tests/float 2/complex1.py deleted file mode 100644 index 479b4b3485b26..0000000000000 --- a/tests/float 2/complex1.py +++ /dev/null @@ -1,116 +0,0 @@ -# test basic complex number functionality - -# constructor -print(complex(1)) -print(complex(1.2)) -print(complex(1.2j)) -print(complex("1")) -print(complex("1.2")) -print(complex("1.2j")) -print(complex(1, 2)) -print(complex(1j, 2j)) - -# unary ops -print(bool(1j)) -print(+(1j)) -print(-(1 + 2j)) - -# binary ops -print(1j + False) -print(1j + True) -print(1j + 2) -print(1j + 2j) -print(1j - 2) -print(1j - 2j) -print(1j * 2) -print(1j * 2j) -print(1j / 2) -print((1j / 2j).real) -print(1j / (1 + 2j)) -ans = 0j ** 0; print("%.5g %.5g" % (ans.real, ans.imag)) -ans = 0j ** 1; print("%.5g %.5g" % (ans.real, ans.imag)) -ans = 0j ** 0j; print("%.5g %.5g" % (ans.real, ans.imag)) -ans = 1j ** 2.5; print("%.5g %.5g" % (ans.real, ans.imag)) -ans = 1j ** 2.5j; print("%.5g %.5g" % (ans.real, ans.imag)) - -# comparison -print(1j == 1) -print(1j == 1j) - -# comparison of nan is special -nan = float('nan') * 1j -print(nan == 1j) -print(nan == nan) - -# builtin abs -print(abs(1j)) -print("%.5g" % abs(1j + 2)) - -# builtin hash -print(hash(1 + 0j)) -print(type(hash(1j))) - -# float on lhs should delegate to complex -print(1.2 + 3j) - -# negative base and fractional power should create a complex -ans = (-1) ** 2.3; print("%.5g %.5g" % (ans.real, ans.imag)) -ans = (-1.2) ** -3.4; print("%.5g %.5g" % (ans.real, ans.imag)) - -# check printing of inf/nan -print(float('nan') * 1j) -print(float('-nan') * 1j) -print(float('inf') * (1 + 1j)) -print(float('-inf') * (1 + 1j)) - -# can't assign to attributes -try: - (1j).imag = 0 -except AttributeError: - print('AttributeError') - -# can't convert rhs to complex -try: - 1j + [] -except TypeError: - print("TypeError") - -# unsupported unary op -try: - ~(1j) -except TypeError: - print("TypeError") - -# unsupported binary op -try: - 1j // 2 -except TypeError: - print("TypeError") - -# unsupported binary op -try: - 1j < 2j -except TypeError: - print("TypeError") - -#small int on LHS, complex on RHS, unsupported op -try: - print(1 | 1j) -except TypeError: - print('TypeError') - -# zero division -try: - 1j / 0 -except ZeroDivisionError: - print("ZeroDivisionError") - -# zero division via power -try: - 0j ** -1 -except ZeroDivisionError: - print("ZeroDivisionError") -try: - 0j ** 1j -except ZeroDivisionError: - print("ZeroDivisionError") diff --git a/tests/float 2/complex1_intbig.py b/tests/float 2/complex1_intbig.py deleted file mode 100644 index ed2390bbaf24c..0000000000000 --- a/tests/float 2/complex1_intbig.py +++ /dev/null @@ -1,4 +0,0 @@ -# test basic complex number functionality - -# convert bignum to complex on rhs -ans = 1j + (1 << 70); print("%.5g %.5g" % (ans.real, ans.imag)) diff --git a/tests/float 2/float1.py b/tests/float 2/float1.py deleted file mode 100644 index 54807e5ac9c27..0000000000000 --- a/tests/float 2/float1.py +++ /dev/null @@ -1,119 +0,0 @@ -# test basic float capabilities - -# literals -print(.12) -print(1.) -print(1.2) -print(0e0) -print(0e+0) -print(0e-0) - -# float construction -print(float(1.2)) -print(float("1.2")) -print(float("+1")) -print(float("1e1")) -print(float("1e+1")) -print(float("1e-1")) -print(float("inf")) -print(float("-inf")) -print(float("INF")) -print(float("infinity")) -print(float("INFINITY")) -print(float("nan")) -print(float("-nan")) -print(float("NaN")) -try: - float("") -except ValueError: - print("ValueError") -try: - float("1e+") -except ValueError: - print("ValueError") -try: - float("1z") -except ValueError: - print("ValueError") - -# construct from something with the buffer protocol -print(float(b"1.2")) -print(float(bytearray(b"3.4"))) - -# unary operators -print(bool(0.0)) -print(bool(1.2)) -print(+(1.2)) -print(-(1.2)) - -# division of integers -x = 1 / 2 -print(x) - -# /= operator -a = 1 -a /= 2 -print(a) - -# floor division -print(1.0 // 2) -print(2.0 // 2) - -# comparison -print(1.2 <= 3.4) -print(1.2 <= -3.4) -print(1.2 >= 3.4) -print(1.2 >= -3.4) - -# comparison of nan is special -nan = float('nan') -print(nan == 1.2) -print(nan == nan) - -try: - 1.0 / 0 -except ZeroDivisionError: - print("ZeroDivisionError") - -try: - 1.0 // 0 -except ZeroDivisionError: - print("ZeroDivisionError") - -try: - 1.2 % 0 -except ZeroDivisionError: - print("ZeroDivisionError") - -try: - 0.0 ** -1 -except ZeroDivisionError: - print("ZeroDivisionError") - -# unsupported unary ops - -try: - ~1.2 -except TypeError: - print("TypeError") - -try: - 1.2 in 3.4 -except TypeError: - print("TypeError") - -# small int on LHS, float on RHS, unsupported op -try: - print(1 | 1.0) -except TypeError: - print('TypeError') - -# can't convert list to float -try: - float([]) -except TypeError: - print("TypeError") - -# test constant float with more than 255 chars -x = 1.84728699436059052516398251149631771898472869943605905251639825114963177189847286994360590525163982511496317718984728699436059052516398251149631771898472869943605905251639825114963177189847286994360590525163982511496317718984728699436059052516398251149631771898472869943605905251639825114963177189 -print("%.5f" % x) diff --git a/tests/float 2/float2int_doubleprec_intbig.py b/tests/float 2/float2int_doubleprec_intbig.py deleted file mode 100644 index de2137d66ca64..0000000000000 --- a/tests/float 2/float2int_doubleprec_intbig.py +++ /dev/null @@ -1,100 +0,0 @@ -# check cases converting float to int, requiring double precision float - -try: - import ustruct as struct -except: - import struct - -import sys -maxsize_bits = 0 -maxsize = sys.maxsize -while maxsize: - maxsize >>= 1 - maxsize_bits += 1 - -# work out configuration values -is_64bit = maxsize_bits > 32 -# 0 = none, 1 = long long, 2 = mpz -ll_type = None -if is_64bit: - if maxsize_bits < 63: - ll_type = 0 -else: - if maxsize_bits < 31: - ll_type = 0 -if ll_type is None: - one = 1 - if one << 65 < one << 62: - ll_type = 1 - else: - ll_type = 2 - -# This case occurs with time.time() values -if ll_type != 0: - print(int(1418774543.)) - print("%d" % 1418774543.) - if ll_type == 3: - print(int(2.**100)) - print("%d" % 2.**100) -else: - print(int(1073741823.)) - print("%d" % 1073741823.) - -testpass = True -p2_rng = ((30,63,1024),(62,63,1024))[is_64bit][ll_type] -for i in range(0,p2_rng): - bitcnt = len(bin(int(2.**i))) - 3; - if i != bitcnt: - print('fail: 2**%u was %u bits long' % (i, bitcnt)); - testpass = False -print("power of 2 test: %s" % (testpass and 'passed' or 'failed')) - -testpass = True -p10_rng = ((9,18,23),(18,18,23))[is_64bit][ll_type] -for i in range(0,p10_rng): - digcnt = len(str(int(10.**i))) - 1; - if i != digcnt: - print('fail: 10**%u was %u digits long' % (i, digcnt)); - testpass = False -print("power of 10 test: %s" % (testpass and 'passed' or 'failed')) - -def fp2int_test(num, name, should_fail): - try: - x = int(num) - passed = ~should_fail - except: - passed = should_fail - print('%s: %s' % (name, passed and 'passed' or 'failed')) - -if ll_type != 2: - if ll_type == 0: - if is_64bit: - neg_bad_fp = -1.00000005*2.**62. - pos_bad_fp = 2.**62. - neg_good_fp = -2.**62. - pos_good_fp = 0.99999993*2.**62. - else: - neg_bad_fp = -1.00000005*2.**30. - pos_bad_fp = 2.**30. - neg_good_fp = -2.**30. - pos_good_fp = 0.9999999499*2.**30. - else: - neg_bad_fp = -0.51*2.**64. - pos_bad_fp = 2.**63. - neg_good_fp = -2.**63. - pos_good_fp = 1.9999998*2.**62. - - fp2int_test(neg_bad_fp, 'neg bad', True) - fp2int_test(pos_bad_fp, 'pos bad', True) - fp2int_test(neg_good_fp, 'neg good', False) - fp2int_test(pos_good_fp, 'pos good', False) -else: - fp2int_test(-1.9999999999999981*2.**1023., 'large neg', False) - fp2int_test(1.9999999999999981*2.**1023., 'large pos', False) - -fp2int_test(float('inf'), 'inf test', True) -fp2int_test(float('nan'), 'NaN test', True) - -# test numbers < 1 (this used to fail; see issue #1044) -fp2int_test(0.0001, 'small num', False) -struct.pack('I', int(1/2)) diff --git a/tests/float 2/float2int_fp30_intbig.py b/tests/float 2/float2int_fp30_intbig.py deleted file mode 100644 index fbb94a4ccc052..0000000000000 --- a/tests/float 2/float2int_fp30_intbig.py +++ /dev/null @@ -1,97 +0,0 @@ -# check cases converting float to int, relying only on single precision float - -try: - import ustruct as struct -except: - import struct - -import sys -maxsize_bits = 0 -maxsize = sys.maxsize -while maxsize: - maxsize >>= 1 - maxsize_bits += 1 - -# work out configuration values -is_64bit = maxsize_bits > 32 -# 0 = none, 1 = long long, 2 = mpz -ll_type = None -if is_64bit: - if maxsize_bits < 63: - ll_type = 0 -else: - if maxsize_bits < 31: - ll_type = 0 -if ll_type is None: - one = 1 - if one << 65 < one << 62: - ll_type = 1 - else: - ll_type = 2 - -# basic conversion -print(int(14187744.)) -print("%d" % 14187744.) -if ll_type == 2: - print(int(2.**100)) - print("%d" % 2.**100) - -testpass = True -p2_rng = ((30,63,127),(62,63,127))[is_64bit][ll_type] -for i in range(0,p2_rng): - bitcnt = len(bin(int(2.**i))) - 3; - if i != bitcnt: - print('fail: 2.**%u was %u bits long' % (i, bitcnt)); - testpass = False -print("power of 2 test: %s" % (testpass and 'passed' or 'failed')) - -# TODO why does 10**12 fail this test for single precision float? -testpass = True -p10_rng = 9 -for i in range(0,p10_rng): - digcnt = len(str(int(10.**i))) - 1; - if i != digcnt: - print('fail: 10.**%u was %u digits long' % (i, digcnt)); - testpass = False -print("power of 10 test: %s" % (testpass and 'passed' or 'failed')) - -def fp2int_test(num, name, should_fail): - try: - x = int(num) - passed = ~should_fail - except: - passed = should_fail - print('%s: %s' % (name, passed and 'passed' or 'failed')) - -if ll_type != 2: - if ll_type == 0: - if is_64bit: - neg_bad_fp = -1.00000005*2.**62. - pos_bad_fp = 2.**62. - neg_good_fp = -2.**62. - pos_good_fp = 0.99999993*2.**62. - else: - neg_bad_fp = -1.00000005*2.**30. - pos_bad_fp = 2.**30. - neg_good_fp = -2.**30. - pos_good_fp = 0.9999999499*2.**30. - else: - neg_bad_fp = -0.51*2.**64. - pos_bad_fp = 2.**63. - neg_good_fp = -2.**63. - pos_good_fp = 1.9999998*2.**62. - - fp2int_test(neg_bad_fp, 'neg bad', True) - fp2int_test(pos_bad_fp, 'pos bad', True) - fp2int_test(neg_good_fp, 'neg good', False) - fp2int_test(pos_good_fp, 'pos good', False) -else: - fp2int_test(-1.999999879*2.**126., 'large neg', False) - fp2int_test(1.999999879*2.**126., 'large pos', False) - -fp2int_test(float('inf'), 'inf test', True) -fp2int_test(float('nan'), 'NaN test', True) - -# test numbers < 1 (this used to fail; see issue #1044) -fp2int_test(0.0001, 'small num', False) -struct.pack('I', int(1/2)) diff --git a/tests/float 2/float2int_intbig.py b/tests/float 2/float2int_intbig.py deleted file mode 100644 index 3596d2f73da53..0000000000000 --- a/tests/float 2/float2int_intbig.py +++ /dev/null @@ -1,99 +0,0 @@ -# check cases converting float to int, relying only on single precision float - -try: - import ustruct as struct -except: - import struct - -import sys - -maxsize_bits = 0 -maxsize = sys.maxsize -while maxsize: - maxsize >>= 1 - maxsize_bits += 1 - -# work out configuration values -is_64bit = maxsize_bits > 32 -# 0 = none, 1 = long long, 2 = mpz -ll_type = None -if is_64bit: - if maxsize_bits < 63: - ll_type = 0 -else: - if maxsize_bits < 31: - ll_type = 0 -if ll_type is None: - one = 1 - if one << 65 < one << 62: - ll_type = 1 - else: - ll_type = 2 - - -# basic conversion -print(int(14187745.)) -print("%d" % 14187745.) -if ll_type == 2: - print(int(2.**100)) - print("%d" % 2.**100) - -testpass = True -p2_rng = ((30,63,127),(62,63,127))[is_64bit][ll_type] -for i in range(0,p2_rng): - bitcnt = len(bin(int(2.**i))) - 3; - if i != bitcnt: - print('fail: 2.**%u was %u bits long' % (i, bitcnt)); - testpass = False -print("power of 2 test: %s" % (testpass and 'passed' or 'failed')) - -# TODO why does 10**12 fail this test for single precision float? -testpass = True -p10_rng = 9 if (ll_type == 0 and ~is_64bit) else 11 -for i in range(0,p10_rng): - digcnt = len(str(int(10.**i))) - 1; - if i != digcnt: - print('fail: 10.**%u was %u digits long' % (i, digcnt)); - testpass = False -print("power of 10 test: %s" % (testpass and 'passed' or 'failed')) - -def fp2int_test(num, name, should_fail): - try: - x = int(num) - passed = ~should_fail - except: - passed = should_fail - print('%s: %s' % (name, passed and 'passed' or 'failed')) - -if ll_type != 2: - if ll_type == 0: - if is_64bit: - neg_bad_fp = -1.00000005*2.**62. - pos_bad_fp = 2.**62. - neg_good_fp = -2.**62. - pos_good_fp = 0.99999993*2.**62. - else: - neg_bad_fp = -1.00000005*2.**30. - pos_bad_fp = 2.**30. - neg_good_fp = -2.**30. - pos_good_fp = 0.9999999499*2.**30. - else: - neg_bad_fp = -0.51*2.**64. - pos_bad_fp = 2.**63. - neg_good_fp = -2.**63. - pos_good_fp = 1.9999998*2.**62. - - fp2int_test(neg_bad_fp, 'neg bad', True) - fp2int_test(pos_bad_fp, 'pos bad', True) - fp2int_test(neg_good_fp, 'neg good', False) - fp2int_test(pos_good_fp, 'pos good', False) -else: - fp2int_test(-1.999999879*2.**127., 'large neg', False) - fp2int_test(1.999999879*2.**127., 'large pos', False) - -fp2int_test(float('inf'), 'inf test', True) -fp2int_test(float('nan'), 'NaN test', True) - -# test numbers < 1 (this used to fail; see issue #1044) -fp2int_test(0.0001, 'small num', False) -struct.pack('I', int(1/2)) diff --git a/tests/float 2/float_array.py b/tests/float 2/float_array.py deleted file mode 100644 index 8c8edcff7c86b..0000000000000 --- a/tests/float 2/float_array.py +++ /dev/null @@ -1,20 +0,0 @@ -try: - from array import array -except ImportError: - print("SKIP") - raise SystemExit - -def test(a): - print(a) - a.append(1.2) - print(len(a), '%.3f' % a[0]) - a.append(1) - a.append(False) - print(len(a), '%.3f %.3f' % (a[1], a[2])) - a[-1] = 3.45 - print('%.3f' % a[-1]) - -test(array('f')) -test(array('d')) - -print('{:.4f}'.format(array('f', b'\xcc\xcc\xcc=')[0])) diff --git a/tests/float 2/float_compare.py b/tests/float 2/float_compare.py deleted file mode 100644 index 105923ac733af..0000000000000 --- a/tests/float 2/float_compare.py +++ /dev/null @@ -1,22 +0,0 @@ -# Extended float comparisons - -class Foo: - pass - -foo = Foo() - -print(foo == 1.0) -print(1.0 == foo) -print(1.0 == Foo) -print(1.0 == []) -print(1.0 == {}) - -try: - print(foo < 1.0) -except TypeError: - print("TypeError") - -try: - print(1.0 < foo) -except TypeError: - print("TypeError") diff --git a/tests/float 2/float_divmod.py b/tests/float 2/float_divmod.py deleted file mode 100644 index 8e7cd435a55e6..0000000000000 --- a/tests/float 2/float_divmod.py +++ /dev/null @@ -1,25 +0,0 @@ -# test floating point floor divide and modulus -# it has some tricky corner cases - -def test(x, y): - div, mod = divmod(x, y) - print('%.8f %.8f %.8f %.8f' % (x // y, x % y, div, mod)) - print(div == x // y, mod == x % y, abs(div * y + mod - x) < 1e-15) - -test(1.23456, 0.7) -test(-1.23456, 0.7) -test(1.23456, -0.7) -test(-1.23456, -0.7) - -a = 1.23456 -b = 0.7 -test(a, b) -test(a, -b) -test(-a, b) -test(-a, -b) - -for i in range(25): - x = (i - 12.5) / 6 - for j in range(25): - y = (j - 12.5) / 6 - test(x, y) diff --git a/tests/float 2/float_divmod_relaxed.py b/tests/float 2/float_divmod_relaxed.py deleted file mode 100644 index a9450fa2c4d94..0000000000000 --- a/tests/float 2/float_divmod_relaxed.py +++ /dev/null @@ -1,33 +0,0 @@ -# test floating point floor divide and modulus -# it has some tricky corner cases - -# pyboard has 32-bit floating point and gives different (but still -# correct) answers for certain combinations of divmod arguments. - -def test(x, y): - div, mod = divmod(x, y) - print(div == x // y, mod == x % y, abs(div * y + mod - x) < 1e-6) - -test(1.23456, 0.7) -test(-1.23456, 0.7) -test(1.23456, -0.7) -test(-1.23456, -0.7) - -a = 1.23456 -b = 0.7 -test(a, b) -test(a, -b) -test(-a, b) -test(-a, -b) - -for i in range(25): - x = (i - 12.5) / 6 - for j in range(25): - y = (j - 12.5) / 6 - test(x, y) - -# test division by zero error -try: - divmod(1.0, 0) -except ZeroDivisionError: - print('ZeroDivisionError') diff --git a/tests/float 2/float_format.py b/tests/float 2/float_format.py deleted file mode 100644 index d43535cf2ff4f..0000000000000 --- a/tests/float 2/float_format.py +++ /dev/null @@ -1,19 +0,0 @@ -# test float formatting - -# general rounding -for val in (116, 1111, 1234, 5010, 11111): - print('%.0f' % val) - print('%.1f' % val) - print('%.3f' % val) - -# make sure rounding is done at the correct precision -for prec in range(8): - print(('%%.%df' % prec) % 6e-5) - -# check certain cases that had a digit value of 10 render as a ":" character -print('%.2e' % float('9' * 51 + 'e-39')) -print('%.2e' % float('9' * 40 + 'e-21')) - -# check a case that would render negative digit values, eg ")" characters -# the string is converted back to a float to check for no illegal characters -float('%.23e' % 1e-80) diff --git a/tests/float 2/float_parse.py b/tests/float 2/float_parse.py deleted file mode 100644 index 4b026de1c8103..0000000000000 --- a/tests/float 2/float_parse.py +++ /dev/null @@ -1,32 +0,0 @@ -# test parsing of floats - -inf = float('inf') - -# it shouldn't matter where the decimal point is if the exponent balances the value -print(float('1234') - float('0.1234e4')) -print(float('1.015625') - float('1015625e-6')) - -# very large integer part with a very negative exponent should cancel out -print('%.4e' % float('9' * 60 + 'e-60')) -print('%.4e' % float('9' * 60 + 'e-40')) - -# many fractional digits -print(float('.' + '9' * 70)) -print(float('.' + '9' * 70 + 'e20')) -print(float('.' + '9' * 70 + 'e-50') == float('1e-50')) - -# tiny fraction with large exponent -print(float('.' + '0' * 60 + '1e10') == float('1e-51')) -print(float('.' + '0' * 60 + '9e25') == float('9e-36')) -print(float('.' + '0' * 60 + '9e40') == float('9e-21')) - -# ensure that accuracy is retained when value is close to a subnormal -print(float('1.00000000000000000000e-37')) -print(float('10.0000000000000000000e-38')) -print(float('100.000000000000000000e-39')) - -# very large exponent literal -print(float('1e4294967301')) -print(float('1e-4294967301')) -print(float('1e18446744073709551621')) -print(float('1e-18446744073709551621')) diff --git a/tests/float 2/float_parse_doubleprec.py b/tests/float 2/float_parse_doubleprec.py deleted file mode 100644 index dcc0dd5921544..0000000000000 --- a/tests/float 2/float_parse_doubleprec.py +++ /dev/null @@ -1,21 +0,0 @@ -# test parsing of floats, requiring double-precision - -# very large integer part with a very negative exponent should cancel out -print(float('9' * 400 + 'e-100')) -print(float('9' * 400 + 'e-200')) -print(float('9' * 400 + 'e-400')) - -# many fractional digits -print(float('.' + '9' * 400)) -print(float('.' + '9' * 400 + 'e100')) -print(float('.' + '9' * 400 + 'e-100')) - -# tiny fraction with large exponent -print('%.14e' % float('.' + '0' * 400 + '9e100')) -print('%.14e' % float('.' + '0' * 400 + '9e200')) -print('%.14e' % float('.' + '0' * 400 + '9e400')) - -# ensure that accuracy is retained when value is close to a subnormal -print(float('1.00000000000000000000e-307')) -print(float('10.0000000000000000000e-308')) -print(float('100.000000000000000000e-309')) diff --git a/tests/float 2/float_struct.py b/tests/float 2/float_struct.py deleted file mode 100644 index dd7a418ad5fd4..0000000000000 --- a/tests/float 2/float_struct.py +++ /dev/null @@ -1,17 +0,0 @@ -# test struct package with floats -try: - try: - import ustruct as struct - except: - import struct -except ImportError: - print("SKIP") - raise SystemExit - -i = 1. + 1/2 -# TODO: it looks like '=' format modifier is not yet supported -# for fmt in ('f', 'd', '>f', '>d', 'f', '>d', '' + fmt.format(*args) + '<') - -test("{:10.4}", 123.456) -test("{:10.4e}", 123.456) -test("{:10.4e}", -123.456) -test("{:10.4f}", 123.456) -test("{:10.4f}", -123.456) -test("{:10.4g}", 123.456) -test("{:10.4g}", -123.456) -test("{:10.4n}", 123.456) -test("{:e}", 100) -test("{:f}", 200) -test("{:g}", 300) - -test("{:10.4E}", 123.456) -test("{:10.4E}", -123.456) -test("{:10.4F}", 123.456) -test("{:10.4F}", -123.456) -test("{:10.4G}", 123.456) -test("{:10.4G}", -123.456) - -test("{:06e}", float("inf")) -test("{:06e}", float("-inf")) -test("{:06e}", float("nan")) - -# The following fails right now -#test("{:10.1}", 0.0) - -print("%.0f" % (1.750000 % 0.08333333333)) -# Below isn't compatible with single-precision float -#print("%.1f" % (1.750000 % 0.08333333333)) -#print("%.2f" % (1.750000 % 0.08333333333)) -#print("%.12f" % (1.750000 % 0.08333333333)) - -# tests for errors in format string - -try: - '{:10.1b}'.format(0.0) -except ValueError: - print('ValueError') diff --git a/tests/float 2/string_format2.py b/tests/float 2/string_format2.py deleted file mode 100644 index 269023e7ffb62..0000000000000 --- a/tests/float 2/string_format2.py +++ /dev/null @@ -1,106 +0,0 @@ -# Change the following to True to get a much more comprehensive set of tests -# to run, albeit, which take considerably longer. - -full_tests = False - -def test(fmt, *args): - print('{:8s}'.format(fmt) + '>' + fmt.format(*args) + '<') - -def test_fmt(conv, fill, alignment, sign, prefix, width, precision, type, arg): - fmt = '{' - if conv: - fmt += '!' - fmt += conv - fmt += ':' - if alignment: - fmt += fill - fmt += alignment - fmt += sign - fmt += prefix - fmt += width - if precision: - fmt += '.' - fmt += precision - fmt += type - fmt += '}' - test(fmt, arg) - if fill == '0' and alignment == '=': - fmt = '{:' - fmt += sign - fmt += prefix - fmt += width - if precision: - fmt += '.' - fmt += precision - fmt += type - fmt += '}' - test(fmt, arg) - -eg_nums = (0.0, -0.0, 0.1, 1.234, 12.3459, 1.23456789, 123456789.0, -0.0, - -0.1, -1.234, -12.3459, 1e4, 1e-4, 1e5, 1e-5, 1e6, 1e-6, 1e10, - 1e37, -1e37, 1e-37, -1e-37, - 1.23456e8, 1.23456e7, 1.23456e6, 1.23456e5, 1.23456e4, 1.23456e3, 1.23456e2, 1.23456e1, 1.23456e0, - 1.23456e-1, 1.23456e-2, 1.23456e-3, 1.23456e-4, 1.23456e-5, 1.23456e-6, 1.23456e-7, 1.23456e-8, - -1.23456e8, -1.23456e7, -1.23456e6, -1.23456e5, -1.23456e4, -1.23456e3, -1.23456e2, -1.23456e1, -1.23456e0, - -1.23456e-1, -1.23456e-2, -1.23456e-3, -1.23456e-4, -1.23456e-5, -1.23456e-6, -1.23456e-7, -1.23456e-8) - -if full_tests: - for type in ('e', 'E', 'g', 'G', 'n'): - for width in ('', '4', '6', '8', '10'): - for alignment in ('', '<', '>', '=', '^'): - for fill in ('', '@', '0', ' '): - for sign in ('', '+', '-', ' '): - for prec in ('', '1', '3', '6'): - for num in eg_nums: - test_fmt('', fill, alignment, sign, '', width, prec, type, num) - -# Note: We use 1.23459 rather than 1.2345 because '{:3f}'.format(1.2345) -# rounds differently than print("%.3f", 1.2345); - -f_nums = (0.0, -0.0, 0.0001, 0.001, 0.01, 0.1, 1.0, 10.0, - 0.0012, 0.0123, 0.1234, 1.23459, 12.3456, - -0.0001, -0.001, -0.01, -0.1, -1.0, -10.0, - -0.0012, -0.0123, -0.1234, -1.23459, -12.3456) - -if full_tests: - for type in ('f', 'F'): - for width in ('', '4', '6', '8', '10'): - for alignment in ('', '<', '>', '=', '^'): - for fill in ('', ' ', '0', '@'): - for sign in ('', '+', '-', ' '): - # An empty precision defaults to 6, but when uPy is - # configured to use a float, we can only use a - # precision of 6 with numbers less than 10 and still - # get results that compare to CPython (which uses - # long doubles). - for prec in ('1', '2', '3'): - for num in f_nums: - test_fmt('', fill, alignment, sign, '', width, prec, type, num) - for num in int_nums2: - test_fmt('', fill, alignment, sign, '', width, '', type, num) - -pct_nums1 = (0.1, 0.58, 0.99, -0.1, -0.58, -0.99) -pct_nums2 = (True, False, 1, 0, -1) - -if full_tests: - type = '%' - for width in ('', '4', '6', '8', '10'): - for alignment in ('', '<', '>', '=', '^'): - for fill in ('', ' ', '0', '@'): - for sign in ('', '+', '-', ' '): - # An empty precision defaults to 6, but when uPy is - # configured to use a float, we can only use a - # precision of 6 with numbers less than 10 and still - # get results that compare to CPython (which uses - # long doubles). - for prec in ('1', '2', '3'): - for num in pct_nums1: - test_fmt('', fill, alignment, sign, '', width, prec, type, num) - for num in pct_nums2: - test_fmt('', fill, alignment, sign, '', width, '', type, num) -else: - for num in pct_nums1: - test_fmt('', '', '', '', '', '', '1', '%', num) - -# We don't currently test a type of '' with floats (see the detailed comment -# in objstr.c) diff --git a/tests/float 2/string_format_fp30.py b/tests/float 2/string_format_fp30.py deleted file mode 100644 index 77b2a528852c2..0000000000000 --- a/tests/float 2/string_format_fp30.py +++ /dev/null @@ -1,41 +0,0 @@ -def test(fmt, *args): - print('{:8s}'.format(fmt) + '>' + fmt.format(*args) + '<') - -test("{:10.4}", 123.456) -test("{:10.4e}", 123.456) -test("{:10.4e}", -123.456) -#test("{:10.4f}", 123.456) -#test("{:10.4f}", -123.456) -test("{:10.4g}", 123.456) -test("{:10.4g}", -123.456) -test("{:10.4n}", 123.456) -test("{:e}", 100) -test("{:f}", 200) -test("{:g}", 300) - -test("{:10.4E}", 123.456) -test("{:10.4E}", -123.456) -#test("{:10.4F}", 123.456) -#test("{:10.4F}", -123.456) -test("{:10.4G}", 123.456) -test("{:10.4G}", -123.456) - -test("{:06e}", float("inf")) -test("{:06e}", float("-inf")) -test("{:06e}", float("nan")) - -# The following fails right now -#test("{:10.1}", 0.0) - -print("%.0f" % (1.750000 % 0.08333333333)) -# Below isn't compatible with single-precision float -#print("%.1f" % (1.750000 % 0.08333333333)) -#print("%.2f" % (1.750000 % 0.08333333333)) -#print("%.12f" % (1.750000 % 0.08333333333)) - -# tests for errors in format string - -try: - '{:10.1b}'.format(0.0) -except ValueError: - print('ValueError') diff --git a/tests/float 2/string_format_modulo.py b/tests/float 2/string_format_modulo.py deleted file mode 100644 index aea534247cc20..0000000000000 --- a/tests/float 2/string_format_modulo.py +++ /dev/null @@ -1,49 +0,0 @@ -print("%s" % 1.0) -print("%r" % 1.0) - -print("%d" % 1.0) -print("%i" % 1.0) -print("%u" % 1.0) - -# these 3 have different behaviour in Python 3.x versions -# uPy raises a TypeError, following Python 3.5 (earlier versions don't) -#print("%x" % 18.0) -#print("%o" % 18.0) -#print("%X" % 18.0) - -print("%e" % 1.23456) -print("%E" % 1.23456) -print("%f" % 1.23456) -print("%F" % 1.23456) -print("%g" % 1.23456) -print("%G" % 1.23456) - -print("%06e" % float("inf")) -print("%06e" % float("-inf")) -print("%06e" % float("nan")) - -print("%02.3d" % 123) # prec > width -print("%+f %+f" % (1.23, -1.23)) # float sign -print("% f % f" % (1.23, -1.23)) # float space sign -print("%0f" % -1.23) # negative number with 0 padding - -# numbers with large negative exponents -print('%f' % 1e-10) -print('%f' % 1e-20) -print('%f' % 1e-50) -print('%f' % 1e-100) -print('%f' % 1e-300) - -# large decimal precision should be truncated and not overflow buffer -# the output depends on the FP calculation so only first 2 digits are printed -# (the 'g' with small e are printed using 'f' style, so need to be checked) -print(('%.40f' % 1e-300)[:2]) -print(('%.40g' % 1e-1)[:2]) -print(('%.40g' % 1e-2)[:2]) -print(('%.40g' % 1e-3)[:2]) -print(('%.40g' % 1e-4)[:2]) - -print("%.0g" % 1) # 0 precision 'g' - -print('%.1e' % 9.99) # round up with positive exponent -print('%.1e' % 0.999) # round up with negative exponent diff --git a/tests/float 2/string_format_modulo2.py b/tests/float 2/string_format_modulo2.py deleted file mode 100644 index f6b1ae537d5e4..0000000000000 --- a/tests/float 2/string_format_modulo2.py +++ /dev/null @@ -1,24 +0,0 @@ -# test formatting floats with large precision, that it doesn't overflow the buffer - -def test(num, num_str): - if num == float('inf') or num == 0.0 and num_str != '0.0': - # skip numbers that overflow or underflow the FP precision - return - for kind in ('e', 'f', 'g'): - # check precision either side of the size of the buffer (32 bytes) - for prec in range(23, 36, 2): - fmt = '%.' + '%d' % prec + kind - s = fmt % num - check = abs(float(s) - num) - if num > 1: - check /= num - if check > 1e-6: - print('FAIL', num_str, fmt, s, len(s), check) - -# check pure zero -test(0.0, '0.0') - -# check some powers of 10, making sure to include exponents with 3 digits -for e in range(-8, 8): - num = pow(10, e) - test(num, '1e%d' % e) diff --git a/tests/float 2/string_format_modulo2_intbig.py b/tests/float 2/string_format_modulo2_intbig.py deleted file mode 100644 index 9992ba65d9d3d..0000000000000 --- a/tests/float 2/string_format_modulo2_intbig.py +++ /dev/null @@ -1,21 +0,0 @@ -# test formatting floats with large precision, that it doesn't overflow the buffer - -def test(num, num_str): - if num == float('inf') or num == 0.0 and num_str != '0.0': - # skip numbers that overflow or underflow the FP precision - return - for kind in ('e', 'f', 'g'): - # check precision either side of the size of the buffer (32 bytes) - for prec in range(23, 36, 2): - fmt = '%.' + '%d' % prec + kind - s = fmt % num - check = abs(float(s) - num) - if num > 1: - check /= num - if check > 1e-6: - print('FAIL', num_str, fmt, s, len(s), check) - -# check most powers of 10, making sure to include exponents with 3 digits -for e in range(-101, 102): - num = pow(10, e) - test(num, '1e%d' % e) diff --git a/tests/float 2/string_format_modulo3.py b/tests/float 2/string_format_modulo3.py deleted file mode 100644 index 5d26f25751d49..0000000000000 --- a/tests/float 2/string_format_modulo3.py +++ /dev/null @@ -1,3 +0,0 @@ -# uPy and CPython outputs differ for the following -print("%.1g" % -9.9) # round up 'g' with '-' sign -print("%.2g" % 99.9) # round up diff --git a/tests/float 2/string_format_modulo3.py.exp b/tests/float 2/string_format_modulo3.py.exp deleted file mode 100644 index 71432b3404519..0000000000000 --- a/tests/float 2/string_format_modulo3.py.exp +++ /dev/null @@ -1,2 +0,0 @@ --10 -100 diff --git a/tests/float 2/true_value.py b/tests/float 2/true_value.py deleted file mode 100644 index df415f0031db0..0000000000000 --- a/tests/float 2/true_value.py +++ /dev/null @@ -1,7 +0,0 @@ -# Test true-ish value handling - -if not 0.0: - print("float 0") - -if not 0+0j: - print("complex 0") diff --git a/tests/float 2/types.py b/tests/float 2/types.py deleted file mode 100644 index 75674c9246389..0000000000000 --- a/tests/float 2/types.py +++ /dev/null @@ -1,17 +0,0 @@ -# float types - -print(float) -print(complex) - -print(type(float()) == float) -print(type(complex()) == complex) - -print(type(0.0) == float) -print(type(1j) == complex) - -# hashing float types - -d = dict() -d[float] = complex -d[complex] = float -print(len(d)) diff --git a/tests/inlineasm 2/asmargs.py b/tests/inlineasm 2/asmargs.py deleted file mode 100644 index 047d9ed4200f1..0000000000000 --- a/tests/inlineasm 2/asmargs.py +++ /dev/null @@ -1,29 +0,0 @@ -# test passing arguments - -@micropython.asm_thumb -def arg0(): - mov(r0, 1) -print(arg0()) - -@micropython.asm_thumb -def arg1(r0): - add(r0, r0, 1) -print(arg1(1)) - -@micropython.asm_thumb -def arg2(r0, r1): - add(r0, r0, r1) -print(arg2(1, 2)) - -@micropython.asm_thumb -def arg3(r0, r1, r2): - add(r0, r0, r1) - add(r0, r0, r2) -print(arg3(1, 2, 3)) - -@micropython.asm_thumb -def arg4(r0, r1, r2, r3): - add(r0, r0, r1) - add(r0, r0, r2) - add(r0, r0, r3) -print(arg4(1, 2, 3, 4)) diff --git a/tests/inlineasm 2/asmargs.py.exp b/tests/inlineasm 2/asmargs.py.exp deleted file mode 100644 index e33a6964f46e8..0000000000000 --- a/tests/inlineasm 2/asmargs.py.exp +++ /dev/null @@ -1,5 +0,0 @@ -1 -2 -3 -6 -10 diff --git a/tests/inlineasm 2/asmbcc.py b/tests/inlineasm 2/asmbcc.py deleted file mode 100644 index 540fa6591fb9d..0000000000000 --- a/tests/inlineasm 2/asmbcc.py +++ /dev/null @@ -1,27 +0,0 @@ -# test bcc instructions -# at the moment only tests beq, narrow and wide versions - -@micropython.asm_thumb -def f(r0): - mov(r1, r0) - - mov(r0, 10) - cmp(r1, 1) - beq(end) - - mov(r0, 20) - cmp(r1, 2) - beq_n(end) - - mov(r0, 30) - cmp(r1, 3) - beq_w(end) - - mov(r0, 0) - - label(end) - -print(f(0)) -print(f(1)) -print(f(2)) -print(f(3)) diff --git a/tests/inlineasm 2/asmbcc.py.exp b/tests/inlineasm 2/asmbcc.py.exp deleted file mode 100644 index 39da7d1a99ee5..0000000000000 --- a/tests/inlineasm 2/asmbcc.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -0 -10 -20 -30 diff --git a/tests/inlineasm 2/asmbitops.py b/tests/inlineasm 2/asmbitops.py deleted file mode 100644 index 8cf92b301f76d..0000000000000 --- a/tests/inlineasm 2/asmbitops.py +++ /dev/null @@ -1,13 +0,0 @@ -@micropython.asm_thumb -def clz(r0): - clz(r0, r0) - -print(clz(0xf0)) -print(clz(0x8000)) - -@micropython.asm_thumb -def rbit(r0): - rbit(r0, r0) - -print(hex(rbit(0xf0))) -print(hex(rbit(0x8000))) diff --git a/tests/inlineasm 2/asmbitops.py.exp b/tests/inlineasm 2/asmbitops.py.exp deleted file mode 100644 index 8c560045f41ed..0000000000000 --- a/tests/inlineasm 2/asmbitops.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -24 -16 -0xf000000 -0x10000 diff --git a/tests/inlineasm 2/asmblbx.py b/tests/inlineasm 2/asmblbx.py deleted file mode 100644 index d08c0ed6b3e03..0000000000000 --- a/tests/inlineasm 2/asmblbx.py +++ /dev/null @@ -1,21 +0,0 @@ -# test bl and bx instructions - -@micropython.asm_thumb -def f(r0): - # jump over the internal functions - b(entry) - - label(func1) - add(r0, 2) - bx(lr) - - label(func2) - sub(r0, 1) - bx(lr) - - label(entry) - bl(func1) - bl(func2) - -print(f(0)) -print(f(1)) diff --git a/tests/inlineasm 2/asmblbx.py.exp b/tests/inlineasm 2/asmblbx.py.exp deleted file mode 100644 index 1191247b6d9a2..0000000000000 --- a/tests/inlineasm 2/asmblbx.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -1 -2 diff --git a/tests/inlineasm 2/asmconst.py b/tests/inlineasm 2/asmconst.py deleted file mode 100644 index 299a25093c7b3..0000000000000 --- a/tests/inlineasm 2/asmconst.py +++ /dev/null @@ -1,8 +0,0 @@ -# test constants in assembler - -@micropython.asm_thumb -def c1(): - movwt(r0, 0xffffffff) - movwt(r1, 0xf0000000) - sub(r0, r0, r1) -print(hex(c1())) diff --git a/tests/inlineasm 2/asmconst.py.exp b/tests/inlineasm 2/asmconst.py.exp deleted file mode 100644 index 3ef9fcabd7ec9..0000000000000 --- a/tests/inlineasm 2/asmconst.py.exp +++ /dev/null @@ -1 +0,0 @@ -0xfffffff diff --git a/tests/inlineasm 2/asmdiv.py b/tests/inlineasm 2/asmdiv.py deleted file mode 100644 index b97d566eb54c1..0000000000000 --- a/tests/inlineasm 2/asmdiv.py +++ /dev/null @@ -1,16 +0,0 @@ -@micropython.asm_thumb -def sdiv(r0, r1): - sdiv(r0, r0, r1) - -@micropython.asm_thumb -def udiv(r0, r1): - udiv(r0, r0, r1) - -print(sdiv(1234, 3)) -print(sdiv(-1234, 3)) -print(sdiv(1234, -3)) -print(sdiv(-1234, -3)) - -print(udiv(1234, 3)) -print(udiv(0xffffffff, 0x7fffffff)) -print(udiv(0xffffffff, 0xffffffff)) diff --git a/tests/inlineasm 2/asmdiv.py.exp b/tests/inlineasm 2/asmdiv.py.exp deleted file mode 100644 index f1b80deb327eb..0000000000000 --- a/tests/inlineasm 2/asmdiv.py.exp +++ /dev/null @@ -1,7 +0,0 @@ -411 --411 --411 -411 -411 -2 -1 diff --git a/tests/inlineasm 2/asmfpaddsub.py b/tests/inlineasm 2/asmfpaddsub.py deleted file mode 100644 index 2bdfccf0e0cef..0000000000000 --- a/tests/inlineasm 2/asmfpaddsub.py +++ /dev/null @@ -1,14 +0,0 @@ -@micropython.asm_thumb # r0 = r0+r1-r2 -def add_sub(r0, r1, r2): - vmov(s0, r0) - vcvt_f32_s32(s0, s0) - vmov(s1, r1) - vcvt_f32_s32(s1, s1) - vmov(s2, r2) - vcvt_f32_s32(s2, s2) - vadd(s0, s0, s1) - vsub(s0, s0, s2) - vcvt_s32_f32(s31, s0) - vmov(r0, s31) - -print(add_sub(100, 20, 30)) diff --git a/tests/inlineasm 2/asmfpaddsub.py.exp b/tests/inlineasm 2/asmfpaddsub.py.exp deleted file mode 100644 index d61f00d8cad39..0000000000000 --- a/tests/inlineasm 2/asmfpaddsub.py.exp +++ /dev/null @@ -1 +0,0 @@ -90 diff --git a/tests/inlineasm 2/asmfpcmp.py b/tests/inlineasm 2/asmfpcmp.py deleted file mode 100644 index d4fa1f2410cff..0000000000000 --- a/tests/inlineasm 2/asmfpcmp.py +++ /dev/null @@ -1,14 +0,0 @@ -@micropython.asm_thumb # test vcmp, vmrs -def f(r0, r1): - vmov(s0, r0) - vcvt_f32_s32(s0, s0) - vmov(s1, r1) - vcvt_f32_s32(s1, s1) - vcmp(s1, s0) - vmrs(r0, FPSCR) - mov(r1, 28) - lsr(r0, r1) - -print(f(0,1)) -print(f(1,1)) -print(f(1,0)) diff --git a/tests/inlineasm 2/asmfpcmp.py.exp b/tests/inlineasm 2/asmfpcmp.py.exp deleted file mode 100644 index 104b3580f7687..0000000000000 --- a/tests/inlineasm 2/asmfpcmp.py.exp +++ /dev/null @@ -1,3 +0,0 @@ -2 -6 -8 diff --git a/tests/inlineasm 2/asmfpldrstr.py b/tests/inlineasm 2/asmfpldrstr.py deleted file mode 100644 index 4c480671f9fef..0000000000000 --- a/tests/inlineasm 2/asmfpldrstr.py +++ /dev/null @@ -1,11 +0,0 @@ -import array -@micropython.asm_thumb # test vldr, vstr -def arrayadd(r0): - vldr(s0, [r0, 0]) - vldr(s1, [r0, 4]) - vadd(s2, s0, s1) - vstr(s2, [r0, 8]) - -z = array.array("f", [2, 4, 10]) -arrayadd(z) -print(z[2]) diff --git a/tests/inlineasm 2/asmfpldrstr.py.exp b/tests/inlineasm 2/asmfpldrstr.py.exp deleted file mode 100644 index e0ea36feef6e8..0000000000000 --- a/tests/inlineasm 2/asmfpldrstr.py.exp +++ /dev/null @@ -1 +0,0 @@ -6.0 diff --git a/tests/inlineasm 2/asmfpmuldiv.py b/tests/inlineasm 2/asmfpmuldiv.py deleted file mode 100644 index 043a28e22985e..0000000000000 --- a/tests/inlineasm 2/asmfpmuldiv.py +++ /dev/null @@ -1,14 +0,0 @@ -@micropython.asm_thumb # r0 = (int)(r0*r1/r2) -def muldiv(r0, r1, r2): - vmov(s0, r0) - vcvt_f32_s32(s0, s0) - vmov(s1, r1) - vcvt_f32_s32(s1, s1) - vmov(s2, r2) - vcvt_f32_s32(s2, s2) - vmul(s7, s0, s1) - vdiv(s8, s7, s2) - vcvt_s32_f32(s31, s8) - vmov(r0, s31) - -print(muldiv(100, 10, 50)) diff --git a/tests/inlineasm 2/asmfpmuldiv.py.exp b/tests/inlineasm 2/asmfpmuldiv.py.exp deleted file mode 100644 index 209e3ef4b6247..0000000000000 --- a/tests/inlineasm 2/asmfpmuldiv.py.exp +++ /dev/null @@ -1 +0,0 @@ -20 diff --git a/tests/inlineasm 2/asmfpsqrt.py b/tests/inlineasm 2/asmfpsqrt.py deleted file mode 100644 index 7b7d52e2380a8..0000000000000 --- a/tests/inlineasm 2/asmfpsqrt.py +++ /dev/null @@ -1,14 +0,0 @@ -# test vsqrt, vneg -@micropython.asm_thumb # r0 = -(int)(sqrt(r0)*r1) -def sqrt_test(r0, r1): - vmov(s1, r0) - vcvt_f32_s32(s1, s1) - vsqrt(s1, s1) - vmov(s2, r1) - vcvt_f32_s32(s2, s2) - vmul(s0, s1, s2) - vneg(s7, s0) - vcvt_s32_f32(s31, s7) - vmov(r0, s31) - -print(sqrt_test(256, 10)) diff --git a/tests/inlineasm 2/asmfpsqrt.py.exp b/tests/inlineasm 2/asmfpsqrt.py.exp deleted file mode 100644 index 88a1e93bab2f0..0000000000000 --- a/tests/inlineasm 2/asmfpsqrt.py.exp +++ /dev/null @@ -1 +0,0 @@ --160 diff --git a/tests/inlineasm 2/asmit.py b/tests/inlineasm 2/asmit.py deleted file mode 100644 index 57bfcc7f9ad86..0000000000000 --- a/tests/inlineasm 2/asmit.py +++ /dev/null @@ -1,16 +0,0 @@ -# test it instruction - -@micropython.asm_thumb -def f(r0, r1): - cmp(r0, r1) - it(eq) - mov(r0, 100) -print(f(0, 0), f(1, 2)) - -@micropython.asm_thumb -def g(r0, r1): - cmp(r0, r1) - ite(eq) - mov(r0, 100) - mov(r0, 200) -print(g(0, 0), g(0, 1)) diff --git a/tests/inlineasm 2/asmit.py.exp b/tests/inlineasm 2/asmit.py.exp deleted file mode 100644 index d06c72d9bbaa8..0000000000000 --- a/tests/inlineasm 2/asmit.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -100 1 -100 200 diff --git a/tests/inlineasm 2/asmpushpop.py b/tests/inlineasm 2/asmpushpop.py deleted file mode 100644 index c9005434ba477..0000000000000 --- a/tests/inlineasm 2/asmpushpop.py +++ /dev/null @@ -1,8 +0,0 @@ -@micropython.asm_thumb -def f(r0, r1, r2): - push({r0}) - push({r1, r2}) - pop({r0}) - pop({r1, r2}) - -print(f(0, 1, 2)) diff --git a/tests/inlineasm 2/asmpushpop.py.exp b/tests/inlineasm 2/asmpushpop.py.exp deleted file mode 100644 index d00491fd7e5bb..0000000000000 --- a/tests/inlineasm 2/asmpushpop.py.exp +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/tests/inlineasm 2/asmrettype.py b/tests/inlineasm 2/asmrettype.py deleted file mode 100644 index f1918696eeaeb..0000000000000 --- a/tests/inlineasm 2/asmrettype.py +++ /dev/null @@ -1,21 +0,0 @@ -# test return type of inline asm - -@micropython.asm_thumb -def ret_obj(r0) -> object: - pass -ret_obj(print)(1) - -@micropython.asm_thumb -def ret_bool(r0) -> bool: - pass -print(ret_bool(0), ret_bool(1)) - -@micropython.asm_thumb -def ret_int(r0) -> int: - lsl(r0, r0, 29) -print(ret_int(0), hex(ret_int(1)), hex(ret_int(2)), hex(ret_int(4))) - -@micropython.asm_thumb -def ret_uint(r0) -> uint: - lsl(r0, r0, 29) -print(ret_uint(0), hex(ret_uint(1)), hex(ret_uint(2)), hex(ret_uint(4))) diff --git a/tests/inlineasm 2/asmrettype.py.exp b/tests/inlineasm 2/asmrettype.py.exp deleted file mode 100644 index cbb49d24724ec..0000000000000 --- a/tests/inlineasm 2/asmrettype.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -1 -False True -0 0x20000000 0x40000000 -0x80000000 -0 0x20000000 0x40000000 0x80000000 diff --git a/tests/inlineasm 2/asmshift.py b/tests/inlineasm 2/asmshift.py deleted file mode 100644 index 0df2187347068..0000000000000 --- a/tests/inlineasm 2/asmshift.py +++ /dev/null @@ -1,29 +0,0 @@ -@micropython.asm_thumb -def lsl1(r0): - lsl(r0, r0, 1) -print(hex(lsl1(0x123))) - -@micropython.asm_thumb -def lsl23(r0): - lsl(r0, r0, 23) -print(hex(lsl23(1))) - -@micropython.asm_thumb -def lsr1(r0): - lsr(r0, r0, 1) -print(hex(lsr1(0x123))) - -@micropython.asm_thumb -def lsr31(r0): - lsr(r0, r0, 31) -print(hex(lsr31(0x80000000))) - -@micropython.asm_thumb -def asr1(r0): - asr(r0, r0, 1) -print(hex(asr1(0x123))) - -@micropython.asm_thumb -def asr31(r0): - asr(r0, r0, 31) -print(hex(asr31(0x80000000))) diff --git a/tests/inlineasm 2/asmshift.py.exp b/tests/inlineasm 2/asmshift.py.exp deleted file mode 100644 index c6c3a7217935d..0000000000000 --- a/tests/inlineasm 2/asmshift.py.exp +++ /dev/null @@ -1,6 +0,0 @@ -0x246 -0x800000 -0x91 -0x1 -0x91 --0x1 diff --git a/tests/inlineasm 2/asmspecialregs.py b/tests/inlineasm 2/asmspecialregs.py deleted file mode 100644 index 2d3b0e396f41f..0000000000000 --- a/tests/inlineasm 2/asmspecialregs.py +++ /dev/null @@ -1,10 +0,0 @@ -@micropython.asm_thumb -def getIPSR(): - mrs(r0, IPSR) - -@micropython.asm_thumb -def getBASEPRI(): - mrs(r0, BASEPRI) - -print(getBASEPRI()) -print(getIPSR()) diff --git a/tests/inlineasm 2/asmspecialregs.py.exp b/tests/inlineasm 2/asmspecialregs.py.exp deleted file mode 100644 index aa47d0d46d47a..0000000000000 --- a/tests/inlineasm 2/asmspecialregs.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -0 -0 diff --git a/tests/inlineasm 2/asmsum.py b/tests/inlineasm 2/asmsum.py deleted file mode 100644 index 07e71c7384927..0000000000000 --- a/tests/inlineasm 2/asmsum.py +++ /dev/null @@ -1,57 +0,0 @@ -@micropython.asm_thumb -def asm_sum_words(r0, r1): - - # r0 = len - # r1 = ptr - # r2 = sum - # r3 = dummy - mov(r2, 0) - - b(loop_entry) - - label(loop1) - ldr(r3, [r1, 0]) - add(r2, r2, r3) - - add(r1, r1, 4) - sub(r0, r0, 1) - - label(loop_entry) - cmp(r0, 0) - bgt(loop1) - - mov(r0, r2) - -@micropython.asm_thumb -def asm_sum_bytes(r0, r1): - - # r0 = len - # r1 = ptr - # r2 = sum - # r3 = dummy - mov(r2, 0) - - b(loop_entry) - - label(loop1) - ldrb(r3, [r1, 0]) - add(r2, r2, r3) - - add(r1, r1, 1) - sub(r0, r0, 1) - - label(loop_entry) - cmp(r0, 0) - bgt(loop1) - - mov(r0, r2) - -import array - -b = array.array('l', (100, 200, 300, 400)) -n = asm_sum_words(len(b), b) -print(b, n) - -b = array.array('b', (10, 20, 30, 40, 50, 60, 70, 80)) -n = asm_sum_bytes(len(b), b) -print(b, n) diff --git a/tests/inlineasm 2/asmsum.py.exp b/tests/inlineasm 2/asmsum.py.exp deleted file mode 100644 index d50a94c8db622..0000000000000 --- a/tests/inlineasm 2/asmsum.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -array('l', [100, 200, 300, 400]) 1000 -array('b', [10, 20, 30, 40, 50, 60, 70, 80]) 360 diff --git a/tests/jni 2/README b/tests/jni 2/README deleted file mode 100644 index a0689e92447b6..0000000000000 --- a/tests/jni 2/README +++ /dev/null @@ -1,11 +0,0 @@ -Running "jni" module tests (as well as just using this module) requires -being able to load libjvm.so, which requires path to it set via -LD_LIBRARY_PATH environment variable. This path is not set automatically -and there is no easy way to guess it, because there can be installed -different implementations of JVM, for one implementation, there can be -different versions, and single version may include different variants -of JVM. - -For example, for OpenJDK 7 on x86_64, following may work: - -LD_LIBRARY_PATH=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server ./run-tests jni/*.py diff --git a/tests/jni 2/list.py b/tests/jni 2/list.py deleted file mode 100644 index d58181d0bad0e..0000000000000 --- a/tests/jni 2/list.py +++ /dev/null @@ -1,15 +0,0 @@ -import jni -try: - ArrayList = jni.cls("java/util/ArrayList") -except: - print("SKIP") - raise SystemExit - -l = ArrayList() -print(l) -l.add("one") -l.add("two") - -print(l.toString()) -print(l) -print(l[0], l[1]) diff --git a/tests/jni 2/list.py.exp b/tests/jni 2/list.py.exp deleted file mode 100644 index cc34bb0a21c64..0000000000000 --- a/tests/jni 2/list.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -[] -[one, two] -[one, two] -one two diff --git a/tests/jni 2/object.py b/tests/jni 2/object.py deleted file mode 100644 index aa67615ec8a83..0000000000000 --- a/tests/jni 2/object.py +++ /dev/null @@ -1,15 +0,0 @@ -import jni -try: - Integer = jni.cls("java/lang/Integer") -except: - print("SKIP") - raise SystemExit - -# Create object -i = Integer(42) -print(i) -# Call object method -print(i.hashCode()) -# Pass object to another method -System = jni.cls("java/lang/System") -System.out.println(i) diff --git a/tests/jni 2/object.py.exp b/tests/jni 2/object.py.exp deleted file mode 100644 index bda709ecfb472..0000000000000 --- a/tests/jni 2/object.py.exp +++ /dev/null @@ -1,3 +0,0 @@ -42 -42 -42 diff --git a/tests/jni 2/system_out.py b/tests/jni 2/system_out.py deleted file mode 100644 index 86c4b9e112163..0000000000000 --- a/tests/jni 2/system_out.py +++ /dev/null @@ -1,8 +0,0 @@ -try: - import jni - System = jni.cls("java/lang/System") -except: - print("SKIP") - raise SystemExit - -System.out.println("Hello, Java!") diff --git a/tests/jni 2/system_out.py.exp b/tests/jni 2/system_out.py.exp deleted file mode 100644 index 01dd954f9067a..0000000000000 --- a/tests/jni 2/system_out.py.exp +++ /dev/null @@ -1 +0,0 @@ -Hello, Java! diff --git a/tests/net_hosted 2/README b/tests/net_hosted 2/README deleted file mode 100644 index 724dd61584a5e..0000000000000 --- a/tests/net_hosted 2/README +++ /dev/null @@ -1,11 +0,0 @@ -This directory contains network tests which require just "peer to peer" -network connection between test host and device under test, instead of -full Internet connection. - -Note that setup for these tests and tests themselves are WIP, and may -not yet fully correspond to the functional specification above. - -So far, these tests are not run as part of the main testsuite and need -to be run seperately (from the main test/ directory): - - ./run-tests net_hosted/*.py diff --git a/tests/net_hosted 2/accept_nonblock.py b/tests/net_hosted 2/accept_nonblock.py deleted file mode 100644 index 56f3288e28e68..0000000000000 --- a/tests/net_hosted 2/accept_nonblock.py +++ /dev/null @@ -1,16 +0,0 @@ -# test that socket.accept() on a non-blocking socket raises EAGAIN - -try: - import usocket as socket -except: - import socket - -s = socket.socket() -s.bind(socket.getaddrinfo('127.0.0.1', 8123)[0][-1]) -s.setblocking(False) -s.listen(1) -try: - s.accept() -except OSError as er: - print(er.args[0] == 11) # 11 is EAGAIN -s.close() diff --git a/tests/net_hosted 2/accept_nonblock.py.exp b/tests/net_hosted 2/accept_nonblock.py.exp deleted file mode 100644 index 0ca95142bb715..0000000000000 --- a/tests/net_hosted 2/accept_nonblock.py.exp +++ /dev/null @@ -1 +0,0 @@ -True diff --git a/tests/net_hosted 2/accept_timeout.py b/tests/net_hosted 2/accept_timeout.py deleted file mode 100644 index 44b3b8c7cdbd0..0000000000000 --- a/tests/net_hosted 2/accept_timeout.py +++ /dev/null @@ -1,22 +0,0 @@ -# test that socket.accept() on a socket with timeout raises ETIMEDOUT - -try: - import usocket as socket -except: - import socket - -try: - socket.socket.settimeout -except AttributeError: - print('SKIP') - raise SystemExit - -s = socket.socket() -s.bind(socket.getaddrinfo('127.0.0.1', 8123)[0][-1]) -s.settimeout(1) -s.listen(1) -try: - s.accept() -except OSError as er: - print(er.args[0] in (110, 'timed out')) # 110 is ETIMEDOUT; CPython uses a string -s.close() diff --git a/tests/net_hosted 2/accept_timeout.py.exp b/tests/net_hosted 2/accept_timeout.py.exp deleted file mode 100644 index 0ca95142bb715..0000000000000 --- a/tests/net_hosted 2/accept_timeout.py.exp +++ /dev/null @@ -1 +0,0 @@ -True diff --git a/tests/net_hosted 2/connect_nonblock.py b/tests/net_hosted 2/connect_nonblock.py deleted file mode 100644 index 6479978bea67c..0000000000000 --- a/tests/net_hosted 2/connect_nonblock.py +++ /dev/null @@ -1,20 +0,0 @@ -# test that socket.connect() on a non-blocking socket raises EINPROGRESS - -try: - import usocket as socket -except: - import socket - - -def test(peer_addr): - s = socket.socket() - s.setblocking(False) - try: - s.connect(peer_addr) - except OSError as er: - print(er.args[0] == 115) # 115 is EINPROGRESS - s.close() - - -if __name__ == "__main__": - test(socket.getaddrinfo('micropython.org', 80)[0][-1]) diff --git a/tests/net_hosted 2/connect_nonblock.py.exp b/tests/net_hosted 2/connect_nonblock.py.exp deleted file mode 100644 index 0ca95142bb715..0000000000000 --- a/tests/net_hosted 2/connect_nonblock.py.exp +++ /dev/null @@ -1 +0,0 @@ -True diff --git a/tests/net_hosted 2/connect_poll.py b/tests/net_hosted 2/connect_poll.py deleted file mode 100644 index ece6aa0da9721..0000000000000 --- a/tests/net_hosted 2/connect_poll.py +++ /dev/null @@ -1,32 +0,0 @@ -# test that socket.connect() has correct polling behaviour before, during and after - -try: - import usocket as socket, uselect as select -except: - import socket, select - - -def test(peer_addr): - s = socket.socket() - poller = select.poll() - poller.register(s) - - # test poll before connect - # note: CPython can return POLLHUP, so use the IN|OUT mask - p = poller.poll(0) - print(len(p), p[0][-1] & (select.POLLIN | select.POLLOUT)) - - s.connect(peer_addr) - - # test poll during connection - print(len(poller.poll(0))) - - # test poll after connection is established - p = poller.poll(1000) - print(len(p), p[0][-1]) - - s.close() - - -if __name__ == "__main__": - test(socket.getaddrinfo('micropython.org', 80)[0][-1]) diff --git a/tests/net_hosted 2/connect_poll.py.exp b/tests/net_hosted 2/connect_poll.py.exp deleted file mode 100644 index cdf520e090bb7..0000000000000 --- a/tests/net_hosted 2/connect_poll.py.exp +++ /dev/null @@ -1,3 +0,0 @@ -1 4 -1 -1 4 diff --git a/tests/net_hosted 2/ssl_getpeercert.py b/tests/net_hosted 2/ssl_getpeercert.py deleted file mode 100644 index e265c830d0d92..0000000000000 --- a/tests/net_hosted 2/ssl_getpeercert.py +++ /dev/null @@ -1,21 +0,0 @@ -# test ssl.getpeercert() method - -try: - import usocket as socket - import ussl as ssl -except: - import socket - import ssl - - -def test(peer_addr): - s = socket.socket() - s.connect(peer_addr) - s = ssl.wrap_socket(s) - cert = s.getpeercert(True) - print(type(cert), len(cert) > 100) - s.close() - - -if __name__ == "__main__": - test(socket.getaddrinfo('micropython.org', 443)[0][-1]) diff --git a/tests/net_hosted 2/ssl_getpeercert.py.exp b/tests/net_hosted 2/ssl_getpeercert.py.exp deleted file mode 100644 index ff7ef5adf1bbb..0000000000000 --- a/tests/net_hosted 2/ssl_getpeercert.py.exp +++ /dev/null @@ -1 +0,0 @@ - True diff --git a/tests/net_inet 2/README b/tests/net_inet 2/README deleted file mode 100644 index 9a5614efa6429..0000000000000 --- a/tests/net_inet 2/README +++ /dev/null @@ -1,5 +0,0 @@ -This directory contains network tests which require Internet connection. -Note that these tests are not run as part of the main testsuite and need -to be run seperately (from the main test/ directory): - - ./run-tests net_inet/*.py diff --git a/tests/net_inet 2/test_tls_sites.py b/tests/net_inet 2/test_tls_sites.py deleted file mode 100644 index bf8071d0878a7..0000000000000 --- a/tests/net_inet 2/test_tls_sites.py +++ /dev/null @@ -1,59 +0,0 @@ -try: - import usocket as _socket -except: - import _socket -try: - import ussl as ssl -except: - import ssl - # CPython only supports server_hostname with SSLContext - ssl = ssl.SSLContext() - - -def test_one(site, opts): - ai = _socket.getaddrinfo(site, 443) - addr = ai[0][-1] - - s = _socket.socket() - - try: - s.connect(addr) - - if "sni" in opts: - s = ssl.wrap_socket(s, server_hostname=opts["host"]) - else: - s = ssl.wrap_socket(s) - - s.write(b"GET / HTTP/1.0\r\nHost: %s\r\n\r\n" % bytes(site, 'latin')) - resp = s.read(4096) -# print(resp) - - finally: - s.close() - - -SITES = [ - "google.com", - "www.google.com", - "api.telegram.org", - {"host": "api.pushbullet.com", "sni": True}, -# "w9rybpfril.execute-api.ap-southeast-2.amazonaws.com", - {"host": "w9rybpfril.execute-api.ap-southeast-2.amazonaws.com", "sni": True}, -] - - -def main(): - for site in SITES: - opts = {} - if isinstance(site, dict): - opts = site - site = opts["host"] - - try: - test_one(site, opts) - print(site, "ok") - except Exception as e: - print(site, repr(e)) - - -main() diff --git a/tests/net_inet 2/test_tls_sites.py.exp b/tests/net_inet 2/test_tls_sites.py.exp deleted file mode 100644 index 2f3c113d2f9ac..0000000000000 --- a/tests/net_inet 2/test_tls_sites.py.exp +++ /dev/null @@ -1,5 +0,0 @@ -google.com ok -www.google.com ok -api.telegram.org ok -api.pushbullet.com ok -w9rybpfril.execute-api.ap-southeast-2.amazonaws.com ok diff --git a/tests/run-bench-tests 2 b/tests/run-bench-tests 2 deleted file mode 100755 index f4a6776cbc29a..0000000000000 --- a/tests/run-bench-tests 2 +++ /dev/null @@ -1,97 +0,0 @@ -#! /usr/bin/env python3 - -import os -import subprocess -import sys -import argparse -import re -from glob import glob -from collections import defaultdict - -# Tests require at least CPython 3.3. If your default python3 executable -# is of lower version, you can point MICROPY_CPYTHON3 environment var -# to the correct executable. -if os.name == 'nt': - CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3.exe') - MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../ports/windows/micropython.exe') -else: - CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3') - MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../ports/unix/micropython') - -def run_tests(pyb, test_dict): - test_count = 0 - testcase_count = 0 - - for base_test, tests in sorted(test_dict.items()): - print(base_test + ":") - for test_file in tests: - - # run MicroPython - if pyb is None: - # run on PC - try: - output_mupy = subprocess.check_output([MICROPYTHON, '-X', 'emit=bytecode', test_file[0]]) - except subprocess.CalledProcessError: - output_mupy = b'CRASH' - else: - # run on pyboard - pyb.enter_raw_repl() - try: - output_mupy = pyb.execfile(test_file).replace(b'\r\n', b'\n') - except pyboard.PyboardError: - output_mupy = b'CRASH' - - output_mupy = float(output_mupy.strip()) - test_file[1] = output_mupy - testcase_count += 1 - - test_count += 1 - baseline = None - for t in tests: - if baseline is None: - baseline = t[1] - print(" %.3fs (%+06.2f%%) %s" % (t[1], (t[1] * 100 / baseline) - 100, t[0])) - - print("{} tests performed ({} individual testcases)".format(test_count, testcase_count)) - - # all tests succeeded - return True - -def main(): - cmd_parser = argparse.ArgumentParser(description='Run tests for MicroPython.') - cmd_parser.add_argument('--pyboard', action='store_true', help='run the tests on the pyboard') - cmd_parser.add_argument('files', nargs='*', help='input test files') - args = cmd_parser.parse_args() - - # Note pyboard support is copied over from run-tests, not testes, and likely needs revamping - if args.pyboard: - import pyboard - pyb = pyboard.Pyboard('/dev/ttyACM0') - pyb.enter_raw_repl() - else: - pyb = None - - if len(args.files) == 0: - if pyb is None: - # run PC tests - test_dirs = ('bench',) - else: - # run pyboard tests - test_dirs = ('basics', 'float', 'pyb') - tests = sorted(test_file for test_files in (glob('{}/*.py'.format(dir)) for dir in test_dirs) for test_file in test_files) - else: - # tests explicitly given - tests = sorted(args.files) - - test_dict = defaultdict(lambda: []) - for t in tests: - m = re.match(r"(.+?)-(.+)\.py", t) - if not m: - continue - test_dict[m.group(1)].append([t, None]) - - if not run_tests(pyb, test_dict): - sys.exit(1) - -if __name__ == "__main__": - main() diff --git a/tests/run-tests 2 b/tests/run-tests 2 deleted file mode 100755 index e28600361bcc0..0000000000000 --- a/tests/run-tests 2 +++ /dev/null @@ -1,615 +0,0 @@ -#! /usr/bin/env python3 - -import os -import subprocess -import sys -import platform -import argparse -import re -import threading -import multiprocessing -from multiprocessing.pool import ThreadPool -from glob import glob - -# Tests require at least CPython 3.3. If your default python3 executable -# is of lower version, you can point MICROPY_CPYTHON3 environment var -# to the correct executable. -if os.name == 'nt': - CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3.exe') - MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../ports/windows/micropython.exe') -else: - CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3') - MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../ports/unix/micropython') - -# mpy-cross is only needed if --via-mpy command-line arg is passed -MPYCROSS = os.getenv('MICROPY_MPYCROSS', '../mpy-cross/mpy-cross') - -# Set PYTHONIOENCODING so that CPython will use utf-8 on systems which set another encoding in the locale -os.environ['PYTHONIOENCODING'] = 'utf-8' - -def rm_f(fname): - if os.path.exists(fname): - os.remove(fname) - - -# unescape wanted regex chars and escape unwanted ones -def convert_regex_escapes(line): - cs = [] - escape = False - for c in str(line, 'utf8'): - if escape: - escape = False - cs.append(c) - elif c == '\\': - escape = True - elif c in ('(', ')', '[', ']', '{', '}', '.', '*', '+', '^', '$'): - cs.append('\\' + c) - else: - cs.append(c) - # accept carriage-return(s) before final newline - if cs[-1] == '\n': - cs[-1] = '\r*\n' - return bytes(''.join(cs), 'utf8') - - -def run_micropython(pyb, args, test_file, is_special=False): - special_tests = ( - 'micropython/meminfo.py', 'basics/bytes_compare3.py', - 'basics/builtin_help.py', 'thread/thread_exc2.py', - ) - had_crash = False - if pyb is None: - # run on PC - if test_file.startswith(('cmdline/', 'feature_check/')) or test_file in special_tests: - # special handling for tests of the unix cmdline program - is_special = True - - if is_special: - # check for any cmdline options needed for this test - args = [MICROPYTHON] - with open(test_file, 'rb') as f: - line = f.readline() - if line.startswith(b'# cmdline:'): - # subprocess.check_output on Windows only accepts strings, not bytes - args += [str(c, 'utf-8') for c in line[10:].strip().split()] - - # run the test, possibly with redirected input - try: - if 'repl_' in test_file: - # Need to use a PTY to test command line editing - try: - import pty - except ImportError: - # in case pty module is not available, like on Windows - return b'SKIP\n' - import select - - def get(required=False): - rv = b'' - while True: - ready = select.select([emulator], [], [], 0.02) - if ready[0] == [emulator]: - rv += os.read(emulator, 1024) - else: - if not required or rv: - return rv - - def send_get(what): - os.write(emulator, what) - return get() - - with open(test_file, 'rb') as f: - # instead of: output_mupy = subprocess.check_output(args, stdin=f) - # openpty returns two read/write file descriptors. The first one is - # used by the program which provides the virtual - # terminal service, and the second one is used by the - # subprogram which requires a tty to work. - emulator, subterminal = pty.openpty() - p = subprocess.Popen(args, stdin=subterminal, stdout=subterminal, - stderr=subprocess.STDOUT, bufsize=0) - banner = get(True) - output_mupy = banner + b''.join(send_get(line) for line in f) - send_get(b'\x04') # exit the REPL, so coverage info is saved - p.kill() - os.close(emulator) - os.close(subterminal) - else: - output_mupy = subprocess.check_output(args + [test_file], stderr=subprocess.STDOUT) - except subprocess.CalledProcessError: - return b'CRASH' - - else: - # a standard test run on PC - - # create system command - cmdlist = [MICROPYTHON, '-X', 'emit=' + args.emit] - if args.heapsize is not None: - cmdlist.extend(['-X', 'heapsize=' + args.heapsize]) - - # if running via .mpy, first compile the .py file - if args.via_mpy: - subprocess.check_output([MPYCROSS, '-mcache-lookup-bc', '-o', 'mpytest.mpy', test_file]) - cmdlist.extend(['-m', 'mpytest']) - else: - cmdlist.append(test_file) - - # run the actual test - e = {"MICROPYPATH": os.getcwd() + ":", "LANG": "en_US.UTF-8"} - p = subprocess.Popen(cmdlist, env=e, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - output_mupy = b'' - while p.poll() is None: - output_mupy += p.stdout.read() - output_mupy += p.stdout.read() - if p.returncode != 0: - output_mupy = b'CRASH' - - # clean up if we had an intermediate .mpy file - if args.via_mpy: - rm_f('mpytest.mpy') - - else: - # run on pyboard - import pyboard - pyb.enter_raw_repl() - try: - output_mupy = pyb.execfile(test_file) - except pyboard.PyboardError: - had_crash = True - output_mupy = b'CRASH' - - # canonical form for all ports/platforms is to use \n for end-of-line - output_mupy = output_mupy.replace(b'\r\n', b'\n') - - # don't try to convert the output if we should skip this test - if had_crash or output_mupy in (b'SKIP\n', b'CRASH'): - return output_mupy - - if is_special or test_file in special_tests: - # convert parts of the output that are not stable across runs - with open(test_file + '.exp', 'rb') as f: - lines_exp = [] - for line in f.readlines(): - if line == b'########\n': - line = (line,) - else: - line = (line, re.compile(convert_regex_escapes(line))) - lines_exp.append(line) - lines_mupy = [line + b'\n' for line in output_mupy.split(b'\n')] - if output_mupy.endswith(b'\n'): - lines_mupy = lines_mupy[:-1] # remove erroneous last empty line - i_mupy = 0 - for i in range(len(lines_exp)): - if lines_exp[i][0] == b'########\n': - # 8x #'s means match 0 or more whole lines - line_exp = lines_exp[i + 1] - skip = 0 - while i_mupy + skip < len(lines_mupy) and not line_exp[1].match(lines_mupy[i_mupy + skip]): - skip += 1 - if i_mupy + skip >= len(lines_mupy): - lines_mupy[i_mupy] = b'######## FAIL\n' - break - del lines_mupy[i_mupy:i_mupy + skip] - lines_mupy.insert(i_mupy, b'########\n') - i_mupy += 1 - else: - # a regex - if lines_exp[i][1].match(lines_mupy[i_mupy]): - lines_mupy[i_mupy] = lines_exp[i][0] - else: - #print("don't match: %r %s" % (lines_exp[i][1], lines_mupy[i_mupy])) # DEBUG - pass - i_mupy += 1 - if i_mupy >= len(lines_mupy): - break - output_mupy = b''.join(lines_mupy) - - return output_mupy - - -def run_feature_check(pyb, args, base_path, test_file): - return run_micropython(pyb, args, base_path + "/feature_check/" + test_file, is_special=True) - -class ThreadSafeCounter: - def __init__(self, start=0): - self._value = start - self._lock = threading.Lock() - - def add(self, to_add): - with self._lock: self._value += to_add - - def append(self, arg): - self.add([arg]) - - @property - def value(self): - return self._value - -def run_tests(pyb, tests, args, base_path=".", num_threads=1): - test_count = ThreadSafeCounter() - testcase_count = ThreadSafeCounter() - passed_count = ThreadSafeCounter() - failed_tests = ThreadSafeCounter([]) - skipped_tests = ThreadSafeCounter([]) - - skip_tests = set() - skip_native = False - skip_int_big = False - skip_set_type = False - skip_async = False - skip_const = False - skip_revops = False - skip_endian = False - has_complex = True - has_coverage = False - - upy_float_precision = 32 - - # If we're asked to --list-tests, we can't assume that there's a - # connection to target, so we can't run feature checks usefully. - if not (args.list_tests or args.write_exp): - # Check if micropython.native is supported, and skip such tests if it's not - output = run_feature_check(pyb, args, base_path, 'native_check.py') - if output == b'CRASH': - skip_native = True - - # Check if arbitrary-precision integers are supported, and skip such tests if it's not - output = run_feature_check(pyb, args, base_path, 'int_big.py') - if output != b'1000000000000000000000000000000000000000000000\n': - skip_int_big = True - - # Check if set type (and set literals) is supported, and skip such tests if it's not - output = run_feature_check(pyb, args, base_path, 'set_check.py') - if output == b'CRASH': - skip_set_type = True - - # Check if async/await keywords are supported, and skip such tests if it's not - output = run_feature_check(pyb, args, base_path, 'async_check.py') - if output == b'CRASH': - skip_async = True - - # Check if const keyword (MicroPython extension) is supported, and skip such tests if it's not - output = run_feature_check(pyb, args, base_path, 'const.py') - if output == b'CRASH': - skip_const = True - - # Check if __rOP__ special methods are supported, and skip such tests if it's not - output = run_feature_check(pyb, args, base_path, 'reverse_ops.py') - if output == b'TypeError\n': - skip_revops = True - - # Check if emacs repl is supported, and skip such tests if it's not - t = run_feature_check(pyb, args, base_path, 'repl_emacs_check.py') - if not 'True' in str(t, 'ascii'): - skip_tests.add('cmdline/repl_emacs_keys.py') - - upy_byteorder = run_feature_check(pyb, args, base_path, 'byteorder.py') - upy_float_precision = int(run_feature_check(pyb, args, base_path, 'float.py')) - has_complex = run_feature_check(pyb, args, base_path, 'complex.py') == b'complex\n' - has_coverage = run_feature_check(pyb, args, base_path, 'coverage.py') == b'coverage\n' - cpy_byteorder = subprocess.check_output([CPYTHON3, base_path + '/feature_check/byteorder.py']) - skip_endian = (upy_byteorder != cpy_byteorder) - - # Some tests shouldn't be run under Travis CI - if os.getenv('TRAVIS') == 'true': - skip_tests.add('basics/memoryerror.py') - skip_tests.add('thread/thread_gc1.py') # has reliability issues - skip_tests.add('thread/thread_lock4.py') # has reliability issues - skip_tests.add('thread/stress_heap.py') # has reliability issues - skip_tests.add('thread/stress_recurse.py') # has reliability issues - - if upy_float_precision == 0: - skip_tests.add('extmod/ujson_dumps_float.py') - skip_tests.add('extmod/ujson_loads_float.py') - skip_tests.add('misc/rge_sm.py') - if upy_float_precision < 32: - skip_tests.add('float/float2int_intbig.py') # requires fp32, there's float2int_fp30_intbig.py instead - skip_tests.add('float/string_format.py') # requires fp32, there's string_format_fp30.py instead - skip_tests.add('float/bytes_construct.py') # requires fp32 - skip_tests.add('float/bytearray_construct.py') # requires fp32 - if upy_float_precision < 64: - skip_tests.add('float/float_divmod.py') # tested by float/float_divmod_relaxed.py instead - skip_tests.add('float/float2int_doubleprec_intbig.py') - skip_tests.add('float/float_parse_doubleprec.py') - - if not has_complex: - skip_tests.add('float/complex1.py') - skip_tests.add('float/complex1_intbig.py') - skip_tests.add('float/int_big_float.py') - skip_tests.add('float/true_value.py') - skip_tests.add('float/types.py') - - if not has_coverage: - skip_tests.add('cmdline/cmd_parsetree.py') - - # Some tests shouldn't be run on a PC - if args.target == 'unix': - # unix build does not have the GIL so can't run thread mutation tests - for t in tests: - if t.startswith('thread/mutate_'): - skip_tests.add(t) - - # Some tests shouldn't be run on pyboard - if args.target != 'unix': - skip_tests.add('basics/exception_chain.py') # warning is not printed - skip_tests.add('micropython/meminfo.py') # output is very different to PC output - skip_tests.add('extmod/machine_mem.py') # raw memory access not supported - - if args.target == 'wipy': - skip_tests.add('misc/print_exception.py') # requires error reporting full - skip_tests.update({'extmod/uctypes_%s.py' % t for t in 'bytearray le native_le ptr_le ptr_native_le sizeof sizeof_native array_assign_le array_assign_native_le'.split()}) # requires uctypes - skip_tests.add('extmod/zlibd_decompress.py') # requires zlib - skip_tests.add('extmod/uheapq1.py') # uheapq not supported by WiPy - skip_tests.add('extmod/urandom_basic.py') # requires urandom - skip_tests.add('extmod/urandom_extra.py') # requires urandom - elif args.target == 'esp8266': - skip_tests.add('misc/rge_sm.py') # too large - elif args.target == 'minimal': - skip_tests.add('basics/class_inplace_op.py') # all special methods not supported - skip_tests.add('basics/subclass_native_init.py')# native subclassing corner cases not support - skip_tests.add('misc/rge_sm.py') # too large - skip_tests.add('micropython/opt_level.py') # don't assume line numbers are stored - - # Some tests are known to fail on 64-bit machines - if pyb is None and platform.architecture()[0] == '64bit': - pass - - # Some tests use unsupported features on Windows - if os.name == 'nt': - skip_tests.add('import/import_file.py') # works but CPython prints forward slashes - - # Some tests are known to fail with native emitter - # Remove them from the below when they work - if args.emit == 'native': - skip_tests.update({'basics/%s.py' % t for t in 'gen_yield_from gen_yield_from_close gen_yield_from_ducktype gen_yield_from_exc gen_yield_from_executing gen_yield_from_iter gen_yield_from_send gen_yield_from_stopped gen_yield_from_throw gen_yield_from_throw2 gen_yield_from_throw3 generator1 generator2 generator_args generator_close generator_closure generator_exc generator_pend_throw generator_return generator_send'.split()}) # require yield - skip_tests.update({'basics/%s.py' % t for t in 'bytes_gen class_store_class globals_del string_join gen_stack_overflow'.split()}) # require yield - skip_tests.update({'basics/async_%s.py' % t for t in 'def await await2 for for2 with with2 coroutine'.split()}) # require yield - skip_tests.update({'basics/%s.py' % t for t in 'try_reraise try_reraise2'.split()}) # require raise_varargs - skip_tests.update({'basics/%s.py' % t for t in 'with_break with_continue with_return'.split()}) # require complete with support - skip_tests.add('basics/array_construct2.py') # requires generators - skip_tests.add('basics/bool1.py') # seems to randomly fail - skip_tests.add('basics/builtin_hash_gen.py') # requires yield - skip_tests.add('basics/class_bind_self.py') # requires yield - skip_tests.add('basics/del_deref.py') # requires checking for unbound local - skip_tests.add('basics/del_local.py') # requires checking for unbound local - skip_tests.add('basics/exception_chain.py') # raise from is not supported - skip_tests.add('basics/for_range.py') # requires yield_value - skip_tests.add('basics/try_finally_loops.py') # requires proper try finally code - skip_tests.add('basics/try_finally_return.py') # requires proper try finally code - skip_tests.add('basics/try_finally_return2.py') # requires proper try finally code - skip_tests.add('basics/unboundlocal.py') # requires checking for unbound local - skip_tests.add('import/gen_context.py') # requires yield_value - skip_tests.add('misc/features.py') # requires raise_varargs - skip_tests.add('misc/rge_sm.py') # requires yield - skip_tests.add('misc/print_exception.py') # because native doesn't have proper traceback info - skip_tests.add('misc/sys_exc_info.py') # sys.exc_info() is not supported for native - skip_tests.add('micropython/emg_exc.py') # because native doesn't have proper traceback info - skip_tests.add('micropython/heapalloc_traceback.py') # because native doesn't have proper traceback info - skip_tests.add('micropython/heapalloc_iter.py') # requires generators - skip_tests.add('micropython/schedule.py') # native code doesn't check pending events - skip_tests.add('stress/gc_trace.py') # requires yield - skip_tests.add('stress/recursive_gen.py') # requires yield - skip_tests.add('extmod/vfs_userfs.py') # because native doesn't properly handle globals across different modules - skip_tests.add('../extmod/ulab/tests/argminmax.py') # requires yield - - def run_one_test(test_file): - test_file = test_file.replace('\\', '/') - - if args.filters: - # Default verdict is the opposit of the first action - verdict = "include" if args.filters[0][0] == "exclude" else "exclude" - for action, pat in args.filters: - if pat.search(test_file): - verdict = action - if verdict == "exclude": - return - - test_basename = os.path.basename(test_file) - test_name = os.path.splitext(test_basename)[0] - is_native = test_name.startswith("native_") or test_name.startswith("viper_") - is_endian = test_name.endswith("_endian") - is_int_big = test_name.startswith("int_big") or test_name.endswith("_intbig") - is_set_type = test_name.startswith("set_") or test_name.startswith("frozenset") - is_async = test_name.startswith("async_") - is_const = test_name.startswith("const") - - skip_it = test_file in skip_tests - skip_it |= skip_native and is_native - skip_it |= skip_endian and is_endian - skip_it |= skip_int_big and is_int_big - skip_it |= skip_set_type and is_set_type - skip_it |= skip_async and is_async - skip_it |= skip_const and is_const - skip_it |= skip_revops and test_name.startswith("class_reverse_op") - - if args.list_tests: - if not skip_it: - print(test_file) - return - - if skip_it: - print("skip ", test_file) - skipped_tests.append(test_name) - return - - # get expected output - test_file_expected = test_file + '.exp' - if os.path.isfile(test_file_expected): - # expected output given by a file, so read that in - with open(test_file_expected, 'rb') as f: - output_expected = f.read() - else: - # run CPython to work out expected output - e = {"PYTHONPATH": os.getcwd(), - "PATH": os.environ["PATH"], - "LANG": "en_US.UTF-8"} - p = subprocess.Popen([CPYTHON3, '-B', test_file], env=e, stdout=subprocess.PIPE) - output_expected = b'' - while p.poll() is None: - output_expected += p.stdout.read() - output_expected += p.stdout.read() - if p.returncode != 0: - output_expected = b'CPYTHON3 CRASH' - elif args.write_exp: - with open(test_file_expected, 'wb') as f: - f.write(output_expected) - - # canonical form for all host platforms is to use \n for end-of-line - output_expected = output_expected.replace(b'\r\n', b'\n') - - if args.write_exp: - return - - # run MicroPython - output_mupy = run_micropython(pyb, args, test_file) - - if output_mupy == b'SKIP\n': - print("skip ", test_file) - skipped_tests.append(test_name) - return - - testcase_count.add(len(output_expected.splitlines())) - - filename_expected = test_basename + ".exp" - filename_mupy = test_basename + ".out" - - if output_expected == output_mupy: - print("pass ", test_file) - passed_count.add(1) - rm_f(filename_expected) - rm_f(filename_mupy) - else: - with open(filename_expected, "wb") as f: - f.write(output_expected) - with open(filename_mupy, "wb") as f: - f.write(output_mupy) - print("### Expected") - print(output_expected) - print("### Actual") - print(output_mupy) - print("FAIL ", test_file) - failed_tests.append(test_name) - - test_count.add(1) - - if args.list_tests: - return True - - if num_threads > 1: - pool = ThreadPool(num_threads) - pool.map(run_one_test, tests) - else: - for test in tests: - run_one_test(test) - - print("{} tests performed ({} individual testcases)".format(test_count.value, testcase_count.value)) - print("{} tests passed".format(passed_count.value)) - - if len(skipped_tests.value) > 0: - print("{} tests skipped: {}".format(len(skipped_tests.value), ' '.join(sorted(skipped_tests.value)))) - if len(failed_tests.value) > 0: - print("{} tests failed: {}".format(len(failed_tests.value), ' '.join(sorted(failed_tests.value)))) - return False - - # all tests succeeded - return True - - -class append_filter(argparse.Action): - - def __init__(self, option_strings, dest, **kwargs): - super().__init__(option_strings, dest, default=[], **kwargs) - - def __call__(self, parser, args, value, option): - if not hasattr(args, self.dest): - args.filters = [] - if option.startswith(("-e", "--e")): - option = "exclude" - else: - option = "include" - args.filters.append((option, re.compile(value))) - - -def main(): - cmd_parser = argparse.ArgumentParser( - formatter_class=argparse.RawDescriptionHelpFormatter, - description='Run and manage tests for MicroPython.', - epilog='''\ -Options -i and -e can be multiple and processed in the order given. Regex -"search" (vs "match") operation is used. An action (include/exclude) of -the last matching regex is used: - run-tests -i async - exclude all, then include tests containg "async" anywhere - run-tests -e '/big.+int' - include all, then exclude by regex - run-tests -e async -i async_foo - include all, exclude async, yet still include async_foo -''') - cmd_parser.add_argument('--target', default='unix', help='the target platform') - cmd_parser.add_argument('--device', default='/dev/ttyACM0', help='the serial device or the IP address of the pyboard') - cmd_parser.add_argument('-b', '--baudrate', default=115200, help='the baud rate of the serial device') - cmd_parser.add_argument('-u', '--user', default='micro', help='the telnet login username') - cmd_parser.add_argument('-p', '--password', default='python', help='the telnet login password') - cmd_parser.add_argument('-d', '--test-dirs', nargs='*', help='input test directories (if no files given)') - cmd_parser.add_argument('-e', '--exclude', action=append_filter, metavar='REGEX', dest='filters', help='exclude test by regex on path/name.py') - cmd_parser.add_argument('-i', '--include', action=append_filter, metavar='REGEX', dest='filters', help='include test by regex on path/name.py') - cmd_parser.add_argument('--write-exp', action='store_true', help='save .exp files to run tests w/o CPython') - cmd_parser.add_argument('--list-tests', action='store_true', help='list tests instead of running them') - cmd_parser.add_argument('--emit', default='bytecode', help='MicroPython emitter to use (bytecode or native)') - cmd_parser.add_argument('--heapsize', help='heapsize to use (use default if not specified)') - cmd_parser.add_argument('--via-mpy', action='store_true', help='compile .py files to .mpy first') - cmd_parser.add_argument('--keep-path', action='store_true', help='do not clear MICROPYPATH when running tests') - cmd_parser.add_argument('-j', '--jobs', default=1, metavar='N', type=int, help='Number of tests to run simultaneously') - cmd_parser.add_argument('--auto-jobs', action='store_const', dest='jobs', const=multiprocessing.cpu_count(), help='Set the -j values to the CPU (thread) count') - cmd_parser.add_argument('files', nargs='*', help='input test files') - args = cmd_parser.parse_args() - - EXTERNAL_TARGETS = ('pyboard', 'wipy', 'esp8266', 'esp32', 'minimal') - if args.target == 'unix' or args.list_tests: - pyb = None - elif args.target in EXTERNAL_TARGETS: - import pyboard - pyb = pyboard.Pyboard(args.device, args.baudrate, args.user, args.password) - pyb.enter_raw_repl() - else: - raise ValueError('target must be either %s or unix' % ", ".join(EXTERNAL_TARGETS)) - - if len(args.files) == 0: - if args.test_dirs is None: - if args.target == 'pyboard': - # run pyboard tests - test_dirs = ('basics', 'micropython', 'float', 'misc', 'stress', 'extmod', 'pyb', 'pybnative', 'inlineasm') - elif args.target in ('esp8266', 'esp32', 'minimal'): - test_dirs = ('basics', 'micropython', 'float', 'misc', 'extmod') - elif args.target == 'wipy': - # run WiPy tests - test_dirs = ('basics', 'micropython', 'misc', 'extmod', 'wipy') - else: - # run PC tests - test_dirs = ( - 'basics', 'micropython', 'float', 'import', 'io', 'misc', - 'stress', 'unicode', 'extmod', '../extmod/ulab/tests', 'unix', 'cmdline', - ) - else: - # run tests from these directories - test_dirs = args.test_dirs - tests = sorted(test_file for test_files in (glob('{}/*.py'.format(dir)) for dir in test_dirs) for test_file in test_files) - else: - # tests explicitly given - tests = args.files - - if not args.keep_path: - # clear search path to make sure tests use only builtin modules - os.environ['MICROPYPATH'] = '' - - # Even if we run completely different tests in a different directory, - # we need to access feature_check's from the same directory as the - # run-tests script itself. - base_path = os.path.dirname(sys.argv[0]) or "." - try: - res = run_tests(pyb, tests, args, base_path, args.jobs) - finally: - if pyb: - pyb.close() - - if not res: - sys.exit(1) - -if __name__ == "__main__": - main() diff --git a/tests/stress 2/dict_copy.py b/tests/stress 2/dict_copy.py deleted file mode 100644 index 36db9bb7e89d0..0000000000000 --- a/tests/stress 2/dict_copy.py +++ /dev/null @@ -1,7 +0,0 @@ -# copying a large dictionary - -a = {i:2*i for i in range(1000)} -b = a.copy() -for i in range(1000): - print(i, b[i]) -print(len(b)) diff --git a/tests/stress 2/dict_create.py b/tests/stress 2/dict_create.py deleted file mode 100644 index e9db40a8e6c5b..0000000000000 --- a/tests/stress 2/dict_create.py +++ /dev/null @@ -1,8 +0,0 @@ -# create a large dictionary - -d = {} -x = 1 -while x < 1000: - d[x] = x - x += 1 -print(d[500]) diff --git a/tests/stress 2/dict_create_max.py b/tests/stress 2/dict_create_max.py deleted file mode 100644 index 3c75db20da0c0..0000000000000 --- a/tests/stress 2/dict_create_max.py +++ /dev/null @@ -1,13 +0,0 @@ -# The aim with this test is to hit the maximum resize/rehash size of a dict, -# where there are no more primes in the table of growing allocation sizes. -# This value is 54907 items. - -d = {} -try: - for i in range(54908): - d[i] = i -except MemoryError: - pass - -# Just check the dict still has the first value -print(d[0]) diff --git a/tests/stress 2/gc_trace.py b/tests/stress 2/gc_trace.py deleted file mode 100644 index 72dc7b62769d7..0000000000000 --- a/tests/stress 2/gc_trace.py +++ /dev/null @@ -1,17 +0,0 @@ -# test that the GC can trace nested objects - -try: - import gc -except ImportError: - print("SKIP") - raise SystemExit - -# test a big shallow object pointing to many unique objects -lst = [[i] for i in range(200)] -gc.collect() -print(lst) - -# test a deep object -lst = [[[[[(i, j, k, l)] for i in range(3)] for j in range(3)] for k in range(3)] for l in range(3)] -gc.collect() -print(lst) diff --git a/tests/stress 2/list_sort.py b/tests/stress 2/list_sort.py deleted file mode 100644 index 3a7701a1e4cc0..0000000000000 --- a/tests/stress 2/list_sort.py +++ /dev/null @@ -1,6 +0,0 @@ -# test large list sorting (should not stack overflow) -l = list(range(2000)) -l.sort() -print(l[0], l[-1]) -l.sort(reverse=True) -print(l[0], l[-1]) diff --git a/tests/stress 2/recursion.py b/tests/stress 2/recursion.py deleted file mode 100644 index 227f48396ad47..0000000000000 --- a/tests/stress 2/recursion.py +++ /dev/null @@ -1,7 +0,0 @@ -def foo(): - foo() - -try: - foo() -except RuntimeError: - print("RuntimeError") diff --git a/tests/stress 2/recursive_data.py b/tests/stress 2/recursive_data.py deleted file mode 100644 index 3b7fa50952584..0000000000000 --- a/tests/stress 2/recursive_data.py +++ /dev/null @@ -1,13 +0,0 @@ -# This tests that printing recursive data structure doesn't lead to segfault. -try: - import uio as io -except ImportError: - print("SKIP") - raise SystemExit - -l = [1, 2, 3, None] -l[-1] = l -try: - print(l, file=io.StringIO()) -except RuntimeError: - print("RuntimeError") diff --git a/tests/stress 2/recursive_data.py.exp b/tests/stress 2/recursive_data.py.exp deleted file mode 100644 index 8a2b9bfdda511..0000000000000 --- a/tests/stress 2/recursive_data.py.exp +++ /dev/null @@ -1 +0,0 @@ -RuntimeError diff --git a/tests/stress 2/recursive_gen.py b/tests/stress 2/recursive_gen.py deleted file mode 100644 index 0e0d3914ee9d5..0000000000000 --- a/tests/stress 2/recursive_gen.py +++ /dev/null @@ -1,18 +0,0 @@ -# test deeply recursive generators - -# simple "yield from" recursion -def gen(): - yield from gen() -try: - list(gen()) -except RuntimeError: - print('RuntimeError') - -# recursion via an iterator over a generator -def gen2(): - for x in gen2(): - yield x -try: - next(gen2()) -except RuntimeError: - print('RuntimeError') diff --git a/tests/stress 2/recursive_iternext.py b/tests/stress 2/recursive_iternext.py deleted file mode 100644 index edb5a843f29dc..0000000000000 --- a/tests/stress 2/recursive_iternext.py +++ /dev/null @@ -1,57 +0,0 @@ -# This tests that recursion with iternext doesn't lead to segfault. -try: - enumerate - filter - map - max - zip -except: - print("SKIP") - raise SystemExit - -# We need to pick an N that is large enough to hit the recursion -# limit, but not too large that we run out of heap memory. -try: - # large stack/heap, eg unix - [0] * 80000 - N = 2400 -except: - try: - # medium, eg pyboard - [0] * 10000 - N = 1000 - except: - # small, eg esp8266 - N = 100 - -try: - x = (1, 2) - for i in range(N): - x = enumerate(x) - tuple(x) -except RuntimeError: - print("RuntimeError") - -try: - x = (1, 2) - for i in range(N): - x = filter(None, x) - tuple(x) -except RuntimeError: - print("RuntimeError") - -try: - x = (1, 2) - for i in range(N): - x = map(max, x, ()) - tuple(x) -except RuntimeError: - print("RuntimeError") - -try: - x = (1, 2) - for i in range(N): - x = zip(x) - tuple(x) -except RuntimeError: - print("RuntimeError") diff --git a/tests/stress 2/recursive_iternext.py.exp b/tests/stress 2/recursive_iternext.py.exp deleted file mode 100644 index 80d1488a3795f..0000000000000 --- a/tests/stress 2/recursive_iternext.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -RuntimeError -RuntimeError -RuntimeError -RuntimeError diff --git a/tests/thread 2/mutate_bytearray.py b/tests/thread 2/mutate_bytearray.py deleted file mode 100644 index 5015c3f9cfaca..0000000000000 --- a/tests/thread 2/mutate_bytearray.py +++ /dev/null @@ -1,46 +0,0 @@ -# test concurrent mutating access to a shared bytearray object -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -# the shared bytearray -ba = bytearray() - -# main thread function -def th(n, lo, hi): - for repeat in range(n): - for i in range(lo, hi): - l = len(ba) - ba.append(i) - assert len(ba) >= l + 1 - - l = len(ba) - ba.extend(bytearray([i])) - assert len(ba) >= l + 1 - - with lock: - global n_finished - n_finished += 1 - -lock = _thread.allocate_lock() -n_thread = 4 -n_finished = 0 -n_repeat = 4 # use 40 for more stressful test (uses more heap) - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(th, (n_repeat, i * 256 // n_thread, (i + 1) * 256 // n_thread)) - -# busy wait for threads to finish -while n_finished < n_thread: - pass - -# check bytearray has correct contents -print(len(ba)) -count = [0 for _ in range(256)] -for b in ba: - count[b] += 1 -print(count) diff --git a/tests/thread 2/mutate_dict.py b/tests/thread 2/mutate_dict.py deleted file mode 100644 index 563fce39debb0..0000000000000 --- a/tests/thread 2/mutate_dict.py +++ /dev/null @@ -1,44 +0,0 @@ -# test concurrent mutating access to a shared dict object -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -# the shared dict -di = {'a':'A', 'b':'B', 'c':'C', 'd':'D'} - -# main thread function -def th(n, lo, hi): - for repeat in range(n): - for i in range(lo, hi): - di[i] = repeat + i - assert di[i] == repeat + i - - del di[i] - assert i not in di - - di[i] = repeat + i - assert di[i] == repeat + i - - assert di.pop(i) == repeat + i - - with lock: - global n_finished - n_finished += 1 - -lock = _thread.allocate_lock() -n_thread = 4 -n_finished = 0 - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(th, (30, i * 300, (i + 1) * 300)) - -# busy wait for threads to finish -while n_finished < n_thread: - pass - -# check dict has correct contents -print(sorted(di.items())) diff --git a/tests/thread 2/mutate_instance.py b/tests/thread 2/mutate_instance.py deleted file mode 100644 index 2ecfbe1092811..0000000000000 --- a/tests/thread 2/mutate_instance.py +++ /dev/null @@ -1,45 +0,0 @@ -# test concurrent mutating access to a shared user instance -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -# the shared user class and instance -class User: - def __init__(self): - self.a = 'A' - self.b = 'B' - self.c = 'C' -user = User() - -# main thread function -def th(n, lo, hi): - for repeat in range(n): - for i in range(lo, hi): - setattr(user, 'attr_%u' % i, repeat + i) - assert getattr(user, 'attr_%u' % i) == repeat + i - - with lock: - global n_finished - n_finished += 1 - -lock = _thread.allocate_lock() -n_repeat = 30 -n_range = 50 # 300 for stressful test (uses more heap) -n_thread = 4 -n_finished = 0 - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(th, (n_repeat, i * n_range, (i + 1) * n_range)) - -# busy wait for threads to finish -while n_finished < n_thread: - pass - -# check user instance has correct contents -print(user.a, user.b, user.c) -for i in range(n_thread * n_range): - assert getattr(user, 'attr_%u' % i) == n_repeat - 1 + i diff --git a/tests/thread 2/mutate_list.py b/tests/thread 2/mutate_list.py deleted file mode 100644 index d70e8a8a388c7..0000000000000 --- a/tests/thread 2/mutate_list.py +++ /dev/null @@ -1,46 +0,0 @@ -# test concurrent mutating access to a shared list object -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -# the shared list -li = list() - -# main thread function -def th(n, lo, hi): - for repeat in range(n): - for i in range(lo, hi): - li.append(i) - assert li.count(i) == repeat + 1 - - li.extend([i, i]) - assert li.count(i) == repeat + 3 - - li.remove(i) - assert li.count(i) == repeat + 2 - - li.remove(i) - assert li.count(i) == repeat + 1 - - with lock: - global n_finished - n_finished += 1 - -lock = _thread.allocate_lock() -n_thread = 4 -n_finished = 0 - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(th, (4, i * 60, (i + 1) * 60)) - -# busy wait for threads to finish -while n_finished < n_thread: - pass - -# check list has correct contents -li.sort() -print(li) diff --git a/tests/thread 2/mutate_set.py b/tests/thread 2/mutate_set.py deleted file mode 100644 index c4529f3562d20..0000000000000 --- a/tests/thread 2/mutate_set.py +++ /dev/null @@ -1,39 +0,0 @@ -# test concurrent mutating access to a shared set object -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -# the shared set -se = set([-1, -2, -3, -4]) - -# main thread function -def th(n, lo, hi): - for repeat in range(n): - for i in range(lo, hi): - se.add(i) - assert i in se - - se.remove(i) - assert i not in se - - with lock: - global n_finished - n_finished += 1 - -lock = _thread.allocate_lock() -n_thread = 4 -n_finished = 0 - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(th, (50, i * 500, (i + 1) * 500)) - -# busy wait for threads to finish -while n_finished < n_thread: - pass - -# check set has correct contents -print(sorted(se)) diff --git a/tests/thread 2/stress_aes.py b/tests/thread 2/stress_aes.py deleted file mode 100644 index ebf7af371b1cf..0000000000000 --- a/tests/thread 2/stress_aes.py +++ /dev/null @@ -1,257 +0,0 @@ -# Stress test for threads using AES encryption routines. -# -# AES was chosen because it is integer based and inplace so doesn't use the -# heap. It is therefore a good test of raw performance and correctness of the -# VM/runtime. It can be used to measure threading performance (concurrency is -# in principle possible) and correctness (it's non trivial for the encryption/ -# decryption to give the correct answer). -# -# The AES code comes first (code originates from a C version authored by D.P.George) -# and then the test harness at the bottom. It can be tuned to be more/less -# aggressive by changing the amount of data to encrypt, the number of loops and -# the number of threads. -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -################################################################## -# discrete arithmetic routines, mostly from a precomputed table - -# non-linear, invertible, substitution box -aes_s_box_table = bytes(( - 0x63,0x7c,0x77,0x7b,0xf2,0x6b,0x6f,0xc5,0x30,0x01,0x67,0x2b,0xfe,0xd7,0xab,0x76, - 0xca,0x82,0xc9,0x7d,0xfa,0x59,0x47,0xf0,0xad,0xd4,0xa2,0xaf,0x9c,0xa4,0x72,0xc0, - 0xb7,0xfd,0x93,0x26,0x36,0x3f,0xf7,0xcc,0x34,0xa5,0xe5,0xf1,0x71,0xd8,0x31,0x15, - 0x04,0xc7,0x23,0xc3,0x18,0x96,0x05,0x9a,0x07,0x12,0x80,0xe2,0xeb,0x27,0xb2,0x75, - 0x09,0x83,0x2c,0x1a,0x1b,0x6e,0x5a,0xa0,0x52,0x3b,0xd6,0xb3,0x29,0xe3,0x2f,0x84, - 0x53,0xd1,0x00,0xed,0x20,0xfc,0xb1,0x5b,0x6a,0xcb,0xbe,0x39,0x4a,0x4c,0x58,0xcf, - 0xd0,0xef,0xaa,0xfb,0x43,0x4d,0x33,0x85,0x45,0xf9,0x02,0x7f,0x50,0x3c,0x9f,0xa8, - 0x51,0xa3,0x40,0x8f,0x92,0x9d,0x38,0xf5,0xbc,0xb6,0xda,0x21,0x10,0xff,0xf3,0xd2, - 0xcd,0x0c,0x13,0xec,0x5f,0x97,0x44,0x17,0xc4,0xa7,0x7e,0x3d,0x64,0x5d,0x19,0x73, - 0x60,0x81,0x4f,0xdc,0x22,0x2a,0x90,0x88,0x46,0xee,0xb8,0x14,0xde,0x5e,0x0b,0xdb, - 0xe0,0x32,0x3a,0x0a,0x49,0x06,0x24,0x5c,0xc2,0xd3,0xac,0x62,0x91,0x95,0xe4,0x79, - 0xe7,0xc8,0x37,0x6d,0x8d,0xd5,0x4e,0xa9,0x6c,0x56,0xf4,0xea,0x65,0x7a,0xae,0x08, - 0xba,0x78,0x25,0x2e,0x1c,0xa6,0xb4,0xc6,0xe8,0xdd,0x74,0x1f,0x4b,0xbd,0x8b,0x8a, - 0x70,0x3e,0xb5,0x66,0x48,0x03,0xf6,0x0e,0x61,0x35,0x57,0xb9,0x86,0xc1,0x1d,0x9e, - 0xe1,0xf8,0x98,0x11,0x69,0xd9,0x8e,0x94,0x9b,0x1e,0x87,0xe9,0xce,0x55,0x28,0xdf, - 0x8c,0xa1,0x89,0x0d,0xbf,0xe6,0x42,0x68,0x41,0x99,0x2d,0x0f,0xb0,0x54,0xbb,0x16, -)) - -# multiplication of polynomials modulo x^8 + x^4 + x^3 + x + 1 = 0x11b -def aes_gf8_mul_2(x): - if x & 0x80: - return (x << 1) ^ 0x11b - else: - return x << 1 - -def aes_gf8_mul_3(x): - return x ^ aes_gf8_mul_2(x) - -# non-linear, invertible, substitution box -def aes_s_box(a): - return aes_s_box_table[a & 0xff] - -# return 0x02^(a-1) in GF(2^8) -def aes_r_con(a): - ans = 1 - while a > 1: - ans <<= 1; - if ans & 0x100: - ans ^= 0x11b - a -= 1 - return ans - -################################################################## -# basic AES algorithm; see FIPS-197 -# -# Think of it as a pseudo random number generator, with each -# symbol in the sequence being a 16 byte block (the state). The -# key is a parameter of the algorithm and tells which particular -# sequence of random symbols you want. The initial vector, IV, -# sets the start of the sequence. The idea of a strong cipher -# is that it's very difficult to guess the key even if you know -# a large part of the sequence. The basic AES algorithm simply -# provides such a sequence. En/de-cryption is implemented here -# using OCB, where the sequence is xored against the plaintext. -# Care must be taken to (almost) always choose a different IV. - -# all inputs must be size 16 -def aes_add_round_key(state, w): - for i in range(16): - state[i] ^= w[i] - -# combined sub_bytes, shift_rows, mix_columns, add_round_key -# all inputs must be size 16 -def aes_sb_sr_mc_ark(state, w, w_idx, temp): - temp_idx = 0 - for i in range(4): - x0 = aes_s_box_table[state[i * 4]] - x1 = aes_s_box_table[state[1 + ((i + 1) & 3) * 4]] - x2 = aes_s_box_table[state[2 + ((i + 2) & 3) * 4]] - x3 = aes_s_box_table[state[3 + ((i + 3) & 3) * 4]] - temp[temp_idx] = aes_gf8_mul_2(x0) ^ aes_gf8_mul_3(x1) ^ x2 ^ x3 ^ w[w_idx] - temp[temp_idx + 1] = x0 ^ aes_gf8_mul_2(x1) ^ aes_gf8_mul_3(x2) ^ x3 ^ w[w_idx + 1] - temp[temp_idx + 2] = x0 ^ x1 ^ aes_gf8_mul_2(x2) ^ aes_gf8_mul_3(x3) ^ w[w_idx + 2] - temp[temp_idx + 3] = aes_gf8_mul_3(x0) ^ x1 ^ x2 ^ aes_gf8_mul_2(x3) ^ w[w_idx + 3] - w_idx += 4 - temp_idx += 4 - for i in range(16): - state[i] = temp[i] - -# combined sub_bytes, shift_rows, add_round_key -# all inputs must be size 16 -def aes_sb_sr_ark(state, w, w_idx, temp): - temp_idx = 0 - for i in range(4): - x0 = aes_s_box_table[state[i * 4]] - x1 = aes_s_box_table[state[1 + ((i + 1) & 3) * 4]] - x2 = aes_s_box_table[state[2 + ((i + 2) & 3) * 4]] - x3 = aes_s_box_table[state[3 + ((i + 3) & 3) * 4]] - temp[temp_idx] = x0 ^ w[w_idx] - temp[temp_idx + 1] = x1 ^ w[w_idx + 1] - temp[temp_idx + 2] = x2 ^ w[w_idx + 2] - temp[temp_idx + 3] = x3 ^ w[w_idx + 3] - w_idx += 4 - temp_idx += 4 - for i in range(16): - state[i] = temp[i] - -# take state as input and change it to the next state in the sequence -# state and temp have size 16, w has size 16 * (Nr + 1), Nr >= 1 -def aes_state(state, w, temp, nr): - aes_add_round_key(state, w) - w_idx = 16 - for i in range(nr - 1): - aes_sb_sr_mc_ark(state, w, w_idx, temp) - w_idx += 16 - aes_sb_sr_ark(state, w, w_idx, temp) - -# expand 'key' to 'w' for use with aes_state -# key has size 4 * Nk, w has size 16 * (Nr + 1), temp has size 16 -def aes_key_expansion(key, w, temp, nk, nr): - for i in range(4 * nk): - w[i] = key[i] - w_idx = 4 * nk - 4 - for i in range(nk, 4 * (nr + 1)): - t = temp - t_idx = 0 - if i % nk == 0: - t[0] = aes_s_box(w[w_idx + 1]) ^ aes_r_con(i // nk) - for j in range(1, 4): - t[j] = aes_s_box(w[w_idx + (j + 1) % 4]) - elif nk > 6 and i % nk == 4: - for j in range(0, 4): - t[j] = aes_s_box(w[w_idx + j]) - else: - t = w - t_idx = w_idx - w_idx += 4 - for j in range(4): - w[w_idx + j] = w[w_idx + j - 4 * nk] ^ t[t_idx + j] - -################################################################## -# simple use of AES algorithm, using output feedback (OFB) mode - -class AES: - def __init__(self, keysize): - if keysize == 128: - self.nk = 4 - self.nr = 10 - elif keysize == 192: - self.nk = 6 - self.nr = 12 - else: - assert keysize == 256 - self.nk = 8 - self.nr = 14 - - self.state = bytearray(16) - self.w = bytearray(16 * (self.nr + 1)) - self.temp = bytearray(16) - self.state_pos = 16 - - def set_key(self, key): - aes_key_expansion(key, self.w, self.temp, self.nk, self.nr) - self.state_pos = 16 - - def set_iv(self, iv): - for i in range(16): - self.state[i] = iv[i] - self.state_pos = 16; - - def get_some_state(self, n_needed): - if self.state_pos >= 16: - aes_state(self.state, self.w, self.temp, self.nr) - self.state_pos = 0 - n = 16 - self.state_pos - if n > n_needed: - n = n_needed - return n - - def apply_to(self, data): - idx = 0 - n = len(data) - while n > 0: - ln = self.get_some_state(n) - n -= ln - for i in range(ln): - data[idx + i] ^= self.state[self.state_pos + i] - idx += ln - self.state_pos += n - -################################################################## -# test code - -try: - import utime as time -except ImportError: - import time -import _thread - -class LockedCounter: - def __init__(self): - self.lock = _thread.allocate_lock() - self.value = 0 - - def add(self, val): - self.lock.acquire() - self.value += val - self.lock.release() - -count = LockedCounter() - -def thread_entry(): - global count - - aes = AES(256) - key = bytearray(256 // 8) - iv = bytearray(16) - data = bytearray(128) - # from now on we don't use the heap - - for loop in range(5): - # encrypt - aes.set_key(key) - aes.set_iv(iv) - for i in range(8): - aes.apply_to(data) - - # decrypt - aes.set_key(key) - aes.set_iv(iv) - for i in range(8): - aes.apply_to(data) - - # verify - for i in range(len(data)): - assert data[i] == 0 - - count.add(1) - -if __name__ == '__main__': - n_thread = 20 - for i in range(n_thread): - _thread.start_new_thread(thread_entry, ()) - while count.value < n_thread: - time.sleep(1) diff --git a/tests/thread 2/stress_create.py b/tests/thread 2/stress_create.py deleted file mode 100644 index 2399746ccab93..0000000000000 --- a/tests/thread 2/stress_create.py +++ /dev/null @@ -1,22 +0,0 @@ -# stress test for creating many threads - -try: - import utime as time -except ImportError: - import time -import _thread - -def thread_entry(n): - pass - -thread_num = 0 -while thread_num < 500: - try: - _thread.start_new_thread(thread_entry, (thread_num,)) - thread_num += 1 - except MemoryError: - pass - -# wait for the last threads to terminate -time.sleep(1) -print('done') diff --git a/tests/thread 2/stress_heap.py b/tests/thread 2/stress_heap.py deleted file mode 100644 index 206cf1a860120..0000000000000 --- a/tests/thread 2/stress_heap.py +++ /dev/null @@ -1,48 +0,0 @@ -# stress test for the heap by allocating lots of objects within threads -# allocates about 5mb on the heap -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -try: - import utime as time -except ImportError: - import time -import _thread - -def last(l): - return l[-1] - -def thread_entry(n): - # allocate a bytearray and fill it - data = bytearray(i for i in range(256)) - - # run a loop which allocates a small list and uses it each iteration - lst = 8 * [0] - sum = 0 - for i in range(n): - sum += last(lst) - lst = [0, 0, 0, 0, 0, 0, 0, i + 1] - - # check that the bytearray still has the right data - for i, b in enumerate(data): - assert i == b - - # print the result of the loop and indicate we are finished - with lock: - print(sum, lst[-1]) - global n_finished - n_finished += 1 - -lock = _thread.allocate_lock() -n_thread = 10 -n_finished = 0 - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(thread_entry, (10000,)) - -# wait for threads to finish -while n_finished < n_thread: - time.sleep(1) diff --git a/tests/thread 2/stress_recurse.py b/tests/thread 2/stress_recurse.py deleted file mode 100644 index 8edee246ad14e..0000000000000 --- a/tests/thread 2/stress_recurse.py +++ /dev/null @@ -1,27 +0,0 @@ -# test hitting the function recursion limit within a thread -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -def foo(): - foo() - -def thread_entry(): - try: - foo() - except RuntimeError: - print('RuntimeError') - global finished - finished = True - -finished = False - -_thread.start_new_thread(thread_entry, ()) - -# busy wait for thread to finish -while not finished: - pass -print('done') diff --git a/tests/thread 2/thread_exc1.py b/tests/thread 2/thread_exc1.py deleted file mode 100644 index e00a16bd2600a..0000000000000 --- a/tests/thread 2/thread_exc1.py +++ /dev/null @@ -1,32 +0,0 @@ -# test raising and catching an exception within a thread -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -def foo(): - raise ValueError - -def thread_entry(): - try: - foo() - except ValueError: - pass - with lock: - global n_finished - n_finished += 1 - -lock = _thread.allocate_lock() -n_thread = 4 -n_finished = 0 - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(thread_entry, ()) - -# busy wait for threads to finish -while n_finished < n_thread: - pass -print('done') diff --git a/tests/thread 2/thread_exc2.py b/tests/thread 2/thread_exc2.py deleted file mode 100644 index 35cb32441204e..0000000000000 --- a/tests/thread 2/thread_exc2.py +++ /dev/null @@ -1,10 +0,0 @@ -# test raising exception within thread which is not caught -import utime -import _thread - -def thread_entry(): - raise ValueError - -_thread.start_new_thread(thread_entry, ()) -utime.sleep(1) -print('done') diff --git a/tests/thread 2/thread_exc2.py.exp b/tests/thread 2/thread_exc2.py.exp deleted file mode 100644 index cc7a20aa26575..0000000000000 --- a/tests/thread 2/thread_exc2.py.exp +++ /dev/null @@ -1,5 +0,0 @@ -Unhandled exception in thread started by -Traceback (most recent call last): - File \.\+, line 6, in thread_entry -ValueError: -done diff --git a/tests/thread 2/thread_exit1.py b/tests/thread 2/thread_exit1.py deleted file mode 100644 index ad7b01d89bb1c..0000000000000 --- a/tests/thread 2/thread_exit1.py +++ /dev/null @@ -1,21 +0,0 @@ -# test _thread.exit() function -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -try: - import utime as time -except ImportError: - import time -import _thread - -def thread_entry(): - _thread.exit() - -_thread.start_new_thread(thread_entry, ()) -_thread.start_new_thread(thread_entry, ()) - -# wait for threads to finish -time.sleep(1) -print('done') diff --git a/tests/thread 2/thread_exit2.py b/tests/thread 2/thread_exit2.py deleted file mode 100644 index 6bff8a1736e06..0000000000000 --- a/tests/thread 2/thread_exit2.py +++ /dev/null @@ -1,21 +0,0 @@ -# test raising SystemExit to finish a thread -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -try: - import utime as time -except ImportError: - import time -import _thread - -def thread_entry(): - raise SystemExit - -_thread.start_new_thread(thread_entry, ()) -_thread.start_new_thread(thread_entry, ()) - -# wait for threads to finish -time.sleep(1) -print('done') diff --git a/tests/thread 2/thread_gc1.py b/tests/thread 2/thread_gc1.py deleted file mode 100644 index 2ea189161503a..0000000000000 --- a/tests/thread 2/thread_gc1.py +++ /dev/null @@ -1,36 +0,0 @@ -# test that we can run the garbage collector within threads -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import gc -import _thread - -def thread_entry(n): - # allocate a bytearray and fill it - data = bytearray(i for i in range(256)) - - # do some work and call gc.collect() a few times - for i in range(n): - for i in range(len(data)): - data[i] = data[i] - gc.collect() - - # print whether the data remains intact and indicate we are finished - with lock: - print(list(data) == list(range(256))) - global n_finished - n_finished += 1 - -lock = _thread.allocate_lock() -n_thread = 4 -n_finished = 0 - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(thread_entry, (10,)) - -# busy wait for threads to finish -while n_finished < n_thread: - pass diff --git a/tests/thread 2/thread_ident1.py b/tests/thread 2/thread_ident1.py deleted file mode 100644 index 9a6f89ff5f7e2..0000000000000 --- a/tests/thread 2/thread_ident1.py +++ /dev/null @@ -1,23 +0,0 @@ -# test _thread.get_ident() function -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -def thread_entry(): - tid = _thread.get_ident() - print('thread', type(tid) == int, tid != 0, tid != tid_main) - global finished - finished = True - -tid_main = _thread.get_ident() -print('main', type(tid_main) == int, tid_main != 0) - -finished = False -_thread.start_new_thread(thread_entry, ()) - -while not finished: - pass -print('done') diff --git a/tests/thread 2/thread_lock1.py b/tests/thread 2/thread_lock1.py deleted file mode 100644 index c2d7c9d1ed165..0000000000000 --- a/tests/thread 2/thread_lock1.py +++ /dev/null @@ -1,48 +0,0 @@ -# test _thread lock object using a single thread -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -# create lock -lock = _thread.allocate_lock() - -print(type(lock) == _thread.LockType) - -# should be unlocked -print(lock.locked()) - -# basic acquire and release -print(lock.acquire()) -print(lock.locked()) -lock.release() -print(lock.locked()) - -# try acquire twice (second should fail) -print(lock.acquire()) -print(lock.locked()) -print(lock.acquire(0)) -print(lock.locked()) -lock.release() -print(lock.locked()) - -# test with capabilities of lock -with lock: - print(lock.locked()) - -# test that lock is unlocked if an error is rasied -try: - with lock: - print(lock.locked()) - raise KeyError -except KeyError: - print('KeyError') - print(lock.locked()) - -# test that we can't release an unlocked lock -try: - lock.release() -except RuntimeError: - print('RuntimeError') diff --git a/tests/thread 2/thread_lock2.py b/tests/thread 2/thread_lock2.py deleted file mode 100644 index 4ef912dff5240..0000000000000 --- a/tests/thread 2/thread_lock2.py +++ /dev/null @@ -1,26 +0,0 @@ -# test _thread lock objects with multiple threads -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -try: - import utime as time -except ImportError: - import time -import _thread - -lock = _thread.allocate_lock() - -def thread_entry(): - lock.acquire() - print('have it') - lock.release() - -# spawn the threads -for i in range(4): - _thread.start_new_thread(thread_entry, ()) - -# wait for threads to finish -time.sleep(1) -print('done') diff --git a/tests/thread 2/thread_lock3.py b/tests/thread 2/thread_lock3.py deleted file mode 100644 index 35808d99cbd71..0000000000000 --- a/tests/thread 2/thread_lock3.py +++ /dev/null @@ -1,29 +0,0 @@ -# test thread coordination using a lock object -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -lock = _thread.allocate_lock() -n_thread = 10 -n_finished = 0 - -def thread_entry(idx): - global n_finished - while True: - with lock: - if n_finished == idx: - break - print('my turn:', idx) - with lock: - n_finished += 1 - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(thread_entry, (i,)) - -# busy wait for threads to finish -while n_finished < n_thread: - pass diff --git a/tests/thread 2/thread_lock4.py b/tests/thread 2/thread_lock4.py deleted file mode 100644 index 440f3e90c68ed..0000000000000 --- a/tests/thread 2/thread_lock4.py +++ /dev/null @@ -1,53 +0,0 @@ -# test using lock to coordinate access to global mutable objects -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -try: - import utime as time -except ImportError: - import time -import _thread - -def fac(n): - x = 1 - for i in range(1, n + 1): - x *= i - return x - -def thread_entry(): - while True: - with jobs_lock: - try: - f, arg = jobs.pop(0) - except IndexError: - return - ans = f(arg) - with output_lock: - output.append((arg, ans)) - -# create a list of jobs -jobs = [(fac, i) for i in range(20, 80)] -jobs_lock = _thread.allocate_lock() -n_jobs = len(jobs) - -# create a list to store the results -output = [] -output_lock = _thread.allocate_lock() - -# spawn threads to do the jobs -for i in range(4): - _thread.start_new_thread(thread_entry, ()) - -# wait for the jobs to complete -while True: - with jobs_lock: - if len(output) == n_jobs: - break - time.sleep(1) - -# sort and print the results -output.sort(key=lambda x: x[0]) -for arg, ans in output: - print(arg, ans) diff --git a/tests/thread 2/thread_qstr1.py b/tests/thread 2/thread_qstr1.py deleted file mode 100644 index dccfb7f517180..0000000000000 --- a/tests/thread 2/thread_qstr1.py +++ /dev/null @@ -1,41 +0,0 @@ -# test concurrent interning of strings -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -try: - import utime as time -except ImportError: - import time -import _thread - -# function to check the interned string -def check(s, val): - assert type(s) == str - assert int(s) == val - -# main thread function -def th(base, n): - for i in range(n): - # this will intern the string and check it - exec("check('%u', %u)" % (base + i, base + i)) - - with lock: - global n_finished - n_finished += 1 - -lock = _thread.allocate_lock() -n_thread = 4 -n_finished = 0 -n_qstr_per_thread = 100 # make 1000 for a more stressful test (uses more heap) - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(th, (i * n_qstr_per_thread, n_qstr_per_thread)) - -# wait for threads to finish -while n_finished < n_thread: - time.sleep(1) - -print('pass') diff --git a/tests/thread 2/thread_shared1.py b/tests/thread 2/thread_shared1.py deleted file mode 100644 index de339ad7f8ee1..0000000000000 --- a/tests/thread 2/thread_shared1.py +++ /dev/null @@ -1,33 +0,0 @@ -# test capability for threads to access a shared immutable data structure -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -def foo(i): - pass - -def thread_entry(n, tup): - for i in tup: - foo(i) - with lock: - global n_finished - n_finished += 1 - -lock = _thread.allocate_lock() -n_thread = 2 -n_finished = 0 - -# the shared data structure -tup = (1, 2, 3, 4) - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(thread_entry, (100, tup)) - -# busy wait for threads to finish -while n_finished < n_thread: - pass -print(tup) diff --git a/tests/thread 2/thread_shared2.py b/tests/thread 2/thread_shared2.py deleted file mode 100644 index 2c749e6883bf8..0000000000000 --- a/tests/thread 2/thread_shared2.py +++ /dev/null @@ -1,34 +0,0 @@ -# test capability for threads to access a shared mutable data structure -# (without contention because they access different parts of the structure) -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import _thread - -def foo(lst, i): - lst[i] += 1 - -def thread_entry(n, lst, idx): - for i in range(n): - foo(lst, idx) - with lock: - global n_finished - n_finished += 1 - -lock = _thread.allocate_lock() -n_thread = 2 -n_finished = 0 - -# the shared data structure -lst = [0, 0] - -# spawn threads -for i in range(n_thread): - _thread.start_new_thread(thread_entry, ((i + 1) * 10, lst, i)) - -# busy wait for threads to finish -while n_finished < n_thread: - pass -print(lst) diff --git a/tests/thread 2/thread_sleep1.py b/tests/thread 2/thread_sleep1.py deleted file mode 100644 index d5aa99f977622..0000000000000 --- a/tests/thread 2/thread_sleep1.py +++ /dev/null @@ -1,33 +0,0 @@ -# test threads sleeping -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -try: - import utime - sleep_ms = utime.sleep_ms -except ImportError: - import time - sleep_ms = lambda t: time.sleep(t / 1000) - -import _thread - -lock = _thread.allocate_lock() -n_thread = 4 -n_finished = 0 - -def thread_entry(t): - global n_finished - sleep_ms(t) - sleep_ms(2 * t) - with lock: - n_finished += 1 - -for i in range(n_thread): - _thread.start_new_thread(thread_entry, (10 * i,)) - -# wait for threads to finish -while n_finished < n_thread: - sleep_ms(100) -print('done', n_thread) diff --git a/tests/thread 2/thread_stacksize1.py b/tests/thread 2/thread_stacksize1.py deleted file mode 100644 index e7189fafbc198..0000000000000 --- a/tests/thread 2/thread_stacksize1.py +++ /dev/null @@ -1,49 +0,0 @@ -# test setting the thread stack size -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -import sys -import _thread - -# different implementations have different minimum sizes -if sys.implementation.name == 'micropython': - sz = 2 * 1024 -else: - sz = 32 * 1024 - -def foo(): - pass - -def thread_entry(): - foo() - with lock: - global n_finished - n_finished += 1 - -# reset stack size to default -_thread.stack_size() - -# test set/get of stack size -print(_thread.stack_size()) -print(_thread.stack_size(sz)) -print(_thread.stack_size() == sz) -print(_thread.stack_size()) - -lock = _thread.allocate_lock() -n_thread = 2 -n_finished = 0 - -# set stack size and spawn a few threads -_thread.stack_size(sz) -for i in range(n_thread): - _thread.start_new_thread(thread_entry, ()) - -# reset stack size to default (for subsequent scripts on baremetal) -_thread.stack_size() - -# busy wait for threads to finish -while n_finished < n_thread: - pass -print('done') diff --git a/tests/thread 2/thread_start1.py b/tests/thread 2/thread_start1.py deleted file mode 100644 index 94df6dc625f60..0000000000000 --- a/tests/thread 2/thread_start1.py +++ /dev/null @@ -1,25 +0,0 @@ -# test basic capability to start a new thread -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -try: - import utime as time -except ImportError: - import time -import _thread - -def foo(): - pass - -def thread_entry(n): - for i in range(n): - foo() - -_thread.start_new_thread(thread_entry, (10,)) -_thread.start_new_thread(thread_entry, (20,)) - -# wait for threads to finish -time.sleep(1) -print('done') diff --git a/tests/thread 2/thread_start2.py b/tests/thread 2/thread_start2.py deleted file mode 100644 index 9412bb6183331..0000000000000 --- a/tests/thread 2/thread_start2.py +++ /dev/null @@ -1,28 +0,0 @@ -# test capability to start a thread with keyword args -# -# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -# -# SPDX-License-Identifier: MIT - -try: - import utime as time -except ImportError: - import time -import _thread - -def thread_entry(a0, a1, a2, a3): - print('thread', a0, a1, a2, a3) - -# spawn thread using kw args -_thread.start_new_thread(thread_entry, (10, 20), {'a2': 0, 'a3': 1}) - -# wait for thread to finish -time.sleep(1) - -# incorrect argument where dictionary is needed for keyword args -try: - _thread.start_new_thread(thread_entry, (), ()) -except TypeError: - print('TypeError') - -print('done') diff --git a/tests/unix 2/extra_coverage.py b/tests/unix 2/extra_coverage.py deleted file mode 100644 index 13721f1f479c3..0000000000000 --- a/tests/unix 2/extra_coverage.py +++ /dev/null @@ -1,74 +0,0 @@ -try: - extra_coverage -except NameError: - print("SKIP") - raise SystemExit - -import uerrno -import uio - -data = extra_coverage() - -# test hashing of str/bytes that have an invalid hash -print(data[0], data[1]) -print(hash(data[0])) -print(hash(data[1])) -print(hash(bytes(data[0], 'utf8'))) -print(hash(str(data[1], 'utf8'))) - -# test streams -stream = data[2] # has set_error and set_buf. Write always returns error -stream.set_error(uerrno.EAGAIN) # non-blocking error -print(stream.read()) # read all encounters non-blocking error -print(stream.read(1)) # read 1 byte encounters non-blocking error -print(stream.readline()) # readline encounters non-blocking error -print(stream.readinto(bytearray(10))) # readinto encounters non-blocking error -print(stream.write(b'1')) # write encounters non-blocking error -print(stream.write1(b'1')) # write1 encounters non-blocking error -stream.set_buf(b'123') -print(stream.read(4)) # read encounters non-blocking error after successful reads -stream.set_buf(b'123') -print(stream.read1(4)) # read1 encounters non-blocking error after successful reads -stream.set_buf(b'123') -print(stream.readline(4)) # readline encounters non-blocking error after successful reads -try: - print(stream.ioctl(0, 0)) # ioctl encounters non-blocking error; raises OSError -except OSError: - print('OSError') -stream.set_error(0) -print(stream.ioctl(0, bytearray(10))) # successful ioctl call - -stream2 = data[3] # is textio -print(stream2.read(1)) # read 1 byte encounters non-blocking error with textio stream - -# test BufferedWriter with stream errors -stream.set_error(uerrno.EAGAIN) -buf = uio.BufferedWriter(stream, 8) -print(buf.write(bytearray(16))) - -# test basic import of frozen scripts -import frzstr1 -import frzmpy1 - -# test import of frozen packages with __init__.py -import frzstr_pkg1 -print(frzstr_pkg1.x) -import frzmpy_pkg1 -print(frzmpy_pkg1.x) - -# test import of frozen packages without __init__.py -from frzstr_pkg2.mod import Foo -print(Foo.x) -from frzmpy_pkg2.mod import Foo -print(Foo.x) - -# test raising exception in frozen script -try: - import frzmpy2 -except ZeroDivisionError: - print('ZeroDivisionError') - -# test loading a resource from a frozen string -import uio -buf = uio.resource_stream('frzstr_pkg2', 'mod.py') -print(buf.read(21)) diff --git a/tests/unix 2/extra_coverage.py.exp b/tests/unix 2/extra_coverage.py.exp deleted file mode 100644 index 06b5d3790354d..0000000000000 --- a/tests/unix 2/extra_coverage.py.exp +++ /dev/null @@ -1,106 +0,0 @@ -# mp_printf --123 +123 123 --0123 -123 -123 -1ABCDEF -ab abc - -false true -(null) --2147483648 -2147483648 -80000000 -80000000 -abc -# GC -0 -0 -# vstr -tests -sts - -test -tes -RuntimeError: -RuntimeError: -# repl -ame__ - -argv byteorder exc_info exit -getsizeof implementation maxsize modules -path platform print_exception -stderr stdin stdout version -version_info -ementation -# attrtuple -(start=1, stop=2, step=3) -# str -1 -# bytearray -data -# mpz -1 -12345678 -0 -0 -0 -0 -0 -1 -12345 -6 -# runtime utils -TypeError: unsupported type for __abs__: 'str' -TypeError: unsupported types for __divmod__: 'str', 'str' -Warning: test -# format float -? -+1e+00 -+1e+00 -# binary -123 -456 -# VM -2 1 -# scheduler -sched(0)=1 -sched(1)=1 -sched(2)=1 -sched(3)=1 -sched(4)=0 -unlocked -3 -2 -1 -0 -0123456789 b'0123456789' -7300 -7300 -7300 -7300 -None -None -None -None -None -None -b'123' -b'123' -b'123' -OSError -0 -None -None -frzstr1 -frzmpy1 -frzstr_pkg1.__init__ -1 -frzmpy_pkg1.__init__ -1 -frzstr_pkg2.mod -1 -frzmpy_pkg2.mod -1 -ZeroDivisionError -b'# test frozen package' diff --git a/tests/unix 2/ffi_callback.py b/tests/unix 2/ffi_callback.py deleted file mode 100644 index 23b058bcec2c4..0000000000000 --- a/tests/unix 2/ffi_callback.py +++ /dev/null @@ -1,33 +0,0 @@ -try: - import ffi -except ImportError: - print("SKIP") - raise SystemExit - - -def ffi_open(names): - err = None - for n in names: - try: - mod = ffi.open(n) - return mod - except OSError as e: - err = e - raise err - -libc = ffi_open(('libc.so', 'libc.so.0', 'libc.so.6', 'libc.dylib')) - -qsort = libc.func("v", "qsort", "piip") - -def cmp(pa, pb): - a = ffi.as_bytearray(pa, 1) - b = ffi.as_bytearray(pb, 1) - #print("cmp:", a, b) - return a[0] - b[0] - -cmp_c = ffi.callback("i", cmp, "pp") - -s = bytearray(b"foobar") -print("org string:", s) -qsort(s, len(s), 1, cmp_c) -print("qsort'ed:", s) diff --git a/tests/unix 2/ffi_callback.py.exp b/tests/unix 2/ffi_callback.py.exp deleted file mode 100644 index d06fec52fbb31..0000000000000 --- a/tests/unix 2/ffi_callback.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -org string: bytearray(b'foobar') -qsort'ed: bytearray(b'abfoor') diff --git a/tests/unix 2/ffi_float.py b/tests/unix 2/ffi_float.py deleted file mode 100644 index c92a39bcdc821..0000000000000 --- a/tests/unix 2/ffi_float.py +++ /dev/null @@ -1,32 +0,0 @@ -# test ffi float support -try: - import ffi -except ImportError: - print("SKIP") - raise SystemExit - - -def ffi_open(names): - err = None - for n in names: - try: - mod = ffi.open(n) - return mod - except OSError as e: - err = e - raise err - -libc = ffi_open(('libc.so', 'libc.so.0', 'libc.so.6', 'libc.dylib')) - -strtof = libc.func("f", "strtof", "sp") -print('%.6f' % strtof('1.23', None)) - -strtod = libc.func("d", "strtod", "sp") -print('%.6f' % strtod('1.23', None)) - -# test passing double and float args -libm = ffi_open(('libm.so', 'libm.so.6', 'libc.so.0', 'libc.so.6', 'libc.dylib')) -tgamma = libm.func('d', 'tgamma', 'd') -for fun in (tgamma,): - for val in (0.5, 1, 1.0, 1.5, 4, 4.0): - print('%.6f' % fun(val)) diff --git a/tests/unix 2/ffi_float.py.exp b/tests/unix 2/ffi_float.py.exp deleted file mode 100644 index b9d7da2bdb99c..0000000000000 --- a/tests/unix 2/ffi_float.py.exp +++ /dev/null @@ -1,8 +0,0 @@ -1.230000 -1.230000 -1.772454 -1.000000 -1.000000 -0.886227 -6.000000 -6.000000 diff --git a/tests/unix 2/ffi_float2.py b/tests/unix 2/ffi_float2.py deleted file mode 100644 index 721eb4d192f17..0000000000000 --- a/tests/unix 2/ffi_float2.py +++ /dev/null @@ -1,31 +0,0 @@ -# test ffi float support -try: - import ffi -except ImportError: - print("SKIP") - raise SystemExit - - -def ffi_open(names): - err = None - for n in names: - try: - mod = ffi.open(n) - return mod - except OSError as e: - err = e - raise err - -libm = ffi_open(('libm.so', 'libm.so.6', 'libc.so.0', 'libc.so.6', 'libc.dylib')) - -# Some libc's implement tgammaf as header macro with tgamma(), so don't assume -# it'll be in library. -try: - tgammaf = libm.func('f', 'tgammaf', 'f') -except OSError: - print("SKIP") - raise SystemExit - -for fun in (tgammaf,): - for val in (0.5, 1, 1.0, 1.5, 4, 4.0): - print('%.6f' % fun(val)) diff --git a/tests/unix 2/ffi_float2.py.exp b/tests/unix 2/ffi_float2.py.exp deleted file mode 100644 index 58fc6a01acb07..0000000000000 --- a/tests/unix 2/ffi_float2.py.exp +++ /dev/null @@ -1,6 +0,0 @@ -1.772454 -1.000000 -1.000000 -0.886227 -6.000000 -6.000000 From 8fcb28e89eda64daf6d4a91ef5dd12a6ebb8c87e Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Wed, 16 Dec 2020 10:44:21 -0500 Subject: [PATCH 443/770] hopefully this gets rid of all the funny files --- .gitattributes 2 | 32 --------- .gitignore 2 | 88 ----------------------- .gitmodules 2 | 155 ----------------------------------------- tests/io/data/file1 2 | 3 - tools/.gitattributes 2 | 1 - tools/.gitignore 2 | 8 --- 6 files changed, 287 deletions(-) delete mode 100644 .gitattributes 2 delete mode 100644 .gitignore 2 delete mode 100644 .gitmodules 2 delete mode 100644 tests/io/data/file1 2 delete mode 100644 tools/.gitattributes 2 delete mode 100644 tools/.gitignore 2 diff --git a/.gitattributes 2 b/.gitattributes 2 deleted file mode 100644 index 5ebde95f07643..0000000000000 --- a/.gitattributes 2 +++ /dev/null @@ -1,32 +0,0 @@ -# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) -# -# SPDX-License-Identifier: MIT - -# Per default everything gets normalized and gets LF line endings on checkout. -* text eol=lf - -# These will always have CRLF line endings on checkout. -*.vcxproj text eol=crlf -*.props text eol=crlf -*.bat text eol=crlf - -# These are binary so should never be modified by git. -*.png binary -*.jpg binary -*.dxf binary -*.mpy binary -*.deb binary -*.zip binary -*.pdf binary - -# These should also not be modified by git. -tests/basics/string_cr_conversion.py -text -tests/basics/string_crlf_conversion.py -text -ports/stm32/pybcdc.inf_template -text -ports/stm32/usbhost/** -text -ports/cc3200/hal/aes.c -text -ports/cc3200/hal/aes.h -text -ports/cc3200/hal/des.c -text -ports/cc3200/hal/i2s.c -text -ports/cc3200/hal/i2s.h -text -ports/cc3200/version.h -text diff --git a/.gitignore 2 b/.gitignore 2 deleted file mode 100644 index a8814be45eb2a..0000000000000 --- a/.gitignore 2 +++ /dev/null @@ -1,88 +0,0 @@ -# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) -# -# SPDX-License-Identifier: MIT - -# Compiled Sources -################### -*.o -*.a -!atmel-samd/asf/**/*.a -*.elf -*.bin -*.map -*.hex -*.dis -*.exe - -# Packages -############ -dist/ -*.egg-info -.eggs - -# Logs and Databases -###################### -*.log - -# VIM Swap Files -###################### -*.swp - -# Build directory -###################### -build/ -bin/ -circuitpython-stubs/ - -# Test failure outputs -###################### -tests/*.exp -tests/*.out - -# Python cache files -###################### -__pycache__/ -*.pyc - -# Customized Makefile/project overrides -###################### -GNUmakefile -user.props - -# Sphinx output -############### -_build - -# Generated rst files -###################### -genrst/ -/autoapi/ -/shared-bindings/*/**/*.rst - -# ctags and similar -################### -TAGS - -# Merge leftovers -################# -*.orig - -# Emacs backup files -#################### -*~ - -*.DS_Store -**/*.DS_Store -*.icloud - -# POEdit mo files -#################### -*.mo - -.vscode -.idea - -# Python Virtual Environments -#################### -.venv -.env diff --git a/.gitmodules 2 b/.gitmodules 2 deleted file mode 100644 index aaa66caf71821..0000000000000 --- a/.gitmodules 2 +++ /dev/null @@ -1,155 +0,0 @@ -# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) -# -# SPDX-License-Identifier: MIT - -[submodule "lib/axtls"] - path = lib/axtls - url = https://github.com/pfalcon/axtls - branch = micropython -[submodule "lib/libffi"] - path = lib/libffi - url = https://github.com/atgreen/libffi -[submodule "lib/berkeley-db-1.xx"] - path = lib/berkeley-db-1.xx - url = https://github.com/pfalcon/berkeley-db-1.xx -[submodule "lib/uzlib"] - path = lib/uzlib - url = https://github.com/pfalcon/uzlib -[submodule "tools/uf2"] - path = tools/uf2 - url = https://github.com/Microsoft/uf2.git -[submodule "atmel-samd/frozen/Adafruit_CircuitPython_NeoPixel"] - path = frozen/Adafruit_CircuitPython_NeoPixel - url = https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel -[submodule "frozen/Adafruit_CircuitPython_Thermistor"] - path = frozen/Adafruit_CircuitPython_Thermistor - url = https://github.com/adafruit/Adafruit_CircuitPython_Thermistor.git -[submodule "frozen/Adafruit_CircuitPython_LIS3DH"] - path = frozen/Adafruit_CircuitPython_LIS3DH - url = https://github.com/adafruit/Adafruit_CircuitPython_LIS3DH.git -[submodule "frozen/Adafruit_CircuitPython_BusDevice"] - path = frozen/Adafruit_CircuitPython_BusDevice - url = https://github.com/adafruit/Adafruit_CircuitPython_BusDevice.git -[submodule "tools/python-semver"] - path = tools/python-semver - url = https://github.com/k-bx/python-semver.git -[submodule "atmel-samd/asf4"] - path = ports/atmel-samd/asf4 - url = https://github.com/adafruit/asf4.git - branch = circuitpython -[submodule "tools/usb_descriptor"] - path = tools/usb_descriptor - url = https://github.com/adafruit/usb_descriptor.git -[submodule "lib/nrfutil"] - path = lib/nrfutil - url = https://github.com/adafruit/nRF52_nrfutil -[submodule "ports/atmel-samd/freetouch"] - path = ports/atmel-samd/freetouch - url = https://github.com/adafruit/Adafruit_FreeTouch.git -[submodule "frozen/Adafruit_CircuitPython_CircuitPlayground"] - path = frozen/Adafruit_CircuitPython_CircuitPlayground - url = https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground.git -[submodule "frozen/Adafruit_CircuitPython_HID"] - path = frozen/Adafruit_CircuitPython_HID - url = https://github.com/adafruit/Adafruit_CircuitPython_HID.git -[submodule "ports/atmel-samd/Adafruit_CircuitPython_Motor"] - path = frozen/Adafruit_CircuitPython_Motor - url = https://github.com/adafruit/Adafruit_CircuitPython_Motor.git -[submodule "ports/atmel-samd/Adafruit_CircuitPython_seesaw"] - path = frozen/Adafruit_CircuitPython_seesaw - url = https://github.com/adafruit/Adafruit_CircuitPython_seesaw.git -[submodule "frozen/Adafruit_CircuitPython_IRRemote"] - path = frozen/Adafruit_CircuitPython_IRRemote - url = https://github.com/adafruit/Adafruit_CircuitPython_IRRemote.git -[submodule "frozen/Adafruit_CircuitPython_DotStar"] - path = frozen/Adafruit_CircuitPython_DotStar - url = https://github.com/adafruit/Adafruit_CircuitPython_DotStar.git -[submodule "ports/atmel-samd/peripherals"] - path = ports/atmel-samd/peripherals - url = https://github.com/adafruit/samd-peripherals.git -[submodule "frozen/Adafruit_CircuitPython_Crickit"] - path = frozen/Adafruit_CircuitPython_Crickit - url = https://github.com/adafruit/Adafruit_CircuitPython_Crickit -[submodule "ports/nrf/nrfx"] - path = ports/nrf/nrfx - url = https://github.com/adafruit/nrfx.git -[submodule "lib/tinyusb"] - path = lib/tinyusb - url = https://github.com/hathach/tinyusb.git - branch = master - fetchRecurseSubmodules = false -[submodule "tools/huffman"] - path = tools/huffman - url = https://github.com/tannewt/huffman.git -[submodule "tools/adabot"] - path = tools/adabot - url = https://github.com/adafruit/adabot.git -[submodule "tools/bitmap_font"] - path = tools/bitmap_font - url = https://github.com/adafruit/Adafruit_CircuitPython_BitmapFont.git -[submodule "tools/Tecate-bitmap-fonts"] - path = tools/Tecate-bitmap-fonts - url = https://github.com/Tecate/bitmap-fonts.git -[submodule "frozen/pew-pewpew-standalone-10.x"] - path = frozen/pew-pewpew-standalone-10.x - url = https://github.com/pewpew-game/pew-pewpew-standalone-10.x.git -[submodule "frozen/circuitpython-stage"] - path = frozen/circuitpython-stage - url = https://github.com/python-ugame/circuitpython-stage.git -[submodule "ports/cxd56/spresense-exported-sdk"] - path = ports/cxd56/spresense-exported-sdk - url = https://github.com/sonydevworld/spresense-exported-sdk.git -[submodule "frozen/Adafruit_CircuitPython_SD"] - path = frozen/Adafruit_CircuitPython_SD - url = https://github.com/adafruit/Adafruit_CircuitPython_SD.git -[submodule "lib/mp3"] - path = lib/mp3 - url = https://github.com/adafruit/Adafruit_MP3 -[submodule "ports/mimxrt10xx/sdk"] - path = ports/mimxrt10xx/sdk - url = https://github.com/adafruit/MIMXRT10xx_SDK -[submodule "frozen/Adafruit_CircuitPython_Register"] - path = frozen/Adafruit_CircuitPython_Register - url = https://github.com/adafruit/Adafruit_CircuitPython_Register.git -[submodule "extmod/ulab"] - path = extmod/ulab - url = https://github.com/v923z/micropython-ulab -[submodule "frozen/Adafruit_CircuitPython_ESP32SPI"] - path = frozen/Adafruit_CircuitPython_ESP32SPI - url = https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI -[submodule "frozen/Adafruit_CircuitPython_Requests"] - path = frozen/Adafruit_CircuitPython_Requests - url = https://github.com/adafruit/Adafruit_CircuitPython_Requests -[submodule "ports/stm/st_driver"] - path = ports/stm/st_driver - url = https://github.com/hathach/st_driver.git -[submodule "lib/protomatter"] - path = lib/protomatter - url = https://github.com/adafruit/Adafruit_Protomatter -[submodule "frozen/Adafruit_CircuitPython_LSM6DS"] - path = frozen/Adafruit_CircuitPython_LSM6DS - url = https://github.com/adafruit/Adafruit_CircuitPython_LSM6DS -[submodule "frozen/Adafruit_CircuitPython_FocalTouch"] - path = frozen/Adafruit_CircuitPython_FocalTouch - url = https://github.com/adafruit/Adafruit_CircuitPython_FocalTouch -[submodule "frozen/Adafruit_CircuitPython_DS3231"] - path = frozen/Adafruit_CircuitPython_DS3231 - url = https://github.com/adafruit/Adafruit_CircuitPython_DS3231 -[submodule "frozen/Adafruit_CircuitPython_DRV2605"] - path = frozen/Adafruit_CircuitPython_DRV2605 - url = https://github.com/adafruit/Adafruit_CircuitPython_DRV2605 -[submodule "frozen/Adafruit_CircuitPython_BLE"] - path = frozen/Adafruit_CircuitPython_BLE - url = https://github.com/adafruit/Adafruit_CircuitPython_BLE -[submodule "frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center"] - path = frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center - url = https://github.com/adafruit/Adafruit_CircuitPython_BLE_Apple_Notification_Center -[submodule "frozen/Adafruit_CircuitPython_RFM9x"] - path = frozen/Adafruit_CircuitPython_RFM9x - url = https://github.com/adafruit/Adafruit_CircuitPython_RFM9x.git -[submodule "frozen/Adafruit_CircuitPython_RFM69"] - path = frozen/Adafruit_CircuitPython_RFM69 - url = https://github.com/adafruit/Adafruit_CircuitPython_RFM69.git -[submodule "ports/esp32s2/esp-idf"] - path = ports/esp32s2/esp-idf - url = https://github.com/jepler/esp-idf.git diff --git a/tests/io/data/file1 2 b/tests/io/data/file1 2 deleted file mode 100644 index e08206337f385..0000000000000 --- a/tests/io/data/file1 2 +++ /dev/null @@ -1,3 +0,0 @@ -longer line1 -line2 -line3 diff --git a/tools/.gitattributes 2 b/tools/.gitattributes 2 deleted file mode 100644 index 9206a0bfc1369..0000000000000 --- a/tools/.gitattributes 2 +++ /dev/null @@ -1 +0,0 @@ -*.tar.gz binary diff --git a/tools/.gitignore 2 b/tools/.gitignore 2 deleted file mode 100644 index 9f65f493bc655..0000000000000 --- a/tools/.gitignore 2 +++ /dev/null @@ -1,8 +0,0 @@ -tinytest/.gitignore -tinytest/.travis.yml -tinytest/Makefile -tinytest/Makefile.arm-cortex-m3-qemu -tinytest/Makefile.avr -tinytest/TODO -tinytest/portable_demo.c -tinytest/tinytest_demo.c From 1f58795c56d35d6a50ecbea3fa8744e7b73f54b6 Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Wed, 16 Dec 2020 10:47:37 -0500 Subject: [PATCH 444/770] still removing doubles. should be the last --- .mailmap 2 | 112 ------------------------------ mpy-cross/.gitignore 2 | 11 --- ports/atmel-samd/.gitattributes 2 | 2 - ports/atmel-samd/.gitignore 2 | 1 - 4 files changed, 126 deletions(-) delete mode 100644 .mailmap 2 delete mode 100644 mpy-cross/.gitignore 2 delete mode 100644 ports/atmel-samd/.gitattributes 2 delete mode 100644 ports/atmel-samd/.gitignore 2 diff --git a/.mailmap 2 b/.mailmap 2 deleted file mode 100644 index f9d7f47a161b5..0000000000000 --- a/.mailmap 2 +++ /dev/null @@ -1,112 +0,0 @@ -# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò -# -# SPDX-License-Identifier: Unlicense - -Alexander Steffen -Alexander Steffen -Alexander Steffen -Benjamin Vernoux -Brent Rubell -Brent Rubell -Brent Rubell -Carlos -Chris Packham -Chris Packham -Damiano Mazzella -Damien George -Dan Halbert -Dan Halbert -Daniel Pollard -Daniel Pollard -Daniel Tralamazza -Daniel Tralamazza -David Glaude -David Glaude -George Waters -George Waters -Ha Thach -Henrik Sölver -Ilya Dmitrichenko -Ilya Dmitrichenko -Jason Pecor <14111408+jpecor@users.noreply.github.com> -Jeff Epler -Jeff Epler -Jeff Epler -Jeff Epler -Jerry Needell -Joe Bakalor -Josh Klar -Josh Klar -Juan Biondi -Juan Biondi -KalbeAbbas -KalbeAbbas -Kamil Tomaszewski -Kamil Tomaszewski <46525824+kamtom480@users.noreply.github.com> -Kattni -Kattni Rembor -Kenny -Kenny <3454741+WarriorOfWire@users.noreply.github.com> -Kevin Townsend -Kevin Townsend -Krzysztof Blazewicz -Krzysztof Blazewicz -Li Weiwei -Li Weiwei -Limor "Ladyada" Fried -Limor "Ladyada" Fried -Lucian Copeland -Lucian Copeland -Mark Olsson -Mark Olsson -Matt Land -Matt Land -Matt Wozniski -Matt Wozniski -Melissa LeBlanc-Williams -Melissa LeBlanc-Williams -Metallicow -Metallicow -Peter Hinch -Peter Hinch -Radomir Dopieralski -Radomir Dopieralski -Rafa Gould -Rafa Gould <50337143+rafa-gould@users.noreply.github.com> -Ryan Shaw -Ryan Shaw -Sabas -Sabas -Sabas -Scott Shawcroft -Scott Shawcroft -Scott Shawcroft -Scott Shawcroft -Scott Shawcroft -Sebastian Plamauer -Sebastian Plamauer -Senuros -Senuros -Stewart Colborne -Stewart Colborne -TG-Techie -TG-Techie <39284876+TG-Techie@users.noreply.github.com> -Thea Flowers -Thea Flowers -Tobias Badertscher -Tobias Badertscher -danicampora -danicampora -dherrada -dherrada <33632497+dherrada@users.noreply.github.com> -dherrada <=> -glennrub -retoc -retoc -siddacious -siddacious -siddacious -sommersoft -sommersoft -stijn -stijn diff --git a/mpy-cross/.gitignore 2 b/mpy-cross/.gitignore 2 deleted file mode 100644 index 6daeea5040074..0000000000000 --- a/mpy-cross/.gitignore 2 +++ /dev/null @@ -1,11 +0,0 @@ -# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) -# -# SPDX-License-Identifier: MIT - -/build-* -/mpy-cross -/mpy-cross.static -/mpy-cross.static.exe -/mpy-cross.static-raspbian -/mpy-cross.fuzz -/pitools diff --git a/ports/atmel-samd/.gitattributes 2 b/ports/atmel-samd/.gitattributes 2 deleted file mode 100644 index 09bba615b1cf4..0000000000000 --- a/ports/atmel-samd/.gitattributes 2 +++ /dev/null @@ -1,2 +0,0 @@ -tools/bossac* binary -asf/**/*.a binary diff --git a/ports/atmel-samd/.gitignore 2 b/ports/atmel-samd/.gitignore 2 deleted file mode 100644 index 414487d53eb83..0000000000000 --- a/ports/atmel-samd/.gitignore 2 +++ /dev/null @@ -1 +0,0 @@ -build-*/ From 74805527e8616076fc65e2875747ce269256528b Mon Sep 17 00:00:00 2001 From: Seth Kerr <41877068+skerr92@users.noreply.github.com> Date: Wed, 16 Dec 2020 10:52:18 -0500 Subject: [PATCH 445/770] Delete board.h not supposed to be here. --- ports/atmel-samd/boards/board.h | 47 --------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 ports/atmel-samd/boards/board.h diff --git a/ports/atmel-samd/boards/board.h b/ports/atmel-samd/boards/board.h deleted file mode 100644 index 4f0ae9d728e72..0000000000000 --- a/ports/atmel-samd/boards/board.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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. - */ - -// This file defines board specific functions. - -#ifndef MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H -#define MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H - -#include - -#include "py/mpconfig.h" - -// Initializes board related state once on start up. -void board_init(void); - -// Returns true if the user initiates safe mode in a board specific way. -// Also add BOARD_USER_SAFE_MODE in mpconfigboard.h to explain the board specific -// way. -bool board_requests_safe_mode(void); - -// Reset the state of off MCU components such as neopixels. -void reset_board(void); - -#endif // MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H From 109b6baee45629e3c072eb17b6c96ac06d7df842 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Wed, 16 Dec 2020 14:04:31 +0000 Subject: [PATCH 446/770] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (879 of 879 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index eb73928502913..8d3d54fabce40 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-14 12:59-0500\n" -"PO-Revision-Date: 2020-12-11 19:08+0000\n" +"PO-Revision-Date: 2020-12-16 17:00+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -1107,7 +1107,7 @@ msgstr "Frequência PWM inválida" #: ports/esp32s2/common-hal/analogio/AnalogIn.c msgid "Invalid Pin" -msgstr "" +msgstr "Pino inválido" #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" @@ -1977,7 +1977,7 @@ msgstr "Não é possível gravar no nvm." #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." -msgstr "" +msgstr "Não foi possível escrever no sleep_memory." #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" From 28bd29eb42d61d0a7116b6c4295e166fcfbe7145 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 16 Dec 2020 13:48:07 -0600 Subject: [PATCH 447/770] displayio: ColorConverter: fix logic errors about transparent pixels The transparent_color field was never initialized. I _think_ this means its value was always set to 0, or the blackest of blacks. Instead, initialize it to the sentinel value, newly given the name NO_TRANSPARENT_COLOR. This exposed a second problem: The test for whether there was an existing transparent color was wrong (backwards). I am guessing that this was not found due to the first bug; since the converter had a transparent color, the correct test would have led to always getting the error "Only one color can be transparent at a time". Closes #3723 --- shared-module/displayio/ColorConverter.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/shared-module/displayio/ColorConverter.c b/shared-module/displayio/ColorConverter.c index 80558d037a689..40dcd9d167818 100644 --- a/shared-module/displayio/ColorConverter.c +++ b/shared-module/displayio/ColorConverter.c @@ -29,6 +29,8 @@ #include "py/misc.h" #include "py/runtime.h" +#define NO_TRANSPARENT_COLOR (0x1000000) + uint32_t displayio_colorconverter_dither_noise_1 (uint32_t n) { n = (n >> 13) ^ n; @@ -42,6 +44,7 @@ uint32_t displayio_colorconverter_dither_noise_2(uint32_t x, uint32_t y) { void common_hal_displayio_colorconverter_construct(displayio_colorconverter_t* self, bool dither) { self->dither = dither; + self->transparent_color = NO_TRANSPARENT_COLOR; } uint16_t displayio_colorconverter_compute_rgb565(uint32_t color_rgb888) { @@ -130,7 +133,7 @@ bool common_hal_displayio_colorconverter_get_dither(displayio_colorconverter_t* } void common_hal_displayio_colorconverter_make_transparent(displayio_colorconverter_t* self, uint32_t transparent_color) { - if (self->transparent_color >= 0x1000000) { + if (self->transparent_color != NO_TRANSPARENT_COLOR) { mp_raise_RuntimeError(translate("Only one color can be transparent at a time")); } self->transparent_color = transparent_color; @@ -138,8 +141,8 @@ void common_hal_displayio_colorconverter_make_transparent(displayio_colorconvert void common_hal_displayio_colorconverter_make_opaque(displayio_colorconverter_t* self, uint32_t transparent_color) { (void) transparent_color; - // 0x1000000 will never equal a valid color - self->transparent_color = 0x1000000; + // NO_TRANSPARENT_COLOR will never equal a valid color + self->transparent_color = NO_TRANSPARENT_COLOR; } void displayio_colorconverter_convert(displayio_colorconverter_t *self, const _displayio_colorspace_t* colorspace, const displayio_input_pixel_t *input_pixel, displayio_output_pixel_t *output_color) { From fac0bf1db8adb4caeba9d3bbec10a670a989ce7d Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 12:37:32 +0800 Subject: [PATCH 448/770] Add files via upload --- .../boards/stackrduino_m0_pro/board.c | 37 +++++++++++++++++ .../boards/stackrduino_m0_pro/mpconfigboard.h | 36 +++++++++++++++++ .../stackrduino_m0_pro/mpconfigboard.mk | 26 ++++++++++++ .../boards/stackrduino_m0_pro/pins.c | 40 +++++++++++++++++++ 4 files changed, 139 insertions(+) create mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/board.c create mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h create mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk create mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/pins.c diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/board.c b/ports/atmel-samd/boards/stackrduino_m0_pro/board.c new file mode 100644 index 0000000000000..d7e856d611991 --- /dev/null +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/board.c @@ -0,0 +1,37 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "boards/board.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h new file mode 100644 index 0000000000000..8f23e82d48c3f --- /dev/null +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h @@ -0,0 +1,36 @@ +#define MICROPY_HW_BOARD_NAME "StackRduino M0 PRO" +#define MICROPY_HW_MCU_NAME "samd21g18" + +#define MICROPY_HW_LED_STATUS (&pin_PA17) +#define MICROPY_HW_NEOPIXEL (&pin_PA06) + +#define SPI_FLASH_BAUDRATE (8000000) + +#define SPI_FLASH_MOSI_PIN &pin_PB22 +#define SPI_FLASH_MISO_PIN &pin_PB03 +#define SPI_FLASH_SCK_PIN &pin_PB23 +#define SPI_FLASH_CS_PIN &pin_PA27 + +// These are pins not to reset. +#define MICROPY_PORT_A (PORT_PA06) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) + +#define BOARD_HAS_CRYSTAL 1 + +#define DEFAULT_I2C_BUS_SCL (&pin_PA23) +#define DEFAULT_I2C_BUS_SDA (&pin_PA22) + +#define DEFAULT_SPI_BUS_SCK (&pin_PB11) +#define DEFAULT_SPI_BUS_MOSI (&pin_PB10) +#define DEFAULT_SPI_BUS_MISO (&pin_PA12) + +#define DEFAULT_UART_BUS_RX (&pin_PA11) +#define DEFAULT_UART_BUS_TX (&pin_PA10) + +// USB is always used internally so skip the pin objects for it. +#define IGNORE_PIN_PA24 1 +#define IGNORE_PIN_PA25 1 + + + diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk new file mode 100644 index 0000000000000..a7caf5bc81c2c --- /dev/null +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk @@ -0,0 +1,26 @@ +LD_FILE = boards/samd21x18-bootloader-external-flash.ld +USB_VID = 0x1209 +USB_PID = 0xE3E3 +USB_PRODUCT = "StackRduino M0 PRO" +USB_MANUFACTURER = "StackRduino" + +CHIP_VARIANT = SAMD21G18A +CHIP_FAMILY = samd21 + +SPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICE_COUNT = 1 +EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ" +LONGINT_IMPL = MPZ + + +CIRCUITPY_BITBANGIO = 0 +CIRCUITPY_FREQUENCYIO = 0 +CIRCUITPY_COUNTIO = 0 +CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_VECTORIO = 0 + +CFLAGS_INLINE_LIMIT = 60 +SUPEROPT_GC = 0 + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c b/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c new file mode 100644 index 0000000000000..50dc341f9e3bb --- /dev/null +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c @@ -0,0 +1,40 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB09) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA04) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB02) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB11) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB10) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA12) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA23) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA14) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA21) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA28) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PA28) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_CHRG_EN), MP_ROM_PTR(&pin_PA13) }, + { 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); From 70a9c601a8461717effdfd543697778922a3a0c9 Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 12:52:51 +0800 Subject: [PATCH 449/770] Update devices.h Correct capacity value for the MX25R1635F from 0x18 to 0x15 (tested and working) refer to https://github.com/adafruit/circuitpython/issues/3558 --- supervisor/shared/external_flash/devices.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervisor/shared/external_flash/devices.h b/supervisor/shared/external_flash/devices.h index a874dbd4fd0f1..6797f86f0816c 100644 --- a/supervisor/shared/external_flash/devices.h +++ b/supervisor/shared/external_flash/devices.h @@ -537,7 +537,7 @@ typedef struct { .start_up_time_us = 800, \ .manufacturer_id = 0xc2, \ .memory_type = 0x28, \ - .capacity = 0x18, \ + .capacity = 0x15, \ .max_clock_speed_mhz = 33, /* 8 mhz for dual/quad */ \ .quad_enable_bit_mask = 0x80, \ .has_sector_protection = false, \ From 70739ff639f53d00473a69b892771e95995b1c5d Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 13:11:53 +0800 Subject: [PATCH 450/770] Update pins.c --- ports/atmel-samd/boards/stackrduino_m0_pro/pins.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c b/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c index 50dc341f9e3bb..7ddaec41132ef 100644 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c @@ -23,16 +23,16 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) }, { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA21) }, { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA06) }, { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) }, { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) }, { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) }, { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) }, { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) }, - { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA28) }, - { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PA28) }, - { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA13) }, - { MP_ROM_QSTR(MP_QSTR_CHRG_EN), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA28) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PA28) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_CHRG_EN), MP_ROM_PTR(&pin_PA13) }, { 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) }, From f3b7cd6a5d15ec82c4a9d06a65fbf5dc444ef3e0 Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 14:24:07 +0800 Subject: [PATCH 451/770] Delete pins.c --- .../boards/stackrduino_m0_pro/pins.c | 40 ------------------- 1 file changed, 40 deletions(-) delete mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/pins.c diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c b/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c deleted file mode 100644 index 7ddaec41132ef..0000000000000 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c +++ /dev/null @@ -1,40 +0,0 @@ -#include "shared-bindings/board/__init__.h" - -STATIC const mp_rom_map_elem_t board_global_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB09) }, - { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA04) }, - { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA05) }, - { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB02) }, - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB11) }, - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB10) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA12) }, - { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) }, - { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA10) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) }, - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA23) }, - { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA08) }, - { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA14) }, - { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) }, - { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) }, - { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA21) }, - { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) }, - { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) }, - { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) }, - { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) }, - { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) }, - { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA28) }, - { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PA28) }, - { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA13) }, - { MP_ROM_QSTR(MP_QSTR_CHRG_EN), MP_ROM_PTR(&pin_PA13) }, - { 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); From 3d9e4958c5c7d9373c373aa3be5947aaeb504330 Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 14:24:24 +0800 Subject: [PATCH 452/770] Add files via upload --- .../boards/stackrduino_m0_pro/pins.c | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/pins.c diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c b/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c new file mode 100644 index 0000000000000..95d2eb5a3d2d0 --- /dev/null +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c @@ -0,0 +1,40 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB09) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA04) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB02) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB11) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB10) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA12) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA23) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA14) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA21) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA28) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PA28) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_CHRG_EN), MP_ROM_PTR(&pin_PA13) }, + { 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); From 23ad9c7402325cf50e7f09db11f0aad4e396b935 Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 15:17:04 +0800 Subject: [PATCH 453/770] Update mpconfigboard.h removed whitespace --- ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h index 8f23e82d48c3f..f0b2764a49ac2 100644 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h @@ -31,6 +31,3 @@ // USB is always used internally so skip the pin objects for it. #define IGNORE_PIN_PA24 1 #define IGNORE_PIN_PA25 1 - - - From 109e147b46838ee0b97b825d91de8d2dc6834e6c Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 16:22:47 +0800 Subject: [PATCH 454/770] Update board.c updated path to board.h --- ports/atmel-samd/boards/stackrduino_m0_pro/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/board.c b/ports/atmel-samd/boards/stackrduino_m0_pro/board.c index d7e856d611991..84960e73cf2cd 100644 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/board.c +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" void board_init(void) { } From 0a7c74230c9cee04785e906cbe8160f6d7d40ddb Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 16:26:54 +0800 Subject: [PATCH 455/770] Update mpconfigboard.mk updated for 6.1 --- ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk index a7caf5bc81c2c..955f3d593bc8d 100644 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk @@ -1,4 +1,3 @@ -LD_FILE = boards/samd21x18-bootloader-external-flash.ld USB_VID = 0x1209 USB_PID = 0xE3E3 USB_PRODUCT = "StackRduino M0 PRO" @@ -18,9 +17,9 @@ CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_VECTORIO = 0 +CIRCUITPY_BUSDEVICE = 0 CFLAGS_INLINE_LIMIT = 60 SUPEROPT_GC = 0 -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel From 736c0d4c3d880664aab0e82c26bd7d92cf6e5b6a Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 17:08:46 +0800 Subject: [PATCH 456/770] Delete pins.c --- .../boards/stackrduino_m0_pro/pins.c | 40 ------------------- 1 file changed, 40 deletions(-) delete mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/pins.c diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c b/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c deleted file mode 100644 index 95d2eb5a3d2d0..0000000000000 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c +++ /dev/null @@ -1,40 +0,0 @@ -#include "shared-bindings/board/__init__.h" - -STATIC const mp_rom_map_elem_t board_global_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB09) }, - { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA04) }, - { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA05) }, - { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB02) }, - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB11) }, - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB10) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA12) }, - { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) }, - { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA10) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) }, - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA23) }, - { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA08) }, - { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA14) }, - { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) }, - { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) }, - { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA21) }, - { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) }, - { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) }, - { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) }, - { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) }, - { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) }, - { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA28) }, - { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PA28) }, - { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA13) }, - { MP_ROM_QSTR(MP_QSTR_CHRG_EN), MP_ROM_PTR(&pin_PA13) }, - { 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); From 1284418fa7df4683074a3ad020dac27967c9819e Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 17:08:48 +0800 Subject: [PATCH 457/770] Delete mpconfigboard.mk --- .../stackrduino_m0_pro/mpconfigboard.mk | 25 ------------------- 1 file changed, 25 deletions(-) delete mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk deleted file mode 100644 index 955f3d593bc8d..0000000000000 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk +++ /dev/null @@ -1,25 +0,0 @@ -USB_VID = 0x1209 -USB_PID = 0xE3E3 -USB_PRODUCT = "StackRduino M0 PRO" -USB_MANUFACTURER = "StackRduino" - -CHIP_VARIANT = SAMD21G18A -CHIP_FAMILY = samd21 - -SPI_FLASH_FILESYSTEM = 1 -EXTERNAL_FLASH_DEVICE_COUNT = 1 -EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ" -LONGINT_IMPL = MPZ - - -CIRCUITPY_BITBANGIO = 0 -CIRCUITPY_FREQUENCYIO = 0 -CIRCUITPY_COUNTIO = 0 -CIRCUITPY_I2CPERIPHERAL = 0 -CIRCUITPY_VECTORIO = 0 -CIRCUITPY_BUSDEVICE = 0 - -CFLAGS_INLINE_LIMIT = 60 -SUPEROPT_GC = 0 - -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel From f3fb01416679132e52a401226a1df7408b621903 Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 17:08:50 +0800 Subject: [PATCH 458/770] Delete mpconfigboard.h --- .../boards/stackrduino_m0_pro/mpconfigboard.h | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h deleted file mode 100644 index f0b2764a49ac2..0000000000000 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h +++ /dev/null @@ -1,33 +0,0 @@ -#define MICROPY_HW_BOARD_NAME "StackRduino M0 PRO" -#define MICROPY_HW_MCU_NAME "samd21g18" - -#define MICROPY_HW_LED_STATUS (&pin_PA17) -#define MICROPY_HW_NEOPIXEL (&pin_PA06) - -#define SPI_FLASH_BAUDRATE (8000000) - -#define SPI_FLASH_MOSI_PIN &pin_PB22 -#define SPI_FLASH_MISO_PIN &pin_PB03 -#define SPI_FLASH_SCK_PIN &pin_PB23 -#define SPI_FLASH_CS_PIN &pin_PA27 - -// These are pins not to reset. -#define MICROPY_PORT_A (PORT_PA06) -#define MICROPY_PORT_B (0) -#define MICROPY_PORT_C (0) - -#define BOARD_HAS_CRYSTAL 1 - -#define DEFAULT_I2C_BUS_SCL (&pin_PA23) -#define DEFAULT_I2C_BUS_SDA (&pin_PA22) - -#define DEFAULT_SPI_BUS_SCK (&pin_PB11) -#define DEFAULT_SPI_BUS_MOSI (&pin_PB10) -#define DEFAULT_SPI_BUS_MISO (&pin_PA12) - -#define DEFAULT_UART_BUS_RX (&pin_PA11) -#define DEFAULT_UART_BUS_TX (&pin_PA10) - -// USB is always used internally so skip the pin objects for it. -#define IGNORE_PIN_PA24 1 -#define IGNORE_PIN_PA25 1 From bc95c7f2190939e43995d7bf331c66f08f11ef80 Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 17:08:52 +0800 Subject: [PATCH 459/770] Delete board.c --- .../boards/stackrduino_m0_pro/board.c | 37 ------------------- 1 file changed, 37 deletions(-) delete mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/board.c diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/board.c b/ports/atmel-samd/boards/stackrduino_m0_pro/board.c deleted file mode 100644 index 84960e73cf2cd..0000000000000 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/board.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 "supervisor/board.h" - -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} From c6de41b4ea809770b3e19b6bbe017827ff7aa320 Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 17:14:49 +0800 Subject: [PATCH 460/770] Update build.yml added stackrduino_m0_pro board --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0edc8c023d203..fff8e826fae4d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -301,6 +301,7 @@ jobs: - "sparkfun_samd21_mini" - "sparkfun_samd51_thing_plus" - "spresense" + - "stackrduino_m0_pro" - "stm32f411ce_blackpill" - "stm32f411ve_discovery" - "stm32f412zg_discovery" From 81ff95a8eb6364072113ba203131d897a9c7f171 Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 20:29:54 +0800 Subject: [PATCH 461/770] Add files via upload --- .../boards/stackrduino_m0_pro/board.c | 37 +++++++++++++++++ .../boards/stackrduino_m0_pro/mpconfigboard.h | 33 +++++++++++++++ .../stackrduino_m0_pro/mpconfigboard.mk | 25 ++++++++++++ .../boards/stackrduino_m0_pro/pins.c | 40 +++++++++++++++++++ 4 files changed, 135 insertions(+) create mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/board.c create mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h create mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk create mode 100644 ports/atmel-samd/boards/stackrduino_m0_pro/pins.c diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/board.c b/ports/atmel-samd/boards/stackrduino_m0_pro/board.c new file mode 100644 index 0000000000000..84960e73cf2cd --- /dev/null +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/board.c @@ -0,0 +1,37 @@ +/* + * 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 "supervisor/board.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h new file mode 100644 index 0000000000000..f0b2764a49ac2 --- /dev/null +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.h @@ -0,0 +1,33 @@ +#define MICROPY_HW_BOARD_NAME "StackRduino M0 PRO" +#define MICROPY_HW_MCU_NAME "samd21g18" + +#define MICROPY_HW_LED_STATUS (&pin_PA17) +#define MICROPY_HW_NEOPIXEL (&pin_PA06) + +#define SPI_FLASH_BAUDRATE (8000000) + +#define SPI_FLASH_MOSI_PIN &pin_PB22 +#define SPI_FLASH_MISO_PIN &pin_PB03 +#define SPI_FLASH_SCK_PIN &pin_PB23 +#define SPI_FLASH_CS_PIN &pin_PA27 + +// These are pins not to reset. +#define MICROPY_PORT_A (PORT_PA06) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) + +#define BOARD_HAS_CRYSTAL 1 + +#define DEFAULT_I2C_BUS_SCL (&pin_PA23) +#define DEFAULT_I2C_BUS_SDA (&pin_PA22) + +#define DEFAULT_SPI_BUS_SCK (&pin_PB11) +#define DEFAULT_SPI_BUS_MOSI (&pin_PB10) +#define DEFAULT_SPI_BUS_MISO (&pin_PA12) + +#define DEFAULT_UART_BUS_RX (&pin_PA11) +#define DEFAULT_UART_BUS_TX (&pin_PA10) + +// USB is always used internally so skip the pin objects for it. +#define IGNORE_PIN_PA24 1 +#define IGNORE_PIN_PA25 1 diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk new file mode 100644 index 0000000000000..955f3d593bc8d --- /dev/null +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk @@ -0,0 +1,25 @@ +USB_VID = 0x1209 +USB_PID = 0xE3E3 +USB_PRODUCT = "StackRduino M0 PRO" +USB_MANUFACTURER = "StackRduino" + +CHIP_VARIANT = SAMD21G18A +CHIP_FAMILY = samd21 + +SPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICE_COUNT = 1 +EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ" +LONGINT_IMPL = MPZ + + +CIRCUITPY_BITBANGIO = 0 +CIRCUITPY_FREQUENCYIO = 0 +CIRCUITPY_COUNTIO = 0 +CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_VECTORIO = 0 +CIRCUITPY_BUSDEVICE = 0 + +CFLAGS_INLINE_LIMIT = 60 +SUPEROPT_GC = 0 + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c b/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c new file mode 100644 index 0000000000000..95d2eb5a3d2d0 --- /dev/null +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c @@ -0,0 +1,40 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB09) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA04) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB02) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB11) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB10) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA12) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA23) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA14) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA21) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA28) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PA28) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_CHRG_EN), MP_ROM_PTR(&pin_PA13) }, + { 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); From 06022a5e9145dbe5213802edbe6dd7a2b5ff5f81 Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 21:58:24 +0800 Subject: [PATCH 462/770] Update mpconfigboard.mk changed CFLAGS_INLINE_LIMIT = 55 --- ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk index 955f3d593bc8d..4a8b85e2f3a97 100644 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk @@ -19,7 +19,7 @@ CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_VECTORIO = 0 CIRCUITPY_BUSDEVICE = 0 -CFLAGS_INLINE_LIMIT = 60 +CFLAGS_INLINE_LIMIT = 55 SUPEROPT_GC = 0 FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel From 7afa1a1d766bb7fb8f4afe2c8d4de336e0be566c Mon Sep 17 00:00:00 2001 From: Hany Elkomy Date: Thu, 17 Dec 2020 22:47:01 +0800 Subject: [PATCH 463/770] Update mpconfigboard.mk reduced to CFLAGS_INLINE_LIMIT = 35 for tranaslations --- .../stackrduino_m0_pro/mpconfigboard.mk | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk index 4a8b85e2f3a97..704d265141d2d 100644 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk @@ -22,4 +22,37 @@ CIRCUITPY_BUSDEVICE = 0 CFLAGS_INLINE_LIMIT = 55 SUPEROPT_GC = 0 -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel +CFLAGS_BOARD = --param max-inline-insns-auto=15 +ifeq ($(TRANSLATION), ja) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +endif +ifeq ($(TRANSLATION), zh_Latn_pinyin) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +endif +ifeq ($(TRANSLATION), de_DE) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +SUPEROPT_VM = 0 +endif +ifeq ($(TRANSLATION), pl) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +SUPEROPT_VM = 0 +endif +ifeq ($(TRANSLATION), fr) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +SUPEROPT_VM = 0 +endif +ifeq ($(TRANSLATION), pt_BR) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +SUPEROPT_VM = 0 +endif +ifeq ($(TRANSLATION), es) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +SUPEROPT_VM = 0 +endif From f224ed18488b1e92b6d13b09b696769a2ac380ce Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 17 Dec 2020 10:54:37 -0600 Subject: [PATCH 464/770] OnDiskBitmap: Correct handling of "0 color palette" images Microsoft documentation says: > If biCompression equals BI_RGB and the bitmap uses 8 bpp or less, the bitmap has a color table immediatelly following the BITMAPINFOHEADER structure. The color table consists of an array of RGBQUAD values. The size of the array is given by the biClrUsed member. If biClrUsed is zero, the array contains the maximum number of colors for the given bitdepth; that is, 2^biBitCount colors. Formerly, we treated 0 colors as "no image palette" during construction, but then during common_hal_displayio_ondiskbitmap_get_pixel indexed into the palette anyway. This could have unpredictable results. On a pygamer, it gave an image that was blue and black. On magtag, it gave a crash. --- shared-module/displayio/OnDiskBitmap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/shared-module/displayio/OnDiskBitmap.c b/shared-module/displayio/OnDiskBitmap.c index 993fc03de62ec..c1a0ddeb7e6b5 100644 --- a/shared-module/displayio/OnDiskBitmap.c +++ b/shared-module/displayio/OnDiskBitmap.c @@ -57,7 +57,7 @@ void common_hal_displayio_ondiskbitmap_construct(displayio_ondiskbitmap_t *self, uint32_t compression = read_word(bmp_header, 15); uint32_t number_of_colors = read_word(bmp_header, 23); - bool indexed = ((bits_per_pixel <= 8) && (number_of_colors != 0)); + bool indexed = bits_per_pixel <= 8; self->bitfield_compressed = (compression == 3); self->bits_per_pixel = bits_per_pixel; self->width = read_word(bmp_header, 9); @@ -75,6 +75,9 @@ void common_hal_displayio_ondiskbitmap_construct(displayio_ondiskbitmap_t *self, self->b_bitmask = 0x1f; } } else if (indexed && self->bits_per_pixel != 1) { + if (number_of_colors == 0) { + number_of_colors = 1 << bits_per_pixel; + } uint16_t palette_size = number_of_colors * sizeof(uint32_t); uint16_t palette_offset = 0xe + header_size; From 4863413bc9aa3104f2c983efa43bf3afa028b80b Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Fri, 18 Dec 2020 00:34:56 +0530 Subject: [PATCH 465/770] rename ota to dualbank --- locale/circuitpython.pot | 20 ++-- .../common-hal/{ota => dualbank}/__init__.c | 65 ++++++------- .../common-hal/{ota => dualbank}/__init__.h | 8 +- ports/esp32s2/mpconfigport.mk | 2 +- ports/esp32s2/supervisor/port.c | 6 +- py/circuitpy_defns.mk | 6 +- py/circuitpy_mpconfig.h | 10 +- py/circuitpy_mpconfig.mk | 4 +- shared-bindings/{ota => dualbank}/__init__.c | 96 ++++++++----------- shared-bindings/{ota => dualbank}/__init__.h | 11 +-- 10 files changed, 102 insertions(+), 126 deletions(-) rename ports/esp32s2/common-hal/{ota => dualbank}/__init__.c (76%) rename ports/esp32s2/common-hal/{ota => dualbank}/__init__.h (84%) rename shared-bindings/{ota => dualbank}/__init__.c (55%) rename shared-bindings/{ota => dualbank}/__init__.h (78%) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 6ee4d816a5805..d7f95091c846f 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-12-10 16:56+0530\n" +"POT-Creation-Date: 2020-12-17 19:42+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -936,6 +936,10 @@ msgstr "" msgid "Filters too complex" msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "" @@ -1420,10 +1424,6 @@ msgstr "" msgid "Not settable" msgstr "" -#: ports/esp32s2/common-hal/ota/__init__.c -msgid "OTA Update Failed" -msgstr "" - #: shared-bindings/util.c msgid "" "Object has been deinitialized and can no longer be used. Create a new object." @@ -1911,10 +1911,6 @@ msgstr "" msgid "Unable to read color palette data" msgstr "" -#: ports/esp32s2/common-hal/ota/__init__.c -msgid "Unable to switch boot partition" -msgstr "" - #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "" @@ -1983,6 +1979,10 @@ msgstr "" msgid "Unsupported pull value." msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3210,7 +3210,7 @@ msgstr "" msgid "offset is too large" msgstr "" -#: shared-bindings/ota/__init__.c +#: shared-bindings/dualbank/__init__.c msgid "offset must be >= 0" msgstr "" diff --git a/ports/esp32s2/common-hal/ota/__init__.c b/ports/esp32s2/common-hal/dualbank/__init__.c similarity index 76% rename from ports/esp32s2/common-hal/ota/__init__.c rename to ports/esp32s2/common-hal/dualbank/__init__.c index 5ea25fb5d487c..0f468a036beb1 100644 --- a/ports/esp32s2/common-hal/ota/__init__.c +++ b/ports/esp32s2/common-hal/dualbank/__init__.c @@ -24,8 +24,8 @@ * THE SOFTWARE. */ -#include "common-hal/ota/__init__.h" -#include "shared-bindings/ota/__init__.h" +#include "common-hal/dualbank/__init__.h" +#include "shared-bindings/dualbank/__init__.h" #include @@ -35,21 +35,24 @@ static const esp_partition_t *update_partition = NULL; static esp_ota_handle_t update_handle = 0; -static bool ota_inited = false; -static const char *TAG = "OTA"; +static const char *TAG = "dualbank"; -void ota_reset(void) { - update_handle = 0; - update_partition = NULL; - ota_inited = false; +void dualbank_reset(void) { + // should use `abort` instead of `end` + // but not in idf v4.2 + // esp_ota_abort(update_handle); + if (esp_ota_end(update_handle) == ESP_OK) { + update_handle = 0; + update_partition = NULL; + } } static void __attribute__((noreturn)) task_fatal_error(void) { ESP_LOGE(TAG, "Exiting task due to fatal error..."); - mp_raise_RuntimeError(translate("OTA Update Failed")); + mp_raise_RuntimeError(translate("Update Failed")); } -void common_hal_ota_flash(const void *buf, const size_t len, const int32_t offset) { +void common_hal_dualbank_flash(const void *buf, const size_t len, const size_t offset) { esp_err_t err; const esp_partition_t *running = esp_ota_get_running_partition(); @@ -67,7 +70,7 @@ void common_hal_ota_flash(const void *buf, const size_t len, const int32_t offse assert(update_partition != NULL); } - if (!ota_inited) { + if (update_handle == 0) { if (len > sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t) + sizeof(esp_app_desc_t)) { esp_app_desc_t new_app_info; memcpy(&new_app_info, &((char *)buf)[sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t)], sizeof(esp_app_desc_t)); @@ -102,14 +105,13 @@ void common_hal_ota_flash(const void *buf, const size_t len, const int32_t offse ESP_LOGE(TAG, "esp_ota_begin failed (%s)", esp_err_to_name(err)); task_fatal_error(); } - ota_inited = true; } else { ESP_LOGE(TAG, "received package is not fit len"); task_fatal_error(); } } - if (offset == -1) { + if (offset == 0) { err = esp_ota_write(update_handle, buf, len); } else { err = esp_ota_write_with_offset(update_handle, buf, len, offset); @@ -120,31 +122,18 @@ void common_hal_ota_flash(const void *buf, const size_t len, const int32_t offse } } -void common_hal_ota_finish(void) { - if (ota_inited) { - esp_err_t err; - - err = esp_ota_end(update_handle); - if (err != ESP_OK) { - if (err == ESP_ERR_OTA_VALIDATE_FAILED) { - ESP_LOGE(TAG, "Image validation failed, image is corrupted"); - } - ESP_LOGE(TAG, "esp_ota_end failed (%s)!", esp_err_to_name(err)); - task_fatal_error(); - } - - err = esp_ota_set_boot_partition(update_partition); - if (err != ESP_OK) { - ESP_LOGE(TAG, "esp_ota_set_boot_partition failed (%s)!", esp_err_to_name(err)); - task_fatal_error(); - } - - ota_reset(); +void common_hal_dualbank_switch(void) { + if (esp_ota_end(update_handle) == ESP_OK) { + update_handle = 0; + update_partition = NULL; } -} - -void common_hal_ota_switch(void) { - if (esp_ota_set_boot_partition(esp_ota_get_next_update_partition(NULL)) != ESP_OK) { - mp_raise_RuntimeError(translate("Unable to switch boot partition")); + esp_err_t err = esp_ota_set_boot_partition(esp_ota_get_next_update_partition(NULL)); + if (err != ESP_OK) { + if (err == ESP_ERR_OTA_VALIDATE_FAILED) { + ESP_LOGE(TAG, "Image validation failed, image is corrupted"); + mp_raise_RuntimeError(translate("Firmware image is invalid")); + } + ESP_LOGE(TAG, "esp_ota_set_boot_partition failed (%s)!", esp_err_to_name(err)); + task_fatal_error(); } } diff --git a/ports/esp32s2/common-hal/ota/__init__.h b/ports/esp32s2/common-hal/dualbank/__init__.h similarity index 84% rename from ports/esp32s2/common-hal/ota/__init__.h rename to ports/esp32s2/common-hal/dualbank/__init__.h index 983b57e3f2dd0..8b18336c948b4 100644 --- a/ports/esp32s2/common-hal/ota/__init__.h +++ b/ports/esp32s2/common-hal/dualbank/__init__.h @@ -24,9 +24,9 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA___INIT___H -#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA___INIT___H +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_DUALBANK___INIT___H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_DUALBANK___INIT___H -extern void ota_reset(void); +extern void dualbank_reset(void); -#endif //MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA___INIT___H +#endif //MICROPY_INCLUDED_ESP32S2_COMMON_HAL_DUALBANK___INIT___H diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index da231107fb82d..2ad8afb51cd1e 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -19,11 +19,11 @@ CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_AUDIOIO = 0 CIRCUITPY_CANIO = 1 CIRCUITPY_COUNTIO = 1 +CIRCUITPY_DUALBANK = 1 CIRCUITPY_FREQUENCYIO = 1 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_ROTARYIO = 1 CIRCUITPY_NVM = 1 -CIRCUITPY_OTA = 1 # We don't have enough endpoints to include MIDI. CIRCUITPY_USB_MIDI = 0 CIRCUITPY_WIFI = 1 diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 201d9962e212b..a56ac61c81b87 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -41,7 +41,7 @@ #include "common-hal/busio/I2C.h" #include "common-hal/busio/SPI.h" #include "common-hal/busio/UART.h" -#include "common-hal/ota/__init__.h" +#include "common-hal/dualbank/__init__.h" #include "common-hal/ps2io/Ps2.h" #include "common-hal/pulseio/PulseIn.h" #include "common-hal/pwmio/PWMOut.h" @@ -124,8 +124,8 @@ void reset_port(void) { analogout_reset(); #endif -#if CIRCUITPY_OTA - ota_reset(); +#if CIRCUITPY_DUALBANK + dualbank_reset(); #endif #if CIRCUITPY_PS2IO diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 68e806d4b2bc4..a8714791416aa 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -205,8 +205,8 @@ endif ifeq ($(CIRCUITPY_OS),1) SRC_PATTERNS += os/% endif -ifeq ($(CIRCUITPY_OTA),1) -SRC_PATTERNS += ota/% +ifeq ($(CIRCUITPY_DUALBANK),1) +SRC_PATTERNS += dualbank/% endif ifeq ($(CIRCUITPY_PIXELBUF),1) SRC_PATTERNS += _pixelbuf/% @@ -350,7 +350,7 @@ SRC_COMMON_HAL_ALL = \ nvm/ByteArray.c \ nvm/__init__.c \ os/__init__.c \ - ota/__init__.c \ + dualbank/__init__.c \ ps2io/Ps2.c \ ps2io/__init__.c \ pulseio/PulseIn.c \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 6a0daa7e9b769..08c92a77ef03a 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -539,11 +539,11 @@ extern const struct _mp_obj_module_t os_module; #define OS_MODULE_ALT_NAME #endif -#if CIRCUITPY_OTA -extern const struct _mp_obj_module_t ota_module; -#define OTA_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_ota), (mp_obj_t)&ota_module }, +#if CIRCUITPY_DUALBANK +extern const struct _mp_obj_module_t dualbank_module; +#define DUALBANK_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_dualbank), (mp_obj_t)&dualbank_module }, #else -#define OTA_MODULE +#define DUALBANK_MODULE #endif #if CIRCUITPY_PEW @@ -834,7 +834,7 @@ extern const struct _mp_obj_module_t wifi_module; NETWORK_MODULE \ SOCKET_MODULE \ WIZNET_MODULE \ - OTA_MODULE \ + DUALBANK_MODULE \ PEW_MODULE \ PIXELBUF_MODULE \ PS2IO_MODULE \ diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 09074bf53c771..af1dccf0243f0 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -179,8 +179,8 @@ CFLAGS += -DCIRCUITPY_NVM=$(CIRCUITPY_NVM) CIRCUITPY_OS ?= 1 CFLAGS += -DCIRCUITPY_OS=$(CIRCUITPY_OS) -CIRCUITPY_OTA ?= 0 -CFLAGS += -DCIRCUITPY_OTA=$(CIRCUITPY_OTA) +CIRCUITPY_DUALBANK ?= 0 +CFLAGS += -DCIRCUITPY_DUALBANK=$(CIRCUITPY_DUALBANK) CIRCUITPY_PIXELBUF ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_PIXELBUF=$(CIRCUITPY_PIXELBUF) diff --git a/shared-bindings/ota/__init__.c b/shared-bindings/dualbank/__init__.c similarity index 55% rename from shared-bindings/ota/__init__.c rename to shared-bindings/dualbank/__init__.c index 8ecc6d9c41d68..8021ab18b937d 100644 --- a/shared-bindings/ota/__init__.c +++ b/shared-bindings/dualbank/__init__.c @@ -24,19 +24,20 @@ * THE SOFTWARE. */ -#include "shared-bindings/ota/__init__.h" +#include "shared-bindings/dualbank/__init__.h" -//| """OTA Module +//| """DUALBANK Module //| -//| The `ota` module implements over-the-air update. +//| The `dualbank` module adds ability to update and switch +//| between the two app partitions. //| -//| There are two identical ota partitions ota_0/1, these -//| contain different firmware versions. +//| There are two identical partitions, these contain different +//| firmware versions. //| Having two partitions enables rollback functionality. //| //| The two partitions are defined as boot partition and -//| next-update partition. Calling `ota.flash()` writes the -//| next-update partition. +//| next-update partition. Calling `dualbank.flash()` writes +//| the next-update partition. //| //| After the next-update partition is written a validation //| check is performed and on a successful validation this @@ -47,81 +48,68 @@ //| //| .. code-block:: python //| -//| import ota +//| import dualbank //| -//| ota.flash(buffer, offset) -//| ota.finish() +//| dualbank.flash(buffer, offset) +//| dualbank.switch() //| """ //| ... //| -//| def switch() -> None: -//| """Switches the boot partition. On next reset, -//| firmware will be loaded from the partition -//| just switched over to.""" -//| ... -//| -STATIC mp_obj_t ota_switch(void) { - common_hal_ota_switch(); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_switch_obj, ota_switch); - -//| def finish() -> None: -//| """Validates flashed firmware, sets next boot partition. -//| **Must be called** after the firmware has been -//| completely written into the flash using `ota.flash()`. -//| -//| This is to be called only once per update.""" -//| ... -//| -STATIC mp_obj_t ota_finish(void) { - common_hal_ota_finish(); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_finish_obj, ota_finish); - //| def flash(*buffer: ReadableBuffer, offset: int=0) -> None: -//| """Writes one of two OTA partitions at the given offset. -//| -//| The default offset is 0. It is necessary to provide the -//| offset when writing in discontinous chunks. +//| """Writes one of two app partitions at the given offset. //| //| This can be called multiple times when flashing the firmware -//| in small chunks.""" +//| in small chunks. +//| """ //| ... //| -STATIC mp_obj_t ota_flash(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +STATIC mp_obj_t dualbank_flash(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buffer, ARG_offset }; static const mp_arg_t allowed_args[] = { { MP_QSTR_buffer, MP_ARG_OBJ | MP_ARG_REQUIRED }, - { MP_QSTR_offset, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = -1} }, + { MP_QSTR_offset, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - if (args[ARG_offset].u_int < -1) { + if (args[ARG_offset].u_int < 0) { mp_raise_ValueError(translate("offset must be >= 0")); } mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_READ); - common_hal_ota_flash(bufinfo.buf, bufinfo.len, args[ARG_offset].u_int); + common_hal_dualbank_flash(bufinfo.buf, bufinfo.len, args[ARG_offset].u_int); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(dualbank_flash_obj, 0, dualbank_flash); + +//| def switch() -> None: +//| """Switches the boot partition. +//| +//| On next reset, firmware will be loaded from the partition +//| just switched over to. +//| """ +//| ... +//| +STATIC mp_obj_t dualbank_switch(void) { + common_hal_dualbank_switch(); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ota_flash_obj, 0, ota_flash); +STATIC MP_DEFINE_CONST_FUN_OBJ_0(dualbank_switch_obj, dualbank_switch); -STATIC const mp_rom_map_elem_t ota_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ota) }, - { MP_ROM_QSTR(MP_QSTR_switch), MP_ROM_PTR(&ota_switch_obj) }, - { MP_ROM_QSTR(MP_QSTR_finish), MP_ROM_PTR(&ota_finish_obj) }, - { MP_ROM_QSTR(MP_QSTR_flash), MP_ROM_PTR(&ota_flash_obj) }, +STATIC const mp_rom_map_elem_t dualbank_module_globals_table[] = { + // module name + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_dualbank) }, + // module functions + { MP_ROM_QSTR(MP_QSTR_flash), MP_ROM_PTR(&dualbank_flash_obj) }, + { MP_ROM_QSTR(MP_QSTR_switch), MP_ROM_PTR(&dualbank_switch_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(ota_module_globals, ota_module_globals_table); +STATIC MP_DEFINE_CONST_DICT(dualbank_module_globals, dualbank_module_globals_table); -const mp_obj_module_t ota_module = { +const mp_obj_module_t dualbank_module = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t*)&ota_module_globals, + .globals = (mp_obj_dict_t*)&dualbank_module_globals, }; diff --git a/shared-bindings/ota/__init__.h b/shared-bindings/dualbank/__init__.h similarity index 78% rename from shared-bindings/ota/__init__.h rename to shared-bindings/dualbank/__init__.h index 82273f975abf0..7edbc6d68afd3 100644 --- a/shared-bindings/ota/__init__.h +++ b/shared-bindings/dualbank/__init__.h @@ -24,13 +24,12 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_OTA___INIT___H -#define MICROPY_INCLUDED_SHARED_BINDINGS_OTA___INIT___H +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DUALBANK___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_DUALBANK___INIT___H #include "py/runtime.h" -extern void common_hal_ota_switch(void); -extern void common_hal_ota_finish(void); -extern void common_hal_ota_flash(const void *buf, const size_t len, const int32_t offset); +extern void common_hal_dualbank_switch(void); +extern void common_hal_dualbank_flash(const void *buf, const size_t len, const size_t offset); -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_OTA___INIT___H +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DUALBANK___INIT___H From 8eaf2b0c1933fa4d0bef2786647b0eb0a586f605 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Fri, 18 Dec 2020 12:54:36 +0530 Subject: [PATCH 466/770] implement touch alarm --- locale/circuitpython.pot | 3 +- ports/esp32s2/common-hal/alarm/__init__.c | 18 ++++-- .../common-hal/alarm/touch/TouchAlarm.c | 49 ++++++++++++++ .../common-hal/alarm/touch/TouchAlarm.h | 45 +++++++++++++ py/circuitpy_defns.mk | 1 + shared-bindings/alarm/__init__.c | 17 ++++- shared-bindings/alarm/touch/TouchAlarm.c | 64 +++++++++++++++++++ shared-bindings/alarm/touch/TouchAlarm.h | 40 ++++++++++++ 8 files changed, 229 insertions(+), 8 deletions(-) create mode 100644 ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c create mode 100644 ports/esp32s2/common-hal/alarm/touch/TouchAlarm.h create mode 100644 shared-bindings/alarm/touch/TouchAlarm.c create mode 100644 shared-bindings/alarm/touch/TouchAlarm.h diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index d64cff18591d9..63407f52b8a9c 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-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-18 12:42+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1144,6 +1144,7 @@ msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c #: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index fae921db0b0bc..6fbad952ffe0e 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -29,11 +29,13 @@ #include "py/objtuple.h" #include "py/runtime.h" -#include "shared-bindings/alarm/pin/PinAlarm.h" #include "shared-bindings/alarm/SleepMemory.h" +#include "shared-bindings/alarm/pin/PinAlarm.h" #include "shared-bindings/alarm/time/TimeAlarm.h" -#include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/alarm/touch/TouchAlarm.h" + #include "shared-bindings/wifi/__init__.h" +#include "shared-bindings/microcontroller/__init__.h" #include "supervisor/port.h" #include "supervisor/shared/workflow.h" @@ -49,10 +51,10 @@ const alarm_sleep_memory_obj_t alarm_sleep_memory_obj = { }, }; - void alarm_reset(void) { - alarm_time_timealarm_reset(); alarm_sleep_memory_reset(); + alarm_time_timealarm_reset(); + alarm_touch_touchalarm_reset(); esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL); } @@ -60,6 +62,9 @@ STATIC esp_sleep_wakeup_cause_t _get_wakeup_cause(void) { if (alarm_time_timealarm_woke_us_up()) { return ESP_SLEEP_WAKEUP_TIMER; } + if (alarm_touch_touchalarm_woke_us_up()) { + return ESP_SLEEP_WAKEUP_TOUCHPAD; + } return esp_sleep_get_wakeup_cause(); } @@ -80,8 +85,7 @@ STATIC mp_obj_t _get_wake_alarm(size_t n_alarms, const mp_obj_t *alarms) { } case ESP_SLEEP_WAKEUP_TOUCHPAD: - // TODO: implement TouchIO - // Wake up from touch on pad, esp_sleep_get_touchpad_wakeup_status() + return alarm_touch_touchalarm_get_wakeup_alarm(n_alarms, alarms); break; case ESP_SLEEP_WAKEUP_UNDEFINED: @@ -110,6 +114,8 @@ STATIC void _setup_sleep_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t } time_alarm = MP_OBJ_TO_PTR(alarms[i]); time_alarm_set = true; + } else if (MP_OBJ_IS_TYPE(alarms[i], &alarm_touch_touchalarm_type)) { + alarm_touch_touchalarm_set_alarm(MP_OBJ_TO_PTR(alarms[i])); } } diff --git a/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c b/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c new file mode 100644 index 0000000000000..b660e90c0fc5d --- /dev/null +++ b/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c @@ -0,0 +1,49 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * 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 "shared-bindings/alarm/touch/TouchAlarm.h" + +#include "esp_sleep.h" + +void common_hal_alarm_touch_touchalarm_construct(alarm_touch_touchalarm_obj_t *self, const mcu_pin_obj_t *pin) { + +} + +mp_obj_t alarm_touch_touchalarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms) { + return mp_const_none; +} + +void alarm_touch_touchalarm_set_alarm(alarm_touch_touchalarm_obj_t *self) { + +} + +bool alarm_touch_touchalarm_woke_us_up(void) { + return false; +} + +void alarm_touch_touchalarm_reset(void) { + +} diff --git a/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.h b/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.h new file mode 100644 index 0000000000000..11643945d671c --- /dev/null +++ b/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.h @@ -0,0 +1,45 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_COMMON_HAL_ALARM_TOUCH_TOUCHALARM_H +#define MICROPY_INCLUDED_COMMON_HAL_ALARM_TOUCH_TOUCHALARM_H + +#include "py/obj.h" +#include "common-hal/microcontroller/Pin.h" + +typedef struct { + mp_obj_base_t base; + const mcu_pin_obj_t *pin; +} alarm_touch_touchalarm_obj_t; + +// Find the alarm object that caused us to wake up or create an equivalent one. +mp_obj_t alarm_touch_touchalarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms); +// Check for the wake up alarm from pretend deep sleep. +void alarm_touch_touchalarm_set_alarm(alarm_touch_touchalarm_obj_t *self); +bool alarm_touch_touchalarm_woke_us_up(void); +void alarm_touch_touchalarm_reset(void); + +#endif // MICROPY_INCLUDED_COMMON_HAL_ALARM_TOUCH_TOUCHALARM_H diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 1eafce2595f96..a36600d62b13a 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -308,6 +308,7 @@ SRC_COMMON_HAL_ALL = \ alarm/__init__.c \ alarm/pin/PinAlarm.c \ alarm/time/TimeAlarm.c \ + alarm/touch/TouchAlarm.c \ analogio/AnalogIn.c \ analogio/AnalogOut.c \ analogio/__init__.c \ diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 700fe020ea6ae..526f5453d1c3d 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -32,6 +32,7 @@ #include "shared-bindings/alarm/SleepMemory.h" #include "shared-bindings/alarm/pin/PinAlarm.h" #include "shared-bindings/alarm/time/TimeAlarm.h" +#include "shared-bindings/alarm/touch/TouchAlarm.h" #include "shared-bindings/supervisor/Runtime.h" #include "shared-bindings/time/__init__.h" #include "supervisor/shared/autoreload.h" @@ -72,7 +73,8 @@ void validate_objs_are_alarms(size_t n_args, const mp_obj_t *objs) { for (size_t i = 0; i < n_args; i++) { if (MP_OBJ_IS_TYPE(objs[i], &alarm_pin_pin_alarm_type) || - MP_OBJ_IS_TYPE(objs[i], &alarm_time_time_alarm_type)) { + MP_OBJ_IS_TYPE(objs[i], &alarm_time_time_alarm_type) || + MP_OBJ_IS_TYPE(objs[i], &alarm_touch_touchalarm_type)) { continue; } mp_raise_TypeError_varg(translate("Expected an alarm")); @@ -182,6 +184,18 @@ STATIC const mp_obj_module_t alarm_time_module = { .globals = (mp_obj_dict_t*)&alarm_time_globals, }; +STATIC const mp_map_elem_t alarm_touch_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_touch) }, + { MP_ROM_QSTR(MP_QSTR_TouchAlarm), MP_OBJ_FROM_PTR(&alarm_touch_touchalarm_type) }, +}; + +STATIC MP_DEFINE_CONST_DICT(alarm_touch_globals, alarm_touch_globals_table); + +STATIC const mp_obj_module_t alarm_touch_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&alarm_touch_globals, +}; + // The module table is mutable because .wake_alarm is a mutable attribute. STATIC mp_map_elem_t alarm_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_alarm) }, @@ -195,6 +209,7 @@ STATIC mp_map_elem_t alarm_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_pin), MP_OBJ_FROM_PTR(&alarm_pin_module) }, { MP_ROM_QSTR(MP_QSTR_time), MP_OBJ_FROM_PTR(&alarm_time_module) }, + { MP_ROM_QSTR(MP_QSTR_touch), MP_OBJ_FROM_PTR(&alarm_touch_module) }, { MP_ROM_QSTR(MP_QSTR_SleepMemory), MP_OBJ_FROM_PTR(&alarm_sleep_memory_type) }, { MP_ROM_QSTR(MP_QSTR_sleep_memory), MP_OBJ_FROM_PTR(&alarm_sleep_memory_obj) }, diff --git a/shared-bindings/alarm/touch/TouchAlarm.c b/shared-bindings/alarm/touch/TouchAlarm.c new file mode 100644 index 0000000000000..8ee1bc75ae339 --- /dev/null +++ b/shared-bindings/alarm/touch/TouchAlarm.c @@ -0,0 +1,64 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * 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 "shared-bindings/alarm/touch/TouchAlarm.h" +#include "shared-bindings/board/__init__.h" + +//| class TouchAlarm: +//| """Trigger an alarm when touch is detected.""" +//| +//| def __init__(self, *pin: microcontroller.Pin) -> None: +//| """Create an alarm that will be triggered when the +//| given pin is touched. +//| +//| """ +//| ... +//| +STATIC mp_obj_t alarm_touch_touchalarm_make_new(const mp_obj_type_t *type, + mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + alarm_touch_touchalarm_obj_t *self = m_new_obj(alarm_touch_touchalarm_obj_t); + self->base.type = &alarm_touch_touchalarm_type; + + enum { ARG_pin }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_pin, MP_ARG_REQUIRED | MP_ARG_OBJ }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj); + + common_hal_alarm_touch_touchalarm_construct(self, pin); + + return MP_OBJ_FROM_PTR(self); +} + +const mp_obj_type_t alarm_touch_touchalarm_type = { + { &mp_type_type }, + .name = MP_QSTR_TouchAlarm, + .make_new = alarm_touch_touchalarm_make_new, +}; diff --git a/shared-bindings/alarm/touch/TouchAlarm.h b/shared-bindings/alarm/touch/TouchAlarm.h new file mode 100644 index 0000000000000..1b70d4dae5084 --- /dev/null +++ b/shared-bindings/alarm/touch/TouchAlarm.h @@ -0,0 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TOUCH_TOUCHALARM_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TOUCH_TOUCHALARM_H + +#include "py/obj.h" +#include "py/runtime.h" + +#include "common-hal/microcontroller/Pin.h" +#include "common-hal/alarm/touch/TouchAlarm.h" + +extern const mp_obj_type_t alarm_touch_touchalarm_type; + +extern void common_hal_alarm_touch_touchalarm_construct(alarm_touch_touchalarm_obj_t *self, const mcu_pin_obj_t *pin); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TOUCH_TOUCHALARM_H From 6c4df5a8b45c6b20e00b5499c5db1d4f5da444a2 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 18 Dec 2020 11:13:28 -0600 Subject: [PATCH 467/770] adafruit_bus_device: Don't transmit STOP condition in write_then_readinto Closes #3795 --- shared-bindings/adafruit_bus_device/I2CDevice.c | 8 ++++---- shared-bindings/adafruit_bus_device/I2CDevice.h | 2 +- shared-module/adafruit_bus_device/I2CDevice.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/shared-bindings/adafruit_bus_device/I2CDevice.c b/shared-bindings/adafruit_bus_device/I2CDevice.c index 4c9086162deac..a4c04e198c805 100644 --- a/shared-bindings/adafruit_bus_device/I2CDevice.c +++ b/shared-bindings/adafruit_bus_device/I2CDevice.c @@ -163,7 +163,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(adafruit_bus_device_i2cdevice_readinto_obj, 2, //| """ //| ... //| -STATIC void write(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, int32_t start, mp_int_t end) { +STATIC void write(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, int32_t start, mp_int_t end, bool transmit_stop_bit) { mp_buffer_info_t bufinfo; mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_READ); @@ -173,7 +173,7 @@ STATIC void write(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, in mp_raise_ValueError(translate("Buffer must be at least length 1")); } - uint8_t status = common_hal_adafruit_bus_device_i2cdevice_write(MP_OBJ_TO_PTR(self), ((uint8_t*)bufinfo.buf) + start, length); + uint8_t status = common_hal_adafruit_bus_device_i2cdevice_write(MP_OBJ_TO_PTR(self), ((uint8_t*)bufinfo.buf) + start, length, transmit_stop_bit); if (status != 0) { mp_raise_OSError(status); } @@ -191,7 +191,7 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_write(size_t n_args, const mp_obj_ mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - write(self, args[ARG_buffer].u_obj, args[ARG_start].u_int, args[ARG_end].u_int); + write(self, args[ARG_buffer].u_obj, args[ARG_start].u_int, args[ARG_end].u_int, true); return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_KW(adafruit_bus_device_i2cdevice_write_obj, 2, adafruit_bus_device_i2cdevice_write); @@ -233,7 +233,7 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_write_then_readinto(size_t n_args, mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - write(self, args[ARG_out_buffer].u_obj, args[ARG_out_start].u_int, args[ARG_out_end].u_int); + write(self, args[ARG_out_buffer].u_obj, args[ARG_out_start].u_int, args[ARG_out_end].u_int, false); readinto(self, args[ARG_in_buffer].u_obj, args[ARG_in_start].u_int, args[ARG_in_end].u_int); diff --git a/shared-bindings/adafruit_bus_device/I2CDevice.h b/shared-bindings/adafruit_bus_device/I2CDevice.h index 7b2182ff03ad6..cf7b1321a080e 100644 --- a/shared-bindings/adafruit_bus_device/I2CDevice.h +++ b/shared-bindings/adafruit_bus_device/I2CDevice.h @@ -45,7 +45,7 @@ extern const mp_obj_type_t adafruit_bus_device_i2cdevice_type; // Initializes the hardware peripheral. extern void common_hal_adafruit_bus_device_i2cdevice_construct(adafruit_bus_device_i2cdevice_obj_t *self, busio_i2c_obj_t *i2c, uint8_t device_address); extern uint8_t common_hal_adafruit_bus_device_i2cdevice_readinto(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length); -extern uint8_t common_hal_adafruit_bus_device_i2cdevice_write(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length); +extern uint8_t common_hal_adafruit_bus_device_i2cdevice_write(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length, bool transmit_stop_bit); extern void common_hal_adafruit_bus_device_i2cdevice_lock(adafruit_bus_device_i2cdevice_obj_t *self); extern void common_hal_adafruit_bus_device_i2cdevice_unlock(adafruit_bus_device_i2cdevice_obj_t *self); extern void common_hal_adafruit_bus_device_i2cdevice_probe_for_device(adafruit_bus_device_i2cdevice_obj_t *self); diff --git a/shared-module/adafruit_bus_device/I2CDevice.c b/shared-module/adafruit_bus_device/I2CDevice.c index ee4b4fa554e74..83abe80d649c0 100644 --- a/shared-module/adafruit_bus_device/I2CDevice.c +++ b/shared-module/adafruit_bus_device/I2CDevice.c @@ -57,8 +57,8 @@ uint8_t common_hal_adafruit_bus_device_i2cdevice_readinto(adafruit_bus_device_i2 return common_hal_busio_i2c_read(self->i2c, self->device_address, buffer, length); } -uint8_t common_hal_adafruit_bus_device_i2cdevice_write(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length) { - return common_hal_busio_i2c_write(self->i2c, self->device_address, buffer, length, true); +uint8_t common_hal_adafruit_bus_device_i2cdevice_write(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length, bool transmit_stop_bit) { + return common_hal_busio_i2c_write(self->i2c, self->device_address, buffer, length, transmit_stop_bit); } void common_hal_adafruit_bus_device_i2cdevice_probe_for_device(adafruit_bus_device_i2cdevice_obj_t *self) { From a60fabdffa6b7a06e6a5ad2278fe225f086f704a Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Sat, 19 Dec 2020 12:56:34 +0530 Subject: [PATCH 468/770] add touch alarm support for esp32s2 --- ports/esp32s2/Makefile | 1 + ports/esp32s2/common-hal/alarm/__init__.c | 1 + .../common-hal/alarm/touch/TouchAlarm.c | 62 ++++++++++++++++++- .../common-hal/alarm/touch/TouchAlarm.h | 1 + ports/esp32s2/common-hal/touchio/TouchIn.c | 22 ++----- ports/esp32s2/common-hal/touchio/TouchIn.h | 5 +- ports/esp32s2/peripherals/touch.c | 46 ++++++++++++++ ports/esp32s2/peripherals/touch.h | 35 +++++++++++ ports/esp32s2/supervisor/port.c | 4 +- 9 files changed, 150 insertions(+), 27 deletions(-) create mode 100644 ports/esp32s2/peripherals/touch.c create mode 100644 ports/esp32s2/peripherals/touch.h diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 01f8f48a78ee4..3291c7fac6bcf 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -192,6 +192,7 @@ SRC_C += \ lib/utils/sys_stdio_mphal.c \ lib/netutils/netutils.c \ peripherals/timer.c \ + peripherals/touch.c \ peripherals/pcnt.c \ peripherals/pins.c \ peripherals/rmt.c \ diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index 6fbad952ffe0e..bdac2edc60e80 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -162,6 +162,7 @@ void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *ala } void NORETURN alarm_enter_deep_sleep(void) { + alarm_touch_touchalarm_prepare_for_deep_sleep(); // The ESP-IDF caches the deep sleep settings and applies them before sleep. // We don't need to worry about resetting them in the interim. esp_deep_sleep_start(); diff --git a/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c b/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c index b660e90c0fc5d..56085c529575d 100644 --- a/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +++ b/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c @@ -25,19 +25,75 @@ */ #include "shared-bindings/alarm/touch/TouchAlarm.h" +#include "shared-bindings/microcontroller/__init__.h" + +#include "peripherals/touch.h" #include "esp_sleep.h" void common_hal_alarm_touch_touchalarm_construct(alarm_touch_touchalarm_obj_t *self, const mcu_pin_obj_t *pin) { - + if (pin->touch_channel == TOUCH_PAD_MAX) { + mp_raise_ValueError(translate("Invalid pin")); + } + self->pin = pin; } mp_obj_t alarm_touch_touchalarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms) { - return mp_const_none; + // First, check to see if we match any given alarms. + for (size_t i = 0; i < n_alarms; i++) { + if (MP_OBJ_IS_TYPE(alarms[i], &alarm_touch_touchalarm_type)) { + return alarms[i]; + } + } + + gpio_num_t pin_number = esp_sleep_get_touchpad_wakeup_status(); + + alarm_touch_touchalarm_obj_t *alarm = m_new_obj(alarm_touch_touchalarm_obj_t); + alarm->base.type = &alarm_touch_touchalarm_type; + alarm->pin = NULL; + + // Map the pin number back to a pin object. + for (size_t i = 0; i < mcu_pin_globals.map.used; i++) { + const mcu_pin_obj_t* pin_obj = MP_OBJ_TO_PTR(mcu_pin_globals.map.table[i].value); + if (pin_obj->number == pin_number) { + alarm->pin = mcu_pin_globals.map.table[i].value; + break; + } + } + + return alarm; } +static uint16_t sleep_touch_pin; + void alarm_touch_touchalarm_set_alarm(alarm_touch_touchalarm_obj_t *self) { + sleep_touch_pin |= 1 << self->pin->number; + esp_sleep_enable_touchpad_wakeup(); + esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON); +} + +static void configure_sleep_touch_pin(touch_pad_t touch_channel) { + // intialize touchpad + peripherals_touch_init(touch_channel); + + // configure touchpad for sleep + touch_pad_sleep_channel_enable(touch_channel, true); + touch_pad_sleep_channel_enable_proximity(touch_channel, false); + + // wait for touch data to reset + mp_hal_delay_ms(10); + uint32_t touch_value; + touch_pad_sleep_channel_read_smooth(touch_channel, &touch_value); + touch_pad_sleep_set_threshold(touch_channel, touch_value * 0.1); //10% +} + +void alarm_touch_touchalarm_prepare_for_deep_sleep(void) { + for (uint8_t i = 1; i <= 14; i++) { + if ((sleep_touch_pin & 1 << i) != 0) { + configure_sleep_touch_pin((touch_pad_t)i); + } + } } bool alarm_touch_touchalarm_woke_us_up(void) { @@ -45,5 +101,5 @@ bool alarm_touch_touchalarm_woke_us_up(void) { } void alarm_touch_touchalarm_reset(void) { - + sleep_touch_pin = 0; } diff --git a/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.h b/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.h index 11643945d671c..aa1c27fea8b1e 100644 --- a/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.h +++ b/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.h @@ -39,6 +39,7 @@ typedef struct { mp_obj_t alarm_touch_touchalarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms); // Check for the wake up alarm from pretend deep sleep. void alarm_touch_touchalarm_set_alarm(alarm_touch_touchalarm_obj_t *self); +void alarm_touch_touchalarm_prepare_for_deep_sleep(void); bool alarm_touch_touchalarm_woke_us_up(void); void alarm_touch_touchalarm_reset(void); diff --git a/ports/esp32s2/common-hal/touchio/TouchIn.c b/ports/esp32s2/common-hal/touchio/TouchIn.c index b27cbcf86d67a..afce8e72d1d7a 100644 --- a/ports/esp32s2/common-hal/touchio/TouchIn.c +++ b/ports/esp32s2/common-hal/touchio/TouchIn.c @@ -28,15 +28,7 @@ #include "py/runtime.h" #include "driver/touch_pad.h" - -bool touch_inited = false; - -void touchin_reset(void) { - if (touch_inited) { - touch_pad_deinit(); - touch_inited = false; - } -} +#include "peripherals/touch.h" static uint16_t get_raw_reading(touchio_touchin_obj_t *self) { uint32_t touch_value; @@ -54,16 +46,10 @@ void common_hal_touchio_touchin_construct(touchio_touchin_obj_t* self, } claim_pin(pin); - if (!touch_inited) { - touch_pad_init(); - touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER); - touch_pad_fsm_start(); - touch_inited = true; - } - - touch_pad_config((touch_pad_t)pin->touch_channel); + // initialize touchpad + peripherals_touch_init((touch_pad_t)pin->touch_channel); - // wait for "raw data" to reset + // wait for touch data to reset mp_hal_delay_ms(10); // Initial values for pins will vary, depending on what peripherals the pins diff --git a/ports/esp32s2/common-hal/touchio/TouchIn.h b/ports/esp32s2/common-hal/touchio/TouchIn.h index 91de209316f34..2f7c66d2b855f 100644 --- a/ports/esp32s2/common-hal/touchio/TouchIn.h +++ b/ports/esp32s2/common-hal/touchio/TouchIn.h @@ -27,9 +27,8 @@ #ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_TOUCHIO_TOUCHIN_H #define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_TOUCHIO_TOUCHIN_H -#include "common-hal/microcontroller/Pin.h" - #include "py/obj.h" +#include "common-hal/microcontroller/Pin.h" typedef struct { mp_obj_base_t base; @@ -37,6 +36,4 @@ typedef struct { uint16_t threshold; } touchio_touchin_obj_t; -void touchin_reset(void); - #endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_TOUCHIO_TOUCHIN_H diff --git a/ports/esp32s2/peripherals/touch.c b/ports/esp32s2/peripherals/touch.c new file mode 100644 index 0000000000000..3f496adddd9bf --- /dev/null +++ b/ports/esp32s2/peripherals/touch.c @@ -0,0 +1,46 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * 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 "peripherals/touch.h" + +static bool touch_inited = false; + +void peripherals_touch_reset(void) { + if (touch_inited) { + touch_pad_deinit(); + touch_inited = false; + } +} + +void peripherals_touch_init(touch_pad_t touchpad) { + if (!touch_inited) { + touch_pad_init(); + touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER); + touch_pad_fsm_start(); + touch_inited = true; + } + touch_pad_config(touchpad); +} diff --git a/ports/esp32s2/peripherals/touch.h b/ports/esp32s2/peripherals/touch.h new file mode 100644 index 0000000000000..d9e0bd5fc2bcc --- /dev/null +++ b/ports/esp32s2/peripherals/touch.h @@ -0,0 +1,35 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_PERIPHERALS_TOUCH_HANDLER_H +#define MICROPY_INCLUDED_ESP32S2_PERIPHERALS_TOUCH_HANDLER_H + +#include "driver/touch_pad.h" + +extern void peripherals_touch_reset(void); +extern void peripherals_touch_init(touch_pad_t touchpad); + +#endif // MICROPY_INCLUDED_ESP32S2_PERIPHERALS_TOUCH_HANDLER_H diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 7037b4f05132f..4dc985cfe4c9c 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -44,7 +44,6 @@ #include "common-hal/ps2io/Ps2.h" #include "common-hal/pulseio/PulseIn.h" #include "common-hal/pwmio/PWMOut.h" -#include "common-hal/touchio/TouchIn.h" #include "common-hal/watchdog/WatchDogTimer.h" #include "common-hal/wifi/__init__.h" #include "supervisor/memory.h" @@ -54,6 +53,7 @@ #include "peripherals/rmt.h" #include "peripherals/pcnt.h" #include "peripherals/timer.h" +#include "peripherals/touch.h" #include "components/esp_rom/include/esp_rom_uart.h" #include "components/heap/include/esp_heap_caps.h" #include "components/xtensa/include/esp_debug_helpers.h" @@ -164,7 +164,7 @@ void reset_port(void) { #endif #if CIRCUITPY_TOUCHIO_USE_NATIVE - touchin_reset(); + peripherals_touch_reset(); #endif #if CIRCUITPY_WATCHDOG From ecd7c0878eaf7038317c5c59c6040f588093fa69 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Sat, 19 Dec 2020 20:54:36 +0530 Subject: [PATCH 469/770] expose wake pin parameter and more tweaks --- locale/circuitpython.pot | 10 +++++- ports/esp32s2/common-hal/alarm/__init__.c | 12 ++++++- .../common-hal/alarm/touch/TouchAlarm.c | 17 +++------- shared-bindings/alarm/touch/TouchAlarm.c | 31 +++++++++++++++++-- 4 files changed, 54 insertions(+), 16 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 63407f52b8a9c..593e955f2c097 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-12-18 12:42+0530\n" +"POT-Creation-Date: 2020-12-18 20:40+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1463,6 +1463,10 @@ msgstr "" msgid "Only one alarm.time alarm can be set." msgstr "" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "Only one alarm.touch alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "" @@ -1837,6 +1841,10 @@ msgstr "" msgid "Total data to write is larger than outgoing_packet_length" msgstr "" +#: ports/esp32s2/common-hal/alarm/__init__.c +msgid "TouchAlarm not available in light sleep" +msgstr "" + #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "" diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index bdac2edc60e80..79c245704713b 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -103,6 +103,7 @@ mp_obj_t common_hal_alarm_get_wake_alarm(void) { // Set up light sleep or deep sleep alarms. STATIC void _setup_sleep_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms) { bool time_alarm_set = false; + bool touch_alarm_set = false; alarm_time_time_alarm_obj_t *time_alarm = MP_OBJ_NULL; for (size_t i = 0; i < n_alarms; i++) { @@ -115,7 +116,16 @@ STATIC void _setup_sleep_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t time_alarm = MP_OBJ_TO_PTR(alarms[i]); time_alarm_set = true; } else if (MP_OBJ_IS_TYPE(alarms[i], &alarm_touch_touchalarm_type)) { - alarm_touch_touchalarm_set_alarm(MP_OBJ_TO_PTR(alarms[i])); + if (!touch_alarm_set) { + if (deep_sleep) { + alarm_touch_touchalarm_set_alarm(MP_OBJ_TO_PTR(alarms[i])); + touch_alarm_set = true; + } else { + mp_raise_NotImplementedError(translate("TouchAlarm not available in light sleep")); + } + } else { + mp_raise_ValueError(translate("Only one alarm.touch alarm can be set.")); + } } } diff --git a/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c b/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c index 56085c529575d..a2fda8e781d9a 100644 --- a/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +++ b/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c @@ -35,6 +35,7 @@ void common_hal_alarm_touch_touchalarm_construct(alarm_touch_touchalarm_obj_t *s if (pin->touch_channel == TOUCH_PAD_MAX) { mp_raise_ValueError(translate("Invalid pin")); } + claim_pin(pin); self->pin = pin; } @@ -64,15 +65,15 @@ mp_obj_t alarm_touch_touchalarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t return alarm; } -static uint16_t sleep_touch_pin; +static touch_pad_t touch_channel = TOUCH_PAD_MAX; void alarm_touch_touchalarm_set_alarm(alarm_touch_touchalarm_obj_t *self) { - sleep_touch_pin |= 1 << self->pin->number; + touch_channel = (touch_pad_t)self->pin->number; esp_sleep_enable_touchpad_wakeup(); esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON); } -static void configure_sleep_touch_pin(touch_pad_t touch_channel) { +void alarm_touch_touchalarm_prepare_for_deep_sleep(void) { // intialize touchpad peripherals_touch_init(touch_channel); @@ -88,18 +89,10 @@ static void configure_sleep_touch_pin(touch_pad_t touch_channel) { touch_pad_sleep_set_threshold(touch_channel, touch_value * 0.1); //10% } -void alarm_touch_touchalarm_prepare_for_deep_sleep(void) { - for (uint8_t i = 1; i <= 14; i++) { - if ((sleep_touch_pin & 1 << i) != 0) { - configure_sleep_touch_pin((touch_pad_t)i); - } - } -} - bool alarm_touch_touchalarm_woke_us_up(void) { return false; } void alarm_touch_touchalarm_reset(void) { - sleep_touch_pin = 0; + touch_channel = TOUCH_PAD_MAX; } diff --git a/shared-bindings/alarm/touch/TouchAlarm.c b/shared-bindings/alarm/touch/TouchAlarm.c index 8ee1bc75ae339..4259b71bdf2f5 100644 --- a/shared-bindings/alarm/touch/TouchAlarm.c +++ b/shared-bindings/alarm/touch/TouchAlarm.c @@ -27,13 +27,18 @@ #include "shared-bindings/alarm/touch/TouchAlarm.h" #include "shared-bindings/board/__init__.h" +#include "py/objproperty.h" + //| class TouchAlarm: //| """Trigger an alarm when touch is detected.""" //| //| def __init__(self, *pin: microcontroller.Pin) -> None: -//| """Create an alarm that will be triggered when the -//| given pin is touched. +//| """Create an alarm that will be triggered when the given pin is touched. +//| The alarm is not active until it is passed to an `alarm`-enabling function, such as +//| `alarm.light_sleep_until_alarms()` or `alarm.exit_and_deep_sleep_until_alarms()`. //| +//| :param microcontroller.Pin pin: The pin to monitor. On some ports, the choice of pin +//| may be limited due to hardware restrictions, particularly for deep-sleep alarms. //| """ //| ... //| @@ -57,8 +62,30 @@ STATIC mp_obj_t alarm_touch_touchalarm_make_new(const mp_obj_type_t *type, return MP_OBJ_FROM_PTR(self); } +//| pin: microcontroller.Pin +//| """The trigger pin.""" +//| +STATIC mp_obj_t alarm_touch_touchalarm_obj_get_pin(mp_obj_t self_in) { + alarm_touch_touchalarm_obj_t *self = MP_OBJ_TO_PTR(self_in); + return MP_OBJ_FROM_PTR(self->pin); +} +MP_DEFINE_CONST_FUN_OBJ_1(alarm_touch_touchalarm_get_pin_obj, alarm_touch_touchalarm_obj_get_pin); + +const mp_obj_property_t alarm_touch_touchalarm_pin_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&alarm_touch_touchalarm_get_pin_obj, + (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +STATIC const mp_rom_map_elem_t alarm_touch_touchalarm_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_pin), MP_ROM_PTR(&alarm_touch_touchalarm_pin_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(alarm_touch_touchalarm_locals_dict, alarm_touch_touchalarm_locals_dict_table); + const mp_obj_type_t alarm_touch_touchalarm_type = { { &mp_type_type }, .name = MP_QSTR_TouchAlarm, .make_new = alarm_touch_touchalarm_make_new, + .locals_dict = (mp_obj_t)&alarm_touch_touchalarm_locals_dict, }; From c875d7c22d447b9a29bcef62af7b46c902684d72 Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Sat, 19 Dec 2020 19:06:43 -0800 Subject: [PATCH 470/770] speedup pack_bin, ext, str; catch short reads --- shared-module/msgpack/__init__.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/shared-module/msgpack/__init__.c b/shared-module/msgpack/__init__.c index 204312109a46f..39178d46e1b15 100644 --- a/shared-module/msgpack/__init__.c +++ b/shared-module/msgpack/__init__.c @@ -67,6 +67,9 @@ STATIC void read(msgpack_stream_t *s, void *buf, mp_uint_t size) { if (ret == 0) { mp_raise_msg(&mp_type_EOFError, NULL); } + if (ret < size) { + mp_raise_ValueError(translate("short read")); + } } STATIC uint8_t read1(msgpack_stream_t *s) { @@ -92,7 +95,7 @@ STATIC uint32_t read4(msgpack_stream_t *s) { } STATIC size_t read_size(msgpack_stream_t *s, uint8_t len_index) { - size_t res; + size_t res = 0; switch (len_index) { case 0: res = (size_t)read1(s); break; case 1: res = (size_t)read2(s); break; @@ -181,9 +184,7 @@ STATIC void pack_int(msgpack_stream_t *s, int32_t x) { STATIC void pack_bin(msgpack_stream_t *s, const uint8_t* data, size_t len) { write_size(s, 0xc4, len); - for (size_t i=0; i 0) write(s, data, len); } STATIC void pack_ext(msgpack_stream_t *s, int8_t code, const uint8_t* data, size_t len) { @@ -201,9 +202,7 @@ STATIC void pack_ext(msgpack_stream_t *s, int8_t code, const uint8_t* data, siz write_size(s, 0xc7, len); } write1(s, code); // type byte - for (size_t i=0; i 0) write(s, data, len); } STATIC void pack_str(msgpack_stream_t *s, const char* str, size_t len) { @@ -212,9 +211,7 @@ STATIC void pack_str(msgpack_stream_t *s, const char* str, size_t len) { } else { write_size(s, 0xd9, len); } - for (size_t l=0; l 0) write(s, str, len); } STATIC void pack_array(msgpack_stream_t *s, size_t len) { From 88b1e2fe61d68c4a4d2ef9e48147c20a929e779e Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Sun, 20 Dec 2020 13:35:15 -0600 Subject: [PATCH 471/770] remove Internal flash unnecessary --- ports/nrf/boards/bastble/mpconfigboard.mk | 2 -- ports/nrf/boards/bastble/pins.c | 1 - 2 files changed, 3 deletions(-) diff --git a/ports/nrf/boards/bastble/mpconfigboard.mk b/ports/nrf/boards/bastble/mpconfigboard.mk index 0e01c4d0f36e7..eca900de775fa 100644 --- a/ports/nrf/boards/bastble/mpconfigboard.mk +++ b/ports/nrf/boards/bastble/mpconfigboard.mk @@ -5,8 +5,6 @@ USB_MANUFACTURER = "ElectronicCats" MCU_CHIP = nrf52840 -INTERNAL_FLASH_FILESYSTEM = 1 - QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICE_COUNT = 1 EXTERNAL_FLASH_DEVICES = "GD25Q16C" diff --git a/ports/nrf/boards/bastble/pins.c b/ports/nrf/boards/bastble/pins.c index 6e4cc511b03db..b35dad43de946 100644 --- a/ports/nrf/boards/bastble/pins.c +++ b/ports/nrf/boards/bastble/pins.c @@ -36,7 +36,6 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { // voltage sense battery { MP_ROM_QSTR(MP_QSTR_VBAT), MP_ROM_PTR(&pin_P0_26) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_10) }, { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_09) }, From bd3c5c33fb0d49f420410e3a949a093d235db81c Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Sun, 20 Dec 2020 14:57:10 -0600 Subject: [PATCH 472/770] define QSPI pinout --- ports/nrf/boards/bastble/mpconfigboard.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ports/nrf/boards/bastble/mpconfigboard.h b/ports/nrf/boards/bastble/mpconfigboard.h index 67a62e915bd0d..e36227c6bc20d 100644 --- a/ports/nrf/boards/bastble/mpconfigboard.h +++ b/ports/nrf/boards/bastble/mpconfigboard.h @@ -5,6 +5,15 @@ #define CIRCUITPY_AUTORELOAD_DELAY_MS 500 +#if QSPI_FLASH_FILESYSTEM +#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 30) +#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 29) +#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 28) +#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 2) +#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 3) +#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 26) +#endif + #define DEFAULT_I2C_BUS_SCL (&pin_P1_10) #define DEFAULT_I2C_BUS_SDA (&pin_P1_11) From 2e393ed1957dae806c8e98e68bbcb82f1fa1ffdb Mon Sep 17 00:00:00 2001 From: BennyE Date: Sun, 20 Dec 2020 22:03:38 +0100 Subject: [PATCH 473/770] adding debug infos --- ports/esp32s2/common-hal/wifi/Radio.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index 49cb8ec30f489..1a242da058c82 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -42,6 +42,10 @@ #define MAC_ADDRESS_LENGTH 6 +#include "components/log/include/esp_log.h" + +static const char* TAG = "wifi"; + static void start_station(wifi_radio_obj_t *self) { if (self->sta_mode) { return; @@ -194,6 +198,19 @@ mp_obj_t common_hal_wifi_radio_get_ap_info(wifi_radio_obj_t *self) { if (esp_wifi_sta_get_ap_info(&self->ap_info.record) != ESP_OK){ return mp_const_none; } else { + ESP_EARLY_LOGW(TAG, "ssid: %s", self->ap_info.record.ssid); + ESP_EARLY_LOGW(TAG, "channel: %d", self->ap_info.record.primary); + ESP_EARLY_LOGW(TAG, "secondary: %d", self->ap_info.record.second); + ESP_EARLY_LOGW(TAG, "rssi: %d", self->ap_info.record.rssi); + ESP_EARLY_LOGW(TAG, "authmode: %d", self->ap_info.record.authmode); + ESP_EARLY_LOGW(TAG, "pairwise_cipher: %d", self->ap_info.record.pairwise_cipher); + ESP_EARLY_LOGW(TAG, "group_cipher: %d", self->ap_info.record.group_cipher); + ESP_EARLY_LOGW(TAG, "11b: %d", self->ap_info.record.phy_11b); + ESP_EARLY_LOGW(TAG, "11g: %d", self->ap_info.record.phy_11g); + ESP_EARLY_LOGW(TAG, "11n: %d", self->ap_info.record.phy_11n); + ESP_EARLY_LOGW(TAG, "phy_lr: %d", self->ap_info.record.phy_lr); + ESP_EARLY_LOGW(TAG, "country: %s", self->ap_info.record.country); + ESP_EARLY_LOGW(TAG, "countryCC: %s", self->ap_info.record.country.cc); memcpy(&ap_info->record, &self->ap_info.record, sizeof(wifi_ap_record_t)); return MP_OBJ_FROM_PTR(ap_info); } From d24a5d62700252a49152ed2bc6af0b9b3025344e Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Sun, 20 Dec 2020 15:52:19 -0600 Subject: [PATCH 474/770] update path board.h --- ports/nrf/boards/bastble/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/nrf/boards/bastble/board.c b/ports/nrf/boards/bastble/board.c index 7c42cee57da98..b6fb04f06c48d 100644 --- a/ports/nrf/boards/bastble/board.c +++ b/ports/nrf/boards/bastble/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "nrf.h" #include "nrf_rtc.h" From 32736dd2c33430d934878f4bbce0a04b48ca22ac Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Mon, 14 Dec 2020 12:57:39 -0500 Subject: [PATCH 475/770] Implement server API --- ports/esp32s2/common-hal/socketpool/Socket.c | 169 +++++++++++++----- ports/esp32s2/common-hal/socketpool/Socket.h | 5 +- .../common-hal/socketpool/SocketPool.c | 29 ++- shared-bindings/socketpool/Socket.c | 153 ++++++---------- shared-bindings/socketpool/Socket.h | 5 + 5 files changed, 203 insertions(+), 158 deletions(-) diff --git a/ports/esp32s2/common-hal/socketpool/Socket.c b/ports/esp32s2/common-hal/socketpool/Socket.c index 32c5fc72f2fde..d92bed1d11350 100644 --- a/ports/esp32s2/common-hal/socketpool/Socket.c +++ b/ports/esp32s2/common-hal/socketpool/Socket.c @@ -4,6 +4,7 @@ * The MIT License (MIT) * * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2020 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 @@ -37,25 +38,87 @@ #include "components/lwip/lwip/src/include/lwip/sys.h" #include "components/lwip/lwip/src/include/lwip/netdb.h" +STATIC void _lazy_init_LWIP(socketpool_socket_obj_t* self) { + if (self->num != -1) { + return; //safe to call on existing socket + } + if (self->tls != NULL) { + mp_raise_RuntimeError(translate("Invalid use of TLS Socket")); + } + int socknum = -1; + socknum = lwip_socket(self->family, self->type, self->ipproto); + if (socknum < 0) { + mp_raise_RuntimeError(translate("Out of sockets")); + } + self->num = socknum; +} + +STATIC void _lazy_init_TLS(socketpool_socket_obj_t* self) { + if (self->type != SOCK_STREAM || self->num != -1) { + mp_raise_RuntimeError(translate("Invalid socket for TLS")); + } + esp_tls_t* tls_handle = esp_tls_init(); + if (tls_handle == NULL) { + mp_raise_espidf_MemoryError(); + } + self->tls = tls_handle; +} + void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t* self, mp_uint_t timeout_ms) { self->timeout_ms = timeout_ms; } -bool common_hal_socketpool_socket_connect(socketpool_socket_obj_t* self, const char* host, mp_uint_t hostlen, mp_int_t port) { +bool common_hal_socketpool_socket_bind(socketpool_socket_obj_t* self, + const char* host, size_t hostlen, uint8_t port) { + _lazy_init_LWIP(self); + + struct sockaddr_in bind_addr; + bind_addr.sin_addr.s_addr = inet_addr(host); + bind_addr.sin_family = AF_INET; + bind_addr.sin_port = htons(port); + + return lwip_bind(self->num, (struct sockaddr *)&bind_addr, sizeof(bind_addr)) == 0; +} + +bool common_hal_socketpool_socket_listen(socketpool_socket_obj_t* self, int backlog) { + return lwip_listen(self->num, backlog) == 0; +} + +int common_hal_socketpool_socket_accept(socketpool_socket_obj_t* self, + uint8_t* ip, uint *port) { + struct sockaddr_in accept_addr; + socklen_t socklen = sizeof(accept_addr); + int newsoc = lwip_accept(self->num, (struct sockaddr *)&accept_addr, &socklen); + + memcpy((void *)ip, (void*)&accept_addr.sin_addr.s_addr, sizeof(accept_addr.sin_addr.s_addr)); + *port = accept_addr.sin_port; + + if (newsoc > 0) { + return newsoc; + } else { + return 0; + } +} + +bool common_hal_socketpool_socket_connect(socketpool_socket_obj_t* self, + const char* host, mp_uint_t hostlen, mp_int_t port) { // For simplicity we use esp_tls for all TCP connections. If it's not SSL, ssl_context will be // NULL and should still work. This makes regular TCP connections more memory expensive but TLS // should become more and more common. Therefore, we optimize for the TLS case. + // Todo: move to SSL Wrapper and add lwip_connect() + _lazy_init_TLS(self); + esp_tls_cfg_t* tls_config = NULL; if (self->ssl_context != NULL) { tls_config = &self->ssl_context->ssl_config; } - int result = esp_tls_conn_new_sync(host, hostlen, port, tls_config, self->tcp); + int result = esp_tls_conn_new_sync(host, hostlen, port, tls_config, self->tls); self->connected = result >= 0; if (result < 0) { int esp_tls_code; int flags; - esp_err_t err = esp_tls_get_and_clear_last_error(self->tcp->error_handle, &esp_tls_code, &flags); + esp_err_t err = esp_tls_get_and_clear_last_error(self->tls->error_handle, &esp_tls_code, &flags); if (err == ESP_ERR_MBEDTLS_SSL_SETUP_FAILED) { mp_raise_espidf_MemoryError(); @@ -70,7 +133,7 @@ bool common_hal_socketpool_socket_connect(socketpool_socket_obj_t* self, const c // shouldn't hit this timeout because we try to only read available data. However, there is // always a chance that we try to read something that is used internally. int fd; - esp_tls_get_conn_sockfd(self->tcp, &fd); + esp_tls_get_conn_sockfd(self->tls, &fd); struct timeval tv; tv.tv_sec = 2 * 60; // Two minutes tv.tv_usec = 0; @@ -86,7 +149,14 @@ bool common_hal_socketpool_socket_get_connected(socketpool_socket_obj_t* self) { } mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len) { - size_t sent = esp_tls_conn_write(self->tcp, buf, len); + size_t sent = -1; + if (self->num != -1) { + // LWIP Socket + sent = lwip_send(self->num, buf, len, 0); + } else if (self->tls != NULL) { + // TLS Socket + sent = esp_tls_conn_write(self->tls, buf, len); + } if (sent < 0) { mp_raise_OSError(MP_ENOTCONN); @@ -96,37 +166,44 @@ mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t* self, const mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len) { size_t received = 0; - int status = 0; - uint64_t start_ticks = supervisor_ticks_ms64(); - int sockfd; - esp_err_t err = esp_tls_get_conn_sockfd(self->tcp, &sockfd); - if (err != ESP_OK) { - mp_raise_OSError(MP_EBADF); - } - while (received == 0 && - status >= 0 && - (self->timeout_ms == 0 || supervisor_ticks_ms64() - start_ticks <= self->timeout_ms) && - !mp_hal_is_interrupted()) { - RUN_BACKGROUND_TASKS; - size_t available = esp_tls_get_bytes_avail(self->tcp); - if (available == 0) { - // This reads the raw socket buffer and is used for non-TLS connections - // and between encrypted TLS blocks. - status = lwip_ioctl(sockfd, FIONREAD, &available); - } - size_t remaining = len - received; - if (available > remaining) { - available = remaining; + + if (self->num != -1) { + // LWIP Socket + received = lwip_recv(self->num, (void*) buf, len - 1, 0); + } else if (self->tls != NULL) { + // TLS Socket + int status = 0; + uint64_t start_ticks = supervisor_ticks_ms64(); + int sockfd; + esp_err_t err = esp_tls_get_conn_sockfd(self->tls, &sockfd); + if (err != ESP_OK) { + mp_raise_OSError(MP_EBADF); } - if (available > 0) { - status = esp_tls_conn_read(self->tcp, (void*) buf + received, available); - if (status == 0) { - // Reading zero when something is available indicates a closed - // connection. (The available bytes could have been TLS internal.) - break; + while (received == 0 && + status >= 0 && + (self->timeout_ms == 0 || supervisor_ticks_ms64() - start_ticks <= self->timeout_ms) && + !mp_hal_is_interrupted()) { + RUN_BACKGROUND_TASKS; + size_t available = esp_tls_get_bytes_avail(self->tls); + if (available == 0) { + // This reads the raw socket buffer and is used for non-TLS connections + // and between encrypted TLS blocks. + status = lwip_ioctl(sockfd, FIONREAD, &available); } - if (status > 0) { - received += status; + size_t remaining = len - received; + if (available > remaining) { + available = remaining; + } + if (available > 0) { + status = esp_tls_conn_read(self->tls, (void*) buf + received, available); + if (status == 0) { + // Reading zero when something is available indicates a closed + // connection. (The available bytes could have been TLS internal.) + break; + } + if (status > 0) { + received += status; + } } } } @@ -141,6 +218,8 @@ mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, mp_uint_t common_hal_socketpool_socket_sendto(socketpool_socket_obj_t* self, const char* host, size_t hostlen, uint8_t port, const uint8_t* buf, mp_uint_t len) { + _lazy_init_LWIP(self); + // Get the IP address string const struct addrinfo hints = { .ai_family = AF_INET, @@ -151,17 +230,15 @@ mp_uint_t common_hal_socketpool_socket_sendto(socketpool_socket_obj_t* self, if (error != 0 || result == NULL) { return 0; } + + // Set parameters + struct sockaddr_in dest_addr; #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wcast-align" - struct in_addr *addr = &((struct sockaddr_in *)result->ai_addr)->sin_addr; + dest_addr.sin_addr.s_addr = ((struct sockaddr_in *)result->ai_addr)->sin_addr.s_addr; #pragma GCC diagnostic pop - char ip_str[IP4ADDR_STRLEN_MAX]; - inet_ntoa_r(*addr, ip_str, IP4ADDR_STRLEN_MAX); freeaddrinfo(result); - // Set parameters - struct sockaddr_in dest_addr; - dest_addr.sin_addr.s_addr = inet_addr((const char *)ip_str); dest_addr.sin_family = AF_INET; dest_addr.sin_port = htons(port); @@ -176,11 +253,13 @@ mp_uint_t common_hal_socketpool_socket_sendto(socketpool_socket_obj_t* self, mp_uint_t common_hal_socketpool_socket_recvfrom_into(socketpool_socket_obj_t* self, uint8_t* buf, mp_uint_t len, uint8_t* ip, uint *port) { + _lazy_init_LWIP(self); + struct sockaddr_in source_addr; socklen_t socklen = sizeof(source_addr); int bytes_received = lwip_recvfrom(self->num, buf, len - 1, 0, (struct sockaddr *)&source_addr, &socklen); - memcpy((void *)ip, (void*)&source_addr.sin_addr.s_addr, sizeof source_addr.sin_addr.s_addr); + memcpy((void *)ip, (void*)&source_addr.sin_addr.s_addr, sizeof(source_addr.sin_addr.s_addr)); *port = source_addr.sin_port; if (bytes_received < 0) { @@ -194,9 +273,9 @@ mp_uint_t common_hal_socketpool_socket_recvfrom_into(socketpool_socket_obj_t* se void common_hal_socketpool_socket_close(socketpool_socket_obj_t* self) { self->connected = false; - if (self->tcp != NULL) { - esp_tls_conn_destroy(self->tcp); - self->tcp = NULL; + if (self->tls != NULL) { + esp_tls_conn_destroy(self->tls); + self->tls = NULL; } if (self->num >= 0) { lwip_shutdown(self->num, 0); @@ -206,7 +285,7 @@ void common_hal_socketpool_socket_close(socketpool_socket_obj_t* self) { } bool common_hal_socketpool_socket_get_closed(socketpool_socket_obj_t* self) { - return self->tcp == NULL && self->num < 0; + return self->tls == NULL && self->num < 0; } diff --git a/ports/esp32s2/common-hal/socketpool/Socket.h b/ports/esp32s2/common-hal/socketpool/Socket.h index 62b5ded58eca0..3cffeeb6a1c4b 100644 --- a/ports/esp32s2/common-hal/socketpool/Socket.h +++ b/ports/esp32s2/common-hal/socketpool/Socket.h @@ -37,8 +37,11 @@ typedef struct { mp_obj_base_t base; int num; + int type; + int family; + int ipproto; bool connected; - esp_tls_t* tcp; + esp_tls_t* tls; ssl_sslcontext_obj_t* ssl_context; socketpool_socketpool_obj_t* pool; mp_uint_t timeout_ms; diff --git a/ports/esp32s2/common-hal/socketpool/SocketPool.c b/ports/esp32s2/common-hal/socketpool/SocketPool.c index 3bec5f337f0e2..5821728ce51e5 100644 --- a/ports/esp32s2/common-hal/socketpool/SocketPool.c +++ b/ports/esp32s2/common-hal/socketpool/SocketPool.c @@ -65,25 +65,20 @@ socketpool_socket_obj_t* common_hal_socketpool_socket(socketpool_socketpool_obj_ mp_raise_NotImplementedError(translate("Only IPv4 sockets supported")); } - int socknum = -1; - esp_tls_t* tcp_handle = NULL; - if (socket_type == SOCK_DGRAM || socket_type == SOCK_RAW) { - socknum = lwip_socket(addr_family, socket_type, ipproto); - } else { - tcp_handle = esp_tls_init(); - - if (tcp_handle == NULL) { - mp_raise_espidf_MemoryError(); - } - } - if (socknum < 0 && tcp_handle == NULL) { - mp_raise_RuntimeError(translate("Out of sockets")); - } - + // Consider LWIP and MbedTLS "variant" sockets to be incompatible (for now) + // The variant of the socket is determined by whether the socket is wrapped + // by SSL. If no TLS handle is set in sslcontext_wrap_socket, the first call + // of bind() or connect() will create a LWIP socket with a corresponding + // socketnum. + // TODO: move MbedTLS to its own duplicate Socket or Server API, maybe? socketpool_socket_obj_t *sock = m_new_obj_with_finaliser(socketpool_socket_obj_t); sock->base.type = &socketpool_socket_type; - sock->num = socknum; - sock->tcp = tcp_handle; + sock->num = -1; + sock->type = socket_type; + sock->family = addr_family; + sock->ipproto = ipproto; + + sock->tls = NULL; sock->ssl_context = NULL; sock->pool = self; return sock; diff --git a/shared-bindings/socketpool/Socket.c b/shared-bindings/socketpool/Socket.c index 0e6968d5f47f7..37ba0cee3130c 100644 --- a/shared-bindings/socketpool/Socket.c +++ b/shared-bindings/socketpool/Socket.c @@ -64,94 +64,72 @@ STATIC mp_obj_t socketpool_socket___exit__(size_t n_args, const mp_obj_t *args) } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socketpool_socket___exit___obj, 4, 4, socketpool_socket___exit__); -// //| def bind(self, address: tuple) -> None: -// //| """Bind a socket to an address -// //| -// //| :param ~tuple address: tuple of (remote_address, remote_port)""" -// //| ... -// //| - -// STATIC mp_obj_t socketpool_socket_bind(mp_obj_t self_in, mp_obj_t addr_in) { -// // mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(self_in); - -// // // get address -// // uint8_t ip[MOD_NETWORK_IPADDR_BUF_SIZE]; -// // mp_uint_t port = netutils_parse_inet_addr(addr_in, ip, NETUTILS_BIG); - -// // // check if we need to select a NIC -// // socket_select_nic(self, ip); - -// // // call the NIC to bind the socket -// // int _errno; -// // if (self->nic_type->bind(self, ip, port, &_errno) != 0) { -// // mp_raise_OSError(_errno); -// // } - -// return mp_const_none; -// } -// STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_bind_obj, socketpool_socket_bind); - -// //| def listen(self, backlog: int) -> None: -// //| """Set socket to listen for incoming connections -// //| -// //| :param ~int backlog: length of backlog queue for waiting connetions""" -// //| ... -// //| +//| def bind(self, address: Tuple[str, int]) -> None: +//| """Bind a socket to an address +//| +//| :param ~tuple address: tuple of (remote_address, remote_port)""" +//| ... +//| +STATIC mp_obj_t socketpool_socket_bind(mp_obj_t self_in, mp_obj_t addr_in) { + socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in); -// STATIC mp_obj_t socketpool_socket_listen(mp_obj_t self_in, mp_obj_t backlog) { -// // mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(self_in); + mp_obj_t *addr_items; + mp_obj_get_array_fixed_n(addr_in, 2, &addr_items); -// // if (self->nic == MP_OBJ_NULL) { -// // // not connected -// // // TODO I think we can listen even if not bound... -// // mp_raise_OSError(MP_ENOTCONN); -// // } + size_t hostlen; + const char* host = mp_obj_str_get_data(addr_items[0], &hostlen); + mp_int_t port = mp_obj_get_int(addr_items[1]); -// // int _errno; -// // if (self->nic_type->listen(self, mp_obj_get_int(backlog), &_errno) != 0) { -// // mp_raise_OSError(_errno); -// // } + bool ok = common_hal_socketpool_socket_bind(self, host, hostlen, port); + if (!ok) { + mp_raise_ValueError(translate("Error: Failure to bind")); + } -// return mp_const_none; -// } -// STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_listen_obj, socketpool_socket_listen); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_bind_obj, socketpool_socket_bind); -// //| def accept(self) -> tuple: -// //| """Accept a connection on a listening socket of type SOCK_STREAM, -// //| creating a new socket of type SOCK_STREAM. -// //| Returns a tuple of (new_socket, remote_address)""" -// //| +//| def listen(self, backlog: int) -> None: +//| """Set socket to listen for incoming connections +//| +//| :param ~int backlog: length of backlog queue for waiting connetions""" +//| ... +//| +STATIC mp_obj_t socketpool_socket_listen(mp_obj_t self_in, mp_obj_t backlog_in) { + socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in); -// STATIC mp_obj_t socketpool_socket_accept(mp_obj_t self_in) { -// // mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(self_in); + int backlog = mp_obj_get_int(backlog_in); -// // // create new socket object -// // // starts with empty NIC so that finaliser doesn't run close() method if accept() fails -// // mod_network_socket_obj_t *socket2 = m_new_obj_with_finaliser(mod_network_socket_obj_t); -// // socket2->base.type = &socket_type; -// // socket2->nic = MP_OBJ_NULL; -// // socket2->nic_type = NULL; + common_hal_socketpool_socket_listen(self, backlog); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_listen_obj, socketpool_socket_listen); -// // // accept incoming connection -// // uint8_t ip[MOD_NETWORK_IPADDR_BUF_SIZE]; -// // mp_uint_t port; -// // int _errno; -// // if (self->nic_type->accept(self, socket2, ip, &port, &_errno) != 0) { -// // mp_raise_OSError(_errno); -// // } +//| def accept(self) -> tuple: +//| """Accept a connection on a listening socket of type SOCK_STREAM, +//| creating a new socket of type SOCK_STREAM. +//| Returns a tuple of (new_socket, remote_address)""" +//| +STATIC mp_obj_t socketpool_socket_accept(mp_obj_t self_in) { + socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in); + uint8_t ip[4]; + uint port; -// // // new socket has valid state, so set the NIC to the same as parent -// // socket2->nic = self->nic; -// // socket2->nic_type = self->nic_type; + int socknum = common_hal_socketpool_socket_accept(self, ip, &port); -// // // make the return value -// // mp_obj_tuple_t *client = MP_OBJ_TO_PTR(mp_obj_new_tuple(2, NULL)); -// // client->items[0] = MP_OBJ_FROM_PTR(socket2); -// // client->items[1] = netutils_format_inet_addr(ip, port, NETUTILS_BIG); + socketpool_socket_obj_t *sock = m_new_obj_with_finaliser(socketpool_socket_obj_t); + sock->base.type = &socketpool_socket_type; + sock->num = socknum; + sock->tls = NULL; + sock->ssl_context = NULL; + sock->pool = self->pool; -// return mp_const_none; -// } -// STATIC MP_DEFINE_CONST_FUN_OBJ_1(socketpool_socket_accept_obj, socketpool_socket_accept); + mp_obj_t tuple_contents[2]; + tuple_contents[0] = MP_OBJ_FROM_PTR(sock); + tuple_contents[1] = netutils_format_inet_addr(ip, port, NETUTILS_BIG); + return mp_obj_new_tuple(2, tuple_contents); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(socketpool_socket_accept_obj, socketpool_socket_accept); //| def close(self) -> None: //| """Closes this Socket and makes its resources available to its SocketPool.""" @@ -169,7 +147,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(socketpool_socket_close_obj, socketpool_socket_ //| :param ~tuple address: tuple of (remote_address, remote_port)""" //| ... //| - STATIC mp_obj_t socketpool_socket_connect(mp_obj_t self_in, mp_obj_t addr_in) { socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -196,7 +173,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_connect_obj, socketpool_socke //| :param ~bytes bytes: some bytes to send""" //| ... //| - STATIC mp_obj_t socketpool_socket_send(mp_obj_t self_in, mp_obj_t buf_in) { socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in); if (common_hal_socketpool_socket_get_closed(self)) { @@ -216,19 +192,6 @@ STATIC mp_obj_t socketpool_socket_send(mp_obj_t self_in, mp_obj_t buf_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_send_obj, socketpool_socket_send); - -// helper function for socket_recv and socket_recv_into to handle common operations of both -// STATIC mp_int_t _socket_recv_into(mod_network_socket_obj_t *sock, byte *buf, mp_int_t len) { -// mp_int_t ret = 0; -// // int _errno; -// // mp_int_t ret = sock->nic_type->recv(sock, buf, len, &_errno); -// // if (ret == -1) { -// // mp_raise_OSError(_errno); -// // } -// return ret; -// } - - //| def recv_into(self, buffer: WriteableBuffer, bufsize: int) -> int: //| """Reads some bytes from the connected remote address, writing //| into the provided buffer. If bufsize <= len(buffer) is given, @@ -430,9 +393,9 @@ STATIC const mp_rom_map_elem_t socketpool_socket_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&socketpool_socket_close_obj) }, { MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&socketpool_socket_close_obj) }, - // { MP_ROM_QSTR(MP_QSTR_bind), MP_ROM_PTR(&socketpool_socket_bind_obj) }, - // { MP_ROM_QSTR(MP_QSTR_listen), MP_ROM_PTR(&socketpool_socket_listen_obj) }, - // { MP_ROM_QSTR(MP_QSTR_accept), MP_ROM_PTR(&socketpool_socket_accept_obj) }, + { MP_ROM_QSTR(MP_QSTR_bind), MP_ROM_PTR(&socketpool_socket_bind_obj) }, + { MP_ROM_QSTR(MP_QSTR_listen), MP_ROM_PTR(&socketpool_socket_listen_obj) }, + { MP_ROM_QSTR(MP_QSTR_accept), MP_ROM_PTR(&socketpool_socket_accept_obj) }, { MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&socketpool_socket_connect_obj) }, { MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&socketpool_socket_send_obj) }, { MP_ROM_QSTR(MP_QSTR_sendto), MP_ROM_PTR(&socketpool_socket_sendto_obj) }, diff --git a/shared-bindings/socketpool/Socket.h b/shared-bindings/socketpool/Socket.h index 54fbe59b28993..e2ea32d39239e 100644 --- a/shared-bindings/socketpool/Socket.h +++ b/shared-bindings/socketpool/Socket.h @@ -32,6 +32,11 @@ extern const mp_obj_type_t socketpool_socket_type; void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t* self, mp_uint_t timeout_ms); + +bool common_hal_socketpool_socket_bind(socketpool_socket_obj_t* self, const char* host, size_t hostlen, uint8_t port); +bool common_hal_socketpool_socket_listen(socketpool_socket_obj_t* self, int backlog); +int common_hal_socketpool_socket_accept(socketpool_socket_obj_t* self, uint8_t* ip, uint *port); + bool common_hal_socketpool_socket_connect(socketpool_socket_obj_t* self, const char* host, size_t hostlen, mp_int_t port); mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len); mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len); From 75620884e6c553b1f5f954762c72eb431357aa24 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Mon, 21 Dec 2020 13:04:52 -0500 Subject: [PATCH 476/770] Fix stubs, recv_into error --- ports/esp32s2/common-hal/socketpool/Socket.c | 2 +- shared-bindings/socketpool/Socket.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/socketpool/Socket.c b/ports/esp32s2/common-hal/socketpool/Socket.c index d92bed1d11350..d5608c7edf0ab 100644 --- a/ports/esp32s2/common-hal/socketpool/Socket.c +++ b/ports/esp32s2/common-hal/socketpool/Socket.c @@ -210,7 +210,7 @@ mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, if (received == 0) { // socket closed - common_hal_socketpool_socket_close(self); + mp_raise_OSError(0); } return received; } diff --git a/shared-bindings/socketpool/Socket.c b/shared-bindings/socketpool/Socket.c index 37ba0cee3130c..548514f2870f5 100644 --- a/shared-bindings/socketpool/Socket.c +++ b/shared-bindings/socketpool/Socket.c @@ -105,7 +105,7 @@ STATIC mp_obj_t socketpool_socket_listen(mp_obj_t self_in, mp_obj_t backlog_in) } STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_listen_obj, socketpool_socket_listen); -//| def accept(self) -> tuple: +//| def accept(self) -> Tuple[Socket, Tuple[str, int]]: //| """Accept a connection on a listening socket of type SOCK_STREAM, //| creating a new socket of type SOCK_STREAM. //| Returns a tuple of (new_socket, remote_address)""" From 9a86829d01ec4471a30c820c6f8da979cf9cecf4 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Mon, 21 Dec 2020 14:14:31 -0500 Subject: [PATCH 477/770] translations --- locale/circuitpython.pot | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index d64cff18591d9..65c31ee229702 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-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-21 14:14-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -812,6 +812,10 @@ msgstr "" msgid "Error in regex" msgstr "" +#: shared-bindings/socketpool/Socket.c +msgid "Error: Failure to bind" +msgstr "" + #: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c @@ -1192,6 +1196,14 @@ msgstr "" msgid "Invalid security_mode" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid socket for TLS" +msgstr "" + +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid use of TLS Socket" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1470,7 +1482,7 @@ msgstr "" msgid "Only raw int supported for ip" msgstr "" -#: ports/esp32s2/common-hal/socketpool/SocketPool.c +#: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "" From ae3b4408350e5623ef769a2860984d2d8937be59 Mon Sep 17 00:00:00 2001 From: BennyE Date: Tue, 22 Dec 2020 00:32:48 +0100 Subject: [PATCH 478/770] more fixes and still with debug --- ports/esp32s2/common-hal/wifi/Network.c | 3 +- ports/esp32s2/common-hal/wifi/Radio.c | 38 ++++++++++++++++++- .../esp32s2/common-hal/wifi/ScannedNetworks.c | 6 +++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/Network.c b/ports/esp32s2/common-hal/wifi/Network.c index ab60b98f45656..d134db057e1f0 100644 --- a/ports/esp32s2/common-hal/wifi/Network.c +++ b/ports/esp32s2/common-hal/wifi/Network.c @@ -51,6 +51,7 @@ mp_obj_t common_hal_wifi_network_get_channel(wifi_network_obj_t *self) { mp_obj_t common_hal_wifi_network_get_country(wifi_network_obj_t *self) { const char* cstr = (const char*) self->record.country.cc; - return mp_obj_new_str(cstr, strlen(cstr)); + // We know that we only want the CC thus limiting to two chars + return mp_obj_new_str(cstr, 2); } diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index 1a242da058c82..08d8bbcd50c3f 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -198,6 +198,37 @@ mp_obj_t common_hal_wifi_radio_get_ap_info(wifi_radio_obj_t *self) { if (esp_wifi_sta_get_ap_info(&self->ap_info.record) != ESP_OK){ return mp_const_none; } else { + ESP_EARLY_LOGW(TAG, "country before handler country: %s", (char *)&self->ap_info.record.country); + ESP_EARLY_LOGW(TAG, "country memory at: %p", self->ap_info.record.country); + ESP_EARLY_LOGW(TAG, "countryCC memory at: %p", self->ap_info.record.country.cc); + ESP_EARLY_LOGW(TAG, "countryCC strlen: %d", strlen(self->ap_info.record.country.cc)); + // The struct member appears to be (not NULL!), I don't know how to properly test for it. + // If the ESP-IDF starts working fine, this "if" wouldn't trigger. + // Note: It is possible that Wi-Fi APs don't have a CC set, then even after this workaround + // the element would remain empty. + if (strlen(self->ap_info.record.country.cc) == 0) { + // Workaround to fill country related information in ap_info until ESP-IDF carries a fix + // esp_wifi_sta_get_ap_info does not appear to fill wifi_country_t (e.g. country.cc) details + // (IDFGH-4437) #6267 + ESP_EARLY_LOGW(TAG, "Triggered missing country workaround"); + if (esp_wifi_get_country(&self->ap_info.record.country) == ESP_OK) { + ESP_EARLY_LOGW(TAG, "Workaround worked fine!"); + ESP_EARLY_LOGW(TAG, "country: %d", self->ap_info.record.country); + ESP_EARLY_LOGW(TAG, "CC: %s", self->ap_info.record.country.cc); + } else { + ESP_EARLY_LOGW(TAG, "Workaround failed!"); + } + //} else { + // ESP_EARLY_LOGW(TAG, "Triggered missing country workaround IN ELSE"); + // //memset(&self->ap_info.record.country, 0, sizeof(wifi_country_t)); + // if (esp_wifi_get_country(&self->ap_info.record.country) == ESP_OK) { + // //if (esp_wifi_get_country(&self->ap_info.record.country) == ESP_OK) { + // ESP_EARLY_LOGW(TAG, "Workaround worked fine!"); + // ESP_EARLY_LOGW(TAG, "CC: %s", self->ap_info.record.country.cc); + // } else { + // ESP_EARLY_LOGW(TAG, "Workaround failed!"); + // } + } ESP_EARLY_LOGW(TAG, "ssid: %s", self->ap_info.record.ssid); ESP_EARLY_LOGW(TAG, "channel: %d", self->ap_info.record.primary); ESP_EARLY_LOGW(TAG, "secondary: %d", self->ap_info.record.second); @@ -209,8 +240,13 @@ mp_obj_t common_hal_wifi_radio_get_ap_info(wifi_radio_obj_t *self) { ESP_EARLY_LOGW(TAG, "11g: %d", self->ap_info.record.phy_11g); ESP_EARLY_LOGW(TAG, "11n: %d", self->ap_info.record.phy_11n); ESP_EARLY_LOGW(TAG, "phy_lr: %d", self->ap_info.record.phy_lr); - ESP_EARLY_LOGW(TAG, "country: %s", self->ap_info.record.country); + ESP_EARLY_LOGW(TAG, "ap_info.record: %s", self->ap_info.record); + ESP_EARLY_LOGW(TAG, "country with cast: %s", (char *)&self->ap_info.record.country); + //ESP_EARLY_LOGW(TAG, "country: %s", self->ap_info.record.country); + ESP_EARLY_LOGW(TAG, "country memory at: %p", self->ap_info.record.country); ESP_EARLY_LOGW(TAG, "countryCC: %s", self->ap_info.record.country.cc); + ESP_EARLY_LOGW(TAG, "countryCC memory at: %p", self->ap_info.record.country.cc); + ESP_EARLY_LOGW(TAG, "countryCC strlen: %d", strlen(self->ap_info.record.country.cc)); memcpy(&ap_info->record, &self->ap_info.record, sizeof(wifi_ap_record_t)); return MP_OBJ_FROM_PTR(ap_info); } diff --git a/ports/esp32s2/common-hal/wifi/ScannedNetworks.c b/ports/esp32s2/common-hal/wifi/ScannedNetworks.c index cc733308db60e..0540ffc5ccd9f 100644 --- a/ports/esp32s2/common-hal/wifi/ScannedNetworks.c +++ b/ports/esp32s2/common-hal/wifi/ScannedNetworks.c @@ -39,6 +39,10 @@ #include "components/esp_wifi/include/esp_wifi.h" +#include "components/log/include/esp_log.h" + +static const char* TAG = "wifi"; + static void wifi_scannednetworks_done(wifi_scannednetworks_obj_t *self) { self->done = true; if (self->results != NULL) { @@ -117,6 +121,8 @@ mp_obj_t common_hal_wifi_scannednetworks_next(wifi_scannednetworks_obj_t *self) wifi_network_obj_t *entry = m_new_obj(wifi_network_obj_t); entry->base.type = &wifi_network_type; + // benny remove again + ESP_EARLY_LOGW(TAG, "scan country: %s", &self->results[self->current_result].country); memcpy(&entry->record, &self->results[self->current_result], sizeof(wifi_ap_record_t)); self->current_result++; From 3b4c14f3ec8b36a00a7eeba562baa7647b82f2e2 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 21 Dec 2020 20:43:46 -0500 Subject: [PATCH 479/770] unmounted filesystems start as ejected --- supervisor/shared/usb/usb_msc_flash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervisor/shared/usb/usb_msc_flash.c b/supervisor/shared/usb/usb_msc_flash.c index b39f60dcd2ff9..7532b6aead524 100644 --- a/supervisor/shared/usb/usb_msc_flash.c +++ b/supervisor/shared/usb/usb_msc_flash.c @@ -39,7 +39,7 @@ #define MSC_FLASH_BLOCK_SIZE 512 -static bool ejected[1] = {false}; +static bool ejected[1] = {true}; void usb_msc_mount(void) { // Reset the ejection tracking every time we're plugged into USB. This allows for us to battery From aa1f0e93ba8fddc358a52c38389f41a9640d6271 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 22 Dec 2020 03:46:23 +0100 Subject: [PATCH 480/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 12 ++++++++++++ locale/cs.po | 12 ++++++++++++ locale/de_DE.po | 12 ++++++++++++ locale/el.po | 12 ++++++++++++ locale/es.po | 12 ++++++++++++ locale/fil.po | 12 ++++++++++++ locale/fr.po | 12 ++++++++++++ locale/hi.po | 12 ++++++++++++ locale/it_IT.po | 12 ++++++++++++ locale/ja.po | 12 ++++++++++++ locale/ko.po | 12 ++++++++++++ locale/nl.po | 12 ++++++++++++ locale/pl.po | 12 ++++++++++++ locale/pt_BR.po | 12 ++++++++++++ locale/sv.po | 12 ++++++++++++ locale/zh_Latn_pinyin.po | 12 ++++++++++++ 16 files changed, 192 insertions(+) diff --git a/locale/ID.po b/locale/ID.po index dd9693f536d9e..150a92c04a21a 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -954,6 +954,10 @@ msgstr "File sudah ada" msgid "Filters too complex" msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "" @@ -2021,6 +2025,10 @@ msgstr "" msgid "Unsupported pull value." msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3256,6 +3264,10 @@ msgstr "panjang data string memiliki keganjilan (odd-length)" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c #, fuzzy msgid "offset out of bounds" diff --git a/locale/cs.po b/locale/cs.po index e178a3fd5b8f0..39e5a50cf3186 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -940,6 +940,10 @@ msgstr "" msgid "Filters too complex" msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "" @@ -1987,6 +1991,10 @@ msgstr "" msgid "Unsupported pull value." msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3215,6 +3223,10 @@ msgstr "" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 85b3b90a06069..95ff26aeec0d2 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -951,6 +951,10 @@ msgstr "Datei existiert" msgid "Filters too complex" msgstr "Filter zu komplex" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "Format nicht unterstützt" @@ -2033,6 +2037,10 @@ msgstr "Nicht unterstützte Operation" msgid "Unsupported pull value." msgstr "Nicht unterstützter Pull-Wert." +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3292,6 +3300,10 @@ msgstr "String mit ungerader Länge" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "offset außerhalb der Grenzen" diff --git a/locale/el.po b/locale/el.po index 1a835fd4245e3..e1b44d2916039 100644 --- a/locale/el.po +++ b/locale/el.po @@ -935,6 +935,10 @@ msgstr "" msgid "Filters too complex" msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "" @@ -1982,6 +1986,10 @@ msgstr "" msgid "Unsupported pull value." msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3210,6 +3218,10 @@ msgstr "" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" diff --git a/locale/es.po b/locale/es.po index 27b1756571ab0..c335d0f396da5 100644 --- a/locale/es.po +++ b/locale/es.po @@ -955,6 +955,10 @@ msgstr "El archivo ya existe" msgid "Filters too complex" msgstr "Filtros muy complejos" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "Sin capacidades para el formato" @@ -2036,6 +2040,10 @@ msgstr "Operación no soportada" msgid "Unsupported pull value." msgstr "valor pull no soportado." +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3286,6 +3294,10 @@ msgstr "string de longitud impar" msgid "offset is too large" msgstr "offset es demasiado grande" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "offset fuera de límites" diff --git a/locale/fil.po b/locale/fil.po index e55fc5e2cca88..067dfc4d79413 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -948,6 +948,10 @@ msgstr "Mayroong file" msgid "Filters too complex" msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "" @@ -2004,6 +2008,10 @@ msgstr "Hindi sinusuportahang operasyon" msgid "Unsupported pull value." msgstr "Hindi suportado ang pull value." +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3257,6 +3265,10 @@ msgstr "odd-length string" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c #, fuzzy msgid "offset out of bounds" diff --git a/locale/fr.po b/locale/fr.po index eef313273931a..3836da812e041 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -960,6 +960,10 @@ msgstr "Le fichier existe" msgid "Filters too complex" msgstr "Filtre trop complexe" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "Format non supporté" @@ -2045,6 +2049,10 @@ msgstr "Opération non supportée" msgid "Unsupported pull value." msgstr "Valeur de tirage 'pull' non supportée." +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3305,6 +3313,10 @@ msgstr "chaîne de longueur impaire" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "décalage hors limites" diff --git a/locale/hi.po b/locale/hi.po index 51b751c82a532..7d90c65dc0527 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -935,6 +935,10 @@ msgstr "" msgid "Filters too complex" msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "" @@ -1982,6 +1986,10 @@ msgstr "" msgid "Unsupported pull value." msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3210,6 +3218,10 @@ msgstr "" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 80dabb6256c99..b14acaf9e4cff 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -948,6 +948,10 @@ msgstr "File esistente" msgid "Filters too complex" msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "" @@ -2016,6 +2020,10 @@ msgstr "Operazione non supportata" msgid "Unsupported pull value." msgstr "Valore di pull non supportato." +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3263,6 +3271,10 @@ msgstr "stringa di lunghezza dispari" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c #, fuzzy msgid "offset out of bounds" diff --git a/locale/ja.po b/locale/ja.po index 226a8e179b0aa..0bd6504b9b433 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -948,6 +948,10 @@ msgstr "ファイルが存在します" msgid "Filters too complex" msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "非対応の形式" @@ -2007,6 +2011,10 @@ msgstr "非対応の操作" msgid "Unsupported pull value." msgstr "非対応のpull値" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3240,6 +3248,10 @@ msgstr "奇数長の文字列" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" diff --git a/locale/ko.po b/locale/ko.po index 456cb47e65355..e307955362305 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -940,6 +940,10 @@ msgstr "" msgid "Filters too complex" msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "" @@ -1988,6 +1992,10 @@ msgstr "" msgid "Unsupported pull value." msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3216,6 +3224,10 @@ msgstr "" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 63ff70716f606..bbd732cb5cf21 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -948,6 +948,10 @@ msgstr "Bestand bestaat" msgid "Filters too complex" msgstr "Filters zijn te complex" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "Formaat wordt niet ondersteund" @@ -2027,6 +2031,10 @@ msgstr "Niet-ondersteunde operatie" msgid "Unsupported pull value." msgstr "Niet-ondersteunde pull-waarde." +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3272,6 +3280,10 @@ msgstr "string met oneven lengte" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "offset buiten bereik" diff --git a/locale/pl.po b/locale/pl.po index 718bf50f429e8..380dedd6062b7 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -948,6 +948,10 @@ msgstr "Plik istnieje" msgid "Filters too complex" msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "Nie wspierany format" @@ -1998,6 +2002,10 @@ msgstr "Zła operacja" msgid "Unsupported pull value." msgstr "Zła wartość podciągnięcia." +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3233,6 +3241,10 @@ msgstr "łańcuch o nieparzystej długości" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "offset poza zakresem" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 8d3d54fabce40..4a1674e4937be 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -957,6 +957,10 @@ msgstr "Arquivo já existe" msgid "Filters too complex" msgstr "Os filtros são muito complexos" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "O formato não é suportado" @@ -2045,6 +2049,10 @@ msgstr "Operação não suportada" msgid "Unsupported pull value." msgstr "O valor pull não é compatível." +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3297,6 +3305,10 @@ msgstr "sequência com comprimento ímpar" msgid "offset is too large" msgstr "o offset é muito grande" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "desvio fora dos limites" diff --git a/locale/sv.po b/locale/sv.po index a608866e3b27e..26eb19cbb1b2c 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -948,6 +948,10 @@ msgstr "Filen finns redan" msgid "Filters too complex" msgstr "Filter för komplexa" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "Formatet stöds inte" @@ -2024,6 +2028,10 @@ msgstr "Åtgärd som inte stöds" msgid "Unsupported pull value." msgstr "Ogiltigt Pull-värde." +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3266,6 +3274,10 @@ msgstr "sträng har udda längd" msgid "offset is too large" msgstr "offset är för stor" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "offset utanför gränserna" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 1cbcc709ff5fc..3106151d46262 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -946,6 +946,10 @@ msgstr "Wénjiàn cúnzài" msgid "Filters too complex" msgstr "guò lǜ qì tài fù zá" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "Bù zhīyuán géshì" @@ -2016,6 +2020,10 @@ msgstr "Bù zhīchí de cāozuò" msgid "Unsupported pull value." msgstr "Bù zhīchí de lādòng zhí." +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -3257,6 +3265,10 @@ msgstr "jīshù zìfú chuàn" msgid "offset is too large" msgstr "" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "piānlí biānjiè" From 39ca406a31f630f9e169ab18ce2fa223aa60077a Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 21 Dec 2020 23:32:11 -0500 Subject: [PATCH 481/770] Add Adafruit to MICROPY_HW_BOARD_NAME for various boards --- .../boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h | 2 +- ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h | 2 +- ports/mimxrt10xx/boards/feather_m7_1011/mpconfigboard.h | 2 +- ports/stm/boards/feather_stm32f405_express/mpconfigboard.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h index be376e5a94b51..8dfe91271262d 100644 --- a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h +++ b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h @@ -26,7 +26,7 @@ //Micropython setup -#define MICROPY_HW_BOARD_NAME "MagTag" +#define MICROPY_HW_BOARD_NAME "Adafruit MagTag" #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO1) diff --git a/ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h b/ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h index 7280aab9c29c5..b25d7d1169bc5 100644 --- a/ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h +++ b/ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h @@ -26,7 +26,7 @@ //Micropython setup -#define MICROPY_HW_BOARD_NAME "Metro ESP32S2" +#define MICROPY_HW_BOARD_NAME "Adafruit Metro ESP32S2" #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO45) diff --git a/ports/mimxrt10xx/boards/feather_m7_1011/mpconfigboard.h b/ports/mimxrt10xx/boards/feather_m7_1011/mpconfigboard.h index e96ec13dd9f81..e027e2b5eea85 100644 --- a/ports/mimxrt10xx/boards/feather_m7_1011/mpconfigboard.h +++ b/ports/mimxrt10xx/boards/feather_m7_1011/mpconfigboard.h @@ -1,4 +1,4 @@ -#define MICROPY_HW_BOARD_NAME "Feather MIMXRT1011" +#define MICROPY_HW_BOARD_NAME "Adafruit Feather MIMXRT1011" #define MICROPY_HW_MCU_NAME "IMXRT1011DAE5A" #define MICROPY_HW_NEOPIXEL (&pin_GPIO_00) diff --git a/ports/stm/boards/feather_stm32f405_express/mpconfigboard.h b/ports/stm/boards/feather_stm32f405_express/mpconfigboard.h index 0d49748c84ea2..e69be6cf95668 100644 --- a/ports/stm/boards/feather_stm32f405_express/mpconfigboard.h +++ b/ports/stm/boards/feather_stm32f405_express/mpconfigboard.h @@ -26,7 +26,7 @@ //Micropython setup -#define MICROPY_HW_BOARD_NAME "Feather STM32F405 Express" +#define MICROPY_HW_BOARD_NAME "Adafruit Feather STM32F405 Express" #define MICROPY_HW_MCU_NAME "STM32F405RG" #define FLASH_SIZE (0x100000) From 17e7973ff2028536034c8c8898044ac93fa10b51 Mon Sep 17 00:00:00 2001 From: Jonathan Giles Date: Mon, 21 Dec 2020 08:38:37 -0500 Subject: [PATCH 482/770] Add support for Winbond W25Q64FV --- supervisor/shared/external_flash/devices.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/supervisor/shared/external_flash/devices.h b/supervisor/shared/external_flash/devices.h index 466ab49eb8f62..be18647953ecc 100644 --- a/supervisor/shared/external_flash/devices.h +++ b/supervisor/shared/external_flash/devices.h @@ -363,6 +363,24 @@ typedef struct { .write_status_register_split = false, \ } +// Settings for the Winbond W25Q64FV 8MiB SPI flash. +// Datasheet: https://www.winbond.com/resource-files/w25q64fv%20revs%2007182017.pdf +#define W25Q64FV {\ + .total_size = (1 << 23), /* 8 MiB */ \ + .start_up_time_us = 5000, \ + .manufacturer_id = 0xef, \ + .memory_type = 0x40, \ + .capacity = 0x17, \ + .max_clock_speed_mhz = 104, \ + .quad_enable_bit_mask = 0x02, \ + .has_sector_protection = false, \ + .supports_fast_read = true, \ + .supports_qspi = true, \ + .supports_qspi_writes = true, \ + .write_status_register_split = false, \ + .single_status_byte = false, \ +} + // Settings for the Winbond W25Q64JV-IM 8MiB SPI flash. Note that JV-IQ has a different .memory_type (0x40) // Datasheet: http://www.winbond.com/resource-files/w25q64jv%20revj%2003272018%20plus.pdf #define W25Q64JV_IM {\ From aaa3c61819bc0c819df88df00d6fe8b52d677356 Mon Sep 17 00:00:00 2001 From: Jonathan Giles Date: Tue, 22 Dec 2020 09:07:50 -0500 Subject: [PATCH 483/770] Add default I2C pins for STM32F411CE --- ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.h | 3 +++ ports/stm/boards/stm32f411ce_blackpill/pins.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.h b/ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.h index 83a8bded39c04..4351339540f0b 100644 --- a/ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.h +++ b/ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.h @@ -42,6 +42,9 @@ // #define SPI_FLASH_SCK_PIN (&pin_PA05) // #define SPI_FLASH_CS_PIN (&pin_PA04) +#define DEFAULT_I2C_BUS_SCL (&pin_PB06) +#define DEFAULT_I2C_BUS_SDA (&pin_PB07) + #define CIRCUITPY_AUTORELOAD_DELAY_MS (500) #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x2000 - 0xC000) diff --git a/ports/stm/boards/stm32f411ce_blackpill/pins.c b/ports/stm/boards/stm32f411ce_blackpill/pins.c index 2f8aab6e8e2fb..16946b8bee4e1 100644 --- a/ports/stm/boards/stm32f411ce_blackpill/pins.c +++ b/ports/stm/boards/stm32f411ce_blackpill/pins.c @@ -35,5 +35,10 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_C14), MP_ROM_PTR(&pin_PC14) }, { MP_ROM_QSTR(MP_QSTR_C13), MP_ROM_PTR(&pin_PC13) }, { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PC13) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB07) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB06) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From d4e9eea397c887d9eceb5f4c6aba117a4dc3d03b Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 22 Dec 2020 10:06:43 -0500 Subject: [PATCH 484/770] mark alarm.wake_alarm during gc sweep --- main.c | 4 ++++ ports/esp32s2/common-hal/alarm/__init__.c | 8 ++++++-- shared-bindings/alarm/__init__.c | 13 ++++++++++++- shared-bindings/alarm/__init__.h | 8 ++++++++ 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index d940f93d180aa..27ed6ff116790 100755 --- a/main.c +++ b/main.c @@ -613,6 +613,10 @@ void gc_collect(void) { background_callback_gc_collect(); + #if CIRCUITPY_ALARM + common_hal_alarm_gc_collect(); + #endif + #if CIRCUITPY_DISPLAYIO displayio_gc_collect(); #endif diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index 5d1f3e95d4fc2..9f19f1afc4def 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -25,10 +25,12 @@ * THE SOFTWARE. */ +#include "py/gc.h" #include "py/obj.h" #include "py/objtuple.h" #include "py/runtime.h" +#include "shared-bindings/alarm/__init__.h" #include "shared-bindings/alarm/pin/PinAlarm.h" #include "shared-bindings/alarm/SleepMemory.h" #include "shared-bindings/alarm/time/TimeAlarm.h" @@ -38,8 +40,6 @@ #include "supervisor/port.h" #include "supervisor/shared/workflow.h" -#include "common-hal/alarm/__init__.h" - #include "esp_sleep.h" #include "components/soc/soc/esp32s2/include/soc/rtc_cntl_reg.h" @@ -159,3 +159,7 @@ void NORETURN alarm_enter_deep_sleep(void) { // We don't need to worry about resetting them in the interim. esp_deep_sleep_start(); } + +void common_hal_alarm_gc_collect(void) { + gc_collect_ptr(alarm_get_wake_alarm()); +} diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 700fe020ea6ae..778674f6d57ad 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -199,7 +199,18 @@ STATIC mp_map_elem_t alarm_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SleepMemory), MP_OBJ_FROM_PTR(&alarm_sleep_memory_type) }, { MP_ROM_QSTR(MP_QSTR_sleep_memory), MP_OBJ_FROM_PTR(&alarm_sleep_memory_obj) }, }; -STATIC MP_DEFINE_MUTABLE_DICT(alarm_module_globals, alarm_module_globals_table); +MP_DEFINE_MUTABLE_DICT(alarm_module_globals, alarm_module_globals_table); + +// Fetch value from module dict. +mp_obj_t alarm_get_wake_alarm(void) { + mp_map_elem_t *elem = + mp_map_lookup(&alarm_module_globals.map, MP_ROM_QSTR(MP_QSTR_wake_alarm), MP_MAP_LOOKUP); + if (elem) { + return elem->value; + } else { + return NULL; + } +} STATIC void alarm_set_wake_alarm(mp_obj_t alarm) { // Equivalent of: diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h index 8c4b6cad96c17..a90405da6bbd8 100644 --- a/shared-bindings/alarm/__init__.h +++ b/shared-bindings/alarm/__init__.h @@ -31,6 +31,9 @@ #include "common-hal/alarm/__init__.h" +// Make module dict available elsewhere, so we can fetch +extern mp_obj_dict_t alarm_module_globals; + extern mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms); // Deep sleep is a two step process. Alarms are set when the VM is valid but @@ -43,6 +46,10 @@ extern void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj // Deep sleep is entered outside of the VM so we omit the `common_hal_` prefix. extern NORETURN void alarm_enter_deep_sleep(void); +// Fetches value from module dict. +extern mp_obj_t alarm_get_wake_alarm(void); + +extern void common_hal_alarm_gc_collect(void); extern mp_obj_t common_hal_alarm_get_wake_alarm(void); // Used by wake-up code. @@ -52,4 +59,5 @@ void alarm_save_wakeup_alarm(void); // True if an alarm is alerting. This is most useful for pretend deep sleep. extern bool alarm_woken_from_sleep(void); + #endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM___INIT___H From da8f02366544d3a9fd5553c52f592a5fa7d74305 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 22 Dec 2020 10:27:42 -0600 Subject: [PATCH 485/770] esp32s2: make flash: use the stub Very long ago, this was apparently not supported in esptool yet, at least when operating over USB CDC. This now works just fine, and our esp webtool relies on it as well. It makes flashing faster, too. --- ports/esp32s2/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 35f82dd8a1492..4334e6b10e5fd 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -338,10 +338,10 @@ $(BUILD)/firmware.uf2: $(BUILD)/circuitpython-firmware.bin $(Q)$(PYTHON3) $(TOP)/tools/uf2/utils/uf2conv.py -f 0xbfdd4eee -b 0x0000 -c -o $@ $^ flash: $(BUILD)/firmware.bin - esptool.py --chip esp32s2 -p $(PORT) --no-stub -b 460800 --before=default_reset --after=no_reset write_flash $(FLASH_FLAGS) 0x0000 $^ + esptool.py --chip esp32s2 -p $(PORT) -b 460800 --before=default_reset --after=no_reset write_flash $(FLASH_FLAGS) 0x0000 $^ flash-circuitpython-only: $(BUILD)/circuitpython-firmware.bin - esptool.py --chip esp32s2 -p $(PORT) --no-stub -b 460800 --before=default_reset --after=no_reset write_flash $(FLASH_FLAGS) 0x10000 $^ + esptool.py --chip esp32s2 -p $(PORT) -b 460800 --before=default_reset --after=no_reset write_flash $(FLASH_FLAGS) 0x10000 $^ include $(TOP)/py/mkrules.mk From 4db2d692e394c4f79da2d2b8b840dfac8276782d Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Tue, 22 Dec 2020 15:43:26 +0000 Subject: [PATCH 486/770] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (882 of 882 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 4a1674e4937be..9918acc4d0dbd 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-14 12:59-0500\n" -"PO-Revision-Date: 2020-12-16 17:00+0000\n" +"PO-Revision-Date: 2020-12-22 18:07+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -959,7 +959,7 @@ msgstr "Os filtros são muito complexos" #: ports/esp32s2/common-hal/dualbank/__init__.c msgid "Firmware image is invalid" -msgstr "" +msgstr "A imagem do firmware é invalida" #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" @@ -2051,7 +2051,7 @@ msgstr "O valor pull não é compatível." #: ports/esp32s2/common-hal/dualbank/__init__.c msgid "Update Failed" -msgstr "" +msgstr "A atualização falou" #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -3307,7 +3307,7 @@ msgstr "o offset é muito grande" #: shared-bindings/dualbank/__init__.c msgid "offset must be >= 0" -msgstr "" +msgstr "o offset deve ser >= 0" #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" From 89079039adadac7c73fe03892ac2114dcc567429 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 22 Dec 2020 18:54:42 -0500 Subject: [PATCH 487/770] FrequencyIn: do not raise in interrupt handler --- ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c b/ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c index 02d0482dcabe4..f973db90b09b8 100644 --- a/ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c +++ b/ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c @@ -82,7 +82,8 @@ void frequencyin_emergency_cancel_capture(uint8_t index) { #ifdef SAM_D5X_E5X NVIC_EnableIRQ(EIC_0_IRQn + self->channel); #endif - mp_raise_RuntimeError(translate("Frequency captured is above capability. Capture Paused.")); + // Frequency captured is above capability. Capture paused. + // We can't raise an error here; we're in an interrupt handler. } void frequencyin_interrupt_handler(uint8_t index) { From 1fca297a2d2bfefb1cdef3ecbac05f54d15e08eb Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 22 Dec 2020 16:13:02 -0800 Subject: [PATCH 488/770] A couple sleep fixes * Better messaging when code is stopped by an auto-reload. * Auto-reload works during sleeps on ESP32-S2. Ticks wake up the main task each time. * Made internal naming consistent. CamelCase Python names are NOT separated by an underscore. --- main.c | 9 ++- ports/esp32s2/common-hal/alarm/__init__.c | 31 ++++------ ports/esp32s2/common-hal/alarm/pin/PinAlarm.c | 60 +++++++++---------- ports/esp32s2/common-hal/alarm/pin/PinAlarm.h | 12 ++-- .../esp32s2/common-hal/alarm/time/TimeAlarm.c | 26 ++++---- .../esp32s2/common-hal/alarm/time/TimeAlarm.h | 2 +- ports/esp32s2/supervisor/port.c | 28 +++++---- py/obj.c | 2 + shared-bindings/alarm/__init__.c | 10 ++-- shared-bindings/alarm/__init__.h | 3 - shared-bindings/alarm/pin/PinAlarm.c | 46 +++++++------- shared-bindings/alarm/pin/PinAlarm.h | 18 +++--- shared-bindings/alarm/time/TimeAlarm.c | 32 +++++----- shared-bindings/alarm/time/TimeAlarm.h | 12 ++-- 14 files changed, 142 insertions(+), 149 deletions(-) diff --git a/main.c b/main.c index 27ed6ff116790..9c4055a28712d 100755 --- a/main.c +++ b/main.c @@ -308,8 +308,11 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { return reload_requested; } - // Display a different completion message if the user has no USB attached (cannot save files) - serial_write_compressed(translate("\nCode done running. Waiting for reload.\n")); + if (reload_requested && result.return_code == PYEXEC_EXCEPTION) { + serial_write_compressed(translate("\nCode stopped by auto-reload.\n")); + } else { + serial_write_compressed(translate("\nCode done running.\n")); + } } // Program has finished running. @@ -407,7 +410,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { alarm_enter_deep_sleep(); // Does not return. } else { - serial_write_compressed(translate("Pretending to deep sleep until alarm, any key or file write.\n")); + serial_write_compressed(translate("Pretending to deep sleep until alarm, CTRL-C or file write.\n")); } } } diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index 9f19f1afc4def..f2686cf184b6d 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -54,7 +54,7 @@ const alarm_sleep_memory_obj_t alarm_sleep_memory_obj = { void alarm_reset(void) { alarm_time_timealarm_reset(); - alarm_pin_pin_alarm_reset(); + alarm_pin_pinalarm_reset(); alarm_sleep_memory_reset(); esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL); } @@ -63,7 +63,7 @@ STATIC esp_sleep_wakeup_cause_t _get_wakeup_cause(void) { if (alarm_time_timealarm_woke_us_up()) { return ESP_SLEEP_WAKEUP_TIMER; } - if (alarm_pin_pin_alarm_woke_us_up()) { + if (alarm_pin_pinalarm_woke_us_up()) { return ESP_SLEEP_WAKEUP_GPIO; } @@ -84,7 +84,7 @@ STATIC mp_obj_t _get_wake_alarm(size_t n_alarms, const mp_obj_t *alarms) { case ESP_SLEEP_WAKEUP_GPIO: case ESP_SLEEP_WAKEUP_EXT0: case ESP_SLEEP_WAKEUP_EXT1: { - return alarm_pin_pin_alarm_get_wakeup_alarm(n_alarms, alarms); + return alarm_pin_pinalarm_get_wakeup_alarm(n_alarms, alarms); } case ESP_SLEEP_WAKEUP_TOUCHPAD: @@ -106,7 +106,7 @@ mp_obj_t common_hal_alarm_get_wake_alarm(void) { // Set up light sleep or deep sleep alarms. STATIC void _setup_sleep_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms) { - alarm_pin_pin_alarm_set_alarms(deep_sleep, n_alarms, alarms); + alarm_pin_pinalarm_set_alarms(deep_sleep, n_alarms, alarms); alarm_time_timealarm_set_alarms(deep_sleep, n_alarms, alarms); } @@ -123,25 +123,14 @@ STATIC void _idle_until_alarm(void) { } } -// Is it safe to do a light sleep? Check whether WiFi is on or there are -// other ongoing tasks that should not be shut down. -STATIC bool _light_sleep_ok(void) { - int64_t connecting_delay_ticks = CIRCUITPY_USB_CONNECTED_SLEEP_DELAY * 1024 - port_get_raw_ticks(NULL); - return !common_hal_wifi_radio_get_enabled(&common_hal_wifi_radio_obj) && - !supervisor_workflow_active() && - connecting_delay_ticks <= 0; -} - mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms) { _setup_sleep_alarms(false, n_alarms, alarms); - // Light sleep can break some functionality so only do it when possible. Otherwise we idle. - if (_light_sleep_ok()) { - // Flush the UART to complete the log line. - uart_wait_tx_idle_polling(CONFIG_ESP_CONSOLE_UART_NUM); - esp_light_sleep_start(); - } else { - _idle_until_alarm(); + // We cannot esp_light_sleep_start() here because it shuts down all non-RTC peripherals. + _idle_until_alarm(); + + if (mp_hal_is_interrupted()) { + return mp_const_none; // Shouldn't be given to python code because exception handling should kick in. } mp_obj_t wake_alarm = _get_wake_alarm(n_alarms, alarms); @@ -154,7 +143,7 @@ void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *ala } void NORETURN alarm_enter_deep_sleep(void) { - alarm_pin_pin_alarm_prepare_for_deep_sleep(); + alarm_pin_pinalarm_prepare_for_deep_sleep(); // The ESP-IDF caches the deep sleep settings and applies them before sleep. // We don't need to worry about resetting them in the interim. esp_deep_sleep_start(); diff --git a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c index 01e2faeb8751e..df8d10ef9e544 100644 --- a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +++ b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.c @@ -38,7 +38,7 @@ #include "components/soc/src/esp32s2/include/hal/gpio_ll.h" #include "components/xtensa/include/esp_debug_helpers.h" -void common_hal_alarm_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, mcu_pin_obj_t *pin, bool value, bool edge, bool pull) { +void common_hal_alarm_pin_pinalarm_construct(alarm_pin_pinalarm_obj_t *self, mcu_pin_obj_t *pin, bool value, bool edge, bool pull) { if (edge) { mp_raise_ValueError(translate("Cannot wake on pin edge. Only level.")); } @@ -51,41 +51,41 @@ void common_hal_alarm_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, m self->pull = pull; } -mcu_pin_obj_t *common_hal_alarm_pin_pin_alarm_get_pin(alarm_pin_pin_alarm_obj_t *self) { +mcu_pin_obj_t *common_hal_alarm_pin_pinalarm_get_pin(alarm_pin_pinalarm_obj_t *self) { return self->pin; } -bool common_hal_alarm_pin_pin_alarm_get_value(alarm_pin_pin_alarm_obj_t *self) { +bool common_hal_alarm_pin_pinalarm_get_value(alarm_pin_pinalarm_obj_t *self) { return self->value; } -bool common_hal_alarm_pin_pin_alarm_get_edge(alarm_pin_pin_alarm_obj_t *self) { +bool common_hal_alarm_pin_pinalarm_get_edge(alarm_pin_pinalarm_obj_t *self) { return false; } -bool common_hal_alarm_pin_pin_alarm_get_pull(alarm_pin_pin_alarm_obj_t *self) { +bool common_hal_alarm_pin_pinalarm_get_pull(alarm_pin_pinalarm_obj_t *self) { return self->pull; } gpio_isr_handle_t gpio_interrupt_handle; // Low and high are relative to pin number. 32+ is high. <32 is low. -static volatile uint32_t low_pin_status = 0; -static volatile uint32_t high_pin_status = 0; +static volatile uint32_t pin_31_0_status = 0; +static volatile uint32_t pin_63_32_status = 0; void gpio_interrupt(void *arg) { (void) arg; - gpio_ll_get_intr_status(&GPIO, xPortGetCoreID(), (uint32_t*) &low_pin_status); - gpio_ll_clear_intr_status(&GPIO, low_pin_status); - gpio_ll_get_intr_status_high(&GPIO, xPortGetCoreID(), (uint32_t*) &high_pin_status); - gpio_ll_clear_intr_status_high(&GPIO, high_pin_status); + gpio_ll_get_intr_status(&GPIO, xPortGetCoreID(), (uint32_t*) &pin_31_0_status); + gpio_ll_clear_intr_status(&GPIO, pin_31_0_status); + gpio_ll_get_intr_status_high(&GPIO, xPortGetCoreID(), (uint32_t*) &pin_63_32_status); + gpio_ll_clear_intr_status_high(&GPIO, pin_63_32_status); // disable the interrupts that fired, maybe all of them for (size_t i = 0; i < 32; i++) { uint32_t mask = 1 << i; - if ((low_pin_status & mask) != 0) { + if ((pin_31_0_status & mask) != 0) { gpio_ll_intr_disable(&GPIO, i); } - if ((high_pin_status & mask) != 0) { + if ((pin_63_32_status & mask) != 0) { gpio_ll_intr_disable(&GPIO, 32 + i); } } @@ -96,18 +96,18 @@ void gpio_interrupt(void *arg) { } } -bool alarm_pin_pin_alarm_woke_us_up(void) { - return low_pin_status != 0 || high_pin_status != 0; +bool alarm_pin_pinalarm_woke_us_up(void) { + return pin_31_0_status != 0 || pin_63_32_status != 0; } -mp_obj_t alarm_pin_pin_alarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms) { +mp_obj_t alarm_pin_pinalarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms) { // First, check to see if we match any given alarms. - uint64_t pin_status = ((uint64_t) high_pin_status) << 32 | low_pin_status; + uint64_t pin_status = ((uint64_t) pin_63_32_status) << 32 | pin_31_0_status; for (size_t i = 0; i < n_alarms; i++) { - if (!MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pin_alarm_type)) { + if (!MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pinalarm_type)) { continue; } - alarm_pin_pin_alarm_obj_t *alarm = MP_OBJ_TO_PTR(alarms[i]); + alarm_pin_pinalarm_obj_t *alarm = MP_OBJ_TO_PTR(alarms[i]); if ((pin_status & (1ull << alarm->pin->number)) != 0) { return alarms[i]; } @@ -131,8 +131,8 @@ mp_obj_t alarm_pin_pin_alarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *a } } - alarm_pin_pin_alarm_obj_t *alarm = m_new_obj(alarm_pin_pin_alarm_obj_t); - alarm->base.type = &alarm_pin_pin_alarm_type; + alarm_pin_pinalarm_obj_t *alarm = m_new_obj(alarm_pin_pinalarm_obj_t); + alarm->base.type = &alarm_pin_pinalarm_type; alarm->pin = NULL; // Map the pin number back to a pin object. for (size_t i = 0; i < mcu_pin_globals.map.used; i++) { @@ -151,7 +151,7 @@ static uint64_t high_alarms = 0; static uint64_t low_alarms = 0; static uint64_t pull_pins = 0; -void alarm_pin_pin_alarm_reset(void) { +void alarm_pin_pinalarm_reset(void) { if (gpio_interrupt_handle != NULL) { esp_intr_free(gpio_interrupt_handle); gpio_interrupt_handle = NULL; @@ -168,21 +168,21 @@ void alarm_pin_pin_alarm_reset(void) { high_alarms = 0; low_alarms = 0; pull_pins = 0; - high_pin_status = 0; - low_pin_status = 0; + pin_63_32_status = 0; + pin_31_0_status = 0; } -void alarm_pin_pin_alarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms) { +void alarm_pin_pinalarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms) { // Bitmask of wake up settings. size_t high_count = 0; size_t low_count = 0; for (size_t i = 0; i < n_alarms; i++) { // TODO: Check for ULP or touch alarms because they can't coexist with GPIO alarms. - if (!MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pin_alarm_type)) { + if (!MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pinalarm_type)) { continue; } - alarm_pin_pin_alarm_obj_t *alarm = MP_OBJ_TO_PTR(alarms[i]); + alarm_pin_pinalarm_obj_t *alarm = MP_OBJ_TO_PTR(alarms[i]); gpio_num_t pin_number = alarm->pin->number; if (alarm->value) { @@ -239,8 +239,8 @@ void alarm_pin_pin_alarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_o } // Set GPIO interrupts so they wake us from light sleep or from idle via the // interrupt handler above. - low_pin_status = 0; - high_pin_status = 0; + pin_31_0_status = 0; + pin_63_32_status = 0; if (gpio_isr_register(gpio_interrupt, NULL, 0, &gpio_interrupt_handle) != ESP_OK) { mp_raise_ValueError(translate("Can only alarm on RTC IO from deep sleep.")); } @@ -282,7 +282,7 @@ void alarm_pin_pin_alarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_o } -void alarm_pin_pin_alarm_prepare_for_deep_sleep(void) { +void alarm_pin_pinalarm_prepare_for_deep_sleep(void) { if (pull_pins == 0) { return; } diff --git a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h index 8b14931cab328..93672c1f2d747 100644 --- a/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h +++ b/ports/esp32s2/common-hal/alarm/pin/PinAlarm.h @@ -32,10 +32,10 @@ typedef struct { mcu_pin_obj_t *pin; bool value; bool pull; -} alarm_pin_pin_alarm_obj_t; +} alarm_pin_pinalarm_obj_t; -void alarm_pin_pin_alarm_reset(void); -void alarm_pin_pin_alarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms); -void alarm_pin_pin_alarm_prepare_for_deep_sleep(void); -mp_obj_t alarm_pin_pin_alarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms); -bool alarm_pin_pin_alarm_woke_us_up(void); +void alarm_pin_pinalarm_reset(void); +void alarm_pin_pinalarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms); +void alarm_pin_pinalarm_prepare_for_deep_sleep(void); +mp_obj_t alarm_pin_pinalarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms); +bool alarm_pin_pinalarm_woke_us_up(void); diff --git a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c index a7abde6a4e3b2..bcde0ab3c0e03 100644 --- a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +++ b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.c @@ -34,23 +34,23 @@ #include "shared-bindings/alarm/time/TimeAlarm.h" #include "shared-bindings/time/__init__.h" -void common_hal_alarm_time_time_alarm_construct(alarm_time_time_alarm_obj_t *self, mp_float_t monotonic_time) { +void common_hal_alarm_time_timealarm_construct(alarm_time_timealarm_obj_t *self, mp_float_t monotonic_time) { self->monotonic_time = monotonic_time; } -mp_float_t common_hal_alarm_time_time_alarm_get_monotonic_time(alarm_time_time_alarm_obj_t *self) { +mp_float_t common_hal_alarm_time_timealarm_get_monotonic_time(alarm_time_timealarm_obj_t *self) { return self->monotonic_time; } mp_obj_t alarm_time_timealarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms) { // First, check to see if we match for (size_t i = 0; i < n_alarms; i++) { - if (MP_OBJ_IS_TYPE(alarms[i], &alarm_time_time_alarm_type)) { + if (MP_OBJ_IS_TYPE(alarms[i], &alarm_time_timealarm_type)) { return alarms[i]; } } - alarm_time_time_alarm_obj_t *timer = m_new_obj(alarm_time_time_alarm_obj_t); - timer->base.type = &alarm_time_time_alarm_type; + alarm_time_timealarm_obj_t *timer = m_new_obj(alarm_time_timealarm_obj_t); + timer->base.type = &alarm_time_timealarm_type; // TODO: Set monotonic_time based on the RTC state. timer->monotonic_time = 0.0f; return timer; @@ -78,20 +78,20 @@ void alarm_time_timealarm_reset(void) { } void alarm_time_timealarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms) { - bool time_alarm_set = false; - alarm_time_time_alarm_obj_t *time_alarm = MP_OBJ_NULL; + bool timealarm_set = false; + alarm_time_timealarm_obj_t *timealarm = MP_OBJ_NULL; for (size_t i = 0; i < n_alarms; i++) { - if (!MP_OBJ_IS_TYPE(alarms[i], &alarm_time_time_alarm_type)) { + if (!MP_OBJ_IS_TYPE(alarms[i], &alarm_time_timealarm_type)) { continue; } - if (time_alarm_set) { + if (timealarm_set) { mp_raise_ValueError(translate("Only one alarm.time alarm can be set.")); } - time_alarm = MP_OBJ_TO_PTR(alarms[i]); - time_alarm_set = true; + timealarm = MP_OBJ_TO_PTR(alarms[i]); + timealarm_set = true; } - if (!time_alarm_set) { + if (!timealarm_set) { return; } @@ -109,7 +109,7 @@ void alarm_time_timealarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_ // Compute how long to actually sleep, considering the time now. mp_float_t now_secs = uint64_to_float(common_hal_time_monotonic_ms()) / 1000.0f; - mp_float_t wakeup_in_secs = MAX(0.0f, time_alarm->monotonic_time - now_secs); + mp_float_t wakeup_in_secs = MAX(0.0f, timealarm->monotonic_time - now_secs); const uint64_t sleep_for_us = (uint64_t) (wakeup_in_secs * 1000000); esp_sleep_enable_timer_wakeup(sleep_for_us); diff --git a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h index 277ababc2041e..dfd75524fd61a 100644 --- a/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h +++ b/ports/esp32s2/common-hal/alarm/time/TimeAlarm.h @@ -30,7 +30,7 @@ typedef struct { mp_obj_base_t base; mp_float_t monotonic_time; // values compatible with time.monotonic_time() -} alarm_time_time_alarm_obj_t; +} alarm_time_timealarm_obj_t; // Find the alarm object that caused us to wake up or create an equivalent one. mp_obj_t alarm_time_timealarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms); diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 8a87180cd9a33..17a413a2ed5ba 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -74,6 +74,10 @@ extern void esp_restart(void) NORETURN; void tick_timer_cb(void* arg) { supervisor_tick(); + + // CircuitPython's VM is run in a separate FreeRTOS task from timer callbacks. So, we have to + // notify the main task every time in case it's waiting for us. + xTaskNotifyGive(circuitpython_task); } void sleep_timer_cb(void* arg); @@ -92,6 +96,8 @@ safe_mode_t port_init(void) { args.name = "CircuitPython Sleep"; esp_timer_create(&args, &_sleep_timer); + circuitpython_task = xTaskGetCurrentTaskHandle(); + // Send the ROM output out of the UART. This includes early logs. #ifdef DEBUG ets_install_uart_printf(); @@ -114,17 +120,17 @@ safe_mode_t port_init(void) { } esp_reset_reason_t reason = esp_reset_reason(); - if (reason == ESP_RST_BROWNOUT) { - return BROWNOUT; - } - if (reason == ESP_RST_PANIC || - reason == ESP_RST_INT_WDT || - reason == ESP_RST_WDT) { - return HARD_CRASH; + switch (reason) { + case ESP_RST_BROWNOUT: + return BROWNOUT; + case ESP_RST_PANIC: + case ESP_RST_INT_WDT: + case ESP_RST_WDT: + return HARD_CRASH; + default: + break; } - circuitpython_task = xTaskGetCurrentTaskHandle(); - return NO_SAFE_MODE; } @@ -262,10 +268,6 @@ void port_enable_tick(void) { // Disable 1/1024 second tick. void port_disable_tick(void) { esp_timer_stop(_tick_timer); - - // CircuitPython's VM is run in a separate FreeRTOS task from TinyUSB. - // Tick disable can happen via auto-reload so poke the main task here. - xTaskNotifyGive(circuitpython_task); } void sleep_timer_cb(void* arg) { diff --git a/py/obj.c b/py/obj.c index 218fb43213d03..5f19089e85097 100644 --- a/py/obj.c +++ b/py/obj.c @@ -68,10 +68,12 @@ void mp_obj_print_helper(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t #ifdef RUN_BACKGROUND_TASKS RUN_BACKGROUND_TASKS; #endif + #if MICROPY_KBD_EXCEPTION // Stop printing if we've been interrupted. if (mp_hal_is_interrupted()) { return; } + #endif #ifndef NDEBUG if (o_in == MP_OBJ_NULL) { diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 778674f6d57ad..dc5309353b1ff 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -71,8 +71,8 @@ void validate_objs_are_alarms(size_t n_args, const mp_obj_t *objs) { for (size_t i = 0; i < n_args; i++) { - if (MP_OBJ_IS_TYPE(objs[i], &alarm_pin_pin_alarm_type) || - MP_OBJ_IS_TYPE(objs[i], &alarm_time_time_alarm_type)) { + if (MP_OBJ_IS_TYPE(objs[i], &alarm_pin_pinalarm_type) || + MP_OBJ_IS_TYPE(objs[i], &alarm_time_timealarm_type)) { continue; } mp_raise_TypeError_varg(translate("Expected an alarm")); @@ -159,7 +159,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_exit_and_deep_sleep_until_alarms_obj, STATIC const mp_map_elem_t alarm_pin_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_pin) }, - { MP_ROM_QSTR(MP_QSTR_PinAlarm), MP_OBJ_FROM_PTR(&alarm_pin_pin_alarm_type) }, + { MP_ROM_QSTR(MP_QSTR_PinAlarm), MP_OBJ_FROM_PTR(&alarm_pin_pinalarm_type) }, }; STATIC MP_DEFINE_CONST_DICT(alarm_pin_globals, alarm_pin_globals_table); @@ -172,7 +172,7 @@ STATIC const mp_obj_module_t alarm_pin_module = { STATIC const mp_map_elem_t alarm_time_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_time) }, - { MP_ROM_QSTR(MP_QSTR_TimeAlarm), MP_OBJ_FROM_PTR(&alarm_time_time_alarm_type) }, + { MP_ROM_QSTR(MP_QSTR_TimeAlarm), MP_OBJ_FROM_PTR(&alarm_time_timealarm_type) }, }; STATIC MP_DEFINE_CONST_DICT(alarm_time_globals, alarm_time_globals_table); @@ -199,7 +199,7 @@ STATIC mp_map_elem_t alarm_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SleepMemory), MP_OBJ_FROM_PTR(&alarm_sleep_memory_type) }, { MP_ROM_QSTR(MP_QSTR_sleep_memory), MP_OBJ_FROM_PTR(&alarm_sleep_memory_obj) }, }; -MP_DEFINE_MUTABLE_DICT(alarm_module_globals, alarm_module_globals_table); +STATIC MP_DEFINE_MUTABLE_DICT(alarm_module_globals, alarm_module_globals_table); // Fetch value from module dict. mp_obj_t alarm_get_wake_alarm(void) { diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h index a90405da6bbd8..4c12e0e70a645 100644 --- a/shared-bindings/alarm/__init__.h +++ b/shared-bindings/alarm/__init__.h @@ -31,9 +31,6 @@ #include "common-hal/alarm/__init__.h" -// Make module dict available elsewhere, so we can fetch -extern mp_obj_dict_t alarm_module_globals; - extern mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms); // Deep sleep is a two step process. Alarms are set when the VM is valid but diff --git a/shared-bindings/alarm/pin/PinAlarm.c b/shared-bindings/alarm/pin/PinAlarm.c index 83ccc0d766294..89de016bcc06c 100644 --- a/shared-bindings/alarm/pin/PinAlarm.c +++ b/shared-bindings/alarm/pin/PinAlarm.c @@ -60,9 +60,9 @@ //| """ //| ... //| -STATIC mp_obj_t alarm_pin_pin_alarm_make_new(const mp_obj_type_t *type, mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - alarm_pin_pin_alarm_obj_t *self = m_new_obj(alarm_pin_pin_alarm_obj_t); - self->base.type = &alarm_pin_pin_alarm_type; +STATIC mp_obj_t alarm_pin_pinalarm_make_new(const mp_obj_type_t *type, mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + alarm_pin_pinalarm_obj_t *self = m_new_obj(alarm_pin_pinalarm_obj_t); + self->base.type = &alarm_pin_pinalarm_type; enum { ARG_pin, ARG_value, ARG_edge, ARG_pull }; static const mp_arg_t allowed_args[] = { { MP_QSTR_pin, MP_ARG_REQUIRED | MP_ARG_OBJ }, @@ -75,7 +75,7 @@ STATIC mp_obj_t alarm_pin_pin_alarm_make_new(const mp_obj_type_t *type, mp_uint_ mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj); - common_hal_alarm_pin_pin_alarm_construct(self, + common_hal_alarm_pin_pinalarm_construct(self, pin, args[ARG_value].u_bool, args[ARG_edge].u_bool, @@ -87,19 +87,19 @@ STATIC mp_obj_t alarm_pin_pin_alarm_make_new(const mp_obj_type_t *type, mp_uint_ //| pin: microcontroller.Pin //| """The trigger pin.""" //| -STATIC mp_obj_t alarm_pin_pin_alarm_obj_get_pin(mp_obj_t self_in) { - alarm_pin_pin_alarm_obj_t *self = MP_OBJ_TO_PTR(self_in); - mcu_pin_obj_t* pin = common_hal_alarm_pin_pin_alarm_get_pin(self); +STATIC mp_obj_t alarm_pin_pinalarm_obj_get_pin(mp_obj_t self_in) { + alarm_pin_pinalarm_obj_t *self = MP_OBJ_TO_PTR(self_in); + mcu_pin_obj_t* pin = common_hal_alarm_pin_pinalarm_get_pin(self); if (pin == NULL) { return mp_const_none; } return MP_OBJ_FROM_PTR(pin); } -MP_DEFINE_CONST_FUN_OBJ_1(alarm_pin_pin_alarm_get_pin_obj, alarm_pin_pin_alarm_obj_get_pin); +MP_DEFINE_CONST_FUN_OBJ_1(alarm_pin_pinalarm_get_pin_obj, alarm_pin_pinalarm_obj_get_pin); -const mp_obj_property_t alarm_pin_pin_alarm_pin_obj = { +const mp_obj_property_t alarm_pin_pinalarm_pin_obj = { .base.type = &mp_type_property, - .proxy = {(mp_obj_t)&alarm_pin_pin_alarm_get_pin_obj, + .proxy = {(mp_obj_t)&alarm_pin_pinalarm_get_pin_obj, (mp_obj_t)&mp_const_none_obj, (mp_obj_t)&mp_const_none_obj}, }; @@ -107,29 +107,29 @@ const mp_obj_property_t alarm_pin_pin_alarm_pin_obj = { //| value: bool //| """The value on which to trigger.""" //| -STATIC mp_obj_t alarm_pin_pin_alarm_obj_get_value(mp_obj_t self_in) { - alarm_pin_pin_alarm_obj_t *self = MP_OBJ_TO_PTR(self_in); - return mp_obj_new_bool(common_hal_alarm_pin_pin_alarm_get_value(self)); +STATIC mp_obj_t alarm_pin_pinalarm_obj_get_value(mp_obj_t self_in) { + alarm_pin_pinalarm_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_bool(common_hal_alarm_pin_pinalarm_get_value(self)); } -MP_DEFINE_CONST_FUN_OBJ_1(alarm_pin_pin_alarm_get_value_obj, alarm_pin_pin_alarm_obj_get_value); +MP_DEFINE_CONST_FUN_OBJ_1(alarm_pin_pinalarm_get_value_obj, alarm_pin_pinalarm_obj_get_value); -const mp_obj_property_t alarm_pin_pin_alarm_value_obj = { +const mp_obj_property_t alarm_pin_pinalarm_value_obj = { .base.type = &mp_type_property, - .proxy = {(mp_obj_t)&alarm_pin_pin_alarm_get_value_obj, + .proxy = {(mp_obj_t)&alarm_pin_pinalarm_get_value_obj, (mp_obj_t)&mp_const_none_obj, (mp_obj_t)&mp_const_none_obj}, }; -STATIC const mp_rom_map_elem_t alarm_pin_pin_alarm_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_pin), MP_ROM_PTR(&alarm_pin_pin_alarm_pin_obj) }, - { MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&alarm_pin_pin_alarm_value_obj) }, +STATIC const mp_rom_map_elem_t alarm_pin_pinalarm_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_pin), MP_ROM_PTR(&alarm_pin_pinalarm_pin_obj) }, + { MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&alarm_pin_pinalarm_value_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(alarm_pin_pin_alarm_locals_dict, alarm_pin_pin_alarm_locals_dict_table); +STATIC MP_DEFINE_CONST_DICT(alarm_pin_pinalarm_locals_dict, alarm_pin_pinalarm_locals_dict_table); -const mp_obj_type_t alarm_pin_pin_alarm_type = { +const mp_obj_type_t alarm_pin_pinalarm_type = { { &mp_type_type }, .name = MP_QSTR_PinAlarm, - .make_new = alarm_pin_pin_alarm_make_new, - .locals_dict = (mp_obj_t)&alarm_pin_pin_alarm_locals_dict, + .make_new = alarm_pin_pinalarm_make_new, + .locals_dict = (mp_obj_t)&alarm_pin_pinalarm_locals_dict, }; diff --git a/shared-bindings/alarm/pin/PinAlarm.h b/shared-bindings/alarm/pin/PinAlarm.h index 49ba71089970c..48865009c3877 100644 --- a/shared-bindings/alarm/pin/PinAlarm.h +++ b/shared-bindings/alarm/pin/PinAlarm.h @@ -24,20 +24,20 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_PIN_PIN_ALARM_H -#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_PIN_PIN_ALARM_H +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_PIN_PINALARM_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_PIN_PINALARM_H #include "py/obj.h" #include "py/objtuple.h" #include "common-hal/microcontroller/Pin.h" #include "common-hal/alarm/pin/PinAlarm.h" -extern const mp_obj_type_t alarm_pin_pin_alarm_type; +extern const mp_obj_type_t alarm_pin_pinalarm_type; -void common_hal_alarm_pin_pin_alarm_construct(alarm_pin_pin_alarm_obj_t *self, mcu_pin_obj_t *pin, bool value, bool edge, bool pull); -extern mcu_pin_obj_t *common_hal_alarm_pin_pin_alarm_get_pin(alarm_pin_pin_alarm_obj_t *self); -extern bool common_hal_alarm_pin_pin_alarm_get_value(alarm_pin_pin_alarm_obj_t *self); -extern bool common_hal_alarm_pin_pin_alarm_get_edge(alarm_pin_pin_alarm_obj_t *self); -extern bool common_hal_alarm_pin_pin_alarm_get_pull(alarm_pin_pin_alarm_obj_t *self); +void common_hal_alarm_pin_pinalarm_construct(alarm_pin_pinalarm_obj_t *self, mcu_pin_obj_t *pin, bool value, bool edge, bool pull); +extern mcu_pin_obj_t *common_hal_alarm_pin_pinalarm_get_pin(alarm_pin_pinalarm_obj_t *self); +extern bool common_hal_alarm_pin_pinalarm_get_value(alarm_pin_pinalarm_obj_t *self); +extern bool common_hal_alarm_pin_pinalarm_get_edge(alarm_pin_pinalarm_obj_t *self); +extern bool common_hal_alarm_pin_pinalarm_get_pull(alarm_pin_pinalarm_obj_t *self); -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_PIN_PIN_ALARM_H +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_PIN_PINALARM_H diff --git a/shared-bindings/alarm/time/TimeAlarm.c b/shared-bindings/alarm/time/TimeAlarm.c index 1c4d976ada0ff..1c9b8d37c5b75 100644 --- a/shared-bindings/alarm/time/TimeAlarm.c +++ b/shared-bindings/alarm/time/TimeAlarm.c @@ -56,10 +56,10 @@ mp_obj_t MP_WEAK rtc_get_time_source_time(void) { //| """ //| ... //| -STATIC mp_obj_t alarm_time_time_alarm_make_new(const mp_obj_type_t *type, +STATIC mp_obj_t alarm_time_timealarm_make_new(const mp_obj_type_t *type, mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - alarm_time_time_alarm_obj_t *self = m_new_obj(alarm_time_time_alarm_obj_t); - self->base.type = &alarm_time_time_alarm_type; + alarm_time_timealarm_obj_t *self = m_new_obj(alarm_time_timealarm_obj_t); + self->base.type = &alarm_time_timealarm_type; enum { ARG_monotonic_time, ARG_epoch_time }; static const mp_arg_t allowed_args[] = { @@ -105,7 +105,7 @@ STATIC mp_obj_t alarm_time_time_alarm_make_new(const mp_obj_type_t *type, mp_raise_ValueError(translate("Time is in the past.")); } - common_hal_alarm_time_time_alarm_construct(self, monotonic_time); + common_hal_alarm_time_timealarm_construct(self, monotonic_time); return MP_OBJ_FROM_PTR(self); } @@ -116,28 +116,28 @@ STATIC mp_obj_t alarm_time_time_alarm_make_new(const mp_obj_type_t *type, //| by this property only as a `time.monotonic()` time. //| """ //| -STATIC mp_obj_t alarm_time_time_alarm_obj_get_monotonic_time(mp_obj_t self_in) { - alarm_time_time_alarm_obj_t *self = MP_OBJ_TO_PTR(self_in); - return mp_obj_new_float(common_hal_alarm_time_time_alarm_get_monotonic_time(self)); +STATIC mp_obj_t alarm_time_timealarm_obj_get_monotonic_time(mp_obj_t self_in) { + alarm_time_timealarm_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_float(common_hal_alarm_time_timealarm_get_monotonic_time(self)); } -MP_DEFINE_CONST_FUN_OBJ_1(alarm_time_time_alarm_get_monotonic_time_obj, alarm_time_time_alarm_obj_get_monotonic_time); +MP_DEFINE_CONST_FUN_OBJ_1(alarm_time_timealarm_get_monotonic_time_obj, alarm_time_timealarm_obj_get_monotonic_time); -const mp_obj_property_t alarm_time_time_alarm_monotonic_time_obj = { +const mp_obj_property_t alarm_time_timealarm_monotonic_time_obj = { .base.type = &mp_type_property, - .proxy = {(mp_obj_t)&alarm_time_time_alarm_get_monotonic_time_obj, + .proxy = {(mp_obj_t)&alarm_time_timealarm_get_monotonic_time_obj, (mp_obj_t)&mp_const_none_obj, (mp_obj_t)&mp_const_none_obj}, }; -STATIC const mp_rom_map_elem_t alarm_time_time_alarm_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_monotonic_time), MP_ROM_PTR(&alarm_time_time_alarm_monotonic_time_obj) }, +STATIC const mp_rom_map_elem_t alarm_time_timealarm_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_monotonic_time), MP_ROM_PTR(&alarm_time_timealarm_monotonic_time_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(alarm_time_time_alarm_locals_dict, alarm_time_time_alarm_locals_dict_table); +STATIC MP_DEFINE_CONST_DICT(alarm_time_timealarm_locals_dict, alarm_time_timealarm_locals_dict_table); -const mp_obj_type_t alarm_time_time_alarm_type = { +const mp_obj_type_t alarm_time_timealarm_type = { { &mp_type_type }, .name = MP_QSTR_TimeAlarm, - .make_new = alarm_time_time_alarm_make_new, - .locals_dict = (mp_obj_t)&alarm_time_time_alarm_locals_dict, + .make_new = alarm_time_timealarm_make_new, + .locals_dict = (mp_obj_t)&alarm_time_timealarm_locals_dict, }; diff --git a/shared-bindings/alarm/time/TimeAlarm.h b/shared-bindings/alarm/time/TimeAlarm.h index ceb3291c9d857..0a4b9caf4a299 100644 --- a/shared-bindings/alarm/time/TimeAlarm.h +++ b/shared-bindings/alarm/time/TimeAlarm.h @@ -24,16 +24,16 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_MONOTONIC_TIME_ALARM_H -#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_MONOTINIC_TIME_ALARM_H +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_TIMEALARM_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_TIMEALARM_H #include "py/obj.h" #include "common-hal/alarm/time/TimeAlarm.h" -extern const mp_obj_type_t alarm_time_time_alarm_type; +extern const mp_obj_type_t alarm_time_timealarm_type; -extern void common_hal_alarm_time_time_alarm_construct(alarm_time_time_alarm_obj_t *self, mp_float_t monotonic_time); -extern mp_float_t common_hal_alarm_time_time_alarm_get_monotonic_time(alarm_time_time_alarm_obj_t *self); +extern void common_hal_alarm_time_timealarm_construct(alarm_time_timealarm_obj_t *self, mp_float_t monotonic_time); +extern mp_float_t common_hal_alarm_time_timealarm_get_monotonic_time(alarm_time_timealarm_obj_t *self); -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_MONOTONIC_TIME_ALARM_H +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_TIMEALARM_H From e9c9fce15ddf292763cf4375c6e5e0c3f25d9e35 Mon Sep 17 00:00:00 2001 From: BennyE Date: Wed, 23 Dec 2020 14:59:09 +0100 Subject: [PATCH 489/770] Remove debug log messages --- ports/esp32s2/common-hal/wifi/Radio.c | 41 ++----------------- .../esp32s2/common-hal/wifi/ScannedNetworks.c | 6 --- 2 files changed, 3 insertions(+), 44 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index 08d8bbcd50c3f..d4db5d08d368d 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -198,55 +198,20 @@ mp_obj_t common_hal_wifi_radio_get_ap_info(wifi_radio_obj_t *self) { if (esp_wifi_sta_get_ap_info(&self->ap_info.record) != ESP_OK){ return mp_const_none; } else { - ESP_EARLY_LOGW(TAG, "country before handler country: %s", (char *)&self->ap_info.record.country); - ESP_EARLY_LOGW(TAG, "country memory at: %p", self->ap_info.record.country); - ESP_EARLY_LOGW(TAG, "countryCC memory at: %p", self->ap_info.record.country.cc); - ESP_EARLY_LOGW(TAG, "countryCC strlen: %d", strlen(self->ap_info.record.country.cc)); // The struct member appears to be (not NULL!), I don't know how to properly test for it. - // If the ESP-IDF starts working fine, this "if" wouldn't trigger. + // When the ESP-IDF starts working fine (when their bugfix is available), this "if" wouldn't trigger. // Note: It is possible that Wi-Fi APs don't have a CC set, then even after this workaround // the element would remain empty. if (strlen(self->ap_info.record.country.cc) == 0) { // Workaround to fill country related information in ap_info until ESP-IDF carries a fix // esp_wifi_sta_get_ap_info does not appear to fill wifi_country_t (e.g. country.cc) details // (IDFGH-4437) #6267 - ESP_EARLY_LOGW(TAG, "Triggered missing country workaround"); if (esp_wifi_get_country(&self->ap_info.record.country) == ESP_OK) { - ESP_EARLY_LOGW(TAG, "Workaround worked fine!"); - ESP_EARLY_LOGW(TAG, "country: %d", self->ap_info.record.country); - ESP_EARLY_LOGW(TAG, "CC: %s", self->ap_info.record.country.cc); + ESP_EARLY_LOGW(TAG, "Country Code: %s", self->ap_info.record.country.cc); } else { - ESP_EARLY_LOGW(TAG, "Workaround failed!"); + ESP_EARLY_LOGW(TAG, "Country Code - Workaround failed!"); } - //} else { - // ESP_EARLY_LOGW(TAG, "Triggered missing country workaround IN ELSE"); - // //memset(&self->ap_info.record.country, 0, sizeof(wifi_country_t)); - // if (esp_wifi_get_country(&self->ap_info.record.country) == ESP_OK) { - // //if (esp_wifi_get_country(&self->ap_info.record.country) == ESP_OK) { - // ESP_EARLY_LOGW(TAG, "Workaround worked fine!"); - // ESP_EARLY_LOGW(TAG, "CC: %s", self->ap_info.record.country.cc); - // } else { - // ESP_EARLY_LOGW(TAG, "Workaround failed!"); - // } } - ESP_EARLY_LOGW(TAG, "ssid: %s", self->ap_info.record.ssid); - ESP_EARLY_LOGW(TAG, "channel: %d", self->ap_info.record.primary); - ESP_EARLY_LOGW(TAG, "secondary: %d", self->ap_info.record.second); - ESP_EARLY_LOGW(TAG, "rssi: %d", self->ap_info.record.rssi); - ESP_EARLY_LOGW(TAG, "authmode: %d", self->ap_info.record.authmode); - ESP_EARLY_LOGW(TAG, "pairwise_cipher: %d", self->ap_info.record.pairwise_cipher); - ESP_EARLY_LOGW(TAG, "group_cipher: %d", self->ap_info.record.group_cipher); - ESP_EARLY_LOGW(TAG, "11b: %d", self->ap_info.record.phy_11b); - ESP_EARLY_LOGW(TAG, "11g: %d", self->ap_info.record.phy_11g); - ESP_EARLY_LOGW(TAG, "11n: %d", self->ap_info.record.phy_11n); - ESP_EARLY_LOGW(TAG, "phy_lr: %d", self->ap_info.record.phy_lr); - ESP_EARLY_LOGW(TAG, "ap_info.record: %s", self->ap_info.record); - ESP_EARLY_LOGW(TAG, "country with cast: %s", (char *)&self->ap_info.record.country); - //ESP_EARLY_LOGW(TAG, "country: %s", self->ap_info.record.country); - ESP_EARLY_LOGW(TAG, "country memory at: %p", self->ap_info.record.country); - ESP_EARLY_LOGW(TAG, "countryCC: %s", self->ap_info.record.country.cc); - ESP_EARLY_LOGW(TAG, "countryCC memory at: %p", self->ap_info.record.country.cc); - ESP_EARLY_LOGW(TAG, "countryCC strlen: %d", strlen(self->ap_info.record.country.cc)); memcpy(&ap_info->record, &self->ap_info.record, sizeof(wifi_ap_record_t)); return MP_OBJ_FROM_PTR(ap_info); } diff --git a/ports/esp32s2/common-hal/wifi/ScannedNetworks.c b/ports/esp32s2/common-hal/wifi/ScannedNetworks.c index 0540ffc5ccd9f..cc733308db60e 100644 --- a/ports/esp32s2/common-hal/wifi/ScannedNetworks.c +++ b/ports/esp32s2/common-hal/wifi/ScannedNetworks.c @@ -39,10 +39,6 @@ #include "components/esp_wifi/include/esp_wifi.h" -#include "components/log/include/esp_log.h" - -static const char* TAG = "wifi"; - static void wifi_scannednetworks_done(wifi_scannednetworks_obj_t *self) { self->done = true; if (self->results != NULL) { @@ -121,8 +117,6 @@ mp_obj_t common_hal_wifi_scannednetworks_next(wifi_scannednetworks_obj_t *self) wifi_network_obj_t *entry = m_new_obj(wifi_network_obj_t); entry->base.type = &wifi_network_type; - // benny remove again - ESP_EARLY_LOGW(TAG, "scan country: %s", &self->results[self->current_result].country); memcpy(&entry->record, &self->results[self->current_result], sizeof(wifi_ap_record_t)); self->current_result++; From 42a229c08b6b5d64af8d4bc5ec99f3e285befd14 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 23 Dec 2020 10:43:04 -0600 Subject: [PATCH 490/770] circuitpy_mpconfig.mk: Unconditionally disable CIRCUITPY_BUSDEVICE Several issues have been found in the implementation. While they're unresolved, it may be better to disable the built-in module. (This means that to work on fixing the module, it'll be necessary to revert this commit) --- py/circuitpy_mpconfig.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index af1dccf0243f0..e588c41e0d178 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -96,7 +96,7 @@ CFLAGS += -DCIRCUITPY_BLEIO=$(CIRCUITPY_BLEIO) CIRCUITPY_BOARD ?= 1 CFLAGS += -DCIRCUITPY_BOARD=$(CIRCUITPY_BOARD) -CIRCUITPY_BUSDEVICE ?= $(CIRCUITPY_FULL_BUILD) +CIRCUITPY_BUSDEVICE = 0 CFLAGS += -DCIRCUITPY_BUSDEVICE=$(CIRCUITPY_BUSDEVICE) CIRCUITPY_BUILTINS_POW3 ?= $(CIRCUITPY_FULL_BUILD) From ad4939ed5ccedefbaf0a9c3fbe8c9cfa08764e03 Mon Sep 17 00:00:00 2001 From: _fonzlate Date: Wed, 23 Dec 2020 19:48:15 +0000 Subject: [PATCH 491/770] Translated using Weblate (Dutch) Currently translated at 100.0% (882 of 882 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/nl/ --- locale/nl.po | 130 ++++++++++++++++++++++++++------------------------- 1 file changed, 67 insertions(+), 63 deletions(-) diff --git a/locale/nl.po b/locale/nl.po index bbd732cb5cf21..8712dc7ec58c3 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -6,15 +6,15 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-14 12:59-0500\n" -"PO-Revision-Date: 2020-10-27 16:47+0000\n" -"Last-Translator: Jelle Jager \n" +"PO-Revision-Date: 2020-12-23 20:14+0000\n" +"Last-Translator: _fonzlate \n" "Language-Team: none\n" "Language: nl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.3.2-dev\n" +"X-Generator: Weblate 4.4.1-dev\n" #: main.c msgid "" @@ -294,7 +294,7 @@ msgstr "Adres type buiten bereik" #: ports/esp32s2/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" -msgstr "" +msgstr "Alle CAN-peripherals zijn in gebruik" #: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" @@ -304,7 +304,7 @@ msgstr "Alle I2C peripherals zijn in gebruik" #: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" -msgstr "" +msgstr "Alle PCNT-eenheden zijn in gebruik" #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c @@ -427,7 +427,7 @@ msgstr "" #: ports/esp32s2/common-hal/canio/CAN.c msgid "Baudrate not supported by peripheral" -msgstr "" +msgstr "Baudrate wordt niet ondersteund door randapparatuur" #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c @@ -441,7 +441,7 @@ msgstr "Bit clock en word select moeten een clock eenheid delen" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Bit depth must be from 1 to 6 inclusive, not %d" -msgstr "" +msgstr "Bitdiepte moet tussen 1 en 6 liggen, niet %d" #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." @@ -859,7 +859,7 @@ msgstr "Verwachtte een adres" #: shared-bindings/alarm/__init__.c msgid "Expected an alarm" -msgstr "" +msgstr "Verwachtte een alarm" #: shared-module/_pixelbuf/PixelBuf.c #, c-format @@ -876,7 +876,7 @@ msgstr "FFT alleen voor ndarrays gedefineerd" #: extmod/ulab/code/fft/fft.c msgid "FFT is implemented for linear arrays only" -msgstr "" +msgstr "FFT is alleen geïmplementeerd voor lineaire arrays" #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" @@ -950,7 +950,7 @@ msgstr "Filters zijn te complex" #: ports/esp32s2/common-hal/dualbank/__init__.c msgid "Firmware image is invalid" -msgstr "" +msgstr "Firmware image is ongeldig" #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" @@ -1014,7 +1014,7 @@ msgstr "I2SOut is niet beschikbaar" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" -msgstr "" +msgstr "IO's 0, 2 en 4 ondersteunen geen interne pullup in slaapstand" #: shared-bindings/aesio/aes.c #, c-format @@ -1035,7 +1035,7 @@ msgstr "Incorrecte buffer grootte" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" -msgstr "" +msgstr "De initialisatie is mislukt vanwege een gebrek aan geheugen" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" @@ -1102,7 +1102,7 @@ msgstr "Ongeldige PWM frequentie" #: ports/esp32s2/common-hal/analogio/AnalogIn.c msgid "Invalid Pin" -msgstr "" +msgstr "Ongeldige Pin" #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" @@ -1300,7 +1300,7 @@ msgstr "Een meervoud van 6 rgb pinnen moet worden gebruikt, niet %d" #: ports/esp32s2/common-hal/nvm/ByteArray.c msgid "NVS Error" -msgstr "" +msgstr "NVS-fout" #: py/parse.c msgid "Name too long" @@ -1323,7 +1323,7 @@ msgstr "Geen DMA kanaal gevonden" #: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" -msgstr "" +msgstr "Geen I2C-apparaat op adres: %x" #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c @@ -1465,7 +1465,7 @@ msgstr "Alleen IPv4 adressen worden ondersteund" #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Only IPv4 sockets supported" -msgstr "" +msgstr "Alleen IPv4-sockets ondersteund" #: shared-module/displayio/OnDiskBitmap.c #, c-format @@ -1486,7 +1486,7 @@ msgstr "" #: ports/esp32s2/common-hal/alarm/__init__.c msgid "Only one alarm.time alarm can be set." -msgstr "" +msgstr "Slechts één alarm.time alarm kan worden ingesteld." #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" @@ -1551,7 +1551,7 @@ msgstr "Pin nummer al gereserveerd door EXTI" #: ports/esp32s2/common-hal/alarm/__init__.c msgid "PinAlarm not yet implemented" -msgstr "" +msgstr "PinAlarm nog niet geïmplementeerd" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format @@ -1598,10 +1598,14 @@ msgstr "Prefix buffer moet op de heap zijn" #: main.c msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" +"Druk een willekeurige toets om de REPL te starten. Gebruik CTRL+D om te " +"herstarten.\n" #: main.c msgid "Pretending to deep sleep until alarm, any key or file write.\n" msgstr "" +"Simuleert diepe slaapstand tot alarm, een willekeurige toets of schrijven " +"naar bestand.\n" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -1773,7 +1777,7 @@ msgstr "Geef op zijn minst 1 UART pin op" #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" -msgstr "" +msgstr "Geef monotonic_time of epoch_time" #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" @@ -1848,7 +1852,7 @@ msgstr "Tile breedte moet exact de bitmap breedte verdelen" #: shared-bindings/alarm/time/TimeAlarm.c msgid "Time is in the past." -msgstr "" +msgstr "Tijdstip ligt in het verleden." #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format @@ -1963,7 +1967,7 @@ msgstr "Niet in staat om naar nvm te schrijven." #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." -msgstr "" +msgstr "Kan niet naar sleep_memory schrijven." #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" @@ -2033,7 +2037,7 @@ msgstr "Niet-ondersteunde pull-waarde." #: ports/esp32s2/common-hal/dualbank/__init__.c msgid "Update Failed" -msgstr "" +msgstr "Update Mislukt" #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -2102,7 +2106,7 @@ msgstr "WiFi wachtwoord moet tussen 8 en 63 karakters bevatten" #: main.c msgid "Woken up by alarm.\n" -msgstr "" +msgstr "Gewekt door alarm.\n" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" @@ -2159,7 +2163,7 @@ msgstr "argsort argument moet een ndarray zijn" #: extmod/ulab/code/numerical/numerical.c msgid "argsort is not implemented for flattened arrays" -msgstr "" +msgstr "argsort wordt niet geïmplementeerd voor vlakke arrays" #: py/runtime.c msgid "argument has wrong type" @@ -2184,7 +2188,7 @@ msgstr "argumenten moeten ndarrays zijn" #: extmod/ulab/code/ndarray.c msgid "array and index length must be equal" -msgstr "" +msgstr "array en indexlengte moeten gelijk zijn" #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c @@ -2193,7 +2197,7 @@ msgstr "array/bytes vereist aan de rechterkant" #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" -msgstr "" +msgstr "verzoek om (arg)min.(arg)max te krijgen van lege reeks" #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" @@ -2205,15 +2209,15 @@ msgstr "attributen nog niet ondersteund" #: extmod/ulab/code/numerical/numerical.c msgid "axis is out of bounds" -msgstr "" +msgstr "as is buiten bereik" #: extmod/ulab/code/numerical/numerical.c msgid "axis must be None, or an integer" -msgstr "" +msgstr "as moet None of een integer zijn" #: extmod/ulab/code/numerical/numerical.c msgid "axis too long" -msgstr "" +msgstr "as te lang" #: py/builtinevex.c msgid "bad compile mode" @@ -2419,7 +2423,7 @@ msgstr "kan niet schakelen tussen handmatige en automatische veld specificatie" #: extmod/ulab/code/ndarray_operators.c msgid "cannot cast output with casting rule" -msgstr "" +msgstr "kan uitvoer niet converteren zonder conversieregel" #: py/objtype.c msgid "cannot create '%q' instances" @@ -2520,7 +2524,7 @@ msgstr "kon SD kaart versie niet bepalen" #: extmod/ulab/code/numerical/numerical.c msgid "cross is defined for 1D arrays of length 3" -msgstr "" +msgstr "kruis wordt gedefinieerd voor 1D-arrays van lengte 3" #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" @@ -2563,7 +2567,7 @@ msgstr "diff argument moet een ndarray zijn" #: extmod/ulab/code/numerical/numerical.c msgid "differentiation order out of range" -msgstr "" +msgstr "differentiatievolgorde buiten bereik" #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c @@ -2596,7 +2600,7 @@ msgstr "end_x moet een int zijn" #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" -msgstr "" +msgstr "epoch_time niet ondersteund op dit bord" #: ports/nrf/common-hal/busio/UART.c #, c-format @@ -2686,7 +2690,7 @@ msgstr "eerste argument moet een functie zijn" #: extmod/ulab/code/ulab_create.c msgid "first argument must be a tuple of ndarrays" -msgstr "" +msgstr "eerste argument moet een tupel van ndarrays zijn" #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" @@ -2743,7 +2747,7 @@ msgstr "functie heeft hetzelfde teken aan beide uiteinden van het interval" #: extmod/ulab/code/ndarray.c msgid "function is defined for ndarrays only" -msgstr "" +msgstr "functie is alleen gedefinieerd voor ndarrays" #: py/argcheck.c #, c-format @@ -2840,7 +2844,7 @@ msgstr "inline assembler moet een functie zijn" #: extmod/ulab/code/ndarray.c msgid "input and output shapes are not compatible" -msgstr "" +msgstr "in- en uitvoervormen zijn niet compatibel" #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer or a 2-tuple" @@ -2852,7 +2856,7 @@ msgstr "invoer array lengte moet een macht van 2 zijn" #: extmod/ulab/code/ulab_create.c msgid "input arrays are not compatible" -msgstr "" +msgstr "input arrays zijn niet compatibel" #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" @@ -2868,19 +2872,19 @@ msgstr "invoermatrix is singulier" #: extmod/ulab/code/user/user.c msgid "input must be a dense ndarray" -msgstr "" +msgstr "invoer moet een gesloten ndarray zijn" #: extmod/ulab/code/ulab_create.c msgid "input must be a tensor of rank 2" -msgstr "" +msgstr "invoer moet een tensor van rang 2 zijn" #: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c msgid "input must be an ndarray" -msgstr "" +msgstr "invoer moet een ndarray zijn" #: extmod/ulab/code/filter/filter.c msgid "input must be one-dimensional" -msgstr "" +msgstr "invoer moet eendimensionaal zijn" #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" @@ -2896,7 +2900,7 @@ msgstr "invoervectors moeten van gelijke lengte zijn" #: extmod/ulab/code/poly/poly.c msgid "inputs are not iterable" -msgstr "" +msgstr "invoer is niet itereerbaar" #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" @@ -2970,7 +2974,7 @@ msgstr "ongeldige syntax voor nummer" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "io must be rtc io" -msgstr "" +msgstr "io moet rtc io zijn" #: py/objtype.c msgid "issubclass() arg 1 must be a class" @@ -3041,7 +3045,7 @@ msgstr "long int wordt niet ondersteund in deze build" #: ports/esp32s2/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" -msgstr "" +msgstr "loopback + silent mode wordt niet ondersteund door randapparaat" #: py/parse.c msgid "malformed f-string" @@ -3075,7 +3079,7 @@ msgstr "max_length moet >0 zijn" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" -msgstr "" +msgstr "maximaal aantal dimensies is 4" #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3083,11 +3087,11 @@ msgstr "maximale recursiediepte overschreden" #: extmod/ulab/code/approx/approx.c msgid "maxiter must be > 0" -msgstr "" +msgstr "maxiter moet groter dan 0 zijn" #: extmod/ulab/code/approx/approx.c msgid "maxiter should be > 0" -msgstr "" +msgstr "maxiter moet groter dan 0 zijn" #: py/runtime.c #, c-format @@ -3210,7 +3214,7 @@ msgstr "niet-trefwoord argument na trefwoord argument" #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" -msgstr "" +msgstr "norm is gedefinieerd voor 1D en 2D arrays" #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" @@ -3278,11 +3282,11 @@ msgstr "string met oneven lengte" #: extmod/ulab/code/ulab_create.c msgid "offset is too large" -msgstr "" +msgstr "compensatie is te groot" #: shared-bindings/dualbank/__init__.c msgid "offset must be >= 0" -msgstr "" +msgstr "compensatie moet groter of gelijk 0 zijn" #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" @@ -3308,11 +3312,11 @@ msgstr "operands konden niet samen verzonden worden" #: extmod/ulab/code/ndarray.c msgid "operation is implemented for 1D Boolean arrays only" -msgstr "" +msgstr "operatie is alleen geïmplementeerd voor 1D Booleaanse arrays" #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented for flattened array" -msgstr "" +msgstr "operatie is niet geïmplementeerd voor vlakke array" #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" @@ -3451,7 +3455,7 @@ msgstr "gevraagde lengte is %d maar object heeft lengte %d" #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" -msgstr "" +msgstr "resultaat kan niet naar gespecificeerd type geconverteerd worden" #: py/compile.c msgid "return annotation must be an identifier" @@ -3473,7 +3477,7 @@ msgstr "rgb_pins[%d] bevindt zich niet op dezelfde poort als klok" #: extmod/ulab/code/numerical/numerical.c msgid "roll argument must be an ndarray" -msgstr "" +msgstr "roll argument moet een ndarray zijn" #: py/objstr.c msgid "rsplit(None,n)" @@ -3501,7 +3505,7 @@ msgstr "scriptcompilatie wordt niet ondersteund" #: extmod/ulab/code/ndarray.c msgid "shape must be a tuple" -msgstr "" +msgstr "vorm moet een tupel zijn" #: py/objstr.c msgid "sign not allowed in string format specifier" @@ -3650,7 +3654,7 @@ msgstr "timestamp buiten bereik voor platform time_t" #: extmod/ulab/code/ndarray.c msgid "tobytes can be invoked for dense arrays only" -msgstr "" +msgstr "tobytes kunnen alleen ingeroepen worden voor gesloten arrays" #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" @@ -3671,7 +3675,7 @@ msgstr "trapz is gedefinieerd voor eendimensionale arrays van gelijke lengte" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "trigger level must be 0 or 1" -msgstr "" +msgstr "triggerniveau moet 0 of 1 zijn" #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" @@ -3684,12 +3688,12 @@ msgstr "tuple of lijst heeft onjuiste lengte" #: ports/esp32s2/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" -msgstr "" +msgstr "twai_driver_install geeft esp-idf fout #%d" #: ports/esp32s2/common-hal/canio/CAN.c #, c-format msgid "twai_start returned esp-idf error #%d" -msgstr "" +msgstr "twai_start geeft esp-idf error #%d" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -3817,11 +3821,11 @@ msgstr "vectoren moeten van gelijke lengte zijn" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "wakeup conflict" -msgstr "" +msgstr "conflict bij ontwaken" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" -msgstr "" +msgstr "watchdog niet geïnitialiseerd" #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" @@ -3837,11 +3841,11 @@ msgstr "window moet <= interval zijn" #: extmod/ulab/code/numerical/numerical.c msgid "wrong axis index" -msgstr "" +msgstr "foute index voor as" #: extmod/ulab/code/ulab_create.c msgid "wrong axis specified" -msgstr "" +msgstr "onjuiste as gespecificeerd" #: extmod/ulab/code/vector/vectorise.c msgid "wrong input type" From 1a8033470a83c0ee202001296d8c03e28104f409 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 23 Dec 2020 12:22:50 -0800 Subject: [PATCH 492/770] Stub out mp_hal_is_interrupted for UNIX --- ports/unix/mphalport.h | 2 ++ ports/unix/unix_mphal.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/ports/unix/mphalport.h b/ports/unix/mphalport.h index 6f2880d4ef049..4e459ffca5180 100644 --- a/ports/unix/mphalport.h +++ b/ports/unix/mphalport.h @@ -24,12 +24,14 @@ * THE SOFTWARE. */ #include +#include #ifndef CHAR_CTRL_C #define CHAR_CTRL_C (3) #endif void mp_hal_set_interrupt_char(char c); +bool mp_hal_is_interrupted(void); void mp_hal_stdio_mode_raw(void); void mp_hal_stdio_mode_orig(void); diff --git a/ports/unix/unix_mphal.c b/ports/unix/unix_mphal.c index e9494d7ff20ae..77deb3152faac 100644 --- a/ports/unix/unix_mphal.c +++ b/ports/unix/unix_mphal.c @@ -81,6 +81,10 @@ void mp_hal_set_interrupt_char(char c) { } } +bool mp_hal_is_interrupted(void) { + return false; +} + #if MICROPY_USE_READLINE == 1 #include From a11ad2572761bc4900994fbf42361efb387cd059 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 21 Dec 2020 22:58:17 -0500 Subject: [PATCH 493/770] BLE fixes --- ports/nrf/common-hal/_bleio/Adapter.c | 11 ++++++++++- shared-bindings/_bleio/Adapter.c | 13 ++++++++++--- shared-bindings/_bleio/Characteristic.c | 4 ++-- shared-bindings/_bleio/Descriptor.c | 4 ++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/ports/nrf/common-hal/_bleio/Adapter.c b/ports/nrf/common-hal/_bleio/Adapter.c index 537f43f237d22..53a40f9a670bf 100644 --- a/ports/nrf/common-hal/_bleio/Adapter.c +++ b/ports/nrf/common-hal/_bleio/Adapter.c @@ -470,7 +470,16 @@ mp_obj_t common_hal_bleio_adapter_start_scan(bleio_adapter_obj_t *self, uint8_t* ble_drv_add_event_handler(scan_on_ble_evt, self->scan_results); uint32_t nrf_timeout = SEC_TO_UNITS(timeout, UNIT_10_MS); - if (timeout <= 0.0001) { + if (nrf_timeout > UINT16_MAX) { + // 0xffff / 100 + mp_raise_ValueError(translate("timeout must be < 655.35 secs")); + } + if (nrf_timeout == 0 && timeout > 0.0f) { + // Make sure converted timeout is > 0 if original timeout is > 0. + mp_raise_ValueError(translate("non-zero timeout must be > 0.01")); + } + + if (nrf_timeout) { nrf_timeout = BLE_GAP_SCAN_TIMEOUT_UNLIMITED; } diff --git a/shared-bindings/_bleio/Adapter.c b/shared-bindings/_bleio/Adapter.c index 682177093d78a..7d7076aab6577 100644 --- a/shared-bindings/_bleio/Adapter.c +++ b/shared-bindings/_bleio/Adapter.c @@ -33,8 +33,8 @@ #include "shared-bindings/_bleio/Address.h" #include "shared-bindings/_bleio/Adapter.h" -#define ADV_INTERVAL_MIN (0.0020f) -#define ADV_INTERVAL_MIN_STRING "0.0020" +#define ADV_INTERVAL_MIN (0.02001f) +#define ADV_INTERVAL_MIN_STRING "0.02001" #define ADV_INTERVAL_MAX (10.24f) #define ADV_INTERVAL_MAX_STRING "10.24" // 20ms is recommended by Apple @@ -307,7 +307,7 @@ STATIC mp_obj_t bleio_adapter_start_scan(size_t n_args, const mp_obj_t *pos_args mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - mp_float_t timeout = 0; + mp_float_t timeout = 0.0f; if (args[ARG_timeout].u_obj != mp_const_none) { timeout = mp_obj_get_float(args[ARG_timeout].u_obj); } @@ -325,6 +325,13 @@ STATIC mp_obj_t bleio_adapter_start_scan(size_t n_args, const mp_obj_t *pos_args mp_raise_ValueError_varg(translate("interval must be in range %s-%s"), INTERVAL_MIN_STRING, INTERVAL_MAX_STRING); } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wfloat-equal" + if (timeout != 0.0f && timeout < interval) { + mp_raise_ValueError(translate("non-zero timeout must be >= interval")); + } +#pragma GCC diagnostic pop + const mp_float_t window = mp_obj_float_get(args[ARG_window].u_obj); if (window > interval) { mp_raise_ValueError(translate("window must be <= interval")); diff --git a/shared-bindings/_bleio/Characteristic.c b/shared-bindings/_bleio/Characteristic.c index 5e384a44caa00..a0751b7e34aed 100644 --- a/shared-bindings/_bleio/Characteristic.c +++ b/shared-bindings/_bleio/Characteristic.c @@ -110,8 +110,8 @@ STATIC mp_obj_t bleio_characteristic_add_to_service(size_t n_args, const mp_obj_ common_hal_bleio_attribute_security_mode_check_valid(write_perm); const mp_int_t max_length_int = args[ARG_max_length].u_int; - if (max_length_int <= 0) { - mp_raise_ValueError(translate("max_length must be > 0")); + if (max_length_int < 0) { + mp_raise_ValueError(translate("max_length must be >= 0")); } const size_t max_length = (size_t) max_length_int; const bool fixed_length = args[ARG_fixed_length].u_bool; diff --git a/shared-bindings/_bleio/Descriptor.c b/shared-bindings/_bleio/Descriptor.c index c313007c6d24e..60f0acf44bfb6 100644 --- a/shared-bindings/_bleio/Descriptor.c +++ b/shared-bindings/_bleio/Descriptor.c @@ -101,8 +101,8 @@ STATIC mp_obj_t bleio_descriptor_add_to_characteristic(size_t n_args, const mp_o common_hal_bleio_attribute_security_mode_check_valid(write_perm); const mp_int_t max_length_int = args[ARG_max_length].u_int; - if (max_length_int <= 0) { - mp_raise_ValueError(translate("max_length must be > 0")); + if (max_length_int < 0) { + mp_raise_ValueError(translate("max_length must be >= 0")); } const size_t max_length = (size_t) max_length_int; const bool fixed_length = args[ARG_fixed_length].u_bool; From 153a686837638ce8722769156610313efca0e559 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 23 Dec 2020 16:41:56 -0500 Subject: [PATCH 494/770] make translate for main --- locale/circuitpython.pot | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index e44892fc3b54c..4a25ec485338c 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-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -949,10 +949,6 @@ msgstr "" msgid "Framebuffer requires %d bytes" msgstr "" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3009,7 +3005,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" +msgid "max_length must be >= 0" msgstr "" #: extmod/ulab/code/ndarray.c @@ -3147,6 +3143,14 @@ msgstr "" msgid "non-keyword arg after keyword arg" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3568,6 +3572,10 @@ msgstr "" msgid "timeout must be 0.0-100.0 seconds" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "" From c371119da4e6f56c15e46c53e914344bb89d026c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 23 Dec 2020 15:00:53 -0800 Subject: [PATCH 495/770] Make translate --- locale/circuitpython.pot | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index d64cff18591d9..59c15027ccd88 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-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 15:00-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -20,7 +20,13 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" +msgstr "" + +#: main.c +msgid "" +"\n" +"Code stopped by auto-reload.\n" msgstr "" #: supervisor/shared/safe_mode.c @@ -534,6 +540,18 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -566,6 +584,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "" @@ -609,6 +631,10 @@ msgstr "" msgid "Cannot vary frequency on a timer that is already in use" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "" @@ -1458,7 +1484,7 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1520,10 +1546,6 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1564,7 +1586,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c From 1a6b1b1953b20a0ddd8b5f76d6dc366399ea1aee Mon Sep 17 00:00:00 2001 From: BennyE Date: Thu, 24 Dec 2020 00:37:37 +0100 Subject: [PATCH 496/770] implementing suggested changes --- ports/esp32s2/common-hal/wifi/Network.c | 5 +++-- ports/esp32s2/common-hal/wifi/Radio.c | 17 +++++------------ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/Network.c b/ports/esp32s2/common-hal/wifi/Network.c index d134db057e1f0..be4935dba518f 100644 --- a/ports/esp32s2/common-hal/wifi/Network.c +++ b/ports/esp32s2/common-hal/wifi/Network.c @@ -51,7 +51,8 @@ mp_obj_t common_hal_wifi_network_get_channel(wifi_network_obj_t *self) { mp_obj_t common_hal_wifi_network_get_country(wifi_network_obj_t *self) { const char* cstr = (const char*) self->record.country.cc; - // We know that we only want the CC thus limiting to two chars + // To address esp_wifi_get_country() returned/set wifi_country_t structure + // doesn't follow the documented behaviour (IDFGH-4486) #6315 + // 2 instead of strlen(cstr) which would be 6 and contain full element return mp_obj_new_str(cstr, 2); } - diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index d4db5d08d368d..c498501c7f7e8 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -42,10 +42,6 @@ #define MAC_ADDRESS_LENGTH 6 -#include "components/log/include/esp_log.h" - -static const char* TAG = "wifi"; - static void start_station(wifi_radio_obj_t *self) { if (self->sta_mode) { return; @@ -198,18 +194,15 @@ mp_obj_t common_hal_wifi_radio_get_ap_info(wifi_radio_obj_t *self) { if (esp_wifi_sta_get_ap_info(&self->ap_info.record) != ESP_OK){ return mp_const_none; } else { - // The struct member appears to be (not NULL!), I don't know how to properly test for it. - // When the ESP-IDF starts working fine (when their bugfix is available), this "if" wouldn't trigger. - // Note: It is possible that Wi-Fi APs don't have a CC set, then even after this workaround - // the element would remain empty. if (strlen(self->ap_info.record.country.cc) == 0) { // Workaround to fill country related information in ap_info until ESP-IDF carries a fix // esp_wifi_sta_get_ap_info does not appear to fill wifi_country_t (e.g. country.cc) details // (IDFGH-4437) #6267 - if (esp_wifi_get_country(&self->ap_info.record.country) == ESP_OK) { - ESP_EARLY_LOGW(TAG, "Country Code: %s", self->ap_info.record.country.cc); - } else { - ESP_EARLY_LOGW(TAG, "Country Code - Workaround failed!"); + // Note: It is possible that Wi-Fi APs don't have a CC set, then even after this workaround + // the element would remain empty. + memset(&self->ap_info.record.country, 0, sizeof(wifi_country_t)); + if (esp_wifi_get_country(&self->ap_info.record.country) != ESP_OK) { + return mp_const_none; } } memcpy(&ap_info->record, &self->ap_info.record, sizeof(wifi_ap_record_t)); From ce01aed5cf59746f5be2892491e02a505fe3c50e Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 24 Dec 2020 03:25:47 +0100 Subject: [PATCH 497/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 25 ++++++++++++++++++------- locale/cs.po | 20 ++++++++++++++------ locale/de_DE.po | 27 +++++++++++++++++++-------- locale/el.po | 20 ++++++++++++++------ locale/es.po | 28 +++++++++++++++++++++------- locale/fil.po | 20 ++++++++++++++------ locale/fr.po | 28 +++++++++++++++++++++------- locale/hi.po | 20 ++++++++++++++------ locale/it_IT.po | 20 ++++++++++++++------ locale/ja.po | 28 +++++++++++++++++++++------- locale/ko.po | 20 ++++++++++++++------ locale/nl.po | 30 ++++++++++++++++++++++-------- locale/pl.po | 28 +++++++++++++++++++++------- locale/pt_BR.po | 30 ++++++++++++++++++++++-------- locale/sv.po | 28 +++++++++++++++++++++------- locale/zh_Latn_pinyin.po | 28 +++++++++++++++++++++------- 16 files changed, 291 insertions(+), 109 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 150a92c04a21a..14b038797e22f 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-10-10 23:51+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -967,11 +967,6 @@ msgstr "" msgid "Framebuffer requires %d bytes" msgstr "" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" -"Frekuensi yang ditangkap berada di atas kemampuan. Penangkapan Ditunda." - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "Frekuensi harus cocok dengan PWMOut yang ada menggunakan timer ini" @@ -3054,7 +3049,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" +msgid "max_length must be >= 0" msgstr "" #: extmod/ulab/code/ndarray.c @@ -3192,6 +3187,14 @@ msgstr "non-keyword arg setelah */**" msgid "non-keyword arg after keyword arg" msgstr "non-keyword arg setelah keyword arg" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3614,6 +3617,10 @@ msgstr "" msgid "timeout must be 0.0-100.0 seconds" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c #, fuzzy msgid "timeout must be >= 0.0" @@ -3874,6 +3881,10 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Frequency captured is above capability. Capture Paused." +#~ msgstr "" +#~ "Frekuensi yang ditangkap berada di atas kemampuan. Penangkapan Ditunda." + #~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." #~ msgstr "" #~ "Tekan tombol apa saja untuk masuk ke dalam REPL. Gunakan CTRL+D untuk " diff --git a/locale/cs.po b/locale/cs.po index 39e5a50cf3186..7921c5a3bf2d6 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-12-04 18:33+0000\n" "Last-Translator: vkuthan \n" "Language-Team: LANGUAGE \n" @@ -953,10 +953,6 @@ msgstr "" msgid "Framebuffer requires %d bytes" msgstr "" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3013,7 +3009,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" +msgid "max_length must be >= 0" msgstr "" #: extmod/ulab/code/ndarray.c @@ -3151,6 +3147,14 @@ msgstr "" msgid "non-keyword arg after keyword arg" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3572,6 +3576,10 @@ msgstr "" msgid "timeout must be 0.0-100.0 seconds" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 95ff26aeec0d2..8f995b5e4357d 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-11-26 03:11+0000\n" "Last-Translator: Daniel Bravo Darriba \n" "Language: de_DE\n" @@ -964,12 +964,6 @@ msgstr "Format nicht unterstützt" msgid "Framebuffer requires %d bytes" msgstr "Framepuffer benötigt %d bytes" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" -"Die aufgezeichnete Frequenz liegt über der Leistungsgrenze. Aufnahme " -"angehalten." - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3089,7 +3083,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "max_length muss 0-%d sein, wenn fixed_length %s ist" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" +msgid "max_length must be >= 0" msgstr "" #: extmod/ulab/code/ndarray.c @@ -3227,6 +3221,14 @@ msgstr "Nicht-Schlüsselwort arg nach * / **" msgid "non-keyword arg after keyword arg" msgstr "Nicht-Schlüsselwort Argument nach Schlüsselwort Argument" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3655,6 +3657,10 @@ msgstr "Das Zeitlimit hat den maximal zulässigen Wert überschritten" msgid "timeout must be 0.0-100.0 seconds" msgstr "Das Zeitlimit muss 0,0-100,0 Sekunden betragen" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "timeout muss >= 0.0 sein" @@ -3918,6 +3924,11 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Frequency captured is above capability. Capture Paused." +#~ msgstr "" +#~ "Die aufgezeichnete Frequenz liegt über der Leistungsgrenze. Aufnahme " +#~ "angehalten." + #~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." #~ msgstr "" #~ "Drücke eine Taste um dich mit der REPL zu verbinden. Drücke Strg-D zum " diff --git a/locale/el.po b/locale/el.po index e1b44d2916039..0352e4735b998 100644 --- a/locale/el.po +++ b/locale/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -948,10 +948,6 @@ msgstr "" msgid "Framebuffer requires %d bytes" msgstr "" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3008,7 +3004,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" +msgid "max_length must be >= 0" msgstr "" #: extmod/ulab/code/ndarray.c @@ -3146,6 +3142,14 @@ msgstr "" msgid "non-keyword arg after keyword arg" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3567,6 +3571,10 @@ msgstr "" msgid "timeout must be 0.0-100.0 seconds" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "" diff --git a/locale/es.po b/locale/es.po index c335d0f396da5..987f61e206118 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-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: Iván Montiel Cardona \n" "Language-Team: \n" @@ -968,10 +968,6 @@ msgstr "Sin capacidades para el formato" msgid "Framebuffer requires %d bytes" msgstr "Framebuffer requiere %d bytes" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "Frecuencia capturada por encima de la capacidad. Captura en pausa." - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3081,8 +3077,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "max_length debe ser 0-%d cuando fixed_length es %s" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" -msgstr "max_lenght debe ser > 0" +msgid "max_length must be >= 0" +msgstr "" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" @@ -3221,6 +3217,14 @@ msgstr "" "no deberia estar/tener agumento por palabra clave despues de argumento por " "palabra clave" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "norma está definida para arrays 1D y 2D" @@ -3646,6 +3650,10 @@ msgstr "" msgid "timeout must be 0.0-100.0 seconds" msgstr "el tiempo de espera debe ser 0.0-100.0 segundos" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "tiempo muerto debe ser >= 0.0" @@ -3905,6 +3913,12 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "Frequency captured is above capability. Capture Paused." +#~ msgstr "Frecuencia capturada por encima de la capacidad. Captura en pausa." + +#~ msgid "max_length must be > 0" +#~ msgstr "max_lenght debe ser > 0" + #~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." #~ msgstr "" #~ "Presiona cualquier tecla para entrar al REPL. Usa CTRL-D para recargar." diff --git a/locale/fil.po b/locale/fil.po index 067dfc4d79413..e808ff1dd275d 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -961,10 +961,6 @@ msgstr "" msgid "Framebuffer requires %d bytes" msgstr "" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3055,7 +3051,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" +msgid "max_length must be >= 0" msgstr "" #: extmod/ulab/code/ndarray.c @@ -3193,6 +3189,14 @@ msgstr "non-keyword arg sa huli ng */**" msgid "non-keyword arg after keyword arg" msgstr "non-keyword arg sa huli ng keyword arg" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3619,6 +3623,10 @@ msgstr "" msgid "timeout must be 0.0-100.0 seconds" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c #, fuzzy msgid "timeout must be >= 0.0" diff --git a/locale/fr.po b/locale/fr.po index 3836da812e041..3c09a728640f2 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-12-08 19:21+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" @@ -973,10 +973,6 @@ msgstr "Format non supporté" msgid "Framebuffer requires %d bytes" msgstr "Le framebuffer nécessite %d octets" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "La fréquence capturée est au delà des capacités. Capture en pause." - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3101,8 +3097,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "max_length doit être 0-%d lorsque fixed_length est %s" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" -msgstr "max_length doit être > 0" +msgid "max_length must be >= 0" +msgstr "" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" @@ -3240,6 +3236,14 @@ msgstr "argument non-nommé après */**" msgid "non-keyword arg after keyword arg" msgstr "argument non-nommé après argument nommé" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3668,6 +3672,10 @@ msgstr "le délai d'expiration a dépassé la valeur maximale prise en charge" msgid "timeout must be 0.0-100.0 seconds" msgstr "le délai doit être compris entre 0.0 et 100.0 secondes" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "'timeout' doit être >= 0.0" @@ -3927,6 +3935,12 @@ msgstr "zi doit être de type float" msgid "zi must be of shape (n_section, 2)" msgstr "zi doit être de forme (n_section, 2)" +#~ msgid "Frequency captured is above capability. Capture Paused." +#~ msgstr "La fréquence capturée est au delà des capacités. Capture en pause." + +#~ msgid "max_length must be > 0" +#~ msgstr "max_length doit être > 0" + #~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." #~ msgstr "" #~ "Appuyez sur une touche pour entrer sur REPL ou CTRL-D pour recharger." diff --git a/locale/hi.po b/locale/hi.po index 7d90c65dc0527..1f868b09663e7 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -948,10 +948,6 @@ msgstr "" msgid "Framebuffer requires %d bytes" msgstr "" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3008,7 +3004,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" +msgid "max_length must be >= 0" msgstr "" #: extmod/ulab/code/ndarray.c @@ -3146,6 +3142,14 @@ msgstr "" msgid "non-keyword arg after keyword arg" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3567,6 +3571,10 @@ msgstr "" msgid "timeout must be 0.0-100.0 seconds" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index b14acaf9e4cff..289d308af7e14 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -961,10 +961,6 @@ msgstr "" msgid "Framebuffer requires %d bytes" msgstr "" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3058,7 +3054,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" +msgid "max_length must be >= 0" msgstr "" #: extmod/ulab/code/ndarray.c @@ -3197,6 +3193,14 @@ msgstr "argomento non nominato dopo */**" msgid "non-keyword arg after keyword arg" msgstr "argomento non nominato seguito da argomento nominato" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3627,6 +3631,10 @@ msgstr "" msgid "timeout must be 0.0-100.0 seconds" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c #, fuzzy msgid "timeout must be >= 0.0" diff --git a/locale/ja.po b/locale/ja.po index 0bd6504b9b433..e8028ac0592b9 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: sporeball \n" "Language-Team: none\n" @@ -961,10 +961,6 @@ msgstr "非対応の形式" msgid "Framebuffer requires %d bytes" msgstr "" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "キャプチャした周波数は能力を超えています。キャプチャ停止" - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "このタイマーを使う既存のPWMOutと周波数を一致させる必要があります" @@ -3038,8 +3034,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" -msgstr "max_lengthは0より大きくなければなりません" +msgid "max_length must be >= 0" +msgstr "" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" @@ -3176,6 +3172,14 @@ msgstr "*/** の後に非キーワード引数は置けません" msgid "non-keyword arg after keyword arg" msgstr "キーワード引数の後に非キーワード引数は置けません" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3600,6 +3604,10 @@ msgstr "タイムアウト長は対応する最大値を超えています" msgid "timeout must be 0.0-100.0 seconds" msgstr "timeoutは0.0〜100.0秒でなければなりません" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "timeoutは0.0以上でなければなりません" @@ -3859,6 +3867,12 @@ msgstr "ziはfloat値でなければなりません" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Frequency captured is above capability. Capture Paused." +#~ msgstr "キャプチャした周波数は能力を超えています。キャプチャ停止" + +#~ msgid "max_length must be > 0" +#~ msgstr "max_lengthは0より大きくなければなりません" + #~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." #~ msgstr "何らかのキーを押すとREPLに入ります。CTRL-Dでリロード。" diff --git a/locale/ko.po b/locale/ko.po index e307955362305..54c819770cb9c 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-10-05 12:12+0000\n" "Last-Translator: Michal Čihař \n" "Language-Team: LANGUAGE \n" @@ -953,10 +953,6 @@ msgstr "" msgid "Framebuffer requires %d bytes" msgstr "" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3014,7 +3010,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" +msgid "max_length must be >= 0" msgstr "" #: extmod/ulab/code/ndarray.c @@ -3152,6 +3148,14 @@ msgstr "" msgid "non-keyword arg after keyword arg" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3573,6 +3577,10 @@ msgstr "" msgid "timeout must be 0.0-100.0 seconds" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 8712dc7ec58c3..bd5fcaff6d8b6 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-12-23 20:14+0000\n" "Last-Translator: _fonzlate \n" "Language-Team: none\n" @@ -961,11 +961,6 @@ msgstr "Formaat wordt niet ondersteund" msgid "Framebuffer requires %d bytes" msgstr "Framebuffer benodigd %d bytes" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" -"De vastgelegde frequentie is boven de capaciteit. Vastleggen gepauzeerd." - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3074,8 +3069,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "max_length moet 0-%d zijn als fixed_length %s is" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" -msgstr "max_length moet >0 zijn" +msgid "max_length must be >= 0" +msgstr "" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" @@ -3212,6 +3207,14 @@ msgstr "niet-trefwoord argument na */**" msgid "non-keyword arg after keyword arg" msgstr "niet-trefwoord argument na trefwoord argument" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "norm is gedefinieerd voor 1D en 2D arrays" @@ -3636,6 +3639,10 @@ msgstr "time-outduur is groter dan de ondersteunde maximale waarde" msgid "timeout must be 0.0-100.0 seconds" msgstr "timeout moet tussen 0.0 en 100.0 seconden zijn" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "timeout moet groter dan 0.0 zijn" @@ -3895,6 +3902,13 @@ msgstr "zi moet van type float zijn" msgid "zi must be of shape (n_section, 2)" msgstr "zi moet vorm (n_section, 2) hebben" +#~ msgid "Frequency captured is above capability. Capture Paused." +#~ msgstr "" +#~ "De vastgelegde frequentie is boven de capaciteit. Vastleggen gepauzeerd." + +#~ msgid "max_length must be > 0" +#~ msgstr "max_length moet >0 zijn" + #~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." #~ msgstr "" #~ "Druk een willekeurige toets om de REPL te starten. Gebruik CTRL+D om te " diff --git a/locale/pl.po b/locale/pl.po index 380dedd6062b7..07c2df2aaee7c 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-12-02 20:29+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" @@ -961,10 +961,6 @@ msgstr "Nie wspierany format" msgid "Framebuffer requires %d bytes" msgstr "Bufor ramki wymaga %d bajtów" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "Uzyskana częstotliwość jest niemożliwa. Spauzowano." - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3031,8 +3027,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" -msgstr "max_length musi być > 0" +msgid "max_length must be >= 0" +msgstr "" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" @@ -3169,6 +3165,14 @@ msgstr "argument nienazwany po */**" msgid "non-keyword arg after keyword arg" msgstr "argument nienazwany po nazwanym" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3592,6 +3596,10 @@ msgstr "" msgid "timeout must be 0.0-100.0 seconds" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "timeout musi być >= 0.0" @@ -3851,6 +3859,12 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Frequency captured is above capability. Capture Paused." +#~ msgstr "Uzyskana częstotliwość jest niemożliwa. Spauzowano." + +#~ msgid "max_length must be > 0" +#~ msgstr "max_length musi być > 0" + #~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." #~ msgstr "Dowolny klawisz aby uruchomić konsolę. CTRL-D aby przeładować." diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 9918acc4d0dbd..f66c88491c0b5 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-12-22 18:07+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -970,11 +970,6 @@ msgstr "O formato não é suportado" msgid "Framebuffer requires %d bytes" msgstr "O Framebuffer requer %d bytes" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" -"A frequência capturada está acima da capacidade. A captura está em pausa." - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -3093,8 +3088,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "o max_length deve ser 0-%d quando Fixed_length for %s" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" -msgstr "max_length deve ser > 0" +msgid "max_length must be >= 0" +msgstr "" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" @@ -3233,6 +3228,14 @@ msgstr "um arg sem palavra-chave após */ **" msgid "non-keyword arg after keyword arg" msgstr "um arg não-palavra-chave após a palavra-chave arg" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "a norma é definida para matrizes 1D e 2D" @@ -3661,6 +3664,10 @@ msgstr "a duração do tempo limite excedeu o valor máximo suportado" msgid "timeout must be 0.0-100.0 seconds" msgstr "o tempo limite deve ser entre 0.0 a 100.0 segundos" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "o tempo limite deve ser >= 0,0" @@ -3920,6 +3927,13 @@ msgstr "zi deve ser de um tipo float" msgid "zi must be of shape (n_section, 2)" msgstr "zi deve estar na forma (n_section, 2)" +#~ msgid "Frequency captured is above capability. Capture Paused." +#~ msgstr "" +#~ "A frequência capturada está acima da capacidade. A captura está em pausa." + +#~ msgid "max_length must be > 0" +#~ msgstr "max_length deve ser > 0" + #~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." #~ msgstr "" #~ "Pressione qualquer tecla para entrar no REPL. Use CTRL-D para recarregar." diff --git a/locale/sv.po b/locale/sv.po index 26eb19cbb1b2c..75f052815e7c1 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-12-07 20:26+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -961,10 +961,6 @@ msgstr "Formatet stöds inte" msgid "Framebuffer requires %d bytes" msgstr "Framebuffer kräver %d byte" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "Infångningsfrekvens är för hög. Infångning pausad." - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "Frekvensen måste matcha befintlig PWMOut med denna timer" @@ -3064,8 +3060,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "max_length måste vara 0-%d när fixed_length är %s" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" -msgstr "max_length måste vara > 0" +msgid "max_length must be >= 0" +msgstr "" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" @@ -3202,6 +3198,14 @@ msgstr "icke nyckelord arg efter * / **" msgid "non-keyword arg after keyword arg" msgstr "icke nyckelord arg efter nyckelord arg" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "norm är definierad för 1D- och 2D-matriser" @@ -3626,6 +3630,10 @@ msgstr "timeout-längd överskred det maximala värde som stöds" msgid "timeout must be 0.0-100.0 seconds" msgstr "timeout måste vara 0.0-100.0 sekunder" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "timeout måste vara >= 0.0" @@ -3885,6 +3893,12 @@ msgstr "zi måste vara av typ float" msgid "zi must be of shape (n_section, 2)" msgstr "zi måste vara i formen (n_section, 2)" +#~ msgid "Frequency captured is above capability. Capture Paused." +#~ msgstr "Infångningsfrekvens är för hög. Infångning pausad." + +#~ msgid "max_length must be > 0" +#~ msgstr "max_length måste vara > 0" + #~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." #~ msgstr "" #~ "Tryck på valfri knapp för att gå in i REPL. Använd CTRL-D för att ladda " diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 3106151d46262..398d84a196aed 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-14 12:59-0500\n" +"POT-Creation-Date: 2020-12-23 16:41-0500\n" "PO-Revision-Date: 2020-11-19 01:28+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -959,10 +959,6 @@ msgstr "Bù zhīyuán géshì" msgid "Framebuffer requires %d bytes" msgstr "zhēn huǎn chōng qū xū yào %d zì jié" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "Pínlǜ bǔhuò gāo yú nénglì. Bǔhuò zàntíng." - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "Pínlǜ bìxū yǔ shǐyòng cǐ jìshí qì de xiàn yǒu PWMOut xiāng pǐpèi" @@ -3055,8 +3051,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "Dāng gùdìng chángdù wèi %s shí, zuìdà chángdù bìxū wèi 0-%d" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" -msgstr "Max_length bìxū > 0" +msgid "max_length must be >= 0" +msgstr "" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" @@ -3193,6 +3189,14 @@ msgstr "zài */** zhīhòu fēi guānjiàn cí cānshù" msgid "non-keyword arg after keyword arg" msgstr "guānjiàn zì cānshù zhīhòu de fēi guānjiàn zì cānshù" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" +msgstr "" + #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3616,6 +3620,10 @@ msgstr "chāoshí shíjiān chāoguò zuìdà zhīchí zhí" msgid "timeout must be 0.0-100.0 seconds" msgstr "Chāo shí shíjiān bìxū wèi 0.0 Dào 100.0 Miǎo" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "chāoshí bìxū shì >= 0.0" @@ -3875,6 +3883,12 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "Frequency captured is above capability. Capture Paused." +#~ msgstr "Pínlǜ bǔhuò gāo yú nénglì. Bǔhuò zàntíng." + +#~ msgid "max_length must be > 0" +#~ msgstr "Max_length bìxū > 0" + #~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." #~ msgstr "Àn xià rènhé jiàn jìnrù REPL. Shǐyòng CTRL-D chóngxīn jiāzài." From cf4862e96e75303b9ecf1cbb7201bf982d552a5f Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 23 Dec 2020 22:52:27 -0500 Subject: [PATCH 498/770] make translate again --- locale/circuitpython.pot | 384 +++------------------------------------ 1 file changed, 23 insertions(+), 361 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index d71ba29a38083..c5830adabb1ab 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-12-23 21:58-0500\n" +"POT-Creation-Date: 2020-12-23 22:50-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -884,14 +884,6 @@ msgstr "" msgid "Extended advertisements with scan response not supported." msgstr "" -#: extmod/ulab/code/fft/fft.c -msgid "FFT is defined for ndarrays only" -msgstr "" - -#: extmod/ulab/code/fft/fft.c -msgid "FFT is implemented for linear arrays only" -msgstr "" - #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" msgstr "" @@ -962,6 +954,10 @@ msgstr "" msgid "Filters too complex" msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Firmware image is invalid" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "" @@ -971,10 +967,6 @@ msgstr "" msgid "Framebuffer requires %d bytes" msgstr "" -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -msgid "Frequency captured is above capability. Capture Paused." -msgstr "" - #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" @@ -2005,6 +1997,10 @@ msgstr "" msgid "Unsupported pull value." msgstr "" +#: ports/esp32s2/common-hal/dualbank/__init__.c +msgid "Update Failed" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" @@ -2114,22 +2110,10 @@ msgstr "" msgid "arg is an empty sequence" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "argsort argument must be an ndarray" -msgstr "" - -#: extmod/ulab/code/numerical/numerical.c -msgid "argsort is not implemented for flattened arrays" -msgstr "" - #: py/runtime.c msgid "argument has wrong type" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "argument must be ndarray" -msgstr "" - #: py/argcheck.c shared-bindings/_stage/__init__.c #: shared-bindings/digitalio/DigitalInOut.c shared-bindings/gamepad/GamePad.c msgid "argument num/types mismatch" @@ -2139,43 +2123,15 @@ msgstr "" msgid "argument should be a '%q' not a '%q'" msgstr "" -#: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c -msgid "arguments must be ndarrays" -msgstr "" - -#: extmod/ulab/code/ndarray.c -msgid "array and index length must be equal" -msgstr "" - #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "attempt to get (arg)min/(arg)max of empty sequence" -msgstr "" - -#: extmod/ulab/code/numerical/numerical.c -msgid "attempt to get argmin/argmax of an empty sequence" -msgstr "" - #: py/objstr.c msgid "attributes not supported yet" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "axis is out of bounds" -msgstr "" - -#: extmod/ulab/code/numerical/numerical.c -msgid "axis must be None, or an integer" -msgstr "" - -#: extmod/ulab/code/numerical/numerical.c -msgid "axis too long" -msgstr "" - #: py/builtinevex.c msgid "bad compile mode" msgstr "" @@ -2377,10 +2333,6 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "" -#: extmod/ulab/code/ndarray_operators.c -msgid "cannot cast output with casting rule" -msgstr "" - #: py/objtype.c msgid "cannot create '%q' instances" msgstr "" @@ -2457,38 +2409,10 @@ msgstr "" msgid "conversion to object" msgstr "" -#: extmod/ulab/code/filter/filter.c -msgid "convolve arguments must be linear arrays" -msgstr "" - -#: extmod/ulab/code/filter/filter.c -msgid "convolve arguments must be ndarrays" -msgstr "" - -#: extmod/ulab/code/filter/filter.c -msgid "convolve arguments must not be empty" -msgstr "" - -#: extmod/ulab/code/poly/poly.c -msgid "could not invert Vandermonde matrix" -msgstr "" - #: shared-module/sdcardio/SDCard.c msgid "couldn't determine SD card version" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "cross is defined for 1D arrays of length 3" -msgstr "" - -#: extmod/ulab/code/approx/approx.c -msgid "data must be iterable" -msgstr "" - -#: extmod/ulab/code/approx/approx.c -msgid "data must be of equal length" -msgstr "" - #: py/parsenum.c msgid "decimal numbers not supported" msgstr "" @@ -2514,14 +2438,6 @@ msgstr "" msgid "dict update sequence has wrong length" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "diff argument must be an ndarray" -msgstr "" - -#: extmod/ulab/code/numerical/numerical.c -msgid "differentiation order out of range" -msgstr "" - #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c msgid "division by zero" @@ -2633,38 +2549,10 @@ msgstr "" msgid "filesystem must provide mount method" msgstr "" -#: extmod/ulab/code/vector/vectorise.c -msgid "first argument must be a callable" -msgstr "" - -#: extmod/ulab/code/approx/approx.c -msgid "first argument must be a function" -msgstr "" - -#: extmod/ulab/code/ulab_create.c -msgid "first argument must be a tuple of ndarrays" -msgstr "" - -#: extmod/ulab/code/ndarray.c -msgid "first argument must be an iterable" -msgstr "" - -#: extmod/ulab/code/vector/vectorise.c -msgid "first argument must be an ndarray" -msgstr "" - #: py/objtype.c msgid "first argument to super() must be type" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "flattening order must be either 'C', or 'F'" -msgstr "" - -#: extmod/ulab/code/numerical/numerical.c -msgid "flip argument must be an ndarray" -msgstr "" - #: py/objint.c msgid "float too big" msgstr "" @@ -2694,14 +2582,6 @@ msgstr "" msgid "function got multiple values for argument '%q'" msgstr "" -#: extmod/ulab/code/approx/approx.c -msgid "function has the same sign at the ends of interval" -msgstr "" - -#: extmod/ulab/code/ndarray.c -msgid "function is defined for ndarrays only" -msgstr "" - #: py/argcheck.c #, c-format msgid "function missing %d required positional arguments" @@ -2765,11 +2645,6 @@ msgstr "" msgid "incorrect padding" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "index is out of bounds" -msgstr "" - -#: extmod/ulab/code/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "" @@ -2778,14 +2653,6 @@ msgstr "" msgid "indices must be integers" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "indices must be integers, slices, or Boolean lists" -msgstr "" - -#: extmod/ulab/code/approx/approx.c -msgid "initial values must be iterable" -msgstr "" - #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c msgid "initial_value length is wrong" msgstr "" @@ -2794,66 +2661,6 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "input and output shapes are not compatible" -msgstr "" - -#: extmod/ulab/code/ulab_create.c -msgid "input argument must be an integer or a 2-tuple" -msgstr "" - -#: extmod/ulab/code/fft/fft.c -msgid "input array length must be power of 2" -msgstr "" - -#: extmod/ulab/code/ulab_create.c -msgid "input arrays are not compatible" -msgstr "" - -#: extmod/ulab/code/poly/poly.c -msgid "input data must be an iterable" -msgstr "" - -#: extmod/ulab/code/linalg/linalg.c -msgid "input matrix is asymmetric" -msgstr "" - -#: extmod/ulab/code/linalg/linalg.c -msgid "input matrix is singular" -msgstr "" - -#: extmod/ulab/code/user/user.c -msgid "input must be a dense ndarray" -msgstr "" - -#: extmod/ulab/code/ulab_create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c -msgid "input must be an ndarray" -msgstr "" - -#: extmod/ulab/code/filter/filter.c -msgid "input must be one-dimensional" -msgstr "" - -#: extmod/ulab/code/linalg/linalg.c -msgid "input must be square matrix" -msgstr "" - -#: extmod/ulab/code/numerical/numerical.c -msgid "input must be tuple, list, range, or ndarray" -msgstr "" - -#: extmod/ulab/code/poly/poly.c -msgid "input vectors must be of equal length" -msgstr "" - -#: extmod/ulab/code/poly/poly.c -msgid "inputs are not iterable" -msgstr "" - #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" msgstr "" @@ -2862,10 +2669,6 @@ msgstr "" msgid "integer required" msgstr "" -#: extmod/ulab/code/approx/approx.c -msgid "interp is defined for 1D arrays of equal length" -msgstr "" - #: shared-bindings/_bleio/Adapter.c #, c-format msgid "interval must be in range %s-%s" @@ -2936,14 +2739,6 @@ msgstr "" msgid "issubclass() arg 2 must be a class or a tuple of classes" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "iterables are not of the same length" -msgstr "" - -#: extmod/ulab/code/linalg/linalg.c -msgid "iterations did not converge" -msgstr "" - #: py/objstr.c msgid "join expects a list of str/bytes objects consistent with self object" msgstr "" @@ -3008,14 +2803,6 @@ msgstr "" msgid "math domain error" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "matrix dimensions do not match" -msgstr "" - -#: extmod/ulab/code/linalg/linalg.c -msgid "matrix is not positive definite" -msgstr "" - #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format @@ -3023,25 +2810,13 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be > 0" -msgstr "" - -#: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "max_length must be >= 0" msgstr "" #: py/runtime.c msgid "maximum recursion depth exceeded" msgstr "" -#: extmod/ulab/code/approx/approx.c -msgid "maxiter must be > 0" -msgstr "" - -#: extmod/ulab/code/approx/approx.c -msgid "maxiter should be > 0" -msgstr "" - #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3055,10 +2830,6 @@ msgstr "" msgid "module not found" msgstr "" -#: extmod/ulab/code/poly/poly.c -msgid "more degrees of freedom than data points" -msgstr "" - #: py/compile.c msgid "multiple *x in assignment" msgstr "" @@ -3161,8 +2932,12 @@ msgstr "" msgid "non-keyword arg after keyword arg" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "norm is defined for 1D and 2D arrays" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "non-zero timeout must be > 0.01" +msgstr "" + +#: shared-bindings/_bleio/Adapter.c +msgid "non-zero timeout must be >= interval" msgstr "" #: shared-bindings/_bleio/UUID.c @@ -3177,10 +2952,6 @@ msgstr "" msgid "not enough arguments for format string" msgstr "" -#: extmod/ulab/code/ulab_create.c -msgid "number of points must be at least 2" -msgstr "" - #: py/obj.c msgid "object '%q' is not a tuple or list" msgstr "" @@ -3229,8 +3000,8 @@ msgstr "" msgid "odd-length string" msgstr "" -#: extmod/ulab/code/ulab_create.c -msgid "offset is too large" +#: shared-bindings/dualbank/__init__.c +msgid "offset must be >= 0" msgstr "" #: py/objstr.c py/objstrunicode.c @@ -3250,27 +3021,6 @@ msgstr "" msgid "only slices with step=1 (aka None) are supported" msgstr "" -#: extmod/ulab/code/compare/compare.c extmod/ulab/code/ndarray.c -#: extmod/ulab/code/vector/vectorise.c -msgid "operands could not be broadcast together" -msgstr "" - -#: extmod/ulab/code/ndarray.c -msgid "operation is implemented for 1D Boolean arrays only" -msgstr "" - -#: extmod/ulab/code/numerical/numerical.c -msgid "operation is not implemented for flattened array" -msgstr "" - -#: extmod/ulab/code/numerical/numerical.c -msgid "operation is not implemented on ndarrays" -msgstr "" - -#: extmod/ulab/code/ndarray.c -msgid "operation is not supported for given type" -msgstr "" - #: py/modbuiltins.c msgid "ord expects a character" msgstr "" @@ -3384,10 +3134,6 @@ msgstr "" msgid "raw f-strings are not implemented" msgstr "" -#: extmod/ulab/code/fft/fft.c -msgid "real and imaginary parts must be of equal length" -msgstr "" - #: py/builtinimport.c msgid "relative import" msgstr "" @@ -3397,10 +3143,6 @@ msgstr "" msgid "requested length %d but object has length %d" msgstr "" -#: extmod/ulab/code/ndarray_operators.c -msgid "results cannot be cast to specified type" -msgstr "" - #: py/compile.c msgid "return annotation must be an identifier" msgstr "" @@ -3419,10 +3161,6 @@ msgstr "" msgid "rgb_pins[%d] is not on the same port as clock" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "roll argument must be an ndarray" -msgstr "" - #: py/objstr.c msgid "rsplit(None,n)" msgstr "" @@ -3445,10 +3183,6 @@ msgstr "" msgid "script compilation not supported" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "shape must be a tuple" -msgstr "" - #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "" @@ -3461,18 +3195,10 @@ msgstr "" msgid "single '}' encountered in format string" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "size is defined for ndarrays only" -msgstr "" - #: shared-bindings/time/__init__.c msgid "sleep length must be non-negative" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "slice step can't be zero" -msgstr "" - #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" msgstr "" @@ -3485,22 +3211,6 @@ msgstr "" msgid "soft reboot\n" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "sort argument must be an ndarray" -msgstr "" - -#: extmod/ulab/code/filter/filter.c -msgid "sos array must be of shape (n_section, 6)" -msgstr "" - -#: extmod/ulab/code/filter/filter.c -msgid "sos[:, 3] should be all ones" -msgstr "" - -#: extmod/ulab/code/filter/filter.c -msgid "sosfilt requires iterable arguments" -msgstr "" - #: shared-bindings/displayio/Bitmap.c msgid "source palette too large" msgstr "" @@ -3578,6 +3288,10 @@ msgstr "" msgid "timeout must be 0.0-100.0 seconds" msgstr "" +#: ports/nrf/common-hal/_bleio/Adapter.c +msgid "timeout must be < 655.35 secs" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "" @@ -3594,35 +3308,19 @@ msgstr "" msgid "timestamp out of range for platform time_t" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "tobytes can be invoked for dense arrays only" -msgstr "" - #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "too many indices" -msgstr "" - #: py/runtime.c #, c-format msgid "too many values to unpack (expected %d)" msgstr "" -#: extmod/ulab/code/approx/approx.c -msgid "trapz is defined for 1D arrays of equal length" -msgstr "" - #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "trigger level must be 0 or 1" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "tuple index out of range" -msgstr "" - #: py/obj.c msgid "tuple/list has wrong length" msgstr "" @@ -3757,10 +3455,6 @@ msgstr "" msgid "value_count must be > 0" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "vectors must have same lengths" -msgstr "" - #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "wakeup conflict" msgstr "" @@ -3781,19 +3475,7 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "wrong axis index" -msgstr "" - -#: extmod/ulab/code/ulab_create.c -msgid "wrong axis specified" -msgstr "" - -#: extmod/ulab/code/vector/vectorise.c -msgid "wrong input type" -msgstr "" - -#: extmod/ulab/code/ulab_create.c py/objstr.c +#: py/objstr.c msgid "wrong number of arguments" msgstr "" @@ -3801,14 +3483,6 @@ msgstr "" msgid "wrong number of values to unpack" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "wrong operand type" -msgstr "" - -#: extmod/ulab/code/vector/vectorise.c -msgid "wrong output type" -msgstr "" - #: shared-module/displayio/Shape.c msgid "x value out of bounds" msgstr "" @@ -3824,15 +3498,3 @@ msgstr "" #: py/objrange.c msgid "zero step" msgstr "" - -#: extmod/ulab/code/filter/filter.c -msgid "zi must be an ndarray" -msgstr "" - -#: extmod/ulab/code/filter/filter.c -msgid "zi must be of float type" -msgstr "" - -#: extmod/ulab/code/filter/filter.c -msgid "zi must be of shape (n_section, 2)" -msgstr "" From 578abae0f50725b67a3f8102ed5d1e6fa6feb4c0 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 23 Dec 2020 23:05:10 -0500 Subject: [PATCH 499/770] make translate yet again; forgot to fetch submodules to fresh clone --- locale/circuitpython.pot | 362 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 360 insertions(+), 2 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index c5830adabb1ab..3edadd57c780a 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-12-23 22:50-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -884,6 +884,14 @@ msgstr "" msgid "Extended advertisements with scan response not supported." msgstr "" +#: extmod/ulab/code/fft/fft.c +msgid "FFT is defined for ndarrays only" +msgstr "" + +#: extmod/ulab/code/fft/fft.c +msgid "FFT is implemented for linear arrays only" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" msgstr "" @@ -2110,10 +2118,22 @@ msgstr "" msgid "arg is an empty sequence" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "argsort argument must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "argsort is not implemented for flattened arrays" +msgstr "" + #: py/runtime.c msgid "argument has wrong type" msgstr "" +#: extmod/ulab/code/linalg/linalg.c +msgid "argument must be ndarray" +msgstr "" + #: py/argcheck.c shared-bindings/_stage/__init__.c #: shared-bindings/digitalio/DigitalInOut.c shared-bindings/gamepad/GamePad.c msgid "argument num/types mismatch" @@ -2123,15 +2143,43 @@ msgstr "" msgid "argument should be a '%q' not a '%q'" msgstr "" +#: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c +msgid "arguments must be ndarrays" +msgstr "" + +#: extmod/ulab/code/ndarray.c +msgid "array and index length must be equal" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "attempt to get (arg)min/(arg)max of empty sequence" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "attempt to get argmin/argmax of an empty sequence" +msgstr "" + #: py/objstr.c msgid "attributes not supported yet" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "axis is out of bounds" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "axis must be None, or an integer" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "axis too long" +msgstr "" + #: py/builtinevex.c msgid "bad compile mode" msgstr "" @@ -2333,6 +2381,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "" +#: extmod/ulab/code/ndarray_operators.c +msgid "cannot cast output with casting rule" +msgstr "" + #: py/objtype.c msgid "cannot create '%q' instances" msgstr "" @@ -2409,10 +2461,38 @@ msgstr "" msgid "conversion to object" msgstr "" +#: extmod/ulab/code/filter/filter.c +msgid "convolve arguments must be linear arrays" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "convolve arguments must be ndarrays" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "convolve arguments must not be empty" +msgstr "" + +#: extmod/ulab/code/poly/poly.c +msgid "could not invert Vandermonde matrix" +msgstr "" + #: shared-module/sdcardio/SDCard.c msgid "couldn't determine SD card version" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "cross is defined for 1D arrays of length 3" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "data must be iterable" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "data must be of equal length" +msgstr "" + #: py/parsenum.c msgid "decimal numbers not supported" msgstr "" @@ -2438,6 +2518,14 @@ msgstr "" msgid "dict update sequence has wrong length" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "diff argument must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "differentiation order out of range" +msgstr "" + #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c msgid "division by zero" @@ -2549,10 +2637,38 @@ msgstr "" msgid "filesystem must provide mount method" msgstr "" +#: extmod/ulab/code/vector/vectorise.c +msgid "first argument must be a callable" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "first argument must be a function" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "first argument must be a tuple of ndarrays" +msgstr "" + +#: extmod/ulab/code/ndarray.c +msgid "first argument must be an iterable" +msgstr "" + +#: extmod/ulab/code/vector/vectorise.c +msgid "first argument must be an ndarray" +msgstr "" + #: py/objtype.c msgid "first argument to super() must be type" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "flattening order must be either 'C', or 'F'" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "flip argument must be an ndarray" +msgstr "" + #: py/objint.c msgid "float too big" msgstr "" @@ -2582,6 +2698,14 @@ msgstr "" msgid "function got multiple values for argument '%q'" msgstr "" +#: extmod/ulab/code/approx/approx.c +msgid "function has the same sign at the ends of interval" +msgstr "" + +#: extmod/ulab/code/ndarray.c +msgid "function is defined for ndarrays only" +msgstr "" + #: py/argcheck.c #, c-format msgid "function missing %d required positional arguments" @@ -2645,6 +2769,11 @@ msgstr "" msgid "incorrect padding" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "index is out of bounds" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" msgstr "" @@ -2653,6 +2782,14 @@ msgstr "" msgid "indices must be integers" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "indices must be integers, slices, or Boolean lists" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "initial values must be iterable" +msgstr "" + #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c msgid "initial_value length is wrong" msgstr "" @@ -2661,6 +2798,66 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "input and output shapes are not compatible" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input argument must be an integer or a 2-tuple" +msgstr "" + +#: extmod/ulab/code/fft/fft.c +msgid "input array length must be power of 2" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input arrays are not compatible" +msgstr "" + +#: extmod/ulab/code/poly/poly.c +msgid "input data must be an iterable" +msgstr "" + +#: extmod/ulab/code/linalg/linalg.c +msgid "input matrix is asymmetric" +msgstr "" + +#: extmod/ulab/code/linalg/linalg.c +msgid "input matrix is singular" +msgstr "" + +#: extmod/ulab/code/user/user.c +msgid "input must be a dense ndarray" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "input must be a tensor of rank 2" +msgstr "" + +#: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c +msgid "input must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "input must be one-dimensional" +msgstr "" + +#: extmod/ulab/code/linalg/linalg.c +msgid "input must be square matrix" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "input must be tuple, list, range, or ndarray" +msgstr "" + +#: extmod/ulab/code/poly/poly.c +msgid "input vectors must be of equal length" +msgstr "" + +#: extmod/ulab/code/poly/poly.c +msgid "inputs are not iterable" +msgstr "" + #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" msgstr "" @@ -2669,6 +2866,10 @@ msgstr "" msgid "integer required" msgstr "" +#: extmod/ulab/code/approx/approx.c +msgid "interp is defined for 1D arrays of equal length" +msgstr "" + #: shared-bindings/_bleio/Adapter.c #, c-format msgid "interval must be in range %s-%s" @@ -2739,6 +2940,14 @@ msgstr "" msgid "issubclass() arg 2 must be a class or a tuple of classes" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "iterables are not of the same length" +msgstr "" + +#: extmod/ulab/code/linalg/linalg.c +msgid "iterations did not converge" +msgstr "" + #: py/objstr.c msgid "join expects a list of str/bytes objects consistent with self object" msgstr "" @@ -2803,6 +3012,14 @@ msgstr "" msgid "math domain error" msgstr "" +#: extmod/ulab/code/linalg/linalg.c +msgid "matrix dimensions do not match" +msgstr "" + +#: extmod/ulab/code/linalg/linalg.c +msgid "matrix is not positive definite" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format @@ -2813,10 +3030,22 @@ msgstr "" msgid "max_length must be >= 0" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "maximum number of dimensions is 4" +msgstr "" + #: py/runtime.c msgid "maximum recursion depth exceeded" msgstr "" +#: extmod/ulab/code/approx/approx.c +msgid "maxiter must be > 0" +msgstr "" + +#: extmod/ulab/code/approx/approx.c +msgid "maxiter should be > 0" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -2830,6 +3059,10 @@ msgstr "" msgid "module not found" msgstr "" +#: extmod/ulab/code/poly/poly.c +msgid "more degrees of freedom than data points" +msgstr "" + #: py/compile.c msgid "multiple *x in assignment" msgstr "" @@ -2940,6 +3173,10 @@ msgstr "" msgid "non-zero timeout must be >= interval" msgstr "" +#: extmod/ulab/code/linalg/linalg.c +msgid "norm is defined for 1D and 2D arrays" +msgstr "" + #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "" @@ -2952,6 +3189,10 @@ msgstr "" msgid "not enough arguments for format string" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "number of points must be at least 2" +msgstr "" + #: py/obj.c msgid "object '%q' is not a tuple or list" msgstr "" @@ -3000,6 +3241,10 @@ msgstr "" msgid "odd-length string" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "offset is too large" +msgstr "" + #: shared-bindings/dualbank/__init__.c msgid "offset must be >= 0" msgstr "" @@ -3021,6 +3266,27 @@ msgstr "" msgid "only slices with step=1 (aka None) are supported" msgstr "" +#: extmod/ulab/code/compare/compare.c extmod/ulab/code/ndarray.c +#: extmod/ulab/code/vector/vectorise.c +msgid "operands could not be broadcast together" +msgstr "" + +#: extmod/ulab/code/ndarray.c +msgid "operation is implemented for 1D Boolean arrays only" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "operation is not implemented for flattened array" +msgstr "" + +#: extmod/ulab/code/numerical/numerical.c +msgid "operation is not implemented on ndarrays" +msgstr "" + +#: extmod/ulab/code/ndarray.c +msgid "operation is not supported for given type" +msgstr "" + #: py/modbuiltins.c msgid "ord expects a character" msgstr "" @@ -3134,6 +3400,10 @@ msgstr "" msgid "raw f-strings are not implemented" msgstr "" +#: extmod/ulab/code/fft/fft.c +msgid "real and imaginary parts must be of equal length" +msgstr "" + #: py/builtinimport.c msgid "relative import" msgstr "" @@ -3143,6 +3413,10 @@ msgstr "" msgid "requested length %d but object has length %d" msgstr "" +#: extmod/ulab/code/ndarray_operators.c +msgid "results cannot be cast to specified type" +msgstr "" + #: py/compile.c msgid "return annotation must be an identifier" msgstr "" @@ -3161,6 +3435,10 @@ msgstr "" msgid "rgb_pins[%d] is not on the same port as clock" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "roll argument must be an ndarray" +msgstr "" + #: py/objstr.c msgid "rsplit(None,n)" msgstr "" @@ -3183,6 +3461,10 @@ msgstr "" msgid "script compilation not supported" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "shape must be a tuple" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "" @@ -3195,10 +3477,18 @@ msgstr "" msgid "single '}' encountered in format string" msgstr "" +#: extmod/ulab/code/linalg/linalg.c +msgid "size is defined for ndarrays only" +msgstr "" + #: shared-bindings/time/__init__.c msgid "sleep length must be non-negative" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "slice step can't be zero" +msgstr "" + #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" msgstr "" @@ -3211,6 +3501,22 @@ msgstr "" msgid "soft reboot\n" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "sort argument must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "sos array must be of shape (n_section, 6)" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "sos[:, 3] should be all ones" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "sosfilt requires iterable arguments" +msgstr "" + #: shared-bindings/displayio/Bitmap.c msgid "source palette too large" msgstr "" @@ -3308,19 +3614,35 @@ msgstr "" msgid "timestamp out of range for platform time_t" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "tobytes can be invoked for dense arrays only" +msgstr "" + #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "too many indices" +msgstr "" + #: py/runtime.c #, c-format msgid "too many values to unpack (expected %d)" msgstr "" +#: extmod/ulab/code/approx/approx.c +msgid "trapz is defined for 1D arrays of equal length" +msgstr "" + #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "trigger level must be 0 or 1" msgstr "" +#: extmod/ulab/code/linalg/linalg.c +msgid "tuple index out of range" +msgstr "" + #: py/obj.c msgid "tuple/list has wrong length" msgstr "" @@ -3455,6 +3777,10 @@ msgstr "" msgid "value_count must be > 0" msgstr "" +#: extmod/ulab/code/linalg/linalg.c +msgid "vectors must have same lengths" +msgstr "" + #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "wakeup conflict" msgstr "" @@ -3475,7 +3801,19 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: py/objstr.c +#: extmod/ulab/code/numerical/numerical.c +msgid "wrong axis index" +msgstr "" + +#: extmod/ulab/code/ulab_create.c +msgid "wrong axis specified" +msgstr "" + +#: extmod/ulab/code/vector/vectorise.c +msgid "wrong input type" +msgstr "" + +#: extmod/ulab/code/ulab_create.c py/objstr.c msgid "wrong number of arguments" msgstr "" @@ -3483,6 +3821,14 @@ msgstr "" msgid "wrong number of values to unpack" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "wrong operand type" +msgstr "" + +#: extmod/ulab/code/vector/vectorise.c +msgid "wrong output type" +msgstr "" + #: shared-module/displayio/Shape.c msgid "x value out of bounds" msgstr "" @@ -3498,3 +3844,15 @@ msgstr "" #: py/objrange.c msgid "zero step" msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "zi must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "zi must be of float type" +msgstr "" + +#: extmod/ulab/code/filter/filter.c +msgid "zi must be of shape (n_section, 2)" +msgstr "" From f3e54414e5771a2463a8a93b4dcbb395584d2fe3 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Thu, 24 Dec 2020 14:03:10 +0800 Subject: [PATCH 500/770] litex: ensure we don't re-enable interrups during ISR During an interrupt handler, interrupts are implicitly disabled. They will be re-enabled when the interrupt handler returns. Due to some changes that were made, varous calls will re-enable interrupts after they're finished. Examples of this include calling `CALLBACK_CRITICAL_END` and getting the number of ticks with `port_get_raw_ticks()`. This patch prevents this from happening by doing two things: 1. Use standard calls in `port_get_raw_ticks()` to disable and re-enable interrupts, preventing nesting issues, and 2. Increase the nesting count inside `isr()`, reflecting the implicit call that is made by hardware when an interrupt is handled This helps to address #3841. Signed-off-by: Sean Cross --- ports/litex/mphalport.c | 15 +++++++++++++++ ports/litex/supervisor/port.c | 6 ++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ports/litex/mphalport.c b/ports/litex/mphalport.c index 862f1639397d3..c7369dc0507c5 100644 --- a/ports/litex/mphalport.c +++ b/ports/litex/mphalport.c @@ -44,16 +44,31 @@ void mp_hal_delay_us(mp_uint_t delay) { extern void SysTick_Handler(void); +// This value contains the number of times "common_hal_mcu_disable_interrupts()" +// has been called without calling "common_hal_mcu_enable_interrupts()". Since +// this is the interrupt handler, that means we're handling an interrupt, so +// this value should be `0`. +// +// Interrupts should already be disabled when this handler is running, which means +// this value is logically already `1`. If we didn't do this, then interrupts would +// be prematurely enabled by interrupt handlers that enable and disable interrupts. +extern volatile uint32_t nesting_count; + __attribute__((section(".ramtext"))) void isr(void) { uint8_t irqs = irq_pending() & irq_getmask(); + // Increase the "nesting count". Note: This should be going from 0 -> 1. + nesting_count += 1; #ifdef CFG_TUSB_MCU if (irqs & (1 << USB_INTERRUPT)) usb_irq_handler(); #endif if (irqs & (1 << TIMER0_INTERRUPT)) SysTick_Handler(); + + // Decrease the "nesting count". Note: This should be going from 1 -> 0. + nesting_count -= 1; } mp_uint_t cpu_get_regs_and_sp(mp_uint_t *regs) { diff --git a/ports/litex/supervisor/port.c b/ports/litex/supervisor/port.c index 02617b9af7deb..9897fa397ef4a 100644 --- a/ports/litex/supervisor/port.c +++ b/ports/litex/supervisor/port.c @@ -32,6 +32,8 @@ #include "irq.h" #include "csr.h" +#include "shared-bindings/microcontroller/__init__.h" + // Global millisecond tick count. 1024 per second because most RTCs are clocked with 32.768khz // crystals. volatile uint64_t raw_ticks = 0; @@ -129,9 +131,9 @@ uint32_t port_get_saved_word(void) { uint64_t port_get_raw_ticks(uint8_t* subticks) { // Reading 64 bits may take two loads, so turn of interrupts while we do it. - irq_setie(false); + common_hal_mcu_disable_interrupts(); uint64_t raw_tick_snapshot = raw_ticks; - irq_setie(true); + common_hal_mcu_enable_interrupts(); return raw_tick_snapshot; } From 2f95cc95a494395658eefed6130b9a8732117482 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Thu, 24 Dec 2020 14:06:57 +0800 Subject: [PATCH 501/770] litex: move more critical code to RAM The XIP SPI flash on Fomu is slow, which results in certain operations taking a long time. This becomes a problem for time-critical operations such as USB. Move various calls into RAM to improve performance. This includes the call to __modsi3 and __udivsi3 which are used by the supervisor handler to determine if periodic callbacks need to be run. This finishes fixing #3841 Signed-off-by: Sean Cross --- ports/litex/boards/fomu/fomu-spi.ld | 5 +++++ ports/litex/common-hal/microcontroller/__init__.c | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ports/litex/boards/fomu/fomu-spi.ld b/ports/litex/boards/fomu/fomu-spi.ld index 9b6443c67324b..e7db25b0c5b43 100644 --- a/ports/litex/boards/fomu/fomu-spi.ld +++ b/ports/litex/boards/fomu/fomu-spi.ld @@ -51,6 +51,11 @@ SECTIONS *(.text.tu_edpt_dir) *(.text.tu_fifo_empty) *(.text.usbd_edpt_busy) + *(.text.usb_irq_handler) + *(.text.supervisor_tick) + *(.text.port_get_raw_ticks) + *(.text.__modsi3) + *(.text.__udivsi3) *(.text.irq_getmask) *(.text.irq_setmask) *(.text.irq_pending) diff --git a/ports/litex/common-hal/microcontroller/__init__.c b/ports/litex/common-hal/microcontroller/__init__.c index 3c91661144b81..522a41e2e366c 100644 --- a/ports/litex/common-hal/microcontroller/__init__.c +++ b/ports/litex/common-hal/microcontroller/__init__.c @@ -59,12 +59,15 @@ void common_hal_mcu_delay_us(uint32_t delay) { volatile uint32_t nesting_count = 0; +__attribute__((section(".ramtext"))) void common_hal_mcu_disable_interrupts(void) { - irq_setie(0); - // __DMB(); + if (nesting_count == 0) { + irq_setie(0); + } nesting_count++; } +__attribute__((section(".ramtext"))) void common_hal_mcu_enable_interrupts(void) { if (nesting_count == 0) { // This is very very bad because it means there was mismatched disable/enables so we From 64bb055700d425617adff7748890354d925248fd Mon Sep 17 00:00:00 2001 From: BennyE Date: Thu, 24 Dec 2020 15:40:53 +0100 Subject: [PATCH 502/770] Updating comment to reflect feedback of espressif from IDFGH-4486 -> works correct as per the protocol --- ports/esp32s2/common-hal/wifi/Network.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/Network.c b/ports/esp32s2/common-hal/wifi/Network.c index be4935dba518f..2674df0651ef1 100644 --- a/ports/esp32s2/common-hal/wifi/Network.c +++ b/ports/esp32s2/common-hal/wifi/Network.c @@ -51,8 +51,6 @@ mp_obj_t common_hal_wifi_network_get_channel(wifi_network_obj_t *self) { mp_obj_t common_hal_wifi_network_get_country(wifi_network_obj_t *self) { const char* cstr = (const char*) self->record.country.cc; - // To address esp_wifi_get_country() returned/set wifi_country_t structure - // doesn't follow the documented behaviour (IDFGH-4486) #6315 - // 2 instead of strlen(cstr) which would be 6 and contain full element + // 2 instead of strlen(cstr) as this gives us only the country-code return mp_obj_new_str(cstr, 2); } From 2729666d82965dc8a01a9aa2b11387af661c4822 Mon Sep 17 00:00:00 2001 From: Uwe Gartmann Date: Fri, 25 Dec 2020 17:53:43 +0100 Subject: [PATCH 503/770] SAMD51: change of DAC power setting Fixes wrong DAC output levels at high data rate closes adafruit#3796 --- ports/atmel-samd/common-hal/audioio/AudioOut.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/atmel-samd/common-hal/audioio/AudioOut.c b/ports/atmel-samd/common-hal/audioio/AudioOut.c index 5cefba56f12aa..34b718dca8755 100644 --- a/ports/atmel-samd/common-hal/audioio/AudioOut.c +++ b/ports/atmel-samd/common-hal/audioio/AudioOut.c @@ -197,7 +197,7 @@ void common_hal_audioio_audioout_construct(audioio_audioout_obj_t* self, #endif #ifdef SAM_D5X_E5X DAC->EVCTRL.reg |= DAC_EVCTRL_STARTEI0; - DAC->DACCTRL[0].reg = DAC_DACCTRL_CCTRL_CC100K | + DAC->DACCTRL[0].reg = DAC_DACCTRL_CCTRL_CC12M | DAC_DACCTRL_ENABLE | DAC_DACCTRL_LEFTADJ; DAC->CTRLB.reg = DAC_CTRLB_REFSEL_VREFPU; @@ -206,7 +206,7 @@ void common_hal_audioio_audioout_construct(audioio_audioout_obj_t* self, #ifdef SAM_D5X_E5X if (channel1_enabled) { DAC->EVCTRL.reg |= DAC_EVCTRL_STARTEI1; - DAC->DACCTRL[1].reg = DAC_DACCTRL_CCTRL_CC100K | + DAC->DACCTRL[1].reg = DAC_DACCTRL_CCTRL_CC12M | DAC_DACCTRL_ENABLE | DAC_DACCTRL_LEFTADJ; DAC->CTRLB.reg = DAC_CTRLB_REFSEL_VREFPU; From f7cafbf5f9ff244c0f7681ff2b07fe9d493c9aa3 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Sat, 26 Dec 2020 12:54:36 +0530 Subject: [PATCH 504/770] re-arrange ci actions --- .github/workflows/build.yml | 52 ++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 36b8db388a387..1a21c13c4f100 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,6 +43,32 @@ jobs: run: | gcc --version python3 --version + - name: Translations + run: make check-translate + - name: New boards check + run: python3 -u ci_new_boards_check.py + working-directory: tools + - name: Duplicate USB VID/PID Check + run: python3 -u -m tools.ci_check_duplicate_usb_vid_pid + - name: Build and Validate Stubs + run: make check-stubs -j2 + - uses: actions/upload-artifact@v2 + with: + name: stubs + path: circuitpython-stubs* + - name: Test Documentation Build (HTML) + run: sphinx-build -E -W -b html -D version=${{ env.CP_VERSION }} -D release=${{ env.CP_VERSION }} . _build/html + - uses: actions/upload-artifact@v2 + with: + name: docs + path: _build/html + - name: Test Documentation Build (LaTeX/PDF) + run: | + make latexpdf + - uses: actions/upload-artifact@v2 + with: + name: docs + path: _build/latex - name: Build mpy-cross run: make -C mpy-cross -j2 - name: Build unix port @@ -68,32 +94,6 @@ jobs: - name: mpy Tests run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float working-directory: tests - - name: Build and Validate Stubs - run: make check-stubs -j2 - - uses: actions/upload-artifact@v2 - with: - name: stubs - path: circuitpython-stubs* - - name: Test Documentation Build (HTML) - run: sphinx-build -E -W -b html -D version=${{ env.CP_VERSION }} -D release=${{ env.CP_VERSION }} . _build/html - - uses: actions/upload-artifact@v2 - with: - name: docs - path: _build/html - - name: Test Documentation Build (LaTeX/PDF) - run: | - make latexpdf - - uses: actions/upload-artifact@v2 - with: - name: docs - path: _build/latex - - name: Translations - run: make check-translate - - name: New boards check - run: python3 -u ci_new_boards_check.py - working-directory: tools - - name: Duplicate USB VID/PID Check - run: python3 -u -m tools.ci_check_duplicate_usb_vid_pid - name: Build mpy-cross.static-raspbian run: make -C mpy-cross -j2 -f Makefile.static-raspbian - uses: actions/upload-artifact@v2 From 938a0fa2fc9ffaba15f345f102a34c5354166c4a Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sat, 26 Dec 2020 13:39:48 -0500 Subject: [PATCH 505/770] Add include to tick.c for mp_hal_is_interrupted() --- supervisor/shared/tick.c | 1 + 1 file changed, 1 insertion(+) diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c index 5d75a5395cfc5..e51c48c7396c4 100644 --- a/supervisor/shared/tick.c +++ b/supervisor/shared/tick.c @@ -26,6 +26,7 @@ #include "supervisor/shared/tick.h" +#include "lib/utils/interrupt_char.h" #include "py/mpstate.h" #include "py/runtime.h" #include "supervisor/linker.h" From 6c7e6abcfdb4bdffd37dc4649bc7232f3cde4897 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Sun, 27 Dec 2020 20:30:49 -0800 Subject: [PATCH 506/770] Downgrade OTA API for IDF 4.2 --- ports/esp32s2/common-hal/dualbank/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/common-hal/dualbank/__init__.c b/ports/esp32s2/common-hal/dualbank/__init__.c index 0f468a036beb1..1414f131d1a91 100644 --- a/ports/esp32s2/common-hal/dualbank/__init__.c +++ b/ports/esp32s2/common-hal/dualbank/__init__.c @@ -100,7 +100,7 @@ void common_hal_dualbank_flash(const void *buf, const size_t len, const size_t o } } - err = esp_ota_begin(update_partition, OTA_WITH_SEQUENTIAL_WRITES, &update_handle); + err = esp_ota_begin(update_partition, OTA_SIZE_UNKNOWN, &update_handle); if (err != ESP_OK) { ESP_LOGE(TAG, "esp_ota_begin failed (%s)", esp_err_to_name(err)); task_fatal_error(); From dc332baa87bf1fa3d777ffe31c7dc29b24a6a142 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Mon, 28 Dec 2020 20:04:00 +0530 Subject: [PATCH 507/770] update common_hal_reset_pin() --- ports/atmel-samd/common-hal/microcontroller/Pin.c | 3 +++ ports/esp32s2/common-hal/busio/SPI.c | 8 ++------ ports/esp32s2/common-hal/microcontroller/Pin.c | 3 +++ ports/litex/common-hal/microcontroller/Pin.c | 3 +++ ports/mimxrt10xx/common-hal/busio/SPI.c | 9 +++------ ports/mimxrt10xx/common-hal/busio/UART.c | 10 ++++------ ports/mimxrt10xx/common-hal/microcontroller/Pin.c | 3 +++ ports/nrf/common-hal/microcontroller/Pin.c | 3 +++ ports/stm/common-hal/microcontroller/Pin.c | 3 +++ shared-module/displayio/FourWire.c | 4 +--- 10 files changed, 28 insertions(+), 21 deletions(-) diff --git a/ports/atmel-samd/common-hal/microcontroller/Pin.c b/ports/atmel-samd/common-hal/microcontroller/Pin.c index 7dd87a3b2c0b6..564d037e03f73 100644 --- a/ports/atmel-samd/common-hal/microcontroller/Pin.c +++ b/ports/atmel-samd/common-hal/microcontroller/Pin.c @@ -169,6 +169,9 @@ void common_hal_never_reset_pin(const mcu_pin_obj_t* pin) { } void common_hal_reset_pin(const mcu_pin_obj_t* pin) { + if (pin == NULL) { + return; + } reset_pin_number(pin->number); } diff --git a/ports/esp32s2/common-hal/busio/SPI.c b/ports/esp32s2/common-hal/busio/SPI.c index 562881585dfd1..62f47999cfa90 100644 --- a/ports/esp32s2/common-hal/busio/SPI.c +++ b/ports/esp32s2/common-hal/busio/SPI.c @@ -248,12 +248,8 @@ void common_hal_busio_spi_deinit(busio_spi_obj_t *self) { spi_bus_free(self->host_id); common_hal_reset_pin(self->clock_pin); - if (self->MOSI_pin != NULL) { - common_hal_reset_pin(self->MOSI_pin); - } - if (self->MISO_pin != NULL) { - common_hal_reset_pin(self->MISO_pin); - } + common_hal_reset_pin(self->MOSI_pin); + common_hal_reset_pin(self->MISO_pin); self->clock_pin = NULL; self->MISO_pin = NULL; self->MOSI_pin = NULL; diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index 81dfa1308d555..26bd6c16be44d 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -89,6 +89,9 @@ void reset_pin_number(gpio_num_t pin_number) { } void common_hal_reset_pin(const mcu_pin_obj_t* pin) { + if (pin == NULL) { + return; + } reset_pin_number(pin->number); } diff --git a/ports/litex/common-hal/microcontroller/Pin.c b/ports/litex/common-hal/microcontroller/Pin.c index 38601e0d3c201..4d088a0763806 100644 --- a/ports/litex/common-hal/microcontroller/Pin.c +++ b/ports/litex/common-hal/microcontroller/Pin.c @@ -42,6 +42,9 @@ void reset_pin_number(uint8_t pin_port, uint8_t pin_number) { } void common_hal_reset_pin(const mcu_pin_obj_t* pin) { + if (pin == NULL) { + return; + } reset_pin_number(0, pin->number); } diff --git a/ports/mimxrt10xx/common-hal/busio/SPI.c b/ports/mimxrt10xx/common-hal/busio/SPI.c index 8fe1b799d6aa3..ce7cbea7ecd9d 100644 --- a/ports/mimxrt10xx/common-hal/busio/SPI.c +++ b/ports/mimxrt10xx/common-hal/busio/SPI.c @@ -220,12 +220,9 @@ void common_hal_busio_spi_deinit(busio_spi_obj_t *self) { never_reset_spi[self->clock->bank_idx - 1] = false; common_hal_reset_pin(self->clock->pin); - if (self->mosi != NULL) { - common_hal_reset_pin(self->mosi->pin); - } - if (self->miso != NULL) { - common_hal_reset_pin(self->miso->pin); - } + common_hal_reset_pin(self->mosi->pin); + common_hal_reset_pin(self->miso->pin); + self->clock = NULL; self->mosi = NULL; self->miso = NULL; diff --git a/ports/mimxrt10xx/common-hal/busio/UART.c b/ports/mimxrt10xx/common-hal/busio/UART.c index db5582d1509d5..03a6e8f3efb14 100644 --- a/ports/mimxrt10xx/common-hal/busio/UART.c +++ b/ports/mimxrt10xx/common-hal/busio/UART.c @@ -295,12 +295,10 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { LPUART_Deinit(self->uart); gc_free(self->ringbuf); - if (self->rx) { - common_hal_reset_pin(self->rx->pin); - } - if (self->tx) { - common_hal_reset_pin(self->tx->pin); - } + + common_hal_reset_pin(self->rx->pin); + common_hal_reset_pin(self->tx->pin); + self->rx = NULL; self->tx = NULL; diff --git a/ports/mimxrt10xx/common-hal/microcontroller/Pin.c b/ports/mimxrt10xx/common-hal/microcontroller/Pin.c index a005924e2f143..50970f8e22509 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/Pin.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/Pin.c @@ -67,6 +67,9 @@ void reset_all_pins(void) { // Since i.MX pins need extra register and reset information to reset properly, // resetting pins by number alone has been removed. void common_hal_reset_pin(const mcu_pin_obj_t* pin) { + if (pin == NULL) { + return; + } never_reset_pins[pin->mux_idx] = false; claimed_pins[pin->mux_idx] = false; *(uint32_t*)pin->mux_reg = pin->mux_reset; diff --git a/ports/nrf/common-hal/microcontroller/Pin.c b/ports/nrf/common-hal/microcontroller/Pin.c index bc7ff831a5633..23d6e23bfe787 100644 --- a/ports/nrf/common-hal/microcontroller/Pin.c +++ b/ports/nrf/common-hal/microcontroller/Pin.c @@ -134,6 +134,9 @@ void common_hal_never_reset_pin(const mcu_pin_obj_t* pin) { } void common_hal_reset_pin(const mcu_pin_obj_t* pin) { + if (pin == NULL) { + return; + } reset_pin_number(pin->number); } diff --git a/ports/stm/common-hal/microcontroller/Pin.c b/ports/stm/common-hal/microcontroller/Pin.c index 0e333c71cff3c..37c202d86ecf0 100644 --- a/ports/stm/common-hal/microcontroller/Pin.c +++ b/ports/stm/common-hal/microcontroller/Pin.c @@ -125,6 +125,9 @@ void common_hal_never_reset_pin(const mcu_pin_obj_t* pin) { } void common_hal_reset_pin(const mcu_pin_obj_t* pin) { + if (pin == NULL) { + return; + } reset_pin_number(pin->port, pin->number); } diff --git a/shared-module/displayio/FourWire.c b/shared-module/displayio/FourWire.c index 06f8a84e3506d..e993f2480c5b7 100644 --- a/shared-module/displayio/FourWire.c +++ b/shared-module/displayio/FourWire.c @@ -76,9 +76,7 @@ void common_hal_displayio_fourwire_deinit(displayio_fourwire_obj_t* self) { common_hal_reset_pin(self->command.pin); common_hal_reset_pin(self->chip_select.pin); - if (self->reset.pin) { - common_hal_reset_pin(self->reset.pin); - } + common_hal_reset_pin(self->reset.pin); } bool common_hal_displayio_fourwire_reset(mp_obj_t obj) { From dc8593db93d1c7213e5be07571498cf42f38be34 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Mon, 28 Dec 2020 16:32:25 +0000 Subject: [PATCH 508/770] Translated using Weblate (Swedish) Currently translated at 100.0% (884 of 884 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 75f052815e7c1..9c2d30d0683f9 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-23 16:41-0500\n" -"PO-Revision-Date: 2020-12-07 20:26+0000\n" +"PO-Revision-Date: 2020-12-28 17:59+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.4-dev\n" +"X-Generator: Weblate 4.4.1-dev\n" #: main.c msgid "" @@ -950,7 +950,7 @@ msgstr "Filter för komplexa" #: ports/esp32s2/common-hal/dualbank/__init__.c msgid "Firmware image is invalid" -msgstr "" +msgstr "Firmware-avbilden är ogiltig" #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" @@ -1096,7 +1096,7 @@ msgstr "Ogiltig PWM-frekvens" #: ports/esp32s2/common-hal/analogio/AnalogIn.c msgid "Invalid Pin" -msgstr "" +msgstr "Ogiltig pinne" #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" @@ -1591,10 +1591,12 @@ msgstr "Prefixbufferten måste finnas på heap" #: main.c msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" +"Tryck på valfri tangent för att gå in i REPL. Använd CTRL-D för att ladda om." +"\n" #: main.c msgid "Pretending to deep sleep until alarm, any key or file write.\n" -msgstr "" +msgstr "Fingerar djup sömn tills larm, valfri tangent eller filskrivning.\n" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -1956,7 +1958,7 @@ msgstr "Det gick inte att skriva till nvm." #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." -msgstr "" +msgstr "Det gick inte att skriva till sleep_memory." #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" @@ -2026,7 +2028,7 @@ msgstr "Ogiltigt Pull-värde." #: ports/esp32s2/common-hal/dualbank/__init__.c msgid "Update Failed" -msgstr "" +msgstr "Uppdateringen misslyckades" #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -2092,7 +2094,7 @@ msgstr "WiFi-lösenord måste vara mellan 8 och 63 tecken" #: main.c msgid "Woken up by alarm.\n" -msgstr "" +msgstr "Vaknade av larm.\n" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" @@ -3061,7 +3063,7 @@ msgstr "max_length måste vara 0-%d när fixed_length är %s" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c msgid "max_length must be >= 0" -msgstr "" +msgstr "max_length måste vara >= 0" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" @@ -3200,11 +3202,11 @@ msgstr "icke nyckelord arg efter nyckelord arg" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" -msgstr "" +msgstr "Icke-noll timeout måste vara > 0.01" #: shared-bindings/_bleio/Adapter.c msgid "non-zero timeout must be >= interval" -msgstr "" +msgstr "Icke-noll timeout måste vara >= intervall" #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" @@ -3280,7 +3282,7 @@ msgstr "offset är för stor" #: shared-bindings/dualbank/__init__.c msgid "offset must be >= 0" -msgstr "" +msgstr "offset måste vara >= 0" #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" @@ -3632,7 +3634,7 @@ msgstr "timeout måste vara 0.0-100.0 sekunder" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "timeout must be < 655.35 secs" -msgstr "" +msgstr "timeout måste vara < 655,35 sekunder" #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" From 860c4d5af44f1fe89b975d9fc052f06af88bb137 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Mon, 28 Dec 2020 18:59:42 +0100 Subject: [PATCH 509/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 45 ++++++++++++++++++++++++------- locale/cs.po | 45 ++++++++++++++++++++++++------- locale/de_DE.po | 45 ++++++++++++++++++++++++------- locale/el.po | 38 +++++++++++++++++++++------ locale/es.po | 45 ++++++++++++++++++++++++------- locale/fil.po | 38 +++++++++++++++++++++------ locale/fr.po | 48 ++++++++++++++++++++++++++------- locale/hi.po | 38 +++++++++++++++++++++------ locale/it_IT.po | 38 +++++++++++++++++++++------ locale/ja.po | 45 ++++++++++++++++++++++++------- locale/ko.po | 45 ++++++++++++++++++++++++------- locale/nl.po | 55 ++++++++++++++++++++++++++++++-------- locale/pl.po | 45 ++++++++++++++++++++++++------- locale/pt_BR.po | 55 ++++++++++++++++++++++++++++++-------- locale/sv.po | 57 +++++++++++++++++++++++++++++++--------- locale/zh_Latn_pinyin.po | 45 ++++++++++++++++++++++++------- 16 files changed, 580 insertions(+), 147 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 14b038797e22f..45b35f195593c 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-10-10 23:51+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -19,10 +19,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"Kode selesai berjalan. Menunggu memuat ulang.\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -540,6 +544,18 @@ msgstr "Blok CBC harus merupakan kelipatan 16 byte" msgid "Call super().__init__() before accessing native object." msgstr "Panggil super().__init__() sebelum mengakses objek asli." +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "Tidak dapat mengatur CCCD pada Karakteristik lokal" @@ -576,6 +592,10 @@ msgstr "" "Tidak dapat menggunakan output di kedua channel dengan menggunakan pin yang " "sama" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "Tidak dapat membaca tanpa pin MISO." @@ -623,6 +643,10 @@ msgstr "" "Tidak dapat membuat variasi frekuensi pada penghitung waktu yang sudah " "digunakan" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "Tidak dapat menulis tanpa pin MOSI." @@ -1484,7 +1508,7 @@ msgstr "" "Hanya monokrom, 4bpp atau 8bpp yang diindeks, dan 16bpp atau lebih yang " "didukung: %d bpp diberikan" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1548,10 +1572,6 @@ msgstr "Pin harus mendukung interupsi perangkat keras" msgid "Pin number already reserved by EXTI" msgstr "Nomor pin sudah dipesan oleh EXTI" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1595,7 +1615,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -3881,6 +3901,13 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Kode selesai berjalan. Menunggu memuat ulang.\n" + #~ msgid "Frequency captured is above capability. Capture Paused." #~ msgstr "" #~ "Frekuensi yang ditangkap berada di atas kemampuan. Penangkapan Ditunda." diff --git a/locale/cs.po b/locale/cs.po index 7921c5a3bf2d6..7ceb85db72ce6 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-12-04 18:33+0000\n" "Last-Translator: vkuthan \n" "Language-Team: LANGUAGE \n" @@ -19,10 +19,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"Kód byl dokončen. Čekám na opětovné nahrání.\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -538,6 +542,18 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -570,6 +586,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "" @@ -613,6 +633,10 @@ msgstr "" msgid "Cannot vary frequency on a timer that is already in use" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "" @@ -1462,7 +1486,7 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1524,10 +1548,6 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1568,7 +1588,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -3839,6 +3859,13 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Kód byl dokončen. Čekám na opětovné nahrání.\n" + #~ msgid "" #~ "\n" #~ "To exit, please reset the board without " diff --git a/locale/de_DE.po b/locale/de_DE.po index 8f995b5e4357d..e481e52c1fe97 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-11-26 03:11+0000\n" "Last-Translator: Daniel Bravo Darriba \n" "Language: de_DE\n" @@ -18,10 +18,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"Der Code wurde ausgeführt. Warte auf reload.\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -541,6 +545,18 @@ msgstr "CBC-Blöcke müssen ein Vielfaches von 16 Bytes sein" msgid "Call super().__init__() before accessing native object." msgstr "Rufe super().__init__() vor dem Zugriff auf ein natives Objekt auf." +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "CCCD kann nicht auf lokales Merkmal eingestellt werden" @@ -574,6 +590,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "Kann nicht beite Kanäle auf dem gleichen Pin ausgeben" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "Kann ohne MISO-Pin nicht lesen." @@ -618,6 +638,10 @@ msgid "Cannot vary frequency on a timer that is already in use" msgstr "" "Die Frequenz eines bereits verwendeten Timers kann nicht variiert werden" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "Kann nicht ohne MOSI-Pin schreiben." @@ -1485,7 +1509,7 @@ msgstr "" "Nur monochrome, indizierte 4bpp oder 8bpp, und 16bpp oder größere BMPs " "unterstützt: %d bpp wurden gegeben" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1547,10 +1571,6 @@ msgstr "Pin muss Hardware-Interrupts unterstützen" msgid "Pin number already reserved by EXTI" msgstr "PIN-Nummer bereits von EXTI reserviert" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1594,7 +1614,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -3924,6 +3944,13 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Der Code wurde ausgeführt. Warte auf reload.\n" + #~ msgid "Frequency captured is above capability. Capture Paused." #~ msgstr "" #~ "Die aufgezeichnete Frequenz liegt über der Leistungsgrenze. Aufnahme " diff --git a/locale/el.po b/locale/el.po index 0352e4735b998..80aebe497c232 100644 --- a/locale/el.po +++ b/locale/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -19,7 +19,13 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" +msgstr "" + +#: main.c +msgid "" +"\n" +"Code stopped by auto-reload.\n" msgstr "" #: supervisor/shared/safe_mode.c @@ -533,6 +539,18 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -565,6 +583,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "" @@ -608,6 +630,10 @@ msgstr "" msgid "Cannot vary frequency on a timer that is already in use" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "" @@ -1457,7 +1483,7 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1519,10 +1545,6 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1563,7 +1585,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c diff --git a/locale/es.po b/locale/es.po index 987f61e206118..1e3e3be5b9719 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-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: Iván Montiel Cardona \n" "Language-Team: \n" @@ -21,10 +21,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"El código terminó su ejecución. Esperando para recargar.\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -547,6 +551,18 @@ msgstr "Los bloques CBC deben ser múltiplos de 16 bytes" msgid "Call super().__init__() before accessing native object." msgstr "Llame a super().__ init __() antes de acceder al objeto nativo." +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "No se puede configurar CCCD en la característica local" @@ -581,6 +597,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "No se puede tener ambos canales en el mismo pin" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "No se puede leer sin pin MISO." @@ -624,6 +644,10 @@ msgstr "No se puede obtener inequívocamente sizeof escalar" msgid "Cannot vary frequency on a timer that is already in use" msgstr "No puede variar la frecuencia en un temporizador que ya está en uso" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "No se puede escribir sin pin MOSI." @@ -1486,7 +1510,7 @@ msgstr "" "Solo se admiten BMP monocromáticos, indexados de 4 bpp u 8 bpp y 16 bpp o " "más: %d bpp proporcionados" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1550,10 +1574,6 @@ msgstr "El pin debe admitir interrupciones de hardware" msgid "Pin number already reserved by EXTI" msgstr "Número de pin ya reservado por EXTI" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1601,7 +1621,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -3913,6 +3933,13 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "El código terminó su ejecución. Esperando para recargar.\n" + #~ msgid "Frequency captured is above capability. Capture Paused." #~ msgstr "Frecuencia capturada por encima de la capacidad. Captura en pausa." diff --git a/locale/fil.po b/locale/fil.po index e808ff1dd275d..09dcfad660ece 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -18,7 +18,13 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" +msgstr "" + +#: main.c +msgid "" +"\n" +"Code stopped by auto-reload.\n" msgstr "" #: supervisor/shared/safe_mode.c @@ -539,6 +545,18 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -572,6 +590,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "Hindi maaaring output ang mga parehong channel sa parehong pin" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "Hindi maaring mabasa kapag walang MISO pin." @@ -615,6 +637,10 @@ msgstr "Hindi puedeng hindi sigurado ang get sizeof scalar" msgid "Cannot vary frequency on a timer that is already in use" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "Hindi maaring isulat kapag walang MOSI pin." @@ -1475,7 +1501,7 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1538,10 +1564,6 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1582,7 +1604,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c diff --git a/locale/fr.po b/locale/fr.po index 3c09a728640f2..0eac4c4b46671 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-12-08 19:21+0000\n" "Last-Translator: Antonin ENFRUN \n" "Language: fr\n" @@ -20,10 +20,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"Fin d'exécution du code. En attente de rechargement.\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -547,6 +551,18 @@ msgstr "Les blocs CBC doivent être des multiples de 16 octets" msgid "Call super().__init__() before accessing native object." msgstr "Appelez super () .__ init __ () avant d'accéder à l'objet natif." +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "Impossible de définir CCCD sur une caractéristique locale" @@ -582,6 +598,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "Les 2 canaux de sortie ne peuvent être sur la même broche" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "Impossible de lire sans broche MISO." @@ -627,6 +647,10 @@ msgid "Cannot vary frequency on a timer that is already in use" msgstr "" "Impossible de faire varier la fréquence sur une minuterie déjà utilisée" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "Impossible d'écrire sans broche MOSI." @@ -1491,7 +1515,7 @@ msgstr "" "Prise en charge uniquement des monochromes, 4 bpp ou 8 bpp indexés et 16 bpp " "ou plus : %d bpp fournis" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1557,10 +1581,6 @@ msgstr "La broche doit prendre en charge les interruptions matérielles" msgid "Pin number already reserved by EXTI" msgstr "Numéro de broche déjà réservé par EXTI" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "PinAlarm pas encore implémenté" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1608,7 +1628,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -3935,6 +3955,16 @@ msgstr "zi doit être de type float" msgid "zi must be of shape (n_section, 2)" msgstr "zi doit être de forme (n_section, 2)" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Fin d'exécution du code. En attente de rechargement.\n" + +#~ msgid "PinAlarm not yet implemented" +#~ msgstr "PinAlarm pas encore implémenté" + #~ msgid "Frequency captured is above capability. Capture Paused." #~ msgstr "La fréquence capturée est au delà des capacités. Capture en pause." diff --git a/locale/hi.po b/locale/hi.po index 1f868b09663e7..5a75cf401782d 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -19,7 +19,13 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" +msgstr "" + +#: main.c +msgid "" +"\n" +"Code stopped by auto-reload.\n" msgstr "" #: supervisor/shared/safe_mode.c @@ -533,6 +539,18 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -565,6 +583,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "" @@ -608,6 +630,10 @@ msgstr "" msgid "Cannot vary frequency on a timer that is already in use" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "" @@ -1457,7 +1483,7 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1519,10 +1545,6 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1563,7 +1585,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c diff --git a/locale/it_IT.po b/locale/it_IT.po index 289d308af7e14..fe742d588c494 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -18,7 +18,13 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" +msgstr "" + +#: main.c +msgid "" +"\n" +"Code stopped by auto-reload.\n" msgstr "" #: supervisor/shared/safe_mode.c @@ -539,6 +545,18 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -572,6 +590,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "Impossibile dare in output entrambi i canal sullo stesso pin" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "Impossibile leggere senza pin MISO." @@ -616,6 +638,10 @@ msgstr "Impossibile ricavare la grandezza scalare di sizeof inequivocabilmente" msgid "Cannot vary frequency on a timer that is already in use" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "Impossibile scrivere senza pin MOSI." @@ -1480,7 +1506,7 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1547,10 +1573,6 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1592,7 +1614,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c diff --git a/locale/ja.po b/locale/ja.po index e8028ac0592b9..dbab57219cd2b 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: sporeball \n" "Language-Team: none\n" @@ -21,10 +21,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"コードの実行が完了しました。リロードを待っています。\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -544,6 +548,18 @@ msgstr "" "ネイティブオブジェクトにアクセスする前にsuper().__init__()を呼び出してくださ" "い" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "ローカルのCharacteristicにはCCCDを設定できません" @@ -576,6 +592,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "同じピン上の両チャネルに出力できません" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "MISOピンなしで読み込めません" @@ -619,6 +639,10 @@ msgstr "スカラのサイズを曖昧さなしに取得できません" msgid "Cannot vary frequency on a timer that is already in use" msgstr "使用中のタイマー上では周波数を変えられません" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "MOSIピンなしで書き込みできません" @@ -1474,7 +1498,7 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1537,10 +1561,6 @@ msgstr "ピンはハードウェア割り込みに対応していなければな msgid "Pin number already reserved by EXTI" msgstr "ピン番号はすでにEXTIによって予約されています" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1581,7 +1601,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -3867,6 +3887,13 @@ msgstr "ziはfloat値でなければなりません" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "コードの実行が完了しました。リロードを待っています。\n" + #~ msgid "Frequency captured is above capability. Capture Paused." #~ msgstr "キャプチャした周波数は能力を超えています。キャプチャ停止" diff --git a/locale/ko.po b/locale/ko.po index 54c819770cb9c..e0006f000ed7e 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-10-05 12:12+0000\n" "Last-Translator: Michal Čihař \n" "Language-Team: LANGUAGE \n" @@ -20,10 +20,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"실행 완료 코드. 재장전 을 기다리는 중입니다\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -538,6 +542,18 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -570,6 +586,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "MISO핀이 없으면 읽을 수 없습니다" @@ -613,6 +633,10 @@ msgstr "" msgid "Cannot vary frequency on a timer that is already in use" msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "" @@ -1462,7 +1486,7 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1524,10 +1548,6 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1568,7 +1588,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -3840,6 +3860,13 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "실행 완료 코드. 재장전 을 기다리는 중입니다\n" + #~ msgid "%q indices must be integers, not %s" #~ msgstr "%q 인덱스는 %s 가 아닌 정수 여야합니다" diff --git a/locale/nl.po b/locale/nl.po index bd5fcaff6d8b6..57bd8cd0b366a 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-12-23 20:14+0000\n" "Last-Translator: _fonzlate \n" "Language-Team: none\n" @@ -19,10 +19,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"Code is uitgevoerd. Wachten op herladen.\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -540,6 +544,18 @@ msgstr "CBC blocks moeten meervouden van 16 bytes zijn" msgid "Call super().__init__() before accessing native object." msgstr "Roep super().__init__() aan voor toegang native object." +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "Kan CCCD niet toewijzen aan lokaal Characteristic" @@ -573,6 +589,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "Output van beide kanalen kan niet op dezelfde pin" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "Kan niet lezen zonder MISO pin." @@ -617,6 +637,10 @@ msgstr "Kan niet ondubbelzinning sizeof scalar verkrijgen" msgid "Cannot vary frequency on a timer that is already in use" msgstr "Kan de frequentie van een timer die al in gebruik is niet variëren" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "Kan niet schrijven zonder MOSI pin." @@ -1479,7 +1503,7 @@ msgstr "" "Alleen monochrome en 4bpp of 8bpp, en 16bpp of grotere geïndiceerde BMP's " "zijn ondersteund: %d bpp is gegeven" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "Slechts één alarm.time alarm kan worden ingesteld." @@ -1544,10 +1568,6 @@ msgstr "Pin moet hardware interrupts ondersteunen" msgid "Pin number already reserved by EXTI" msgstr "Pin nummer al gereserveerd door EXTI" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "PinAlarm nog niet geïmplementeerd" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1597,10 +1617,8 @@ msgstr "" "herstarten.\n" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" -"Simuleert diepe slaapstand tot alarm, een willekeurige toets of schrijven " -"naar bestand.\n" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -3902,6 +3920,21 @@ msgstr "zi moet van type float zijn" msgid "zi must be of shape (n_section, 2)" msgstr "zi moet vorm (n_section, 2) hebben" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Code is uitgevoerd. Wachten op herladen.\n" + +#~ msgid "PinAlarm not yet implemented" +#~ msgstr "PinAlarm nog niet geïmplementeerd" + +#~ msgid "Pretending to deep sleep until alarm, any key or file write.\n" +#~ msgstr "" +#~ "Simuleert diepe slaapstand tot alarm, een willekeurige toets of schrijven " +#~ "naar bestand.\n" + #~ msgid "Frequency captured is above capability. Capture Paused." #~ msgstr "" #~ "De vastgelegde frequentie is boven de capaciteit. Vastleggen gepauzeerd." diff --git a/locale/pl.po b/locale/pl.po index 07c2df2aaee7c..fe969af3d1f34 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-12-02 20:29+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" @@ -21,10 +21,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"Kod wykonany. Czekam na przeładowanie.\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -542,6 +546,18 @@ msgstr "Bloki CBC muszą być wielokrotnościami 16 bajtów" msgid "Call super().__init__() before accessing native object." msgstr "" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -574,6 +590,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "Nie można mieć obu kanałów na tej samej nóżce" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "Nie można czytać bez nóżki MISO." @@ -617,6 +637,10 @@ msgstr "Wielkość skalara jest niejednoznaczna" msgid "Cannot vary frequency on a timer that is already in use" msgstr "Nie można zmieniać częstotliwości timera, który jest już używany" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "Nie można pisać bez nóżki MOSI." @@ -1473,7 +1497,7 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1535,10 +1559,6 @@ msgstr "Pin musi obsługiwać przerwania sprzętowe" msgid "Pin number already reserved by EXTI" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1579,7 +1599,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -3859,6 +3879,13 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Kod wykonany. Czekam na przeładowanie.\n" + #~ msgid "Frequency captured is above capability. Capture Paused." #~ msgstr "Uzyskana częstotliwość jest niemożliwa. Spauzowano." diff --git a/locale/pt_BR.po b/locale/pt_BR.po index f66c88491c0b5..beb5401a5f064 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-12-22 18:07+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -19,10 +19,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"O código concluiu a execução. Esperando pela recarga.\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -548,6 +552,18 @@ msgstr "Os blocos CBC devem ter múltiplos de 16 bytes" msgid "Call super().__init__() before accessing native object." msgstr "Chame super().__init__() antes de acessar o objeto nativo." +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "Não é possível definir o CCCD com a característica local" @@ -582,6 +598,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "Não é possível emitir os dois canais no mesmo pino" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "Não é possível ler sem o pino MISO." @@ -626,6 +646,10 @@ msgstr "Não é possível obter inequivocamente o tamanho do escalar" msgid "Cannot vary frequency on a timer that is already in use" msgstr "Não é possível variar a frequência em um timer que já esteja em uso" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "Não é possível fazer a escrita sem um pino MOSI." @@ -1487,7 +1511,7 @@ msgstr "" "São compatíveis apenas os BMPs monocromáticos, indexados em 4bpp ou 8bpp e " "16bpp ou superior: determinado %d bpp" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "Apenas um alarme alarm.time pode ser definido." @@ -1553,10 +1577,6 @@ msgstr "O pino deve ser compatível com as interrupções do hardware" msgid "Pin number already reserved by EXTI" msgstr "Número do PIN já está reservado através da EXTI" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "PinAlarm ainda não foi implementado" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1607,10 +1627,8 @@ msgstr "" "Pressione qualquer tecla para entrar no REPL. Use CTRL-D para recarregar.\n" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" -"Simular o deep sleep até o alarme, até qualquer chave ou até a escrita do " -"arquivo.\n" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -3927,6 +3945,21 @@ msgstr "zi deve ser de um tipo float" msgid "zi must be of shape (n_section, 2)" msgstr "zi deve estar na forma (n_section, 2)" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "O código concluiu a execução. Esperando pela recarga.\n" + +#~ msgid "PinAlarm not yet implemented" +#~ msgstr "PinAlarm ainda não foi implementado" + +#~ msgid "Pretending to deep sleep until alarm, any key or file write.\n" +#~ msgstr "" +#~ "Simular o deep sleep até o alarme, até qualquer chave ou até a escrita do " +#~ "arquivo.\n" + #~ msgid "Frequency captured is above capability. Capture Paused." #~ msgstr "" #~ "A frequência capturada está acima da capacidade. A captura está em pausa." diff --git a/locale/sv.po b/locale/sv.po index 9c2d30d0683f9..0d17fc539ceec 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-12-28 17:59+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -19,10 +19,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"Koden har kört klart. Väntar på omladdning.\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -540,6 +544,18 @@ msgstr "CBC-block måste vara multiplar om 16 byte" msgid "Call super().__init__() before accessing native object." msgstr "Anropa super().__init__() innan du använder det ursprungliga objektet." +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "Kan inte ställa in CCCD på lokal karaktäristik" @@ -573,6 +589,10 @@ msgstr "" msgid "Cannot output both channels on the same pin" msgstr "Det går inte att mata ut båda kanalerna på samma pinne" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "Kan inte läsa utan MISO-pinne." @@ -617,6 +637,10 @@ msgstr "Kan inte entydigt få sizeof scalar" msgid "Cannot vary frequency on a timer that is already in use" msgstr "Det går inte att ändra frekvensen på en timer som redan används" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "Kan inte skriva utan MOSI-pinne." @@ -1478,7 +1502,7 @@ msgstr "" "Endast monokrom, indexerad 4 bpp eller 8 bpp och 16 bpp eller högre BMP: er " "stöds: %d bpp angiven" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "Endast ett alarm.time kan ställas in." @@ -1542,10 +1566,6 @@ msgstr "Pinnen måste stödja hårdvaruavbrott" msgid "Pin number already reserved by EXTI" msgstr "PInn-nummer redan reserverat av EXTI" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "PinAlarm är inte implementerat ännu" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1591,12 +1611,12 @@ msgstr "Prefixbufferten måste finnas på heap" #: main.c msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" -"Tryck på valfri tangent för att gå in i REPL. Använd CTRL-D för att ladda om." -"\n" +"Tryck på valfri tangent för att gå in i REPL. Använd CTRL-D för att ladda " +"om.\n" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" -msgstr "Fingerar djup sömn tills larm, valfri tangent eller filskrivning.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" +msgstr "" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -3895,6 +3915,19 @@ msgstr "zi måste vara av typ float" msgid "zi must be of shape (n_section, 2)" msgstr "zi måste vara i formen (n_section, 2)" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Koden har kört klart. Väntar på omladdning.\n" + +#~ msgid "PinAlarm not yet implemented" +#~ msgstr "PinAlarm är inte implementerat ännu" + +#~ msgid "Pretending to deep sleep until alarm, any key or file write.\n" +#~ msgstr "Fingerar djup sömn tills larm, valfri tangent eller filskrivning.\n" + #~ msgid "Frequency captured is above capability. Capture Paused." #~ msgstr "Infångningsfrekvens är för hög. Infångning pausad." diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 398d84a196aed..ff1d89a313576 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 16:41-0500\n" +"POT-Creation-Date: 2020-12-23 23:04-0500\n" "PO-Revision-Date: 2020-11-19 01:28+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -20,10 +20,14 @@ msgstr "" #: main.c msgid "" "\n" -"Code done running. Waiting for reload.\n" +"Code done running.\n" msgstr "" + +#: main.c +msgid "" "\n" -"Dàimǎ yǐ wánchéng yùnxíng. Zhèngzài děngdài chóngxīn jiāzài.\n" +"Code stopped by auto-reload.\n" +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -542,6 +546,18 @@ msgstr "CBC kuài bì xū shì 16 zì jié de bèi shù" msgid "Call super().__init__() before accessing native object." msgstr "Zài fǎngwèn běn jī wùjiàn zhīqián diàoyòng super().__init__()." +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on one low pin while others alarm high from deep sleep." +msgstr "" + +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on two low pins from deep sleep." +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "Wúfǎ jiāng CCCD shèzhì wéi běndì tèzhēng" @@ -574,6 +590,10 @@ msgstr "Nín wúfǎ sǎomiáo kuòzhǎn de, kě liánjiē de guǎnggào." msgid "Cannot output both channels on the same pin" msgstr "Wúfǎ shūchū tóng yīgè yǐn jiǎo shàng de liǎng gè píndào" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot pull on input-only pin." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." msgstr "Wúfǎ dòu qǔ méiyǒu MISO de yǐn jiǎo." @@ -617,6 +637,10 @@ msgstr "Wúfǎ míngquè de huòdé biāoliàng de dàxiǎo" msgid "Cannot vary frequency on a timer that is already in use" msgstr "Wúfǎ gēnggǎi yǐ zài shǐyòng de jìshí qì shàng de pínlǜ" +#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." msgstr "Wúfǎ xiě rù MOSI de yǐn jiǎo." @@ -1475,7 +1499,7 @@ msgstr "" "Jǐn zhīchí dān sè, suǒyǐn wéi 4bpp huò 8bpp yǐjí 16bpp huò gèng gāo de BMP: " "Gěi chū %d bpp" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1538,10 +1562,6 @@ msgstr "Yǐn jiǎo bìxū zhīchí yìngjiàn zhōngduàn" msgid "Pin number already reserved by EXTI" msgstr "Zhēn hào yǐ bèi EXTI bǎoliú" -#: ports/esp32s2/common-hal/alarm/__init__.c -msgid "PinAlarm not yet implemented" -msgstr "" - #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -1586,7 +1606,7 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" #: main.c -msgid "Pretending to deep sleep until alarm, any key or file write.\n" +msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -3883,6 +3903,13 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "" +#~ "\n" +#~ "Code done running. Waiting for reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Dàimǎ yǐ wánchéng yùnxíng. Zhèngzài děngdài chóngxīn jiāzài.\n" + #~ msgid "Frequency captured is above capability. Capture Paused." #~ msgstr "Pínlǜ bǔhuò gāo yú nénglì. Bǔhuò zàntíng." From 62eb65e4017a2a3240aaa803e8a0813b41b3feab Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Tue, 29 Dec 2020 13:19:40 +0000 Subject: [PATCH 510/770] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (889 of 889 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index beb5401a5f064..1d8819a699510 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-23 23:04-0500\n" -"PO-Revision-Date: 2020-12-22 18:07+0000\n" +"PO-Revision-Date: 2020-12-29 16:08+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -14,19 +14,23 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.4-dev\n" +"X-Generator: Weblate 4.4.1-dev\n" #: main.c msgid "" "\n" "Code done running.\n" msgstr "" +"\n" +"O código concluiu a sua execução.\n" #: main.c msgid "" "\n" "Code stopped by auto-reload.\n" msgstr "" +"\n" +"O código parou através do auto-reload.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -554,15 +558,18 @@ msgstr "Chame super().__init__() antes de acessar o objeto nativo." #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." -msgstr "" +msgstr "O alarme só pode acontecer no RTC IO a partir do deep sleep." #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on one low pin while others alarm high from deep sleep." msgstr "" +"O alarme só pode acontecer em um pino com nível baixo enquanto os outros " +"alarmes só com nível alto a partir do deep sleep." #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on two low pins from deep sleep." msgstr "" +"O alarme só é possível nos dois pinos com sinal baixo a partir do deep sleep." #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" @@ -582,7 +589,7 @@ msgstr "Não é possível excluir valores" #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" -msgstr "Não é possível obter pull enquanto está modo de saída" +msgstr "Não é possível obter (pull) enquanto estiver no modo saída" #: ports/nrf/common-hal/microcontroller/Processor.c msgid "Cannot get temperature" @@ -600,7 +607,7 @@ msgstr "Não é possível emitir os dois canais no mesmo pino" #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." -msgstr "" +msgstr "Não é possível obter (pull) nos pinos somente de entrada." #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." @@ -648,7 +655,7 @@ msgstr "Não é possível variar a frequência em um timer que já esteja em uso #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge. Only level." -msgstr "" +msgstr "Não é possível acordar (wake) no pino edge. Nível apenas." #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." @@ -1346,7 +1353,7 @@ msgstr "Nenhum DAC no chip" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "No DMA channel found" -msgstr "Nenhum canal DMA encontrado" +msgstr "Nenhum canal DMA foi encontrado" #: shared-module/adafruit_bus_device/I2CDevice.c #, c-format @@ -1629,6 +1636,8 @@ msgstr "" #: main.c msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" +"Tentando entrar no deep sleep até o alarme, pressione CTRL-C ou grave o " +"arquivo.\n" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -3107,7 +3116,7 @@ msgstr "o max_length deve ser 0-%d quando Fixed_length for %s" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c msgid "max_length must be >= 0" -msgstr "" +msgstr "max_length deve ser >= 0" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" @@ -3248,11 +3257,11 @@ msgstr "um arg não-palavra-chave após a palavra-chave arg" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" -msgstr "" +msgstr "o tempo limite não zero deve ser > 0.01" #: shared-bindings/_bleio/Adapter.c msgid "non-zero timeout must be >= interval" -msgstr "" +msgstr "o tempo limite não zero deve ser >= intervalo" #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" @@ -3684,7 +3693,7 @@ msgstr "o tempo limite deve ser entre 0.0 a 100.0 segundos" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "timeout must be < 655.35 secs" -msgstr "" +msgstr "o tempo limite deve ser < 655.35 seg" #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" From 8666083bd0cf86d8509b4ba20ae4e2340cf6ca1b Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Tue, 29 Dec 2020 18:57:50 +0000 Subject: [PATCH 511/770] Translated using Weblate (French) Currently translated at 100.0% (889 of 889 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 89 +++++++++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 39 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index 0eac4c4b46671..1098170d79d40 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,26 +8,30 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-23 23:04-0500\n" -"PO-Revision-Date: 2020-12-08 19:21+0000\n" -"Last-Translator: Antonin ENFRUN \n" +"PO-Revision-Date: 2020-12-29 19:50+0000\n" +"Last-Translator: Hugo Dahl \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.4-dev\n" +"X-Generator: Weblate 4.4.1-dev\n" #: main.c msgid "" "\n" "Code done running.\n" msgstr "" +"\n" +"Exécution du code complété.\n" #: main.c msgid "" "\n" "Code stopped by auto-reload.\n" msgstr "" +"\n" +"Exécution du code arrêté par l'auto-rechargement.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -553,15 +557,19 @@ msgstr "Appelez super () .__ init __ () avant d'accéder à l'objet natif." #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." -msgstr "" +msgstr "L'alarme peut seulement être depuis TRC IO depuis le someil profond." #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on one low pin while others alarm high from deep sleep." msgstr "" +"L'alarme peut seulement être sur une broche basse tandis que d'autres " +"alarment sont sur des broches hautes depuis le someil profond." #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on two low pins from deep sleep." msgstr "" +"L'alarme peut seulement être sur deux broches basses depuis le someil " +"profond." #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" @@ -600,7 +608,7 @@ msgstr "Les 2 canaux de sortie ne peuvent être sur la même broche" #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." -msgstr "" +msgstr "Ne peut tirer sur une broche d'entrée seule." #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." @@ -649,7 +657,7 @@ msgstr "" #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge. Only level." -msgstr "" +msgstr "Ne peut reveillé sur le board de broche. Seuleument à niveau." #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." @@ -894,7 +902,7 @@ msgstr "Attendu une adresse" #: shared-bindings/alarm/__init__.c msgid "Expected an alarm" -msgstr "" +msgstr "Une alarme était prévue" #: shared-module/_pixelbuf/PixelBuf.c #, c-format @@ -986,7 +994,7 @@ msgstr "Filtre trop complexe" #: ports/esp32s2/common-hal/dualbank/__init__.c msgid "Firmware image is invalid" -msgstr "" +msgstr "Image du microprogramme est invalide" #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" @@ -1045,7 +1053,7 @@ msgstr "I2SOut n'est pas disponible" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" -msgstr "" +msgstr "IOs 0, 2 & 4 ne supportent pas l'éleveuse interne en mode someil" #: shared-bindings/aesio/aes.c #, c-format @@ -1133,7 +1141,7 @@ msgstr "Fréquence de PWM invalide" #: ports/esp32s2/common-hal/analogio/AnalogIn.c msgid "Invalid Pin" -msgstr "" +msgstr "Broche invalide" #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" @@ -1517,7 +1525,7 @@ msgstr "" #: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." -msgstr "" +msgstr "Seulement une alarme alarm.time peut être réglée." #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" @@ -1626,10 +1634,13 @@ msgstr "Le tampon de préfixe doit être sur le tas" #: main.c msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" +"Appuyez sur n'importe quelle touche pour utiliser le REPL. Utilisez CTRL-D " +"pour relancer.\n" #: main.c msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" +"Feinte de someil profond jusqu'à l'alarme, Ctrl-C ou écriture au fichier.\n" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -1877,7 +1888,7 @@ msgstr "La largeur de la tuile doit diviser exactement la largeur de l'image" #: shared-bindings/alarm/time/TimeAlarm.c msgid "Time is in the past." -msgstr "" +msgstr "L'heure est dans le passé." #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format @@ -1996,7 +2007,7 @@ msgstr "Impossible d'écrire sur la mémoire non-volatile." #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." -msgstr "" +msgstr "Impossibilitée d'écriture à sleep_memory." #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" @@ -2067,7 +2078,7 @@ msgstr "Valeur de tirage 'pull' non supportée." #: ports/esp32s2/common-hal/dualbank/__init__.c msgid "Update Failed" -msgstr "" +msgstr "Mise-à-jour échouée" #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -2137,7 +2148,7 @@ msgstr "Le mot de passe WiFi doit faire entre 8 et 63 caractères" #: main.c msgid "Woken up by alarm.\n" -msgstr "" +msgstr "Réveil par alarme.\n" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" @@ -2462,7 +2473,7 @@ msgstr "" #: extmod/ulab/code/ndarray_operators.c msgid "cannot cast output with casting rule" -msgstr "" +msgstr "output ne peut être projeté sans règle de projection" #: py/objtype.c msgid "cannot create '%q' instances" @@ -2640,7 +2651,7 @@ msgstr "end_x doit être un entier 'int'" #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" -msgstr "" +msgstr "epoch_time n'est pas supporté sur ce panneau" #: ports/nrf/common-hal/busio/UART.c #, c-format @@ -2922,11 +2933,11 @@ msgstr "l'entrée doit être un tenseur de rang 2" #: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c msgid "input must be an ndarray" -msgstr "" +msgstr "l'entrée doit être un ndarray" #: extmod/ulab/code/filter/filter.c msgid "input must be one-dimensional" -msgstr "" +msgstr "l'entrée doit être uni-dimensionelle" #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" @@ -2942,7 +2953,7 @@ msgstr "les vecteurs d'entrée doivent être de longueur égale" #: extmod/ulab/code/poly/poly.c msgid "inputs are not iterable" -msgstr "" +msgstr "les entrées ne sont pas itérables" #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" @@ -3016,7 +3027,7 @@ msgstr "syntaxe invalide pour un nombre" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "io must be rtc io" -msgstr "" +msgstr "io doit être rtc io" #: py/objtype.c msgid "issubclass() arg 1 must be a class" @@ -3118,11 +3129,11 @@ msgstr "max_length doit être 0-%d lorsque fixed_length est %s" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c msgid "max_length must be >= 0" -msgstr "" +msgstr "max_length doit être >= 0" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" -msgstr "" +msgstr "nombre maximal de dimensions est 4" #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3258,15 +3269,15 @@ msgstr "argument non-nommé après argument nommé" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" -msgstr "" +msgstr "le délai non-zéro doit être > 0.01" #: shared-bindings/_bleio/Adapter.c msgid "non-zero timeout must be >= interval" -msgstr "" +msgstr "le délai non-zéro doit être >= interval" #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" -msgstr "" +msgstr "norm est défini pour des tableaux 1D et 2D" #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" @@ -3335,11 +3346,11 @@ msgstr "chaîne de longueur impaire" #: extmod/ulab/code/ulab_create.c msgid "offset is too large" -msgstr "" +msgstr "offset est trop large" #: shared-bindings/dualbank/__init__.c msgid "offset must be >= 0" -msgstr "" +msgstr "offset doit être >= 0" #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" @@ -3365,11 +3376,11 @@ msgstr "les opérandes ne pouvaient pas être diffusés ensemble" #: extmod/ulab/code/ndarray.c msgid "operation is implemented for 1D Boolean arrays only" -msgstr "" +msgstr "opération implémentée que pour des tableaux 1D booléennes" #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented for flattened array" -msgstr "" +msgstr "l'opération n'est pas implémentée pour un tableau applatit" #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" @@ -3510,7 +3521,7 @@ msgstr "la longueur requise est %d mais l'objet est long de %d" #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" -msgstr "" +msgstr "résultats ne peuvent être transformé au type spécifié" #: py/compile.c msgid "return annotation must be an identifier" @@ -3532,7 +3543,7 @@ msgstr "rgb_pins[%d] n'est pas sur le même port que l'horloge" #: extmod/ulab/code/numerical/numerical.c msgid "roll argument must be an ndarray" -msgstr "" +msgstr "paramêtre roll doit être un ndarray" #: py/objstr.c msgid "rsplit(None,n)" @@ -3560,7 +3571,7 @@ msgstr "compilation de script non supportée" #: extmod/ulab/code/ndarray.c msgid "shape must be a tuple" -msgstr "" +msgstr "forme doit être un tuple" #: py/objstr.c msgid "sign not allowed in string format specifier" @@ -3694,7 +3705,7 @@ msgstr "le délai doit être compris entre 0.0 et 100.0 secondes" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "timeout must be < 655.35 secs" -msgstr "" +msgstr "le délai (timeout) doit être < 655.35 secondes" #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" @@ -3714,7 +3725,7 @@ msgstr "'timestamp' hors bornes pour 'time_t' de la plateforme" #: extmod/ulab/code/ndarray.c msgid "tobytes can be invoked for dense arrays only" -msgstr "" +msgstr "tobytes ne peut être appelé que pour des tableaux dense" #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" @@ -3735,7 +3746,7 @@ msgstr "trapz n'est défini que pour des tableaux 1D de longueur égale" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "trigger level must be 0 or 1" -msgstr "" +msgstr "niveau du déclencheur doit être 0 ou 1" #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" @@ -3881,7 +3892,7 @@ msgstr "les vecteurs doivent avoir la même longueur" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "wakeup conflict" -msgstr "" +msgstr "conflit au réveil" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" @@ -3901,11 +3912,11 @@ msgstr "la fenêtre doit être <= intervalle" #: extmod/ulab/code/numerical/numerical.c msgid "wrong axis index" -msgstr "" +msgstr "index d'axe incorrecte" #: extmod/ulab/code/ulab_create.c msgid "wrong axis specified" -msgstr "" +msgstr "axe incorrecte spécifiée" #: extmod/ulab/code/vector/vectorise.c msgid "wrong input type" From d024df6b065c125f07c929371c94a48b058eff22 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 12 Nov 2020 14:04:50 -0600 Subject: [PATCH 512/770] esp32s2: Use better optimizer flags in debug builds (note that the before and after files both lack trailing newlines; this is how the esp-idf do) OPTIMIZATION_DEFAULT is -Og, which enables optimizations that do not interfere with the debugger: ``` elseif(CONFIG_COMPILER_OPTIMIZATION_DEFAULT) list(APPEND compile_options "-Og") ``` --- ports/esp32s2/esp-idf-config/sdkconfig-debug.defaults | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/esp-idf-config/sdkconfig-debug.defaults b/ports/esp32s2/esp-idf-config/sdkconfig-debug.defaults index f45f6ae9f1907..b108532aa2149 100644 --- a/ports/esp32s2/esp-idf-config/sdkconfig-debug.defaults +++ b/ports/esp32s2/esp-idf-config/sdkconfig-debug.defaults @@ -10,4 +10,7 @@ CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y # CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT is not set # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -# CONFIG_ESP_SYSTEM_PANIC_GDBSTUB is not set \ No newline at end of file +# CONFIG_ESP_SYSTEM_PANIC_GDBSTUB is not set +CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG=y +CONFIG_COMPILER_OPTIMIZATION_DEFAULT=y +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y \ No newline at end of file From 05ba1431c387db97dbd66c07d3494a4dae7fc570 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 20 Nov 2020 14:53:13 -0600 Subject: [PATCH 513/770] esp32s2: espidf: Add IDFError this is an exception class for "generic" IDF errors that don't have their own exception type. --- ports/esp32s2/bindings/espidf/__init__.c | 27 ++++++++++++++++++++---- ports/esp32s2/bindings/espidf/__init__.h | 1 + 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/ports/esp32s2/bindings/espidf/__init__.c b/ports/esp32s2/bindings/espidf/__init__.c index 554bfaa39ea6f..5d3950f04e239 100644 --- a/ports/esp32s2/bindings/espidf/__init__.c +++ b/ports/esp32s2/bindings/espidf/__init__.c @@ -65,12 +65,12 @@ STATIC mp_obj_t espidf_heap_caps_get_largest_free_block(void) { } MP_DEFINE_CONST_FUN_OBJ_0(espidf_heap_caps_get_largest_free_block_obj, espidf_heap_caps_get_largest_free_block); -//| class MemoryError(MemoryError): -//| """Raised when an ESP IDF memory allocation fails.""" +//| class IDFError(OSError): +//| """Raised for certain generic ESP IDF errors.""" //| ... //| -NORETURN void mp_raise_espidf_MemoryError(void) { - nlr_raise(mp_obj_new_exception(&mp_type_espidf_MemoryError)); +NORETURN void mp_raise_espidf_IDFError(void) { + nlr_raise(mp_obj_new_exception(&mp_type_espidf_IDFError)); } void espidf_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) { @@ -83,6 +83,24 @@ void espidf_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kin mp_obj_exception_print(print, o_in, kind); } +const mp_obj_type_t mp_type_espidf_IDFError = { + { &mp_type_type }, + .name = MP_QSTR_IDFError, + .print = espidf_exception_print, + .make_new = mp_obj_exception_make_new, + .attr = mp_obj_exception_attr, + .parent = &mp_type_OSError, +}; + + +//| class MemoryError(MemoryError): +//| """Raised when an ESP IDF memory allocation fails.""" +//| ... +//| +NORETURN void mp_raise_espidf_MemoryError(void) { + nlr_raise(mp_obj_new_exception(&mp_type_espidf_MemoryError)); +} + const mp_obj_type_t mp_type_espidf_MemoryError = { { &mp_type_type }, .name = MP_QSTR_MemoryError, @@ -99,6 +117,7 @@ STATIC const mp_rom_map_elem_t espidf_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_heap_caps_get_free_size), MP_ROM_PTR(&espidf_heap_caps_get_free_size_obj)}, { MP_ROM_QSTR(MP_QSTR_heap_caps_get_largest_free_block), MP_ROM_PTR(&espidf_heap_caps_get_largest_free_block_obj)}, + { MP_ROM_QSTR(MP_QSTR_IDFError), MP_ROM_PTR(&mp_type_espidf_IDFError) }, { MP_ROM_QSTR(MP_QSTR_MemoryError), MP_ROM_PTR(&mp_type_espidf_MemoryError) }, }; diff --git a/ports/esp32s2/bindings/espidf/__init__.h b/ports/esp32s2/bindings/espidf/__init__.h index 356c1c8140e5a..e35ec24b813ec 100644 --- a/ports/esp32s2/bindings/espidf/__init__.h +++ b/ports/esp32s2/bindings/espidf/__init__.h @@ -27,6 +27,7 @@ #ifndef MICROPY_INCLUDED_ESP32S2_BINDINGS_ESPIDF___INIT___H #define MICROPY_INCLUDED_ESP32S2_BINDINGS_ESPIDF___INIT___H +extern const mp_obj_type_t mp_type_espidf_IDFError; extern const mp_obj_type_t mp_type_espidf_MemoryError; NORETURN void mp_raise_espidf_MemoryError(void); From b40a579d180103d9f8a67390495d02e47554e7d7 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 30 Oct 2020 10:05:16 -0500 Subject: [PATCH 514/770] esp32s2: espidf: Consistent error checking of esp-idf calls By surrounding most ESP-IDF API calls with this new macro, their failure will result in a CircuitPython exception. --- ports/esp32s2/bindings/espidf/__init__.c | 61 ++++++++++++++++ ports/esp32s2/bindings/espidf/__init__.h | 7 ++ ports/esp32s2/esp_error.c | 91 ++++++++++++++++++++++++ 3 files changed, 159 insertions(+) create mode 100644 ports/esp32s2/esp_error.c diff --git a/ports/esp32s2/bindings/espidf/__init__.c b/ports/esp32s2/bindings/espidf/__init__.c index 5d3950f04e239..708c30c391b58 100644 --- a/ports/esp32s2/bindings/espidf/__init__.c +++ b/ports/esp32s2/bindings/espidf/__init__.c @@ -127,3 +127,64 @@ const mp_obj_module_t espidf_module = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t*)&espidf_module_globals, }; + +void raise_esp_error(esp_err_t err) { + const compressed_string_t *msg = NULL; + const mp_obj_type_t * exception_type = &mp_type_espidf_IDFError; + switch(err) { + case ESP_FAIL: + msg = translate("Generic Failure"); + break; + case ESP_ERR_NO_MEM: + exception_type = &mp_type_espidf_MemoryError; + msg = translate("Out of memory"); + break; + case ESP_ERR_INVALID_ARG: + msg = translate("Invalid argument"); + break; + case ESP_ERR_INVALID_STATE: + msg = translate("Invalid state"); + break; + case ESP_ERR_INVALID_SIZE: + msg = translate("Invalid size"); + break; + case ESP_ERR_NOT_FOUND: + msg = translate("Requested resource not found"); + break; + case ESP_ERR_NOT_SUPPORTED: + msg = translate("Operation or feature not supported"); + break; + case ESP_ERR_TIMEOUT: + msg = translate("Operation timed out"); + break; + case ESP_ERR_INVALID_RESPONSE: + msg = translate("Received response was invalid"); + break; + case ESP_ERR_INVALID_CRC: + msg = translate("CRC or checksum was invalid"); + break; + case ESP_ERR_INVALID_VERSION: + msg = translate("Version was invalid"); + break; + case ESP_ERR_INVALID_MAC: + msg = translate("MAC address was invalid"); + break; + } + if (msg) { + mp_raise_msg(exception_type, msg); + } + + const char *group = "ESP-IDF"; + + // tests must be in descending order + MP_STATIC_ASSERT( ESP_ERR_FLASH_BASE > ESP_ERR_MESH_BASE ); + MP_STATIC_ASSERT( ESP_ERR_MESH_BASE > ESP_ERR_WIFI_BASE ); + if(err >= ESP_ERR_FLASH_BASE) { + group = "Flash"; + } else if (err >= ESP_ERR_MESH_BASE) { + group = "Mesh"; + } else if (err >= ESP_ERR_WIFI_BASE) { + group = "WiFi"; + } + mp_raise_msg_varg(exception_type, translate("%s error 0x%x"), group, err); +} diff --git a/ports/esp32s2/bindings/espidf/__init__.h b/ports/esp32s2/bindings/espidf/__init__.h index e35ec24b813ec..5ff49970d3935 100644 --- a/ports/esp32s2/bindings/espidf/__init__.h +++ b/ports/esp32s2/bindings/espidf/__init__.h @@ -27,9 +27,16 @@ #ifndef MICROPY_INCLUDED_ESP32S2_BINDINGS_ESPIDF___INIT___H #define MICROPY_INCLUDED_ESP32S2_BINDINGS_ESPIDF___INIT___H +#include "esp_err.h" +#include "py/mpconfig.h" +#include "py/obj.h" + extern const mp_obj_type_t mp_type_espidf_IDFError; extern const mp_obj_type_t mp_type_espidf_MemoryError; NORETURN void mp_raise_espidf_MemoryError(void); +void raise_esp_error(esp_err_t err) NORETURN; +#define ESP_CALL_RAISE(x) do { int res = (x); if(res != ESP_OK) raise_esp_error(res); } while(0) + #endif // MICROPY_INCLUDED_ESP32S2_BINDINGS_ESPIDF___INIT___H diff --git a/ports/esp32s2/esp_error.c b/ports/esp32s2/esp_error.c new file mode 100644 index 0000000000000..57bc51528d5e4 --- /dev/null +++ b/ports/esp32s2/esp_error.c @@ -0,0 +1,91 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler 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 "esp_error.h" +#include "py/runtime.h" + +#include "bindings/espidf/__init__.h" + +void raise_esp_error(esp_err_t err) { + const compressed_string_t *msg = NULL; + const mp_obj_type_t * exception_type = &mp_type_espidf_IDFError; + switch(err) { + case ESP_FAIL: + msg = translate("Generic Failure"); + break; + case ESP_ERR_NO_MEM: + exception_type = &mp_type_espidf_MemoryError; + msg = translate("Out of memory"); + break; + case ESP_ERR_INVALID_ARG: + msg = translate("Invalid argument"); + break; + case ESP_ERR_INVALID_STATE: + msg = translate("Invalid state"); + break; + case ESP_ERR_INVALID_SIZE: + msg = translate("Invalid size"); + break; + case ESP_ERR_NOT_FOUND: + msg = translate("Requested resource not found"); + break; + case ESP_ERR_NOT_SUPPORTED: + msg = translate("Operation or feature not supported"); + break; + case ESP_ERR_TIMEOUT: + msg = translate("Operation timed out"); + break; + case ESP_ERR_INVALID_RESPONSE: + msg = translate("Received response was invalid"); + break; + case ESP_ERR_INVALID_CRC: + msg = translate("CRC or checksum was invalid"); + break; + case ESP_ERR_INVALID_VERSION: + msg = translate("Version was invalid"); + break; + case ESP_ERR_INVALID_MAC: + msg = translate("MAC address was invalid"); + break; + } + if (msg) { + mp_raise_msg(exception_type, msg); + } + + const char *group = "ESP-IDF"; + + // tests must be in descending order + MP_STATIC_ASSERT( ESP_ERR_FLASH_BASE > ESP_ERR_MESH_BASE ); + MP_STATIC_ASSERT( ESP_ERR_MESH_BASE > ESP_ERR_WIFI_BASE ); + if(err >= ESP_ERR_FLASH_BASE) { + group = "Flash"; + } else if (err >= ESP_ERR_MESH_BASE) { + group = "Mesh"; + } else if (err >= ESP_ERR_WIFI_BASE) { + group = "WiFi"; + } + mp_raise_msg_varg(exception_type, translate("%s error 0x%x"), group, err); +} From 537a4daabd79407a8c2c5cd4adead6019406d992 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 28 Oct 2020 10:20:36 -0500 Subject: [PATCH 515/770] mark script as executable --- tools/analyze_mpy.py | 1 + 1 file changed, 1 insertion(+) mode change 100644 => 100755 tools/analyze_mpy.py diff --git a/tools/analyze_mpy.py b/tools/analyze_mpy.py old mode 100644 new mode 100755 index a2f541d0f441a..99c06f62ad631 --- a/tools/analyze_mpy.py +++ b/tools/analyze_mpy.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # # SPDX-License-Identifier: MIT From 2cd377f1a7a91a46d154f4da9dbf50a747da9b41 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 28 Oct 2020 13:27:48 -0500 Subject: [PATCH 516/770] audiobusio: Make PDMIn optional --- py/circuitpy_mpconfig.mk | 4 ++++ shared-bindings/audiobusio/PDMIn.c | 8 ++++++++ shared-bindings/audiobusio/PDMIn.h | 2 ++ 3 files changed, 14 insertions(+) diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index e588c41e0d178..9a07f62a34d61 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -55,6 +55,10 @@ CFLAGS += -DCIRCUITPY_AUDIOBUSIO=$(CIRCUITPY_AUDIOBUSIO) CIRCUITPY_AUDIOBUSIO_I2SOUT ?= $(CIRCUITPY_AUDIOBUSIO) CFLAGS += -DCIRCUITPY_AUDIOBUSIO_I2SOUT=$(CIRCUITPY_AUDIOBUSIO_I2SOUT) +# Likewise, some boards have I2SOut but do not implement PDMIn. +CIRCUITPY_AUDIOBUSIO_PDMIN ?= $(CIRCUITPY_AUDIOBUSIO) +CFLAGS += -DCIRCUITPY_AUDIOBUSIO_PDMIN=$(CIRCUITPY_AUDIOBUSIO_PDMIN) + CIRCUITPY_AUDIOIO ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_AUDIOIO=$(CIRCUITPY_AUDIOIO) diff --git a/shared-bindings/audiobusio/PDMIn.c b/shared-bindings/audiobusio/PDMIn.c index 6c5fa79394f9b..a3cc8b07e9373 100644 --- a/shared-bindings/audiobusio/PDMIn.c +++ b/shared-bindings/audiobusio/PDMIn.c @@ -84,6 +84,9 @@ //| ... //| STATIC mp_obj_t audiobusio_pdmin_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +#if !CIRCUITPY_AUDIOBUSIO_PDMIN + mp_raise_NotImplementedError(translate("PDMIn not available")); +#else enum { ARG_clock_pin, ARG_data_pin, ARG_sample_rate, ARG_bit_depth, ARG_mono, ARG_oversample, ARG_startup_delay }; static const mp_arg_t allowed_args[] = { { MP_QSTR_clock_pin, MP_ARG_REQUIRED | MP_ARG_OBJ }, @@ -132,8 +135,10 @@ STATIC mp_obj_t audiobusio_pdmin_make_new(const mp_obj_type_t *type, size_t n_ar mp_hal_delay_ms(startup_delay * 1000); return MP_OBJ_FROM_PTR(self); +#endif } +#if CIRCUITPY_AUDIOBUSIO_PDMIN //| def deinit(self) -> None: //| """Deinitialises the PDMIn and releases any hardware resources for reuse.""" //| ... @@ -237,10 +242,13 @@ STATIC const mp_rom_map_elem_t audiobusio_pdmin_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_sample_rate), MP_ROM_PTR(&audiobusio_pdmin_sample_rate_obj) } }; STATIC MP_DEFINE_CONST_DICT(audiobusio_pdmin_locals_dict, audiobusio_pdmin_locals_dict_table); +#endif const mp_obj_type_t audiobusio_pdmin_type = { { &mp_type_type }, .name = MP_QSTR_PDMIn, .make_new = audiobusio_pdmin_make_new, +#if CIRCUITPY_AUDIOBUSIO_PDMIN .locals_dict = (mp_obj_dict_t*)&audiobusio_pdmin_locals_dict, +#endif }; diff --git a/shared-bindings/audiobusio/PDMIn.h b/shared-bindings/audiobusio/PDMIn.h index c2a8bab2f8e83..e89fc7e232275 100644 --- a/shared-bindings/audiobusio/PDMIn.h +++ b/shared-bindings/audiobusio/PDMIn.h @@ -33,6 +33,7 @@ extern const mp_obj_type_t audiobusio_pdmin_type; +#if CIRCUITPY_AUDIOBUSIO_PDMIN void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self, const mcu_pin_obj_t* clock_pin, const mcu_pin_obj_t* data_pin, uint32_t sample_rate, uint8_t bit_depth, bool mono, uint8_t oversample); @@ -43,5 +44,6 @@ uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* se uint8_t common_hal_audiobusio_pdmin_get_bit_depth(audiobusio_pdmin_obj_t* self); uint32_t common_hal_audiobusio_pdmin_get_sample_rate(audiobusio_pdmin_obj_t* self); // TODO(tannewt): Add record to file +#endif #endif // MICROPY_INCLUDED_SHARED_BINDINGS_AUDIOBUSIO_AUDIOOUT_H From ffbe37b056ab87f32853ddd6009dea75db297df9 Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Tue, 29 Dec 2020 20:35:58 +0000 Subject: [PATCH 517/770] Translated using Weblate (French) Currently translated at 100.0% (889 of 889 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index 1098170d79d40..b88bf3b8b9255 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-23 23:04-0500\n" -"PO-Revision-Date: 2020-12-29 19:50+0000\n" +"PO-Revision-Date: 2020-12-29 20:38+0000\n" "Last-Translator: Hugo Dahl \n" "Language: fr\n" "MIME-Version: 1.0\n" @@ -59,7 +59,7 @@ msgstr " sortie :\n" #: py/objstr.c #, c-format msgid "%%c requires int or char" -msgstr "%%c nécessite un entier 'int' ou un caractère 'char'" +msgstr "%%c nécessite un chiffre entier 'int' ou un caractère 'char'" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format @@ -74,7 +74,7 @@ msgstr "Échec de %q : %d" #: shared-bindings/microcontroller/Pin.c msgid "%q in use" -msgstr "%q utilisé" +msgstr "%q en cours d'utilisation" #: extmod/moductypes.c ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c @@ -114,19 +114,19 @@ msgstr "%q est hors de porté" #: ports/atmel-samd/common-hal/microcontroller/Pin.c msgid "%q pin invalid" -msgstr "PIN %q invalide" +msgstr "broche %q invalide" #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" -msgstr "%q doit être un entier (int)" +msgstr "%q doit être un chiffre entier (int)" #: py/bc.c py/objnamedtuple.c msgid "%q() takes %d positional arguments but %d were given" -msgstr "%q() prend %d arguments positionnels mais %d ont été donnés" +msgstr "%q() prend %d paramêtres positionnels mais %d ont été donnés" #: py/argcheck.c msgid "'%q' argument required" -msgstr "'%q' argument requis" +msgstr "paramêtre '%q' requis" #: py/runtime.c msgid "'%q' object cannot assign attribute '%q'" @@ -197,7 +197,7 @@ msgstr "'%s' attend un entier" #: py/emitinlinethumb.c #, c-format msgid "'%s' expects at most r%d" -msgstr "'%s' s'attend au plus à r%d" +msgstr "'%s' attend au plus à r%d" #: py/emitinlinethumb.c #, c-format @@ -437,8 +437,8 @@ msgid "" "Auto-reload is on. Simply save files over USB to run them or enter REPL to " "disable.\n" msgstr "" -"Auto-chargement activé. Copiez simplement les fichiers en USB pour les " -"lancer ou entrez sur REPL pour le désactiver.\n" +"Auto-chargement activé. Copiez ou sauvegardez les fichiers via USB pour les " +"lancer ou démarrez le REPL pour le désactiver.\n" #: ports/esp32s2/common-hal/canio/CAN.c msgid "Baudrate not supported by peripheral" @@ -1602,7 +1602,7 @@ msgstr "" #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" -msgstr "Ainsi que tout autre module présent sur le système de fichiers\n" +msgstr "Ainsi que tout autres modules présents sur le système de fichiers\n" #: shared-module/vectorio/Polygon.c msgid "Polygon needs at least 3 points" From a7542598a0ce1fbd7722312dd863b1d40b0c2837 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 30 Oct 2020 10:05:16 -0500 Subject: [PATCH 518/770] esp32s2: add I2SOut --- ports/esp32s2/Makefile | 1 + ports/esp32s2/common-hal/audiobusio/I2SOut.c | 126 ++++++++++ ports/esp32s2/common-hal/audiobusio/I2SOut.h | 45 ++++ ports/esp32s2/common-hal/audiobusio/PDMIn.c | 0 ports/esp32s2/common-hal/audiobusio/PDMIn.h | 0 .../esp32s2/common-hal/audiobusio/__init__.c | 0 .../esp32s2/common-hal/audiobusio/__init__.h | 0 ports/esp32s2/i2s_common.c | 231 ++++++++++++++++++ ports/esp32s2/i2s_common.h | 61 +++++ ports/esp32s2/mpconfigport.mk | 6 +- ports/esp32s2/supervisor/port.c | 8 + shared-module/audiocore/__init__.c | 60 +++++ shared-module/audiocore/__init__.h | 8 + 13 files changed, 545 insertions(+), 1 deletion(-) create mode 100644 ports/esp32s2/common-hal/audiobusio/I2SOut.c create mode 100644 ports/esp32s2/common-hal/audiobusio/I2SOut.h create mode 100644 ports/esp32s2/common-hal/audiobusio/PDMIn.c create mode 100644 ports/esp32s2/common-hal/audiobusio/PDMIn.h create mode 100644 ports/esp32s2/common-hal/audiobusio/__init__.c create mode 100644 ports/esp32s2/common-hal/audiobusio/__init__.h create mode 100644 ports/esp32s2/i2s_common.c create mode 100644 ports/esp32s2/i2s_common.h diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index e08b8a7928bb6..c1e20d17a2010 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -175,6 +175,7 @@ CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_ESP32S2 -DCFG_TUSB_OS=OPT_OS_FREERTOS -DCFG_TUD SRC_C += \ background.c \ fatfs_port.c \ + i2s_common.c \ mphalport.c \ bindings/espidf/__init__.c \ boards/$(BOARD)/board.c \ diff --git a/ports/esp32s2/common-hal/audiobusio/I2SOut.c b/ports/esp32s2/common-hal/audiobusio/I2SOut.c new file mode 100644 index 0000000000000..be5b04fa95797 --- /dev/null +++ b/ports/esp32s2/common-hal/audiobusio/I2SOut.c @@ -0,0 +1,126 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler 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 +#include + +#include "mpconfigport.h" + +#include "bindings/espidf/__init__.h" + +// Some boards don't implement I2SOut, so suppress any routines from here. +#if CIRCUITPY_AUDIOBUSIO_I2SOUT + +#include "extmod/vfs_fat.h" +#include "py/gc.h" +#include "py/mperrno.h" +#include "py/runtime.h" +#include "common-hal/audiobusio/I2SOut.h" +#include "shared-bindings/audiobusio/I2SOut.h" +#include "shared-bindings/audiocore/RawSample.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "supervisor/shared/translate.h" + +#include "driver/i2s.h" + +// Caller validates that pins are free. +void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t* self, + const mcu_pin_obj_t* bit_clock, const mcu_pin_obj_t* word_select, + const mcu_pin_obj_t* data, bool left_justified) { + + port_i2s_allocate_init(&self->peripheral, left_justified); + + i2s_pin_config_t i2s_pin_config = { + .bck_io_num = bit_clock->number, + .ws_io_num = word_select->number, + .data_out_num = data->number, + .data_in_num = I2S_PIN_NO_CHANGE, + }; + ESP_CALL_RAISE(i2s_set_pin(self->peripheral.instance, &i2s_pin_config)); + self->bit_clock = bit_clock; + self->word_select = word_select; + self->data = data; +} + +bool common_hal_audiobusio_i2sout_deinited(audiobusio_i2sout_obj_t* self) { + return self->peripheral.instance == -1; +} + +void common_hal_audiobusio_i2sout_deinit(audiobusio_i2sout_obj_t* self) { + if (common_hal_audiobusio_i2sout_deinited(self)) { + return; + } + + if (self->bit_clock) { + reset_pin_number(self->bit_clock->number); + } + self->bit_clock = NULL; + + if (self->word_select) { + reset_pin_number(self->word_select->number); + } + self->word_select = NULL; + + if (self->data) { + reset_pin_number(self->data->number); + } + self->data = NULL; + + if (self->peripheral.instance >= 0) { + port_i2s_reset_instance(self->peripheral.instance); + } + self->peripheral.instance = -1; +} + +void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t* self, + mp_obj_t sample, bool loop) { + if (common_hal_audiobusio_i2sout_get_playing(self)) { + common_hal_audiobusio_i2sout_stop(self); + } + port_i2s_play(&self->peripheral, sample, loop); +} + +void common_hal_audiobusio_i2sout_pause(audiobusio_i2sout_obj_t* self) { + port_i2s_pause(&self->peripheral); +} + +void common_hal_audiobusio_i2sout_resume(audiobusio_i2sout_obj_t* self) { + port_i2s_resume(&self->peripheral); +} + +bool common_hal_audiobusio_i2sout_get_paused(audiobusio_i2sout_obj_t* self) { + return port_i2s_paused(&self->peripheral); +} + +void common_hal_audiobusio_i2sout_stop(audiobusio_i2sout_obj_t* self) { + port_i2s_stop(&self->peripheral); +} + +bool common_hal_audiobusio_i2sout_get_playing(audiobusio_i2sout_obj_t* self) { + return port_i2s_playing(&self->peripheral); +} + +#endif // CIRCUITPY_AUDIOBUSIO_I2SOUT diff --git a/ports/esp32s2/common-hal/audiobusio/I2SOut.h b/ports/esp32s2/common-hal/audiobusio/I2SOut.h new file mode 100644 index 0000000000000..90266342cb33a --- /dev/null +++ b/ports/esp32s2/common-hal/audiobusio/I2SOut.h @@ -0,0 +1,45 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler 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. + */ + +#pragma once + +#include "supervisor/background_callback.h" +#include "common-hal/microcontroller/Pin.h" + +#include "i2s_common.h" + +// Some boards don't implement I2SOut, so suppress any routines from here. +#if CIRCUITPY_AUDIOBUSIO_I2SOUT + +typedef struct { + mp_obj_base_t base; + i2s_t peripheral; + const mcu_pin_obj_t *bit_clock; + const mcu_pin_obj_t *word_select; + const mcu_pin_obj_t *data; +} audiobusio_i2sout_obj_t; + +#endif diff --git a/ports/esp32s2/common-hal/audiobusio/PDMIn.c b/ports/esp32s2/common-hal/audiobusio/PDMIn.c new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/ports/esp32s2/common-hal/audiobusio/PDMIn.h b/ports/esp32s2/common-hal/audiobusio/PDMIn.h new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/ports/esp32s2/common-hal/audiobusio/__init__.c b/ports/esp32s2/common-hal/audiobusio/__init__.c new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/ports/esp32s2/common-hal/audiobusio/__init__.h b/ports/esp32s2/common-hal/audiobusio/__init__.h new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/ports/esp32s2/i2s_common.c b/ports/esp32s2/i2s_common.c new file mode 100644 index 0000000000000..1933665a33f3d --- /dev/null +++ b/ports/esp32s2/i2s_common.c @@ -0,0 +1,231 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler 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 "py/runtime.h" + +#include "i2s_common.h" +#include "bindings/espidf/__init__.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +#include "shared-module/audiocore/__init__.h" + +#define I2S_QUEUE_SIZE (3) + +static i2s_t *i2s_instance[I2S_NUM_MAX]; +static QueueHandle_t i2s_queues[I2S_NUM_MAX]; +static TaskHandle_t i2s_tasks[I2S_NUM_MAX]; + +static int8_t port_i2s_allocate(void) { +#if defined(I2S_NUM_1) + if(!i2s_instance[1]) return 1; +#endif + if(!i2s_instance[0]) return 0; + + mp_raise_RuntimeError(translate("Peripheral in use")); +} + +void port_i2s_reset_instance(int i) { + assert(i >= 0 && i < I2S_NUM_MAX); + if (i2s_tasks[i]) { + vTaskDelete(i2s_tasks[i]); + } + i2s_tasks[i] = NULL; + + (void)i2s_driver_uninstall(i); + i2s_instance[i] = NULL; +} + +void i2s_reset(void) { + for (int i=0; i < I2S_NUM_MAX; i++) { + port_i2s_reset_instance(i); + } +} + +static void i2s_fill_buffer(i2s_t *self) { + if (self->instance < 0 || self->instance >= I2S_NUM_MAX) { + return; + } + if (self->paused || !self->sample) { + i2s_zero_dma_buffer(self->instance); + return; + } + while (!self->stopping) { + if (self->sample_data == self->sample_end) { + uint32_t sample_buffer_length; + audioio_get_buffer_result_t get_buffer_result = + audiosample_get_buffer(self->sample, false, 0, + &self->sample_data, &sample_buffer_length); + self->sample_end = self->sample_data + sample_buffer_length; + if (get_buffer_result == GET_BUFFER_DONE) { + if (self->loop) { + audiosample_reset_buffer(self->sample, false, 0); + } else { + self->stopping = true; + break; + } + } + if (get_buffer_result == GET_BUFFER_ERROR || sample_buffer_length == 0) { + self->stopping = true; + break; + } + } + size_t bytes_written = 0; + size_t bytecount = self->sample_end - self->sample_data; + if (self->samples_signed && self->channel_count == 2) { + if (self->bytes_per_sample == 2) { + ESP_CALL_RAISE(i2s_write(self->instance, self->sample_data, bytecount, &bytes_written, 0)); + } else { + ESP_CALL_RAISE(i2s_write_expand(self->instance, self->sample_data, bytecount, 8, 16, &bytes_written, 0)); + } + } else { +#define STACK_BUFFER_SIZE (64) + size_t bytes_per_frame = self->channel_count * self->bytes_per_sample; + size_t framecount = MIN(STACK_BUFFER_SIZE / bytes_per_frame, bytecount); + int16_t signed_samples[STACK_BUFFER_SIZE / sizeof(int16_t)]; + if (self->samples_signed) { + assert(self->channel_count == 1); + if (self->bytes_per_sample == 1) { + audiosample_convert_s8m_s16s(signed_samples, (int8_t*)(void*)self->sample_data, framecount); + } else { + audiosample_convert_s16m_s16s(signed_samples, (int16_t*)(void*)self->sample_data, framecount); + } + } else { + if (self->channel_count == 1) { + if (self->bytes_per_sample == 1) { + audiosample_convert_u8m_s16s(signed_samples, (uint8_t*)(void*)self->sample_data, framecount); + } else { + audiosample_convert_u16m_s16s(signed_samples, (uint16_t*)(void*)self->sample_data, framecount); + } + } else { + if (self->bytes_per_sample == 1) { + audiosample_convert_u8s_s16s(signed_samples, (uint8_t*)(void*)self->sample_data, framecount); + } else { + audiosample_convert_u16s_s16s(signed_samples, (uint16_t*)(void*)self->sample_data, framecount); + } + } + } + size_t expanded_bytes_written = 0; + ESP_CALL_RAISE(i2s_write(self->instance, signed_samples, 4*framecount, &expanded_bytes_written, 0)); + assert(expanded_bytes_written % 4 == 0); + bytes_written = expanded_bytes_written / 4 * bytes_per_frame; + } + self->sample_data += bytes_written; + // We have filled the DMA buffer + if (!bytes_written) { + break; + } + } +} + +static void i2s_callback_fun(void *self_in) { + i2s_t *self = self_in; + i2s_fill_buffer(self); +} + +static void i2s_event_task(void *self_in) { + i2s_t *self = self_in; + while(true) { + i2s_event_type_t event; + BaseType_t result = xQueueReceive(i2s_queues[self->instance], &event, portMAX_DELAY); + if (result && event == I2S_EVENT_TX_DONE) { + background_callback_add(&self->callback, i2s_callback_fun, self_in); + } + } +} + +void port_i2s_allocate_init(i2s_t *self, bool left_justified) { + self->instance = port_i2s_allocate(); + + i2s_config_t i2s_config = { + .mode = I2S_MODE_MASTER | I2S_MODE_TX, + .sample_rate = 44100, + .bits_per_sample = 16, + .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT, + .communication_format = left_justified ? I2S_COMM_FORMAT_STAND_I2S : I2S_COMM_FORMAT_STAND_I2S, + .dma_buf_count = 2, + .dma_buf_len = 128, // in _frames_, so 128 is 512 bytes per dma buf + .use_apll = false, + }; + ESP_CALL_RAISE(i2s_driver_install(self->instance, &i2s_config, I2S_QUEUE_SIZE, &i2s_queues[self->instance])); + + if (!xTaskCreate(i2s_event_task, "I2S_task", 3 * configMINIMAL_STACK_SIZE, self, CONFIG_PTHREAD_TASK_PRIO_DEFAULT, &i2s_tasks[self->instance])) { + mp_raise_OSError_msg(translate("xTaskCreate failed")); + } + i2s_instance[self->instance] = self; + +} + + +void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop) { + self->sample = sample; + self->bytes_per_sample = audiosample_bits_per_sample(sample) / 8; + self->channel_count = audiosample_channel_count(sample); + bool single_buffer; + bool samples_signed; + uint32_t max_buffer_length; + uint8_t spacing; + audiosample_get_buffer_structure(sample, false, &single_buffer, &samples_signed, + &max_buffer_length, &spacing); + self->samples_signed = samples_signed; + self->loop = loop; + self->playing = true; + self->paused = false; + self->stopping = false; + // We always output stereo so output twice as many bits. + // uint16_t bits_per_sample_output = bits_per_sample * 2; + ESP_CALL_RAISE(i2s_set_sample_rates(self->instance, audiosample_sample_rate(sample))); + i2s_fill_buffer(self); +} + +bool port_i2s_playing(i2s_t *self) { + return self->playing && !self->stopping; +} + +bool port_i2s_paused(i2s_t *self) { + return self->paused; +} + +void port_i2s_stop(i2s_t *self) { + self->sample = NULL; + self->paused = false; + self->playing = false; + self->stopping = false; +} + +void port_i2s_pause(i2s_t *self) { + if (!self->paused) { + self->paused = true; + ESP_CALL_RAISE(i2s_stop(self->instance)); + } +} + +void port_i2s_resume(i2s_t *self) { + if (self->paused) { + self->paused = false; + ESP_CALL_RAISE(i2s_start(self->instance)); + } +} diff --git a/ports/esp32s2/i2s_common.h b/ports/esp32s2/i2s_common.h new file mode 100644 index 0000000000000..7709735daeca7 --- /dev/null +++ b/ports/esp32s2/i2s_common.h @@ -0,0 +1,61 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler 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. + */ + +#pragma once + +#include "py/obj.h" + +#include "supervisor/background_callback.h" + +#include "driver/i2s.h" + +typedef struct { + mp_obj_t *sample; + bool left_justified; + bool loop; + bool paused; + bool playing; + bool stopping; + bool samples_signed; + int8_t bytes_per_sample; + int8_t channel_count; + int8_t instance; + uint16_t buffer_length; + uint8_t *sample_data, *sample_end; + i2s_config_t i2s_config; + background_callback_t callback; +} i2s_t; + + +void port_i2s_allocate_init(i2s_t *self, bool left_justified); +void port_i2s_reset_instance(int i); +void i2s_reset(void); +void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop); +void port_i2s_stop(i2s_t *self); +bool port_i2s_playing(i2s_t *self); +bool port_i2s_paused(i2s_t *self); +void port_i2s_pause(i2s_t *self); +void port_i2s_resume(i2s_t *self); diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index 2ad8afb51cd1e..562c60998c29e 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -15,7 +15,11 @@ LONGINT_IMPL = MPZ # These modules are implemented in ports//common-hal: CIRCUITPY_FULL_BUILD = 1 CIRCUITPY_ALARM = 1 -CIRCUITPY_AUDIOBUSIO = 0 +CIRCUITPY_AUDIOCORE = 1 +CIRCUITPY_AUDIOMP3 = 0 +CIRCUITPY_AUDIOBUSIO = 1 +CIRCUITPY_AUDIOBUSIO_PDMIN = 0 +CIRCUITPY_AUDIOBUSIO_I2SOUT = 1 CIRCUITPY_AUDIOIO = 0 CIRCUITPY_CANIO = 1 CIRCUITPY_COUNTIO = 1 diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index ff35845f71685..75492492eb4eb 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -61,6 +61,10 @@ #include "components/soc/soc/esp32s2/include/soc/cache_memory.h" #include "components/soc/soc/esp32s2/include/soc/rtc_cntl_reg.h" +#if CIRCUITPY_AUDIOBUSIO +#include "i2s_common.h" +#endif + #define HEAP_SIZE (48 * 1024) uint32_t* heap; @@ -153,6 +157,10 @@ void reset_port(void) { ps2_reset(); #endif +#if CIRCUITPY_AUDIOBUSIO + i2s_reset(); +#endif + #if CIRCUITPY_PULSEIO esp32s2_peripherals_rmt_reset(); pulsein_reset(); diff --git a/shared-module/audiocore/__init__.c b/shared-module/audiocore/__init__.c index ac9d41b60a755..7bdfe460ce419 100644 --- a/shared-module/audiocore/__init__.c +++ b/shared-module/audiocore/__init__.c @@ -70,3 +70,63 @@ void audiosample_get_buffer_structure(mp_obj_t sample_obj, bool single_channel, proto->get_buffer_structure(MP_OBJ_TO_PTR(sample_obj), single_channel, single_buffer, samples_signed, max_buffer_length, spacing); } + +void audiosample_convert_u8m_s16s(int16_t *buffer_out, const uint8_t *buffer_in, size_t nframes) { + for(;nframes--;) { + int16_t sample = (*buffer_in++ - 0x80) << 8; + *buffer_out++ = sample; + *buffer_out++ = sample; + } +} + + +void audiosample_convert_u8s_s16s(int16_t *buffer_out, const uint8_t *buffer_in, size_t nframes) { + size_t nsamples = 2*nframes; + for(;nsamples--;) { + int16_t sample = (*buffer_in++ - 0x80) << 8; + *buffer_out++ = sample; + } +} + +void audiosample_convert_s8m_s16s(int16_t *buffer_out, const int8_t *buffer_in, size_t nframes) { + for(;nframes--;) { + int16_t sample = (*buffer_in++) << 8; + *buffer_out++ = sample; + *buffer_out++ = sample; + } +} + + +void audiosample_convert_s8s_s16s(int16_t *buffer_out, const int8_t *buffer_in, size_t nframes) { + size_t nsamples = 2*nframes; + for(;nsamples--;) { + int16_t sample = (*buffer_in++) << 8; + *buffer_out++ = sample; + } +} + + +void audiosample_convert_u16m_s16s(int16_t *buffer_out, const uint16_t *buffer_in, size_t nframes) { + for(;nframes--;) { + int16_t sample = *buffer_in++ - 0x8000; + *buffer_out++ = sample; + *buffer_out++ = sample; + } +} + + +void audiosample_convert_u16s_s16s(int16_t *buffer_out, const uint16_t *buffer_in, size_t nframes) { + size_t nsamples = 2*nframes; + for(;nsamples--;) { + int16_t sample = *buffer_in++ - 0x8000; + *buffer_out++ = sample; + } +} + +void audiosample_convert_s16m_s16s(int16_t *buffer_out, const int16_t *buffer_in, size_t nframes) { + for(;nframes--;) { + int16_t sample = *buffer_in++; + *buffer_out++ = sample; + *buffer_out++ = sample; + } +} diff --git a/shared-module/audiocore/__init__.h b/shared-module/audiocore/__init__.h index 7a56454b8a4aa..ec2cf1cfab0b2 100644 --- a/shared-module/audiocore/__init__.h +++ b/shared-module/audiocore/__init__.h @@ -74,4 +74,12 @@ void audiosample_get_buffer_structure(mp_obj_t sample_obj, bool single_channel, bool* single_buffer, bool* samples_signed, uint32_t* max_buffer_length, uint8_t* spacing); +void audiosample_convert_u8m_s16s(int16_t *buffer_out, const uint8_t *buffer_in, size_t nframes); +void audiosample_convert_u8s_s16s(int16_t *buffer_out, const uint8_t *buffer_in, size_t nframes); +void audiosample_convert_s8m_s16s(int16_t *buffer_out, const int8_t *buffer_in, size_t nframes); +void audiosample_convert_s8s_s16s(int16_t *buffer_out, const int8_t *buffer_in, size_t nframes); +void audiosample_convert_u16m_s16s(int16_t *buffer_out, const uint16_t *buffer_in, size_t nframes); +void audiosample_convert_u16s_s16s(int16_t *buffer_out, const uint16_t *buffer_in, size_t nframes); +void audiosample_convert_s16m_s16s(int16_t *buffer_out, const int16_t *buffer_in, size_t nframes); + #endif // MICROPY_INCLUDED_SHARED_MODULE_AUDIOCORE__INIT__H From 42cad23dea7c4b6fdfb7a8a294cfeb8048f74cac Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 29 Dec 2020 16:31:29 -0600 Subject: [PATCH 519/770] make translate --- locale/circuitpython.pot | 64 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 3edadd57c780a..9016a38c92146 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-12-23 23:04-0500\n" +"POT-Creation-Date: 2020-12-29 16:31-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -114,6 +114,11 @@ msgstr "" msgid "%q() takes %d positional arguments but %d were given" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "" @@ -536,6 +541,10 @@ msgstr "" msgid "CBC blocks must be multiples of 16 bytes" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "" @@ -984,6 +993,10 @@ msgstr "" msgid "Function requires lock" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1110,6 +1123,7 @@ msgstr "" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "" @@ -1218,6 +1232,14 @@ msgstr "" msgid "Invalid security_mode" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1258,6 +1280,10 @@ msgstr "" msgid "Length must be non-negative" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "" @@ -1496,6 +1522,18 @@ msgstr "" msgid "Only raw int supported for ip" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "" @@ -1504,6 +1542,10 @@ msgstr "" msgid "Oversample must be multiple of 8." msgstr "" +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1520,6 +1562,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "" +#: ports/esp32s2/i2s_common.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "" @@ -1637,6 +1683,10 @@ msgstr "" msgid "Read-only object" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -1649,6 +1699,10 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "" @@ -2019,6 +2073,10 @@ msgstr "" msgid "Value length > max_length" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "" @@ -3833,6 +3891,10 @@ msgstr "" msgid "x value out of bounds" msgstr "" +#: ports/esp32s2/i2s_common.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "" From 72cad49c69591874b09b4b7edca89ba5b2e6996b Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Tue, 29 Dec 2020 22:52:59 -0600 Subject: [PATCH 520/770] Fix minor typo in ESP32S2 readme --- ports/esp32s2/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/README.md b/ports/esp32s2/README.md index 0738d520e7f30..f5a2bfe5ca713 100644 --- a/ports/esp32s2/README.md +++ b/ports/esp32s2/README.md @@ -7,7 +7,7 @@ This port adds the ESP32-S2 line of modules from Espressif to Circuitpython. ESP - **bindings/** contains some required bindings to the ESP-IDF for exceptions and memory. - **boards/** contains the configuration files for each development board and breakout available on the port. - **common-hal/** contains the port-specific module implementations, used by shared-module and shared-bindings. -- **esp-idf/** contains the Espressif IoT development framework installation, includign all the drivers for the port. +- **esp-idf/** contains the Espressif IoT development framework installation, including all the drivers for the port. - **modules/** contains information specific to certain ESP32-S2 hardware modules, such as the pins used for flash and RAM on the WROVER and WROOM. - **peripherals/** contains peripheral setup files and peripheral mapping information, sorted by family and sub-variant. Most files in this directory can be generated with the python scripts in **tools/**. - **supervisor/** contains port-specific implementations of internal flash, serial and USB, as well as the **port.c** file, which initializes the port at startup. From 0914b71653adafccb6bb7f656d3833fd60e9c4ae Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Wed, 30 Dec 2020 09:26:25 -0600 Subject: [PATCH 521/770] remove unneeded set_config (wrong param; called in connect anyway) --- ports/esp32s2/common-hal/wifi/Radio.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index 05506783e7ad9..a9617af653046 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -55,8 +55,6 @@ static void start_station(wifi_radio_obj_t *self) { esp_wifi_set_mode(next_mode); self->sta_mode = 1; - - esp_wifi_set_config(WIFI_MODE_STA, &self->sta_config); } bool common_hal_wifi_radio_get_enabled(wifi_radio_obj_t *self) { From d537d94a4c6ca36fba4aa7c11a1de93d2a38cf6b Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Wed, 30 Dec 2020 09:45:15 -0600 Subject: [PATCH 522/770] see what we're missing --- ports/esp32s2/common-hal/wifi/__init__.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/common-hal/wifi/__init__.c b/ports/esp32s2/common-hal/wifi/__init__.c index 8de37753751a4..878c903521e2a 100644 --- a/ports/esp32s2/common-hal/wifi/__init__.c +++ b/ports/esp32s2/common-hal/wifi/__init__.c @@ -78,12 +78,15 @@ static void event_handler(void* arg, esp_event_base_t event_base, radio->last_disconnect_reason = reason; xEventGroupSetBits(radio->event_group_handle, WIFI_DISCONNECTED_BIT); + break; } // Cases to handle later. // case WIFI_EVENT_STA_AUTHMODE_CHANGE: - default: + default: { + ESP_EARLY_LOGW(TAG, "event %d 0x%02x", event_id, event_id); break; + } } } From c7f68022efa1306b0c7cb2fa47dcc84dbca2c605 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 30 Dec 2020 22:11:22 +0530 Subject: [PATCH 523/770] add pretend-to-sleep functionality --- locale/circuitpython.pot | 6 +- ports/esp32s2/common-hal/alarm/__init__.c | 13 +-- .../common-hal/alarm/touch/TouchAlarm.c | 81 ++++++++++++++++--- .../common-hal/alarm/touch/TouchAlarm.h | 4 +- ports/esp32s2/common-hal/touchio/TouchIn.c | 8 +- ports/esp32s2/peripherals/pins.h | 2 +- ports/esp32s2/peripherals/touch.c | 11 ++- ports/esp32s2/peripherals/touch.h | 3 +- 8 files changed, 90 insertions(+), 38 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 593e955f2c097..b9cf5bdcf3752 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-12-18 20:40+0530\n" +"POT-Creation-Date: 2020-12-22 22:54+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1463,7 +1463,7 @@ msgstr "" msgid "Only one alarm.time alarm can be set." msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c msgid "Only one alarm.touch alarm can be set." msgstr "" @@ -1841,7 +1841,7 @@ msgstr "" msgid "Total data to write is larger than outgoing_packet_length" msgstr "" -#: ports/esp32s2/common-hal/alarm/__init__.c +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c msgid "TouchAlarm not available in light sleep" msgstr "" diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index 79c245704713b..9e5772eacf639 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -103,7 +103,6 @@ mp_obj_t common_hal_alarm_get_wake_alarm(void) { // Set up light sleep or deep sleep alarms. STATIC void _setup_sleep_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t *alarms) { bool time_alarm_set = false; - bool touch_alarm_set = false; alarm_time_time_alarm_obj_t *time_alarm = MP_OBJ_NULL; for (size_t i = 0; i < n_alarms; i++) { @@ -115,23 +114,13 @@ STATIC void _setup_sleep_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t } time_alarm = MP_OBJ_TO_PTR(alarms[i]); time_alarm_set = true; - } else if (MP_OBJ_IS_TYPE(alarms[i], &alarm_touch_touchalarm_type)) { - if (!touch_alarm_set) { - if (deep_sleep) { - alarm_touch_touchalarm_set_alarm(MP_OBJ_TO_PTR(alarms[i])); - touch_alarm_set = true; - } else { - mp_raise_NotImplementedError(translate("TouchAlarm not available in light sleep")); - } - } else { - mp_raise_ValueError(translate("Only one alarm.touch alarm can be set.")); - } } } if (time_alarm_set) { alarm_time_timealarm_set_alarm(time_alarm); } + alarm_touch_touchalarm_set_alarm(deep_sleep, n_alarms, alarms); } STATIC void _idle_until_alarm(void) { diff --git a/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c b/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c index a2fda8e781d9a..f5497af478a8d 100644 --- a/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +++ b/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c @@ -27,9 +27,12 @@ #include "shared-bindings/alarm/touch/TouchAlarm.h" #include "shared-bindings/microcontroller/__init__.h" +#include "esp_sleep.h" #include "peripherals/touch.h" +#include "supervisor/esp_port.h" -#include "esp_sleep.h" +static volatile bool woke_up = false; +static touch_pad_t touch_channel = TOUCH_PAD_MAX; void common_hal_alarm_touch_touchalarm_construct(alarm_touch_touchalarm_obj_t *self, const mcu_pin_obj_t *pin) { if (pin->touch_channel == TOUCH_PAD_MAX) { @@ -39,7 +42,7 @@ void common_hal_alarm_touch_touchalarm_construct(alarm_touch_touchalarm_obj_t *s self->pin = pin; } -mp_obj_t alarm_touch_touchalarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms) { +mp_obj_t alarm_touch_touchalarm_get_wakeup_alarm(const size_t n_alarms, const mp_obj_t *alarms) { // First, check to see if we match any given alarms. for (size_t i = 0; i < n_alarms; i++) { if (MP_OBJ_IS_TYPE(alarms[i], &alarm_touch_touchalarm_type)) { @@ -47,8 +50,6 @@ mp_obj_t alarm_touch_touchalarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t } } - gpio_num_t pin_number = esp_sleep_get_touchpad_wakeup_status(); - alarm_touch_touchalarm_obj_t *alarm = m_new_obj(alarm_touch_touchalarm_obj_t); alarm->base.type = &alarm_touch_touchalarm_type; alarm->pin = NULL; @@ -56,7 +57,7 @@ mp_obj_t alarm_touch_touchalarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t // Map the pin number back to a pin object. for (size_t i = 0; i < mcu_pin_globals.map.used; i++) { const mcu_pin_obj_t* pin_obj = MP_OBJ_TO_PTR(mcu_pin_globals.map.table[i].value); - if (pin_obj->number == pin_number) { + if (pin_obj->touch_channel == touch_channel) { alarm->pin = mcu_pin_globals.map.table[i].value; break; } @@ -65,16 +66,67 @@ mp_obj_t alarm_touch_touchalarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t return alarm; } -static touch_pad_t touch_channel = TOUCH_PAD_MAX; +// This is used to wake the main CircuitPython task. +void touch_interrupt(void *arg) { + (void) arg; + woke_up = true; + BaseType_t task_wakeup; + vTaskNotifyGiveFromISR(circuitpython_task, &task_wakeup); + if (task_wakeup) { + portYIELD_FROM_ISR(); + } +} -void alarm_touch_touchalarm_set_alarm(alarm_touch_touchalarm_obj_t *self) { - touch_channel = (touch_pad_t)self->pin->number; - esp_sleep_enable_touchpad_wakeup(); - esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON); +void alarm_touch_touchalarm_set_alarm(const bool deep_sleep, const size_t n_alarms, const mp_obj_t *alarms) { + bool touch_alarm_set = false; + alarm_touch_touchalarm_obj_t *touch_alarm = MP_OBJ_NULL; + + for (size_t i = 0; i < n_alarms; i++) { + if (MP_OBJ_IS_TYPE(alarms[i], &alarm_touch_touchalarm_type)) { + if (!touch_alarm_set) { + if (deep_sleep) { + touch_alarm = MP_OBJ_TO_PTR(alarms[i]); + touch_alarm_set = true; + } else { + mp_raise_NotImplementedError(translate("TouchAlarm not available in light sleep")); + } + } else { + mp_raise_ValueError(translate("Only one alarm.touch alarm can be set.")); + } + } + } + if (!touch_alarm_set) { + return; + } + + touch_channel = touch_alarm->pin->touch_channel; + + // configure interrupt for pretend to deep sleep + // this will be disabled if we actually deep sleep + + // intialize touchpad + peripherals_touch_reset(); + peripherals_touch_never_reset(true); + peripherals_touch_init(touch_channel); + + // wait for touch data to reset + mp_hal_delay_ms(10); + + // configure trigger threshold + uint32_t touch_value; + touch_pad_read_benchmark(touch_channel, &touch_value); + touch_pad_set_thresh(touch_channel, touch_value * 0.1); //10% + + // configure touch interrupt + touch_pad_timeout_set(true, SOC_TOUCH_PAD_THRESHOLD_MAX); + touch_pad_isr_register(touch_interrupt, NULL, TOUCH_PAD_INTR_MASK_ALL); + touch_pad_intr_enable(TOUCH_PAD_INTR_MASK_ACTIVE | TOUCH_PAD_INTR_MASK_INACTIVE | TOUCH_PAD_INTR_MASK_TIMEOUT); } void alarm_touch_touchalarm_prepare_for_deep_sleep(void) { // intialize touchpad + peripherals_touch_never_reset(false); + peripherals_touch_reset(); peripherals_touch_init(touch_channel); // configure touchpad for sleep @@ -84,15 +136,22 @@ void alarm_touch_touchalarm_prepare_for_deep_sleep(void) { // wait for touch data to reset mp_hal_delay_ms(10); + // configure trigger threshold uint32_t touch_value; touch_pad_sleep_channel_read_smooth(touch_channel, &touch_value); touch_pad_sleep_set_threshold(touch_channel, touch_value * 0.1); //10% + + // enable touchpad wakeup + esp_sleep_enable_touchpad_wakeup(); + esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON); } bool alarm_touch_touchalarm_woke_us_up(void) { - return false; + return woke_up; } void alarm_touch_touchalarm_reset(void) { + woke_up = false; touch_channel = TOUCH_PAD_MAX; + peripherals_touch_never_reset(false); } diff --git a/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.h b/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.h index aa1c27fea8b1e..755a3977ad37b 100644 --- a/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.h +++ b/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.h @@ -36,9 +36,9 @@ typedef struct { } alarm_touch_touchalarm_obj_t; // Find the alarm object that caused us to wake up or create an equivalent one. -mp_obj_t alarm_touch_touchalarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms); +mp_obj_t alarm_touch_touchalarm_get_wakeup_alarm(const size_t n_alarms, const mp_obj_t *alarms); // Check for the wake up alarm from pretend deep sleep. -void alarm_touch_touchalarm_set_alarm(alarm_touch_touchalarm_obj_t *self); +void alarm_touch_touchalarm_set_alarm(const bool deep_sleep, const size_t n_alarms, const mp_obj_t *alarms); void alarm_touch_touchalarm_prepare_for_deep_sleep(void); bool alarm_touch_touchalarm_woke_us_up(void); void alarm_touch_touchalarm_reset(void); diff --git a/ports/esp32s2/common-hal/touchio/TouchIn.c b/ports/esp32s2/common-hal/touchio/TouchIn.c index afce8e72d1d7a..401b84d5c2d40 100644 --- a/ports/esp32s2/common-hal/touchio/TouchIn.c +++ b/ports/esp32s2/common-hal/touchio/TouchIn.c @@ -27,12 +27,11 @@ #include "shared-bindings/touchio/TouchIn.h" #include "py/runtime.h" -#include "driver/touch_pad.h" #include "peripherals/touch.h" static uint16_t get_raw_reading(touchio_touchin_obj_t *self) { uint32_t touch_value; - touch_pad_read_raw_data((touch_pad_t)self->pin->touch_channel, &touch_value); + touch_pad_read_raw_data(self->pin->touch_channel, &touch_value); if (touch_value > UINT16_MAX) { return UINT16_MAX; } @@ -47,14 +46,11 @@ void common_hal_touchio_touchin_construct(touchio_touchin_obj_t* self, claim_pin(pin); // initialize touchpad - peripherals_touch_init((touch_pad_t)pin->touch_channel); + peripherals_touch_init(pin->touch_channel); // wait for touch data to reset mp_hal_delay_ms(10); - // Initial values for pins will vary, depending on what peripherals the pins - // share on-chip. - // Set a "touched" threshold not too far above the initial value. // For simple finger touch, the values may vary as much as a factor of two, // but for touches using fruit or other objects, the difference is much less. diff --git a/ports/esp32s2/peripherals/pins.h b/ports/esp32s2/peripherals/pins.h index c78eb83851382..dc28385bd5184 100644 --- a/ports/esp32s2/peripherals/pins.h +++ b/ports/esp32s2/peripherals/pins.h @@ -44,7 +44,7 @@ typedef struct { gpio_num_t number; uint8_t adc_index:2; uint8_t adc_channel:6; - uint8_t touch_channel; + touch_pad_t touch_channel; } mcu_pin_obj_t; extern const mcu_pin_obj_t pin_GPIO0; diff --git a/ports/esp32s2/peripherals/touch.c b/ports/esp32s2/peripherals/touch.c index 3f496adddd9bf..6cf33b2bdef05 100644 --- a/ports/esp32s2/peripherals/touch.c +++ b/ports/esp32s2/peripherals/touch.c @@ -24,18 +24,25 @@ * THE SOFTWARE. */ +#include "components/soc/include/hal/gpio_types.h" +// above include fixes build error in idf@v4.2 #include "peripherals/touch.h" static bool touch_inited = false; +static bool touch_never_reset = false; void peripherals_touch_reset(void) { - if (touch_inited) { + if (touch_inited && !touch_never_reset) { touch_pad_deinit(); touch_inited = false; } } -void peripherals_touch_init(touch_pad_t touchpad) { +void peripherals_touch_never_reset(const bool enable) { + touch_never_reset = enable; +} + +void peripherals_touch_init(const touch_pad_t touchpad) { if (!touch_inited) { touch_pad_init(); touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER); diff --git a/ports/esp32s2/peripherals/touch.h b/ports/esp32s2/peripherals/touch.h index d9e0bd5fc2bcc..218045f398555 100644 --- a/ports/esp32s2/peripherals/touch.h +++ b/ports/esp32s2/peripherals/touch.h @@ -30,6 +30,7 @@ #include "driver/touch_pad.h" extern void peripherals_touch_reset(void); -extern void peripherals_touch_init(touch_pad_t touchpad); +extern void peripherals_touch_never_reset(const bool enable); +extern void peripherals_touch_init(const touch_pad_t touchpad); #endif // MICROPY_INCLUDED_ESP32S2_PERIPHERALS_TOUCH_HANDLER_H From 83c6774a448c2bfa20dc5de04644489fc64adaaf Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 30 Dec 2020 10:55:28 -0600 Subject: [PATCH 524/770] Revert "Removing frozen libs" This reverts commit 23ed3ef971f8f38497337874da39273e5ae090d7. --- ports/atmel-samd/boards/8086_commander/mpconfigboard.mk | 1 + .../boards/feather_m0_express_crickit/mpconfigboard.mk | 1 + ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk | 1 + ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk | 1 + ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk | 1 + ports/atmel-samd/boards/pycubed/mpconfigboard.mk | 1 + ports/atmel-samd/boards/pycubed_mram/mpconfigboard.mk | 1 + ports/atmel-samd/boards/sam32/mpconfigboard.mk | 1 + ports/atmel-samd/boards/xinabox_cc03/mpconfigboard.mk | 1 + ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk | 1 + 10 files changed, 10 insertions(+) diff --git a/ports/atmel-samd/boards/8086_commander/mpconfigboard.mk b/ports/atmel-samd/boards/8086_commander/mpconfigboard.mk index f976dfe787cb8..b5a4bc735f958 100644 --- a/ports/atmel-samd/boards/8086_commander/mpconfigboard.mk +++ b/ports/atmel-samd/boards/8086_commander/mpconfigboard.mk @@ -22,6 +22,7 @@ CIRCUITPY_GAMEPAD = 1 CIRCUITPY_BUSDEVICE = 1 # Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD #FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_ADXL34x diff --git a/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk index 331a3110ef4b8..5624144e880b1 100644 --- a/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk @@ -20,6 +20,7 @@ CIRCUITPY_GAMEPAD = 0 CFLAGS_INLINE_LIMIT = 50 # Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Crickit FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Motor FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk index 6ea21ed82e824..6e089bb90d636 100644 --- a/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk @@ -28,4 +28,5 @@ CFLAGS_INLINE_LIMIT = 35 SUPEROPT_GC = 0 # Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_RFM69 diff --git a/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk index 76a6be2e34e28..383b6a6df448e 100644 --- a/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk @@ -29,4 +29,5 @@ CFLAGS_INLINE_LIMIT = 35 SUPEROPT_GC = 0 # Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_RFM9x diff --git a/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk index 2b211abd4e06d..1931ceb9a87a7 100644 --- a/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk @@ -27,6 +27,7 @@ CFLAGS_INLINE_LIMIT = 55 SUPEROPT_GC = 0 # Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/atmel-samd/boards/pycubed/mpconfigboard.mk b/ports/atmel-samd/boards/pycubed/mpconfigboard.mk index a82362b8d2c3d..b7b8073ab9f42 100644 --- a/ports/atmel-samd/boards/pycubed/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pycubed/mpconfigboard.mk @@ -21,6 +21,7 @@ CIRCUITPY_GAMEPAD = 0 CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_PS2IO = 0 +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD diff --git a/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.mk b/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.mk index 3bf42d70543b6..f49bb3fef039b 100644 --- a/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.mk @@ -21,6 +21,7 @@ CIRCUITPY_GAMEPAD = 0 CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_PS2IO = 0 +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD diff --git a/ports/atmel-samd/boards/sam32/mpconfigboard.mk b/ports/atmel-samd/boards/sam32/mpconfigboard.mk index 9ac24a014c60e..1dc686ef8aa69 100644 --- a/ports/atmel-samd/boards/sam32/mpconfigboard.mk +++ b/ports/atmel-samd/boards/sam32/mpconfigboard.mk @@ -13,4 +13,5 @@ LONGINT_IMPL = MPZ CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_USTACK = 1 +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/atmel-samd/boards/xinabox_cc03/mpconfigboard.mk b/ports/atmel-samd/boards/xinabox_cc03/mpconfigboard.mk index d6f333b5be6e7..3562228c71e6e 100644 --- a/ports/atmel-samd/boards/xinabox_cc03/mpconfigboard.mk +++ b/ports/atmel-samd/boards/xinabox_cc03/mpconfigboard.mk @@ -24,3 +24,4 @@ CIRCUITPY_TOUCHIO=0 CIRCUITPY_BUSDEVICE=1 # Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice diff --git a/ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk b/ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk index fd2fa044a8d1a..53908293f5d1a 100644 --- a/ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk +++ b/ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk @@ -27,4 +27,5 @@ CIRCUITPY_COUNTIO=0 CIRCUITPY_BUSDEVICE=1 # Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD From 3b72d502a40bd7e576b0136129251ea9370b4530 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 30 Dec 2020 14:27:37 -0500 Subject: [PATCH 525/770] update frozen libs for 6.1.0-beta.3 --- frozen/Adafruit_CircuitPython_BLE | 2 +- frozen/Adafruit_CircuitPython_DRV2605 | 2 +- frozen/Adafruit_CircuitPython_DS3231 | 2 +- frozen/Adafruit_CircuitPython_ESP32SPI | 2 +- frozen/Adafruit_CircuitPython_LIS3DH | 2 +- frozen/Adafruit_CircuitPython_LSM6DS | 2 +- frozen/Adafruit_CircuitPython_Motor | 2 +- frozen/Adafruit_CircuitPython_RFM9x | 2 +- frozen/Adafruit_CircuitPython_Register | 2 +- frozen/Adafruit_CircuitPython_Requests | 2 +- frozen/Adafruit_CircuitPython_seesaw | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/frozen/Adafruit_CircuitPython_BLE b/frozen/Adafruit_CircuitPython_BLE index 41f7a3530d4ca..8bb1210eebed4 160000 --- a/frozen/Adafruit_CircuitPython_BLE +++ b/frozen/Adafruit_CircuitPython_BLE @@ -1 +1 @@ -Subproject commit 41f7a3530d4cacdbf668399d3a015ea29c7e169b +Subproject commit 8bb1210eebed4846dae7e76ff1db86a010b132bc diff --git a/frozen/Adafruit_CircuitPython_DRV2605 b/frozen/Adafruit_CircuitPython_DRV2605 index 209edd164eb64..ce30b04a3c8e5 160000 --- a/frozen/Adafruit_CircuitPython_DRV2605 +++ b/frozen/Adafruit_CircuitPython_DRV2605 @@ -1 +1 @@ -Subproject commit 209edd164eb640a8ced561a54505792fc99a67b9 +Subproject commit ce30b04a3c8e557d48a0607ddcb25272b196a433 diff --git a/frozen/Adafruit_CircuitPython_DS3231 b/frozen/Adafruit_CircuitPython_DS3231 index 5d81a9ea822a8..4f5dc66d50e43 160000 --- a/frozen/Adafruit_CircuitPython_DS3231 +++ b/frozen/Adafruit_CircuitPython_DS3231 @@ -1 +1 @@ -Subproject commit 5d81a9ea822a85e46be4a512ac44abf21e77d816 +Subproject commit 4f5dc66d50e43ca8d413ab0d86c125a7a13d394f diff --git a/frozen/Adafruit_CircuitPython_ESP32SPI b/frozen/Adafruit_CircuitPython_ESP32SPI index 01f3f6674b449..fce466bd2bb70 160000 --- a/frozen/Adafruit_CircuitPython_ESP32SPI +++ b/frozen/Adafruit_CircuitPython_ESP32SPI @@ -1 +1 @@ -Subproject commit 01f3f6674b4493ba29b857e0f43deb69975736ec +Subproject commit fce466bd2bb70ca86b79e5cb36bbaca00afacfd1 diff --git a/frozen/Adafruit_CircuitPython_LIS3DH b/frozen/Adafruit_CircuitPython_LIS3DH index 9fe8f314c032c..bea5d4a347aee 160000 --- a/frozen/Adafruit_CircuitPython_LIS3DH +++ b/frozen/Adafruit_CircuitPython_LIS3DH @@ -1 +1 @@ -Subproject commit 9fe8f314c032cee89b9ad7697d61e9cba76431ff +Subproject commit bea5d4a347aeece71a421ee292551264e3bf7ae2 diff --git a/frozen/Adafruit_CircuitPython_LSM6DS b/frozen/Adafruit_CircuitPython_LSM6DS index f1cc47f024b27..fee951908cc5f 160000 --- a/frozen/Adafruit_CircuitPython_LSM6DS +++ b/frozen/Adafruit_CircuitPython_LSM6DS @@ -1 +1 @@ -Subproject commit f1cc47f024b27e670b9bf2a51c89e32f93c1b957 +Subproject commit fee951908cc5f1ba7db5edd2537fade09d626730 diff --git a/frozen/Adafruit_CircuitPython_Motor b/frozen/Adafruit_CircuitPython_Motor index 434e5b5346cb0..608291801ce71 160000 --- a/frozen/Adafruit_CircuitPython_Motor +++ b/frozen/Adafruit_CircuitPython_Motor @@ -1 +1 @@ -Subproject commit 434e5b5346cb0a1a9eb15989b00278be87cb2ff1 +Subproject commit 608291801ce7112b280d32518de79993cc80963a diff --git a/frozen/Adafruit_CircuitPython_RFM9x b/frozen/Adafruit_CircuitPython_RFM9x index cfffc23378496..4696e07638eff 160000 --- a/frozen/Adafruit_CircuitPython_RFM9x +++ b/frozen/Adafruit_CircuitPython_RFM9x @@ -1 +1 @@ -Subproject commit cfffc233784961929d722ea4e9acfe5786790609 +Subproject commit 4696e07638eff28392b57162d2a70e20473e97b7 diff --git a/frozen/Adafruit_CircuitPython_Register b/frozen/Adafruit_CircuitPython_Register index 6143ec2a96a6d..dd7cc167c528a 160000 --- a/frozen/Adafruit_CircuitPython_Register +++ b/frozen/Adafruit_CircuitPython_Register @@ -1 +1 @@ -Subproject commit 6143ec2a96a6d218041e9cab5968de26702d7bbf +Subproject commit dd7cc167c528a94a9feed81f9c52b5d372f68258 diff --git a/frozen/Adafruit_CircuitPython_Requests b/frozen/Adafruit_CircuitPython_Requests index 53902152c674b..c070f6e8dbc37 160000 --- a/frozen/Adafruit_CircuitPython_Requests +++ b/frozen/Adafruit_CircuitPython_Requests @@ -1 +1 @@ -Subproject commit 53902152c674b0ba31536b50291f7ddd28960f47 +Subproject commit c070f6e8dbc37757cbcb444269c6cd6a4b676647 diff --git a/frozen/Adafruit_CircuitPython_seesaw b/frozen/Adafruit_CircuitPython_seesaw index 88738da275a83..9d91ec849efb5 160000 --- a/frozen/Adafruit_CircuitPython_seesaw +++ b/frozen/Adafruit_CircuitPython_seesaw @@ -1 +1 @@ -Subproject commit 88738da275a83acabb14b7140d1c79b33cdc7b02 +Subproject commit 9d91ec849efb5fbc3d26d350a75a61f15d19bc48 From b83bdc540d64c647e9339a8368aef83bab1387f5 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 31 Dec 2020 02:22:20 +0530 Subject: [PATCH 526/770] enable light-sleep functionality --- ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c b/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c index f5497af478a8d..20553877ca2f2 100644 --- a/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +++ b/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c @@ -84,12 +84,8 @@ void alarm_touch_touchalarm_set_alarm(const bool deep_sleep, const size_t n_alar for (size_t i = 0; i < n_alarms; i++) { if (MP_OBJ_IS_TYPE(alarms[i], &alarm_touch_touchalarm_type)) { if (!touch_alarm_set) { - if (deep_sleep) { - touch_alarm = MP_OBJ_TO_PTR(alarms[i]); - touch_alarm_set = true; - } else { - mp_raise_NotImplementedError(translate("TouchAlarm not available in light sleep")); - } + touch_alarm = MP_OBJ_TO_PTR(alarms[i]); + touch_alarm_set = true; } else { mp_raise_ValueError(translate("Only one alarm.touch alarm can be set.")); } From 0bad6110d4f2c1b66560dccb2eaf54f563d8f5a8 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 31 Dec 2020 02:44:20 +0530 Subject: [PATCH 527/770] update wake-alarm implementation --- main.c | 2 +- ports/esp32s2/common-hal/alarm/__init__.c | 2 +- shared-bindings/alarm/__init__.c | 10 +++------- shared-bindings/alarm/__init__.h | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/main.c b/main.c index 9c4055a28712d..91b6a062d20bf 100755 --- a/main.c +++ b/main.c @@ -157,7 +157,7 @@ STATIC void start_mp(supervisor_allocation* heap) { #if CIRCUITPY_ALARM // Record which alarm woke us up, if any. An object may be created so the heap must be functional. - alarm_save_wakeup_alarm(); + alarm_save_wake_alarm(); // Reset alarm module only after we retrieved the wakeup alarm. alarm_reset(); #endif diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index 0b1a7f049dd13..47764a03a616d 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -121,9 +121,9 @@ STATIC void _idle_until_alarm(void) { RUN_BACKGROUND_TASKS; // Allow ctrl-C interrupt. if (alarm_woken_from_sleep()) { + alarm_save_wake_alarm(); return; } - port_idle_until_interrupt(); } } diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index e8230a4ca27e5..7023c70e5deba 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -227,21 +227,17 @@ mp_obj_t alarm_get_wake_alarm(void) { } } -STATIC void alarm_set_wake_alarm(mp_obj_t alarm) { +// Initialize .wake_alarm value. +void alarm_save_wake_alarm(void) { // Equivalent of: // alarm.wake_alarm = alarm mp_map_elem_t *elem = mp_map_lookup(&alarm_module_globals.map, MP_ROM_QSTR(MP_QSTR_wake_alarm), MP_MAP_LOOKUP); if (elem) { - elem->value = alarm; + elem->value = common_hal_alarm_get_wake_alarm(); } } -// Initialize .wake_alarm value. -void alarm_save_wakeup_alarm(void) { - alarm_set_wake_alarm(common_hal_alarm_get_wake_alarm()); -} - const mp_obj_module_t alarm_module = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t*)&alarm_module_globals, diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h index 4c12e0e70a645..154f91e265b13 100644 --- a/shared-bindings/alarm/__init__.h +++ b/shared-bindings/alarm/__init__.h @@ -50,7 +50,7 @@ extern void common_hal_alarm_gc_collect(void); extern mp_obj_t common_hal_alarm_get_wake_alarm(void); // Used by wake-up code. -void alarm_save_wakeup_alarm(void); +void alarm_save_wake_alarm(void); // True if an alarm is alerting. This is most useful for pretend deep sleep. From 7cae612ad08c4da5543e968c326b5f88213b550b Mon Sep 17 00:00:00 2001 From: oon arfiandwi Date: Wed, 30 Dec 2020 05:48:17 +0000 Subject: [PATCH 528/770] Translated using Weblate (Indonesian) Currently translated at 46.1% (410 of 889 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/id/ --- locale/ID.po | 72 ++++++++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 33 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 45b35f195593c..47c3310dbeae2 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-23 23:04-0500\n" -"PO-Revision-Date: 2020-10-10 23:51+0000\n" +"PO-Revision-Date: 2020-12-30 22:25+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" "Language: ID\n" @@ -14,13 +14,15 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.3-dev\n" +"X-Generator: Weblate 4.4.1-dev\n" #: main.c msgid "" "\n" "Code done running.\n" msgstr "" +"\n" +"Kode selesai beroperasi.\n" #: main.c msgid "" @@ -62,7 +64,7 @@ msgstr "pin alamat %d dan pin rgb %d menunjukkan tinggi %d, bukan %d" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" -msgstr "" +msgstr "%q gagal: %d" #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -78,7 +80,7 @@ msgstr "%q indeks di luar batas" #: py/obj.c msgid "%q indices must be integers, not %q" -msgstr "" +msgstr "%q indeks harus bilangan bulat, bukan %q" #: shared-bindings/vectorio/Polygon.c msgid "%q list must be a list" @@ -86,7 +88,7 @@ msgstr "daftar %q harus berupa daftar" #: shared-bindings/memorymonitor/AllocationAlarm.c msgid "%q must be >= 0" -msgstr "" +msgstr "%q harus >= 0" #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c @@ -102,7 +104,7 @@ msgstr "%q harus berupa tuple dengan panjang 2" #: shared-bindings/canio/Match.c msgid "%q out of range" -msgstr "" +msgstr "%q di luar jangkauan" #: ports/atmel-samd/common-hal/microcontroller/Pin.c msgid "%q pin invalid" @@ -126,23 +128,23 @@ msgstr "" #: py/proto.c msgid "'%q' object does not support '%q'" -msgstr "" +msgstr "Objek '%q' tidak mendukung '%q'" #: py/obj.c msgid "'%q' object does not support item assignment" -msgstr "" +msgstr "Objek '%q' tidak mendukung penugasan item" #: py/obj.c msgid "'%q' object does not support item deletion" -msgstr "" +msgstr "Objek '%q' tidak mendukung penghapusan item" #: py/runtime.c msgid "'%q' object has no attribute '%q'" -msgstr "" +msgstr "Objek '%q' tidak memiliki atribut '%q'" #: py/runtime.c msgid "'%q' object is not an iterator" -msgstr "" +msgstr "Objek '%q' bukan merupakan iterator" #: py/objtype.c py/runtime.c msgid "'%q' object is not callable" @@ -150,7 +152,7 @@ msgstr "" #: py/runtime.c msgid "'%q' object is not iterable" -msgstr "" +msgstr "Objek '%q' tidak dapat diulang" #: py/obj.c msgid "'%q' object is not subscriptable" @@ -224,7 +226,7 @@ msgstr "'await' diluar fungsi" #: py/compile.c msgid "'await', 'async for' or 'async with' outside async function" -msgstr "" +msgstr "'await', 'async for' atau 'async with' di luar fungsi async" #: py/compile.c msgid "'break' outside loop" @@ -256,7 +258,7 @@ msgstr "'return' diluar fungsi" #: py/compile.c msgid "'yield from' inside async function" -msgstr "" +msgstr "'yield from' di dalam fungsi async" #: py/compile.c msgid "'yield' outside function" @@ -285,7 +287,7 @@ msgstr "Sebuah channel hardware interrupt sedang digunakan" #: ports/esp32s2/common-hal/analogio/AnalogIn.c msgid "ADC2 is being used by WiFi" -msgstr "" +msgstr "ADC2 sedang digunakan oleh WiFi" #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format @@ -308,13 +310,13 @@ msgstr "Semua perangkat I2C sedang digunakan" #: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" -msgstr "" +msgstr "Semua unit PCNT sedang digunakan" #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "All RX FIFOs in use" -msgstr "" +msgstr "Semua RX FIFO sedang digunakan" #: ports/esp32s2/common-hal/busio/SPI.c ports/nrf/common-hal/busio/SPI.c msgid "All SPI peripherals are in use" @@ -1825,18 +1827,21 @@ msgid "" "enough power for the whole circuit and press reset (after ejecting " "CIRCUITPY).\n" msgstr "" +"Kekuatan mikrokontroler menurun. Pastikan catu daya Anda menyediakan\n" +"daya yang cukup untuk seluruh rangkaian dan tekan reset (setelah " +"mengeluarkan CIRCUITPY).\n" #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" -msgstr "" +msgstr "Sampel bits_per_sampel tidak cocok dengan mixer" #: shared-module/audiomixer/MixerVoice.c msgid "The sample's channel count does not match the mixer's" -msgstr "" +msgstr "Jumlah saluran sampel tidak cocok dengan mixer" #: shared-module/audiomixer/MixerVoice.c msgid "The sample's sample rate does not match the mixer's" -msgstr "" +msgstr "Tingkat sampel dari sampel tidak cocok dengan mixer" #: shared-module/audiomixer/MixerVoice.c msgid "The sample's signedness does not match the mixer's" @@ -1848,15 +1853,15 @@ msgstr "" #: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c msgid "Tile index out of bounds" -msgstr "" +msgstr "Indeks ubin di luar batas" #: shared-bindings/displayio/TileGrid.c msgid "Tile value out of bounds" -msgstr "" +msgstr "Nilai ubin di luar batas" #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" -msgstr "" +msgstr "Lebar ubin harus persis membagi lebar bitmap" #: shared-bindings/alarm/time/TimeAlarm.c msgid "Time is in the past." @@ -1882,15 +1887,16 @@ msgstr "Terlalu banyak channel dalam sampel" #: shared-module/displayio/__init__.c msgid "Too many display busses" -msgstr "" +msgstr "Terlalu banyak tampilan bus" #: shared-module/displayio/__init__.c msgid "Too many displays" -msgstr "" +msgstr "Terlalu banyak tampilan" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Total data to write is larger than outgoing_packet_length" msgstr "" +"Total data yang akan ditulis lebih besar daripada outgoing_packet_length" #: py/obj.c msgid "Traceback (most recent call last):\n" @@ -1898,35 +1904,35 @@ msgstr "" #: shared-bindings/time/__init__.c msgid "Tuple or struct_time argument required" -msgstr "" +msgstr "Diperlukan argumen Tuple atau struct_time" #: ports/stm/common-hal/busio/UART.c msgid "UART Buffer allocation error" -msgstr "" +msgstr "Kesalahan alokasi Buffer UART" #: ports/stm/common-hal/busio/UART.c msgid "UART De-init error" -msgstr "" +msgstr "Kesalahan UART De-init" #: ports/stm/common-hal/busio/UART.c msgid "UART Init Error" -msgstr "" +msgstr "Kesalahan Init UART" #: ports/stm/common-hal/busio/UART.c msgid "UART Re-init error" -msgstr "" +msgstr "Kesalahan Re-init UART" #: ports/stm/common-hal/busio/UART.c msgid "UART write error" -msgstr "" +msgstr "Kesalahan penulisan UART" #: shared-module/usb_hid/Device.c msgid "USB Busy" -msgstr "" +msgstr "USB Sibuk" #: shared-module/usb_hid/Device.c msgid "USB Error" -msgstr "" +msgstr "Kesalahan USB" #: shared-bindings/_bleio/UUID.c msgid "UUID integer value must be 0-0xffff" From c27030ba7cc7d4fd20d9e8eebefe9f011cddd3e4 Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Tue, 29 Dec 2020 22:41:37 +0000 Subject: [PATCH 529/770] Translated using Weblate (Spanish) Currently translated at 96.7% (860 of 889 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/locale/es.po b/locale/es.po index 1e3e3be5b9719..9bce0559d4a7c 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,15 +8,15 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-23 23:04-0500\n" -"PO-Revision-Date: 2020-11-27 18:34+0000\n" -"Last-Translator: Iván Montiel Cardona \n" +"PO-Revision-Date: 2020-12-30 22:25+0000\n" +"Last-Translator: Hugo Dahl \n" "Language-Team: \n" "Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.4-dev\n" +"X-Generator: Weblate 4.4.1-dev\n" #: main.c msgid "" @@ -1236,7 +1236,7 @@ msgstr "Modo de ejecución inválido." #: shared-module/_bleio/Attribute.c msgid "Invalid security_mode" -msgstr "Modo de seguridad no válido" +msgstr "'security_mode' no válido" #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" @@ -1276,7 +1276,7 @@ msgstr "Length debe ser un int" #: py/objslice.c msgid "Length must be non-negative" -msgstr "Longitud no deberia ser negativa" +msgstr "Length no deberia ser negativa" #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." From 334207c3655585f23e8905455fa70d8498ff01c3 Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Wed, 30 Dec 2020 01:58:12 +0000 Subject: [PATCH 530/770] Translated using Weblate (French) Currently translated at 100.0% (889 of 889 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 333 ++++++++++++++++++++++++++------------------------- 1 file changed, 168 insertions(+), 165 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index b88bf3b8b9255..66e8e9186e4ba 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-23 23:04-0500\n" -"PO-Revision-Date: 2020-12-29 20:38+0000\n" +"PO-Revision-Date: 2020-12-30 22:25+0000\n" "Last-Translator: Hugo Dahl \n" "Language: fr\n" "MIME-Version: 1.0\n" @@ -82,7 +82,7 @@ msgstr "%q en cours d'utilisation" #: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c #: py/objstrunicode.c msgid "%q index out of range" -msgstr "index %q hors gamme" +msgstr "index %q hors de portée" #: py/obj.c msgid "%q indices must be integers, not %q" @@ -102,7 +102,7 @@ msgstr "%q doit être >= 0" #: shared-bindings/memorymonitor/AllocationAlarm.c #: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c msgid "%q must be >= 1" -msgstr "%q doit être >=1" +msgstr "%q doit être >= 1" #: shared-module/vectorio/Polygon.c msgid "%q must be a tuple of length 2" @@ -122,11 +122,11 @@ msgstr "%q doit être un chiffre entier (int)" #: py/bc.c py/objnamedtuple.c msgid "%q() takes %d positional arguments but %d were given" -msgstr "%q() prend %d paramêtres positionnels mais %d ont été donnés" +msgstr "%q() prend %d paramètres positionnels mais %d ont été donnés" #: py/argcheck.c msgid "'%q' argument required" -msgstr "paramêtre '%q' requis" +msgstr "paramètre '%q' requis" #: py/runtime.c msgid "'%q' object cannot assign attribute '%q'" @@ -167,7 +167,7 @@ msgstr "l'objet '%q' n'est pas souscriptable" #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects a label" -msgstr "'%s' attend un label" +msgstr "'%s' attend une étiquette" #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format @@ -192,12 +192,12 @@ msgstr "'%s' attend une adresse de la forme [a, b]" #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects an integer" -msgstr "'%s' attend un entier" +msgstr "'%s' attend un chiffre entier" #: py/emitinlinethumb.c #, c-format msgid "'%s' expects at most r%d" -msgstr "'%s' attend au plus à r%d" +msgstr "'%s' attend au plus r%d" #: py/emitinlinethumb.c #, c-format @@ -207,16 +207,16 @@ msgstr "'%s' attend {r0, r1, ...}" #: py/emitinlinextensa.c #, c-format msgid "'%s' integer %d is not within range %d..%d" -msgstr "'%s' l'entier %d n'est pas dans la gamme %d..%d" +msgstr "'%s' le chiffre entier %d n'est pas dans la portée %d..%d" #: py/emitinlinethumb.c #, c-format msgid "'%s' integer 0x%x does not fit in mask 0x%x" -msgstr "'%s' l'entier 0x%x ne correspond pas au masque 0x%x" +msgstr "'%s' le chiffre entier 0x%x ne correspond pas au masque 0x%x" #: py/objstr.c msgid "'=' alignment not allowed in string format specifier" -msgstr "'=' alignement non autorisé dans la spéc. de format de chaîne" +msgstr "'=' alignement non permis dans la spécification du format de chaîne" #: shared-module/struct/__init__.c msgid "'S' and 'O' are not supported format types" @@ -224,43 +224,43 @@ msgstr "'S' et 'O' ne sont pas des types de format supportés" #: py/compile.c msgid "'align' requires 1 argument" -msgstr "'align' nécessite 1 argument" +msgstr "'align' nécessite 1 paramètre" #: py/compile.c msgid "'await' outside function" -msgstr "'await' en dehors d'une fonction" +msgstr "'await' dehors d'une fonction" #: py/compile.c msgid "'await', 'async for' or 'async with' outside async function" -msgstr "'await', 'async for' ou 'async with' au dehors d'une fonction async" +msgstr "'await', 'async for' ou 'async with' dehors d'une fonction async" #: py/compile.c msgid "'break' outside loop" -msgstr "'break' en dehors d'une boucle" +msgstr "'break' dehors d'une boucle" #: py/compile.c msgid "'continue' outside loop" -msgstr "'continue' en dehors d'une boucle" +msgstr "'continue' dehors d'une boucle" #: py/objgenerator.c msgid "'coroutine' object is not an iterator" -msgstr "L'objet « coroutine » n'est pas un itérateur" +msgstr "L'objet \"coroutine\" n'est pas un itérateur" #: py/compile.c msgid "'data' requires at least 2 arguments" -msgstr "'data' nécessite au moins 2 arguments" +msgstr "'data' nécessite au moins 2 paramètres" #: py/compile.c msgid "'data' requires integer arguments" -msgstr "'data' nécessite des arguments entiers" +msgstr "'data' nécessite des paramètre de chiffres entiers" #: py/compile.c msgid "'label' requires 1 argument" -msgstr "'label' nécessite 1 argument" +msgstr "'label' nécessite 1 paramètre" #: py/compile.c msgid "'return' outside function" -msgstr "'return' en dehors d'une fonction" +msgstr "'return' dehors d'une fonction" #: py/compile.c msgid "'yield from' inside async function" @@ -268,7 +268,7 @@ msgstr "'yield from' dans une fonction async" #: py/compile.c msgid "'yield' outside function" -msgstr "'yield' en dehors d'une fonction" +msgstr "'yield' dehors d'une fonction" #: py/compile.c msgid "*x must be assignment target" @@ -284,12 +284,12 @@ msgstr "0.0 à une puissance complexe" #: py/modbuiltins.c msgid "3-arg pow() not supported" -msgstr "pow() non supporté avec 3 arguments" +msgstr "pow() non supporté avec 3 paramètres" #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" -msgstr "Un canal d'interruptions matérielles est déjà utilisé" +msgstr "Un canal d'interruptions matériel est déjà utilisé" #: ports/esp32s2/common-hal/analogio/AnalogIn.c msgid "ADC2 is being used by WiFi" @@ -302,7 +302,7 @@ msgstr "L'adresse doit être longue de %d octets" #: shared-bindings/_bleio/Address.c msgid "Address type out of range" -msgstr "Type d'adresse hors plage" +msgstr "Type d'adresse hors portée" #: ports/esp32s2/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" @@ -338,11 +338,11 @@ msgstr "Tous les canaux d'événements sont utilisés" #: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "All sync event channels in use" -msgstr "Tous les canaux d'événements de synchro sont utilisés" +msgstr "Tous les canaux d'événements sync (sync event channels) sont utilisés" #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" -msgstr "Tous les timers pour cette broche sont utilisés" +msgstr "Tous les minuteurs pour cette broche sont utilisés" #: ports/atmel-samd/common-hal/_pew/PewPew.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c @@ -358,7 +358,7 @@ msgstr "Tous les timers pour cette broche sont utilisés" #: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c #: ports/stm/peripherals/timers.c shared-bindings/pwmio/PWMOut.c msgid "All timers in use" -msgstr "Tous les timers sont utilisés" +msgstr "Tous les minuteurs sont utilisés" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Already advertising." @@ -390,7 +390,8 @@ msgstr "Fonctionnalité AnalogOut non supportée" #: shared-bindings/analogio/AnalogOut.c msgid "AnalogOut is only 16 bits. Value must be less than 65536." msgstr "" -"AnalogOut est seulement 16 bits. Les valeurs doivent être inf. à 65536." +"AnalogOut est seulement 16 bits. Les valeurs doivent être inférieures à " +"65536." #: ports/atmel-samd/common-hal/analogio/AnalogOut.c msgid "AnalogOut not supported on given pin" @@ -407,7 +408,7 @@ msgstr "Le tableau doit contenir des demi-mots (type 'H')" #: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." -msgstr "Les valeurs du tableau doivent être des octets simples 'bytes'." +msgstr "Les valeurs du tableau doivent être des octets singuliers." #: shared-bindings/microcontroller/Pin.c msgid "At most %d %q may be specified (not %d)" @@ -442,12 +443,12 @@ msgstr "" #: ports/esp32s2/common-hal/canio/CAN.c msgid "Baudrate not supported by peripheral" -msgstr "Baudrate non prise en charge par le périphérique" +msgstr "Baudrate non supporté par le périphérique" #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" -msgstr "Inférieur à la fréquence d'images minimale" +msgstr "Au-dessous de la fréquence d'images minimale" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must share a clock unit" @@ -456,7 +457,7 @@ msgstr "'bit clock' et 'word select' doivent partager une horloge" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Bit depth must be from 1 to 6 inclusive, not %d" -msgstr "Bit depth doit être compris entre 1 et 6 inclus, et non %d" +msgstr "Bit depth doit être entre 1 et 6 inclusivement, et non %d" #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." @@ -468,7 +469,7 @@ msgstr "RX et TX requis pour le contrôle de flux" #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" -msgstr "Les deux entrées doivent supporter les interruptions matérielles" +msgstr "Les deux broches doivent supporter les interruptions matérielles" #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -590,7 +591,7 @@ msgstr "Impossible de supprimer les valeurs" #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" -msgstr "Ne peut être tiré ('pull') en mode 'output'" +msgstr "Ne peut être tiré ('pull') en mode sortie ('output')" #: ports/nrf/common-hal/microcontroller/Processor.c msgid "Cannot get temperature" @@ -608,7 +609,7 @@ msgstr "Les 2 canaux de sortie ne peuvent être sur la même broche" #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." -msgstr "Ne peut tirer sur une broche d'entrée seule." +msgstr "Ne peut tirer ('pull') sur une broche d'entrée ('input') seule." #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." @@ -631,7 +632,8 @@ msgstr "" #: shared-bindings/digitalio/DigitalInOut.c msgid "Cannot set value when direction is input." -msgstr "Impossible d'affecter une valeur quand la direction est 'input'." +msgstr "" +"Impossible d'affecter une valeur quand la direction est entrentre ('input')." #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c @@ -648,12 +650,11 @@ msgstr "Pas de transfert sans broches MOSI et MISO." #: extmod/moductypes.c msgid "Cannot unambiguously get sizeof scalar" -msgstr "Impossible d'obtenir la taille du scalaire sans ambigüité" +msgstr "Impossible d'obtenir la taille (sizeof) du scalaire sans ambigüité" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" -msgstr "" -"Impossible de faire varier la fréquence sur une minuterie déjà utilisée" +msgstr "Impossible de faire varier la fréquence sur un minuteur déjà utilisée" #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge. Only level." @@ -682,11 +683,11 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "CircuitPython was unable to allocate the heap.\n" -msgstr "CircuitPython n'as pu faire l'allocation de la pile\n" +msgstr "CircuitPython n'as pu faire l'allocation de la pile.\n" #: shared-module/bitbangio/SPI.c msgid "Clock pin init failed." -msgstr "Echec de l'init. de la broche d'horloge." +msgstr "Échec de l'initialization de la broche d'horloge." #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" @@ -703,7 +704,7 @@ msgstr "L'entrée 'Column' doit être un digitalio.DigitalInOut" #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c #: shared-bindings/displayio/ParallelBus.c msgid "Command must be an int between 0 and 255" -msgstr "La commande doit être un entier entre 0 et 255" +msgstr "La commande doit être un chiffre entier entre 0 et 255" #: shared-bindings/_bleio/Connection.c msgid "" @@ -723,7 +724,7 @@ msgstr "Code brut corrompu" #: ports/cxd56/common-hal/camera/Camera.c msgid "Could not initialize Camera" -msgstr "Impossible d'initialisé la Camera" +msgstr "Impossible d'initialiser Camera" #: ports/cxd56/common-hal/gnss/GNSS.c msgid "Could not initialize GNSS" @@ -736,19 +737,19 @@ msgstr "Impossible d'initialiser la carte SD" #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c msgid "Could not initialize UART" -msgstr "L'UART n'a pu être initialisé" +msgstr "Impossible d'initialiser UART" #: ports/esp32s2/common-hal/pwmio/PWMOut.c ports/stm/common-hal/pwmio/PWMOut.c msgid "Could not initialize channel" -msgstr "Impossible d'initialiser la chaîne" +msgstr "Impossible d'initialiser le canal" #: ports/esp32s2/common-hal/pwmio/PWMOut.c ports/stm/common-hal/pwmio/PWMOut.c msgid "Could not initialize timer" -msgstr "Impossible d'initialiser la minuterie" +msgstr "Impossible d'initialiser le minuteur" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Could not re-init channel" -msgstr "Impossible de réinitialiser la chaîne" +msgstr "Impossible de réinitialiser le canal" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Could not re-init timer" @@ -781,7 +782,7 @@ msgstr "Impossible d'allouer le décodeur" #: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c #: shared-module/audiomp3/MP3Decoder.c msgid "Couldn't allocate first buffer" -msgstr "Impossible d'allouer le 1er tampon" +msgstr "Impossible d'allouer le premier tampon" #: shared-module/audiomp3/MP3Decoder.c msgid "Couldn't allocate input buffer" @@ -790,11 +791,11 @@ msgstr "Impossible d'allouer le tampon d'entrée" #: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c #: shared-module/audiomp3/MP3Decoder.c msgid "Couldn't allocate second buffer" -msgstr "Impossible d'allouer le 2e tampon" +msgstr "Impossible d'allouer le deuxième tampon" #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." -msgstr "Crash dans le HardFault_Handler." +msgstr "Échec vers le HardFault_Handler." #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" @@ -815,11 +816,11 @@ msgstr "La broche 'Data 0' doit être aligné sur l'octet" #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" -msgstr "Un bloc de données doit suivre un bloc de format" +msgstr "Un bloc de données doit suivre un bloc fmt" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Data too large for advertisement packet" -msgstr "Données trop volumineuses pour un paquet de diffusion" +msgstr "Données trop volumineuses pour un paquet d'avertissement" #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." @@ -846,7 +847,8 @@ msgstr "La rotation d'affichage doit se faire par incréments de 90 degrés" #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." -msgstr "Le mode Drive n'est pas utilisé quand la direction est 'input'." +msgstr "" +"Le mode Drive n'est pas utilisé quand la direction est entrante ('input')." #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" @@ -885,11 +887,11 @@ msgstr "Un 'DigitalInOut' est attendu" #: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" -msgstr "Attendu un service" +msgstr "Un Service est attendu" #: shared-bindings/_bleio/Adapter.c msgid "Expected a UART" -msgstr "Un 'UART' est attendu" +msgstr "Un UART est attendu" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c #: shared-bindings/_bleio/Service.c @@ -898,7 +900,7 @@ msgstr "Un UUID est attendu" #: shared-bindings/_bleio/Adapter.c msgid "Expected an Address" -msgstr "Attendu une adresse" +msgstr "Un Address est attendu" #: shared-bindings/alarm/__init__.c msgid "Expected an alarm" @@ -912,11 +914,11 @@ msgstr "Tuple de longueur %d attendu, obtenu %d" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Extended advertisements with scan response not supported." msgstr "" -"Les publicités étendues avec réponse d'analyse ne sont pas prises en charge." +"Les avertissement étendues avec analyse de réponse ne sont pas supportées." #: extmod/ulab/code/fft/fft.c msgid "FFT is defined for ndarrays only" -msgstr "La FFT est définie pour les ndarrays uniquement" +msgstr "La FFT est définie uniquement pour les ndarrays" #: extmod/ulab/code/fft/fft.c msgid "FFT is implemented for linear arrays only" @@ -963,7 +965,7 @@ msgstr "Impossible de se connecter : erreur interne" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to connect: timeout" -msgstr "Impossible de se connecter : délai d'expiration" +msgstr "Impossible de se connecter: délai dépassé" #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Failed to init wifi" @@ -980,7 +982,7 @@ msgstr "Impossible de libérer mutex, err 0x%04x" #: supervisor/shared/safe_mode.c msgid "Failed to write internal flash." -msgstr "Échec de l'écriture du flash interne." +msgstr "Échec de l'écriture vers flash interne." #: py/moduerrno.c msgid "File exists" @@ -990,7 +992,7 @@ msgstr "Le fichier existe" #: ports/esp32s2/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "Filters too complex" -msgstr "Filtre trop complexe" +msgstr "Filtres trop complexe" #: ports/esp32s2/common-hal/dualbank/__init__.c msgid "Firmware image is invalid" @@ -1003,17 +1005,18 @@ msgstr "Format non supporté" #: shared-module/framebufferio/FramebufferDisplay.c #, c-format msgid "Framebuffer requires %d bytes" -msgstr "Le framebuffer nécessite %d octets" +msgstr "FrameBuffer nécessite %d octets" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" -"La fréquence doit correspondre à PWMOut existant à l'aide de cette minuterie" +"La fréquence doit correspondre à PWMOut existant à l'utilisation de ce " +"minuteur" #: shared-bindings/bitbangio/I2C.c shared-bindings/bitbangio/SPI.c #: shared-bindings/busio/I2C.c shared-bindings/busio/SPI.c msgid "Function requires lock" -msgstr "La fonction nécessite un verrou" +msgstr "La fonction nécessite un verrou ('lock')" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c @@ -1037,11 +1040,11 @@ msgstr "Matériel utilisé, essayez d'autres broches" #: shared-bindings/wifi/Radio.c msgid "Hostname must be between 1 and 253 characters" -msgstr "Hostname doit faire entre 1 et 253 caractères" +msgstr "Hostname doit être entre 1 et 253 caractères" #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" -msgstr "opération d'E/S sur un fichier fermé" +msgstr "Opération d'E/S sur un fichier fermé" #: ports/stm/common-hal/busio/I2C.c msgid "I2C Init Error" @@ -1058,14 +1061,14 @@ msgstr "IOs 0, 2 & 4 ne supportent pas l'éleveuse interne en mode someil" #: shared-bindings/aesio/aes.c #, c-format msgid "IV must be %d bytes long" -msgstr "IV doit être long de %d octets" +msgstr "IV doit être de longueur de %d octets" #: py/persistentcode.c msgid "" "Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" "mpy-update for more info." msgstr "" -"Fichier .mpy incompatible. Merci de mettre à jour tous les fichiers .mpy." +"Fichier .mpy incompatible. Merci de mettre à jour tous les fichiers .mpy. " "Voir http://adafru.it/mpy-update pour plus d'informations." #: shared-bindings/_pew/PewPew.c @@ -1074,7 +1077,7 @@ msgstr "Taille de tampon incorrecte" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" -msgstr "L'initialisation a échoué par manque de mémoire" +msgstr "Échec d'initialisation par manque de mémoire" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" @@ -1114,7 +1117,7 @@ msgstr "Broche invalide pour '%q'" #: ports/stm/common-hal/busio/UART.c ports/stm/common-hal/canio/CAN.c #: ports/stm/common-hal/sdioio/SDCard.c msgid "Invalid %q pin selection" -msgstr "Sélection de pin %q invalide" +msgstr "Sélection de broche %q invalide" #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" @@ -1126,7 +1129,7 @@ msgstr "Fichier BMP invalide" #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" -msgstr "BSSID Invalide" +msgstr "BSSID invalide" #: ports/esp32s2/common-hal/analogio/AnalogOut.c #: ports/stm/common-hal/analogio/AnalogOut.c @@ -1145,7 +1148,7 @@ msgstr "Broche invalide" #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" -msgstr "Argument invalide" +msgstr "Paramètre invalide" #: shared-module/displayio/Bitmap.c msgid "Invalid bits per value" @@ -1157,12 +1160,12 @@ msgstr "Longueur de tampon invalide" #: shared-bindings/_pixelbuf/PixelBuf.c msgid "Invalid byteorder string" -msgstr "Chaîne d'octets non valide" +msgstr "Chaîne byteorder non valide" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" -msgstr "Période de capture invalide. Gamme valide : 1 à 500" +msgstr "Période de capture invalide. Portée valide : 1 à 500" #: shared-bindings/audiomixer/Mixer.c msgid "Invalid channel count" @@ -1182,7 +1185,7 @@ msgstr "Taille de bloc de formatage invalide" #: ports/esp32s2/common-hal/pwmio/PWMOut.c msgid "Invalid frequency" -msgstr "fréquence non Valide" +msgstr "Fréquence non valide" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Invalid frequency supplied" @@ -1190,7 +1193,7 @@ msgstr "Fréquence invalide fournie" #: supervisor/shared/safe_mode.c msgid "Invalid memory access." -msgstr "Accès mémoire invalide." +msgstr "Accès à la mémoire invalide." #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c msgid "Invalid number of bits" @@ -1232,7 +1235,7 @@ msgstr "Broches invalides" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "Invalid pins for PWMOut" -msgstr "Broches non valides pour PWMOut" +msgstr "Broches invalides pour PWMOut" #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c #: shared-bindings/displayio/FourWire.c @@ -1241,7 +1244,7 @@ msgstr "Polarité invalide" #: shared-bindings/_bleio/Characteristic.c msgid "Invalid properties" -msgstr "Propriétés non valides" +msgstr "Propriétés invalides" #: shared-bindings/microcontroller/__init__.c msgid "Invalid run mode." @@ -1249,7 +1252,7 @@ msgstr "Mode de lancement invalide." #: shared-module/_bleio/Attribute.c msgid "Invalid security_mode" -msgstr "'mode_security' non valide" +msgstr "'security_mode' invalide" #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" @@ -1265,7 +1268,7 @@ msgstr "Fichier WAVE invalide" #: ports/stm/common-hal/busio/UART.c msgid "Invalid word/bit length" -msgstr "Longueur de mot / bit non valide" +msgstr "Longueur de mot / bit invalide" #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" @@ -1285,32 +1288,32 @@ msgstr "'Layer' doit être un 'Group' ou une sous-classe 'TileGrid'." #: py/objslice.c msgid "Length must be an int" -msgstr "La longueur doit être un nombre entier" +msgstr "Length doit être un chiffre entier (int)" #: py/objslice.c msgid "Length must be non-negative" -msgstr "La longueur ne doit pas être négative" +msgstr "Length ne doit pas être négatif" #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." -msgstr "Echec de l'init. de la broche MISO." +msgstr "Échec de l'initialization de la broche MISO." #: shared-module/bitbangio/SPI.c msgid "MOSI pin init failed." -msgstr "Echec de l'init. de la broche MOSI." +msgstr "Échec de l'initialization de la broche MOSI." #: shared-module/displayio/Shape.c #, c-format msgid "Maximum x value when mirrored is %d" -msgstr "La valeur max. de x est %d lors d'une opération miroir" +msgstr "La valeur maximale de x est %d lors d'une opération miroir" #: shared-bindings/canio/Message.c msgid "Messages limited to 8 bytes" -msgstr "Message limité a 8 bytes" +msgstr "Messages limités à 8 octets" #: supervisor/shared/safe_mode.c msgid "MicroPython NLR jump failed. Likely memory corruption." -msgstr "Le saut MicroPython NLR a échoué. Altération probable de la mémoire." +msgstr "Échec du saut MicroPython NLR. Corruption de la mémoire probable." #: supervisor/shared/safe_mode.c msgid "MicroPython fatal error." @@ -1406,7 +1409,7 @@ msgstr "Pas de GCLK libre" #: shared-bindings/os/__init__.c msgid "No hardware random available" -msgstr "Pas de source matérielle d'aléa disponible" +msgstr "Aucunes source de valeurs aléatoire matérielle disponible" #: ports/atmel-samd/common-hal/ps2io/Ps2.c msgid "No hardware support on clk pin" @@ -1423,7 +1426,7 @@ msgstr "Aucune clé n'a été spécifiée" #: shared-bindings/time/__init__.c msgid "No long integer support" -msgstr "Pas de support entier long" +msgstr "Pas de support pour chiffre entier long" #: ports/esp32s2/common-hal/pwmio/PWMOut.c msgid "No more channels available" @@ -1431,7 +1434,7 @@ msgstr "Pas de canal supplémentaire disponible" #: ports/esp32s2/common-hal/pwmio/PWMOut.c msgid "No more timers available" -msgstr "Pas d'horloge supplémentaire disponible" +msgstr "Plus de minuteurs disponibles" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "No more timers available on this pin." @@ -1447,15 +1450,15 @@ msgstr "Pas de pulldown sur la broche ; 1Mohm recommandé" #: py/moduerrno.c msgid "No space left on device" -msgstr "Il n'y a plus d'espace libre sur le périphérique" +msgstr "Aucun espace libre sur le dispositif" #: py/moduerrno.c msgid "No such file/directory" -msgstr "Fichier/dossier introuvable" +msgstr "Fichier/répertoire introuvable" #: shared-module/rgbmatrix/RGBMatrix.c msgid "No timer available" -msgstr "Pas de minuterie disponible" +msgstr "Aucun minuteur disponible" #: supervisor/shared/safe_mode.c msgid "Nordic Soft Device failure assertion." @@ -1500,18 +1503,18 @@ msgstr "Uniquement 8 ou 16 bit mono avec " #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" -msgstr "Seules les adresses IPv4 sont prises en charge" +msgstr "Seulement les adresses IPv4 sont supportées" #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Only IPv4 sockets supported" -msgstr "Seules les sockets IPv4 sont prises en charge" +msgstr "Seulement les sockets IPv4 sont supportés" #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" "Only Windows format, uncompressed BMP supported: given header size is %d" msgstr "" -"Seul le format BMP Windows, non compressé est supporté : la taille de " +"Seulement le format BMP Windows, non compressé est supporté : la taille de " "l'entête fournie est %d" #: shared-module/displayio/OnDiskBitmap.c @@ -1520,8 +1523,8 @@ msgid "" "Only monochrome, indexed 4bpp or 8bpp, and 16bpp or greater BMPs supported: " "%d bpp given" msgstr "" -"Prise en charge uniquement des monochromes, 4 bpp ou 8 bpp indexés et 16 bpp " -"ou plus : %d bpp fournis" +"Seulement les BMP monochromes, 4 bpp ou 8 bpp, ou 16 bpp et plus sont " +"supportés: %d bpp fournis" #: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." @@ -1533,7 +1536,7 @@ msgstr "Une seule couleur peut être transparente à la fois" #: shared-bindings/ipaddress/__init__.c msgid "Only raw int supported for ip" -msgstr "IP n'accepte que les entiers bruts" +msgstr "IP n'accepte que les chiffres entiers bruts" #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" @@ -1547,8 +1550,8 @@ msgstr "Le sur-échantillonage doit être un multiple de 8." msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" msgstr "" -"La valeur de cycle PWM doit être entre 0 et 65535 inclus (résolution de 16 " -"bits)" +"La valeur de duty_cycle de PWM doit être entre 0 et 65535 inclusivement (" +"résolution de 16 bits)" #: shared-bindings/pwmio/PWMOut.c msgid "" @@ -1561,7 +1564,7 @@ msgstr "" #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" -msgstr "ParallelBus pas encore pris en charge" +msgstr "ParallelBus pas encore supporté" #: py/moduerrno.c msgid "Permission denied" @@ -1574,7 +1577,7 @@ msgstr "Permission refusée" #: ports/nrf/common-hal/analogio/AnalogIn.c #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Pin does not have ADC capabilities" -msgstr "La broche ne peut être utilisée pour l'ADC" +msgstr "La broche 'pin' ne supporte pas les capacitées ADC" #: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c @@ -1583,11 +1586,11 @@ msgstr "La broche est entrée uniquement" #: ports/atmel-samd/common-hal/countio/Counter.c msgid "Pin must support hardware interrupts" -msgstr "La broche doit prendre en charge les interruptions matérielles" +msgstr "La broche doit supporter les interruptions matérielles" #: ports/stm/common-hal/pulseio/PulseIn.c msgid "Pin number already reserved by EXTI" -msgstr "Numéro de broche déjà réservé par EXTI" +msgstr "Numéro de broche 'pin' déjà réservé par EXTI" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format @@ -1606,15 +1609,15 @@ msgstr "Ainsi que tout autres modules présents sur le système de fichiers\n" #: shared-module/vectorio/Polygon.c msgid "Polygon needs at least 3 points" -msgstr "Polygone a besoin d’au moins 3 points" +msgstr "Polygon a besoin d’au moins 3 points" #: ports/esp32s2/common-hal/pulseio/PulseOut.c msgid "" "Port does not accept PWM carrier. Pass a pin, frequency and duty cycle " "instead" msgstr "" -"Ce portage n'accepte pas de PWM carrier. Précisez plutôt pin, frequency et " -"duty cycle" +"Ce port n'accepte pas de PWM carrier. Précisez plutôt les valeurs pin, " +"frequency et duty_cycle" #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c @@ -1624,12 +1627,12 @@ msgid "" "Port does not accept pins or frequency. Construct and pass a PWMOut Carrier " "instead" msgstr "" -"Ce portage n'accepte pas pins ou frequency. Construisez et passez un PWMOut " -"Carrier à la place" +"Ce port n'accepte pas de broches ou de fréquence. Construisez plutôt en " +"passant un PWMOut Carrier" #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" -msgstr "Le tampon de préfixe doit être sur le tas" +msgstr "Le tampon de préfixe doit être sur la pile" #: main.c msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" @@ -1640,7 +1643,7 @@ msgstr "" #: main.c msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" -"Feinte de someil profond jusqu'à l'alarme, Ctrl-C ou écriture au fichier.\n" +"Feinte de someil profond jusqu'à l'alarme, CTRL-C ou écriture au fichier.\n" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -1648,34 +1651,34 @@ msgstr "Le tirage 'pull' n'est pas utilisé quand la direction est 'output'." #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" -msgstr "Erreur RNG DeInit" +msgstr "Erreur de désinitiation du RNG (RNG DeInit)" #: ports/stm/common-hal/os/__init__.c msgid "RNG Init Error" -msgstr "Erreur d'initialisation RNG" +msgstr "Erreur d'initialisation du RNG (RNG Init)" #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "RS485 inversion specified when not in RS485 mode" -msgstr "Inversion RS485 spécifiée lorsqu'elle n'est pas en mode RS485" +msgstr "Inversion RS485 spécifiée sans être en mode RS485" #: ports/cxd56/common-hal/rtc/RTC.c ports/esp32s2/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c msgid "RTC calibration is not supported on this board" -msgstr "étalonnage de la RTC non supportée sur cette carte" +msgstr "La calibration du RTC non supportée sur cette carte" #: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" -msgstr "RTC non supportée sur cette carte" +msgstr "RTC non supporté sur cette carte" #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c #: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "RTS/CTS/RS485 Not yet supported on this device" -msgstr "RTS / CTS / RS485 Pas encore pris en charge sur cet appareil" +msgstr "RTS / CTS / RS485 Pas encore supporté sur cet appareil" #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" -msgstr "Erreur de génération de nombres aléatoires" +msgstr "Erreur de génération de chiffres aléatoires" #: shared-bindings/memorymonitor/AllocationSize.c #: shared-bindings/pulseio/PulseIn.c @@ -1692,7 +1695,7 @@ msgstr "Objet en lecture seule" #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" -msgstr "Rafraîchissez trop tôt" +msgstr "Rafraîchissement trop tôt" #: shared-bindings/canio/RemoteTransmissionRequest.c msgid "RemoteTransmissionRequests limited to 8 bytes" @@ -1700,7 +1703,7 @@ msgstr "RemoteTransmissionRequests limité à 8 octets" #: shared-bindings/aesio/aes.c msgid "Requested AES mode is unsupported" -msgstr "Le mode AES demandé n'est pas pris en charge" +msgstr "Le mode AES demandé n'est pas supporté" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" @@ -1712,11 +1715,11 @@ msgstr "L'entrée de ligne 'Row' doit être un digitalio.DigitalInOut" #: main.c msgid "Running in safe mode! " -msgstr "Tourne en mode sécurisé " +msgstr "Exécution en mode sécurisé! " #: shared-module/sdcardio/SDCard.c msgid "SD card CSD format not supported" -msgstr "Le format de carte SD CSD n'est pas pris en charge" +msgstr "Le format de carte SD CSD n'est pas supporté" #: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c @@ -1726,12 +1729,12 @@ msgstr "SDA ou SCL a besoin d'une résistance de tirage ('pull up')" #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO GetCardInfo Error %d" -msgstr "SDIO GetCardInfo erreur %d" +msgstr "Erreur de SDIO GetCardInfo %d" #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO Init Error %d" -msgstr "SDIO Init erreur %d" +msgstr "Erreur d'initialisation SDIO %d" #: ports/stm/common-hal/busio/SPI.c msgid "SPI Init Error" @@ -1748,7 +1751,7 @@ msgstr "Le taux d'échantillonage doit être positif" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #, c-format msgid "Sample rate too high. It must be less than %d" -msgstr "Taux d'échantillonage trop élevé. Doit être inf. à %d" +msgstr "Taux d'échantillonage trop élevé. Doit être inférieur à %d" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Scan already in progess. Stop with stop_scan." @@ -1756,11 +1759,11 @@ msgstr "Scan déjà en cours. Arrêtez avec stop_scan." #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Selected CTS pin not valid" -msgstr "Broche CTS sélectionnée non valide" +msgstr "La broche CTS sélectionnée n'est pas valide" #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Selected RTS pin not valid" -msgstr "Broche RTS sélectionnée non valide" +msgstr "La broche RTS sélectionnée n'est pas valide" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c @@ -1773,7 +1776,7 @@ msgstr "Un contexte niveau serveur ne peut avoir de hostname" #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" -msgstr "Taille non prise en charge" +msgstr "Taille n'est pas supportée" #: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." @@ -1820,7 +1823,7 @@ msgstr "L'entrée du système doit être gnss.SatelliteSystem" #: ports/stm/common-hal/microcontroller/Processor.c msgid "Temperature read timed out" -msgstr "Temporisation de lecture dépassée" +msgstr "Délais de lecture de température dépassée" #: supervisor/shared/safe_mode.c msgid "" @@ -1835,7 +1838,7 @@ msgid "" "The `microcontroller` module was used to boot into safe mode. Press reset to " "exit safe mode.\n" msgstr "" -"Le module `microcontrôleur` a été utilisé pour démarrer en mode sans échec. " +"Le module `microcontroller` a été utilisé pour démarrer en mode sans échec. " "Appuyez sur reset pour quitter le mode sans échec.\n" #: shared-bindings/rgbmatrix/RGBMatrix.c @@ -1849,7 +1852,7 @@ msgid "" "CIRCUITPY).\n" msgstr "" "La puissance du microcontrôleur a baissé. Assurez-vous que votre " -"alimentation\n" +"alimentation fournit\n" "assez de puissance pour tout le circuit et appuyez sur reset (après avoir " "éjecté CIRCUITPY).\n" @@ -1899,12 +1902,12 @@ msgstr "Le délai est trop long : le délai maximal est de %d secondes" msgid "" "Timer was reserved for internal use - declare PWM pins earlier in the program" msgstr "" -"Timer est reservé pour un usage interne - déclarez la broche PWM plus tôt " -"dans le programme" +"Le minuteur est reservé pour un usage interne - déclarez la broche PWM plus " +"tôt dans le programme" #: supervisor/shared/safe_mode.c msgid "To exit, please reset the board without " -msgstr "Pour quitter, redémarrez la carte SVP sans " +msgstr "Pour quitter, SVP redémarrez la carte sans " #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." @@ -1925,11 +1928,11 @@ msgstr "" #: py/obj.c msgid "Traceback (most recent call last):\n" -msgstr "Trace (appels les plus récents en dernier) :\n" +msgstr "Traceback (appels les plus récents en dernier) :\n" #: shared-bindings/time/__init__.c msgid "Tuple or struct_time argument required" -msgstr "Argument de type tuple ou struct_time nécessaire" +msgstr "Paramètre de type tuple ou struct_time requis" #: ports/stm/common-hal/busio/UART.c msgid "UART Buffer allocation error" @@ -1961,7 +1964,7 @@ msgstr "Erreur USB" #: shared-bindings/_bleio/UUID.c msgid "UUID integer value must be 0-0xffff" -msgstr "La valeur entière UUID doit être 0-0xffff" +msgstr "La valeur du chiffre entier de UUID doit être 0-0xffff" #: shared-bindings/_bleio/UUID.c msgid "UUID string not 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" @@ -1971,8 +1974,8 @@ msgstr "" #: shared-bindings/_bleio/UUID.c msgid "UUID value is not str, int or byte buffer" msgstr "" -"la valeur de l'UUID n'est pas une chaîne de caractères, un entier ou un " -"tampon d'octets" +"La valeur de l'UUID n'est pas une chaîne de caractères, un chiffre entier ou " +"un tampon d'octets" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c @@ -1981,7 +1984,7 @@ msgstr "Impossible d'allouer des tampons pour une conversion signée" #: ports/esp32s2/common-hal/busio/I2C.c msgid "Unable to create lock" -msgstr "Impossible de créer un verrou" +msgstr "Impossible de créer un verrou ('lock')" #: shared-module/displayio/I2CDisplay.c #, c-format @@ -2003,11 +2006,11 @@ msgstr "Impossible de lire les données de la palette de couleurs" #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." -msgstr "Impossible d'écrire sur la mémoire non-volatile." +msgstr "Écriture impossible vers nvm." #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." -msgstr "Impossibilitée d'écriture à sleep_memory." +msgstr "Écriture impossible vers sleep_memory." #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" @@ -2058,7 +2061,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c #: ports/esp32s2/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c msgid "Unsupported baudrate" -msgstr "Débit non supporté" +msgstr "Débit en bauds non supporté" #: shared-module/displayio/display_core.c msgid "Unsupported display bus type" @@ -2116,7 +2119,7 @@ msgstr "WatchDogTimer n'est pas en cours d'exécution" #: shared-bindings/watchdog/WatchDogTimer.c msgid "WatchDogTimer.mode cannot be changed once set to WatchDogMode.RESET" msgstr "" -"WatchDogTimer.mode ne peut pas être changé une fois réglé pour WatchDogMode." +"WatchDogTimer.mode ne peut pas être changé une fois réglé à WatchDogMode." "RESET" #: shared-bindings/watchdog/WatchDogTimer.c @@ -2152,7 +2155,7 @@ msgstr "Réveil par alarme.\n" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" -msgstr "Écritures non prises en charge sur la caractéristique" +msgstr "Écritures non supporté vers les Characteristic" #: supervisor/shared/safe_mode.c msgid "You are in safe mode: something unanticipated happened.\n" @@ -2218,19 +2221,19 @@ msgstr "l'argument doit être un ndarray" #: py/argcheck.c shared-bindings/_stage/__init__.c #: shared-bindings/digitalio/DigitalInOut.c shared-bindings/gamepad/GamePad.c msgid "argument num/types mismatch" -msgstr "argument num/types ne correspond pas" +msgstr "Nombre/types de paramètres ne correspondent pas" #: py/runtime.c msgid "argument should be a '%q' not a '%q'" -msgstr "l'argument devrait être un(e) '%q', pas '%q'" +msgstr "le paramètre devrait être un(e) '%q', pas '%q'" #: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c msgid "arguments must be ndarrays" -msgstr "les arguments doivent être des ndarrays" +msgstr "les paramètres doivent être des ndarrays" #: extmod/ulab/code/ndarray.c msgid "array and index length must be equal" -msgstr "la longueur du tableau et de l'index doit être égale" +msgstr "la longueur du tableau et de l'index doivent être égaux" #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c @@ -2501,11 +2504,11 @@ msgstr "tampon de caractères trop petit" #: py/modbuiltins.c msgid "chr() arg not in range(0x110000)" -msgstr "argument de chr() hors de la gamme range(0x11000)" +msgstr "paramètre de chr() hors les bornes de range(0x11000)" #: py/modbuiltins.c msgid "chr() arg not in range(256)" -msgstr "argument de chr() hors de la gamme range(256)" +msgstr "paramètre de chr() hors les bornes de range(256)" #: shared-module/vectorio/Circle.c msgid "circle can only be registered in one parent" @@ -2618,7 +2621,7 @@ msgstr "l'argument diff doit être un ndarray" #: extmod/ulab/code/numerical/numerical.c msgid "differentiation order out of range" -msgstr "differentiation order hors plage" +msgstr "differentiation order hors de portée" #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c @@ -2805,7 +2808,7 @@ msgstr "La fonction n'est définie que pour les ndarrays" #: py/argcheck.c #, c-format msgid "function missing %d required positional arguments" -msgstr "il manque %d arguments obligatoires à la fonction" +msgstr "il manque %d argument(s) positionnel(s) requis pour la fonction" #: py/bc.c msgid "function missing keyword-only argument" @@ -2872,7 +2875,7 @@ msgstr "l'index est hors limites" #: extmod/ulab/code/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c msgid "index out of range" -msgstr "index hors gamme" +msgstr "index est hors bornes" #: py/obj.c msgid "indices must be integers" @@ -2945,7 +2948,7 @@ msgstr "l'entrée doit être une matrice carrée" #: extmod/ulab/code/numerical/numerical.c msgid "input must be tuple, list, range, or ndarray" -msgstr "l'entrée doit être tuple, list, range ou ndarray" +msgstr "l'entrée 'input' doit être tuple, list, range ou ndarray" #: extmod/ulab/code/poly/poly.c msgid "input vectors must be of equal length" @@ -2970,7 +2973,7 @@ msgstr "interp est défini pour les tableaux 1D de longueur égale" #: shared-bindings/_bleio/Adapter.c #, c-format msgid "interval must be in range %s-%s" -msgstr "l'intervalle doit être dans la plage %s-%s" +msgstr "interval doit être dans la portée %s-%s" #: lib/netutils/netutils.c msgid "invalid arguments" @@ -3067,11 +3070,11 @@ msgstr "label '%q' non supporté" #: py/compile.c msgid "label redefined" -msgstr "label redéfini" +msgstr "étiquette redéfinie" #: py/stream.c msgid "length argument not allowed for this type" -msgstr "argument 'length' non-permis pour ce type" +msgstr "paramètre 'length' non-permis pour ce type" #: shared-bindings/audiomixer/MixerVoice.c msgid "level must be between 0 and 1" @@ -3194,7 +3197,7 @@ msgstr "nom non défini" #: py/compile.c msgid "name reused for argument" -msgstr "nom réutilisé comme argument" +msgstr "nom réutilisé comme paramètre" #: py/emitnative.c msgid "native yield" @@ -3559,7 +3562,7 @@ msgstr "" #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "sampling rate out of range" -msgstr "taux d'échantillonage hors gamme" +msgstr "taux d'échantillonage hors bornes" #: py/modmicropython.c msgid "schedule stack full" @@ -3688,7 +3691,7 @@ msgstr "erreur de syntaxe dans le descripteur d'uctypes" #: shared-bindings/touchio/TouchIn.c msgid "threshold must be in the range 0-65536" -msgstr "le seuil doit être dans la gamme 0-65536" +msgstr "le seuil doit être dans la portée 0-65536" #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" @@ -3721,7 +3724,7 @@ msgstr "Délai d’expiration dépassé en attendant une carte v2" #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" -msgstr "'timestamp' hors bornes pour 'time_t' de la plateforme" +msgstr "timestamp hors bornes pour 'time_t' de la plateforme" #: extmod/ulab/code/ndarray.c msgid "tobytes can be invoked for dense arrays only" @@ -3750,7 +3753,7 @@ msgstr "niveau du déclencheur doit être 0 ou 1" #: extmod/ulab/code/linalg/linalg.c msgid "tuple index out of range" -msgstr "index du tuple hors gamme" +msgstr "index du tuple hors de portée" #: py/obj.c msgid "tuple/list has wrong length" From c056ac3499873bcecf33e89bc51d9d0c397057e3 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Wed, 30 Dec 2020 23:25:22 +0100 Subject: [PATCH 531/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 11 ++++++++++- locale/cs.po | 11 ++++++++++- locale/de_DE.po | 11 ++++++++++- locale/el.po | 11 ++++++++++- locale/es.po | 11 ++++++++++- locale/fil.po | 11 ++++++++++- locale/fr.po | 15 ++++++++++++--- locale/hi.po | 11 ++++++++++- locale/it_IT.po | 11 ++++++++++- locale/ja.po | 11 ++++++++++- locale/ko.po | 11 ++++++++++- locale/nl.po | 11 ++++++++++- locale/pl.po | 11 ++++++++++- locale/pt_BR.po | 11 ++++++++++- locale/sv.po | 11 ++++++++++- locale/zh_Latn_pinyin.po | 11 ++++++++++- 16 files changed, 162 insertions(+), 18 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 47c3310dbeae2..ca26f01bd1c51 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 23:04-0500\n" +"POT-Creation-Date: 2020-12-22 22:54+0530\n" "PO-Revision-Date: 2020-12-30 22:25+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -1190,6 +1190,7 @@ msgstr "Fase tidak valid" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c #: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" @@ -1514,6 +1515,10 @@ msgstr "" msgid "Only one alarm.time alarm can be set." msgstr "" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one alarm.touch alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "" @@ -1898,6 +1903,10 @@ msgid "Total data to write is larger than outgoing_packet_length" msgstr "" "Total data yang akan ditulis lebih besar daripada outgoing_packet_length" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "TouchAlarm not available in light sleep" +msgstr "" + #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index 7ceb85db72ce6..88380fbea6262 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 23:04-0500\n" +"POT-Creation-Date: 2020-12-22 22:54+0530\n" "PO-Revision-Date: 2020-12-04 18:33+0000\n" "Last-Translator: vkuthan \n" "Language-Team: LANGUAGE \n" @@ -1172,6 +1172,7 @@ msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c #: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" @@ -1490,6 +1491,10 @@ msgstr "" msgid "Only one alarm.time alarm can be set." msgstr "" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one alarm.touch alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "" @@ -1860,6 +1865,10 @@ msgstr "" msgid "Total data to write is larger than outgoing_packet_length" msgstr "" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "TouchAlarm not available in light sleep" +msgstr "" + #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index e481e52c1fe97..39e1071f90c90 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 23:04-0500\n" +"POT-Creation-Date: 2020-12-22 22:54+0530\n" "PO-Revision-Date: 2020-11-26 03:11+0000\n" "Last-Translator: Daniel Bravo Darriba \n" "Language: de_DE\n" @@ -1187,6 +1187,7 @@ msgstr "Ungültige Phase" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c #: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" @@ -1513,6 +1514,10 @@ msgstr "" msgid "Only one alarm.time alarm can be set." msgstr "" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one alarm.touch alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "" @@ -1900,6 +1905,10 @@ msgstr "" "Die Gesamtzahl der zu schreibenden Daten ist größer als " "outgoing_packet_length" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "TouchAlarm not available in light sleep" +msgstr "" + #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "Zurückverfolgung (jüngste Aufforderung zuletzt):\n" diff --git a/locale/el.po b/locale/el.po index 80aebe497c232..21a0942a6baa8 100644 --- a/locale/el.po +++ b/locale/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 23:04-0500\n" +"POT-Creation-Date: 2020-12-22 22:54+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -1169,6 +1169,7 @@ msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c #: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" @@ -1487,6 +1488,10 @@ msgstr "" msgid "Only one alarm.time alarm can be set." msgstr "" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one alarm.touch alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "" @@ -1857,6 +1862,10 @@ msgstr "" msgid "Total data to write is larger than outgoing_packet_length" msgstr "" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "TouchAlarm not available in light sleep" +msgstr "" + #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "" diff --git a/locale/es.po b/locale/es.po index 9bce0559d4a7c..bac7d2840532a 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-12-23 23:04-0500\n" +"POT-Creation-Date: 2020-12-22 22:54+0530\n" "PO-Revision-Date: 2020-12-30 22:25+0000\n" "Last-Translator: Hugo Dahl \n" "Language-Team: \n" @@ -1190,6 +1190,7 @@ msgstr "Fase inválida" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c #: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" @@ -1514,6 +1515,10 @@ msgstr "" msgid "Only one alarm.time alarm can be set." msgstr "" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one alarm.touch alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "Solo un color puede ser transparente a la vez" @@ -1907,6 +1912,10 @@ msgid "Total data to write is larger than outgoing_packet_length" msgstr "" "Los datos totales a escribir son más grandes que outgoing_packet_length" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "TouchAlarm not available in light sleep" +msgstr "" + #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "Traceback (ultima llamada reciente):\n" diff --git a/locale/fil.po b/locale/fil.po index 09dcfad660ece..86386cf1f3672 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 23:04-0500\n" +"POT-Creation-Date: 2020-12-22 22:54+0530\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -1184,6 +1184,7 @@ msgstr "Mali ang phase" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c #: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" @@ -1505,6 +1506,10 @@ msgstr "" msgid "Only one alarm.time alarm can be set." msgstr "" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one alarm.touch alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "" @@ -1877,6 +1882,10 @@ msgstr "" msgid "Total data to write is larger than outgoing_packet_length" msgstr "" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "TouchAlarm not available in light sleep" +msgstr "" + #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "Traceback (pinakahuling huling tawag): \n" diff --git a/locale/fr.po b/locale/fr.po index 66e8e9186e4ba..7903b567e0936 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 23:04-0500\n" +"POT-Creation-Date: 2020-12-22 22:54+0530\n" "PO-Revision-Date: 2020-12-30 22:25+0000\n" "Last-Translator: Hugo Dahl \n" "Language: fr\n" @@ -1206,6 +1206,7 @@ msgstr "Phase invalide" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c #: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" @@ -1530,6 +1531,10 @@ msgstr "" msgid "Only one alarm.time alarm can be set." msgstr "Seulement une alarme alarm.time peut être réglée." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one alarm.touch alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "Une seule couleur peut être transparente à la fois" @@ -1550,8 +1555,8 @@ msgstr "Le sur-échantillonage doit être un multiple de 8." msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" msgstr "" -"La valeur de duty_cycle de PWM doit être entre 0 et 65535 inclusivement (" -"résolution de 16 bits)" +"La valeur de duty_cycle de PWM doit être entre 0 et 65535 inclusivement " +"(résolution de 16 bits)" #: shared-bindings/pwmio/PWMOut.c msgid "" @@ -1926,6 +1931,10 @@ msgid "Total data to write is larger than outgoing_packet_length" msgstr "" "Le nombre total de données à écrire est supérieur à outgoing_packet_length" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "TouchAlarm not available in light sleep" +msgstr "" + #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "Traceback (appels les plus récents en dernier) :\n" diff --git a/locale/hi.po b/locale/hi.po index 5a75cf401782d..34d0238f6b895 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 23:04-0500\n" +"POT-Creation-Date: 2020-12-22 22:54+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -1169,6 +1169,7 @@ msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c #: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" @@ -1487,6 +1488,10 @@ msgstr "" msgid "Only one alarm.time alarm can be set." msgstr "" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one alarm.touch alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "" @@ -1857,6 +1862,10 @@ msgstr "" msgid "Total data to write is larger than outgoing_packet_length" msgstr "" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "TouchAlarm not available in light sleep" +msgstr "" + #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index fe742d588c494..dbefb87a8beff 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 23:04-0500\n" +"POT-Creation-Date: 2020-12-22 22:54+0530\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -1186,6 +1186,7 @@ msgstr "Fase non valida" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c #: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" @@ -1510,6 +1511,10 @@ msgstr "" msgid "Only one alarm.time alarm can be set." msgstr "" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one alarm.touch alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "" @@ -1889,6 +1894,10 @@ msgstr "Troppi schermi" msgid "Total data to write is larger than outgoing_packet_length" msgstr "" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "TouchAlarm not available in light sleep" +msgstr "" + #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "Traceback (chiamata più recente per ultima):\n" diff --git a/locale/ja.po b/locale/ja.po index dbab57219cd2b..6ccdc158e061b 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 23:04-0500\n" +"POT-Creation-Date: 2020-12-22 22:54+0530\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: sporeball \n" "Language-Team: none\n" @@ -1182,6 +1182,7 @@ msgstr "不正なphase" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c #: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" @@ -1502,6 +1503,10 @@ msgstr "" msgid "Only one alarm.time alarm can be set." msgstr "" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one alarm.touch alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "" @@ -1879,6 +1884,10 @@ msgstr "" msgid "Total data to write is larger than outgoing_packet_length" msgstr "" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "TouchAlarm not available in light sleep" +msgstr "" + #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "トレースバック(最新の呼び出しが末尾):\n" diff --git a/locale/ko.po b/locale/ko.po index e0006f000ed7e..c2272af7b0910 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 23:04-0500\n" +"POT-Creation-Date: 2020-12-22 22:54+0530\n" "PO-Revision-Date: 2020-10-05 12:12+0000\n" "Last-Translator: Michal Čihař \n" "Language-Team: LANGUAGE \n" @@ -1172,6 +1172,7 @@ msgstr "단계가 잘못되었습니다" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c #: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" @@ -1490,6 +1491,10 @@ msgstr "" msgid "Only one alarm.time alarm can be set." msgstr "" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one alarm.touch alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "" @@ -1860,6 +1865,10 @@ msgstr "" msgid "Total data to write is larger than outgoing_packet_length" msgstr "" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "TouchAlarm not available in light sleep" +msgstr "" + #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 57bd8cd0b366a..73aeade01cd73 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 23:04-0500\n" +"POT-Creation-Date: 2020-12-22 22:54+0530\n" "PO-Revision-Date: 2020-12-23 20:14+0000\n" "Last-Translator: _fonzlate \n" "Language-Team: none\n" @@ -1183,6 +1183,7 @@ msgstr "Ongeldige fase" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c #: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" @@ -1507,6 +1508,10 @@ msgstr "" msgid "Only one alarm.time alarm can be set." msgstr "Slechts één alarm.time alarm kan worden ingesteld." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one alarm.touch alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "Er kan maar één kleur per keer transparant zijn" @@ -1899,6 +1904,10 @@ msgstr "Teveel beeldschermen" msgid "Total data to write is larger than outgoing_packet_length" msgstr "Totale data om te schrijven is groter dan outgoing_packet_length" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "TouchAlarm not available in light sleep" +msgstr "" + #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "Traceback (meest recente call laatst):\n" diff --git a/locale/pl.po b/locale/pl.po index fe969af3d1f34..deefb878b8ccc 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 23:04-0500\n" +"POT-Creation-Date: 2020-12-22 22:54+0530\n" "PO-Revision-Date: 2020-12-02 20:29+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" @@ -1182,6 +1182,7 @@ msgstr "Zła faza" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c #: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" @@ -1501,6 +1502,10 @@ msgstr "" msgid "Only one alarm.time alarm can be set." msgstr "" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one alarm.touch alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "W danym momencie przezroczysty może być tylko jeden kolor" @@ -1871,6 +1876,10 @@ msgstr "Zbyt wiele wyświetlaczy" msgid "Total data to write is larger than outgoing_packet_length" msgstr "" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "TouchAlarm not available in light sleep" +msgstr "" + #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "Ślad wyjątku (najnowsze wywołanie na końcu):\n" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 1d8819a699510..dabcd98d12764 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 23:04-0500\n" +"POT-Creation-Date: 2020-12-22 22:54+0530\n" "PO-Revision-Date: 2020-12-29 16:08+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -1199,6 +1199,7 @@ msgstr "Fase Inválida" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c #: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" @@ -1522,6 +1523,10 @@ msgstr "" msgid "Only one alarm.time alarm can be set." msgstr "Apenas um alarme alarm.time pode ser definido." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one alarm.touch alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "Apenas uma cor pode ser transparente de cada vez" @@ -1922,6 +1927,10 @@ msgid "Total data to write is larger than outgoing_packet_length" msgstr "" "O total dos dados que serão gravados é maior que outgoing_packet_length" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "TouchAlarm not available in light sleep" +msgstr "" + #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "Traceback (a última chamada mais recente):\n" diff --git a/locale/sv.po b/locale/sv.po index 0d17fc539ceec..71b1c3a8660bf 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 23:04-0500\n" +"POT-Creation-Date: 2020-12-22 22:54+0530\n" "PO-Revision-Date: 2020-12-28 17:59+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -1182,6 +1182,7 @@ msgstr "Ogiltig fas" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c #: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" @@ -1506,6 +1507,10 @@ msgstr "" msgid "Only one alarm.time alarm can be set." msgstr "Endast ett alarm.time kan ställas in." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one alarm.touch alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "Bara en färg kan vara genomskinlig i taget" @@ -1897,6 +1902,10 @@ msgstr "För många displayer" msgid "Total data to write is larger than outgoing_packet_length" msgstr "Total data som ska skrivas är större än outgoing_packet_length" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "TouchAlarm not available in light sleep" +msgstr "" + #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "Traceback (senaste anrop):\n" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index ff1d89a313576..b372b067a44d2 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 23:04-0500\n" +"POT-Creation-Date: 2020-12-22 22:54+0530\n" "PO-Revision-Date: 2020-11-19 01:28+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -1180,6 +1180,7 @@ msgstr "Jiēduàn wúxiào" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c #: ports/esp32s2/common-hal/touchio/TouchIn.c shared-bindings/pwmio/PWMOut.c #: shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid pin" @@ -1503,6 +1504,10 @@ msgstr "" msgid "Only one alarm.time alarm can be set." msgstr "" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one alarm.touch alarm can be set." +msgstr "" + #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "Yīcì zhǐ néng yǒuyī zhǒng yánsè shì tòumíng de" @@ -1887,6 +1892,10 @@ msgstr "Xiǎnshì tài duō" msgid "Total data to write is larger than outgoing_packet_length" msgstr "Yào xiě rù de zǒng shùjù dàyú outgoing_packet_length" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "TouchAlarm not available in light sleep" +msgstr "" + #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "Traceback (Zuìjìn yīcì dǎ diànhuà):\n" From 1407af72913d891eefe884ff65f42f6b55aa2a14 Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Wed, 30 Dec 2020 17:47:35 -0600 Subject: [PATCH 532/770] Add localization for built-in help Support localizing the output of a call to to match the firmware's language. --- locale/circuitpython.pot | 10 +++++++++- py/builtinhelp.c | 13 +++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 3edadd57c780a..770a61e8b5600 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-12-23 23:04-0500\n" +"POT-Creation-Date: 2020-12-30 17:42-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -44,6 +44,10 @@ msgstr "" msgid " File \"%q\", line %d" msgstr "" +#: py/builtinhelp.c +msgid " is of type %q\n" +msgstr "" + #: main.c msgid " output:\n" msgstr "" @@ -3193,6 +3197,10 @@ msgstr "" msgid "number of points must be at least 2" msgstr "" +#: py/builtinhelp.c +msgid "object " +msgstr "" + #: py/obj.c msgid "object '%q' is not a tuple or list" msgstr "" diff --git a/py/builtinhelp.c b/py/builtinhelp.c index d12e088d60f33..e1dcb60962044 100644 --- a/py/builtinhelp.c +++ b/py/builtinhelp.c @@ -152,9 +152,18 @@ STATIC void mp_help_print_obj(const mp_obj_t obj) { mp_obj_type_t *type = mp_obj_get_type(obj); // try to print something sensible about the given object - mp_print_str(MP_PYTHON_PRINTER, "object "); + const compressed_string_t* compressed = translate("object "); + char decompressed_object[decompress_length(compressed)]; + decompress(compressed, decompressed_object); + + mp_print_str(MP_PYTHON_PRINTER, decompressed_object); mp_obj_print(obj, PRINT_STR); - mp_printf(MP_PYTHON_PRINTER, " is of type %q\n", type->name); + + compressed = translate(" is of type %q\n"); + char decompressed_typestring[decompress_length(compressed)]; + decompress(compressed, decompressed_typestring); + + mp_printf(MP_PYTHON_PRINTER, decompressed_typestring, type->name); mp_map_t *map = NULL; if (type == &mp_type_module) { From 43f93b097fd39f4cba10a5ac0736f2fc6b5db61c Mon Sep 17 00:00:00 2001 From: askpatricw <4002194+askpatrickw@users.noreply.github.com> Date: Thu, 31 Dec 2020 17:50:41 -0800 Subject: [PATCH 533/770] release and pre-release FeatherS2 NSync --- .../boards/unexpectedmaker_feathers2/mpconfigboard.h | 1 - ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c | 1 + .../mpconfigboard.h | 10 ++++++++++ .../boards/unexpectedmaker_feathers2_prerelease/pins.c | 3 ++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h index b68a31b9e5219..e100ac118efda 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h @@ -30,7 +30,6 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - #define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") #define AUTORESET_DELAY_MS 500 diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c b/ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c index c294fb9d3c64a..191ef5ffdeec6 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c @@ -12,6 +12,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO13) }, { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO12) }, diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h b/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h index 93d901becb938..d550ff64fed4a 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h @@ -36,3 +36,13 @@ // #define MICROPY_HW_APA102_MOSI (&pin_GPIO40) // #define MICROPY_HW_APA102_SCK (&pin_GPIO45) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO38) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/pins.c b/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/pins.c index a1036f8506bf7..d4179a2b85ed0 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/pins.c +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/pins.c @@ -26,7 +26,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO5) }, { MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_GPIO5) }, - { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, { MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_GPIO36) }, @@ -86,6 +86,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_GPIO40) }, // MTDO { MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_LDO2), MP_ROM_PTR(&pin_GPIO21) }, { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, From 220501e159998ee873bb93fba87f654bc378f4ef Mon Sep 17 00:00:00 2001 From: askpatricw <4002194+askpatrickw@users.noreply.github.com> Date: Thu, 31 Dec 2020 18:02:44 -0800 Subject: [PATCH 534/770] dupe LED entries --- ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c | 1 - ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/pins.c | 1 - 2 files changed, 2 deletions(-) diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c b/ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c index 191ef5ffdeec6..439726f5ab16b 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c @@ -91,7 +91,6 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_AMB), MP_ROM_PTR(&pin_GPIO4) }, diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/pins.c b/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/pins.c index d4179a2b85ed0..977ec845daf95 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/pins.c +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/pins.c @@ -91,7 +91,6 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_AMB), MP_ROM_PTR(&pin_GPIO4) }, From 80e5899b306692e4aa7ff49b9e8d0b36a9d280bf Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Thu, 31 Dec 2020 04:03:13 +0000 Subject: [PATCH 535/770] Translated using Weblate (French) Currently translated at 100.0% (891 of 891 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index 7903b567e0936..c25da7888ff96 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-22 22:54+0530\n" -"PO-Revision-Date: 2020-12-30 22:25+0000\n" +"PO-Revision-Date: 2021-01-01 04:29+0000\n" "Last-Translator: Hugo Dahl \n" "Language: fr\n" "MIME-Version: 1.0\n" @@ -1533,7 +1533,7 @@ msgstr "Seulement une alarme alarm.time peut être réglée." #: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c msgid "Only one alarm.touch alarm can be set." -msgstr "" +msgstr "Seulement une alarme alarm.touch peut être réglée." #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" @@ -1933,7 +1933,7 @@ msgstr "" #: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c msgid "TouchAlarm not available in light sleep" -msgstr "" +msgstr "TouchAlarm n'est pas disponible en mode someil léger" #: py/obj.c msgid "Traceback (most recent call last):\n" @@ -3818,11 +3818,11 @@ msgstr "indentation inattendue" #: py/bc.c msgid "unexpected keyword argument" -msgstr "argument nommé inattendu" +msgstr "paramètre nommé inattendu" #: py/bc.c py/objnamedtuple.c msgid "unexpected keyword argument '%q'" -msgstr "argument nommé '%q' inattendu" +msgstr "paramètre nommé '%q' inattendu" #: py/lexer.c msgid "unicode name escapes" @@ -3865,12 +3865,12 @@ msgstr "type %q non pris on charge" #: py/emitinlinethumb.c #, c-format msgid "unsupported Thumb instruction '%s' with %d arguments" -msgstr "instruction Thumb '%s' non supportée avec %d arguments" +msgstr "instruction Thumb '%s' non supportée avec %d paramètres" #: py/emitinlinextensa.c #, c-format msgid "unsupported Xtensa instruction '%s' with %d arguments" -msgstr "instruction Xtensa '%s' non supportée avec %d arguments" +msgstr "instruction Xtensa '%s' non supportée avec %d paramètres" #: py/objstr.c #, c-format @@ -3908,7 +3908,7 @@ msgstr "conflit au réveil" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" -msgstr "chien de garde non initialisé" +msgstr "chien de garde (watchdog) non initialisé" #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" @@ -3920,7 +3920,7 @@ msgstr "width doit être plus grand que zero" #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" -msgstr "la fenêtre doit être <= intervalle" +msgstr "la fenêtre (window) doit être <= intervalle (interval)" #: extmod/ulab/code/numerical/numerical.c msgid "wrong axis index" From 71cc9b60ea9a0bd4232586cecd7f18734d5b7548 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Thu, 31 Dec 2020 03:58:34 +0000 Subject: [PATCH 536/770] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (891 of 891 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index dabcd98d12764..73922b3d353f6 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-22 22:54+0530\n" -"PO-Revision-Date: 2020-12-29 16:08+0000\n" +"PO-Revision-Date: 2021-01-01 04:29+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -1525,7 +1525,7 @@ msgstr "Apenas um alarme alarm.time pode ser definido." #: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c msgid "Only one alarm.touch alarm can be set." -msgstr "" +msgstr "Apenas um alarme alarm.touch pode ser definido." #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" @@ -1929,7 +1929,7 @@ msgstr "" #: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c msgid "TouchAlarm not available in light sleep" -msgstr "" +msgstr "O TouchAlarm não está disponívle no modo light sleep" #: py/obj.c msgid "Traceback (most recent call last):\n" From df4c028d29e5a48180975d17471db81dc4717442 Mon Sep 17 00:00:00 2001 From: "@brrzap" Date: Fri, 1 Jan 2021 19:49:20 -0500 Subject: [PATCH 537/770] _pixelbuf: error check in brightness setter (fix #3753) --- shared-bindings/_pixelbuf/PixelBuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/_pixelbuf/PixelBuf.c b/shared-bindings/_pixelbuf/PixelBuf.c index 88e8aa8010f9f..a4b5b5b1b3998 100644 --- a/shared-bindings/_pixelbuf/PixelBuf.c +++ b/shared-bindings/_pixelbuf/PixelBuf.c @@ -185,7 +185,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_get_brightness_obj, pixelbuf_pixelbu STATIC mp_obj_t pixelbuf_pixelbuf_obj_set_brightness(mp_obj_t self_in, mp_obj_t value) { - mp_float_t brightness = mp_obj_float_get(value); + mp_float_t brightness = mp_obj_get_float(value); if (brightness > 1) { brightness = 1; } else if (brightness < 0) { From 2ce07209dff9f509bd5f401b8eb3a1639667e680 Mon Sep 17 00:00:00 2001 From: askpatricw <4002194+askpatrickw@users.noreply.github.com> Date: Fri, 1 Jan 2021 17:23:11 -0800 Subject: [PATCH 538/770] changes based on UM's input --- ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c | 3 --- .../esp32s2/boards/unexpectedmaker_feathers2_prerelease/pins.c | 3 --- 2 files changed, 6 deletions(-) diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c b/ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c index 439726f5ab16b..7dd85215309d2 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c @@ -86,12 +86,9 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_GPIO40) }, // MTDO { MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_GPIO45) }, - { MP_ROM_QSTR(MP_QSTR_LDO2), MP_ROM_PTR(&pin_GPIO21) }, { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, - { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_AMB), MP_ROM_PTR(&pin_GPIO4) }, diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/pins.c b/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/pins.c index 977ec845daf95..4fb71a85df8b5 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/pins.c +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/pins.c @@ -86,12 +86,9 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_GPIO40) }, // MTDO { MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_GPIO45) }, - { MP_ROM_QSTR(MP_QSTR_LDO2), MP_ROM_PTR(&pin_GPIO21) }, { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, - { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_AMB), MP_ROM_PTR(&pin_GPIO4) }, From 9d5587fb084c3eb8ebf4f6fdd20c2b88607ad261 Mon Sep 17 00:00:00 2001 From: oon arfiandwi Date: Sat, 2 Jan 2021 04:36:18 +0000 Subject: [PATCH 539/770] Translated using Weblate (Indonesian) Currently translated at 47.2% (421 of 891 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/id/ --- locale/ID.po | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index ca26f01bd1c51..5f80f1f140b6a 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-22 22:54+0530\n" -"PO-Revision-Date: 2020-12-30 22:25+0000\n" +"PO-Revision-Date: 2021-01-03 05:29+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" "Language: ID\n" @@ -1850,11 +1850,11 @@ msgstr "Tingkat sampel dari sampel tidak cocok dengan mixer" #: shared-module/audiomixer/MixerVoice.c msgid "The sample's signedness does not match the mixer's" -msgstr "" +msgstr "signedness dari sampel tidak cocok dengan mixer" #: shared-bindings/displayio/TileGrid.c msgid "Tile height must exactly divide bitmap height" -msgstr "" +msgstr "Tinggi tile harus persis membagi tinggi bitmap" #: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c msgid "Tile index out of bounds" @@ -1909,7 +1909,7 @@ msgstr "" #: py/obj.c msgid "Traceback (most recent call last):\n" -msgstr "" +msgstr "Traceback (bagian terakhir dari panggilan terkini):\n" #: shared-bindings/time/__init__.c msgid "Tuple or struct_time argument required" @@ -1945,15 +1945,15 @@ msgstr "Kesalahan USB" #: shared-bindings/_bleio/UUID.c msgid "UUID integer value must be 0-0xffff" -msgstr "" +msgstr "Nilai integer UUID harus 0-0xffff" #: shared-bindings/_bleio/UUID.c msgid "UUID string not 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" -msgstr "" +msgstr "String UUID bukan 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" #: shared-bindings/_bleio/UUID.c msgid "UUID value is not str, int or byte buffer" -msgstr "" +msgstr "Nilai UUID bukan str, int atau byte buffer" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c @@ -1967,7 +1967,7 @@ msgstr "" #: shared-module/displayio/I2CDisplay.c #, c-format msgid "Unable to find I2C Display at %x" -msgstr "" +msgstr "Tidak dapat menemukan Tampilan I2C di %x" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c @@ -1976,15 +1976,15 @@ msgstr "Tidak dapat menemukan GCLK yang kosong" #: py/parse.c msgid "Unable to init parser" -msgstr "" +msgstr "Tidak dapat memulai parser" #: shared-module/displayio/OnDiskBitmap.c msgid "Unable to read color palette data" -msgstr "" +msgstr "Tidak dapat membaca data palet warna" #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." -msgstr "" +msgstr "Tidak dapat menulis ke nvm." #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." @@ -1992,7 +1992,7 @@ msgstr "" #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" -msgstr "" +msgstr "Tipe urf nrfx tak sesuai" #: ports/esp32s2/common-hal/socketpool/Socket.c #, c-format From 9286f268318e316e31d836447371d07ae0e70c5c Mon Sep 17 00:00:00 2001 From: Benjamin Shockley Date: Sun, 3 Jan 2021 10:42:58 -0600 Subject: [PATCH 540/770] Added CP Dotstart Lib to Build Added the CircuitPython dotstar library to the Mini SAM M4 build so users do not have to include the library to utilize the built-in APA102 LED. --- ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.mk b/ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.mk index 393adf8397565..321ee5f476adf 100644 --- a/ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.mk @@ -15,3 +15,6 @@ LONGINT_IMPL = MPZ CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_BITBANG_APA102 = 1 + +#Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar From 10f178d1621a31962b6f818bf73c9b00bc8b9ccd Mon Sep 17 00:00:00 2001 From: Seon Rozenblum Date: Mon, 4 Jan 2021 10:06:32 +1100 Subject: [PATCH 541/770] Fixed incorrect pin assignment on header IO13 is for blue LED IO14 is the correct pin header between IO18 and IO12 The silk is wrong (shows IO13), but hardware is correct as IO14, but IO14 was not included in pins.c Silk will be updated on next PCB production run --- .../boards/unexpectedmaker_feathers2/pins.c | 21 ++++++++++--------- .../pins.c | 21 ++++++++++--------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c b/ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c index 7dd85215309d2..bef2001bac0ce 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c @@ -9,10 +9,9 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO18) }, { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO18) }, - { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO14) }, { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO12) }, @@ -83,14 +82,16 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO11) }, { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO11) }, - { MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_GPIO40) }, // MTDO - { MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, // Blue LED - { MP_ROM_QSTR(MP_QSTR_LDO2), MP_ROM_PTR(&pin_GPIO21) }, - { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_GPIO40) }, // APA102 + { MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_GPIO45) }, // APA102 - { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, - { MP_ROM_QSTR(MP_QSTR_AMB), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_LDO2), MP_ROM_PTR(&pin_GPIO21) }, // Second LDO Enable control + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, // Second LDO Enable control + + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, // Ambient Light Sensor + { MP_ROM_QSTR(MP_QSTR_AMB), MP_ROM_PTR(&pin_GPIO4) }, // Ambient Light Sensor { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/pins.c b/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/pins.c index 4fb71a85df8b5..57ac27aeb9f3f 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/pins.c +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/pins.c @@ -9,10 +9,9 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO18) }, { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO18) }, - { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO14) }, { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO12) }, @@ -83,14 +82,16 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO11) }, { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO11) }, - { MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_GPIO40) }, // MTDO - { MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, // Blue LED - { MP_ROM_QSTR(MP_QSTR_LDO2), MP_ROM_PTR(&pin_GPIO21) }, - { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_GPIO40) }, // APA102 + { MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_GPIO45) }, // APA102 - { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, - { MP_ROM_QSTR(MP_QSTR_AMB), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_LDO2), MP_ROM_PTR(&pin_GPIO21) }, // Second LDO Enable control + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, // Second LDO Enable control + + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, // Ambient Light Sensor + { MP_ROM_QSTR(MP_QSTR_AMB), MP_ROM_PTR(&pin_GPIO4) }, // Ambient Light Sensor { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, From ec02102409b3935d0efa6c6f132b7f38c414ff03 Mon Sep 17 00:00:00 2001 From: jerryneedell Date: Mon, 4 Jan 2021 07:41:25 -0500 Subject: [PATCH 542/770] implment use of DotStar for staus led --- .../unexpectedmaker_feathers2/mpconfigboard.h | 4 +- .../esp32s2/common-hal/microcontroller/Pin.c | 43 +++++++++++++++++-- .../esp32s2/common-hal/microcontroller/Pin.h | 4 +- 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h index e100ac118efda..6b1a0c4aa527b 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h @@ -34,8 +34,8 @@ #define AUTORESET_DELAY_MS 500 -// #define MICROPY_HW_APA102_MOSI (&pin_GPIO40) -// #define MICROPY_HW_APA102_SCK (&pin_GPIO45) +#define MICROPY_HW_APA102_MOSI (&pin_GPIO40) +#define MICROPY_HW_APA102_SCK (&pin_GPIO45) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index fca89ce8ec000..fd01d68e1f5bd 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -37,13 +37,14 @@ #ifdef MICROPY_HW_NEOPIXEL bool neopixel_in_use; #endif +#ifdef MICROPY_HW_APA102_MOSI +bool apa102_sck_in_use; +bool apa102_mosi_in_use; +#endif STATIC uint32_t never_reset_pins[2]; STATIC uint32_t in_use[2]; -bool apa102_mosi_in_use; -bool apa102_sck_in_use; - STATIC void floating_gpio_reset(gpio_num_t pin_number) { // This is the same as gpio_reset_pin(), but without the pullup. // Note that gpio_config resets the iomatrix to GPIO_FUNC as well. @@ -86,6 +87,20 @@ void reset_pin_number(gpio_num_t pin_number) { return; } #endif + #ifdef MICROPY_HW_APA102_MOSI + if (pin_number == MICROPY_HW_APA102_MOSI->number || + pin_number == MICROPY_HW_APA102_SCK->number) { + apa102_mosi_in_use = apa102_mosi_in_use && pin_number != MICROPY_HW_APA102_MOSI->number; + apa102_sck_in_use = apa102_sck_in_use && pin_number != MICROPY_HW_APA102_SCK->number; + if (!apa102_sck_in_use && !apa102_mosi_in_use) { + rgb_led_status_init(); + } + return; + } + #endif + + + } void common_hal_reset_pin(const mcu_pin_obj_t* pin) { @@ -110,6 +125,11 @@ void reset_all_pins(void) { #ifdef MICROPY_HW_NEOPIXEL neopixel_in_use = false; #endif + #ifdef MICROPY_HW_APA102_MOSI + apa102_sck_in_use = false; + apa102_mosi_in_use = false; + #endif + } void claim_pin(const mcu_pin_obj_t* pin) { @@ -119,6 +139,15 @@ void claim_pin(const mcu_pin_obj_t* pin) { neopixel_in_use = true; } #endif + #ifdef MICROPY_HW_APA102_MOSI + if (pin == MICROPY_HW_APA102_MOSI) { + apa102_mosi_in_use = true; + } + if (pin == MICROPY_HW_APA102_SCK) { + apa102_sck_in_use = true; + } + #endif + } void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin) { @@ -131,6 +160,14 @@ bool pin_number_is_free(gpio_num_t pin_number) { return !neopixel_in_use; } #endif + #ifdef MICROPY_HW_APA102_MOSI + if (pin_number == MICROPY_HW_APA102_MOSI->number) { + return !apa102_mosi_in_use; + } + if (pin_number == MICROPY_HW_APA102_SCK->number) { + return !apa102_sck_in_use; + } + #endif uint8_t offset = pin_number / 32; uint32_t mask = 1 << (pin_number % 32); diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.h b/ports/esp32s2/common-hal/microcontroller/Pin.h index f6c0087031c63..65f57a82d40cf 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.h +++ b/ports/esp32s2/common-hal/microcontroller/Pin.h @@ -31,8 +31,10 @@ #include "peripherals/pins.h" -extern bool apa102_mosi_in_use; +#ifdef MICROPY_HW_APA102_MOSI extern bool apa102_sck_in_use; +extern bool apa102_mosi_in_use; +#endif #ifdef MICROPY_HW_NEOPIXEL extern bool neopixel_in_use; From 09bf58407fc09a308154105636694b65b51cb760 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 4 Jan 2021 12:50:08 -0600 Subject: [PATCH 543/770] ulab: update to 1.6.0 This fixes several problems I encountered. --- extmod/ulab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extmod/ulab b/extmod/ulab index aa7e741530df4..c4b06e419f3d5 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit aa7e741530df471d206a4a321823a37a913a0eb8 +Subproject commit c4b06e419f3d515478b05bb8ce03ebdb29cddec4 From f87ce01b8f451be00a1cf9b546ecd9919cf2148c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 4 Jan 2021 12:55:39 -0600 Subject: [PATCH 544/770] make translate --- locale/circuitpython.pot | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 880b1c74c09b6..f319b82f8bbbf 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-12-22 22:54+0530\n" +"POT-Creation-Date: 2021-01-04 12:55-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1863,10 +1863,6 @@ msgstr "" msgid "Total data to write is larger than outgoing_packet_length" msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "TouchAlarm not available in light sleep" -msgstr "" - #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "" @@ -2502,6 +2498,10 @@ msgstr "" msgid "data must be of equal length" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "data type not understood" +msgstr "" + #: py/parsenum.c msgid "decimal numbers not supported" msgstr "" @@ -2812,7 +2812,7 @@ msgid "input and output shapes are not compatible" msgstr "" #: extmod/ulab/code/ulab_create.c -msgid "input argument must be an integer or a 2-tuple" +msgid "input argument must be an integer, a tuple, or a list" msgstr "" #: extmod/ulab/code/fft/fft.c @@ -3055,6 +3055,10 @@ msgstr "" msgid "maxiter should be > 0" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "median argument must be an ndarray" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3284,10 +3288,6 @@ msgstr "" msgid "operation is implemented for 1D Boolean arrays only" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "operation is not implemented for flattened array" -msgstr "" - #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "" @@ -3631,6 +3631,10 @@ msgstr "" msgid "too many arguments provided with the given format" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "too many dimensions" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "too many indices" msgstr "" @@ -3640,6 +3644,10 @@ msgstr "" msgid "too many values to unpack (expected %d)" msgstr "" +#: extmod/ulab/code/approx/approx.c +msgid "trapz is defined for 1D arrays" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays of equal length" msgstr "" @@ -3648,10 +3656,6 @@ msgstr "" msgid "trigger level must be 0 or 1" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "tuple index out of range" -msgstr "" - #: py/obj.c msgid "tuple/list has wrong length" msgstr "" From 4135ccb100779011ee9f11e6e68750f00c362aa7 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Mon, 4 Jan 2021 21:25:02 +0100 Subject: [PATCH 545/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 32 ++++++++++++++++------------ locale/cs.po | 32 ++++++++++++++++------------ locale/de_DE.po | 40 +++++++++++++++++++++------------- locale/el.po | 32 ++++++++++++++++------------ locale/es.po | 43 ++++++++++++++++++++++++------------- locale/fil.po | 35 ++++++++++++++++++------------ locale/fr.po | 46 +++++++++++++++++++++++++++------------- locale/hi.po | 32 ++++++++++++++++------------ locale/it_IT.po | 35 ++++++++++++++++++------------ locale/ja.po | 32 ++++++++++++++++------------ locale/ko.po | 32 ++++++++++++++++------------ locale/nl.po | 43 ++++++++++++++++++++++++------------- locale/pl.po | 35 ++++++++++++++++++------------ locale/pt_BR.po | 46 +++++++++++++++++++++++++++------------- locale/sv.po | 43 ++++++++++++++++++++++++------------- locale/zh_Latn_pinyin.po | 40 +++++++++++++++++++++------------- 16 files changed, 367 insertions(+), 231 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 5f80f1f140b6a..9fc91305ee240 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-22 22:54+0530\n" +"POT-Creation-Date: 2021-01-04 12:55-0600\n" "PO-Revision-Date: 2021-01-03 05:29+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -1903,10 +1903,6 @@ msgid "Total data to write is larger than outgoing_packet_length" msgstr "" "Total data yang akan ditulis lebih besar daripada outgoing_packet_length" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "TouchAlarm not available in light sleep" -msgstr "" - #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "Traceback (bagian terakhir dari panggilan terkini):\n" @@ -2550,6 +2546,10 @@ msgstr "" msgid "data must be of equal length" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "data type not understood" +msgstr "" + #: py/parsenum.c msgid "decimal numbers not supported" msgstr "" @@ -2860,7 +2860,7 @@ msgid "input and output shapes are not compatible" msgstr "" #: extmod/ulab/code/ulab_create.c -msgid "input argument must be an integer or a 2-tuple" +msgid "input argument must be an integer, a tuple, or a list" msgstr "" #: extmod/ulab/code/fft/fft.c @@ -3103,6 +3103,10 @@ msgstr "" msgid "maxiter should be > 0" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "median argument must be an ndarray" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3333,10 +3337,6 @@ msgstr "" msgid "operation is implemented for 1D Boolean arrays only" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "operation is not implemented for flattened array" -msgstr "" - #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "" @@ -3681,6 +3681,10 @@ msgstr "" msgid "too many arguments provided with the given format" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "too many dimensions" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "too many indices" msgstr "" @@ -3690,6 +3694,10 @@ msgstr "" msgid "too many values to unpack (expected %d)" msgstr "" +#: extmod/ulab/code/approx/approx.c +msgid "trapz is defined for 1D arrays" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays of equal length" msgstr "" @@ -3698,10 +3706,6 @@ msgstr "" msgid "trigger level must be 0 or 1" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "tuple index out of range" -msgstr "" - #: py/obj.c msgid "tuple/list has wrong length" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index 88380fbea6262..c72a781bee536 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-22 22:54+0530\n" +"POT-Creation-Date: 2021-01-04 12:55-0600\n" "PO-Revision-Date: 2020-12-04 18:33+0000\n" "Last-Translator: vkuthan \n" "Language-Team: LANGUAGE \n" @@ -1865,10 +1865,6 @@ msgstr "" msgid "Total data to write is larger than outgoing_packet_length" msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "TouchAlarm not available in light sleep" -msgstr "" - #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "" @@ -2504,6 +2500,10 @@ msgstr "" msgid "data must be of equal length" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "data type not understood" +msgstr "" + #: py/parsenum.c msgid "decimal numbers not supported" msgstr "" @@ -2814,7 +2814,7 @@ msgid "input and output shapes are not compatible" msgstr "" #: extmod/ulab/code/ulab_create.c -msgid "input argument must be an integer or a 2-tuple" +msgid "input argument must be an integer, a tuple, or a list" msgstr "" #: extmod/ulab/code/fft/fft.c @@ -3057,6 +3057,10 @@ msgstr "" msgid "maxiter should be > 0" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "median argument must be an ndarray" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3286,10 +3290,6 @@ msgstr "" msgid "operation is implemented for 1D Boolean arrays only" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "operation is not implemented for flattened array" -msgstr "" - #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "" @@ -3633,6 +3633,10 @@ msgstr "" msgid "too many arguments provided with the given format" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "too many dimensions" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "too many indices" msgstr "" @@ -3642,6 +3646,10 @@ msgstr "" msgid "too many values to unpack (expected %d)" msgstr "" +#: extmod/ulab/code/approx/approx.c +msgid "trapz is defined for 1D arrays" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays of equal length" msgstr "" @@ -3650,10 +3658,6 @@ msgstr "" msgid "trigger level must be 0 or 1" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "tuple index out of range" -msgstr "" - #: py/obj.c msgid "tuple/list has wrong length" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 39e1071f90c90..0dd71199938ed 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-22 22:54+0530\n" +"POT-Creation-Date: 2021-01-04 12:55-0600\n" "PO-Revision-Date: 2020-11-26 03:11+0000\n" "Last-Translator: Daniel Bravo Darriba \n" "Language: de_DE\n" @@ -1905,10 +1905,6 @@ msgstr "" "Die Gesamtzahl der zu schreibenden Daten ist größer als " "outgoing_packet_length" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "TouchAlarm not available in light sleep" -msgstr "" - #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "Zurückverfolgung (jüngste Aufforderung zuletzt):\n" @@ -2569,6 +2565,10 @@ msgstr "" msgid "data must be of equal length" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "data type not understood" +msgstr "" + #: py/parsenum.c msgid "decimal numbers not supported" msgstr "Dezimalzahlen nicht unterstützt" @@ -2882,8 +2882,8 @@ msgid "input and output shapes are not compatible" msgstr "" #: extmod/ulab/code/ulab_create.c -msgid "input argument must be an integer or a 2-tuple" -msgstr "Das Eingabeargument muss eine Ganzzahl oder ein 2-Tupel sein" +msgid "input argument must be an integer, a tuple, or a list" +msgstr "" #: extmod/ulab/code/fft/fft.c msgid "input array length must be power of 2" @@ -3131,6 +3131,10 @@ msgstr "" msgid "maxiter should be > 0" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "median argument must be an ndarray" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3362,10 +3366,6 @@ msgstr "Operanden konnten nicht zusammen gesendet werden" msgid "operation is implemented for 1D Boolean arrays only" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "operation is not implemented for flattened array" -msgstr "" - #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "Die Operation ist für ndarrays nicht implementiert" @@ -3714,6 +3714,10 @@ msgstr "" msgid "too many arguments provided with the given format" msgstr "zu viele Argumente mit dem angegebenen Format" +#: extmod/ulab/code/ulab_create.c +msgid "too many dimensions" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "too many indices" msgstr "zu viele Indizes" @@ -3723,6 +3727,10 @@ msgstr "zu viele Indizes" msgid "too many values to unpack (expected %d)" msgstr "zu viele Werte zum Auspacken (erwartet %d)" +#: extmod/ulab/code/approx/approx.c +msgid "trapz is defined for 1D arrays" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays of equal length" msgstr "" @@ -3731,10 +3739,6 @@ msgstr "" msgid "trigger level must be 0 or 1" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "tuple index out of range" -msgstr "Tupelindex außerhalb des Bereichs" - #: py/obj.c msgid "tuple/list has wrong length" msgstr "tupel/list hat falsche Länge" @@ -3953,6 +3957,12 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "input argument must be an integer or a 2-tuple" +#~ msgstr "Das Eingabeargument muss eine Ganzzahl oder ein 2-Tupel sein" + +#~ msgid "tuple index out of range" +#~ msgstr "Tupelindex außerhalb des Bereichs" + #~ msgid "" #~ "\n" #~ "Code done running. Waiting for reload.\n" diff --git a/locale/el.po b/locale/el.po index 21a0942a6baa8..acf4241d19835 100644 --- a/locale/el.po +++ b/locale/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-22 22:54+0530\n" +"POT-Creation-Date: 2021-01-04 12:55-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -1862,10 +1862,6 @@ msgstr "" msgid "Total data to write is larger than outgoing_packet_length" msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "TouchAlarm not available in light sleep" -msgstr "" - #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "" @@ -2501,6 +2497,10 @@ msgstr "" msgid "data must be of equal length" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "data type not understood" +msgstr "" + #: py/parsenum.c msgid "decimal numbers not supported" msgstr "" @@ -2811,7 +2811,7 @@ msgid "input and output shapes are not compatible" msgstr "" #: extmod/ulab/code/ulab_create.c -msgid "input argument must be an integer or a 2-tuple" +msgid "input argument must be an integer, a tuple, or a list" msgstr "" #: extmod/ulab/code/fft/fft.c @@ -3054,6 +3054,10 @@ msgstr "" msgid "maxiter should be > 0" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "median argument must be an ndarray" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3283,10 +3287,6 @@ msgstr "" msgid "operation is implemented for 1D Boolean arrays only" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "operation is not implemented for flattened array" -msgstr "" - #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "" @@ -3630,6 +3630,10 @@ msgstr "" msgid "too many arguments provided with the given format" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "too many dimensions" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "too many indices" msgstr "" @@ -3639,6 +3643,10 @@ msgstr "" msgid "too many values to unpack (expected %d)" msgstr "" +#: extmod/ulab/code/approx/approx.c +msgid "trapz is defined for 1D arrays" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays of equal length" msgstr "" @@ -3647,10 +3655,6 @@ msgstr "" msgid "trigger level must be 0 or 1" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "tuple index out of range" -msgstr "" - #: py/obj.c msgid "tuple/list has wrong length" msgstr "" diff --git a/locale/es.po b/locale/es.po index bac7d2840532a..90fbc5631b5e7 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-12-22 22:54+0530\n" +"POT-Creation-Date: 2021-01-04 12:55-0600\n" "PO-Revision-Date: 2020-12-30 22:25+0000\n" "Last-Translator: Hugo Dahl \n" "Language-Team: \n" @@ -1912,10 +1912,6 @@ msgid "Total data to write is larger than outgoing_packet_length" msgstr "" "Los datos totales a escribir son más grandes que outgoing_packet_length" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "TouchAlarm not available in light sleep" -msgstr "" - #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "Traceback (ultima llamada reciente):\n" @@ -2567,6 +2563,10 @@ msgstr "los datos deben permitir iteración" msgid "data must be of equal length" msgstr "los datos deben ser de igual tamaño" +#: extmod/ulab/code/ndarray.c +msgid "data type not understood" +msgstr "" + #: py/parsenum.c msgid "decimal numbers not supported" msgstr "números decimales no soportados" @@ -2879,8 +2879,8 @@ msgid "input and output shapes are not compatible" msgstr "Formas de entrada y salida no son compactibles" #: extmod/ulab/code/ulab_create.c -msgid "input argument must be an integer or a 2-tuple" -msgstr "el argumento de entrada debe ser un entero o una tupla de par" +msgid "input argument must be an integer, a tuple, or a list" +msgstr "" #: extmod/ulab/code/fft/fft.c msgid "input array length must be power of 2" @@ -3125,6 +3125,10 @@ msgstr "maxiter tiene que ser > 0" msgid "maxiter should be > 0" msgstr "maxiter debe ser > 0" +#: extmod/ulab/code/numerical/numerical.c +msgid "median argument must be an ndarray" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3357,10 +3361,6 @@ msgstr "los operandos no se pueden transmitir juntos" msgid "operation is implemented for 1D Boolean arrays only" msgstr "operación solo está implementada para arrays booleanos de 1D" -#: extmod/ulab/code/numerical/numerical.c -msgid "operation is not implemented for flattened array" -msgstr "operación no está implementada para arrays aplanados" - #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "la operación no está implementada para ndarrays" @@ -3707,6 +3707,10 @@ msgstr "tobytes solo pueden ser invocados por arrays densos" msgid "too many arguments provided with the given format" msgstr "demasiados argumentos provistos con el formato dado" +#: extmod/ulab/code/ulab_create.c +msgid "too many dimensions" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "too many indices" msgstr "demasiados índices" @@ -3716,6 +3720,10 @@ msgstr "demasiados índices" msgid "too many values to unpack (expected %d)" msgstr "demasiados valores para descomprimir (%d esperado)" +#: extmod/ulab/code/approx/approx.c +msgid "trapz is defined for 1D arrays" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays of equal length" msgstr "trapz está definido para arreglos 1D de igual tamaño" @@ -3724,10 +3732,6 @@ msgstr "trapz está definido para arreglos 1D de igual tamaño" msgid "trigger level must be 0 or 1" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "tuple index out of range" -msgstr "tuple index fuera de rango" - #: py/obj.c msgid "tuple/list has wrong length" msgstr "tupla/lista tiene una longitud incorrecta" @@ -3942,6 +3946,15 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "input argument must be an integer or a 2-tuple" +#~ msgstr "el argumento de entrada debe ser un entero o una tupla de par" + +#~ msgid "operation is not implemented for flattened array" +#~ msgstr "operación no está implementada para arrays aplanados" + +#~ msgid "tuple index out of range" +#~ msgstr "tuple index fuera de rango" + #~ msgid "" #~ "\n" #~ "Code done running. Waiting for reload.\n" diff --git a/locale/fil.po b/locale/fil.po index 86386cf1f3672..d82731e316121 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-22 22:54+0530\n" +"POT-Creation-Date: 2021-01-04 12:55-0600\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -1882,10 +1882,6 @@ msgstr "" msgid "Total data to write is larger than outgoing_packet_length" msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "TouchAlarm not available in light sleep" -msgstr "" - #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "Traceback (pinakahuling huling tawag): \n" @@ -2538,6 +2534,10 @@ msgstr "" msgid "data must be of equal length" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "data type not understood" +msgstr "" + #: py/parsenum.c msgid "decimal numbers not supported" msgstr "decimal numbers hindi sinusuportahan" @@ -2854,7 +2854,7 @@ msgid "input and output shapes are not compatible" msgstr "" #: extmod/ulab/code/ulab_create.c -msgid "input argument must be an integer or a 2-tuple" +msgid "input argument must be an integer, a tuple, or a list" msgstr "" #: extmod/ulab/code/fft/fft.c @@ -3101,6 +3101,10 @@ msgstr "" msgid "maxiter should be > 0" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "median argument must be an ndarray" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3331,10 +3335,6 @@ msgstr "" msgid "operation is implemented for 1D Boolean arrays only" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "operation is not implemented for flattened array" -msgstr "" - #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "" @@ -3683,6 +3683,10 @@ msgstr "" msgid "too many arguments provided with the given format" msgstr "masyadong maraming mga argumento na ibinigay sa ibinigay na format" +#: extmod/ulab/code/ulab_create.c +msgid "too many dimensions" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "too many indices" msgstr "" @@ -3692,6 +3696,10 @@ msgstr "" msgid "too many values to unpack (expected %d)" msgstr "masyadong maraming values para i-unpact (umaasa ng %d)" +#: extmod/ulab/code/approx/approx.c +msgid "trapz is defined for 1D arrays" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays of equal length" msgstr "" @@ -3700,10 +3708,6 @@ msgstr "" msgid "trigger level must be 0 or 1" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "tuple index out of range" -msgstr "indeks ng tuple wala sa sakop" - #: py/obj.c msgid "tuple/list has wrong length" msgstr "mali ang haba ng tuple/list" @@ -3920,6 +3924,9 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "tuple index out of range" +#~ msgstr "indeks ng tuple wala sa sakop" + #~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." #~ msgstr "" #~ "Pindutin ang anumang key upang pumasok sa REPL. Gamitin ang CTRL-D upang " diff --git a/locale/fr.po b/locale/fr.po index c25da7888ff96..187ee6f92d869 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-22 22:54+0530\n" +"POT-Creation-Date: 2021-01-04 12:55-0600\n" "PO-Revision-Date: 2021-01-01 04:29+0000\n" "Last-Translator: Hugo Dahl \n" "Language: fr\n" @@ -1931,10 +1931,6 @@ msgid "Total data to write is larger than outgoing_packet_length" msgstr "" "Le nombre total de données à écrire est supérieur à outgoing_packet_length" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "TouchAlarm not available in light sleep" -msgstr "TouchAlarm n'est pas disponible en mode someil léger" - #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "Traceback (appels les plus récents en dernier) :\n" @@ -2597,6 +2593,10 @@ msgstr "les données doivent être les objets iterables" msgid "data must be of equal length" msgstr "les données doivent être de longueur égale" +#: extmod/ulab/code/ndarray.c +msgid "data type not understood" +msgstr "" + #: py/parsenum.c msgid "decimal numbers not supported" msgstr "nombres décimaux non supportés" @@ -2912,8 +2912,8 @@ msgid "input and output shapes are not compatible" msgstr "les formes d'entrée et de sortie ne sont pas compatibles" #: extmod/ulab/code/ulab_create.c -msgid "input argument must be an integer or a 2-tuple" -msgstr "l'argument d'entrée doit être un entier ou un tuple 2" +msgid "input argument must be an integer, a tuple, or a list" +msgstr "" #: extmod/ulab/code/fft/fft.c msgid "input array length must be power of 2" @@ -3159,6 +3159,10 @@ msgstr "maxiter doit être > 0" msgid "maxiter should be > 0" msgstr "maxiter devrait être > 0" +#: extmod/ulab/code/numerical/numerical.c +msgid "median argument must be an ndarray" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3390,10 +3394,6 @@ msgstr "les opérandes ne pouvaient pas être diffusés ensemble" msgid "operation is implemented for 1D Boolean arrays only" msgstr "opération implémentée que pour des tableaux 1D booléennes" -#: extmod/ulab/code/numerical/numerical.c -msgid "operation is not implemented for flattened array" -msgstr "l'opération n'est pas implémentée pour un tableau applatit" - #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "l'opération n'est pas implémentée sur les ndarrays" @@ -3743,6 +3743,10 @@ msgstr "tobytes ne peut être appelé que pour des tableaux dense" msgid "too many arguments provided with the given format" msgstr "trop d'arguments fournis avec ce format" +#: extmod/ulab/code/ulab_create.c +msgid "too many dimensions" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "too many indices" msgstr "trop d'indices" @@ -3752,6 +3756,10 @@ msgstr "trop d'indices" msgid "too many values to unpack (expected %d)" msgstr "trop de valeur à dégrouper (%d attendues)" +#: extmod/ulab/code/approx/approx.c +msgid "trapz is defined for 1D arrays" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays of equal length" msgstr "trapz n'est défini que pour des tableaux 1D de longueur égale" @@ -3760,10 +3768,6 @@ msgstr "trapz n'est défini que pour des tableaux 1D de longueur égale" msgid "trigger level must be 0 or 1" msgstr "niveau du déclencheur doit être 0 ou 1" -#: extmod/ulab/code/linalg/linalg.c -msgid "tuple index out of range" -msgstr "index du tuple hors de portée" - #: py/obj.c msgid "tuple/list has wrong length" msgstr "tuple/liste a une mauvaise longueur" @@ -3978,6 +3982,18 @@ msgstr "zi doit être de type float" msgid "zi must be of shape (n_section, 2)" msgstr "zi doit être de forme (n_section, 2)" +#~ msgid "TouchAlarm not available in light sleep" +#~ msgstr "TouchAlarm n'est pas disponible en mode someil léger" + +#~ msgid "input argument must be an integer or a 2-tuple" +#~ msgstr "l'argument d'entrée doit être un entier ou un tuple 2" + +#~ msgid "operation is not implemented for flattened array" +#~ msgstr "l'opération n'est pas implémentée pour un tableau applatit" + +#~ msgid "tuple index out of range" +#~ msgstr "index du tuple hors de portée" + #~ msgid "" #~ "\n" #~ "Code done running. Waiting for reload.\n" diff --git a/locale/hi.po b/locale/hi.po index 34d0238f6b895..ba82ca8958f62 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-22 22:54+0530\n" +"POT-Creation-Date: 2021-01-04 12:55-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -1862,10 +1862,6 @@ msgstr "" msgid "Total data to write is larger than outgoing_packet_length" msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "TouchAlarm not available in light sleep" -msgstr "" - #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "" @@ -2501,6 +2497,10 @@ msgstr "" msgid "data must be of equal length" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "data type not understood" +msgstr "" + #: py/parsenum.c msgid "decimal numbers not supported" msgstr "" @@ -2811,7 +2811,7 @@ msgid "input and output shapes are not compatible" msgstr "" #: extmod/ulab/code/ulab_create.c -msgid "input argument must be an integer or a 2-tuple" +msgid "input argument must be an integer, a tuple, or a list" msgstr "" #: extmod/ulab/code/fft/fft.c @@ -3054,6 +3054,10 @@ msgstr "" msgid "maxiter should be > 0" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "median argument must be an ndarray" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3283,10 +3287,6 @@ msgstr "" msgid "operation is implemented for 1D Boolean arrays only" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "operation is not implemented for flattened array" -msgstr "" - #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "" @@ -3630,6 +3630,10 @@ msgstr "" msgid "too many arguments provided with the given format" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "too many dimensions" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "too many indices" msgstr "" @@ -3639,6 +3643,10 @@ msgstr "" msgid "too many values to unpack (expected %d)" msgstr "" +#: extmod/ulab/code/approx/approx.c +msgid "trapz is defined for 1D arrays" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays of equal length" msgstr "" @@ -3647,10 +3655,6 @@ msgstr "" msgid "trigger level must be 0 or 1" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "tuple index out of range" -msgstr "" - #: py/obj.c msgid "tuple/list has wrong length" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index dbefb87a8beff..c0b2aa931f8a1 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-22 22:54+0530\n" +"POT-Creation-Date: 2021-01-04 12:55-0600\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -1894,10 +1894,6 @@ msgstr "Troppi schermi" msgid "Total data to write is larger than outgoing_packet_length" msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "TouchAlarm not available in light sleep" -msgstr "" - #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "Traceback (chiamata più recente per ultima):\n" @@ -2541,6 +2537,10 @@ msgstr "" msgid "data must be of equal length" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "data type not understood" +msgstr "" + #: py/parsenum.c msgid "decimal numbers not supported" msgstr "numeri decimali non supportati" @@ -2856,7 +2856,7 @@ msgid "input and output shapes are not compatible" msgstr "" #: extmod/ulab/code/ulab_create.c -msgid "input argument must be an integer or a 2-tuple" +msgid "input argument must be an integer, a tuple, or a list" msgstr "" #: extmod/ulab/code/fft/fft.c @@ -3104,6 +3104,10 @@ msgstr "" msgid "maxiter should be > 0" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "median argument must be an ndarray" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3337,10 +3341,6 @@ msgstr "" msgid "operation is implemented for 1D Boolean arrays only" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "operation is not implemented for flattened array" -msgstr "" - #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "" @@ -3691,6 +3691,10 @@ msgstr "" msgid "too many arguments provided with the given format" msgstr "troppi argomenti forniti con il formato specificato" +#: extmod/ulab/code/ulab_create.c +msgid "too many dimensions" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "too many indices" msgstr "" @@ -3700,6 +3704,10 @@ msgstr "" msgid "too many values to unpack (expected %d)" msgstr "troppi valori da scompattare (%d attesi)" +#: extmod/ulab/code/approx/approx.c +msgid "trapz is defined for 1D arrays" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays of equal length" msgstr "" @@ -3708,10 +3716,6 @@ msgstr "" msgid "trigger level must be 0 or 1" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "tuple index out of range" -msgstr "indice della tupla fuori intervallo" - #: py/obj.c msgid "tuple/list has wrong length" msgstr "tupla/lista ha la lunghezza sbagliata" @@ -3928,6 +3932,9 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "tuple index out of range" +#~ msgstr "indice della tupla fuori intervallo" + #~ msgid "Press any key to enter the REPL. Use CTRL-D to reload." #~ msgstr "" #~ "Premi un qualunque tasto per entrare nel REPL. Usa CTRL-D per ricaricare." diff --git a/locale/ja.po b/locale/ja.po index 6ccdc158e061b..770752e995365 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-22 22:54+0530\n" +"POT-Creation-Date: 2021-01-04 12:55-0600\n" "PO-Revision-Date: 2020-11-27 18:34+0000\n" "Last-Translator: sporeball \n" "Language-Team: none\n" @@ -1884,10 +1884,6 @@ msgstr "" msgid "Total data to write is larger than outgoing_packet_length" msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "TouchAlarm not available in light sleep" -msgstr "" - #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "トレースバック(最新の呼び出しが末尾):\n" @@ -2526,6 +2522,10 @@ msgstr "dataはイテレート可能でなければなりません" msgid "data must be of equal length" msgstr "dataは同じ長さでなければなりません" +#: extmod/ulab/code/ndarray.c +msgid "data type not understood" +msgstr "" + #: py/parsenum.c msgid "decimal numbers not supported" msgstr "" @@ -2839,7 +2839,7 @@ msgid "input and output shapes are not compatible" msgstr "" #: extmod/ulab/code/ulab_create.c -msgid "input argument must be an integer or a 2-tuple" +msgid "input argument must be an integer, a tuple, or a list" msgstr "" #: extmod/ulab/code/fft/fft.c @@ -3082,6 +3082,10 @@ msgstr "" msgid "maxiter should be > 0" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "median argument must be an ndarray" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3311,10 +3315,6 @@ msgstr "" msgid "operation is implemented for 1D Boolean arrays only" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "operation is not implemented for flattened array" -msgstr "" - #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "この演算はndarray上で実装されていません" @@ -3661,6 +3661,10 @@ msgstr "" msgid "too many arguments provided with the given format" msgstr "指定された書式に対して引数が多すぎます" +#: extmod/ulab/code/ulab_create.c +msgid "too many dimensions" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "too many indices" msgstr "インデクスが多すぎます" @@ -3670,6 +3674,10 @@ msgstr "インデクスが多すぎます" msgid "too many values to unpack (expected %d)" msgstr "アンパックする値が多すぎます (%d個を期待)" +#: extmod/ulab/code/approx/approx.c +msgid "trapz is defined for 1D arrays" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays of equal length" msgstr "trapzは同じ長さの1次元arrayに対して定義されています" @@ -3678,10 +3686,6 @@ msgstr "trapzは同じ長さの1次元arrayに対して定義されています" msgid "trigger level must be 0 or 1" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "tuple index out of range" -msgstr "" - #: py/obj.c msgid "tuple/list has wrong length" msgstr "タプル/リストの長さが正しくありません" diff --git a/locale/ko.po b/locale/ko.po index c2272af7b0910..97ede047a6012 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-22 22:54+0530\n" +"POT-Creation-Date: 2021-01-04 12:55-0600\n" "PO-Revision-Date: 2020-10-05 12:12+0000\n" "Last-Translator: Michal Čihař \n" "Language-Team: LANGUAGE \n" @@ -1865,10 +1865,6 @@ msgstr "" msgid "Total data to write is larger than outgoing_packet_length" msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "TouchAlarm not available in light sleep" -msgstr "" - #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "" @@ -2505,6 +2501,10 @@ msgstr "" msgid "data must be of equal length" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "data type not understood" +msgstr "" + #: py/parsenum.c msgid "decimal numbers not supported" msgstr "" @@ -2815,7 +2815,7 @@ msgid "input and output shapes are not compatible" msgstr "" #: extmod/ulab/code/ulab_create.c -msgid "input argument must be an integer or a 2-tuple" +msgid "input argument must be an integer, a tuple, or a list" msgstr "" #: extmod/ulab/code/fft/fft.c @@ -3058,6 +3058,10 @@ msgstr "" msgid "maxiter should be > 0" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "median argument must be an ndarray" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3287,10 +3291,6 @@ msgstr "" msgid "operation is implemented for 1D Boolean arrays only" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "operation is not implemented for flattened array" -msgstr "" - #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "" @@ -3634,6 +3634,10 @@ msgstr "" msgid "too many arguments provided with the given format" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "too many dimensions" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "too many indices" msgstr "" @@ -3643,6 +3647,10 @@ msgstr "" msgid "too many values to unpack (expected %d)" msgstr "" +#: extmod/ulab/code/approx/approx.c +msgid "trapz is defined for 1D arrays" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays of equal length" msgstr "" @@ -3651,10 +3659,6 @@ msgstr "" msgid "trigger level must be 0 or 1" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "tuple index out of range" -msgstr "" - #: py/obj.c msgid "tuple/list has wrong length" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 73aeade01cd73..3fce13212062f 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-22 22:54+0530\n" +"POT-Creation-Date: 2021-01-04 12:55-0600\n" "PO-Revision-Date: 2020-12-23 20:14+0000\n" "Last-Translator: _fonzlate \n" "Language-Team: none\n" @@ -1904,10 +1904,6 @@ msgstr "Teveel beeldschermen" msgid "Total data to write is larger than outgoing_packet_length" msgstr "Totale data om te schrijven is groter dan outgoing_packet_length" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "TouchAlarm not available in light sleep" -msgstr "" - #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "Traceback (meest recente call laatst):\n" @@ -2556,6 +2552,10 @@ msgstr "data moet itereerbaar zijn" msgid "data must be of equal length" msgstr "data moet van gelijke lengte zijn" +#: extmod/ulab/code/ndarray.c +msgid "data type not understood" +msgstr "" + #: py/parsenum.c msgid "decimal numbers not supported" msgstr "decimale getallen zijn niet ondersteund" @@ -2869,8 +2869,8 @@ msgid "input and output shapes are not compatible" msgstr "in- en uitvoervormen zijn niet compatibel" #: extmod/ulab/code/ulab_create.c -msgid "input argument must be an integer or a 2-tuple" -msgstr "invoerargument moet een integer of 2-tuple zijn" +msgid "input argument must be an integer, a tuple, or a list" +msgstr "" #: extmod/ulab/code/fft/fft.c msgid "input array length must be power of 2" @@ -3115,6 +3115,10 @@ msgstr "maxiter moet groter dan 0 zijn" msgid "maxiter should be > 0" msgstr "maxiter moet groter dan 0 zijn" +#: extmod/ulab/code/numerical/numerical.c +msgid "median argument must be an ndarray" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3344,10 +3348,6 @@ msgstr "operands konden niet samen verzonden worden" msgid "operation is implemented for 1D Boolean arrays only" msgstr "operatie is alleen geïmplementeerd voor 1D Booleaanse arrays" -#: extmod/ulab/code/numerical/numerical.c -msgid "operation is not implemented for flattened array" -msgstr "operatie is niet geïmplementeerd voor vlakke array" - #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "bewerking is voor ndarrays niet geïmplementeerd" @@ -3694,6 +3694,10 @@ msgstr "tobytes kunnen alleen ingeroepen worden voor gesloten arrays" msgid "too many arguments provided with the given format" msgstr "te veel argumenten opgegeven bij dit formaat" +#: extmod/ulab/code/ulab_create.c +msgid "too many dimensions" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "too many indices" msgstr "te veel indices" @@ -3703,6 +3707,10 @@ msgstr "te veel indices" msgid "too many values to unpack (expected %d)" msgstr "te veel waarden om uit te pakken (%d verwacht)" +#: extmod/ulab/code/approx/approx.c +msgid "trapz is defined for 1D arrays" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays of equal length" msgstr "trapz is gedefinieerd voor eendimensionale arrays van gelijke lengte" @@ -3711,10 +3719,6 @@ msgstr "trapz is gedefinieerd voor eendimensionale arrays van gelijke lengte" msgid "trigger level must be 0 or 1" msgstr "triggerniveau moet 0 of 1 zijn" -#: extmod/ulab/code/linalg/linalg.c -msgid "tuple index out of range" -msgstr "tuple index buiten bereik" - #: py/obj.c msgid "tuple/list has wrong length" msgstr "tuple of lijst heeft onjuiste lengte" @@ -3929,6 +3933,15 @@ msgstr "zi moet van type float zijn" msgid "zi must be of shape (n_section, 2)" msgstr "zi moet vorm (n_section, 2) hebben" +#~ msgid "input argument must be an integer or a 2-tuple" +#~ msgstr "invoerargument moet een integer of 2-tuple zijn" + +#~ msgid "operation is not implemented for flattened array" +#~ msgstr "operatie is niet geïmplementeerd voor vlakke array" + +#~ msgid "tuple index out of range" +#~ msgstr "tuple index buiten bereik" + #~ msgid "" #~ "\n" #~ "Code done running. Waiting for reload.\n" diff --git a/locale/pl.po b/locale/pl.po index deefb878b8ccc..80d5cf90bdbca 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-22 22:54+0530\n" +"POT-Creation-Date: 2021-01-04 12:55-0600\n" "PO-Revision-Date: 2020-12-02 20:29+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" @@ -1876,10 +1876,6 @@ msgstr "Zbyt wiele wyświetlaczy" msgid "Total data to write is larger than outgoing_packet_length" msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "TouchAlarm not available in light sleep" -msgstr "" - #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "Ślad wyjątku (najnowsze wywołanie na końcu):\n" @@ -2521,6 +2517,10 @@ msgstr "" msgid "data must be of equal length" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "data type not understood" +msgstr "" + #: py/parsenum.c msgid "decimal numbers not supported" msgstr "liczby dziesiętne nieobsługiwane" @@ -2832,7 +2832,7 @@ msgid "input and output shapes are not compatible" msgstr "" #: extmod/ulab/code/ulab_create.c -msgid "input argument must be an integer or a 2-tuple" +msgid "input argument must be an integer, a tuple, or a list" msgstr "" #: extmod/ulab/code/fft/fft.c @@ -3075,6 +3075,10 @@ msgstr "" msgid "maxiter should be > 0" msgstr "" +#: extmod/ulab/code/numerical/numerical.c +msgid "median argument must be an ndarray" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3304,10 +3308,6 @@ msgstr "operandy nie mogły być rozgłaszane razem" msgid "operation is implemented for 1D Boolean arrays only" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "operation is not implemented for flattened array" -msgstr "" - #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "" @@ -3653,6 +3653,10 @@ msgstr "" msgid "too many arguments provided with the given format" msgstr "zbyt wiele argumentów podanych dla tego formatu" +#: extmod/ulab/code/ulab_create.c +msgid "too many dimensions" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "too many indices" msgstr "zbyt wiele indeksów" @@ -3662,6 +3666,10 @@ msgstr "zbyt wiele indeksów" msgid "too many values to unpack (expected %d)" msgstr "zbyt wiele wartości do rozpakowania (oczekiwano %d)" +#: extmod/ulab/code/approx/approx.c +msgid "trapz is defined for 1D arrays" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays of equal length" msgstr "" @@ -3670,10 +3678,6 @@ msgstr "" msgid "trigger level must be 0 or 1" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "tuple index out of range" -msgstr "indeks krotki poza zakresem" - #: py/obj.c msgid "tuple/list has wrong length" msgstr "krotka/lista ma złą długość" @@ -3888,6 +3892,9 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "tuple index out of range" +#~ msgstr "indeks krotki poza zakresem" + #~ msgid "" #~ "\n" #~ "Code done running. Waiting for reload.\n" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 73922b3d353f6..43c5626b27fcd 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-22 22:54+0530\n" +"POT-Creation-Date: 2021-01-04 12:55-0600\n" "PO-Revision-Date: 2021-01-01 04:29+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -1927,10 +1927,6 @@ msgid "Total data to write is larger than outgoing_packet_length" msgstr "" "O total dos dados que serão gravados é maior que outgoing_packet_length" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "TouchAlarm not available in light sleep" -msgstr "O TouchAlarm não está disponívle no modo light sleep" - #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "Traceback (a última chamada mais recente):\n" @@ -2584,6 +2580,10 @@ msgstr "os dados devem ser iteráveis" msgid "data must be of equal length" msgstr "os dados devem ser de igual comprimento" +#: extmod/ulab/code/ndarray.c +msgid "data type not understood" +msgstr "" + #: py/parsenum.c msgid "decimal numbers not supported" msgstr "os números decimais não são compatíveis" @@ -2897,8 +2897,8 @@ msgid "input and output shapes are not compatible" msgstr "as formas de entrada e saída não são compatíveis" #: extmod/ulab/code/ulab_create.c -msgid "input argument must be an integer or a 2-tuple" -msgstr "o argumento da entrada deve ser um número inteiro ou uma tupla de 2" +msgid "input argument must be an integer, a tuple, or a list" +msgstr "" #: extmod/ulab/code/fft/fft.c msgid "input array length must be power of 2" @@ -3143,6 +3143,10 @@ msgstr "maxiter deve ser > 0" msgid "maxiter should be > 0" msgstr "maxiter pode ser > 0" +#: extmod/ulab/code/numerical/numerical.c +msgid "median argument must be an ndarray" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3375,10 +3379,6 @@ msgstr "os operandos não puderam ser transmitidos juntos" msgid "operation is implemented for 1D Boolean arrays only" msgstr "A operação é implementada apenas para matrizes booleanas 1D" -#: extmod/ulab/code/numerical/numerical.c -msgid "operation is not implemented for flattened array" -msgstr "a operação não é implementada para a matriz achatada" - #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "a operação não foi implementada nos ndarrays" @@ -3728,6 +3728,10 @@ msgstr "os tobytes podem ser invocados apenas nas matrizes densas" msgid "too many arguments provided with the given format" msgstr "Muitos argumentos fornecidos com o formato dado" +#: extmod/ulab/code/ulab_create.c +msgid "too many dimensions" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "too many indices" msgstr "índices demais" @@ -3737,6 +3741,10 @@ msgstr "índices demais" msgid "too many values to unpack (expected %d)" msgstr "valores demais para descompactar (esperado %d)" +#: extmod/ulab/code/approx/approx.c +msgid "trapz is defined for 1D arrays" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays of equal length" msgstr "o trapz está definido para 1D arrays de igual tamanho" @@ -3745,10 +3753,6 @@ msgstr "o trapz está definido para 1D arrays de igual tamanho" msgid "trigger level must be 0 or 1" msgstr "nível do gatilho deve ser 0 ou 1" -#: extmod/ulab/code/linalg/linalg.c -msgid "tuple index out of range" -msgstr "o índice da tupla está fora do intervalo" - #: py/obj.c msgid "tuple/list has wrong length" msgstr "a tupla/lista está com tamanho incorreto" @@ -3963,6 +3967,18 @@ msgstr "zi deve ser de um tipo float" msgid "zi must be of shape (n_section, 2)" msgstr "zi deve estar na forma (n_section, 2)" +#~ msgid "TouchAlarm not available in light sleep" +#~ msgstr "O TouchAlarm não está disponívle no modo light sleep" + +#~ msgid "input argument must be an integer or a 2-tuple" +#~ msgstr "o argumento da entrada deve ser um número inteiro ou uma tupla de 2" + +#~ msgid "operation is not implemented for flattened array" +#~ msgstr "a operação não é implementada para a matriz achatada" + +#~ msgid "tuple index out of range" +#~ msgstr "o índice da tupla está fora do intervalo" + #~ msgid "" #~ "\n" #~ "Code done running. Waiting for reload.\n" diff --git a/locale/sv.po b/locale/sv.po index 71b1c3a8660bf..c3d8c8a70266a 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-22 22:54+0530\n" +"POT-Creation-Date: 2021-01-04 12:55-0600\n" "PO-Revision-Date: 2020-12-28 17:59+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -1902,10 +1902,6 @@ msgstr "För många displayer" msgid "Total data to write is larger than outgoing_packet_length" msgstr "Total data som ska skrivas är större än outgoing_packet_length" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "TouchAlarm not available in light sleep" -msgstr "" - #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "Traceback (senaste anrop):\n" @@ -2551,6 +2547,10 @@ msgstr "data måste vara itererbar" msgid "data must be of equal length" msgstr "data måste vara av samma längd" +#: extmod/ulab/code/ndarray.c +msgid "data type not understood" +msgstr "" + #: py/parsenum.c msgid "decimal numbers not supported" msgstr "decimaltal stöds inte" @@ -2864,8 +2864,8 @@ msgid "input and output shapes are not compatible" msgstr "indata- och utdataformer är inte kompatibla" #: extmod/ulab/code/ulab_create.c -msgid "input argument must be an integer or a 2-tuple" -msgstr "indataargumentet måste vara ett heltal eller en 2-tupel" +msgid "input argument must be an integer, a tuple, or a list" +msgstr "" #: extmod/ulab/code/fft/fft.c msgid "input array length must be power of 2" @@ -3110,6 +3110,10 @@ msgstr "maxiter måste vara > 0" msgid "maxiter should be > 0" msgstr "maxiter bör vara > 0" +#: extmod/ulab/code/numerical/numerical.c +msgid "median argument must be an ndarray" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3339,10 +3343,6 @@ msgstr "operander kan inte sändas tillsammans" msgid "operation is implemented for 1D Boolean arrays only" msgstr "operationen är enbart implementerad för 1D Boolean-matriser" -#: extmod/ulab/code/numerical/numerical.c -msgid "operation is not implemented for flattened array" -msgstr "operationen inte implementeras för tillplattad matris" - #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "åtgärden är inte implementerad för ndarray:er" @@ -3689,6 +3689,10 @@ msgstr "tobyte kan enbart anropas för täta matriser" msgid "too many arguments provided with the given format" msgstr "för många argument för det givna formatet" +#: extmod/ulab/code/ulab_create.c +msgid "too many dimensions" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "too many indices" msgstr "för många index" @@ -3698,6 +3702,10 @@ msgstr "för många index" msgid "too many values to unpack (expected %d)" msgstr "för många värden att packa upp (förväntat %d)" +#: extmod/ulab/code/approx/approx.c +msgid "trapz is defined for 1D arrays" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays of equal length" msgstr "trapz är definierad för 1D-matriser med samma längd" @@ -3706,10 +3714,6 @@ msgstr "trapz är definierad för 1D-matriser med samma längd" msgid "trigger level must be 0 or 1" msgstr "triggernivå måste vara 0 eller 1" -#: extmod/ulab/code/linalg/linalg.c -msgid "tuple index out of range" -msgstr "tupelindex utanför intervallet" - #: py/obj.c msgid "tuple/list has wrong length" msgstr "tupel/lista har fel längd" @@ -3924,6 +3928,15 @@ msgstr "zi måste vara av typ float" msgid "zi must be of shape (n_section, 2)" msgstr "zi måste vara i formen (n_section, 2)" +#~ msgid "input argument must be an integer or a 2-tuple" +#~ msgstr "indataargumentet måste vara ett heltal eller en 2-tupel" + +#~ msgid "operation is not implemented for flattened array" +#~ msgstr "operationen inte implementeras för tillplattad matris" + +#~ msgid "tuple index out of range" +#~ msgstr "tupelindex utanför intervallet" + #~ msgid "" #~ "\n" #~ "Code done running. Waiting for reload.\n" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index b372b067a44d2..596855cf6a7eb 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-22 22:54+0530\n" +"POT-Creation-Date: 2021-01-04 12:55-0600\n" "PO-Revision-Date: 2020-11-19 01:28+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -1892,10 +1892,6 @@ msgstr "Xiǎnshì tài duō" msgid "Total data to write is larger than outgoing_packet_length" msgstr "Yào xiě rù de zǒng shùjù dàyú outgoing_packet_length" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "TouchAlarm not available in light sleep" -msgstr "" - #: py/obj.c msgid "Traceback (most recent call last):\n" msgstr "Traceback (Zuìjìn yīcì dǎ diànhuà):\n" @@ -2543,6 +2539,10 @@ msgstr "shùjù bìxū shì kě diédài de" msgid "data must be of equal length" msgstr "shùjù chángdù bìxū xiāngděng" +#: extmod/ulab/code/ndarray.c +msgid "data type not understood" +msgstr "" + #: py/parsenum.c msgid "decimal numbers not supported" msgstr "bù zhīchí xiǎoshù shù" @@ -2855,8 +2855,8 @@ msgid "input and output shapes are not compatible" msgstr "" #: extmod/ulab/code/ulab_create.c -msgid "input argument must be an integer or a 2-tuple" -msgstr "shūrù cānshù bìxū shì zhěngshù huò 2 yuán zǔ" +msgid "input argument must be an integer, a tuple, or a list" +msgstr "" #: extmod/ulab/code/fft/fft.c msgid "input array length must be power of 2" @@ -3099,6 +3099,10 @@ msgstr "maxiter bì xū > 0" msgid "maxiter should be > 0" msgstr "maxiter yìng wéi > 0" +#: extmod/ulab/code/numerical/numerical.c +msgid "median argument must be an ndarray" +msgstr "" + #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" @@ -3328,10 +3332,6 @@ msgstr "cāozuò shǔ bùnéng yīqǐ guǎngbò" msgid "operation is implemented for 1D Boolean arrays only" msgstr "" -#: extmod/ulab/code/numerical/numerical.c -msgid "operation is not implemented for flattened array" -msgstr "" - #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "cāozuò wèi zài ndarrays shàng shíxiàn" @@ -3677,6 +3677,10 @@ msgstr "" msgid "too many arguments provided with the given format" msgstr "tígōng jǐ dìng géshì de cānshù tài duō" +#: extmod/ulab/code/ulab_create.c +msgid "too many dimensions" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "too many indices" msgstr "suǒyǐn tài duō" @@ -3686,6 +3690,10 @@ msgstr "suǒyǐn tài duō" msgid "too many values to unpack (expected %d)" msgstr "dǎkāi tài duō zhí (yùqí %d)" +#: extmod/ulab/code/approx/approx.c +msgid "trapz is defined for 1D arrays" +msgstr "" + #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays of equal length" msgstr "Trapz shì wèi děng zhǎng de 1D shùzǔ dìngyì de" @@ -3694,10 +3702,6 @@ msgstr "Trapz shì wèi děng zhǎng de 1D shùzǔ dìngyì de" msgid "trigger level must be 0 or 1" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "tuple index out of range" -msgstr "yuán zǔ suǒyǐn chāochū fànwéi" - #: py/obj.c msgid "tuple/list has wrong length" msgstr "yuán zǔ/lièbiǎo chángdù cuòwù" @@ -3912,6 +3916,12 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "input argument must be an integer or a 2-tuple" +#~ msgstr "shūrù cānshù bìxū shì zhěngshù huò 2 yuán zǔ" + +#~ msgid "tuple index out of range" +#~ msgstr "yuán zǔ suǒyǐn chāochū fànwéi" + #~ msgid "" #~ "\n" #~ "Code done running. Waiting for reload.\n" From bbd4de33d1c9b9da8984b68889428cbbeb602612 Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Mon, 4 Jan 2021 15:53:39 -0500 Subject: [PATCH 546/770] Add adafruit_bus_device to CPX builds. --- .../atmel-samd/boards/circuitplayground_express/mpconfigboard.mk | 1 + .../boards/circuitplayground_express_crickit/mpconfigboard.mk | 1 + .../boards/circuitplayground_express_displayio/mpconfigboard.mk | 1 + 3 files changed, 3 insertions(+) diff --git a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk index 5389fc89a5790..13ec9e861cbbf 100644 --- a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk @@ -21,6 +21,7 @@ SUPEROPT_GC = 0 CFLAGS_INLINE_LIMIT = 55 # Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH diff --git a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk index 31e10d736ced3..7aa45eb39e4b6 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk @@ -25,6 +25,7 @@ CFLAGS_INLINE_LIMIT = 50 # Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Crickit FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH diff --git a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk index 36b49b0eef685..3a43093a98cef 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk @@ -26,6 +26,7 @@ SUPEROPT_GC = 0 CFLAGS_INLINE_LIMIT = 55 # Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel From ce55822680b3b4005f370bbd735d50402cd48925 Mon Sep 17 00:00:00 2001 From: DavePutz Date: Mon, 4 Jan 2021 15:50:09 -0600 Subject: [PATCH 547/770] Fix size of memset in board_reset_user_neopixels() --- supervisor/shared/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervisor/shared/board.c b/supervisor/shared/board.c index 30603aa66cc9e..6d648510e715f 100644 --- a/supervisor/shared/board.c +++ b/supervisor/shared/board.c @@ -36,7 +36,7 @@ void board_reset_user_neopixels(const mcu_pin_obj_t* pin, size_t count) { // Turn off on-board NeoPixel string uint8_t empty[count * 3]; - memset(empty, 0, count); + memset(empty, 0, count * 3); digitalio_digitalinout_obj_t neopixel_pin; common_hal_digitalio_digitalinout_construct(&neopixel_pin, pin); common_hal_digitalio_digitalinout_switch_to_output(&neopixel_pin, false, From 90a299bb1e6c80971b576dc51dd50bca6220b6f7 Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Tue, 5 Jan 2021 11:17:09 -0800 Subject: [PATCH 548/770] added //| to (hopefully) get CI to pass --- locale/circuitpython.pot | 6 +++++- shared-bindings/msgpack/ExtType.c | 2 ++ shared-bindings/msgpack/__init__.c | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index cea26c6baca34..578257e2d0bad 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-12-08 09:56-0800\n" +"POT-Creation-Date: 2021-01-05 11:08-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -3438,6 +3438,10 @@ msgstr "" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "" diff --git a/shared-bindings/msgpack/ExtType.c b/shared-bindings/msgpack/ExtType.c index 5dc3d4992ee41..e9ddd32bce560 100644 --- a/shared-bindings/msgpack/ExtType.c +++ b/shared-bindings/msgpack/ExtType.c @@ -61,6 +61,7 @@ STATIC mp_obj_t mod_msgpack_exttype_make_new(const mp_obj_type_t *type, size_t n //| code: int //| """The type code, in range 0~127.""" +//| ... //| STATIC mp_obj_t mod_msgpack_exttype_get_code(mp_obj_t self_in) { mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -88,6 +89,7 @@ const mp_obj_property_t mod_msgpack_exttype_code_obj = { //| data: bytes //| """Data.""" +//| ... //| STATIC mp_obj_t mod_msgpack_exttype_get_data(mp_obj_t self_in) { mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index 5dc45dde2c676..e1b6b8fce6212 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -89,6 +89,7 @@ //| function called for python objects that do not have //| a representation in msgpack format. //| """ +//| ... //| STATIC mp_obj_t mod_msgpack_pack(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_obj, ARG_buffer, ARG_default }; @@ -119,6 +120,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_pack_obj, 1, mod_msgpack_pack); //| :param Optional[bool] use_list: return array as list or tuple (use_list=False). //| :return object: object read from buffer. //| """ +//| ... //| STATIC mp_obj_t mod_msgpack_unpack(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buffer, ARG_ext_hook, ARG_use_list }; From 0057e1dc2cf9e848e7aa616f2b4c82e9f61b936a Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Tue, 5 Jan 2021 02:27:28 +0000 Subject: [PATCH 549/770] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (892 of 892 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 43c5626b27fcd..3c6c5956206f9 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-01-01 04:29+0000\n" +"PO-Revision-Date: 2021-01-05 21:03+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -2582,7 +2582,7 @@ msgstr "os dados devem ser de igual comprimento" #: extmod/ulab/code/ndarray.c msgid "data type not understood" -msgstr "" +msgstr "o tipo do dado não foi compreendido" #: py/parsenum.c msgid "decimal numbers not supported" @@ -2898,7 +2898,7 @@ msgstr "as formas de entrada e saída não são compatíveis" #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer, a tuple, or a list" -msgstr "" +msgstr "argumento da entrada deve ser um número inteiro, uma tupla ou uma lista" #: extmod/ulab/code/fft/fft.c msgid "input array length must be power of 2" @@ -3145,7 +3145,7 @@ msgstr "maxiter pode ser > 0" #: extmod/ulab/code/numerical/numerical.c msgid "median argument must be an ndarray" -msgstr "" +msgstr "o argumento mediano deve ser um ndarray" #: py/runtime.c #, c-format @@ -3730,7 +3730,7 @@ msgstr "Muitos argumentos fornecidos com o formato dado" #: extmod/ulab/code/ulab_create.c msgid "too many dimensions" -msgstr "" +msgstr "dimensões demais" #: extmod/ulab/code/ndarray.c msgid "too many indices" @@ -3743,7 +3743,7 @@ msgstr "valores demais para descompactar (esperado %d)" #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays" -msgstr "" +msgstr "Trapz está definido para arrays 1D" #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays of equal length" From 794327254e4c80a5d3c462b16a82d8ede1c1da6a Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Mon, 4 Jan 2021 21:13:33 +0000 Subject: [PATCH 550/770] Translated using Weblate (Swedish) Currently translated at 100.0% (892 of 892 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index c3d8c8a70266a..6a19dc5ad5552 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2020-12-28 17:59+0000\n" +"PO-Revision-Date: 2021-01-05 21:03+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -21,12 +21,16 @@ msgid "" "\n" "Code done running.\n" msgstr "" +"\n" +"Koden har kört klart.\n" #: main.c msgid "" "\n" "Code stopped by auto-reload.\n" msgstr "" +"\n" +"Koden stoppades av auto-omladdning.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -546,15 +550,16 @@ msgstr "Anropa super().__init__() innan du använder det ursprungliga objektet." #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." -msgstr "" +msgstr "Kan bara larma på RTC-IO från djupsömn." #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on one low pin while others alarm high from deep sleep." msgstr "" +"Kan bara larma från djup sömn på låg för en pinne medan andra larmar på hög." #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on two low pins from deep sleep." -msgstr "" +msgstr "Kan bara larma från djup sömn på två låga pinnar." #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" @@ -591,7 +596,7 @@ msgstr "Det går inte att mata ut båda kanalerna på samma pinne" #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." -msgstr "" +msgstr "Kan bara använda pull på pinne för input." #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." @@ -639,7 +644,7 @@ msgstr "Det går inte att ändra frekvensen på en timer som redan används" #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge. Only level." -msgstr "" +msgstr "Kan inte vakna på nivåskift, enbart nivå." #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." @@ -1509,7 +1514,7 @@ msgstr "Endast ett alarm.time kan ställas in." #: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c msgid "Only one alarm.touch alarm can be set." -msgstr "" +msgstr "Endast ett larm av typ alarm.touch kan ställas in." #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" @@ -1621,7 +1626,7 @@ msgstr "" #: main.c msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" -msgstr "" +msgstr "Fingerar djup sömn tills larm, Ctrl-C eller filskrivning.\n" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2549,7 +2554,7 @@ msgstr "data måste vara av samma längd" #: extmod/ulab/code/ndarray.c msgid "data type not understood" -msgstr "" +msgstr "datatyp inte förstådd" #: py/parsenum.c msgid "decimal numbers not supported" @@ -2865,7 +2870,7 @@ msgstr "indata- och utdataformer är inte kompatibla" #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer, a tuple, or a list" -msgstr "" +msgstr "indataargument måste vara integer, en tuple eller list" #: extmod/ulab/code/fft/fft.c msgid "input array length must be power of 2" @@ -3112,7 +3117,7 @@ msgstr "maxiter bör vara > 0" #: extmod/ulab/code/numerical/numerical.c msgid "median argument must be an ndarray" -msgstr "" +msgstr "argumentet median måste vara en ndarray" #: py/runtime.c #, c-format @@ -3691,7 +3696,7 @@ msgstr "för många argument för det givna formatet" #: extmod/ulab/code/ulab_create.c msgid "too many dimensions" -msgstr "" +msgstr "för många dimensioner" #: extmod/ulab/code/ndarray.c msgid "too many indices" @@ -3704,7 +3709,7 @@ msgstr "för många värden att packa upp (förväntat %d)" #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays" -msgstr "" +msgstr "trapz är definierat för 1D-matriser" #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays of equal length" From 9eb2ca02a57cea7ed44f3e144e446cab15a90354 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 5 Jan 2021 22:03:19 +0100 Subject: [PATCH 551/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/pt_BR.po | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 3c6c5956206f9..f399ade1678ab 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -2898,7 +2898,8 @@ msgstr "as formas de entrada e saída não são compatíveis" #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer, a tuple, or a list" -msgstr "argumento da entrada deve ser um número inteiro, uma tupla ou uma lista" +msgstr "" +"argumento da entrada deve ser um número inteiro, uma tupla ou uma lista" #: extmod/ulab/code/fft/fft.c msgid "input array length must be power of 2" From 98c9492a8c5da5a40e92c60e0f891b6c3038355d Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Tue, 5 Jan 2021 18:39:51 -0600 Subject: [PATCH 552/770] change ESP_EARLY_LOG* to ESP_LOG* throughout event_handler --- ports/esp32s2/common-hal/wifi/__init__.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/__init__.c b/ports/esp32s2/common-hal/wifi/__init__.c index 878c903521e2a..08d7a164f4c2e 100644 --- a/ports/esp32s2/common-hal/wifi/__init__.c +++ b/ports/esp32s2/common-hal/wifi/__init__.c @@ -47,23 +47,23 @@ static void event_handler(void* arg, esp_event_base_t event_base, if (event_base == WIFI_EVENT) { switch (event_id) { case WIFI_EVENT_SCAN_DONE: - ESP_EARLY_LOGW(TAG, "scan"); + ESP_LOGW(TAG, "scan"); xEventGroupSetBits(radio->event_group_handle, WIFI_SCAN_DONE_BIT); break; case WIFI_EVENT_STA_START: - ESP_EARLY_LOGW(TAG, "start"); + ESP_LOGW(TAG, "start"); break; case WIFI_EVENT_STA_STOP: - ESP_EARLY_LOGW(TAG, "stop"); + ESP_LOGW(TAG, "stop"); break; case WIFI_EVENT_STA_CONNECTED: - ESP_EARLY_LOGW(TAG, "connected"); + ESP_LOGW(TAG, "connected"); break; case WIFI_EVENT_STA_DISCONNECTED: { - ESP_EARLY_LOGW(TAG, "disconnected"); + ESP_LOGW(TAG, "disconnected"); wifi_event_sta_disconnected_t* d = (wifi_event_sta_disconnected_t*) event_data; uint8_t reason = d->reason; - ESP_EARLY_LOGW(TAG, "reason %d 0x%02x", reason, reason); + ESP_LOGW(TAG, "reason %d 0x%02x", reason, reason); if (radio->retries_left > 0 && (reason == WIFI_REASON_AUTH_EXPIRE || reason == WIFI_REASON_NOT_AUTHED || @@ -71,7 +71,7 @@ static void event_handler(void* arg, esp_event_base_t event_base, reason == WIFI_REASON_CONNECTION_FAIL || reason == WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT)) { radio->retries_left--; - ESP_EARLY_LOGI(TAG, "Retrying connect. %d retries remaining", radio->retries_left); + ESP_LOGI(TAG, "Retrying connect. %d retries remaining", radio->retries_left); esp_wifi_connect(); return; } @@ -84,14 +84,14 @@ static void event_handler(void* arg, esp_event_base_t event_base, // Cases to handle later. // case WIFI_EVENT_STA_AUTHMODE_CHANGE: default: { - ESP_EARLY_LOGW(TAG, "event %d 0x%02x", event_id, event_id); + ESP_LOGW(TAG, "event %d 0x%02x", event_id, event_id); break; } } } if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) { - ESP_EARLY_LOGW(TAG, "got ip"); + ESP_LOGW(TAG, "got ip"); radio->retries_left = radio->starting_retries; xEventGroupSetBits(radio->event_group_handle, WIFI_CONNECTED_BIT); } From 9a1d864331effd793b0a95bdac592f04b0032178 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 6 Jan 2021 11:09:06 -0500 Subject: [PATCH 553/770] overflowed tick counter needs 64 bits everywhere --- ports/atmel-samd/supervisor/port.c | 4 ++-- ports/nrf/supervisor/port.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index 7d02789e82757..b9977fdc4689a 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -431,7 +431,7 @@ uint32_t port_get_saved_word(void) { static volatile uint64_t overflowed_ticks = 0; static volatile bool _ticks_enabled = false; -static uint32_t _get_count(uint32_t* overflow_count) { +static uint32_t _get_count(uint64_t* overflow_count) { #ifdef SAM_D5X_E5X while ((RTC->MODE0.SYNCBUSY.reg & (RTC_MODE0_SYNCBUSY_COUNTSYNC | RTC_MODE0_SYNCBUSY_COUNT)) != 0) {} #endif @@ -500,7 +500,7 @@ void RTC_Handler(void) { } uint64_t port_get_raw_ticks(uint8_t* subticks) { - uint32_t overflow_count; + uint64_t overflow_count; uint32_t current_ticks = _get_count(&overflow_count); if (subticks != NULL) { *subticks = (current_ticks % 16) * 2; diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c index 00485d8588d19..78bb20ce6cf85 100644 --- a/ports/nrf/supervisor/port.c +++ b/ports/nrf/supervisor/port.c @@ -276,7 +276,7 @@ uint32_t port_get_saved_word(void) { uint64_t port_get_raw_ticks(uint8_t* subticks) { common_hal_mcu_disable_interrupts(); uint32_t rtc = nrfx_rtc_counter_get(&rtc_instance); - uint32_t overflow_count = overflow_tracker.overflowed_ticks; + uint64_t overflow_count = overflow_tracker.overflowed_ticks; common_hal_mcu_enable_interrupts(); if (subticks != NULL) { From cdad59fbc2d681d06a21aefedb00a6b6946cce1c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 6 Jan 2021 09:03:58 -0800 Subject: [PATCH 554/770] Fix doc build with extra blank lines --- shared-bindings/msgpack/__init__.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index e1b6b8fce6212..f5c47bb218c77 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -41,7 +41,8 @@ //| //| Not implemented: 64-bit int, uint, float. //| -//| Example 1: +//| Example 1:: +//| //| import msgpack //| from io import BytesIO //| @@ -50,7 +51,7 @@ //| b.seek(0) //| print(msgpack.unpack(b)) //| -//| Example 2: handling objects +//| Example 2: handling objects:: //| //| from msgpack import pack, unpack, ExtType //| from io import BytesIO @@ -78,11 +79,13 @@ //| buffer.seek(0) //| decoded = unpack(buffer, ext_hook=decoder) //| print(f"{data} -> {buffer.getvalue()} -> {decoded}") +//| //| """ //| //| def pack(obj: object, buffer: WriteableBuffer, *, default: Union[Callable[[object], None], None] = None) -> None: //| """Ouput object to buffer in msgpack format. +//| //| :param object obj: Object to convert to msgpack format. //| :param ~_typing.WriteableBuffer buffer: buffer to write into //| :param Optional[~_typing.Callable[[object], None]] default: @@ -114,10 +117,12 @@ MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_pack_obj, 1, mod_msgpack_pack); //| def unpack(buffer: ReadableBuffer, *, ext_hook: Union[Callable[[int, bytes], object], None] = None, use_list: bool=True) -> object: //| """Unpack and return one object from buffer. +//| //| :param ~_typing.ReadableBuffer buffer: buffer to read from //| :param Optional[~_typing.Callable[[int, bytes], object]] ext_hook: function called for objects in //| msgpack ext format. //| :param Optional[bool] use_list: return array as list or tuple (use_list=False). +//| //| :return object: object read from buffer. //| """ //| ... From 9db0a4f2658a00e5fd712b5afbffcc36292bb5ba Mon Sep 17 00:00:00 2001 From: caternuson Date: Wed, 6 Jan 2021 09:17:19 -0800 Subject: [PATCH 555/770] add magtag accelo irq pin --- ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c index 0cefb6dfbc2d9..645dc12a1b105 100644 --- a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c +++ b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c @@ -49,6 +49,8 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { 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].epaper_display)} + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].epaper_display)}, + + { MP_ROM_QSTR(MP_QSTR_ACCELEROMETER_INTERRUPT), MP_ROM_PTR(&pin_GPIO9) }, }; MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); From 66d87782be3793fd179b12fa864e71509f1dbf6f Mon Sep 17 00:00:00 2001 From: BennyE Date: Wed, 6 Jan 2021 23:52:30 +0100 Subject: [PATCH 556/770] Adding authmode keyword --- ports/esp32s2/common-hal/wifi/Network.c | 35 +++++++++++++++++++++++++ shared-bindings/wifi/Network.c | 16 +++++++++++ shared-bindings/wifi/Network.h | 1 + shared-bindings/wifi/Radio.c | 2 +- 4 files changed, 53 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/common-hal/wifi/Network.c b/ports/esp32s2/common-hal/wifi/Network.c index 2674df0651ef1..0289ad4ebb021 100644 --- a/ports/esp32s2/common-hal/wifi/Network.c +++ b/ports/esp32s2/common-hal/wifi/Network.c @@ -54,3 +54,38 @@ mp_obj_t common_hal_wifi_network_get_country(wifi_network_obj_t *self) { // 2 instead of strlen(cstr) as this gives us only the country-code return mp_obj_new_str(cstr, 2); } + +mp_obj_t common_hal_wifi_network_get_authmode(wifi_network_obj_t *self) { + char authmode[16]; + switch (self->record.authmode) { + case WIFI_AUTH_OPEN: + strcpy(authmode, "OPEN"); + break; + case WIFI_AUTH_WEP: + strcpy(authmode, "WEP"); + break; + case WIFI_AUTH_WPA_PSK: + strcpy(authmode, "WPA_PSK"); + break; + case WIFI_AUTH_WPA2_PSK: + strcpy(authmode, "WPA2_PSK"); + break; + case WIFI_AUTH_WPA_WPA2_PSK: + strcpy(authmode, "WPA_WPA2_PSK"); + break; + case WIFI_AUTH_WPA2_ENTERPRISE: + strcpy(authmode, "WPA2_ENTERPRISE"); + break; + case WIFI_AUTH_WPA3_PSK: + strcpy(authmode, "WPA3_PSK"); + break; + case WIFI_AUTH_WPA2_WPA3_PSK: + strcpy(authmode, "WPA2_WPA3_PSK"); + break; + default: + strcpy(authmode, "UNKNOWN"); + break; + } + const char* cstr = (const char*) authmode; + return mp_obj_new_str(cstr, strlen(cstr)); +} diff --git a/shared-bindings/wifi/Network.c b/shared-bindings/wifi/Network.c index 009712ad190e1..0f3006f2ea8f6 100644 --- a/shared-bindings/wifi/Network.c +++ b/shared-bindings/wifi/Network.c @@ -124,6 +124,21 @@ const mp_obj_property_t wifi_network_country_obj = { (mp_obj_t)&mp_const_none_obj }, }; +//| authmode: str +//| """String id of the authmode""" +//| +STATIC mp_obj_t wifi_network_get_authmode(mp_obj_t self) { + return common_hal_wifi_network_get_authmode(self); + +} +MP_DEFINE_CONST_FUN_OBJ_1(wifi_network_get_authmode_obj, wifi_network_get_authmode); + +const mp_obj_property_t wifi_network_authmode_obj = { + .base.type = &mp_type_property, + .proxy = { (mp_obj_t)&wifi_network_get_authmode_obj, + (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&mp_const_none_obj }, +}; STATIC const mp_rom_map_elem_t wifi_network_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_ssid), MP_ROM_PTR(&wifi_network_ssid_obj) }, @@ -131,6 +146,7 @@ STATIC const mp_rom_map_elem_t wifi_network_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_rssi), MP_ROM_PTR(&wifi_network_rssi_obj) }, { MP_ROM_QSTR(MP_QSTR_channel), MP_ROM_PTR(&wifi_network_channel_obj) }, { MP_ROM_QSTR(MP_QSTR_country), MP_ROM_PTR(&wifi_network_country_obj) }, + { MP_ROM_QSTR(MP_QSTR_authmode), MP_ROM_PTR(&wifi_network_authmode_obj) }, }; STATIC MP_DEFINE_CONST_DICT(wifi_network_locals_dict, wifi_network_locals_dict_table); diff --git a/shared-bindings/wifi/Network.h b/shared-bindings/wifi/Network.h index e672e3108a5df..0f07e7b5557e2 100644 --- a/shared-bindings/wifi/Network.h +++ b/shared-bindings/wifi/Network.h @@ -40,5 +40,6 @@ extern mp_obj_t common_hal_wifi_network_get_bssid(wifi_network_obj_t *self); extern mp_obj_t common_hal_wifi_network_get_rssi(wifi_network_obj_t *self); extern mp_obj_t common_hal_wifi_network_get_channel(wifi_network_obj_t *self); extern mp_obj_t common_hal_wifi_network_get_country(wifi_network_obj_t *self); +extern mp_obj_t common_hal_wifi_network_get_authmode(wifi_network_obj_t *self); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_WIFI_NETWORK_H diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index 723572a321081..63f507067a72a 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -295,7 +295,7 @@ const mp_obj_property_t wifi_radio_ipv4_dns_obj = { }; //| ap_info: Optional[Network] -//| """Network object containing BSSID, SSID, channel, country and RSSI when connected to an access point. None otherwise.""" +//| """Network object containing BSSID, SSID, authmode, channel, country and RSSI when connected to an access point. None otherwise.""" //| STATIC mp_obj_t wifi_radio_get_ap_info(mp_obj_t self) { return common_hal_wifi_radio_get_ap_info(self); From 092331eee148977bef5de974906194e17640257d Mon Sep 17 00:00:00 2001 From: brendan <2bndy5@gmail.com> Date: Wed, 6 Jan 2021 15:19:40 -0800 Subject: [PATCH 557/770] convert esp32s2 readme to rst --- ports/esp32s2/README.md | 84 ----------------------------------- ports/esp32s2/README.rst | 94 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+), 84 deletions(-) delete mode 100644 ports/esp32s2/README.md create mode 100644 ports/esp32s2/README.rst diff --git a/ports/esp32s2/README.md b/ports/esp32s2/README.md deleted file mode 100644 index f5a2bfe5ca713..0000000000000 --- a/ports/esp32s2/README.md +++ /dev/null @@ -1,84 +0,0 @@ -# Circuitpython on ESP32-S2 # - -This port adds the ESP32-S2 line of modules from Espressif to Circuitpython. ESP32-S2 modules are low power, single-core Wi-Fi microcontroller SoCs designed for IoT applications. - -## How this port is organized: ## - -- **bindings/** contains some required bindings to the ESP-IDF for exceptions and memory. -- **boards/** contains the configuration files for each development board and breakout available on the port. -- **common-hal/** contains the port-specific module implementations, used by shared-module and shared-bindings. -- **esp-idf/** contains the Espressif IoT development framework installation, including all the drivers for the port. -- **modules/** contains information specific to certain ESP32-S2 hardware modules, such as the pins used for flash and RAM on the WROVER and WROOM. -- **peripherals/** contains peripheral setup files and peripheral mapping information, sorted by family and sub-variant. Most files in this directory can be generated with the python scripts in **tools/**. -- **supervisor/** contains port-specific implementations of internal flash, serial and USB, as well as the **port.c** file, which initializes the port at startup. -- **tools/** includes useful python scripts for debugging and other purposes. - -At the root level, refer to **mpconfigboard.h** and **mpconfigport.mk** for port specific settings and a list of enabled circuitpython modules. - -## Connecting to the ESP32-S2 ## - -The USB port built into ESP32-S2 boards such as the Saola is not the native USB of the board, but a debugging and programming interface. The actual ESP32-S2 native USB which exposes the Circuitpython drive and CDC connection is located on IO pins 19 and 20: - -| GPIO | USB | -| ---- | ----------- | -| 20 | D+ (green) | -| 19 | D- (white) | -| GND | GND (black) | -| 5V | +5V (red) | - -Connect these pins using a [USB adapter](https://www.adafruit.com/product/4090) or [breakout cable](https://www.adafruit.com/product/4448) to access the Circuitpython drive. - -## Building and flashing ## - -Before building or flashing the ESP32-S2, you must [install the esp-idf](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/get-started/index.html). This must be re-done every time the esp-idf is updated, but not every time you build. Run `cd ports/esp32s2` from `circuitpython/` to move to the esp32s2 port root, and run: - -``` -./esp-idf/install.sh -``` - -After this initial installation, you must add the esp-idf tools to your path. You must also do this **any time you open a new bash environment for building or flashing**: - -``` -. esp-idf/export.sh -``` - -When Circuitpython updates the ESP-IDF to a new release, you may need to run this installation process again. The exact commands used may also vary based on your bash environment. - -Building boards such as the Saola is typically done through `make flash`. The default port is `tty.SLAB_USBtoUART`, which will only work on certain Mac setups. On most machines, both Mac and Linux, you will need to set the port yourself by running `ls /dev/tty.usb*` and selecting the one that only appears when your development board is plugged in. An example make command with the port setting is as follows: - -``` -make BOARD=espressif_saola_1_wrover flash PORT=/dev/tty.usbserial-1421120 -``` - -## Debugging ## - -The ESP32-S2 supports JTAG debugging over OpenOCD using a JLink or other probe hardware. The official tutorials can be found on the Espressif website [here](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-guides/jtag-debugging/index.html), but they are mostly for the ESP32-S2 Kaluga, which has built-in debugging. - -OpenOCD is automatically installed and added to your bash environment during the esp-idf installation and setup process. You can double check that it is installed by using `openocd --version`, as per the tutorial. Attach the JTAG probe pins according to the [instructions](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-guides/jtag-debugging/configure-other-jtag.html) for JTAG debugging on boards that do not contain an integrated debugger. - -Once the debugger is connected physically, you must run OpenOCD with attached configuration files specifying the **interface** (your debugger probe) and either a **target** or a **board** (targets are for SoCs only, and can be used when a full board configuration file doesn't exist). You can find the path location of these files by checking the `OPENOCD_SCRIPTS` environmental variable by running `echo $OPENOCD_SCRIPTS` in bash. Interfaces will be in the `interface/` directory, and targets and boards in the `target/` and `board/` directories, respectively. - -**Note:** Unfortunately, there are no board files for the esp32-s2 other than the Kaluga, and the included `target/esp32s2.cfg` target file will not work by default on the Jlink for boards like the Saola 1, as the default speed is incorrect. In addition, these files are covered under the GPL and cannot be included in Circuitpython. Thus, you must make a copy of the esp32s2.cfg file yourself and add the following line manually, under `transport select jtag` at the start of the file: - -``` -adapter_khz 1000 -``` - -Once this is complete, your final OpenOCD command may look something like this: - -`openocd -f interface/jlink.cfg -f SOMEPATH/copied-esp32s2-saola-1.cfg` - -Where `SOMEPATH` is the location of your copied configuration file (this can be placed in the port/boards director with a prefix to ignore it with `.gitignore`, for instance). Interface, target and board config files sourced from espressif only need their paths from the $OPENOCD_SCRIPTS location, you don't need to include their full path. Once OpenOCD is running, connect to GDB with: - -`xtensa-esp32s2-elf-gdb build-espressif_saola_1_wrover/firmware.elf` - -And follow the Espressif GDB tutorial [instructions](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-guides/jtag-debugging/using-debugger.html) for connecting, or add them to your `gdbinit`: - -``` -target remote :3333 -set remote hardware-watchpoint-limit 2 -mon reset halt -flushregs -thb app_main -c -``` diff --git a/ports/esp32s2/README.rst b/ports/esp32s2/README.rst new file mode 100644 index 0000000000000..d62e3367956e7 --- /dev/null +++ b/ports/esp32s2/README.rst @@ -0,0 +1,94 @@ +Circuitpython on ESP32-S2 +======================================= + +This port adds the ESP32-S2 line of modules from Espressif to Circuitpython. ESP32-S2 modules are low power, single-core Wi-Fi microcontroller SoCs designed for IoT applications. + +How this port is organized: +--------------------------------------- + +- **bindings/** contains some required bindings to the ESP-IDF for exceptions and memory. +- **boards/** contains the configuration files for each development board and breakout available on the port. +- **common-hal/** contains the port-specific module implementations, used by shared-module and shared-bindings. +- **esp-idf/** contains the Espressif IoT development framework installation, including all the drivers for the port. +- **modules/** contains information specific to certain ESP32-S2 hardware modules, such as the pins used for flash and RAM on the WROVER and WROOM. +- **peripherals/** contains peripheral setup files and peripheral mapping information, sorted by family and sub-variant. Most files in this directory can be generated with the python scripts in **tools/**. +- **supervisor/** contains port-specific implementations of internal flash, serial and USB, as well as the **port.c** file, which initializes the port at startup. +- **tools/** includes useful python scripts for debugging and other purposes. + +At the root level, refer to **mpconfigboard.h** and **mpconfigport.mk** for port specific settings and a list of enabled circuitpython modules. + +Connecting to the ESP32-S2 +--------------------------------------- + +The USB port built into ESP32-S2 boards such as the Saola is not the native USB of the board, but a debugging and programming interface. The actual ESP32-S2 native USB which exposes the Circuitpython drive and CDC connection is located on IO pins 19 and 20: + +.. csv-table:: + :header: GPIO, USB + + 20, "D+ (green)" + 19, "D- (white)" + GND, "GND (black)" + 5V, "+5V (red)" + +Connect these pins using a `USB adapter `_ or `breakout cable `_ to access the Circuitpython drive. + +Building and flashing +--------------------------------------- + +Before building or flashing the ESP32-S2, you must `install the esp-idf `_. This must be re-done every time the esp-idf is updated, but not every time you build. Run ``cd ports/esp32s2`` from ``circuitpython/`` to move to the esp32s2 port root, and run: + +.. code-block:: + + ./esp-idf/install.sh + +After this initial installation, you must add the esp-idf tools to your path. You must also do this **any time you open a new bash environment for building or flashing**: + +.. code-block:: + + . esp-idf/export.sh + +When Circuitpython updates the ESP-IDF to a new release, you may need to run this installation process again. The exact commands used may also vary based on your bash environment. + +Building boards such as the Saola is typically done through ``make flash``. The default port is ``tty.SLAB_USBtoUART``, which will only work on certain Mac setups. On most machines, both Mac and Linux, you will need to set the port yourself by running ``ls /dev/tty.usb*`` and selecting the one that only appears when your development board is plugged in. An example make command with the port setting is as follows: + +.. code-block:: + + make BOARD=espressif_saola_1_wrover flash PORT=/dev/tty.usbserial-1421120 + +Debugging +--------------------------------------- + +The ESP32-S2 supports JTAG debugging over OpenOCD using a JLink or other probe hardware. The official tutorials can be found on the Espressif website `here `_, but they are mostly for the ESP32-S2 Kaluga, which has built-in debugging. + +OpenOCD is automatically installed and added to your bash environment during the esp-idf installation and setup process. You can double check that it is installed by using ``openocd --version``, as per the tutorial. Attach the JTAG probe pins according to the `instructions for JTAG debugging `_ on boards that do not contain an integrated debugger. + +Once the debugger is connected physically, you must run OpenOCD with attached configuration files specifying the **interface** (your debugger probe) and either a **target** or a **board** (targets are for SoCs only, and can be used when a full board configuration file doesn't exist). You can find the path location of these files by checking the ``OPENOCD_SCRIPTS`` environmental variable by running ``echo $OPENOCD_SCRIPTS`` in bash. Interfaces will be in the ``interface/`` directory, and targets and boards in the ``target/`` and ``board/`` directories, respectively. + +**Note:** Unfortunately, there are no board files for the esp32-s2 other than the Kaluga, and the included ``target/esp32s2.cfg`` target file will not work by default on the Jlink for boards like the Saola 1, as the default speed is incorrect. In addition, these files are covered under the GPL and cannot be included in Circuitpython. Thus, you must make a copy of the esp32s2.cfg file yourself and add the following line manually, under ``transport select jtag`` at the start of the file: + +.. code-block:: + + adapter_khz 1000 + +Once this is complete, your final OpenOCD command may look something like this: + +.. code-block:: + + openocd -f interface/jlink.cfg -f SOMEPATH/copied-esp32s2-saola-1.cfg + +Where `SOMEPATH` is the location of your copied configuration file (this can be placed in the port/boards directory with a prefix to ignore it with `.gitignore`, for instance). Interface, target and board config files sourced from espressif only need their paths from the $OPENOCD_SCRIPTS location, you don't need to include their full path. Once OpenOCD is running, connect to GDB with: + +.. code-block:: + + xtensa-esp32s2-elf-gdb build-espressif_saola_1_wrover/firmware.elf + +And follow the Espressif GDB tutorial `instructions for connecting `_, or add them to your ``gdbinit``: + +.. code-block:: + + target remote :3333 + set remote hardware-watchpoint-limit 2 + mon reset halt + flushregs + thb app_main + c From 18122e0455023070e64fa6be9b07afbd28da894d Mon Sep 17 00:00:00 2001 From: brendan <2bndy5@gmail.com> Date: Wed, 6 Jan 2021 15:28:19 -0800 Subject: [PATCH 558/770] missed a couple inline code snippets --- ports/esp32s2/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/README.rst b/ports/esp32s2/README.rst index d62e3367956e7..827aba41b7d14 100644 --- a/ports/esp32s2/README.rst +++ b/ports/esp32s2/README.rst @@ -76,7 +76,7 @@ Once this is complete, your final OpenOCD command may look something like this: openocd -f interface/jlink.cfg -f SOMEPATH/copied-esp32s2-saola-1.cfg -Where `SOMEPATH` is the location of your copied configuration file (this can be placed in the port/boards directory with a prefix to ignore it with `.gitignore`, for instance). Interface, target and board config files sourced from espressif only need their paths from the $OPENOCD_SCRIPTS location, you don't need to include their full path. Once OpenOCD is running, connect to GDB with: +Where ``SOMEPATH`` is the location of your copied configuration file (this can be placed in the port/boards directory with a prefix to ignore it with ``.gitignore``, for instance). Interface, target and board config files sourced from espressif only need their paths from the $OPENOCD_SCRIPTS location, you don't need to include their full path. Once OpenOCD is running, connect to GDB with: .. code-block:: From 30ed8d136cea63eda2b518c3bbdfde2d79d9bf2c Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Wed, 6 Jan 2021 00:59:12 +0000 Subject: [PATCH 559/770] Translated using Weblate (French) Currently translated at 100.0% (892 of 892 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index 187ee6f92d869..e898631ea9180 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-01-01 04:29+0000\n" +"PO-Revision-Date: 2021-01-07 01:29+0000\n" "Last-Translator: Hugo Dahl \n" "Language: fr\n" "MIME-Version: 1.0\n" @@ -2595,7 +2595,7 @@ msgstr "les données doivent être de longueur égale" #: extmod/ulab/code/ndarray.c msgid "data type not understood" -msgstr "" +msgstr "le type de donnée n'est pas reconnu" #: py/parsenum.c msgid "decimal numbers not supported" @@ -2913,7 +2913,7 @@ msgstr "les formes d'entrée et de sortie ne sont pas compatibles" #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer, a tuple, or a list" -msgstr "" +msgstr "Paramètre entrant doit être un chiffre entier, un tuple, ou une liste" #: extmod/ulab/code/fft/fft.c msgid "input array length must be power of 2" @@ -3161,7 +3161,7 @@ msgstr "maxiter devrait être > 0" #: extmod/ulab/code/numerical/numerical.c msgid "median argument must be an ndarray" -msgstr "" +msgstr "Paramètre pour median doit être un ndarray" #: py/runtime.c #, c-format @@ -3745,7 +3745,7 @@ msgstr "trop d'arguments fournis avec ce format" #: extmod/ulab/code/ulab_create.c msgid "too many dimensions" -msgstr "" +msgstr "Trop de dimensions" #: extmod/ulab/code/ndarray.c msgid "too many indices" @@ -3758,7 +3758,7 @@ msgstr "trop de valeur à dégrouper (%d attendues)" #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays" -msgstr "" +msgstr "trapz est défini pour tableaux à une dimension" #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays of equal length" From a03f35e093e8c54da0a5781988596694c2f81e6c Mon Sep 17 00:00:00 2001 From: Dennis Schweer Date: Thu, 7 Jan 2021 15:49:14 +0000 Subject: [PATCH 560/770] Translated using Weblate (German) Currently translated at 84.4% (753 of 892 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/de/ --- locale/de_DE.po | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/locale/de_DE.po b/locale/de_DE.po index 0dd71199938ed..a1d0726433d3f 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -6,20 +6,22 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2020-11-26 03:11+0000\n" -"Last-Translator: Daniel Bravo Darriba \n" +"PO-Revision-Date: 2021-01-07 18:01+0000\n" +"Last-Translator: Dennis Schweer \n" "Language: de_DE\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.4-dev\n" +"X-Generator: Weblate 4.4.1-dev\n" #: main.c msgid "" "\n" "Code done running.\n" msgstr "" +"\n" +"Programm wird ausgeführt.\n" #: main.c msgid "" @@ -129,7 +131,7 @@ msgstr "'%q' Objekt unterstützt '%q' nicht" #: py/obj.c msgid "'%q' object does not support item assignment" -msgstr "" +msgstr "'%q' Objekt unterschützt keine Elementzuweisung" #: py/obj.c msgid "'%q' object does not support item deletion" @@ -141,7 +143,7 @@ msgstr "'%q' Objekt hat kein Attribut '%q'" #: py/runtime.c msgid "'%q' object is not an iterator" -msgstr "" +msgstr "'%q' Objekt ist kein Iterator" #: py/objtype.c py/runtime.c msgid "'%q' object is not callable" @@ -235,7 +237,7 @@ msgstr "'continue' außerhalb einer Schleife" #: py/objgenerator.c msgid "'coroutine' object is not an iterator" -msgstr "" +msgstr "'coroutine' Objekt ist kein Iterator" #: py/compile.c msgid "'data' requires at least 2 arguments" @@ -307,7 +309,7 @@ msgstr "Alle I2C-Peripheriegeräte sind in Benutzung" #: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" -msgstr "" +msgstr "Alle PCNT Einheiten sind in Benutzung" #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c @@ -710,7 +712,7 @@ msgstr "Konnte Kamera nicht initialisieren" #: ports/cxd56/common-hal/gnss/GNSS.c msgid "Could not initialize GNSS" -msgstr "" +msgstr "GNSS konnte nicht initialisiert werden" #: ports/cxd56/common-hal/sdioio/SDCard.c msgid "Could not initialize SDCard" @@ -837,7 +839,7 @@ msgstr "Die EZB arbeitet jeweils nur mit 16 Bytes" #: ports/esp32s2/common-hal/busio/SPI.c ports/esp32s2/common-hal/canio/CAN.c msgid "ESP-IDF memory allocation failed" -msgstr "" +msgstr "ESP-IDF Speicherallozierung fehlgeschlagen" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c #: ports/atmel-samd/common-hal/ps2io/Ps2.c @@ -903,7 +905,7 @@ msgstr "FFT ist nur für ndarrays definiert" #: extmod/ulab/code/fft/fft.c msgid "FFT is implemented for linear arrays only" -msgstr "" +msgstr "FFT ist nur für lineare Arrays implementiert" #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" @@ -934,7 +936,7 @@ msgstr "Konnte keine RX Buffer mit %d allozieren" #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Failed to allocate Wifi memory" -msgstr "" +msgstr "Zuweisung des Wifi Speichers ist fehlgeschlagen" #: ports/esp32s2/common-hal/wifi/ScannedNetworks.c msgid "Failed to allocate wifi scan memory" @@ -950,7 +952,7 @@ msgstr "Verbindung nicht erfolgreich: timeout" #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Failed to init wifi" -msgstr "" +msgstr "Wifi Initialisierung ist fehlgeschlagen" #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" @@ -1037,7 +1039,7 @@ msgstr "I2SOut nicht verfügbar" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" -msgstr "" +msgstr "IOs 0, 2 & 4 unterstützen keinen internen Pull up im sleep-Modus" #: shared-bindings/aesio/aes.c #, c-format @@ -1058,7 +1060,7 @@ msgstr "Inkorrekte Puffergröße" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" -msgstr "" +msgstr "Initialisierung aufgrund von Speichermangel fehlgeschlagen" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" @@ -3858,7 +3860,7 @@ msgstr "nicht unterstütztes Formatzeichen '%c' (0x%x) bei Index %d" #: py/runtime.c msgid "unsupported type for %q: '%q'" -msgstr "" +msgstr "nicht unterstützer Typ für %q: '%q'" #: py/runtime.c msgid "unsupported type for operator" @@ -3866,7 +3868,7 @@ msgstr "nicht unterstützter Typ für Operator" #: py/runtime.c msgid "unsupported types for %q: '%q', '%q'" -msgstr "" +msgstr "nicht unterstützte Typen für %q: '%q', '%q'" #: py/objint.c #, c-format @@ -3911,7 +3913,7 @@ msgstr "" #: extmod/ulab/code/vector/vectorise.c msgid "wrong input type" -msgstr "" +msgstr "falscher Eingabetyp" #: extmod/ulab/code/ulab_create.c py/objstr.c msgid "wrong number of arguments" @@ -3927,7 +3929,7 @@ msgstr "falscher Operandentyp" #: extmod/ulab/code/vector/vectorise.c msgid "wrong output type" -msgstr "" +msgstr "Falscher Ausgabetyp" #: shared-module/displayio/Shape.c msgid "x value out of bounds" From e4129ecf00071a8b7b9f2b97f0522ba6bbeb0253 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jan 2021 14:40:11 -0600 Subject: [PATCH 561/770] Makefile: Remove POT-Creation-Date from circuitpython.pot This line is only a magnet for conflicts; the date that circuitpython.pot was modified can be extracted from git metadata. Additionally, when we add "make translate" checking to pre-commit, this will avoid spurious changes since the most straightforward implementation would otherwise update this line every time pre-commit executed. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a1807c308fa4d..adb206d7bc739 100644 --- a/Makefile +++ b/Makefile @@ -222,7 +222,7 @@ pseudoxml: all-source: locale/circuitpython.pot: all-source - find $(TRANSLATE_SOURCES) -type d \( $(TRANSLATE_SOURCES_EXC) \) -prune -o -type f \( -iname "*.c" -o -iname "*.h" \) -print | (LC_ALL=C sort) | xgettext -f- -L C -s --add-location=file --keyword=translate -o circuitpython.pot -p locale + find $(TRANSLATE_SOURCES) -type d \( $(TRANSLATE_SOURCES_EXC) \) -prune -o -type f \( -iname "*.c" -o -iname "*.h" \) -print | (LC_ALL=C sort) | xgettext -f- -L C -s --add-location=file --keyword=translate -o - | sed -e '/"POT-Creation-Date: /d' > $@ # Historically, `make translate` updated the .pot file and ran msgmerge. # However, this was a frequent source of merge conflicts. Weblate can perform From e79ee785ac45abc1ee53d9cdbfd30f2290ee7bd9 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jan 2021 14:40:51 -0600 Subject: [PATCH 562/770] circuitpython.pot: regenerate without timestamp --- locale/circuitpython.pot | 1 - 1 file changed, 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index f319b82f8bbbf..63dc92d18aff7 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,6 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-01-04 12:55-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" From 1dda33dc418cae1a0047df0241762ebdb3d87e8a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jan 2021 14:41:11 -0600 Subject: [PATCH 563/770] pre-commit: Add checking of 'make translate' status .. when this check completes with an error, circuitpython.pot has been updated and the changes can be staged. --- .pre-commit-config.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 322f37da46d3b..82d89eaa3e43b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,3 +11,10 @@ repos: exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*|ports/esp32s2/esp-idf-config/.*|ports/esp32s2/boards/.*/sdkconfig)' - id: trailing-whitespace exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*)' +- repo: local + hooks: + - id: translations + name: Check Translations + entry: sh -c "make translate" + language: system + always_run: true From 7bb196b9d2133477bf967d6b1d5dafe0971f765f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jan 2021 15:01:33 -0600 Subject: [PATCH 564/770] esp32s2: 'make flash': Allow customizing the esptool flags This can be useful so that e.g., on a Kaluga when programming via the FTDI chip, you can override the variable to specify "--after=hard_reset" to automatically return to running CircuitPython, choose a different baud rate (921600 is about 2s faster than 460800), etc: make BOARD=espressif_kaluga_1 ESPTOOL_FLAGS="-b 921600 --before=default_reset --after=hard_reset" --- ports/esp32s2/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 4a334a2eb0cc9..88bc8ce63724c 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -300,6 +300,8 @@ ESP_AUTOGEN_LD = $(BUILD)/esp-idf/esp-idf/esp32s2/esp32s2_out.ld $(BUILD)/esp-id FLASH_FLAGS = --flash_mode $(CIRCUITPY_ESP_FLASH_MODE) --flash_freq $(CIRCUITPY_ESP_FLASH_FREQ) --flash_size $(CIRCUITPY_ESP_FLASH_SIZE) +ESPTOOL_FLAGS ?= -b 460800 --before=default_reset --after=no_reset write_flash + all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2 .PHONY: esp-idf-stamp @@ -338,10 +340,10 @@ $(BUILD)/firmware.uf2: $(BUILD)/circuitpython-firmware.bin $(Q)$(PYTHON3) $(TOP)/tools/uf2/utils/uf2conv.py -f 0xbfdd4eee -b 0x0000 -c -o $@ $^ flash: $(BUILD)/firmware.bin - esptool.py --chip esp32s2 -p $(PORT) -b 460800 --before=default_reset --after=no_reset write_flash $(FLASH_FLAGS) 0x0000 $^ + esptool.py --chip esp32s2 -p $(PORT) $(ESPTOOL_FLAGS) write_flash $(FLASH_FLAGS) 0x0000 $^ flash-circuitpython-only: $(BUILD)/circuitpython-firmware.bin - esptool.py --chip esp32s2 -p $(PORT) -b 460800 --before=default_reset --after=no_reset write_flash $(FLASH_FLAGS) 0x10000 $^ + esptool.py --chip esp32s2 -p $(PORT) $(ESPTOOL_FLAGS) write_flash $(FLASH_FLAGS) 0x10000 $^ include $(TOP)/py/mkrules.mk From 115f3e08677520806b95dfc92e4462d119854023 Mon Sep 17 00:00:00 2001 From: BennyE Date: Thu, 7 Jan 2021 23:05:16 +0100 Subject: [PATCH 565/770] Updated code as per helpful suggestion --- ports/esp32s2/common-hal/wifi/Network.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/Network.c b/ports/esp32s2/common-hal/wifi/Network.c index 0289ad4ebb021..83c675a190655 100644 --- a/ports/esp32s2/common-hal/wifi/Network.c +++ b/ports/esp32s2/common-hal/wifi/Network.c @@ -56,34 +56,34 @@ mp_obj_t common_hal_wifi_network_get_country(wifi_network_obj_t *self) { } mp_obj_t common_hal_wifi_network_get_authmode(wifi_network_obj_t *self) { - char authmode[16]; + const char* authmode = ""; switch (self->record.authmode) { case WIFI_AUTH_OPEN: - strcpy(authmode, "OPEN"); + authmode = "OPEN"; break; case WIFI_AUTH_WEP: - strcpy(authmode, "WEP"); + authmode = "WEP"; break; case WIFI_AUTH_WPA_PSK: - strcpy(authmode, "WPA_PSK"); + authmode = "WPA_PSK"; break; case WIFI_AUTH_WPA2_PSK: - strcpy(authmode, "WPA2_PSK"); + authmode = "WPA2_PSK"; break; case WIFI_AUTH_WPA_WPA2_PSK: - strcpy(authmode, "WPA_WPA2_PSK"); + authmode = "WPA_WPA2_PSK"; break; case WIFI_AUTH_WPA2_ENTERPRISE: - strcpy(authmode, "WPA2_ENTERPRISE"); + authmode = "WPA2_ENTERPRISE"; break; case WIFI_AUTH_WPA3_PSK: - strcpy(authmode, "WPA3_PSK"); + authmode = "WPA3_PSK"; break; case WIFI_AUTH_WPA2_WPA3_PSK: - strcpy(authmode, "WPA2_WPA3_PSK"); + authmode = "WPA2_WPA3_PSK"; break; default: - strcpy(authmode, "UNKNOWN"); + authmode = "UNKNOWN"; break; } const char* cstr = (const char*) authmode; From c7dc5f2507fbcca8215823744607008ccc3759cc Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Thu, 7 Jan 2021 14:13:19 -0800 Subject: [PATCH 566/770] support RTS/CTS hardware flow control --- ports/nrf/common-hal/busio/UART.c | 59 ++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 8 deletions(-) diff --git a/ports/nrf/common-hal/busio/UART.c b/ports/nrf/common-hal/busio/UART.c index 012ebc3b5e15f..625807d866f50 100644 --- a/ports/nrf/common-hal/busio/UART.c +++ b/ports/nrf/common-hal/busio/UART.c @@ -36,6 +36,7 @@ #include "supervisor/shared/translate.h" #include "nrfx_uarte.h" +#include "nrf_gpio.h" #include // expression to examine, and return value in case of failing @@ -98,10 +99,16 @@ static void uart_callback_irq (const nrfx_uarte_event_t * event, void * context) switch ( event->type ) { case NRFX_UARTE_EVT_RX_DONE: - ringbuf_put_n(&self->ringbuf, event->data.rxtx.p_data, event->data.rxtx.bytes); + if (ringbuf_num_empty(&self->ringbuf) >= event->data.rxtx.bytes) { + ringbuf_put_n(&self->ringbuf, event->data.rxtx.p_data, event->data.rxtx.bytes); + // keep receiving + (void) nrfx_uarte_rx(self->uarte, &self->rx_char, 1); + } else { + // receive buffer full, suspend + self->rx_paused = true; + nrf_gpio_pin_write(self->rts_pin_number, true); + } - // keep receiving - (void) nrfx_uarte_rx(self->uarte, &self->rx_char, 1); break; case NRFX_UARTE_EVT_TX_DONE: @@ -137,8 +144,8 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, mp_float_t timeout, uint16_t receiver_buffer_size, byte* receiver_buffer, bool sigint_enabled) { - if ((rts != NULL) || (cts != NULL) || (rs485_dir != NULL) || (rs485_invert)) { - mp_raise_ValueError(translate("RTS/CTS/RS485 Not yet supported on this device")); + if ((rs485_dir != NULL) || (rs485_invert)) { + mp_raise_ValueError(translate("RS485 Not yet supported on this device")); } // Find a free UART peripheral. @@ -166,16 +173,18 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, mp_raise_ValueError(translate("Odd parity is not supported")); } + bool hwfc = rts != NULL || cts != NULL; + nrfx_uarte_config_t config = { .pseltxd = (tx == NULL) ? NRF_UARTE_PSEL_DISCONNECTED : tx->number, .pselrxd = (rx == NULL) ? NRF_UARTE_PSEL_DISCONNECTED : rx->number, - .pselcts = NRF_UARTE_PSEL_DISCONNECTED, - .pselrts = NRF_UARTE_PSEL_DISCONNECTED, + .pselcts = (cts == NULL) ? NRF_UARTE_PSEL_DISCONNECTED : cts->number, + .pselrts = (rts == NULL) ? NRF_UARTE_PSEL_DISCONNECTED : rts->number, .p_context = self, .baudrate = get_nrf_baud(baudrate), .interrupt_priority = 7, .hal_cfg = { - .hwfc = NRF_UARTE_HWFC_DISABLED, + .hwfc = hwfc ? NRF_UARTE_HWFC_ENABLED : NRF_UARTE_HWFC_DISABLED, .parity = (parity == BUSIO_UART_PARITY_NONE) ? NRF_UARTE_PARITY_EXCLUDED : NRF_UARTE_PARITY_INCLUDED } }; @@ -207,9 +216,25 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, self->tx_pin_number = NO_PIN; } + if ( rts != NULL ) { + self->rts_pin_number = rts->number; + claim_pin(rts); + } else { + self->rts_pin_number = NO_PIN; + } + + if ( cts != NULL ) { + self->cts_pin_number = cts->number; + claim_pin(cts); + } else { + self->cts_pin_number = NO_PIN; + } + self->baudrate = baudrate; self->timeout_ms = timeout * 1000; + self->rx_paused = false; + // Initial wait for incoming byte _VERIFY_ERR(nrfx_uarte_rx(self->uarte, &self->rx_char, 1)); } @@ -223,8 +248,12 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { nrfx_uarte_uninit(self->uarte); reset_pin_number(self->tx_pin_number); reset_pin_number(self->rx_pin_number); + reset_pin_number(self->rts_pin_number); + reset_pin_number(self->cts_pin_number); self->tx_pin_number = NO_PIN; self->rx_pin_number = NO_PIN; + self->rts_pin_number = NO_PIN; + self->cts_pin_number = NO_PIN; ringbuf_free(&self->ringbuf); } } @@ -237,6 +266,10 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t uint64_t start_ticks = supervisor_ticks_ms64(); + if (len > ringbuf_capacity(&self->ringbuf)) { + mp_raise_ValueError(translate("Reading >receiver_buffer_size bytes is not supported")); + } + // Wait for all bytes received or timeout while ( (ringbuf_num_filled(&self->ringbuf) < len) && (supervisor_ticks_ms64() - start_ticks < self->timeout_ms) ) { RUN_BACKGROUND_TASKS; @@ -252,6 +285,16 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t // Copy as much received data as available, up to len bytes. size_t rx_bytes = ringbuf_get_n(&self->ringbuf, data, len); + // restart reader, if stopped + if (self->rx_paused) { + // the character that did not fit in ringbuf is in rx_char + ringbuf_put_n(&self->ringbuf, &self->rx_char, 1); + // keep receiving + (void) nrfx_uarte_rx(self->uarte, &self->rx_char, 1); + nrf_gpio_pin_write(self->rts_pin_number, false); + self->rx_paused = false; + } + NVIC_EnableIRQ(nrfx_get_irq_number(self->uarte->p_reg)); return rx_bytes; From 010a4e7b0fefbee12f8139f7c5c13436545bb1eb Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jan 2021 16:23:21 -0600 Subject: [PATCH 567/770] esp32s2: port: Ensure JTAG pins are available for debugging --- ports/esp32s2/supervisor/port.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index ead12003dea56..a6b6a82aa49de 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -111,6 +111,14 @@ safe_mode_t port_init(void) { heap = NULL; never_reset_module_internal_pins(); + #if defined(DEBUG) || defined(ENABLE_JTAG) + // JTAG + common_hal_never_reset_pin(&pin_GPIO39); + common_hal_never_reset_pin(&pin_GPIO40); + common_hal_never_reset_pin(&pin_GPIO41); + common_hal_never_reset_pin(&pin_GPIO42); + #endif + #ifdef CONFIG_SPIRAM heap = (uint32_t*) (DRAM0_CACHE_ADDRESS_HIGH - CONFIG_SPIRAM_SIZE); heap_size = CONFIG_SPIRAM_SIZE / sizeof(uint32_t); From 352226402c6b897ec9dc776a61cff3330b8a40df Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jan 2021 16:28:33 -0600 Subject: [PATCH 568/770] esp32s2: i2s: fix accounting for "stretched" frames --- ports/esp32s2/i2s_common.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ports/esp32s2/i2s_common.c b/ports/esp32s2/i2s_common.c index 1933665a33f3d..24ded295f5899 100644 --- a/ports/esp32s2/i2s_common.c +++ b/ports/esp32s2/i2s_common.c @@ -103,9 +103,9 @@ static void i2s_fill_buffer(i2s_t *self) { } } else { #define STACK_BUFFER_SIZE (64) - size_t bytes_per_frame = self->channel_count * self->bytes_per_sample; - size_t framecount = MIN(STACK_BUFFER_SIZE / bytes_per_frame, bytecount); - int16_t signed_samples[STACK_BUFFER_SIZE / sizeof(int16_t)]; + const size_t bytes_per_output_frame = 4; + size_t bytes_per_input_frame = self->channel_count * self->bytes_per_sample; + size_t framecount = MIN(STACK_BUFFER_SIZE / bytes_per_output_frame, bytecount / bytes_per_input_frame); if (self->samples_signed) { assert(self->channel_count == 1); if (self->bytes_per_sample == 1) { @@ -129,9 +129,9 @@ static void i2s_fill_buffer(i2s_t *self) { } } size_t expanded_bytes_written = 0; - ESP_CALL_RAISE(i2s_write(self->instance, signed_samples, 4*framecount, &expanded_bytes_written, 0)); + ESP_CALL_RAISE(i2s_write(self->instance, signed_samples, bytes_per_output_frame*framecount, &expanded_bytes_written, 0)); assert(expanded_bytes_written % 4 == 0); - bytes_written = expanded_bytes_written / 4 * bytes_per_frame; + bytes_written = expanded_bytes_written / bytes_per_output_frame * bytes_per_input_frame; } self->sample_data += bytes_written; // We have filled the DMA buffer @@ -181,6 +181,10 @@ void port_i2s_allocate_init(i2s_t *self, bool left_justified) { void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop) { + if (common_hal_audiobusio_i2sout_get_playing(self)) { + common_hal_audiobusio_i2sout_stop(self); + } + self->sample = sample; self->bytes_per_sample = audiosample_bits_per_sample(sample) / 8; self->channel_count = audiosample_channel_count(sample); From d3afda61d8172ad6ec8706782c397d9cd52c3edc Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jan 2021 16:29:08 -0600 Subject: [PATCH 569/770] esp32s2: i2s: must reset buffer, otherwise wave samples don't start .. and other housekeeping when starting to play a sample --- ports/esp32s2/i2s_common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/i2s_common.c b/ports/esp32s2/i2s_common.c index 24ded295f5899..d5c0facaabb78 100644 --- a/ports/esp32s2/i2s_common.c +++ b/ports/esp32s2/i2s_common.c @@ -186,6 +186,7 @@ void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop) { } self->sample = sample; + self->loop = loop; self->bytes_per_sample = audiosample_bits_per_sample(sample) / 8; self->channel_count = audiosample_channel_count(sample); bool single_buffer; @@ -195,12 +196,15 @@ void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop) { audiosample_get_buffer_structure(sample, false, &single_buffer, &samples_signed, &max_buffer_length, &spacing); self->samples_signed = samples_signed; - self->loop = loop; self->playing = true; self->paused = false; self->stopping = false; + self->sample_data = self->sample_end = NULL; // We always output stereo so output twice as many bits. // uint16_t bits_per_sample_output = bits_per_sample * 2; + + audiosample_reset_buffer(self->sample, false, 0); + ESP_CALL_RAISE(i2s_set_sample_rates(self->instance, audiosample_sample_rate(sample))); i2s_fill_buffer(self); } From cfd8288dfa0a27bd727e3877659d9bbb990dd1ce Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jan 2021 16:29:52 -0600 Subject: [PATCH 570/770] esp2s2: enlarge stack-buffer, use it instead of i2s_zero_dma_buffer .. it's not clear that there was a problem with i2s_zero_dma_buffer, but just in case. --- ports/esp32s2/i2s_common.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/ports/esp32s2/i2s_common.c b/ports/esp32s2/i2s_common.c index d5c0facaabb78..ca2a3b93e056a 100644 --- a/ports/esp32s2/i2s_common.c +++ b/ports/esp32s2/i2s_common.c @@ -24,6 +24,8 @@ * THE SOFTWARE. */ +#include + #include "py/runtime.h" #include "i2s_common.h" @@ -69,8 +71,17 @@ static void i2s_fill_buffer(i2s_t *self) { if (self->instance < 0 || self->instance >= I2S_NUM_MAX) { return; } - if (self->paused || !self->sample) { - i2s_zero_dma_buffer(self->instance); +#define STACK_BUFFER_SIZE (512) + int16_t signed_samples[STACK_BUFFER_SIZE / sizeof(int16_t)]; +mp_printf(&mp_plat_print, "playing=%d paused=%d stopping=%d sample@%p sample_data=%p..%p\n", self->playing, self->paused, self->stopping, self->sample, self->sample_data, self->sample_end); + + if (!self->playing || self->paused || !self->sample) { + memset(signed_samples, 0, sizeof(signed_samples)); + + size_t bytes_written = 0; + do { + ESP_CALL_RAISE(i2s_write(self->instance, signed_samples, sizeof(signed_samples), &bytes_written, 0)); + } while (bytes_written != 0); return; } while (!self->stopping) { @@ -102,7 +113,6 @@ static void i2s_fill_buffer(i2s_t *self) { ESP_CALL_RAISE(i2s_write_expand(self->instance, self->sample_data, bytecount, 8, 16, &bytes_written, 0)); } } else { -#define STACK_BUFFER_SIZE (64) const size_t bytes_per_output_frame = 4; size_t bytes_per_input_frame = self->channel_count * self->bytes_per_sample; size_t framecount = MIN(STACK_BUFFER_SIZE / bytes_per_output_frame, bytecount / bytes_per_input_frame); From 873a300d02316ca8b6d227574613385acc3df6b9 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 8 Jan 2021 08:46:41 -0600 Subject: [PATCH 571/770] i2s_fill_buffer: Need to fill with zeros when stopping --- ports/esp32s2/i2s_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/i2s_common.c b/ports/esp32s2/i2s_common.c index ca2a3b93e056a..5316c8088b952 100644 --- a/ports/esp32s2/i2s_common.c +++ b/ports/esp32s2/i2s_common.c @@ -75,7 +75,7 @@ static void i2s_fill_buffer(i2s_t *self) { int16_t signed_samples[STACK_BUFFER_SIZE / sizeof(int16_t)]; mp_printf(&mp_plat_print, "playing=%d paused=%d stopping=%d sample@%p sample_data=%p..%p\n", self->playing, self->paused, self->stopping, self->sample, self->sample_data, self->sample_end); - if (!self->playing || self->paused || !self->sample) { + if (!self->playing || self->paused || !self->sample || self->stopping) { memset(signed_samples, 0, sizeof(signed_samples)); size_t bytes_written = 0; From 0b7a4c4b2b7e6e56e40100ab1e85d79b8a93ef33 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 8 Jan 2021 08:46:56 -0600 Subject: [PATCH 572/770] i2s_fill_buffer: remove debug print --- ports/esp32s2/i2s_common.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/esp32s2/i2s_common.c b/ports/esp32s2/i2s_common.c index 5316c8088b952..a58bdc23ba22f 100644 --- a/ports/esp32s2/i2s_common.c +++ b/ports/esp32s2/i2s_common.c @@ -73,7 +73,6 @@ static void i2s_fill_buffer(i2s_t *self) { } #define STACK_BUFFER_SIZE (512) int16_t signed_samples[STACK_BUFFER_SIZE / sizeof(int16_t)]; -mp_printf(&mp_plat_print, "playing=%d paused=%d stopping=%d sample@%p sample_data=%p..%p\n", self->playing, self->paused, self->stopping, self->sample, self->sample_data, self->sample_end); if (!self->playing || self->paused || !self->sample || self->stopping) { memset(signed_samples, 0, sizeof(signed_samples)); From 12264cca34179c2e3bafad49145c9af3f827fa0f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 8 Jan 2021 08:47:13 -0600 Subject: [PATCH 573/770] port_i2s_play: remove build error --- ports/esp32s2/i2s_common.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ports/esp32s2/i2s_common.c b/ports/esp32s2/i2s_common.c index a58bdc23ba22f..a948ee0f5aeff 100644 --- a/ports/esp32s2/i2s_common.c +++ b/ports/esp32s2/i2s_common.c @@ -190,10 +190,6 @@ void port_i2s_allocate_init(i2s_t *self, bool left_justified) { void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop) { - if (common_hal_audiobusio_i2sout_get_playing(self)) { - common_hal_audiobusio_i2sout_stop(self); - } - self->sample = sample; self->loop = loop; self->bytes_per_sample = audiosample_bits_per_sample(sample) / 8; From 430bcdb59d47fc89c7788aeb300027bcf4e00bf2 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 8 Jan 2021 08:49:25 -0600 Subject: [PATCH 574/770] port_i2s_play: fill the initial buffer via background callback There were _possibly_ problems where this routine was being entered by direct call AND by background callback. Schedule the work here, and it will be done almost immediately, without worry about interference. I don't know if this is strictly necessary, but it doesn't hurt. Since the I2S clock is being run all the time, we have to enter the background task to fill the FIFO with zeros constantly anyway. --- ports/esp32s2/i2s_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/i2s_common.c b/ports/esp32s2/i2s_common.c index a948ee0f5aeff..552fe7424cb8e 100644 --- a/ports/esp32s2/i2s_common.c +++ b/ports/esp32s2/i2s_common.c @@ -211,7 +211,8 @@ void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop) { audiosample_reset_buffer(self->sample, false, 0); ESP_CALL_RAISE(i2s_set_sample_rates(self->instance, audiosample_sample_rate(sample))); - i2s_fill_buffer(self); + + background_callback_add(&self->callback, i2s_callback_fun, self); } bool port_i2s_playing(i2s_t *self) { From 5f0e41ad601664b37c109a5d84b2a6031a4a740f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 8 Jan 2021 09:01:34 -0600 Subject: [PATCH 575/770] I2SOut: Enable ticks during audio playback .. otherwise, the background callback to load the I2S fifos does not get run. (I'm not sure this is _correct_ behavior of sleep + background tasks, but it is the current behavior) --- ports/esp32s2/common-hal/audiobusio/I2SOut.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports/esp32s2/common-hal/audiobusio/I2SOut.c b/ports/esp32s2/common-hal/audiobusio/I2SOut.c index be5b04fa95797..694cab49d51a8 100644 --- a/ports/esp32s2/common-hal/audiobusio/I2SOut.c +++ b/ports/esp32s2/common-hal/audiobusio/I2SOut.c @@ -63,6 +63,8 @@ void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t* self, self->bit_clock = bit_clock; self->word_select = word_select; self->data = data; + + supervisor_enable_tick(); } bool common_hal_audiobusio_i2sout_deinited(audiobusio_i2sout_obj_t* self) { @@ -93,6 +95,8 @@ void common_hal_audiobusio_i2sout_deinit(audiobusio_i2sout_obj_t* self) { port_i2s_reset_instance(self->peripheral.instance); } self->peripheral.instance = -1; + + supervisor_disable_tick(); } void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t* self, From 39c166ba6a72d6e95aaf2865ff3e7cade39d04a2 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 8 Jan 2021 13:30:11 -0500 Subject: [PATCH 576/770] update tinyusb; _ticks_enabled only for SAMD21 --- lib/tinyusb | 2 +- ports/atmel-samd/supervisor/port.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/tinyusb b/lib/tinyusb index 218b80e63ab6f..cfcffe94ce62f 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit 218b80e63ab6ff87c1851e403f08b3d716d68f5e +Subproject commit cfcffe94ce62f5ef1fb5aef4641924d64dc4b1c0 diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index b9977fdc4689a..02b9e3874339e 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -429,7 +429,9 @@ uint32_t port_get_saved_word(void) { // TODO: Move this to an RTC backup register so we can preserve it when only the BACKUP power domain // is enabled. static volatile uint64_t overflowed_ticks = 0; +#ifdef SAMD21 static volatile bool _ticks_enabled = false; +#endif static uint32_t _get_count(uint64_t* overflow_count) { #ifdef SAM_D5X_E5X @@ -537,9 +539,11 @@ void port_disable_tick(void) { // they'll wake us up earlier. If we don't, we'll mess up ticks by overwriting // the next RTC wake up time. void port_interrupt_after_ticks(uint32_t ticks) { + #ifdef SAMD21 if (_ticks_enabled) { return; } + #endif _port_interrupt_after_ticks(ticks); } From 7556f38f04d641445a484133696664fc781a5c58 Mon Sep 17 00:00:00 2001 From: jerryneedell Date: Fri, 8 Jan 2021 14:40:06 -0500 Subject: [PATCH 577/770] initialize LDO2 in board_init() --- ports/esp32s2/boards/unexpectedmaker_feathers2/board.c | 8 ++++++++ ports/esp32s2/common-hal/microcontroller/Pin.c | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c b/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c index d8fd3a0a2b7bb..ac08190a5bc48 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c @@ -27,6 +27,8 @@ #include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" +#include "components/driver/include/driver/gpio.h" +#include "components/soc/include/hal/gpio_hal.h" void board_init(void) { // USB @@ -47,6 +49,12 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO30); common_hal_never_reset_pin(&pin_GPIO31); common_hal_never_reset_pin(&pin_GPIO32); + + + // Add LDO2 to never reset list, set to output and enable + common_hal_never_reset_pin(&pin_GPIO21); + gpio_set_direction(pin_GPIO21.number, GPIO_MODE_DEF_OUTPUT); + gpio_set_level(pin_GPIO21.number, true); } bool board_requests_safe_mode(void) { diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index fd01d68e1f5bd..66677d1ea1054 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -171,7 +171,8 @@ bool pin_number_is_free(gpio_num_t pin_number) { uint8_t offset = pin_number / 32; uint32_t mask = 1 << (pin_number % 32); - return (never_reset_pins[offset] & mask) == 0 && (in_use[offset] & mask) == 0; + //return (never_reset_pins[offset] & mask) == 0 && (in_use[offset] & mask) == 0; + return (in_use[offset] & mask) == 0; } bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) { From de5b138dcffce7c8f7cf8d30321713ee82ce995c Mon Sep 17 00:00:00 2001 From: jerryneedell Date: Fri, 8 Jan 2021 14:46:37 -0500 Subject: [PATCH 578/770] remove commented line --- ports/esp32s2/common-hal/microcontroller/Pin.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index 66677d1ea1054..6889720e84171 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -171,7 +171,6 @@ bool pin_number_is_free(gpio_num_t pin_number) { uint8_t offset = pin_number / 32; uint32_t mask = 1 << (pin_number % 32); - //return (never_reset_pins[offset] & mask) == 0 && (in_use[offset] & mask) == 0; return (in_use[offset] & mask) == 0; } From 06ab848a0d78594d17b49022174bf0e023b68c60 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Fri, 8 Jan 2021 16:48:25 -0600 Subject: [PATCH 579/770] added platform --- ports/esp32s2/mpconfigport.h | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/esp32s2/mpconfigport.h b/ports/esp32s2/mpconfigport.h index db7393d8ef142..9c0fd9da3e81e 100644 --- a/ports/esp32s2/mpconfigport.h +++ b/ports/esp32s2/mpconfigport.h @@ -32,6 +32,7 @@ #define MICROPY_PY_UJSON (1) #define MICROPY_USE_INTERNAL_PRINTF (0) +#define MICROPY_PY_SYS_PLATFORM "Espressif ESP32-S2" #include "py/circuitpy_mpconfig.h" From 7b4558b750df85026e1801bb661343101da9df5a Mon Sep 17 00:00:00 2001 From: Caio Henrique de Queiroz Katayama Date: Fri, 8 Jan 2021 19:17:17 -0500 Subject: [PATCH 580/770] Fix socket.recvfrom_into() --- ports/esp32s2/common-hal/socketpool/Socket.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ports/esp32s2/common-hal/socketpool/Socket.c b/ports/esp32s2/common-hal/socketpool/Socket.c index 32c5fc72f2fde..5e943f8fd0682 100644 --- a/ports/esp32s2/common-hal/socketpool/Socket.c +++ b/ports/esp32s2/common-hal/socketpool/Socket.c @@ -178,7 +178,7 @@ mp_uint_t common_hal_socketpool_socket_recvfrom_into(socketpool_socket_obj_t* se struct sockaddr_in source_addr; socklen_t socklen = sizeof(source_addr); - int bytes_received = lwip_recvfrom(self->num, buf, len - 1, 0, (struct sockaddr *)&source_addr, &socklen); + int bytes_received = lwip_recvfrom(self->num, buf, len, 0, (struct sockaddr *)&source_addr, &socklen); memcpy((void *)ip, (void*)&source_addr.sin_addr.s_addr, sizeof source_addr.sin_addr.s_addr); *port = source_addr.sin_port; @@ -186,10 +186,9 @@ mp_uint_t common_hal_socketpool_socket_recvfrom_into(socketpool_socket_obj_t* se if (bytes_received < 0) { mp_raise_BrokenPipeError(); return 0; - } else { - buf[bytes_received] = 0; // Null-terminate whatever we received - return bytes_received; } + + return bytes_received; } void common_hal_socketpool_socket_close(socketpool_socket_obj_t* self) { From 96dd3d3fef30ce632312ba592b84e2b9f5d84399 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 8 Jan 2021 18:21:27 -0600 Subject: [PATCH 581/770] ensure gettext program is available to pre-commit --- .github/workflows/pre-commit.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 8caf56d2684f3..20c76c1249466 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -15,6 +15,8 @@ jobs: steps: - uses: actions/checkout@v1 - uses: actions/setup-python@v1 + - name: Install deps + run: sudo apt-get update && sudo apt-get install -y gettext - name: set PY run: echo >>$GITHUB_ENV PY="$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" - uses: actions/cache@v1 From 288c54c70a8b6a6682ae9ac8c0a5483c3968d433 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 8 Jan 2021 18:54:02 -0600 Subject: [PATCH 582/770] need to find strings in ulab --- .github/workflows/pre-commit.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 20c76c1249466..af62072c89ac8 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -17,6 +17,8 @@ jobs: - uses: actions/setup-python@v1 - name: Install deps run: sudo apt-get update && sudo apt-get install -y gettext + - name: Populate selected submodules + run: git submodule update --init extmod/ulab - name: set PY run: echo >>$GITHUB_ENV PY="$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" - uses: actions/cache@v1 From dd10c534c526b8c8709127e7f13fbdad71a47c39 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 8 Jan 2021 22:32:23 -0500 Subject: [PATCH 583/770] restore len(alarm.sleep_memory) and bool(alarm.sleep_memory) --- shared-bindings/alarm/SleepMemory.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/shared-bindings/alarm/SleepMemory.c b/shared-bindings/alarm/SleepMemory.c index bec0b766584d4..aed24827adb30 100644 --- a/shared-bindings/alarm/SleepMemory.c +++ b/shared-bindings/alarm/SleepMemory.c @@ -53,6 +53,25 @@ //| """Not used. Access the sole instance through `alarm.sleep_memory`.""" //| ... //| +//| def __bool__(self) -> bool: +//| """``sleep_memory`` is ``True`` if its length is greater than zero. +//| This is an easy way to check for its existence. +//| """ +//| ... +//| +//| def __len__(self) -> int: +//| """Return the length. This is used by (`len`)""" +//| ... +//| +STATIC mp_obj_t alarm_sleep_memory_unary_op(mp_unary_op_t op, mp_obj_t self_in) { + alarm_sleep_memory_obj_t *self = MP_OBJ_TO_PTR(self_in); + uint16_t len = common_hal_alarm_sleep_memory_get_length(self); + switch (op) { + case MP_UNARY_OP_BOOL: return mp_obj_new_bool(len != 0); + case MP_UNARY_OP_LEN: return MP_OBJ_NEW_SMALL_INT(len); + default: return MP_OBJ_NULL; // op not supported + } +} STATIC const mp_rom_map_elem_t alarm_sleep_memory_locals_dict_table[] = { }; @@ -154,6 +173,7 @@ const mp_obj_type_t alarm_sleep_memory_type = { { &mp_type_type }, .name = MP_QSTR_SleepMemory, .subscr = alarm_sleep_memory_subscr, + .unary_op = alarm_sleep_memory_unary_op, .print = NULL, .locals_dict = (mp_obj_t)&alarm_sleep_memory_locals_dict, }; From 255ffa979cd62063bcbabbc64e3c4fb8d1c0f216 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 8 Jan 2021 22:16:58 -0500 Subject: [PATCH 584/770] avoid inline compile errors --- py/circuitpy_defns.mk | 8 ++++++++ supervisor/shared/translate.c | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index d6d192a95741e..8e8751036d879 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -58,6 +58,14 @@ BASE_CFLAGS = \ # -H +# Set a global CIRCUITPY_DEBUG flag. +# Don't just call it "DEBUG": too many libraries use plain DEBUG. +ifneq ($(DEBUG),) +CFLAGS += -DCIRCUITPY_DEBUG=$(DEBUG) +else +CFLAGS += -DCIRCUITPY_DEBUG=0 +endif + ### # Handle frozen modules. diff --git a/supervisor/shared/translate.c b/supervisor/shared/translate.c index 44544c98dd61b..8bd3c5acdee8f 100644 --- a/supervisor/shared/translate.c +++ b/supervisor/shared/translate.c @@ -122,7 +122,12 @@ char* decompress(const compressed_string_t* compressed, char* decompressed) { return decompressed; } -inline __attribute__((always_inline)) const compressed_string_t* translate(const char* original) { +inline +// gcc10 -flto has issues with this being always_inline for debug builds. +#if CIRCUITPY_DEBUG < 1 + __attribute__((always_inline)) +#endif +const compressed_string_t* translate(const char* original) { #ifndef NO_QSTR #define QDEF(id, str) #define TRANSLATION(id, firstbyte, ...) if (strcmp(original, id) == 0) { static const compressed_string_t v = { .data = firstbyte, .tail = { __VA_ARGS__ } }; return &v; } else From 13efbf24e58b2be940cad44e4f0816d6daa67202 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Sat, 9 Jan 2021 10:33:56 -0600 Subject: [PATCH 585/770] disable msgpack on boards without room --- ports/atmel-samd/boards/qtpy_m0_haxpress/mpconfigboard.mk | 1 + ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk | 1 + ports/nrf/boards/pca10100/mpconfigboard.mk | 1 + 3 files changed, 3 insertions(+) diff --git a/ports/atmel-samd/boards/qtpy_m0_haxpress/mpconfigboard.mk b/ports/atmel-samd/boards/qtpy_m0_haxpress/mpconfigboard.mk index a63f142742847..8773c5771dd94 100644 --- a/ports/atmel-samd/boards/qtpy_m0_haxpress/mpconfigboard.mk +++ b/ports/atmel-samd/boards/qtpy_m0_haxpress/mpconfigboard.mk @@ -17,6 +17,7 @@ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 SUPEROPT_GC = 0 diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk index 704d265141d2d..734be2d145d86 100644 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk @@ -16,6 +16,7 @@ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 CIRCUITPY_VECTORIO = 0 CIRCUITPY_BUSDEVICE = 0 diff --git a/ports/nrf/boards/pca10100/mpconfigboard.mk b/ports/nrf/boards/pca10100/mpconfigboard.mk index 86ba654548b8c..76d15e6081ca3 100644 --- a/ports/nrf/boards/pca10100/mpconfigboard.mk +++ b/ports/nrf/boards/pca10100/mpconfigboard.mk @@ -15,6 +15,7 @@ CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_FRAMEBUFFERIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 CIRCUITPY_NEOPIXEL_WRITE = 0 CIRCUITPY_NVM = 0 CIRCUITPY_PIXELBUF = 0 From 999ee68e12877e6b2188a821fd43efc1567279fe Mon Sep 17 00:00:00 2001 From: lady ada Date: Sat, 9 Jan 2021 12:22:53 -0500 Subject: [PATCH 586/770] try adding new feather def --- .github/workflows/build.yml | 1 + .../adafruit_feather_esp32s2_nopsram/board.c | 47 ++++++++++++++ .../mpconfigboard.h | 46 ++++++++++++++ .../mpconfigboard.mk | 17 +++++ .../adafruit_feather_esp32s2_nopsram/pins.c | 63 +++++++++++++++++++ .../sdkconfig | 0 6 files changed, 174 insertions(+) create mode 100644 ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c create mode 100644 ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h create mode 100644 ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk create mode 100644 ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/pins.c create mode 100644 ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/sdkconfig diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b6c80558ebb76..8c44edc891d84 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -422,6 +422,7 @@ jobs: matrix: board: - "adafruit_esp32s2_eink_portal" + - "adafruit_feather_esp32s2_nopsram" - "adafruit_metro_esp32s2" - "electroniccats_bastwifi" - "espressif_kaluga_1" diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c new file mode 100644 index 0000000000000..9f708874bfdf5 --- /dev/null +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c @@ -0,0 +1,47 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "boards/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // USB + common_hal_never_reset_pin(&pin_GPIO19); + common_hal_never_reset_pin(&pin_GPIO20); + + // Debug UART + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h new file mode 100644 index 0000000000000..b63524abebfb8 --- /dev/null +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h @@ -0,0 +1,46 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 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. + */ + +//Micropython setup + +#define MICROPY_HW_BOARD_NAME "Feather ESP32S2 without PSRAM" +#define MICROPY_HW_MCU_NAME "ESP32S2" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO33) + +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) + +#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") + +#define AUTORESET_DELAY_MS 500 + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO4) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO3) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) + diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk new file mode 100644 index 0000000000000..2d22b726af1ff --- /dev/null +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk @@ -0,0 +1,17 @@ +USB_VID = 0x239A +USB_PID = 0x80EC +USB_PRODUCT = "Feather ESP32S2 no PSRAM" +USB_MANUFACTURER = "Adafruit" + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = MPZ + +# The default queue depth of 16 overflows on release builds, +# so increase it to 32. +CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 + +CIRCUITPY_ESP_FLASH_MODE=dio +CIRCUITPY_ESP_FLASH_FREQ=40m +CIRCUITPY_ESP_FLASH_SIZE=4MB + +CIRCUITPY_MODULE=wroom diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/pins.c b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/pins.c new file mode 100644 index 0000000000000..bf14d81ae6f0f --- /dev/null +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/pins.c @@ -0,0 +1,63 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO33) }, + + { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, + + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) }, + + + { MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO38) }, + + { MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/sdkconfig b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/sdkconfig new file mode 100644 index 0000000000000..e69de29bb2d1d From 813fa671f34484caf592b41fcf4b4b9e20e07e26 Mon Sep 17 00:00:00 2001 From: lady ada Date: Sat, 9 Jan 2021 12:29:08 -0500 Subject: [PATCH 587/770] nowhitespace --- .../boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h index b63524abebfb8..9d95e8e437ab8 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h @@ -43,4 +43,3 @@ #define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) #define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) - From 7de1da45dacfa446b034b0cf65c98dadf0ab7272 Mon Sep 17 00:00:00 2001 From: lady ada Date: Sat, 9 Jan 2021 13:23:17 -0500 Subject: [PATCH 588/770] woops out of sync header, plus... i dunno add some frozen modules cause we have almost no RAM :( --- .../esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c | 2 +- .../boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c index 9f708874bfdf5..b8fbf34d6a8e2 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk index 2d22b726af1ff..bf44d16872490 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk @@ -15,3 +15,8 @@ CIRCUITPY_ESP_FLASH_FREQ=40m CIRCUITPY_ESP_FLASH_SIZE=4MB CIRCUITPY_MODULE=wroom + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register \ No newline at end of file From 301facf102b6e65b427492976116c6fb114c30db Mon Sep 17 00:00:00 2001 From: lady ada Date: Sat, 9 Jan 2021 13:36:21 -0500 Subject: [PATCH 589/770] newline --- .../boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk index bf44d16872490..3290f8cae3628 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk @@ -19,4 +19,4 @@ CIRCUITPY_MODULE=wroom FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register \ No newline at end of file +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register From a600fd3478c0f3851e384507817b853608439de3 Mon Sep 17 00:00:00 2001 From: lady ada Date: Sat, 9 Jan 2021 14:01:58 -0500 Subject: [PATCH 590/770] forgot deinit --- .../esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c index b8fbf34d6a8e2..aaef97c7d1404 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c @@ -34,8 +34,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ } bool board_requests_safe_mode(void) { @@ -45,3 +47,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} From 10861b403881c96cc7da6d1b8c6e80b40332fee7 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 9 Jan 2021 13:41:44 -0600 Subject: [PATCH 591/770] esp32s2: Rename ESP_CALL_RAISE to CHECK_ESP_RESULT Suggested by @tannewt, thanks! --- ports/esp32s2/bindings/espidf/__init__.h | 2 +- ports/esp32s2/common-hal/audiobusio/I2SOut.c | 2 +- ports/esp32s2/i2s_common.c | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ports/esp32s2/bindings/espidf/__init__.h b/ports/esp32s2/bindings/espidf/__init__.h index 5ff49970d3935..9248b01acd169 100644 --- a/ports/esp32s2/bindings/espidf/__init__.h +++ b/ports/esp32s2/bindings/espidf/__init__.h @@ -37,6 +37,6 @@ extern const mp_obj_type_t mp_type_espidf_MemoryError; NORETURN void mp_raise_espidf_MemoryError(void); void raise_esp_error(esp_err_t err) NORETURN; -#define ESP_CALL_RAISE(x) do { int res = (x); if(res != ESP_OK) raise_esp_error(res); } while(0) +#define CHECK_ESP_RESULT(x) do { int res = (x); if(res != ESP_OK) raise_esp_error(res); } while(0) #endif // MICROPY_INCLUDED_ESP32S2_BINDINGS_ESPIDF___INIT___H diff --git a/ports/esp32s2/common-hal/audiobusio/I2SOut.c b/ports/esp32s2/common-hal/audiobusio/I2SOut.c index 694cab49d51a8..ee16c6ca8921e 100644 --- a/ports/esp32s2/common-hal/audiobusio/I2SOut.c +++ b/ports/esp32s2/common-hal/audiobusio/I2SOut.c @@ -59,7 +59,7 @@ void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t* self, .data_out_num = data->number, .data_in_num = I2S_PIN_NO_CHANGE, }; - ESP_CALL_RAISE(i2s_set_pin(self->peripheral.instance, &i2s_pin_config)); + CHECK_ESP_RESULT(i2s_set_pin(self->peripheral.instance, &i2s_pin_config)); self->bit_clock = bit_clock; self->word_select = word_select; self->data = data; diff --git a/ports/esp32s2/i2s_common.c b/ports/esp32s2/i2s_common.c index 552fe7424cb8e..f967e9a096b6c 100644 --- a/ports/esp32s2/i2s_common.c +++ b/ports/esp32s2/i2s_common.c @@ -79,7 +79,7 @@ static void i2s_fill_buffer(i2s_t *self) { size_t bytes_written = 0; do { - ESP_CALL_RAISE(i2s_write(self->instance, signed_samples, sizeof(signed_samples), &bytes_written, 0)); + CHECK_ESP_RESULT(i2s_write(self->instance, signed_samples, sizeof(signed_samples), &bytes_written, 0)); } while (bytes_written != 0); return; } @@ -107,9 +107,9 @@ static void i2s_fill_buffer(i2s_t *self) { size_t bytecount = self->sample_end - self->sample_data; if (self->samples_signed && self->channel_count == 2) { if (self->bytes_per_sample == 2) { - ESP_CALL_RAISE(i2s_write(self->instance, self->sample_data, bytecount, &bytes_written, 0)); + CHECK_ESP_RESULT(i2s_write(self->instance, self->sample_data, bytecount, &bytes_written, 0)); } else { - ESP_CALL_RAISE(i2s_write_expand(self->instance, self->sample_data, bytecount, 8, 16, &bytes_written, 0)); + CHECK_ESP_RESULT(i2s_write_expand(self->instance, self->sample_data, bytecount, 8, 16, &bytes_written, 0)); } } else { const size_t bytes_per_output_frame = 4; @@ -138,7 +138,7 @@ static void i2s_fill_buffer(i2s_t *self) { } } size_t expanded_bytes_written = 0; - ESP_CALL_RAISE(i2s_write(self->instance, signed_samples, bytes_per_output_frame*framecount, &expanded_bytes_written, 0)); + CHECK_ESP_RESULT(i2s_write(self->instance, signed_samples, bytes_per_output_frame*framecount, &expanded_bytes_written, 0)); assert(expanded_bytes_written % 4 == 0); bytes_written = expanded_bytes_written / bytes_per_output_frame * bytes_per_input_frame; } @@ -179,7 +179,7 @@ void port_i2s_allocate_init(i2s_t *self, bool left_justified) { .dma_buf_len = 128, // in _frames_, so 128 is 512 bytes per dma buf .use_apll = false, }; - ESP_CALL_RAISE(i2s_driver_install(self->instance, &i2s_config, I2S_QUEUE_SIZE, &i2s_queues[self->instance])); + CHECK_ESP_RESULT(i2s_driver_install(self->instance, &i2s_config, I2S_QUEUE_SIZE, &i2s_queues[self->instance])); if (!xTaskCreate(i2s_event_task, "I2S_task", 3 * configMINIMAL_STACK_SIZE, self, CONFIG_PTHREAD_TASK_PRIO_DEFAULT, &i2s_tasks[self->instance])) { mp_raise_OSError_msg(translate("xTaskCreate failed")); @@ -210,7 +210,7 @@ void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop) { audiosample_reset_buffer(self->sample, false, 0); - ESP_CALL_RAISE(i2s_set_sample_rates(self->instance, audiosample_sample_rate(sample))); + CHECK_ESP_RESULT(i2s_set_sample_rates(self->instance, audiosample_sample_rate(sample))); background_callback_add(&self->callback, i2s_callback_fun, self); } @@ -233,13 +233,13 @@ void port_i2s_stop(i2s_t *self) { void port_i2s_pause(i2s_t *self) { if (!self->paused) { self->paused = true; - ESP_CALL_RAISE(i2s_stop(self->instance)); + CHECK_ESP_RESULT(i2s_stop(self->instance)); } } void port_i2s_resume(i2s_t *self) { if (self->paused) { self->paused = false; - ESP_CALL_RAISE(i2s_start(self->instance)); + CHECK_ESP_RESULT(i2s_start(self->instance)); } } From 4735cf4747764f0694e1285085e99f06a7a11a81 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 9 Jan 2021 13:48:36 -0600 Subject: [PATCH 592/770] esp32s2: audiobusio: move i2s_common inside Originally, I believed the implementation might be shared with AudioOut, as on the ESP32 (non-S2) the I2S peripheral was also used to drive the DAC. However, this is not the case on ESP32-S2 and appears it will not be the case with the ESP32-S3 or -C3, to the extent that there's skeletal support for either of them in esp-idf master branch. However, it could still be shared by I2SIn or PDMIn (the latter being hypothetically implemented as I2SIn + digital postprocessing like we did in the atmel-sam port, to my understanding), so I moved it to the common-hal folder. --- ports/esp32s2/Makefile | 1 - ports/esp32s2/common-hal/audiobusio/I2SOut.h | 2 +- .../esp32s2/common-hal/audiobusio/__init__.c | 245 ++++++++++++++++++ .../esp32s2/common-hal/audiobusio/__init__.h | 61 +++++ ports/esp32s2/i2s_common.c | 245 ------------------ ports/esp32s2/i2s_common.h | 61 ----- ports/esp32s2/supervisor/port.c | 2 +- 7 files changed, 308 insertions(+), 309 deletions(-) delete mode 100644 ports/esp32s2/i2s_common.c delete mode 100644 ports/esp32s2/i2s_common.h diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 88bc8ce63724c..9827b555c5e7d 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -175,7 +175,6 @@ CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_ESP32S2 -DCFG_TUSB_OS=OPT_OS_FREERTOS -DCFG_TUD SRC_C += \ background.c \ fatfs_port.c \ - i2s_common.c \ mphalport.c \ bindings/espidf/__init__.c \ boards/$(BOARD)/board.c \ diff --git a/ports/esp32s2/common-hal/audiobusio/I2SOut.h b/ports/esp32s2/common-hal/audiobusio/I2SOut.h index 90266342cb33a..891e9af674fe9 100644 --- a/ports/esp32s2/common-hal/audiobusio/I2SOut.h +++ b/ports/esp32s2/common-hal/audiobusio/I2SOut.h @@ -29,7 +29,7 @@ #include "supervisor/background_callback.h" #include "common-hal/microcontroller/Pin.h" -#include "i2s_common.h" +#include "common-hal/audiobusio/__init__.h" // Some boards don't implement I2SOut, so suppress any routines from here. #if CIRCUITPY_AUDIOBUSIO_I2SOUT diff --git a/ports/esp32s2/common-hal/audiobusio/__init__.c b/ports/esp32s2/common-hal/audiobusio/__init__.c index e69de29bb2d1d..01c77c531356d 100644 --- a/ports/esp32s2/common-hal/audiobusio/__init__.c +++ b/ports/esp32s2/common-hal/audiobusio/__init__.c @@ -0,0 +1,245 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler 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 + +#include "py/runtime.h" + +#include "common-hal/audiobusio/__init__.h" +#include "bindings/espidf/__init__.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +#include "shared-module/audiocore/__init__.h" + +#define I2S_QUEUE_SIZE (3) + +static i2s_t *i2s_instance[I2S_NUM_MAX]; +static QueueHandle_t i2s_queues[I2S_NUM_MAX]; +static TaskHandle_t i2s_tasks[I2S_NUM_MAX]; + +static int8_t port_i2s_allocate(void) { +#if defined(I2S_NUM_1) + if(!i2s_instance[1]) return 1; +#endif + if(!i2s_instance[0]) return 0; + + mp_raise_RuntimeError(translate("Peripheral in use")); +} + +void port_i2s_reset_instance(int i) { + assert(i >= 0 && i < I2S_NUM_MAX); + if (i2s_tasks[i]) { + vTaskDelete(i2s_tasks[i]); + } + i2s_tasks[i] = NULL; + + (void)i2s_driver_uninstall(i); + i2s_instance[i] = NULL; +} + +void i2s_reset(void) { + for (int i=0; i < I2S_NUM_MAX; i++) { + port_i2s_reset_instance(i); + } +} + +static void i2s_fill_buffer(i2s_t *self) { + if (self->instance < 0 || self->instance >= I2S_NUM_MAX) { + return; + } +#define STACK_BUFFER_SIZE (512) + int16_t signed_samples[STACK_BUFFER_SIZE / sizeof(int16_t)]; + + if (!self->playing || self->paused || !self->sample || self->stopping) { + memset(signed_samples, 0, sizeof(signed_samples)); + + size_t bytes_written = 0; + do { + CHECK_ESP_RESULT(i2s_write(self->instance, signed_samples, sizeof(signed_samples), &bytes_written, 0)); + } while (bytes_written != 0); + return; + } + while (!self->stopping) { + if (self->sample_data == self->sample_end) { + uint32_t sample_buffer_length; + audioio_get_buffer_result_t get_buffer_result = + audiosample_get_buffer(self->sample, false, 0, + &self->sample_data, &sample_buffer_length); + self->sample_end = self->sample_data + sample_buffer_length; + if (get_buffer_result == GET_BUFFER_DONE) { + if (self->loop) { + audiosample_reset_buffer(self->sample, false, 0); + } else { + self->stopping = true; + break; + } + } + if (get_buffer_result == GET_BUFFER_ERROR || sample_buffer_length == 0) { + self->stopping = true; + break; + } + } + size_t bytes_written = 0; + size_t bytecount = self->sample_end - self->sample_data; + if (self->samples_signed && self->channel_count == 2) { + if (self->bytes_per_sample == 2) { + CHECK_ESP_RESULT(i2s_write(self->instance, self->sample_data, bytecount, &bytes_written, 0)); + } else { + CHECK_ESP_RESULT(i2s_write_expand(self->instance, self->sample_data, bytecount, 8, 16, &bytes_written, 0)); + } + } else { + const size_t bytes_per_output_frame = 4; + size_t bytes_per_input_frame = self->channel_count * self->bytes_per_sample; + size_t framecount = MIN(STACK_BUFFER_SIZE / bytes_per_output_frame, bytecount / bytes_per_input_frame); + if (self->samples_signed) { + assert(self->channel_count == 1); + if (self->bytes_per_sample == 1) { + audiosample_convert_s8m_s16s(signed_samples, (int8_t*)(void*)self->sample_data, framecount); + } else { + audiosample_convert_s16m_s16s(signed_samples, (int16_t*)(void*)self->sample_data, framecount); + } + } else { + if (self->channel_count == 1) { + if (self->bytes_per_sample == 1) { + audiosample_convert_u8m_s16s(signed_samples, (uint8_t*)(void*)self->sample_data, framecount); + } else { + audiosample_convert_u16m_s16s(signed_samples, (uint16_t*)(void*)self->sample_data, framecount); + } + } else { + if (self->bytes_per_sample == 1) { + audiosample_convert_u8s_s16s(signed_samples, (uint8_t*)(void*)self->sample_data, framecount); + } else { + audiosample_convert_u16s_s16s(signed_samples, (uint16_t*)(void*)self->sample_data, framecount); + } + } + } + size_t expanded_bytes_written = 0; + CHECK_ESP_RESULT(i2s_write(self->instance, signed_samples, bytes_per_output_frame*framecount, &expanded_bytes_written, 0)); + assert(expanded_bytes_written % 4 == 0); + bytes_written = expanded_bytes_written / bytes_per_output_frame * bytes_per_input_frame; + } + self->sample_data += bytes_written; + // We have filled the DMA buffer + if (!bytes_written) { + break; + } + } +} + +static void i2s_callback_fun(void *self_in) { + i2s_t *self = self_in; + i2s_fill_buffer(self); +} + +static void i2s_event_task(void *self_in) { + i2s_t *self = self_in; + while(true) { + i2s_event_type_t event; + BaseType_t result = xQueueReceive(i2s_queues[self->instance], &event, portMAX_DELAY); + if (result && event == I2S_EVENT_TX_DONE) { + background_callback_add(&self->callback, i2s_callback_fun, self_in); + } + } +} + +void port_i2s_allocate_init(i2s_t *self, bool left_justified) { + self->instance = port_i2s_allocate(); + + i2s_config_t i2s_config = { + .mode = I2S_MODE_MASTER | I2S_MODE_TX, + .sample_rate = 44100, + .bits_per_sample = 16, + .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT, + .communication_format = left_justified ? I2S_COMM_FORMAT_STAND_I2S : I2S_COMM_FORMAT_STAND_I2S, + .dma_buf_count = 2, + .dma_buf_len = 128, // in _frames_, so 128 is 512 bytes per dma buf + .use_apll = false, + }; + CHECK_ESP_RESULT(i2s_driver_install(self->instance, &i2s_config, I2S_QUEUE_SIZE, &i2s_queues[self->instance])); + + if (!xTaskCreate(i2s_event_task, "I2S_task", 3 * configMINIMAL_STACK_SIZE, self, CONFIG_PTHREAD_TASK_PRIO_DEFAULT, &i2s_tasks[self->instance])) { + mp_raise_OSError_msg(translate("xTaskCreate failed")); + } + i2s_instance[self->instance] = self; + +} + + +void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop) { + self->sample = sample; + self->loop = loop; + self->bytes_per_sample = audiosample_bits_per_sample(sample) / 8; + self->channel_count = audiosample_channel_count(sample); + bool single_buffer; + bool samples_signed; + uint32_t max_buffer_length; + uint8_t spacing; + audiosample_get_buffer_structure(sample, false, &single_buffer, &samples_signed, + &max_buffer_length, &spacing); + self->samples_signed = samples_signed; + self->playing = true; + self->paused = false; + self->stopping = false; + self->sample_data = self->sample_end = NULL; + // We always output stereo so output twice as many bits. + // uint16_t bits_per_sample_output = bits_per_sample * 2; + + audiosample_reset_buffer(self->sample, false, 0); + + CHECK_ESP_RESULT(i2s_set_sample_rates(self->instance, audiosample_sample_rate(sample))); + + background_callback_add(&self->callback, i2s_callback_fun, self); +} + +bool port_i2s_playing(i2s_t *self) { + return self->playing && !self->stopping; +} + +bool port_i2s_paused(i2s_t *self) { + return self->paused; +} + +void port_i2s_stop(i2s_t *self) { + self->sample = NULL; + self->paused = false; + self->playing = false; + self->stopping = false; +} + +void port_i2s_pause(i2s_t *self) { + if (!self->paused) { + self->paused = true; + CHECK_ESP_RESULT(i2s_stop(self->instance)); + } +} + +void port_i2s_resume(i2s_t *self) { + if (self->paused) { + self->paused = false; + CHECK_ESP_RESULT(i2s_start(self->instance)); + } +} diff --git a/ports/esp32s2/common-hal/audiobusio/__init__.h b/ports/esp32s2/common-hal/audiobusio/__init__.h index e69de29bb2d1d..7709735daeca7 100644 --- a/ports/esp32s2/common-hal/audiobusio/__init__.h +++ b/ports/esp32s2/common-hal/audiobusio/__init__.h @@ -0,0 +1,61 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler 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. + */ + +#pragma once + +#include "py/obj.h" + +#include "supervisor/background_callback.h" + +#include "driver/i2s.h" + +typedef struct { + mp_obj_t *sample; + bool left_justified; + bool loop; + bool paused; + bool playing; + bool stopping; + bool samples_signed; + int8_t bytes_per_sample; + int8_t channel_count; + int8_t instance; + uint16_t buffer_length; + uint8_t *sample_data, *sample_end; + i2s_config_t i2s_config; + background_callback_t callback; +} i2s_t; + + +void port_i2s_allocate_init(i2s_t *self, bool left_justified); +void port_i2s_reset_instance(int i); +void i2s_reset(void); +void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop); +void port_i2s_stop(i2s_t *self); +bool port_i2s_playing(i2s_t *self); +bool port_i2s_paused(i2s_t *self); +void port_i2s_pause(i2s_t *self); +void port_i2s_resume(i2s_t *self); diff --git a/ports/esp32s2/i2s_common.c b/ports/esp32s2/i2s_common.c deleted file mode 100644 index f967e9a096b6c..0000000000000 --- a/ports/esp32s2/i2s_common.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2020 Jeff Epler 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 - -#include "py/runtime.h" - -#include "i2s_common.h" -#include "bindings/espidf/__init__.h" -#include "freertos/FreeRTOS.h" -#include "freertos/task.h" - -#include "shared-module/audiocore/__init__.h" - -#define I2S_QUEUE_SIZE (3) - -static i2s_t *i2s_instance[I2S_NUM_MAX]; -static QueueHandle_t i2s_queues[I2S_NUM_MAX]; -static TaskHandle_t i2s_tasks[I2S_NUM_MAX]; - -static int8_t port_i2s_allocate(void) { -#if defined(I2S_NUM_1) - if(!i2s_instance[1]) return 1; -#endif - if(!i2s_instance[0]) return 0; - - mp_raise_RuntimeError(translate("Peripheral in use")); -} - -void port_i2s_reset_instance(int i) { - assert(i >= 0 && i < I2S_NUM_MAX); - if (i2s_tasks[i]) { - vTaskDelete(i2s_tasks[i]); - } - i2s_tasks[i] = NULL; - - (void)i2s_driver_uninstall(i); - i2s_instance[i] = NULL; -} - -void i2s_reset(void) { - for (int i=0; i < I2S_NUM_MAX; i++) { - port_i2s_reset_instance(i); - } -} - -static void i2s_fill_buffer(i2s_t *self) { - if (self->instance < 0 || self->instance >= I2S_NUM_MAX) { - return; - } -#define STACK_BUFFER_SIZE (512) - int16_t signed_samples[STACK_BUFFER_SIZE / sizeof(int16_t)]; - - if (!self->playing || self->paused || !self->sample || self->stopping) { - memset(signed_samples, 0, sizeof(signed_samples)); - - size_t bytes_written = 0; - do { - CHECK_ESP_RESULT(i2s_write(self->instance, signed_samples, sizeof(signed_samples), &bytes_written, 0)); - } while (bytes_written != 0); - return; - } - while (!self->stopping) { - if (self->sample_data == self->sample_end) { - uint32_t sample_buffer_length; - audioio_get_buffer_result_t get_buffer_result = - audiosample_get_buffer(self->sample, false, 0, - &self->sample_data, &sample_buffer_length); - self->sample_end = self->sample_data + sample_buffer_length; - if (get_buffer_result == GET_BUFFER_DONE) { - if (self->loop) { - audiosample_reset_buffer(self->sample, false, 0); - } else { - self->stopping = true; - break; - } - } - if (get_buffer_result == GET_BUFFER_ERROR || sample_buffer_length == 0) { - self->stopping = true; - break; - } - } - size_t bytes_written = 0; - size_t bytecount = self->sample_end - self->sample_data; - if (self->samples_signed && self->channel_count == 2) { - if (self->bytes_per_sample == 2) { - CHECK_ESP_RESULT(i2s_write(self->instance, self->sample_data, bytecount, &bytes_written, 0)); - } else { - CHECK_ESP_RESULT(i2s_write_expand(self->instance, self->sample_data, bytecount, 8, 16, &bytes_written, 0)); - } - } else { - const size_t bytes_per_output_frame = 4; - size_t bytes_per_input_frame = self->channel_count * self->bytes_per_sample; - size_t framecount = MIN(STACK_BUFFER_SIZE / bytes_per_output_frame, bytecount / bytes_per_input_frame); - if (self->samples_signed) { - assert(self->channel_count == 1); - if (self->bytes_per_sample == 1) { - audiosample_convert_s8m_s16s(signed_samples, (int8_t*)(void*)self->sample_data, framecount); - } else { - audiosample_convert_s16m_s16s(signed_samples, (int16_t*)(void*)self->sample_data, framecount); - } - } else { - if (self->channel_count == 1) { - if (self->bytes_per_sample == 1) { - audiosample_convert_u8m_s16s(signed_samples, (uint8_t*)(void*)self->sample_data, framecount); - } else { - audiosample_convert_u16m_s16s(signed_samples, (uint16_t*)(void*)self->sample_data, framecount); - } - } else { - if (self->bytes_per_sample == 1) { - audiosample_convert_u8s_s16s(signed_samples, (uint8_t*)(void*)self->sample_data, framecount); - } else { - audiosample_convert_u16s_s16s(signed_samples, (uint16_t*)(void*)self->sample_data, framecount); - } - } - } - size_t expanded_bytes_written = 0; - CHECK_ESP_RESULT(i2s_write(self->instance, signed_samples, bytes_per_output_frame*framecount, &expanded_bytes_written, 0)); - assert(expanded_bytes_written % 4 == 0); - bytes_written = expanded_bytes_written / bytes_per_output_frame * bytes_per_input_frame; - } - self->sample_data += bytes_written; - // We have filled the DMA buffer - if (!bytes_written) { - break; - } - } -} - -static void i2s_callback_fun(void *self_in) { - i2s_t *self = self_in; - i2s_fill_buffer(self); -} - -static void i2s_event_task(void *self_in) { - i2s_t *self = self_in; - while(true) { - i2s_event_type_t event; - BaseType_t result = xQueueReceive(i2s_queues[self->instance], &event, portMAX_DELAY); - if (result && event == I2S_EVENT_TX_DONE) { - background_callback_add(&self->callback, i2s_callback_fun, self_in); - } - } -} - -void port_i2s_allocate_init(i2s_t *self, bool left_justified) { - self->instance = port_i2s_allocate(); - - i2s_config_t i2s_config = { - .mode = I2S_MODE_MASTER | I2S_MODE_TX, - .sample_rate = 44100, - .bits_per_sample = 16, - .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT, - .communication_format = left_justified ? I2S_COMM_FORMAT_STAND_I2S : I2S_COMM_FORMAT_STAND_I2S, - .dma_buf_count = 2, - .dma_buf_len = 128, // in _frames_, so 128 is 512 bytes per dma buf - .use_apll = false, - }; - CHECK_ESP_RESULT(i2s_driver_install(self->instance, &i2s_config, I2S_QUEUE_SIZE, &i2s_queues[self->instance])); - - if (!xTaskCreate(i2s_event_task, "I2S_task", 3 * configMINIMAL_STACK_SIZE, self, CONFIG_PTHREAD_TASK_PRIO_DEFAULT, &i2s_tasks[self->instance])) { - mp_raise_OSError_msg(translate("xTaskCreate failed")); - } - i2s_instance[self->instance] = self; - -} - - -void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop) { - self->sample = sample; - self->loop = loop; - self->bytes_per_sample = audiosample_bits_per_sample(sample) / 8; - self->channel_count = audiosample_channel_count(sample); - bool single_buffer; - bool samples_signed; - uint32_t max_buffer_length; - uint8_t spacing; - audiosample_get_buffer_structure(sample, false, &single_buffer, &samples_signed, - &max_buffer_length, &spacing); - self->samples_signed = samples_signed; - self->playing = true; - self->paused = false; - self->stopping = false; - self->sample_data = self->sample_end = NULL; - // We always output stereo so output twice as many bits. - // uint16_t bits_per_sample_output = bits_per_sample * 2; - - audiosample_reset_buffer(self->sample, false, 0); - - CHECK_ESP_RESULT(i2s_set_sample_rates(self->instance, audiosample_sample_rate(sample))); - - background_callback_add(&self->callback, i2s_callback_fun, self); -} - -bool port_i2s_playing(i2s_t *self) { - return self->playing && !self->stopping; -} - -bool port_i2s_paused(i2s_t *self) { - return self->paused; -} - -void port_i2s_stop(i2s_t *self) { - self->sample = NULL; - self->paused = false; - self->playing = false; - self->stopping = false; -} - -void port_i2s_pause(i2s_t *self) { - if (!self->paused) { - self->paused = true; - CHECK_ESP_RESULT(i2s_stop(self->instance)); - } -} - -void port_i2s_resume(i2s_t *self) { - if (self->paused) { - self->paused = false; - CHECK_ESP_RESULT(i2s_start(self->instance)); - } -} diff --git a/ports/esp32s2/i2s_common.h b/ports/esp32s2/i2s_common.h deleted file mode 100644 index 7709735daeca7..0000000000000 --- a/ports/esp32s2/i2s_common.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2020 Jeff Epler 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. - */ - -#pragma once - -#include "py/obj.h" - -#include "supervisor/background_callback.h" - -#include "driver/i2s.h" - -typedef struct { - mp_obj_t *sample; - bool left_justified; - bool loop; - bool paused; - bool playing; - bool stopping; - bool samples_signed; - int8_t bytes_per_sample; - int8_t channel_count; - int8_t instance; - uint16_t buffer_length; - uint8_t *sample_data, *sample_end; - i2s_config_t i2s_config; - background_callback_t callback; -} i2s_t; - - -void port_i2s_allocate_init(i2s_t *self, bool left_justified); -void port_i2s_reset_instance(int i); -void i2s_reset(void); -void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop); -void port_i2s_stop(i2s_t *self); -bool port_i2s_playing(i2s_t *self); -bool port_i2s_paused(i2s_t *self); -void port_i2s_pause(i2s_t *self); -void port_i2s_resume(i2s_t *self); diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index a6b6a82aa49de..a5215fdefd343 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -62,7 +62,7 @@ #include "components/soc/soc/esp32s2/include/soc/rtc_cntl_reg.h" #if CIRCUITPY_AUDIOBUSIO -#include "i2s_common.h" +#include "common-hal/audiobusio/__init__.h" #endif #define HEAP_SIZE (48 * 1024) From e20c65d8f044cb9522cd1a7f4a3030efefa77cbb Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 9 Jan 2021 13:59:54 -0600 Subject: [PATCH 593/770] background tasks: Add, use port_wake_main_task Some ports need an extra operation to ensure that the main task is awoken so that a queued background task will execute during an ongoing light sleep. This removes the need to enable supervisor ticks while I2SOut is operating. Closes: #3952 --- ports/esp32s2/common-hal/audiobusio/I2SOut.c | 4 ---- ports/esp32s2/supervisor/port.c | 12 +++++++++++- supervisor/port.h | 4 ++++ supervisor/shared/background_callback.c | 4 ++++ 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ports/esp32s2/common-hal/audiobusio/I2SOut.c b/ports/esp32s2/common-hal/audiobusio/I2SOut.c index ee16c6ca8921e..86322be8655fa 100644 --- a/ports/esp32s2/common-hal/audiobusio/I2SOut.c +++ b/ports/esp32s2/common-hal/audiobusio/I2SOut.c @@ -63,8 +63,6 @@ void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t* self, self->bit_clock = bit_clock; self->word_select = word_select; self->data = data; - - supervisor_enable_tick(); } bool common_hal_audiobusio_i2sout_deinited(audiobusio_i2sout_obj_t* self) { @@ -95,8 +93,6 @@ void common_hal_audiobusio_i2sout_deinit(audiobusio_i2sout_obj_t* self) { port_i2s_reset_instance(self->peripheral.instance); } self->peripheral.instance = -1; - - supervisor_disable_tick(); } void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t* self, diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index a5215fdefd343..6491e7430c4c4 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -111,6 +111,12 @@ safe_mode_t port_init(void) { heap = NULL; never_reset_module_internal_pins(); + #if defined(DEBUG) + // debug UART + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif + #if defined(DEBUG) || defined(ENABLE_JTAG) // JTAG common_hal_never_reset_pin(&pin_GPIO39); @@ -291,10 +297,14 @@ void port_disable_tick(void) { esp_timer_stop(_tick_timer); } -void sleep_timer_cb(void* arg) { +void port_wake_main_task() { xTaskNotifyGive(circuitpython_task); } +void sleep_timer_cb(void* arg) { + port_wake_main_task(); +} + void port_interrupt_after_ticks(uint32_t ticks) { uint64_t timeout_us = ticks * 1000000ull / 1024; if (esp_timer_start_once(_sleep_timer, timeout_us) != ESP_OK) { diff --git a/supervisor/port.h b/supervisor/port.h index 862400986b801..812cf715b1913 100644 --- a/supervisor/port.h +++ b/supervisor/port.h @@ -99,4 +99,8 @@ void port_background_task(void); void port_start_background_task(void); void port_finish_background_task(void); +// Some ports need special handling to wake the main task from an interrupt +// context or other task. The port must implement the necessary code in this +// function. A default weak implementation is provided that does nothing. +void port_wake_main_task(void); #endif // MICROPY_INCLUDED_SUPERVISOR_PORT_H diff --git a/supervisor/shared/background_callback.c b/supervisor/shared/background_callback.c index ef686cbabe5bc..288c9a4df297a 100644 --- a/supervisor/shared/background_callback.c +++ b/supervisor/shared/background_callback.c @@ -38,6 +38,8 @@ STATIC volatile background_callback_t *callback_head, *callback_tail; #define CALLBACK_CRITICAL_BEGIN (common_hal_mcu_disable_interrupts()) #define CALLBACK_CRITICAL_END (common_hal_mcu_enable_interrupts()) +MP_WEAK void port_wake_main_task(void) {} + void background_callback_add_core(background_callback_t *cb) { CALLBACK_CRITICAL_BEGIN; if (cb->prev || callback_head == cb) { @@ -55,6 +57,8 @@ void background_callback_add_core(background_callback_t *cb) { } callback_tail = cb; CALLBACK_CRITICAL_END; + + port_wake_main_task(); } void background_callback_add(background_callback_t *cb, background_callback_fun fun, void *data) { From 908e02439d79b7dd9d29f7465833aead504c257c Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sat, 9 Jan 2021 15:04:23 -0500 Subject: [PATCH 594/770] Look up TCC resolution as necessary --- ports/atmel-samd/common-hal/pwmio/PWMOut.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ports/atmel-samd/common-hal/pwmio/PWMOut.c b/ports/atmel-samd/common-hal/pwmio/PWMOut.c index 2e538ccdc393b..b5142c21e1692 100644 --- a/ports/atmel-samd/common-hal/pwmio/PWMOut.c +++ b/ports/atmel-samd/common-hal/pwmio/PWMOut.c @@ -44,6 +44,7 @@ # define _TCC_SIZE(unused, n) TCC ## n ## _SIZE, # define TCC_SIZES { REPEAT_MACRO(_TCC_SIZE, 0, TCC_INST_NUM) } +static const uint8_t tcc_sizes[TCC_INST_NUM] = TCC_SIZES; static uint32_t tcc_periods[TCC_INST_NUM]; static uint32_t tc_periods[TC_INST_NUM]; @@ -233,8 +234,7 @@ pwmout_result_t common_hal_pwmio_pwmout_construct(pwmio_pwmout_obj_t* self, resolution = 16; } else { // TCC resolution varies so look it up. - const uint8_t _tcc_sizes[TCC_INST_NUM] = TCC_SIZES; - resolution = _tcc_sizes[timer->index]; + resolution = tcc_sizes[timer->index]; } // First determine the divisor that gets us the highest resolution. uint32_t system_clock = common_hal_mcu_processor_get_frequency(); @@ -421,7 +421,8 @@ void common_hal_pwmio_pwmout_set_frequency(pwmio_pwmout_obj_t* self, if (t->is_tc) { resolution = 16; } else { - resolution = 24; + // TCC resolution varies so look it up. + resolution = tcc_sizes[t->index]; } uint32_t system_clock = common_hal_mcu_processor_get_frequency(); uint32_t new_top; From 68a5e6dcbab095a7267fa885f8e5ef4703935c71 Mon Sep 17 00:00:00 2001 From: lady ada Date: Sat, 9 Jan 2021 15:52:58 -0500 Subject: [PATCH 595/770] copypaste typo --- .../boards/adafruit_feather_esp32s2_nopsram/pins.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/pins.c b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/pins.c index bf14d81ae6f0f..d4704c22468e2 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/pins.c +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/pins.c @@ -29,14 +29,14 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO15) }, - { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO15) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO16) }, - { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO15) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO17) }, - { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO15) }, - { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO18) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO21) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO33) }, From b5b0d45b73f38c5b428830e432088bbebe8523ae Mon Sep 17 00:00:00 2001 From: lady ada Date: Sat, 9 Jan 2021 22:36:54 -0500 Subject: [PATCH 596/770] add tft --- .github/workflows/build.yml | 1 + .../board.c | 118 ++++++++++++++++++ .../mpconfigboard.h | 45 +++++++ .../mpconfigboard.mk | 22 ++++ .../pins.c | 72 +++++++++++ .../sdkconfig | 0 6 files changed, 258 insertions(+) create mode 100644 ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c create mode 100644 ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h create mode 100644 ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk create mode 100644 ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c create mode 100644 ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4fccb159698bb..b918ba64a81ab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -432,6 +432,7 @@ jobs: matrix: board: - "adafruit_feather_esp32s2_nopsram" + - "adafruit_feather_esp32s2_tftback_nopsram" - "adafruit_magtag_2.9_grayscale" - "adafruit_metro_esp32s2" - "electroniccats_bastwifi" diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c new file mode 100644 index 0000000000000..304a64e451a1e --- /dev/null +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c @@ -0,0 +1,118 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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 "supervisor/board.h" +#include "mpconfigboard.h" +#include "hal/include/hal_gpio.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/busio/SPI.h" +#include "shared-bindings/displayio/FourWire.h" +#include "shared-module/displayio/__init__.h" +#include "shared-module/displayio/mipi_constants.h" + +displayio_fourwire_obj_t board_display_obj; + +#define DELAY 0x80 + +uint8_t display_init_sequence[] = { + 0x01, 0 | DELAY, 150, // SWRESET + 0x11, 0 | DELAY, 255, // SLPOUT + 0x36, 1, 0x00, // _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 + 0x29, 0 | DELAY, 255, // _DISPON +}; + +void board_init(void) { + // USB + common_hal_never_reset_pin(&pin_GPIO19); + common_hal_never_reset_pin(&pin_GPIO20); + + // Debug UART +#ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ + + busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; + common_hal_busio_spi_construct(spi, &pin_GPIO36, &pin_GPIO35, NULL); + common_hal_busio_spi_never_reset(spi); + + displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; + bus->base.type = &displayio_fourwire_type; + common_hal_displayio_fourwire_construct(bus, + spi, + &pin_GPIO40, // TFT_DC Command or data + &pin_GPIO42, // TFT_CS Chip select + &pin_GPIO41, // TFT_RST Reset + 20000000, // Baudrate + 0, // Polarity + 0); // Phase + + displayio_display_obj_t* display = &displays[0].display; + display->base.type = &displayio_display_type; + common_hal_displayio_display_construct(display, + bus, + 240, // Width (after rotation) + 135, // Height (after rotation) + 0, // column start + 0, // row start + 0, // rotation + 16, // Color depth + false, // Grayscale + false, // Pixels in a byte share a row. Only used for depth < 8 + 1, // bytes per cell. Only valid for depths < 8 + false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word + MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command + MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command + MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command + 0x37, // set vertical scroll command + display_init_sequence, + sizeof(display_init_sequence), + &pin_GPIO7, // backlight pin + NO_BRIGHTNESS_COMMAND, + 1.0f, // brightness (ignored) + true, // auto_brightness + false, // single_byte_bounds + false, // data_as_commands + true, // auto_refresh + 60, // native_frames_per_second + true, // backlight_on_high + false); // not SH1107 +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} + +void board_deinit(void) { +} diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h new file mode 100644 index 0000000000000..9d95e8e437ab8 --- /dev/null +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h @@ -0,0 +1,45 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 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. + */ + +//Micropython setup + +#define MICROPY_HW_BOARD_NAME "Feather ESP32S2 without PSRAM" +#define MICROPY_HW_MCU_NAME "ESP32S2" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO33) + +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) + +#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") + +#define AUTORESET_DELAY_MS 500 + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO4) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO3) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk new file mode 100644 index 0000000000000..989f092cfc227 --- /dev/null +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk @@ -0,0 +1,22 @@ +USB_VID = 0x239A +USB_PID = 0x80EC +USB_PRODUCT = "Feather ESP32S2 TFT no PSRAM" +USB_MANUFACTURER = "Adafruit" + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = MPZ + +# The default queue depth of 16 overflows on release builds, +# so increase it to 32. +CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 + +CIRCUITPY_ESP_FLASH_MODE=dio +CIRCUITPY_ESP_FLASH_FREQ=40m +CIRCUITPY_ESP_FLASH_SIZE=4MB + +CIRCUITPY_MODULE=wroom + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c new file mode 100644 index 0000000000000..7e2054f414087 --- /dev/null +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c @@ -0,0 +1,72 @@ +#include "shared-bindings/board/__init__.h" + +#include "shared-module/displayio/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_TFT_BACKLIGHT), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO33) }, + + { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, + + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) }, + + { MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO38) }, + + { MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_GPIO42) }, + + { 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_global_dict_table); diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig new file mode 100644 index 0000000000000..e69de29bb2d1d From 5b9ce9e7cfbfccd1d9f30d25bb4d3004175363ab Mon Sep 17 00:00:00 2001 From: lady ada Date: Sat, 9 Jan 2021 22:42:43 -0500 Subject: [PATCH 597/770] fix dup usb --- .../adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk index 989f092cfc227..3ba6f62289ef0 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk @@ -1,5 +1,5 @@ USB_VID = 0x239A -USB_PID = 0x80EC +USB_PID = 0x80EE USB_PRODUCT = "Feather ESP32S2 TFT no PSRAM" USB_MANUFACTURER = "Adafruit" From d036620c707dc2cadd6f955c4d6b9161b01e62a7 Mon Sep 17 00:00:00 2001 From: lady ada Date: Sat, 9 Jan 2021 23:19:04 -0500 Subject: [PATCH 598/770] compilier --- .../boards/adafruit_feather_esp32s2_tftback_nopsram/board.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c index 304a64e451a1e..8d2b260173cc1 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c @@ -26,10 +26,9 @@ #include "supervisor/board.h" #include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/busio/SPI.h" #include "shared-bindings/displayio/FourWire.h" +#include "shared-bindings/microcontroller/Pin.h" #include "shared-module/displayio/__init__.h" #include "shared-module/displayio/mipi_constants.h" From 8652d696142159f147efb74f0947a9e0bd7a357e Mon Sep 17 00:00:00 2001 From: Jonah Yolles-Murphy Date: Sun, 10 Jan 2021 04:04:50 -0500 Subject: [PATCH 599/770] update TG-Watch pins, name, and frozen libraries --- .github/workflows/build.yml | 2 +- .gitmodules | 12 +++ frozen/Adafruit_CircuitPython_Display_Shapes | 1 + frozen/Adafruit_CircuitPython_Display_Text | 1 + frozen/Adafruit_CircuitPython_ProgressBar | 1 + frozen/Adafruit_CircuitPython_ST7789 | 1 + .../{TG-Watch02A => TG-Watch02}/board.c | 0 .../mpconfigboard.h | 11 ++- .../mpconfigboard.mk | 10 ++- ports/nrf/boards/TG-Watch02/pins.c | 73 +++++++++++++++++++ ports/nrf/boards/TG-Watch02A/pins.c | 51 ------------- 11 files changed, 104 insertions(+), 59 deletions(-) create mode 160000 frozen/Adafruit_CircuitPython_Display_Shapes create mode 160000 frozen/Adafruit_CircuitPython_Display_Text create mode 160000 frozen/Adafruit_CircuitPython_ProgressBar create mode 160000 frozen/Adafruit_CircuitPython_ST7789 rename ports/nrf/boards/{TG-Watch02A => TG-Watch02}/board.c (100%) rename ports/nrf/boards/{TG-Watch02A => TG-Watch02}/mpconfigboard.h (88%) rename ports/nrf/boards/{TG-Watch02A => TG-Watch02}/mpconfigboard.mk (66%) create mode 100644 ports/nrf/boards/TG-Watch02/pins.c delete mode 100644 ports/nrf/boards/TG-Watch02A/pins.c diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1a21c13c4f100..d53dc51214483 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -176,7 +176,7 @@ jobs: board: - "8086_commander" - "ADM_B_NRF52840_1" - - "TG-Watch02A" + - "TG-Watch02" - "aloriumtech_evo_m51" - "aramcon_badge_2019" - "arduino_mkr1300" diff --git a/.gitmodules b/.gitmodules index b74cd0b30d846..0fb64d4b576ee 100644 --- a/.gitmodules +++ b/.gitmodules @@ -156,3 +156,15 @@ [submodule "ports/esp32s2/certificates/nina-fw"] path = ports/esp32s2/certificates/nina-fw url = https://github.com/adafruit/nina-fw.git +[submodule "frozen/Adafruit_CircuitPython_ST7789"] + path = frozen/Adafruit_CircuitPython_ST7789 + url = https://github.com/adafruit/Adafruit_CircuitPython_ST7789 +[submodule "frozen/Adafruit_CircuitPython_Display_Shapes"] + path = frozen/Adafruit_CircuitPython_Display_Shapes + url = https://github.com/adafruit/Adafruit_CircuitPython_Display_Shapes +[submodule "frozen/Adafruit_CircuitPython_Display_Text"] + path = frozen/Adafruit_CircuitPython_Display_Text + url = https://github.com/adafruit/Adafruit_CircuitPython_Display_Text +[submodule "frozen/Adafruit_CircuitPython_ProgressBar"] + path = frozen/Adafruit_CircuitPython_ProgressBar + url = https://github.com/adafruit/Adafruit_CircuitPython_ProgressBar diff --git a/frozen/Adafruit_CircuitPython_Display_Shapes b/frozen/Adafruit_CircuitPython_Display_Shapes new file mode 160000 index 0000000000000..07435f53ee60e --- /dev/null +++ b/frozen/Adafruit_CircuitPython_Display_Shapes @@ -0,0 +1 @@ +Subproject commit 07435f53ee60e373042d6a3c8261218edd7c4e88 diff --git a/frozen/Adafruit_CircuitPython_Display_Text b/frozen/Adafruit_CircuitPython_Display_Text new file mode 160000 index 0000000000000..92733f5103eb8 --- /dev/null +++ b/frozen/Adafruit_CircuitPython_Display_Text @@ -0,0 +1 @@ +Subproject commit 92733f5103eb81e1c1f0b0e2cdd9009f3bae344a diff --git a/frozen/Adafruit_CircuitPython_ProgressBar b/frozen/Adafruit_CircuitPython_ProgressBar new file mode 160000 index 0000000000000..f8206d40e9375 --- /dev/null +++ b/frozen/Adafruit_CircuitPython_ProgressBar @@ -0,0 +1 @@ +Subproject commit f8206d40e9375bfa5ffc8ace2948751c742c8f8f diff --git a/frozen/Adafruit_CircuitPython_ST7789 b/frozen/Adafruit_CircuitPython_ST7789 new file mode 160000 index 0000000000000..e0225d3f7c4e1 --- /dev/null +++ b/frozen/Adafruit_CircuitPython_ST7789 @@ -0,0 +1 @@ +Subproject commit e0225d3f7c4e137846cb2ceed4915559d4ba9daf diff --git a/ports/nrf/boards/TG-Watch02A/board.c b/ports/nrf/boards/TG-Watch02/board.c similarity index 100% rename from ports/nrf/boards/TG-Watch02A/board.c rename to ports/nrf/boards/TG-Watch02/board.c diff --git a/ports/nrf/boards/TG-Watch02A/mpconfigboard.h b/ports/nrf/boards/TG-Watch02/mpconfigboard.h similarity index 88% rename from ports/nrf/boards/TG-Watch02A/mpconfigboard.h rename to ports/nrf/boards/TG-Watch02/mpconfigboard.h index 9b8a31858d900..3ed4288a17be3 100644 --- a/ports/nrf/boards/TG-Watch02A/mpconfigboard.h +++ b/ports/nrf/boards/TG-Watch02/mpconfigboard.h @@ -27,10 +27,15 @@ #include "nrfx/hal/nrf_gpio.h" -#define MICROPY_HW_BOARD_NAME "TG-Techie's TG-Watch02A" +#define MICROPY_HW_BOARD_NAME "TG-Watch02" #define MICROPY_HW_MCU_NAME "nRF52840" -#define MICROPY_HW_LED_STATUS (&pin_P0_07) +#define MICROPY_HW_NEOPIXEL (&pin_P0_16) +#define MICROPY_HW_LED_STATUS (&pin_P1_15) + +// TG-Gui requires a deeper call stack than normal CircuitPython +#define CIRCUITPY_PYSTACK_SIZE 8192 // 1536 is the normal size, (32 bytes/frame * 48 frames) +#define BOARD_HAS_CRYSTAL 0 #if QSPI_FLASH_FILESYSTEM #define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 17) @@ -48,8 +53,6 @@ #define SPI_FLASH_CS_PIN &pin_P0_20 #endif -#define BOARD_HAS_CRYSTAL 0 - #define DEFAULT_I2C_BUS_SCL (&pin_P0_11) #define DEFAULT_I2C_BUS_SDA (&pin_P0_12) diff --git a/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk b/ports/nrf/boards/TG-Watch02/mpconfigboard.mk similarity index 66% rename from ports/nrf/boards/TG-Watch02A/mpconfigboard.mk rename to ports/nrf/boards/TG-Watch02/mpconfigboard.mk index 4f5899fa7d2be..d6eff4fed8c19 100644 --- a/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk +++ b/ports/nrf/boards/TG-Watch02/mpconfigboard.mk @@ -1,7 +1,7 @@ USB_VID = 0x239A -USB_PID = 0x80DB -USB_PRODUCT = "TG-Watch02A" -USB_MANUFACTURER = "TG-Tech" +USB_PID = 0x802A +USB_PRODUCT = "TG_Watch02" +USB_MANUFACTURER = "TG-Techie" MCU_CHIP = nrf52840 @@ -11,6 +11,10 @@ EXTERNAL_FLASH_DEVICES = "GD25Q16C, W25Q128JV_SQ" FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_ST7789 +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Display_Shapes +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Display_Text +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_ProgressBar FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LSM6DS FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_FocalTouch FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DS3231 diff --git a/ports/nrf/boards/TG-Watch02/pins.c b/ports/nrf/boards/TG-Watch02/pins.c new file mode 100644 index 0000000000000..71eb1c0a96700 --- /dev/null +++ b/ports/nrf/boards/TG-Watch02/pins.c @@ -0,0 +1,73 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + + /* default ports */ + { 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) }, + + /* TG-Watch02 specific pins */ + { MP_ROM_QSTR(MP_QSTR_VBUS_PRESENT), MP_ROM_PTR(&pin_P1_04) }, + { MP_ROM_QSTR(MP_QSTR_HAPTIC_ENABLE), MP_ROM_PTR(&pin_P1_06) }, + { MP_ROM_QSTR(MP_QSTR_HAPTIC_INT), MP_ROM_PTR(&pin_P1_07) }, + { MP_ROM_QSTR(MP_QSTR_CTP_INT), MP_ROM_PTR(&pin_P1_05) }, + { MP_ROM_QSTR(MP_QSTR_CTP_RST), MP_ROM_PTR(&pin_P1_03) }, + { MP_ROM_QSTR(MP_QSTR_TFT_RST), MP_ROM_PTR(&pin_P1_01) }, + + { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_P1_12) }, + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_P1_13) }, + { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_P1_14) }, + + { MP_ROM_QSTR(MP_QSTR_ACCEL_INT1), MP_ROM_PTR(&pin_P1_11) }, + { MP_ROM_QSTR(MP_QSTR_ACCEL_INT2), MP_ROM_PTR(&pin_P1_10) }, + + { MP_ROM_QSTR(MP_QSTR_BATTERY_DIV), MP_ROM_PTR(&pin_P0_29) }, + + { MP_ROM_QSTR(MP_QSTR_RTC_INT), MP_ROM_PTR(&pin_P0_27) }, + { MP_ROM_QSTR(MP_QSTR_RTC_RST), MP_ROM_PTR(&pin_P0_26) }, + { MP_ROM_QSTR(MP_QSTR_CHRG_STAT), MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_BACKLIGHT), MP_ROM_PTR(&pin_P0_07) }, + { MP_ROM_QSTR(MP_QSTR_SMC_RST), MP_ROM_PTR(&pin_P0_08) }, + + /* nrf52840 compatible pins */ + { 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_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/nrf/boards/TG-Watch02A/pins.c b/ports/nrf/boards/TG-Watch02A/pins.c deleted file mode 100644 index 582d954ecc805..0000000000000 --- a/ports/nrf/boards/TG-Watch02A/pins.c +++ /dev/null @@ -1,51 +0,0 @@ -#include "shared-bindings/board/__init__.h" - -STATIC const mp_rom_map_elem_t board_module_globals_table[] = { - - /*Port and bus pins*/ - { 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_SCL), MP_ROM_PTR(&pin_P0_11) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_12) }, - - { 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) }, - - /*TG-Watch02A specific pins*/ - - //tft / display pins - { MP_ROM_QSTR(MP_QSTR_BACKLIGHT), MP_ROM_PTR(&pin_P0_07) }, - { MP_ROM_QSTR(MP_QSTR_DISP_PWR), MP_ROM_PTR(&pin_P0_05) }, - { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_P1_14) }, - { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_P1_12) }, - { MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_P1_01) }, - - //cap touch screen - { MP_ROM_QSTR(MP_QSTR_CTP_RESET), MP_ROM_PTR(&pin_P1_03) }, - { MP_ROM_QSTR(MP_QSTR_CTP_INT), MP_ROM_PTR(&pin_P1_05) }, - - //power / battery - { MP_ROM_QSTR(MP_QSTR_CHRG_STAT), MP_ROM_PTR(&pin_P0_06) }, - { MP_ROM_QSTR(MP_QSTR_BAT_VDIV), MP_ROM_PTR(&pin_P0_29) }, - { MP_ROM_QSTR(MP_QSTR_VBUS_PRESENT), MP_ROM_PTR(&pin_P1_04) }, - - //sensors / outputs - { MP_ROM_QSTR(MP_QSTR_RTC_RESET), MP_ROM_PTR(&pin_P0_26) }, - { MP_ROM_QSTR(MP_QSTR_RTC_INT), MP_ROM_PTR(&pin_P0_27) }, - - { MP_ROM_QSTR(MP_QSTR_ACCEL_INT1), MP_ROM_PTR(&pin_P1_11) }, - { MP_ROM_QSTR(MP_QSTR_ACCEL_INT2), MP_ROM_PTR(&pin_P1_10) }, - - { MP_ROM_QSTR(MP_QSTR_HAPTIC_INT), MP_ROM_PTR(&pin_P1_07) }, - { MP_ROM_QSTR(MP_QSTR_HAPTIC_ENABLE), MP_ROM_PTR(&pin_P1_06) }, - - //smc pins - { MP_ROM_QSTR(MP_QSTR_SMC_RESET), MP_ROM_PTR(&pin_P0_08) }, - { MP_ROM_QSTR(MP_QSTR_BUTTON0), MP_ROM_PTR(&pin_P1_08) }, - { MP_ROM_QSTR(MP_QSTR_BUTTON1), MP_ROM_PTR(&pin_P1_09) }, -}; - -MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 53e4d78a3cf42b4a8766d8d2d8315464b80b9632 Mon Sep 17 00:00:00 2001 From: BennyE Date: Sun, 10 Jan 2021 17:18:43 +0100 Subject: [PATCH 600/770] Update ports/esp32s2/common-hal/wifi/Network.c Avoid to use yet another variable. Co-authored-by: Scott Shawcroft --- ports/esp32s2/common-hal/wifi/Network.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/Network.c b/ports/esp32s2/common-hal/wifi/Network.c index 83c675a190655..b6eb6bb433e95 100644 --- a/ports/esp32s2/common-hal/wifi/Network.c +++ b/ports/esp32s2/common-hal/wifi/Network.c @@ -86,6 +86,5 @@ mp_obj_t common_hal_wifi_network_get_authmode(wifi_network_obj_t *self) { authmode = "UNKNOWN"; break; } - const char* cstr = (const char*) authmode; - return mp_obj_new_str(cstr, strlen(cstr)); + return mp_obj_new_str(authmode, strlen(authmode)); } From c87e1a6527edd6cfe218bf1b5241468ef9161646 Mon Sep 17 00:00:00 2001 From: lady ada Date: Sun, 10 Jan 2021 11:58:39 -0500 Subject: [PATCH 601/770] ok lets try without auto-display --- .../adafruit_feather_esp32s2_tftback_nopsram/board.c | 7 ++++++- .../boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c index 8d2b260173cc1..c8be187470209 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c @@ -32,6 +32,7 @@ #include "shared-module/displayio/__init__.h" #include "shared-module/displayio/mipi_constants.h" +/* displayio_fourwire_obj_t board_display_obj; #define DELAY 0x80 @@ -46,6 +47,8 @@ uint8_t display_init_sequence[] = { 0x29, 0 | DELAY, 255, // _DISPON }; +*/ + void board_init(void) { // USB common_hal_never_reset_pin(&pin_GPIO19); @@ -57,6 +60,7 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO44); #endif /* DEBUG */ + /* busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; common_hal_busio_spi_construct(spi, &pin_GPIO36, &pin_GPIO35, NULL); common_hal_busio_spi_never_reset(spi); @@ -68,7 +72,7 @@ void board_init(void) { &pin_GPIO40, // TFT_DC Command or data &pin_GPIO42, // TFT_CS Chip select &pin_GPIO41, // TFT_RST Reset - 20000000, // Baudrate + 4000000, // Baudrate 0, // Polarity 0); // Phase @@ -103,6 +107,7 @@ void board_init(void) { 60, // native_frames_per_second true, // backlight_on_high false); // not SH1107 + */ } bool board_requests_safe_mode(void) { diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c index 7e2054f414087..7e1a72374273f 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c @@ -67,6 +67,6 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { 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_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} }; MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); From a397af9bdfc23d7d0b3c7c05aab799d674b7c953 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sun, 10 Jan 2021 13:16:19 -0500 Subject: [PATCH 602/770] Round BLE timing values; fix timeout check --- ports/nrf/common-hal/_bleio/Adapter.c | 12 ++++++------ shared-bindings/_bleio/Adapter.c | 14 +++++++------- shared-bindings/_pixelbuf/__init__.c | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ports/nrf/common-hal/_bleio/Adapter.c b/ports/nrf/common-hal/_bleio/Adapter.c index 53a40f9a670bf..10794c16a8ba2 100644 --- a/ports/nrf/common-hal/_bleio/Adapter.c +++ b/ports/nrf/common-hal/_bleio/Adapter.c @@ -469,7 +469,7 @@ mp_obj_t common_hal_bleio_adapter_start_scan(bleio_adapter_obj_t *self, uint8_t* ble_drv_add_event_handler(scan_on_ble_evt, self->scan_results); - uint32_t nrf_timeout = SEC_TO_UNITS(timeout, UNIT_10_MS); + uint32_t nrf_timeout = SEC_TO_UNITS(timeout, UNIT_10_MS) + 0.5f; if (nrf_timeout > UINT16_MAX) { // 0xffff / 100 mp_raise_ValueError(translate("timeout must be < 655.35 secs")); @@ -479,15 +479,15 @@ mp_obj_t common_hal_bleio_adapter_start_scan(bleio_adapter_obj_t *self, uint8_t* mp_raise_ValueError(translate("non-zero timeout must be > 0.01")); } - if (nrf_timeout) { + if (nrf_timeout == 0) { nrf_timeout = BLE_GAP_SCAN_TIMEOUT_UNLIMITED; } ble_gap_scan_params_t scan_params = { .extended = extended, - .interval = SEC_TO_UNITS(interval, UNIT_0_625_MS), + .interval = SEC_TO_UNITS(interval, UNIT_0_625_MS) + 0.5f, .timeout = nrf_timeout, - .window = SEC_TO_UNITS(window, UNIT_0_625_MS), + .window = SEC_TO_UNITS(window, UNIT_0_625_MS) + 0.5f, .scan_phys = BLE_GAP_PHY_1MBPS, .active = active }; @@ -553,7 +553,7 @@ mp_obj_t common_hal_bleio_adapter_connect(bleio_adapter_obj_t *self, bleio_addre .window = MSEC_TO_UNITS(100, UNIT_0_625_MS), .scan_phys = BLE_GAP_PHY_1MBPS, // timeout of 0 means no timeout - .timeout = SEC_TO_UNITS(timeout, UNIT_10_MS), + .timeout = SEC_TO_UNITS(timeout, UNIT_10_MS) + 0.5f, }; ble_gap_conn_params_t conn_params = { @@ -696,7 +696,7 @@ uint32_t _common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self, } ble_gap_adv_params_t adv_params = { - .interval = SEC_TO_UNITS(interval, UNIT_0_625_MS), + .interval = SEC_TO_UNITS(interval, UNIT_0_625_MS) + 0.5f, .properties.type = adv_type, .duration = SEC_TO_UNITS(timeout, UNIT_10_MS), .filter_policy = BLE_GAP_ADV_FP_ANY, diff --git a/shared-bindings/_bleio/Adapter.c b/shared-bindings/_bleio/Adapter.c index 7d7076aab6577..81277fd701e05 100644 --- a/shared-bindings/_bleio/Adapter.c +++ b/shared-bindings/_bleio/Adapter.c @@ -33,8 +33,8 @@ #include "shared-bindings/_bleio/Address.h" #include "shared-bindings/_bleio/Adapter.h" -#define ADV_INTERVAL_MIN (0.02001f) -#define ADV_INTERVAL_MIN_STRING "0.02001" +#define ADV_INTERVAL_MIN (0.02f) +#define ADV_INTERVAL_MIN_STRING "0.02" #define ADV_INTERVAL_MAX (10.24f) #define ADV_INTERVAL_MAX_STRING "10.24" // 20ms is recommended by Apple @@ -204,7 +204,7 @@ const mp_obj_property_t bleio_adapter_name_obj = { //| :param ~_typing.ReadableBuffer scan_response: scan response data packet bytes. ``None`` if no scan response is needed. //| :param bool connectable: If `True` then other devices are allowed to connect to this peripheral. //| :param bool anonymous: If `True` then this device's MAC address is randomized before advertising. -//| :param int timeout: If set, we will only advertise for this many seconds. +//| :param int timeout: If set, we will only advertise for this many seconds. Zero means no timeout. //| :param float interval: advertising interval, in seconds""" //| ... //| @@ -237,7 +237,7 @@ STATIC mp_obj_t bleio_adapter_start_advertising(mp_uint_t n_args, const mp_obj_t args[ARG_interval].u_obj = mp_obj_new_float(ADV_INTERVAL_DEFAULT); } - const mp_float_t interval = mp_obj_float_get(args[ARG_interval].u_obj); + const mp_float_t interval = mp_obj_get_float(args[ARG_interval].u_obj); if (interval < ADV_INTERVAL_MIN || interval > ADV_INTERVAL_MAX) { mp_raise_ValueError_varg(translate("interval must be in range %s-%s"), ADV_INTERVAL_MIN_STRING, ADV_INTERVAL_MAX_STRING); @@ -279,7 +279,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_advertising_obj, bleio_adapt //| ignored. Format is one byte for length (n) and n bytes of prefix and can be repeated. //| :param int buffer_size: the maximum number of advertising bytes to buffer. //| :param bool extended: When True, support extended advertising packets. Increasing buffer_size is recommended when this is set. -//| :param float timeout: the scan timeout in seconds. If None, will scan until `stop_scan` is called. +//| :param float timeout: the scan timeout in seconds. If None or zero, will scan until `stop_scan` is called. //| :param float interval: the interval (in seconds) between the start of two consecutive scan windows //| Must be in the range 0.0025 - 40.959375 seconds. //| :param float window: the duration (in seconds) to scan a single BLE channel. @@ -320,7 +320,7 @@ STATIC mp_obj_t bleio_adapter_start_scan(size_t n_args, const mp_obj_t *pos_args args[ARG_window].u_obj = mp_obj_new_float(WINDOW_DEFAULT); } - const mp_float_t interval = mp_obj_float_get(args[ARG_interval].u_obj); + const mp_float_t interval = mp_obj_get_float(args[ARG_interval].u_obj); if (interval < INTERVAL_MIN || interval > INTERVAL_MAX) { mp_raise_ValueError_varg(translate("interval must be in range %s-%s"), INTERVAL_MIN_STRING, INTERVAL_MAX_STRING); } @@ -332,7 +332,7 @@ STATIC mp_obj_t bleio_adapter_start_scan(size_t n_args, const mp_obj_t *pos_args } #pragma GCC diagnostic pop - const mp_float_t window = mp_obj_float_get(args[ARG_window].u_obj); + const mp_float_t window = mp_obj_get_float(args[ARG_window].u_obj); if (window > interval) { mp_raise_ValueError(translate("window must be <= interval")); } diff --git a/shared-bindings/_pixelbuf/__init__.c b/shared-bindings/_pixelbuf/__init__.c index c61acc939f761..fdd02509c891a 100644 --- a/shared-bindings/_pixelbuf/__init__.c +++ b/shared-bindings/_pixelbuf/__init__.c @@ -51,7 +51,7 @@ //| STATIC mp_obj_t pixelbuf_colorwheel(mp_obj_t n) { - return MP_OBJ_NEW_SMALL_INT(colorwheel(MP_OBJ_IS_SMALL_INT(n) ? MP_OBJ_SMALL_INT_VALUE(n) : mp_obj_float_get(n))); + return MP_OBJ_NEW_SMALL_INT(colorwheel(MP_OBJ_IS_SMALL_INT(n) ? MP_OBJ_SMALL_INT_VALUE(n) : mp_obj_get_float(n))); } STATIC MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_colorwheel_obj, pixelbuf_colorwheel); From 6928de0364fa6682bd39b48b1bac9a566773f3fd Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sun, 10 Jan 2021 13:54:08 -0500 Subject: [PATCH 603/770] merge from upstream and update to 6.0.x --- docs/robots.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/robots.txt b/docs/robots.txt index 39a4eaeed9f59..ad3189d42c3da 100644 --- a/docs/robots.txt +++ b/docs/robots.txt @@ -1,6 +1,6 @@ User-agent: * Allow: /*/latest/ Allow: /en/latest/ # Fallback for bots that don't understand wildcards -Allow: /*/5.3.x/ -Allow: /en/5.3.x/ # Fallback for bots that don't understand wildcards +Allow: /*/6.0.x/ +Allow: /en/6.0.x/ # Fallback for bots that don't understand wildcards Disallow: / From 316bd0c72d852ce5983decd17b4b0bfd4828f294 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sun, 10 Jan 2021 19:19:48 -0500 Subject: [PATCH 604/770] fix atmel-samd DAC channel selection logic --- .../common-hal/analogio/AnalogOut.c | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/ports/atmel-samd/common-hal/analogio/AnalogOut.c b/ports/atmel-samd/common-hal/analogio/AnalogOut.c index 1565b0a8f48ae..2ddbb6e3a4fc5 100644 --- a/ports/atmel-samd/common-hal/analogio/AnalogOut.c +++ b/ports/atmel-samd/common-hal/analogio/AnalogOut.c @@ -55,21 +55,22 @@ void common_hal_analogio_analogout_construct(analogio_analogout_obj_t* self, mp_raise_NotImplementedError(translate("No DAC on chip")); #else - int channel = -1; - - #if defined(PIN_PA02) && !defined(IGNORE_PIN_PA02) - if (pin->number != PIN_PA02) { - channel = 0; - } - #endif - #if defined(PIN_PA05) && defined(PIN_PA05) && !defined(IGNORE_PIN_PA05) - if (pin->number != PIN_PA05) { - channel = 1; - } - #endif - - if(channel == -1) { - mp_raise_ValueError(translate("AnalogOut not supported on given pin")); + uint8_t channel; + switch (pin->number) { + #if defined(PIN_PA02) && !defined(IGNORE_PIN_PA02) + case PIN_PA02: + channel = 0; + break; + #endif + + #if defined(SAM_D5X_E5X) && defined(PIN_PA05) && defined(PIN_PA05) && !defined(IGNORE_PIN_PA05) + case PIN_PA05: + channel = 1; + break; + #endif + + default: + mp_raise_ValueError(translate("AnalogOut not supported on given pin")); return; } From 5f448139e0c5972def8a8f138cd29afd1e9222f8 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Mon, 11 Jan 2021 15:30:45 +0530 Subject: [PATCH 605/770] fixes and enhancement for touch alarm - prevent touch alarm initialization if not set - fix wake_alarm is set to touch alarm on autoreload - add ability to have multiple touch alarms in light sleep --- locale/circuitpython.pot | 10 +-- ports/esp32s2/common-hal/alarm/__init__.c | 4 +- .../common-hal/alarm/touch/TouchAlarm.c | 66 +++++++++++++------ 3 files changed, 53 insertions(+), 27 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index f319b82f8bbbf..dc5396b8e712e 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: 2021-01-04 12:55-0600\n" +"POT-Creation-Date: 2021-01-11 14:24+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1485,12 +1485,12 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index 47764a03a616d..1cec5d4ae881f 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -92,9 +92,9 @@ STATIC mp_obj_t _get_wake_alarm(size_t n_alarms, const mp_obj_t *alarms) { return alarm_pin_pinalarm_get_wakeup_alarm(n_alarms, alarms); } - case ESP_SLEEP_WAKEUP_TOUCHPAD: + case ESP_SLEEP_WAKEUP_TOUCHPAD: { return alarm_touch_touchalarm_get_wakeup_alarm(n_alarms, alarms); - break; + } case ESP_SLEEP_WAKEUP_UNDEFINED: default: diff --git a/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c b/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c index 20553877ca2f2..3095bc9e8b22c 100644 --- a/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +++ b/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c @@ -31,8 +31,8 @@ #include "peripherals/touch.h" #include "supervisor/esp_port.h" +static uint16_t touch_channel_mask; static volatile bool woke_up = false; -static touch_pad_t touch_channel = TOUCH_PAD_MAX; void common_hal_alarm_touch_touchalarm_construct(alarm_touch_touchalarm_obj_t *self, const mcu_pin_obj_t *pin) { if (pin->touch_channel == TOUCH_PAD_MAX) { @@ -50,14 +50,20 @@ mp_obj_t alarm_touch_touchalarm_get_wakeup_alarm(const size_t n_alarms, const mp } } + // Create TouchAlarm object. alarm_touch_touchalarm_obj_t *alarm = m_new_obj(alarm_touch_touchalarm_obj_t); alarm->base.type = &alarm_touch_touchalarm_type; alarm->pin = NULL; + touch_pad_t wake_channel = touch_pad_get_current_meas_channel(); + if (wake_channel == TOUCH_PAD_MAX) { + return alarm; + } + // Map the pin number back to a pin object. for (size_t i = 0; i < mcu_pin_globals.map.used; i++) { const mcu_pin_obj_t* pin_obj = MP_OBJ_TO_PTR(mcu_pin_globals.map.table[i].value); - if (pin_obj->touch_channel == touch_channel) { + if (pin_obj->touch_channel == wake_channel) { alarm->pin = mcu_pin_globals.map.table[i].value; break; } @@ -83,46 +89,66 @@ void alarm_touch_touchalarm_set_alarm(const bool deep_sleep, const size_t n_alar for (size_t i = 0; i < n_alarms; i++) { if (MP_OBJ_IS_TYPE(alarms[i], &alarm_touch_touchalarm_type)) { - if (!touch_alarm_set) { - touch_alarm = MP_OBJ_TO_PTR(alarms[i]); - touch_alarm_set = true; - } else { - mp_raise_ValueError(translate("Only one alarm.touch alarm can be set.")); + if (deep_sleep && touch_alarm_set) { + mp_raise_ValueError(translate("Only one TouchAlarm can be set in deep sleep.")); } + touch_alarm = MP_OBJ_TO_PTR(alarms[i]); + touch_channel_mask |= 1 << touch_alarm->pin->number; + touch_alarm_set = true; } } + if (!touch_alarm_set) { return; } - touch_channel = touch_alarm->pin->touch_channel; - // configure interrupt for pretend to deep sleep // this will be disabled if we actually deep sleep - // intialize touchpad + // reset touch peripheral peripherals_touch_reset(); peripherals_touch_never_reset(true); - peripherals_touch_init(touch_channel); - // wait for touch data to reset - mp_hal_delay_ms(10); + for (uint8_t i = 1; i <= 14; i++) { + if ((touch_channel_mask & 1 << i) != 0) { + touch_pad_t touch_channel = (touch_pad_t)i; + // intialize touchpad + peripherals_touch_init(touch_channel); - // configure trigger threshold - uint32_t touch_value; - touch_pad_read_benchmark(touch_channel, &touch_value); - touch_pad_set_thresh(touch_channel, touch_value * 0.1); //10% + // wait for touch data to reset + mp_hal_delay_ms(10); + + // configure trigger threshold + uint32_t touch_value; + touch_pad_read_benchmark(touch_channel, &touch_value); + touch_pad_set_thresh(touch_channel, touch_value * 0.1); //10% + } + } // configure touch interrupt touch_pad_timeout_set(true, SOC_TOUCH_PAD_THRESHOLD_MAX); touch_pad_isr_register(touch_interrupt, NULL, TOUCH_PAD_INTR_MASK_ALL); - touch_pad_intr_enable(TOUCH_PAD_INTR_MASK_ACTIVE | TOUCH_PAD_INTR_MASK_INACTIVE | TOUCH_PAD_INTR_MASK_TIMEOUT); + touch_pad_intr_enable(TOUCH_PAD_INTR_MASK_ACTIVE | TOUCH_PAD_INTR_MASK_INACTIVE); } void alarm_touch_touchalarm_prepare_for_deep_sleep(void) { - // intialize touchpad + if (!touch_channel_mask) { + return; + } + + touch_pad_t touch_channel = TOUCH_PAD_MAX; + for (uint8_t i = 1; i <= 14; i++) { + if ((touch_channel_mask & 1 << i) != 0) { + touch_channel = (touch_pad_t)i; + break; + } + } + + // reset touch peripheral peripherals_touch_never_reset(false); peripherals_touch_reset(); + + // intialize touchpad peripherals_touch_init(touch_channel); // configure touchpad for sleep @@ -148,6 +174,6 @@ bool alarm_touch_touchalarm_woke_us_up(void) { void alarm_touch_touchalarm_reset(void) { woke_up = false; - touch_channel = TOUCH_PAD_MAX; + touch_channel_mask = 0; peripherals_touch_never_reset(false); } From 0593e464bfa52eda31ff53772f6e7f8150f6b01c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 11 Jan 2021 13:52:46 -0600 Subject: [PATCH 606/770] ulab: bump to version 1.6.1 --- extmod/ulab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extmod/ulab b/extmod/ulab index c4b06e419f3d5..d62d07ea0b959 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit c4b06e419f3d515478b05bb8ce03ebdb29cddec4 +Subproject commit d62d07ea0b9597535428ebe6012da6b0d6608bf9 From 9e9291777f5fe3bb6f1545c62cb7285268f61cda Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Mon, 11 Jan 2021 16:09:05 -0500 Subject: [PATCH 607/770] Update created code.py file formatting. --- supervisor/shared/filesystem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervisor/shared/filesystem.c b/supervisor/shared/filesystem.c index 88603be0c057b..184c67b5f59f2 100644 --- a/supervisor/shared/filesystem.c +++ b/supervisor/shared/filesystem.c @@ -74,7 +74,7 @@ static void make_sample_code_file(FATFS *fatfs) { #if CIRCUITPY_FULL_BUILD FIL fs; UINT char_written = 0; - const byte buffer[] = "print('Hello World!')\n"; + const byte buffer[] = "print("Hello World!")\n"; //Create or modify existing code.py file f_open(fatfs, &fs, "/code.py", FA_WRITE | FA_CREATE_ALWAYS); f_write(&fs, buffer, sizeof(buffer) - 1, &char_written); From 09596ddca208b2bd337c5e6650e61d1ff972dad4 Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Mon, 11 Jan 2021 16:26:27 -0500 Subject: [PATCH 608/770] Adding escape characters. --- supervisor/shared/filesystem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervisor/shared/filesystem.c b/supervisor/shared/filesystem.c index 184c67b5f59f2..618dc796b89b0 100644 --- a/supervisor/shared/filesystem.c +++ b/supervisor/shared/filesystem.c @@ -74,7 +74,7 @@ static void make_sample_code_file(FATFS *fatfs) { #if CIRCUITPY_FULL_BUILD FIL fs; UINT char_written = 0; - const byte buffer[] = "print("Hello World!")\n"; + const byte buffer[] = "print(\"Hello World!\")\n"; //Create or modify existing code.py file f_open(fatfs, &fs, "/code.py", FA_WRITE | FA_CREATE_ALWAYS); f_write(&fs, buffer, sizeof(buffer) - 1, &char_written); From 0bc5461dc77203ded954a7446f421a520ea50789 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 12 Jan 2021 00:22:49 +0100 Subject: [PATCH 609/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 24 ++++++++++++++++++++++++ locale/cs.po | 24 ++++++++++++++++++++++++ locale/de_DE.po | 24 ++++++++++++++++++++++++ locale/el.po | 24 ++++++++++++++++++++++++ locale/es.po | 24 ++++++++++++++++++++++++ locale/fil.po | 24 ++++++++++++++++++++++++ locale/fr.po | 24 ++++++++++++++++++++++++ locale/hi.po | 24 ++++++++++++++++++++++++ locale/it_IT.po | 24 ++++++++++++++++++++++++ locale/ja.po | 24 ++++++++++++++++++++++++ locale/ko.po | 24 ++++++++++++++++++++++++ locale/nl.po | 24 ++++++++++++++++++++++++ locale/pl.po | 24 ++++++++++++++++++++++++ locale/pt_BR.po | 24 ++++++++++++++++++++++++ locale/sv.po | 24 ++++++++++++++++++++++++ locale/zh_Latn_pinyin.po | 24 ++++++++++++++++++++++++ 16 files changed, 384 insertions(+) diff --git a/locale/ID.po b/locale/ID.po index 9fc91305ee240..2c0408f22844f 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -280,6 +280,10 @@ msgstr "0.0 ke kompleks berpangkat" msgid "3-arg pow() not supported" msgstr "pow() 3-arg tidak didukung" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2474,6 +2478,10 @@ msgstr "" msgid "circle can only be registered in one parent" msgstr "" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "" @@ -2558,6 +2566,10 @@ msgstr "" msgid "default 'except' must be last" msgstr "'except' standar harus terakhir" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2657,6 +2669,10 @@ msgstr "hanya mengharapkan sebuah nilai (value) untuk set" msgid "expecting key:value for dict" msgstr "key:value diharapkan untuk dict" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "argumen keyword ekstra telah diberikan" @@ -3189,6 +3205,10 @@ msgstr "" msgid "no binding for nonlocal found" msgstr "tidak ada ikatan/bind pada temuan nonlocal" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "tidak ada modul yang bernama '%q'" @@ -3523,6 +3543,10 @@ msgstr "kompilasi script tidak didukung" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index c72a781bee536..3d8c8d9530b63 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -278,6 +278,10 @@ msgstr "" msgid "3-arg pow() not supported" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2428,6 +2432,10 @@ msgstr "" msgid "circle can only be registered in one parent" msgstr "" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "" @@ -2512,6 +2520,10 @@ msgstr "" msgid "default 'except' must be last" msgstr "" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2611,6 +2623,10 @@ msgstr "" msgid "expecting key:value for dict" msgstr "" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "" @@ -3143,6 +3159,10 @@ msgstr "" msgid "no binding for nonlocal found" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "" @@ -3476,6 +3496,10 @@ msgstr "" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index a1d0726433d3f..647f294351295 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -279,6 +279,10 @@ msgstr "0.0 zu einer komplexen Potenz" msgid "3-arg pow() not supported" msgstr "3-arg pow() wird nicht unterstützt" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2493,6 +2497,10 @@ msgstr "chr() arg ist nicht in range(256)" msgid "circle can only be registered in one parent" msgstr "Kreis kann nur in einem Elternteil registriert werden" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c 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" @@ -2579,6 +2587,10 @@ msgstr "Dezimalzahlen nicht unterstützt" msgid "default 'except' must be last" msgstr "Die Standart-Ausnahmebehandlung muss als letztes sein" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2680,6 +2692,10 @@ msgstr "Erwarte nur einen Wert für set" msgid "expecting key:value for dict" msgstr "Erwarte key:value für dict" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "Es wurden zusätzliche Keyword-Argumente angegeben" @@ -3219,6 +3235,10 @@ msgstr "kein verfügbares Netzwerkadapter (NIC)" msgid "no binding for nonlocal found" msgstr "Kein Binding für nonlocal gefunden" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "Kein Modul mit dem Namen '%q'" @@ -3558,6 +3578,10 @@ msgstr "kompilieren von Skripten nicht unterstützt" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "Vorzeichen nicht erlaubt in einem String formatierungs specifier" diff --git a/locale/el.po b/locale/el.po index acf4241d19835..bfa6779ab71da 100644 --- a/locale/el.po +++ b/locale/el.po @@ -275,6 +275,10 @@ msgstr "" msgid "3-arg pow() not supported" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2425,6 +2429,10 @@ msgstr "" msgid "circle can only be registered in one parent" msgstr "" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "" @@ -2509,6 +2517,10 @@ msgstr "" msgid "default 'except' must be last" msgstr "" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2608,6 +2620,10 @@ msgstr "" msgid "expecting key:value for dict" msgstr "" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "" @@ -3140,6 +3156,10 @@ msgstr "" msgid "no binding for nonlocal found" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "" @@ -3473,6 +3493,10 @@ msgstr "" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "" diff --git a/locale/es.po b/locale/es.po index 90fbc5631b5e7..e4391fef64216 100644 --- a/locale/es.po +++ b/locale/es.po @@ -281,6 +281,10 @@ msgstr "0.0 a una potencia compleja" msgid "3-arg pow() not supported" msgstr "pow() con 3 argumentos no soportado" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2491,6 +2495,10 @@ msgstr "El argumento de chr() no esta en el rango(256)" msgid "circle can only be registered in one parent" msgstr "circulo solo puede ser registrado con un pariente" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c 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)" @@ -2575,6 +2583,10 @@ msgstr "números decimales no soportados" msgid "default 'except' must be last" msgstr "'except' por defecto deberia estar de último" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2676,6 +2688,10 @@ msgstr "esperando solo un valor para set" msgid "expecting key:value for dict" msgstr "esperando la clave:valor para dict" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "argumento(s) por palabra clave adicionales fueron dados" @@ -3211,6 +3227,10 @@ msgstr "NIC no disponible" msgid "no binding for nonlocal found" msgstr "no se ha encontrado ningún enlace para nonlocal" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "ningún módulo se llama '%q'" @@ -3549,6 +3569,10 @@ msgstr "script de compilación no soportado" msgid "shape must be a tuple" msgstr "forma tiene que ser una tupla" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "signo no permitido en el espeficador de string format" diff --git a/locale/fil.po b/locale/fil.po index d82731e316121..82a59922b037f 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -277,6 +277,10 @@ msgstr "0.0 para sa complex power" msgid "3-arg pow() not supported" msgstr "3-arg pow() hindi suportado" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2462,6 +2466,10 @@ msgstr "chr() arg wala sa sakop ng range(256)" msgid "circle can only be registered in one parent" msgstr "" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c 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)" @@ -2546,6 +2554,10 @@ msgstr "decimal numbers hindi sinusuportahan" msgid "default 'except' must be last" msgstr "default 'except' ay dapat sa huli" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2650,6 +2662,10 @@ msgstr "umaasa sa value para sa set" msgid "expecting key:value for dict" msgstr "umaasang key: halaga para sa dict" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "dagdag na keyword argument na ibinigay" @@ -3187,6 +3203,10 @@ msgstr "walang magagamit na NIC" msgid "no binding for nonlocal found" msgstr "no binding para sa nonlocal, nahanap" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "walang module na '%q'" @@ -3524,6 +3544,10 @@ msgstr "script kompilasyon hindi supportado" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "sign hindi maaring string format specifier" diff --git a/locale/fr.po b/locale/fr.po index e898631ea9180..3fb38788f9b1d 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -286,6 +286,10 @@ msgstr "0.0 à une puissance complexe" msgid "3-arg pow() not supported" msgstr "pow() non supporté avec 3 paramètres" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2519,6 +2523,10 @@ msgstr "paramètre de chr() hors les bornes de range(256)" msgid "circle can only be registered in one parent" msgstr "le cercle ne peut être enregistré que dans un seul parent" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c 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)" @@ -2605,6 +2613,10 @@ msgstr "nombres décimaux non supportés" msgid "default 'except' must be last" msgstr "l''except' par défaut doit être en dernier" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2706,6 +2718,10 @@ msgstr "une simple valeur est attendue pour l'ensemble 'set'" msgid "expecting key:value for dict" msgstr "couple clef:valeur attendu pour un dictionnaire 'dict'" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "argument(s) nommé(s) supplémentaire(s) donné(s)" @@ -3245,6 +3261,10 @@ msgstr "adapteur réseau non disponible" msgid "no binding for nonlocal found" msgstr "pas de lien trouvé pour nonlocal" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "pas de module '%q'" @@ -3585,6 +3605,10 @@ msgstr "compilation de script non supportée" msgid "shape must be a tuple" msgstr "forme doit être un tuple" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "signe non autorisé dans les spéc. de formats de chaînes de caractères" diff --git a/locale/hi.po b/locale/hi.po index ba82ca8958f62..916f22a13b378 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -275,6 +275,10 @@ msgstr "" msgid "3-arg pow() not supported" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2425,6 +2429,10 @@ msgstr "" msgid "circle can only be registered in one parent" msgstr "" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "" @@ -2509,6 +2517,10 @@ msgstr "" msgid "default 'except' must be last" msgstr "" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2608,6 +2620,10 @@ msgstr "" msgid "expecting key:value for dict" msgstr "" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "" @@ -3140,6 +3156,10 @@ msgstr "" msgid "no binding for nonlocal found" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "" @@ -3473,6 +3493,10 @@ msgstr "" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index c0b2aa931f8a1..91d11bdcb240f 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -276,6 +276,10 @@ msgstr "0.0 elevato alla potenza di un numero complesso" msgid "3-arg pow() not supported" msgstr "pow() con tre argmomenti non supportata" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2463,6 +2467,10 @@ msgstr "argomento di chr() non è in range(256)" msgid "circle can only be registered in one parent" msgstr "" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "" @@ -2549,6 +2557,10 @@ msgstr "numeri decimali non supportati" msgid "default 'except' must be last" msgstr "'except' predefinito deve essere ultimo" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2652,6 +2664,10 @@ msgstr "un solo valore atteso per set" msgid "expecting key:value for dict" msgstr "chiave:valore atteso per dict" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "argomento nominato aggiuntivo fornito" @@ -3191,6 +3207,10 @@ msgstr "busio.UART non ancora implementato" msgid "no binding for nonlocal found" msgstr "nessun binding per nonlocal trovato" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "nessun modulo chiamato '%q'" @@ -3532,6 +3552,10 @@ msgstr "compilazione dello scrip non suportata" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "segno non permesso nello spcificatore di formato della stringa" diff --git a/locale/ja.po b/locale/ja.po index 770752e995365..7c4e080eb6055 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -280,6 +280,10 @@ msgstr "0.0を複素数でべき乗" msgid "3-arg pow() not supported" msgstr "引数3つのpow()は非対応" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2448,6 +2452,10 @@ msgstr "" msgid "circle can only be registered in one parent" msgstr "" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "" @@ -2534,6 +2542,10 @@ msgstr "" msgid "default 'except' must be last" msgstr "デフォルトのexceptは最後に置く必要があります" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2635,6 +2647,10 @@ msgstr "setには値のみが必要" msgid "expecting key:value for dict" msgstr "dictには key:value が必要" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "余分なキーワード引数があります" @@ -3168,6 +3184,10 @@ msgstr "利用可能なNICがありません" msgid "no binding for nonlocal found" msgstr "nonlocalの対象が見つかりません" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "'%q' という名前のモジュールはありません" @@ -3504,6 +3524,10 @@ msgstr "スクリプトのコンパイルは非対応" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "文字列フォーマット指定子で符号は使えません" diff --git a/locale/ko.po b/locale/ko.po index 97ede047a6012..7bf8c4ca6aec8 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -276,6 +276,10 @@ msgstr "" msgid "3-arg pow() not supported" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2429,6 +2433,10 @@ msgstr "" msgid "circle can only be registered in one parent" msgstr "" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "" @@ -2513,6 +2521,10 @@ msgstr "" msgid "default 'except' must be last" msgstr "" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2612,6 +2624,10 @@ msgstr "" msgid "expecting key:value for dict" msgstr "" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "" @@ -3144,6 +3160,10 @@ msgstr "" msgid "no binding for nonlocal found" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "" @@ -3477,6 +3497,10 @@ msgstr "" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 3fce13212062f..224898f426dd6 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -278,6 +278,10 @@ msgstr "0.0 tot een complexe macht" msgid "3-arg pow() not supported" msgstr "3-arg pow() niet ondersteund" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2480,6 +2484,10 @@ msgid "circle can only be registered in one parent" msgstr "" "cirkel kan slechts bij één object van een hoger niveau worden geregistreerd" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "kleurbuffer moet 3 bytes (RGB) of 4 bytes (RGB + pad byte) zijn" @@ -2564,6 +2572,10 @@ msgstr "decimale getallen zijn niet ondersteund" msgid "default 'except' must be last" msgstr "standaard 'expect' moet laatste zijn" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2665,6 +2677,10 @@ msgstr "verwacht alleen een waarde voor set" msgid "expecting key:value for dict" msgstr "verwacht key:waarde for dict" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "extra keyword argumenten gegeven" @@ -3201,6 +3217,10 @@ msgstr "geen netwerkadapter (NIC) beschikbaar" msgid "no binding for nonlocal found" msgstr "geen binding voor nonlocal gevonden" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "geen module met naam '%q'" @@ -3537,6 +3557,10 @@ msgstr "scriptcompilatie wordt niet ondersteund" msgid "shape must be a tuple" msgstr "vorm moet een tupel zijn" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "teken niet toegestaan in string formaatspecificatie" diff --git a/locale/pl.po b/locale/pl.po index 80d5cf90bdbca..df26ae451c1fd 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -280,6 +280,10 @@ msgstr "0.0 do potęgi zespolonej" msgid "3-arg pow() not supported" msgstr "3-argumentowy pow() jest niewspierany" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2445,6 +2449,10 @@ msgstr "argument chr() poza zakresem range(256)" msgid "circle can only be registered in one parent" msgstr "" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c 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)" @@ -2529,6 +2537,10 @@ msgstr "liczby dziesiętne nieobsługiwane" msgid "default 'except' must be last" msgstr "domyślny 'except' musi być ostatni" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2629,6 +2641,10 @@ msgstr "oczekiwano tylko wartości dla zbioru" msgid "expecting key:value for dict" msgstr "oczekiwano klucz:wartość dla słownika" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "nadmiarowe argumenty nazwane" @@ -3161,6 +3177,10 @@ msgstr "brak wolnego NIC" msgid "no binding for nonlocal found" msgstr "brak wiązania dla zmiennej nielokalnej" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "brak modułu o nazwie '%q'" @@ -3496,6 +3516,10 @@ msgstr "kompilowanie skryptów nieobsługiwane" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "znak jest niedopuszczalny w specyfikacji formatu łańcucha" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index f399ade1678ab..f6dea756598bb 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -286,6 +286,10 @@ msgstr "0,0 para uma potência complexa" msgid "3-arg pow() not supported" msgstr "3-arg pow() não compatível" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2506,6 +2510,10 @@ msgstr "o arg chr() está fora do intervalo(256)" msgid "circle can only be registered in one parent" msgstr "o círculo só pode ser registrado em um pai" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "o buffer das cores deve ter 3 bytes (RGB) ou 4 bytes (RGB + pad byte)" @@ -2592,6 +2600,10 @@ msgstr "os números decimais não são compatíveis" msgid "default 'except' must be last" msgstr "a predefinição 'exceto' deve ser o último" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2694,6 +2706,10 @@ msgstr "esperando apenas um valor para o conjunto" msgid "expecting key:value for dict" msgstr "chave esperada: valor para dict" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "argumentos extras de palavras-chave passados" @@ -3232,6 +3248,10 @@ msgstr "não há uma Placa de Rede disponível" msgid "no binding for nonlocal found" msgstr "nenhuma ligação para nonlocal foi encontrada" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "nenhum módulo chamado '%q'" @@ -3572,6 +3592,10 @@ msgstr "compilação de script não suportada" msgid "shape must be a tuple" msgstr "a forma deve ser uma tupla" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "sinal não permitido no especificador do formato da sequência" diff --git a/locale/sv.po b/locale/sv.po index 6a19dc5ad5552..80950a4002696 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -282,6 +282,10 @@ msgstr "0,0 till ett komplext nummer" msgid "3-arg pow() not supported" msgstr "3-arguments pow() stöds inte" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2480,6 +2484,10 @@ msgstr "chr() arg är inte i intervallet(256)" msgid "circle can only be registered in one parent" msgstr "circle kan endast registreras i en förälder" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "färgbuffert måste vara 3 byte (RGB) eller 4 byte (RGB + pad byte)" @@ -2564,6 +2572,10 @@ msgstr "decimaltal stöds inte" msgid "default 'except' must be last" msgstr "standard \"except\" måste ligga sist" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2666,6 +2678,10 @@ msgstr "förväntar bara ett värde för set" msgid "expecting key:value for dict" msgstr "förväntar nyckel:värde för dict" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "extra keyword-argument angivna" @@ -3201,6 +3217,10 @@ msgstr "ingen tillgänglig NIC" msgid "no binding for nonlocal found" msgstr "ingen bindning för ickelokal hittad" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "ingen modul med namnet '%q'" @@ -3537,6 +3557,10 @@ msgstr "skriptkompilering stöds inte" msgid "shape must be a tuple" msgstr "shape måste vara en tuple" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "tecknet tillåts inte i strängformatspecificerare" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 596855cf6a7eb..63472bedcb103 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -280,6 +280,10 @@ msgstr "0.0 dào fùzá diànyuán" msgid "3-arg pow() not supported" msgstr "bù zhīchí 3-arg pow ()" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2464,6 +2468,10 @@ msgstr "chr() cān shǔ bùzài fànwéi (256)" msgid "circle can only be registered in one parent" msgstr "quānzi zhǐ néng zài yī wèi jiāzhǎng zhōng zhùcè" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "" @@ -2551,6 +2559,10 @@ msgstr "bù zhīchí xiǎoshù shù" msgid "default 'except' must be last" msgstr "mòrèn 'except' bìxū shì zuìhòu yīgè" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2652,6 +2664,10 @@ msgstr "jǐn qídài shèzhì de zhí" msgid "expecting key:value for dict" msgstr "qídài guānjiàn: Zìdiǎn de jiàzhí" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "éwài de guānjiàn cí cānshù" @@ -3185,6 +3201,10 @@ msgstr "méiyǒu kěyòng de NIC" msgid "no binding for nonlocal found" msgstr "zhǎo bù dào fēi běndì de bǎng dìng" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "méiyǒu mókuài '%q'" @@ -3520,6 +3540,10 @@ msgstr "bù zhīchí jiǎoběn biānyì" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "zìfú chuàn géshì shuōmíng fú zhōng bù yǔnxǔ shǐyòng fúhào" From 452d66dd0ec117e9015ff9ce8162326c4bfc6b1a Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 11 Jan 2021 19:12:52 -0500 Subject: [PATCH 610/770] Update ports/atmel-samd/common-hal/analogio/AnalogOut.c whoops, yes! Co-authored-by: Scott Shawcroft --- ports/atmel-samd/common-hal/analogio/AnalogOut.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/atmel-samd/common-hal/analogio/AnalogOut.c b/ports/atmel-samd/common-hal/analogio/AnalogOut.c index 2ddbb6e3a4fc5..3ddd9cac667eb 100644 --- a/ports/atmel-samd/common-hal/analogio/AnalogOut.c +++ b/ports/atmel-samd/common-hal/analogio/AnalogOut.c @@ -63,7 +63,7 @@ void common_hal_analogio_analogout_construct(analogio_analogout_obj_t* self, break; #endif - #if defined(SAM_D5X_E5X) && defined(PIN_PA05) && defined(PIN_PA05) && !defined(IGNORE_PIN_PA05) + #if defined(SAM_D5X_E5X) && defined(PIN_PA05) && !defined(IGNORE_PIN_PA05) case PIN_PA05: channel = 1; break; From 5949516ece3e41caf0d155bb1f4ea3f19a591dfc Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Mon, 11 Jan 2021 20:46:02 -0600 Subject: [PATCH 611/770] Update circuitpython.pot Fix missing closing quote --- locale/circuitpython.pot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index c74bab8234e4b..130cd590322ea 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-30 17:42-0600\n" -"PO-Revision-Date: 2021-01-11 19:30-0600\n +"PO-Revision-Date: 2021-01-11 19:30-0600\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" From 87849fb62cb06547c98c1fd17bf08914cfaa79f4 Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Tue, 12 Jan 2021 07:31:56 -0600 Subject: [PATCH 612/770] Fix pre-commit hook issue --- locale/circuitpython.pot | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 130cd590322ea..307d23f0e5f9a 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,8 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-30 17:42-0600\n" -"PO-Revision-Date: 2021-01-11 19:30-0600\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" From 1f53d5a4b9277d36f0c24f08cc4608c413b7eafa Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Tue, 12 Jan 2021 14:23:49 +0000 Subject: [PATCH 613/770] Translated using Weblate (French) Currently translated at 100.0% (898 of 898 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index 3fb38788f9b1d..60f9bb9aed62e 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-01-07 01:29+0000\n" +"PO-Revision-Date: 2021-01-12 15:40+0000\n" "Last-Translator: Hugo Dahl \n" "Language: fr\n" "MIME-Version: 1.0\n" @@ -288,7 +288,7 @@ msgstr "pow() non supporté avec 3 paramètres" #: shared-module/msgpack/__init__.c msgid "64 bit types" -msgstr "" +msgstr "types à 64 bit" #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c @@ -2525,7 +2525,7 @@ msgstr "le cercle ne peut être enregistré que dans un seul parent" #: shared-bindings/msgpack/ExtType.c msgid "code outside range 0~127" -msgstr "" +msgstr "code hors bornes 0~127" #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" @@ -2615,7 +2615,7 @@ msgstr "l''except' par défaut doit être en dernier" #: shared-bindings/msgpack/__init__.c msgid "default is not a function" -msgstr "" +msgstr "default n'est pas une fonction" #: shared-bindings/audiobusio/PDMIn.c msgid "" @@ -2720,7 +2720,7 @@ msgstr "couple clef:valeur attendu pour un dictionnaire 'dict'" #: shared-bindings/msgpack/__init__.c msgid "ext_hook is not a function" -msgstr "" +msgstr "ext_hook n'est pas une fonction" #: py/argcheck.c msgid "extra keyword arguments given" @@ -3263,7 +3263,7 @@ msgstr "pas de lien trouvé pour nonlocal" #: shared-module/msgpack/__init__.c msgid "no default packer" -msgstr "" +msgstr "aucun emballeur par défault" #: py/builtinimport.c msgid "no module named '%q'" @@ -3607,7 +3607,7 @@ msgstr "forme doit être un tuple" #: shared-module/msgpack/__init__.c msgid "short read" -msgstr "" +msgstr "donnée trop petite" #: py/objstr.c msgid "sign not allowed in string format specifier" From af4732a71675ee847ae827691b4a040bf2f4bd9a Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 12 Jan 2021 16:40:07 +0100 Subject: [PATCH 614/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 8 ++++---- locale/cs.po | 8 ++++---- locale/de_DE.po | 8 ++++---- locale/el.po | 8 ++++---- locale/es.po | 8 ++++---- locale/fil.po | 8 ++++---- locale/fr.po | 11 +++++++---- locale/hi.po | 8 ++++---- locale/it_IT.po | 8 ++++---- locale/ja.po | 8 ++++---- locale/ko.po | 8 ++++---- locale/nl.po | 8 ++++---- locale/pl.po | 8 ++++---- locale/pt_BR.po | 11 +++++++---- locale/sv.po | 11 +++++++---- locale/zh_Latn_pinyin.po | 8 ++++---- 16 files changed, 73 insertions(+), 64 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 2c0408f22844f..f2dc049d9c73e 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -1515,12 +1515,12 @@ msgstr "" "Hanya monokrom, 4bpp atau 8bpp yang diindeks, dan 16bpp atau lebih yang " "didukung: %d bpp diberikan" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/locale/cs.po b/locale/cs.po index 3d8c8d9530b63..f02a5863dace2 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -1491,12 +1491,12 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/locale/de_DE.po b/locale/de_DE.po index 647f294351295..b7f11335a0541 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -1516,12 +1516,12 @@ msgstr "" "Nur monochrome, indizierte 4bpp oder 8bpp, und 16bpp oder größere BMPs " "unterstützt: %d bpp wurden gegeben" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/locale/el.po b/locale/el.po index bfa6779ab71da..77c0f664d0cbb 100644 --- a/locale/el.po +++ b/locale/el.po @@ -1488,12 +1488,12 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/locale/es.po b/locale/es.po index e4391fef64216..227c0c5a13c48 100644 --- a/locale/es.po +++ b/locale/es.po @@ -1515,12 +1515,12 @@ msgstr "" "Solo se admiten BMP monocromáticos, indexados de 4 bpp u 8 bpp y 16 bpp o " "más: %d bpp proporcionados" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/locale/fil.po b/locale/fil.po index 82a59922b037f..ba3cb28923b45 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -1506,12 +1506,12 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/locale/fr.po b/locale/fr.po index 60f9bb9aed62e..a2e704f5b1155 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -1531,14 +1531,14 @@ msgstr "" "Seulement les BMP monochromes, 4 bpp ou 8 bpp, ou 16 bpp et plus sont " "supportés: %d bpp fournis" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." +msgstr "" + #: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "Seulement une alarme alarm.time peut être réglée." -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." -msgstr "Seulement une alarme alarm.touch peut être réglée." - #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "Une seule couleur peut être transparente à la fois" @@ -4006,6 +4006,9 @@ msgstr "zi doit être de type float" msgid "zi must be of shape (n_section, 2)" msgstr "zi doit être de forme (n_section, 2)" +#~ msgid "Only one alarm.touch alarm can be set." +#~ msgstr "Seulement une alarme alarm.touch peut être réglée." + #~ msgid "TouchAlarm not available in light sleep" #~ msgstr "TouchAlarm n'est pas disponible en mode someil léger" diff --git a/locale/hi.po b/locale/hi.po index 916f22a13b378..5c9dfcb77dac4 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -1488,12 +1488,12 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/locale/it_IT.po b/locale/it_IT.po index 91d11bdcb240f..6ee6c710900df 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -1511,12 +1511,12 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/locale/ja.po b/locale/ja.po index 7c4e080eb6055..6c391bb41b339 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -1503,12 +1503,12 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/locale/ko.po b/locale/ko.po index 7bf8c4ca6aec8..deb7c617ee457 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -1491,12 +1491,12 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/locale/nl.po b/locale/nl.po index 224898f426dd6..a9e7d6bf6d058 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -1508,14 +1508,14 @@ msgstr "" "Alleen monochrome en 4bpp of 8bpp, en 16bpp of grotere geïndiceerde BMP's " "zijn ondersteund: %d bpp is gegeven" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." +msgstr "" + #: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "Slechts één alarm.time alarm kan worden ingesteld." -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." -msgstr "" - #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "Er kan maar één kleur per keer transparant zijn" diff --git a/locale/pl.po b/locale/pl.po index df26ae451c1fd..4356b04913479 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -1502,12 +1502,12 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/locale/pt_BR.po b/locale/pt_BR.po index f6dea756598bb..d93307486f6ae 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -1523,14 +1523,14 @@ msgstr "" "São compatíveis apenas os BMPs monocromáticos, indexados em 4bpp ou 8bpp e " "16bpp ou superior: determinado %d bpp" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." +msgstr "" + #: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "Apenas um alarme alarm.time pode ser definido." -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." -msgstr "Apenas um alarme alarm.touch pode ser definido." - #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "Apenas uma cor pode ser transparente de cada vez" @@ -3992,6 +3992,9 @@ msgstr "zi deve ser de um tipo float" msgid "zi must be of shape (n_section, 2)" msgstr "zi deve estar na forma (n_section, 2)" +#~ msgid "Only one alarm.touch alarm can be set." +#~ msgstr "Apenas um alarme alarm.touch pode ser definido." + #~ msgid "TouchAlarm not available in light sleep" #~ msgstr "O TouchAlarm não está disponívle no modo light sleep" diff --git a/locale/sv.po b/locale/sv.po index 80950a4002696..8cae545880c2f 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -1512,14 +1512,14 @@ msgstr "" "Endast monokrom, indexerad 4 bpp eller 8 bpp och 16 bpp eller högre BMP: er " "stöds: %d bpp angiven" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." +msgstr "" + #: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "Endast ett alarm.time kan ställas in." -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." -msgstr "Endast ett larm av typ alarm.touch kan ställas in." - #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "Bara en färg kan vara genomskinlig i taget" @@ -3957,6 +3957,9 @@ msgstr "zi måste vara av typ float" msgid "zi must be of shape (n_section, 2)" msgstr "zi måste vara i formen (n_section, 2)" +#~ msgid "Only one alarm.touch alarm can be set." +#~ msgstr "Endast ett larm av typ alarm.touch kan ställas in." + #~ msgid "input argument must be an integer or a 2-tuple" #~ msgstr "indataargumentet måste vara ett heltal eller en 2-tupel" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 63472bedcb103..735c90743abd2 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -1504,12 +1504,12 @@ msgstr "" "Jǐn zhīchí dān sè, suǒyǐn wéi 4bpp huò 8bpp yǐjí 16bpp huò gèng gāo de BMP: " "Gěi chū %d bpp" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c From f7f97ae1b780458265db2091c9bb1337c3108aed Mon Sep 17 00:00:00 2001 From: lady ada Date: Tue, 12 Jan 2021 12:50:08 -0500 Subject: [PATCH 615/770] samd21 board with only 4 neopixels + two touchpads --- .../boards/neopixel_trinkey_m0/board.c | 40 +++++++++++++ .../neopixel_trinkey_m0/mpconfigboard.h | 57 +++++++++++++++++++ .../neopixel_trinkey_m0/mpconfigboard.mk | 44 ++++++++++++++ .../boards/neopixel_trinkey_m0/pins.c | 9 +++ ports/atmel-samd/supervisor/port.c | 3 +- 5 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 ports/atmel-samd/boards/neopixel_trinkey_m0/board.c create mode 100644 ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.h create mode 100644 ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.mk create mode 100644 ports/atmel-samd/boards/neopixel_trinkey_m0/pins.c diff --git a/ports/atmel-samd/boards/neopixel_trinkey_m0/board.c b/ports/atmel-samd/boards/neopixel_trinkey_m0/board.c new file mode 100644 index 0000000000000..cde441b3d9fab --- /dev/null +++ b/ports/atmel-samd/boards/neopixel_trinkey_m0/board.c @@ -0,0 +1,40 @@ +/* + * 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 "supervisor/board.h" +#include "common-hal/microcontroller/Pin.h" +#include "supervisor/shared/board.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/neopixel_trinkey_m0/mpconfigboard.h b/ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.h new file mode 100644 index 0000000000000..ebf8b1e3450d2 --- /dev/null +++ b/ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.h @@ -0,0 +1,57 @@ +#define MICROPY_HW_BOARD_NAME "Adafruit NeoPixel Trinkey M0" +#define MICROPY_HW_MCU_NAME "samd21e18" + +#define MICROPY_HW_NEOPIXEL (&pin_PA05) + +#define MICROPY_PORT_A (0) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) + +#define IGNORE_PIN_PA00 1 +#define IGNORE_PIN_PA01 1 +#define IGNORE_PIN_PA02 1 +#define IGNORE_PIN_PA04 1 +#define IGNORE_PIN_PA06 1 +#define IGNORE_PIN_PA08 1 +#define IGNORE_PIN_PA09 1 +#define IGNORE_PIN_PA10 1 +#define IGNORE_PIN_PA11 1 +#define IGNORE_PIN_PA12 1 +#define IGNORE_PIN_PA13 1 +#define IGNORE_PIN_PA14 1 +#define IGNORE_PIN_PA15 1 +#define IGNORE_PIN_PA16 1 +#define IGNORE_PIN_PA17 1 +#define IGNORE_PIN_PA18 1 +#define IGNORE_PIN_PA19 1 +#define IGNORE_PIN_PA20 1 +#define IGNORE_PIN_PA21 1 +// USB is always used internally so skip the pin objects for it. +#define IGNORE_PIN_PA24 1 +#define IGNORE_PIN_PA25 1 +#define IGNORE_PIN_PA27 1 +#define IGNORE_PIN_PA28 1 +#define IGNORE_PIN_PA30 1 +#define IGNORE_PIN_PA31 1 +#define IGNORE_PIN_PB00 1 +#define IGNORE_PIN_PB01 1 +#define IGNORE_PIN_PB02 1 +#define IGNORE_PIN_PB03 1 +#define IGNORE_PIN_PB04 1 +#define IGNORE_PIN_PB05 1 +#define IGNORE_PIN_PB06 1 +#define IGNORE_PIN_PB07 1 +#define IGNORE_PIN_PB08 1 +#define IGNORE_PIN_PB09 1 +#define IGNORE_PIN_PB10 1 +#define IGNORE_PIN_PB11 1 +#define IGNORE_PIN_PB12 1 +#define IGNORE_PIN_PB13 1 +#define IGNORE_PIN_PB14 1 +#define IGNORE_PIN_PB15 1 +#define IGNORE_PIN_PB16 1 +#define IGNORE_PIN_PB17 1 +#define IGNORE_PIN_PB22 1 +#define IGNORE_PIN_PB23 1 +#define IGNORE_PIN_PB30 1 +#define IGNORE_PIN_PB31 1 diff --git a/ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.mk b/ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.mk new file mode 100644 index 0000000000000..4b7dbc8f0542e --- /dev/null +++ b/ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.mk @@ -0,0 +1,44 @@ +USB_VID = 0x239A +USB_PID = 0x80F0 +USB_PRODUCT = "NeoPixel Trinkey M0" +USB_MANUFACTURER = "Adafruit Industries LLC" + +CHIP_VARIANT = SAMD21E18A +CHIP_FAMILY = samd21 + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = NONE + +SUPEROPT_GC = 0 + +CIRCUITPY_ANALOGIO = 0 +CIRCUITPY_ROTARYIO = 0 +CIRCUITPY_RTC = 0 +CIRCUITPY_SAMD = 0 +CIRCUITPY_PS2IO = 0 +CIRCUITPY_PULSEIO = 0 +CIRCUITPY_PWMIO = 0 +CIRCUITPY_AUDIOCORE = 0 +CIRCUITPY_BUSIO = 0 +CIRCUITPY_STORAGE = 0 + +CIRCUITPY_MATH = 1 +CIRCUITPY_PIXELBUF = 1 +CIRCUITPY_USB_MIDI = 1 +CIRCUITPY_TOUCHIO = 1 +CIRCUITPY_FULL_BUILD = 0 + +CFLAGS_BOARD = --param max-inline-insns-auto=15 +ifeq ($(TRANSLATION), zh_Latn_pinyin) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +endif +ifeq ($(TRANSLATION), de_DE) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +SUPEROPT_VM = 0 +endif + +# Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID \ No newline at end of file diff --git a/ports/atmel-samd/boards/neopixel_trinkey_m0/pins.c b/ports/atmel-samd/boards/neopixel_trinkey_m0/pins.c new file mode 100644 index 0000000000000..3673fcbeca394 --- /dev/null +++ b/ports/atmel-samd/boards/neopixel_trinkey_m0/pins.c @@ -0,0 +1,9 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_TOUCH1), MP_ROM_PTR(&pin_PA03) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_TOUCH2), MP_ROM_PTR(&pin_PA07) }, + +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index 02b9e3874339e..c2e27e1e7ffdd 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -319,8 +319,9 @@ safe_mode_t port_init(void) { } void reset_port(void) { +#if CIRCUITPY_BUSIO reset_sercoms(); - +#endif #if CIRCUITPY_AUDIOIO audio_dma_reset(); audioout_reset(); From 748d44892def232c0e585c4b1d8a4569d3367315 Mon Sep 17 00:00:00 2001 From: lady ada Date: Tue, 12 Jan 2021 12:55:02 -0500 Subject: [PATCH 616/770] fix some precommit complaints --- .github/workflows/build.yml | 1 + locale/circuitpython.pot | 2 ++ ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.mk | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b918ba64a81ab..9899972ebd024 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -261,6 +261,7 @@ jobs: - "monster_m4sk" - "ndgarage_ndbit6" - "ndgarage_ndbit6_v2" + - "neopixel_trinkey_m0" - "nfc_copy_cat" - "nice_nano" - "nucleo_f746zg" diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 5a8c607632acb..205c8465a9ecf 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -3397,6 +3397,8 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.mk b/ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.mk index 4b7dbc8f0542e..ab8065a9c5865 100644 --- a/ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.mk +++ b/ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.mk @@ -41,4 +41,4 @@ endif # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID \ No newline at end of file +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID From a07b59552d83d0cff03ac98630b7422f19840c48 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 12 Jan 2021 19:25:50 +0100 Subject: [PATCH 617/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 62 ++++++++++++++++++++++++++++++++++++++++ locale/cs.po | 62 ++++++++++++++++++++++++++++++++++++++++ locale/de_DE.po | 62 ++++++++++++++++++++++++++++++++++++++++ locale/el.po | 62 ++++++++++++++++++++++++++++++++++++++++ locale/es.po | 62 ++++++++++++++++++++++++++++++++++++++++ locale/fil.po | 62 ++++++++++++++++++++++++++++++++++++++++ locale/fr.po | 62 ++++++++++++++++++++++++++++++++++++++++ locale/hi.po | 62 ++++++++++++++++++++++++++++++++++++++++ locale/it_IT.po | 62 ++++++++++++++++++++++++++++++++++++++++ locale/ja.po | 62 ++++++++++++++++++++++++++++++++++++++++ locale/ko.po | 62 ++++++++++++++++++++++++++++++++++++++++ locale/nl.po | 62 ++++++++++++++++++++++++++++++++++++++++ locale/pl.po | 62 ++++++++++++++++++++++++++++++++++++++++ locale/pt_BR.po | 62 ++++++++++++++++++++++++++++++++++++++++ locale/sv.po | 62 ++++++++++++++++++++++++++++++++++++++++ locale/zh_Latn_pinyin.po | 62 ++++++++++++++++++++++++++++++++++++++++ 16 files changed, 992 insertions(+) diff --git a/locale/ID.po b/locale/ID.po index f2dc049d9c73e..f4bb1512ef5ae 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -118,6 +118,11 @@ msgstr "%q harus berupa int" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() mengambil posisi argumen %d tapi %d yang diberikan" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "'%q' argumen dibutuhkan" @@ -546,6 +551,10 @@ msgstr "Bytes harus di antara 0 dan 255." msgid "CBC blocks must be multiples of 16 bytes" msgstr "Blok CBC harus merupakan kelipatan 16 byte" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "Panggil super().__init__() sebelum mengakses objek asli." @@ -1006,6 +1015,10 @@ msgstr "Frekuensi harus cocok dengan PWMOut yang ada menggunakan timer ini" msgid "Function requires lock" msgstr "Fungsinya membutuhkan kunci" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1134,6 +1147,7 @@ msgstr "Frekuensi PWM tidak valid" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Argumen tidak valid" @@ -1243,6 +1257,14 @@ msgstr "Mode operasi tidak valid." msgid "Invalid security_mode" msgstr "security_mode tidak valid" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "Suara tidak valid" @@ -1283,6 +1305,10 @@ msgstr "Panjang harus berupa int" msgid "Length must be non-negative" msgstr "Panjangnya harus non-negatif" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "Pin MISO gagal inisialisasi." @@ -1531,6 +1557,18 @@ msgstr "" msgid "Only raw int supported for ip" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "" @@ -1539,6 +1577,10 @@ msgstr "" msgid "Oversample must be multiple of 8." msgstr "Sampel berlebihan harus kelipatan 8." +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1557,6 +1599,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "ParallelBus belum didukung" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "Izin ditolak" @@ -1678,6 +1724,10 @@ msgstr "sistem file (filesystem) bersifat Read-only" msgid "Read-only object" msgstr "sistem file (filesystem) bersifat Read-only" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Segarkan terlalu cepat" @@ -1690,6 +1740,10 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "Mode AES yang diminta tidak didukung" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Channel Kanan tidak didukung" @@ -2069,6 +2123,10 @@ msgstr "" msgid "Value length > max_length" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "" @@ -3920,6 +3978,10 @@ msgstr "" msgid "x value out of bounds" msgstr "" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index f02a5863dace2..2394834a16f06 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -116,6 +116,11 @@ msgstr "%q by měl být int" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() vyžaduje %d pozičních argumentů, ale %d jich bylo zadáno" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "Je vyžadován argument '%q'" @@ -542,6 +547,10 @@ msgstr "" msgid "CBC blocks must be multiples of 16 bytes" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "" @@ -990,6 +999,10 @@ msgstr "" msgid "Function requires lock" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1116,6 +1129,7 @@ msgstr "" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "" @@ -1225,6 +1239,14 @@ msgstr "" msgid "Invalid security_mode" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1265,6 +1287,10 @@ msgstr "" msgid "Length must be non-negative" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "" @@ -1507,6 +1533,18 @@ msgstr "" msgid "Only raw int supported for ip" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "" @@ -1515,6 +1553,10 @@ msgstr "" msgid "Oversample must be multiple of 8." msgstr "" +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1531,6 +1573,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "" @@ -1648,6 +1694,10 @@ msgstr "" msgid "Read-only object" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -1660,6 +1710,10 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "" @@ -2030,6 +2084,10 @@ msgstr "" msgid "Value length > max_length" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "" @@ -3872,6 +3930,10 @@ msgstr "" msgid "x value out of bounds" msgstr "" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index b7f11335a0541..f83fafe3a9c98 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -117,6 +117,11 @@ msgstr "%q sollte ein integer sein" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() nimmt %d Argumente ohne Keyword an, aber es wurden %d angegeben" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "'%q' Argument erforderlich" @@ -547,6 +552,10 @@ msgstr "Ein Bytes kann nur Werte zwischen 0 und 255 annehmen." msgid "CBC blocks must be multiples of 16 bytes" msgstr "CBC-Blöcke müssen ein Vielfaches von 16 Bytes sein" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "Rufe super().__init__() vor dem Zugriff auf ein natives Objekt auf." @@ -1005,6 +1014,10 @@ msgstr "" msgid "Function requires lock" msgstr "Die Funktion erwartet, dass der 'lock'-Befehl zuvor ausgeführt wurde" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1133,6 +1146,7 @@ msgstr "Ungültige PWM Frequenz" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Ungültiges Argument" @@ -1242,6 +1256,14 @@ msgstr "Ungültiger Ausführungsmodus." msgid "Invalid security_mode" msgstr "Ungültiger security_mode" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "Ungültige Stimme" @@ -1282,6 +1304,10 @@ msgstr "Länge muss ein int sein" msgid "Length must be non-negative" msgstr "Länge darf nicht negativ sein" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "MISO pin Initialisierung fehlgeschlagen." @@ -1532,6 +1558,18 @@ msgstr "" msgid "Only raw int supported for ip" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "" @@ -1540,6 +1578,10 @@ msgstr "" msgid "Oversample must be multiple of 8." msgstr "Oversample muss ein Vielfaches von 8 sein." +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1556,6 +1598,10 @@ msgstr "Die PWM-Frequenz ist nicht schreibbar wenn variable_Frequenz = False." msgid "ParallelBus not yet supported" msgstr "ParallelBus wird noch nicht unterstützt" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "Zugang verweigert" @@ -1676,6 +1722,10 @@ msgstr "Schreibgeschützte Dateisystem" msgid "Read-only object" msgstr "Schreibgeschützte Objekt" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Zu früh neu geladen" @@ -1688,6 +1738,10 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "Der angeforderte AES-Modus wird nicht unterstützt" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Rechter Kanal wird nicht unterstützt" @@ -2076,6 +2130,10 @@ msgstr "Wert Länge != Erforderliche feste Länge" msgid "Value length > max_length" msgstr "Länge des Wertes > max_length" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "Viper-Funktionen unterstützen derzeit nicht mehr als 4 Argumente" @@ -3959,6 +4017,10 @@ msgstr "Falscher Ausgabetyp" msgid "x value out of bounds" msgstr "x Wert außerhalb der Grenzen" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "y sollte ein int sein" diff --git a/locale/el.po b/locale/el.po index 77c0f664d0cbb..267bc4987cc82 100644 --- a/locale/el.po +++ b/locale/el.po @@ -113,6 +113,11 @@ msgstr "" msgid "%q() takes %d positional arguments but %d were given" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "" @@ -539,6 +544,10 @@ msgstr "" msgid "CBC blocks must be multiples of 16 bytes" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "" @@ -987,6 +996,10 @@ msgstr "" msgid "Function requires lock" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1113,6 +1126,7 @@ msgstr "" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "" @@ -1222,6 +1236,14 @@ msgstr "" msgid "Invalid security_mode" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1262,6 +1284,10 @@ msgstr "" msgid "Length must be non-negative" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "" @@ -1504,6 +1530,18 @@ msgstr "" msgid "Only raw int supported for ip" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "" @@ -1512,6 +1550,10 @@ msgstr "" msgid "Oversample must be multiple of 8." msgstr "" +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1528,6 +1570,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "" @@ -1645,6 +1691,10 @@ msgstr "" msgid "Read-only object" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -1657,6 +1707,10 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "" @@ -2027,6 +2081,10 @@ msgstr "" msgid "Value length > max_length" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "" @@ -3869,6 +3927,10 @@ msgstr "" msgid "x value out of bounds" msgstr "" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "" diff --git a/locale/es.po b/locale/es.po index 227c0c5a13c48..e456d78295abe 100644 --- a/locale/es.po +++ b/locale/es.po @@ -119,6 +119,11 @@ msgstr "%q debe ser un int" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() toma %d argumentos posicionales pero %d fueron dados" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "argumento '%q' requerido" @@ -551,6 +556,10 @@ msgstr "Bytes debe estar entre 0 y 255." msgid "CBC blocks must be multiples of 16 bytes" msgstr "Los bloques CBC deben ser múltiplos de 16 bytes" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "Llame a super().__ init __() antes de acceder al objeto nativo." @@ -1006,6 +1015,10 @@ msgstr "" msgid "Function requires lock" msgstr "La función requiere lock" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1134,6 +1147,7 @@ msgstr "Frecuencia PWM inválida" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Argumento inválido" @@ -1243,6 +1257,14 @@ msgstr "Modo de ejecución inválido." msgid "Invalid security_mode" msgstr "'security_mode' no válido" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "Voz inválida" @@ -1283,6 +1305,10 @@ msgstr "Length debe ser un int" msgid "Length must be non-negative" msgstr "Length no deberia ser negativa" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "MISO pin init fallido." @@ -1531,6 +1557,18 @@ msgstr "Solo un color puede ser transparente a la vez" msgid "Only raw int supported for ip" msgstr "Solo se aceptan enteros crudos para ip" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "Se acabaron los enchufes" @@ -1539,6 +1577,10 @@ msgstr "Se acabaron los enchufes" msgid "Oversample must be multiple of 8." msgstr "El sobremuestreo debe ser un múltiplo de 8." +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1557,6 +1599,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "ParallelBus todavía no soportado" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "Permiso denegado" @@ -1681,6 +1727,10 @@ msgstr "Sistema de archivos de solo-Lectura" msgid "Read-only object" msgstr "Objeto de solo-lectura" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Refresco demasiado pronto" @@ -1693,6 +1743,10 @@ msgstr "RemoteTransmissionRequests limitado a 8 bytes" msgid "Requested AES mode is unsupported" msgstr "El modo AES solicitado no es compatible" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Canal derecho no soportado" @@ -2079,6 +2133,10 @@ msgstr "Tamaño del valor != del tamaño fijo requerido" msgid "Value length > max_length" msgstr "Tamaño de valor > max_length" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "funciones Viper no soportan por el momento, más de 4 argumentos" @@ -3946,6 +4004,10 @@ msgstr "tipo de salida incorrecta" msgid "x value out of bounds" msgstr "valor x fuera de límites" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "y deberia ser un int" diff --git a/locale/fil.po b/locale/fil.po index ba3cb28923b45..753ecef589064 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -115,6 +115,11 @@ msgid "%q() takes %d positional arguments but %d were given" msgstr "" "Ang %q() ay kumukuha ng %d positional arguments pero %d lang ang binigay" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "'%q' argument kailangan" @@ -545,6 +550,10 @@ msgstr "Sa gitna ng 0 o 255 dapat ang bytes." msgid "CBC blocks must be multiples of 16 bytes" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "" @@ -1000,6 +1009,10 @@ msgstr "" msgid "Function requires lock" msgstr "Function nangangailangan ng lock" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1128,6 +1141,7 @@ msgstr "Mali ang PWM frequency" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Maling argumento" @@ -1237,6 +1251,14 @@ msgstr "Mali ang run mode." msgid "Invalid security_mode" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1277,6 +1299,10 @@ msgstr "Haba ay dapat int" msgid "Length must be non-negative" msgstr "Haba ay dapat hindi negatibo" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "Hindi ma-initialize ang MISO pin." @@ -1522,6 +1548,18 @@ msgstr "" msgid "Only raw int supported for ip" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "" @@ -1530,6 +1568,10 @@ msgstr "" msgid "Oversample must be multiple of 8." msgstr "Oversample ay dapat multiple ng 8." +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1547,6 +1589,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "Walang pahintulot" @@ -1665,6 +1711,10 @@ msgstr "Basahin-lamang mode" msgid "Read-only object" msgstr "Basahin-lamang" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -1677,6 +1727,10 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Hindi supportado ang kanang channel" @@ -2049,6 +2103,10 @@ msgstr "" msgid "Value length > max_length" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "" @@ -3923,6 +3981,10 @@ msgstr "" msgid "x value out of bounds" msgstr "wala sa sakop ang address" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "y ay dapat int" diff --git a/locale/fr.po b/locale/fr.po index a2e704f5b1155..50166c71e3fb2 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -124,6 +124,11 @@ msgstr "%q doit être un chiffre entier (int)" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() prend %d paramètres positionnels mais %d ont été donnés" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "paramètre '%q' requis" @@ -556,6 +561,10 @@ msgstr "Les octets 'bytes' doivent être entre 0 et 255." msgid "CBC blocks must be multiples of 16 bytes" msgstr "Les blocs CBC doivent être des multiples de 16 octets" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "Appelez super () .__ init __ () avant d'accéder à l'objet natif." @@ -1022,6 +1031,10 @@ msgstr "" msgid "Function requires lock" msgstr "La fonction nécessite un verrou ('lock')" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1150,6 +1163,7 @@ msgstr "Fréquence de PWM invalide" msgid "Invalid Pin" msgstr "Broche invalide" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Paramètre invalide" @@ -1259,6 +1273,14 @@ msgstr "Mode de lancement invalide." msgid "Invalid security_mode" msgstr "'security_mode' invalide" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "Voix invalide" @@ -1299,6 +1321,10 @@ msgstr "Length doit être un chiffre entier (int)" msgid "Length must be non-negative" msgstr "Length ne doit pas être négatif" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "Échec de l'initialization de la broche MISO." @@ -1547,6 +1573,18 @@ msgstr "Une seule couleur peut être transparente à la fois" msgid "Only raw int supported for ip" msgstr "IP n'accepte que les chiffres entiers bruts" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "Plus de sockets" @@ -1555,6 +1593,10 @@ msgstr "Plus de sockets" msgid "Oversample must be multiple of 8." msgstr "Le sur-échantillonage doit être un multiple de 8." +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1575,6 +1617,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "ParallelBus pas encore supporté" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "Permission refusée" @@ -1702,6 +1748,10 @@ msgstr "Système de fichier en lecture seule" msgid "Read-only object" msgstr "Objet en lecture seule" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Rafraîchissement trop tôt" @@ -1714,6 +1764,10 @@ msgstr "RemoteTransmissionRequests limité à 8 octets" msgid "Requested AES mode is unsupported" msgstr "Le mode AES demandé n'est pas supporté" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Canal droit non supporté" @@ -2102,6 +2156,10 @@ msgstr "Longueur de valeur != Longueur fixe requise" msgid "Value length > max_length" msgstr "Longueur de la valeur > max_length" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "" @@ -3982,6 +4040,10 @@ msgstr "type de sortie incorrect" msgid "x value out of bounds" msgstr "valeur x hors limites" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "'y' doit être un entier 'int'" diff --git a/locale/hi.po b/locale/hi.po index 5c9dfcb77dac4..fc106f8d1fd5b 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -113,6 +113,11 @@ msgstr "" msgid "%q() takes %d positional arguments but %d were given" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "" @@ -539,6 +544,10 @@ msgstr "" msgid "CBC blocks must be multiples of 16 bytes" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "" @@ -987,6 +996,10 @@ msgstr "" msgid "Function requires lock" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1113,6 +1126,7 @@ msgstr "" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "" @@ -1222,6 +1236,14 @@ msgstr "" msgid "Invalid security_mode" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1262,6 +1284,10 @@ msgstr "" msgid "Length must be non-negative" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "" @@ -1504,6 +1530,18 @@ msgstr "" msgid "Only raw int supported for ip" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "" @@ -1512,6 +1550,10 @@ msgstr "" msgid "Oversample must be multiple of 8." msgstr "" +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1528,6 +1570,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "" @@ -1645,6 +1691,10 @@ msgstr "" msgid "Read-only object" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -1657,6 +1707,10 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "" @@ -2027,6 +2081,10 @@ msgstr "" msgid "Value length > max_length" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "" @@ -3869,6 +3927,10 @@ msgstr "" msgid "x value out of bounds" msgstr "" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 6ee6c710900df..efdb071161d09 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -114,6 +114,11 @@ msgstr "y dovrebbe essere un int" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() prende %d argomenti posizionali ma ne sono stati forniti %d" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "'%q' argomento richiesto" @@ -545,6 +550,10 @@ msgstr "I byte devono essere compresi tra 0 e 255" msgid "CBC blocks must be multiples of 16 bytes" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "" @@ -1000,6 +1009,10 @@ msgstr "" msgid "Function requires lock" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1128,6 +1141,7 @@ msgstr "Frequenza PWM non valida" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Argomento non valido" @@ -1239,6 +1253,14 @@ msgstr "Modalità di esecuzione non valida." msgid "Invalid security_mode" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1280,6 +1302,10 @@ msgstr "Length deve essere un intero" msgid "Length must be non-negative" msgstr "Length deve essere non negativo" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "inizializzazione del pin MISO fallita." @@ -1527,6 +1553,18 @@ msgstr "" msgid "Only raw int supported for ip" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "" @@ -1535,6 +1573,10 @@ msgstr "" msgid "Oversample must be multiple of 8." msgstr "L'oversampling deve essere multiplo di 8." +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1556,6 +1598,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "Permesso negato" @@ -1675,6 +1721,10 @@ msgstr "Filesystem in sola lettura" msgid "Read-only object" msgstr "Sola lettura" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -1687,6 +1737,10 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Canale destro non supportato" @@ -2061,6 +2115,10 @@ msgstr "" msgid "Value length > max_length" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "Le funzioni Viper non supportano più di 4 argomenti al momento" @@ -3931,6 +3989,10 @@ msgstr "" msgid "x value out of bounds" msgstr "indirizzo fuori limite" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "y dovrebbe essere un int" diff --git a/locale/ja.po b/locale/ja.po index 6c391bb41b339..29e3086aa284c 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -118,6 +118,11 @@ msgstr "%qはint型でなければなりません" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() は %d 個の位置引数を取りますが、%d 個与えられました" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "'%q' 引数が必要" @@ -546,6 +551,10 @@ msgstr "バイト値は0から255の間でなければなりません" msgid "CBC blocks must be multiples of 16 bytes" msgstr "CBCブロックは16バイトの整数倍でなければなりません" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "" @@ -998,6 +1007,10 @@ msgstr "このタイマーを使う既存のPWMOutと周波数を一致させる msgid "Function requires lock" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1126,6 +1139,7 @@ msgstr "無効なPWM周波数" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "不正な引数" @@ -1235,6 +1249,14 @@ msgstr "不正なrun mode" msgid "Invalid security_mode" msgstr "不正なsecurity_mode" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "不正なボイス" @@ -1275,6 +1297,10 @@ msgstr "長さには整数が必要" msgid "Length must be non-negative" msgstr "Lengthは非負数でなければなりません" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "MISOピン初期化に失敗" @@ -1519,6 +1545,18 @@ msgstr "" msgid "Only raw int supported for ip" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "" @@ -1527,6 +1565,10 @@ msgstr "" msgid "Oversample must be multiple of 8." msgstr "オーバーサンプルは8の倍数でなければなりません" +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1544,6 +1586,10 @@ msgstr "PWM周波数は生成時のvariable_frequencyがFalseのとき書き換 msgid "ParallelBus not yet supported" msgstr "ParallelBusにはまだ対応していません" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "パーミッション拒否" @@ -1661,6 +1707,10 @@ msgstr "読み込み専用のファイルシステム" msgid "Read-only object" msgstr "読み込み専用のオブジェクト" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "リフレッシュが早すぎます" @@ -1673,6 +1723,10 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "要求のAESモードは非対応" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "右チャネルは非対応" @@ -2050,6 +2104,10 @@ msgstr "" msgid "Value length > max_length" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "" @@ -3900,6 +3958,10 @@ msgstr "" msgid "x value out of bounds" msgstr "xが範囲外" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "yは整数でなければなりません" diff --git a/locale/ko.po b/locale/ko.po index deb7c617ee457..7088a00ba5cd4 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -114,6 +114,11 @@ msgstr "%q 는 정수(int) 여야합니다" msgid "%q() takes %d positional arguments but %d were given" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "" @@ -542,6 +547,10 @@ msgstr "바이트는 0에서 255 사이 여야합니다." msgid "CBC blocks must be multiples of 16 bytes" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "" @@ -990,6 +999,10 @@ msgstr "" msgid "Function requires lock" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1116,6 +1129,7 @@ msgstr "" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "" @@ -1225,6 +1239,14 @@ msgstr "" msgid "Invalid security_mode" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1265,6 +1287,10 @@ msgstr "길이는 정수(int) 여야합니다" msgid "Length must be non-negative" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "" @@ -1507,6 +1533,18 @@ msgstr "" msgid "Only raw int supported for ip" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "" @@ -1515,6 +1553,10 @@ msgstr "" msgid "Oversample must be multiple of 8." msgstr "" +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1531,6 +1573,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "" @@ -1648,6 +1694,10 @@ msgstr "" msgid "Read-only object" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -1660,6 +1710,10 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "" @@ -2031,6 +2085,10 @@ msgstr "" msgid "Value length > max_length" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "" @@ -3873,6 +3931,10 @@ msgstr "" msgid "x value out of bounds" msgstr "" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index a9e7d6bf6d058..2ed0b2dc504e5 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -116,6 +116,11 @@ msgstr "%q moet een int zijn" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() verwacht %d positionele argumenten maar kreeg %d" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "'%q' argument vereist" @@ -544,6 +549,10 @@ msgstr "Bytes moeten tussen 0 en 255 liggen." msgid "CBC blocks must be multiples of 16 bytes" msgstr "CBC blocks moeten meervouden van 16 bytes zijn" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "Roep super().__init__() aan voor toegang native object." @@ -999,6 +1008,10 @@ msgstr "" msgid "Function requires lock" msgstr "Functie vereist lock" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1127,6 +1140,7 @@ msgstr "Ongeldige PWM frequentie" msgid "Invalid Pin" msgstr "Ongeldige Pin" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Ongeldig argument" @@ -1236,6 +1250,14 @@ msgstr "Ongeldige run modus." msgid "Invalid security_mode" msgstr "Ongeldige security_mode" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "Ongeldige stem" @@ -1276,6 +1298,10 @@ msgstr "Lengte moet een int zijn" msgid "Length must be non-negative" msgstr "Lengte moet niet negatief zijn" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "MISO pin init mislukt." @@ -1524,6 +1550,18 @@ msgstr "Er kan maar één kleur per keer transparant zijn" msgid "Only raw int supported for ip" msgstr "Alleen raw int ondersteund voor IP" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "Geen sockets meer beschikbaar" @@ -1532,6 +1570,10 @@ msgstr "Geen sockets meer beschikbaar" msgid "Oversample must be multiple of 8." msgstr "Oversample moet een meervoud van 8 zijn." +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1551,6 +1593,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "ParallelBus nog niet ondersteund" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "Toegang geweigerd" @@ -1677,6 +1723,10 @@ msgstr "Alleen-lezen bestandssysteem" msgid "Read-only object" msgstr "Alleen-lezen object" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Verversing te snel" @@ -1689,6 +1739,10 @@ msgstr "RemoteTransmissionRequests is beperkt tot 8 bytes" msgid "Requested AES mode is unsupported" msgstr "Gevraagde AES modus is niet ondersteund" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Rechter kanaal niet ondersteund" @@ -2071,6 +2125,10 @@ msgstr "Waarde lengte != vereist vaste lengte" msgid "Value length > max_length" msgstr "Waarde length > max_length" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "Viper-functies ondersteunen momenteel niet meer dan 4 argumenten" @@ -3933,6 +3991,10 @@ msgstr "onjuist uitvoer type" msgid "x value out of bounds" msgstr "x-waarde buiten bereik" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "y moet een int zijn" diff --git a/locale/pl.po b/locale/pl.po index 4356b04913479..38f26355b26a4 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -118,6 +118,11 @@ msgstr "%q powinno być typu int" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() bierze %d argumentów pozycyjnych, lecz podano %d" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "'%q' wymaga argumentu" @@ -546,6 +551,10 @@ msgstr "Bytes musi być między 0 a 255." msgid "CBC blocks must be multiples of 16 bytes" msgstr "Bloki CBC muszą być wielokrotnościami 16 bajtów" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "" @@ -998,6 +1007,10 @@ msgstr "" msgid "Function requires lock" msgstr "Funkcja wymaga blokady" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1126,6 +1139,7 @@ msgstr "Zła częstotliwość PWM" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Zły argument" @@ -1235,6 +1249,14 @@ msgstr "Zły tryb uruchomienia." msgid "Invalid security_mode" msgstr "Nieprawidłowy security_mode" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1275,6 +1297,10 @@ msgstr "Długość musi być całkowita" msgid "Length must be non-negative" msgstr "Długość musi być nieujemna" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "Nie powiodło się ustawienie pinu MISO." @@ -1518,6 +1544,18 @@ msgstr "W danym momencie przezroczysty może być tylko jeden kolor" msgid "Only raw int supported for ip" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "" @@ -1526,6 +1564,10 @@ msgstr "" msgid "Oversample must be multiple of 8." msgstr "Nadpróbkowanie musi być wielokrotnością 8." +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1542,6 +1584,10 @@ msgstr "Nie można zmienić częstotliwości PWM gdy variable_frequency=False." msgid "ParallelBus not yet supported" msgstr "ParallelBus nie jest jeszcze obsługiwany" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "Odmowa dostępu" @@ -1659,6 +1705,10 @@ msgstr "System plików tylko do odczytu" msgid "Read-only object" msgstr "Obiekt tylko do odczytu" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Zbyt wczesne odświeżenie" @@ -1671,6 +1721,10 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "Żądany tryb AES nie jest obsługiwany" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Prawy kanał jest niewspierany" @@ -2041,6 +2095,10 @@ msgstr "" msgid "Value length > max_length" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "Funkcje Viper nie obsługują obecnie więcej niż 4 argumentów" @@ -3892,6 +3950,10 @@ msgstr "" msgid "x value out of bounds" msgstr "x poza zakresem" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "y powinno być całkowite" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index d93307486f6ae..7a3a3c0fb0304 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -120,6 +120,11 @@ msgstr "%q deve ser um int" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() recebe %d argumentos posicionais, porém %d foram informados" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "'%q' argumento(s) requerido(s)" @@ -556,6 +561,10 @@ msgstr "Os bytes devem estar entre 0 e 255." msgid "CBC blocks must be multiples of 16 bytes" msgstr "Os blocos CBC devem ter múltiplos de 16 bytes" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "Chame super().__init__() antes de acessar o objeto nativo." @@ -1015,6 +1024,10 @@ msgstr "" msgid "Function requires lock" msgstr "A função requer bloqueio" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1143,6 +1156,7 @@ msgstr "Frequência PWM inválida" msgid "Invalid Pin" msgstr "Pino inválido" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Argumento inválido" @@ -1252,6 +1266,14 @@ msgstr "O modo de execução é inválido." msgid "Invalid security_mode" msgstr "O Security_mode é inválido" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "A voz é inválida" @@ -1292,6 +1314,10 @@ msgstr "Tamanho deve ser um int" msgid "Length must be non-negative" msgstr "O comprimento deve ser positivo" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "A inicialização do pino MISO falhou." @@ -1539,6 +1565,18 @@ msgstr "Apenas uma cor pode ser transparente de cada vez" msgid "Only raw int supported for ip" msgstr "Apenas o int bruto é compatível para o ip" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "Sem soquetes" @@ -1547,6 +1585,10 @@ msgstr "Sem soquetes" msgid "Oversample must be multiple of 8." msgstr "A superamostragem deve ser um múltiplo de 8." +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1567,6 +1609,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "O ParallelBus ainda não é compatível" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "Permissão negada" @@ -1696,6 +1742,10 @@ msgstr "Sistema de arquivos somente leitura" msgid "Read-only object" msgstr "Objeto de leitura apenas" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "A recarga foi cedo demais" @@ -1708,6 +1758,10 @@ msgstr "As requisições de transmissões remotas é limitada a 8 bytes" msgid "Requested AES mode is unsupported" msgstr "O modo AES solicitado não é compatível" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Canal direito não suportado" @@ -2094,6 +2148,10 @@ msgstr "Comprimento do valor != comprimento fixo necessário" msgid "Value length > max_length" msgstr "O comprimento do valor é > max_length" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "Atualmente, as funções do Viper não suportam mais de 4 argumentos" @@ -3968,6 +4026,10 @@ msgstr "tipo da saída incorreta" msgid "x value out of bounds" msgstr "o valor x está fora dos limites" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "y deve ser um int" diff --git a/locale/sv.po b/locale/sv.po index 8cae545880c2f..d618f3e280a5d 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -120,6 +120,11 @@ msgstr "%q ska vara en int" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() kräver %d positionsargument men %d gavs" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "'%q' argument krävs" @@ -548,6 +553,10 @@ msgstr "Bytes måste vara mellan 0 och 255." msgid "CBC blocks must be multiples of 16 bytes" msgstr "CBC-block måste vara multiplar om 16 byte" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "Anropa super().__init__() innan du använder det ursprungliga objektet." @@ -1003,6 +1012,10 @@ msgstr "Frekvensen måste matcha befintlig PWMOut med denna timer" msgid "Function requires lock" msgstr "Funktion kräver lås" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1131,6 +1144,7 @@ msgstr "Ogiltig PWM-frekvens" msgid "Invalid Pin" msgstr "Ogiltig pinne" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Ogiltigt argument" @@ -1240,6 +1254,14 @@ msgstr "Ogiltigt körläge." msgid "Invalid security_mode" msgstr "Ogiltigt säkerhetsläge" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "Ogiltig kanal" @@ -1280,6 +1302,10 @@ msgstr "Length måste vara en int" msgid "Length must be non-negative" msgstr "Length måste vara positiv" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "init för MISO-pinne misslyckades." @@ -1528,6 +1554,18 @@ msgstr "Bara en färg kan vara genomskinlig i taget" msgid "Only raw int supported for ip" msgstr "Endast raw int stöds för ip" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "Slut på sockets" @@ -1536,6 +1574,10 @@ msgstr "Slut på sockets" msgid "Oversample must be multiple of 8." msgstr "Översampling måste vara multipel av 8." +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1554,6 +1596,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "ParallelBus stöds ännu inte" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "Åtkomst nekad" @@ -1680,6 +1726,10 @@ msgstr "Skrivskyddat filsystem" msgid "Read-only object" msgstr "Skrivskyddat objekt" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Uppdaterad för tidigt" @@ -1692,6 +1742,10 @@ msgstr "RemoteTransmissionRequests begränsad till 8 byte" msgid "Requested AES mode is unsupported" msgstr "Det begärda AES-läget stöds inte" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Höger kanal stöds inte" @@ -2074,6 +2128,10 @@ msgstr "Värdets längde ! = krävd fast längd" msgid "Value length > max_length" msgstr "Värdets längd > max_length" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "Viper-funktioner stöder för närvarande inte mer än fyra argument" @@ -3933,6 +3991,10 @@ msgstr "fel utdatatyp" msgid "x value out of bounds" msgstr "x-värde utanför intervall" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "y ska vara en int" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 735c90743abd2..9b1bdf5647c29 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -118,6 +118,11 @@ msgstr "%q yīnggāi shì yīgè int" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() cǎiyòng %d wèizhì cānshù, dàn gěi chū %d" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "xūyào '%q' cānshù" @@ -546,6 +551,10 @@ msgstr "Zì jié bìxū jiè yú 0 dào 255 zhī jiān." msgid "CBC blocks must be multiples of 16 bytes" msgstr "CBC kuài bì xū shì 16 zì jié de bèi shù" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "Zài fǎngwèn běn jī wùjiàn zhīqián diàoyòng super().__init__()." @@ -996,6 +1005,10 @@ msgstr "Pínlǜ bìxū yǔ shǐyòng cǐ jìshí qì de xiàn yǒu PWMOut xiāng msgid "Function requires lock" msgstr "Hánshù xūyào suǒdìng" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1124,6 +1137,7 @@ msgstr "Wúxiào de PWM pínlǜ" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Wúxiào de cānshù" @@ -1233,6 +1247,14 @@ msgstr "Wúxiào de yùnxíng móshì." msgid "Invalid security_mode" msgstr "Ānquán móshì wúxiào" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "Yǔyīn wúxiào" @@ -1273,6 +1295,10 @@ msgstr "Chángdù bìxū shì yīgè zhěngshù" msgid "Length must be non-negative" msgstr "Chángdù bìxū shìfēi fùshù" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "MISO yǐn jiǎo chūshǐhuà shībài." @@ -1520,6 +1546,18 @@ msgstr "Yīcì zhǐ néng yǒuyī zhǒng yánsè shì tòumíng de" msgid "Only raw int supported for ip" msgstr "Ip jǐn zhīchí raw int" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "tào jiē zì wài" @@ -1528,6 +1566,10 @@ msgstr "tào jiē zì wài" msgid "Oversample must be multiple of 8." msgstr "Guò cǎiyàng bìxū shì 8 de bèishù." +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1545,6 +1587,10 @@ msgstr "Dāng biànliàng_pínlǜ shì False zài jiànzhú shí PWM pínlǜ bù msgid "ParallelBus not yet supported" msgstr "Shàng bù zhīchí ParallelBus" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "Quánxiàn bèi jùjué" @@ -1666,6 +1712,10 @@ msgstr "Zhǐ dú wénjiàn xìtǒng" msgid "Read-only object" msgstr "Zhǐ dú duìxiàng" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Shuāxīn tài kuàile" @@ -1678,6 +1728,10 @@ msgstr "RemoteTransmissionRequests xiànzhì wèi 8 gè zì jié" msgid "Requested AES mode is unsupported" msgstr "Qǐngqiú de AES móshì bù shòu zhīchí" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Bù zhīchí yòu tōngdào" @@ -2059,6 +2113,10 @@ msgstr "Zhí chángdù != Suǒ xū de gùdìng chángdù" msgid "Value length > max_length" msgstr "Zhí chángdù > zuìdà chángdù" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "Viper hánshù mùqián bù zhīchí chāoguò 4 gè cānshù" @@ -3916,6 +3974,10 @@ msgstr "cuòwù de shūchū lèixíng" msgid "x value out of bounds" msgstr "x zhí chāochū biānjiè" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "y yīnggāi shì yīgè zhěngshù" From f07dd487af935b34f1c735c874cf5351612029d9 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Tue, 12 Jan 2021 13:49:50 -0600 Subject: [PATCH 618/770] change IPPROTO_* comments to match usage in current shared-bindings and common-hal code --- shared-bindings/socketpool/SocketPool.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/shared-bindings/socketpool/SocketPool.c b/shared-bindings/socketpool/SocketPool.c index 73eeed2652bab..3261311244062 100644 --- a/shared-bindings/socketpool/SocketPool.c +++ b/shared-bindings/socketpool/SocketPool.c @@ -62,14 +62,12 @@ STATIC mp_obj_t socketpool_socketpool_make_new(const mp_obj_type_t *type, size_t //| SOCK_STREAM: int //| SOCK_DGRAM: int //| SOCK_RAW: int -//| IPPROTO_TCP: int //| -//| def socket(self, family: int = AF_INET, type: int = SOCK_STREAM, proto: int = IPPROTO_TCP) -> socketpool.Socket: +//| def socket(self, family: int = AF_INET, type: int = SOCK_STREAM) -> socketpool.Socket: //| """Create a new socket //| //| :param ~int family: AF_INET or AF_INET6 //| :param ~int type: SOCK_STREAM, SOCK_DGRAM or SOCK_RAW -//| :param ~int proto: IPPROTO_TCP, IPPROTO_UDP or IPPROTO_RAW (ignored)""" //| ... //| From 4cdb298a20eced513536f30d3d81990eb9fbceaa Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Tue, 12 Jan 2021 15:05:28 -0500 Subject: [PATCH 619/770] WIP of non-blocking calls --- ports/esp32s2/common-hal/socketpool/Socket.c | 17 ++++++++++++++++- shared-bindings/socketpool/Socket.c | 8 ++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/ports/esp32s2/common-hal/socketpool/Socket.c b/ports/esp32s2/common-hal/socketpool/Socket.c index d5608c7edf0ab..757156e08d5bc 100644 --- a/ports/esp32s2/common-hal/socketpool/Socket.c +++ b/ports/esp32s2/common-hal/socketpool/Socket.c @@ -51,6 +51,7 @@ STATIC void _lazy_init_LWIP(socketpool_socket_obj_t* self) { mp_raise_RuntimeError(translate("Out of sockets")); } self->num = socknum; + lwip_fcntl(socknum, F_SETFL, O_NONBLOCK); } STATIC void _lazy_init_TLS(socketpool_socket_obj_t* self) { @@ -88,12 +89,20 @@ int common_hal_socketpool_socket_accept(socketpool_socket_obj_t* self, uint8_t* ip, uint *port) { struct sockaddr_in accept_addr; socklen_t socklen = sizeof(accept_addr); - int newsoc = lwip_accept(self->num, (struct sockaddr *)&accept_addr, &socklen); + + int newsoc = -1; + //(self->timeout_ms == 0 || supervisor_ticks_ms64() - start_ticks <= self->timeout_ms) + while ((newsoc == -1) && !mp_hal_is_interrupted() ) { + RUN_BACKGROUND_TASKS; + newsoc = lwip_accept(self->num, (struct sockaddr *)&accept_addr, &socklen); + } + mp_printf(&mp_plat_print, "oldsoc:%d newsoc:%d\n",self->num, newsoc); memcpy((void *)ip, (void*)&accept_addr.sin_addr.s_addr, sizeof(accept_addr.sin_addr.s_addr)); *port = accept_addr.sin_port; if (newsoc > 0) { + lwip_fcntl(newsoc, F_SETFL, O_NONBLOCK); return newsoc; } else { return 0; @@ -169,7 +178,11 @@ mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, if (self->num != -1) { // LWIP Socket + mp_printf(&mp_plat_print, "lwip_recv:\n"); + received = lwip_recv(self->num, (void*) buf, len - 1, 0); + mp_printf(&mp_plat_print, "received:%d\n",received); + } else if (self->tls != NULL) { // TLS Socket int status = 0; @@ -257,7 +270,9 @@ mp_uint_t common_hal_socketpool_socket_recvfrom_into(socketpool_socket_obj_t* se struct sockaddr_in source_addr; socklen_t socklen = sizeof(source_addr); + mp_printf(&mp_plat_print, "recvfrom_into\n"); int bytes_received = lwip_recvfrom(self->num, buf, len - 1, 0, (struct sockaddr *)&source_addr, &socklen); + mp_printf(&mp_plat_print, "received:%d\n",bytes_received); memcpy((void *)ip, (void*)&source_addr.sin_addr.s_addr, sizeof(source_addr.sin_addr.s_addr)); *port = source_addr.sin_port; diff --git a/shared-bindings/socketpool/Socket.c b/shared-bindings/socketpool/Socket.c index 548514f2870f5..a92e508b61bc5 100644 --- a/shared-bindings/socketpool/Socket.c +++ b/shared-bindings/socketpool/Socket.c @@ -213,10 +213,10 @@ STATIC mp_obj_t socketpool_socket_recv_into(size_t n_args, const mp_obj_t *args) // Bad file number. mp_raise_OSError(MP_EBADF); } - if (!common_hal_socketpool_socket_get_connected(self)) { - // not connected - mp_raise_OSError(MP_ENOTCONN); - } + // if (!common_hal_socketpool_socket_get_connected(self)) { + // // not connected + // mp_raise_OSError(MP_ENOTCONN); + // } mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[1], &bufinfo, MP_BUFFER_WRITE); mp_int_t len = bufinfo.len; From ed0cb248e9a002ce0bdd08243f223e48c0288f96 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 12 Jan 2021 16:04:29 -0600 Subject: [PATCH 620/770] esp32s2: Fix 'make flash' As reported by @jerryneedell, this change was incorrect; the given ESPTOOL_FLAGS caused `write_flash` to be repeated twice, which doesn't work. Closes #3981. --- ports/esp32s2/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 9827b555c5e7d..aac93478240da 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -299,7 +299,7 @@ ESP_AUTOGEN_LD = $(BUILD)/esp-idf/esp-idf/esp32s2/esp32s2_out.ld $(BUILD)/esp-id FLASH_FLAGS = --flash_mode $(CIRCUITPY_ESP_FLASH_MODE) --flash_freq $(CIRCUITPY_ESP_FLASH_FREQ) --flash_size $(CIRCUITPY_ESP_FLASH_SIZE) -ESPTOOL_FLAGS ?= -b 460800 --before=default_reset --after=no_reset write_flash +ESPTOOL_FLAGS ?= -b 460800 --before=default_reset --after=no_reset all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2 From f95d10b2a66d69aeaea02ff778fde0d92400fffc Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 12 Jan 2021 16:30:20 -0600 Subject: [PATCH 621/770] make translate --- locale/circuitpython.pot | 2 ++ 1 file changed, 2 insertions(+) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index e8ac7512aa3d3..82058a6110902 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -3455,6 +3455,8 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h From 4b304128710987f7f97e327a486fefe5e9305005 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 12 Jan 2021 18:23:37 -0500 Subject: [PATCH 622/770] shrink some de_DE builds --- ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk | 2 ++ ports/atmel-samd/boards/pewpew10/mpconfigboard.mk | 5 +++++ ports/atmel-samd/boards/shirtty/mpconfigboard.mk | 2 ++ 3 files changed, 9 insertions(+) diff --git a/ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk b/ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk index fd24edafa2535..07b1b98002e49 100644 --- a/ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk +++ b/ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk @@ -11,3 +11,5 @@ LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 SUPEROPT_GC = 0 + +CFLAGS_BOARD = --param max-inline-insns-auto=15 diff --git a/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk index 1cc91a8df686b..fadcc21448fe3 100644 --- a/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk @@ -24,3 +24,8 @@ SUPEROPT_GC = 0 FROZEN_MPY_DIRS += $(TOP)/frozen/pew-pewpew-standalone-10.x CFLAGS_BOARD = --param max-inline-insns-auto=15 +ifeq ($(TRANSLATION), de_DE) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +SUPEROPT_VM = 0 +endif diff --git a/ports/atmel-samd/boards/shirtty/mpconfigboard.mk b/ports/atmel-samd/boards/shirtty/mpconfigboard.mk index a04e09769236c..0b56e9ae02cc8 100644 --- a/ports/atmel-samd/boards/shirtty/mpconfigboard.mk +++ b/ports/atmel-samd/boards/shirtty/mpconfigboard.mk @@ -13,3 +13,5 @@ CIRCUITPY_I2CPERIPHERAL = 1 CIRCUITPY_TOUCHIO = 0 SUPEROPT_GC = 0 + +CFLAGS_BOARD = --param max-inline-insns-auto=15 From 5e52ca053037b8f03a40d56c07958fbe0289a2ed Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 12 Jan 2021 18:41:50 -0500 Subject: [PATCH 623/770] make translate --- locale/circuitpython.pot | 2 ++ 1 file changed, 2 insertions(+) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index e8ac7512aa3d3..82058a6110902 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -3455,6 +3455,8 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h From 88ce6911b7e75dfb783b8d1acf5d6f478e7ca59b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 12 Jan 2021 18:52:39 -0600 Subject: [PATCH 624/770] Revert "pre-commit: Add checking of 'make translate' status" This reverts commit 1dda33dc418cae1a0047df0241762ebdb3d87e8a. --- .pre-commit-config.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 82d89eaa3e43b..322f37da46d3b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,10 +11,3 @@ repos: exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*|ports/esp32s2/esp-idf-config/.*|ports/esp32s2/boards/.*/sdkconfig)' - id: trailing-whitespace exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*)' -- repo: local - hooks: - - id: translations - name: Check Translations - entry: sh -c "make translate" - language: system - always_run: true From 0a13eff940933b3756f70c673b958476c4b0241c Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Tue, 12 Jan 2021 21:31:50 +0000 Subject: [PATCH 625/770] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (913 of 913 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 7a3a3c0fb0304..d21283a4eb174 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-01-05 21:03+0000\n" +"PO-Revision-Date: 2021-01-13 02:19+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -123,7 +123,7 @@ msgstr "%q() recebe %d argumentos posicionais, porém %d foram informados" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #, c-format msgid "%s error 0x%x" -msgstr "" +msgstr "%s erro 0x%x" #: py/argcheck.c msgid "'%q' argument required" @@ -293,7 +293,7 @@ msgstr "3-arg pow() não compatível" #: shared-module/msgpack/__init__.c msgid "64 bit types" -msgstr "" +msgstr "Tipos 64 bit" #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c @@ -563,7 +563,7 @@ msgstr "Os blocos CBC devem ter múltiplos de 16 bytes" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "CRC or checksum was invalid" -msgstr "" +msgstr "CRC ou checksum inválido" #: py/objtype.c msgid "Call super().__init__() before accessing native object." @@ -1026,7 +1026,7 @@ msgstr "A função requer bloqueio" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Generic Failure" -msgstr "" +msgstr "Falha Genérica" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c @@ -1268,11 +1268,11 @@ msgstr "O Security_mode é inválido" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid size" -msgstr "" +msgstr "Tamanho inválido" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" -msgstr "" +msgstr "Estado inválido" #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" @@ -1316,7 +1316,7 @@ msgstr "O comprimento deve ser positivo" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "MAC address was invalid" -msgstr "" +msgstr "Endereço MAC inválido" #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." @@ -1551,7 +1551,7 @@ msgstr "" #: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c msgid "Only one TouchAlarm can be set in deep sleep." -msgstr "" +msgstr "Apenas um TouchAlarm pode ser colocado em deep sleep." #: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." @@ -1567,15 +1567,15 @@ msgstr "Apenas o int bruto é compatível para o ip" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" -msgstr "" +msgstr "A operação ou o recurso não é suportado" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation timed out" -msgstr "" +msgstr "A operação expirou" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Out of memory" -msgstr "" +msgstr "Sem memória" #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" @@ -1587,7 +1587,7 @@ msgstr "A superamostragem deve ser um múltiplo de 8." #: shared-bindings/audiobusio/PDMIn.c msgid "PDMIn not available" -msgstr "" +msgstr "O PDMIn não está disponível" #: shared-bindings/pwmio/PWMOut.c msgid "" @@ -1611,7 +1611,7 @@ msgstr "O ParallelBus ainda não é compatível" #: ports/esp32s2/common-hal/audiobusio/__init__.c msgid "Peripheral in use" -msgstr "" +msgstr "O periférico está em uso" #: py/moduerrno.c msgid "Permission denied" @@ -1744,7 +1744,7 @@ msgstr "Objeto de leitura apenas" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Received response was invalid" -msgstr "" +msgstr "A resposta recebida foi inválida" #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" @@ -1760,7 +1760,7 @@ msgstr "O modo AES solicitado não é compatível" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Requested resource not found" -msgstr "" +msgstr "O recurso solicitado não foi encontrado" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" @@ -2150,7 +2150,7 @@ msgstr "O comprimento do valor é > max_length" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Version was invalid" -msgstr "" +msgstr "A versão era inválida" #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" @@ -2570,7 +2570,7 @@ msgstr "o círculo só pode ser registrado em um pai" #: shared-bindings/msgpack/ExtType.c msgid "code outside range 0~127" -msgstr "" +msgstr "código fora do alcance 0~127" #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" @@ -2660,7 +2660,7 @@ msgstr "a predefinição 'exceto' deve ser o último" #: shared-bindings/msgpack/__init__.c msgid "default is not a function" -msgstr "" +msgstr "o padrão não é uma função" #: shared-bindings/audiobusio/PDMIn.c msgid "" @@ -2766,7 +2766,7 @@ msgstr "chave esperada: valor para dict" #: shared-bindings/msgpack/__init__.c msgid "ext_hook is not a function" -msgstr "" +msgstr "o ext_hook não é uma função" #: py/argcheck.c msgid "extra keyword arguments given" @@ -3308,7 +3308,7 @@ msgstr "nenhuma ligação para nonlocal foi encontrada" #: shared-module/msgpack/__init__.c msgid "no default packer" -msgstr "" +msgstr "nenhum empacotador padrão" #: py/builtinimport.c msgid "no module named '%q'" @@ -3652,7 +3652,7 @@ msgstr "a forma deve ser uma tupla" #: shared-module/msgpack/__init__.c msgid "short read" -msgstr "" +msgstr "leitura curta" #: py/objstr.c msgid "sign not allowed in string format specifier" @@ -4028,7 +4028,7 @@ msgstr "o valor x está fora dos limites" #: ports/esp32s2/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" -msgstr "" +msgstr "o xTaskCreate falhou" #: shared-bindings/displayio/Shape.c msgid "y should be an int" From 35a10952b2d21a3b8bf725a8a84d15dab67cc036 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Wed, 13 Jan 2021 03:19:08 +0100 Subject: [PATCH 626/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 2 ++ locale/cs.po | 2 ++ locale/de_DE.po | 2 ++ locale/el.po | 2 ++ locale/es.po | 2 ++ locale/fil.po | 2 ++ locale/fr.po | 2 ++ locale/hi.po | 2 ++ locale/it_IT.po | 2 ++ locale/ja.po | 2 ++ locale/ko.po | 2 ++ locale/nl.po | 2 ++ locale/pl.po | 2 ++ locale/pt_BR.po | 2 ++ locale/sv.po | 2 ++ locale/zh_Latn_pinyin.po | 2 ++ 16 files changed, 32 insertions(+) diff --git a/locale/ID.po b/locale/ID.po index f4bb1512ef5ae..6aa4f0fba2e3f 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -3505,6 +3505,8 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/cs.po b/locale/cs.po index 2394834a16f06..a27a1459a1db4 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -3458,6 +3458,8 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/de_DE.po b/locale/de_DE.po index f83fafe3a9c98..350c7aac1a8ce 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -3538,6 +3538,8 @@ msgstr "pow() drittes Argument darf nicht 0 sein" msgid "pow() with 3 arguments requires integers" msgstr "pow () mit 3 Argumenten erfordert Integer" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/el.po b/locale/el.po index 267bc4987cc82..7001c2aa23115 100644 --- a/locale/el.po +++ b/locale/el.po @@ -3455,6 +3455,8 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/es.po b/locale/es.po index e456d78295abe..45695665c1cf9 100644 --- a/locale/es.po +++ b/locale/es.po @@ -3529,6 +3529,8 @@ msgstr "el 3er argumento de pow() no puede ser 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() con 3 argumentos requiere enteros" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/fil.po b/locale/fil.po index 753ecef589064..ddd5f3dfe4669 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -3504,6 +3504,8 @@ msgstr "pow() 3rd argument ay hindi maaring 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() na may 3 argumento kailangan ng integers" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/fr.po b/locale/fr.po index 50166c71e3fb2..87e2024be9fc3 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -3565,6 +3565,8 @@ msgstr "le 3e argument de pow() ne peut être 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() avec 3 arguments nécessite des entiers" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/hi.po b/locale/hi.po index fc106f8d1fd5b..618490b378ff5 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -3455,6 +3455,8 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/it_IT.po b/locale/it_IT.po index efdb071161d09..f9f77b20efb2c 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -3512,6 +3512,8 @@ msgstr "il terzo argomento di pow() non può essere 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() con 3 argomenti richiede interi" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/ja.po b/locale/ja.po index 29e3086aa284c..37d23f9594a76 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -3485,6 +3485,8 @@ msgstr "pow()の3つ目の引数は0にできません" msgid "pow() with 3 arguments requires integers" msgstr "pow()の第3引数には整数が必要" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/ko.po b/locale/ko.po index 7088a00ba5cd4..b7fc29629bb14 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -3459,6 +3459,8 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/nl.po b/locale/nl.po index 2ed0b2dc504e5..52984373c2dbc 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -3517,6 +3517,8 @@ msgstr "derde argument van pow() mag geen 0 zijn" msgid "pow() with 3 arguments requires integers" msgstr "pow() met 3 argumenten vereist integers" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/pl.po b/locale/pl.po index 38f26355b26a4..41eee9e74557e 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -3477,6 +3477,8 @@ msgstr "trzeci argument pow() nie może być 0" msgid "pow() with 3 arguments requires integers" msgstr "trzyargumentowe pow() wymaga liczb całkowitych" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/pt_BR.po b/locale/pt_BR.po index d21283a4eb174..64723c1938e32 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -3552,6 +3552,8 @@ msgstr "O terceiro argumento pow() não pode ser 0" msgid "pow() with 3 arguments requires integers" msgstr "o pow() com 3 argumentos requer números inteiros" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/sv.po b/locale/sv.po index d618f3e280a5d..477664972c44d 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -3517,6 +3517,8 @@ msgstr "pow() 3: e argument kan inte vara 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() med 3 argument kräver heltal" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 9b1bdf5647c29..d9a750b348ac4 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -3500,6 +3500,8 @@ msgstr "pow() 3 cān shǔ bùnéng wéi 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() yǒu 3 cānshù xūyào zhěngshù" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h From b4eb46b9ef198a59a83df7e6f8c5847c1ac6383b Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Wed, 13 Jan 2021 02:39:31 +0000 Subject: [PATCH 627/770] Translated using Weblate (French) Currently translated at 100.0% (913 of 913 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index 87e2024be9fc3..ad0ed6e7afe6d 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-01-12 15:40+0000\n" +"PO-Revision-Date: 2021-01-13 16:07+0000\n" "Last-Translator: Hugo Dahl \n" "Language: fr\n" "MIME-Version: 1.0\n" @@ -127,7 +127,7 @@ msgstr "%q() prend %d paramètres positionnels mais %d ont été donnés" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #, c-format msgid "%s error 0x%x" -msgstr "" +msgstr "%s erreur 0x%x" #: py/argcheck.c msgid "'%q' argument required" @@ -563,7 +563,7 @@ msgstr "Les blocs CBC doivent être des multiples de 16 octets" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "CRC or checksum was invalid" -msgstr "" +msgstr "CRC ou somme de contrôle invalide" #: py/objtype.c msgid "Call super().__init__() before accessing native object." @@ -1033,7 +1033,7 @@ msgstr "La fonction nécessite un verrou ('lock')" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Generic Failure" -msgstr "" +msgstr "Échec génerique" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c @@ -1275,11 +1275,11 @@ msgstr "'security_mode' invalide" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid size" -msgstr "" +msgstr "Taille invalide" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" -msgstr "" +msgstr "État invalide" #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" @@ -1323,7 +1323,7 @@ msgstr "Length ne doit pas être négatif" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "MAC address was invalid" -msgstr "" +msgstr "Adresse physique (MAC) invalide" #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." @@ -1559,7 +1559,7 @@ msgstr "" #: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c msgid "Only one TouchAlarm can be set in deep sleep." -msgstr "" +msgstr "Seulement une TouchAlarm peu être réglée en someil profond." #: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." @@ -1575,15 +1575,15 @@ msgstr "IP n'accepte que les chiffres entiers bruts" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" -msgstr "" +msgstr "Opération ou fonction non supportée" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation timed out" -msgstr "" +msgstr "Timeout de l'opération" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Out of memory" -msgstr "" +msgstr "Hors de mémoire" #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" @@ -1595,7 +1595,7 @@ msgstr "Le sur-échantillonage doit être un multiple de 8." #: shared-bindings/audiobusio/PDMIn.c msgid "PDMIn not available" -msgstr "" +msgstr "PDMIn non disponible" #: shared-bindings/pwmio/PWMOut.c msgid "" @@ -1619,7 +1619,7 @@ msgstr "ParallelBus pas encore supporté" #: ports/esp32s2/common-hal/audiobusio/__init__.c msgid "Peripheral in use" -msgstr "" +msgstr "Périphérique en utilisation" #: py/moduerrno.c msgid "Permission denied" @@ -1750,7 +1750,7 @@ msgstr "Objet en lecture seule" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Received response was invalid" -msgstr "" +msgstr "Réponse reçue invalide" #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" @@ -1766,7 +1766,7 @@ msgstr "Le mode AES demandé n'est pas supporté" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Requested resource not found" -msgstr "" +msgstr "Resource demandée non trouvée" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" @@ -2158,7 +2158,7 @@ msgstr "Longueur de la valeur > max_length" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Version was invalid" -msgstr "" +msgstr "Version est invalide" #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" @@ -4044,7 +4044,7 @@ msgstr "valeur x hors limites" #: ports/esp32s2/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" -msgstr "" +msgstr "Échec de xTaskCreate" #: shared-bindings/displayio/Shape.c msgid "y should be an int" From e703e065952b7e3f25a23f08609160e9a7a22fae Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Wed, 13 Jan 2021 11:17:37 -0600 Subject: [PATCH 628/770] Update shared-bindings/socketpool/SocketPool.c Co-authored-by: Scott Shawcroft --- shared-bindings/socketpool/SocketPool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/socketpool/SocketPool.c b/shared-bindings/socketpool/SocketPool.c index 3261311244062..8f4069faadada 100644 --- a/shared-bindings/socketpool/SocketPool.c +++ b/shared-bindings/socketpool/SocketPool.c @@ -67,7 +67,7 @@ STATIC mp_obj_t socketpool_socketpool_make_new(const mp_obj_type_t *type, size_t //| """Create a new socket //| //| :param ~int family: AF_INET or AF_INET6 -//| :param ~int type: SOCK_STREAM, SOCK_DGRAM or SOCK_RAW +//| :param ~int type: SOCK_STREAM, SOCK_DGRAM or SOCK_RAW""" //| ... //| From ccace62ac955bfffa3d8fc6a48e8c3953343a7bc Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 13 Jan 2021 15:35:51 -0500 Subject: [PATCH 629/770] don't check length for remote characteristic or dedescriptor --- ports/nrf/common-hal/_bleio/Characteristic.c | 15 ++++++++------- ports/nrf/common-hal/_bleio/Connection.c | 2 +- ports/nrf/common-hal/_bleio/Descriptor.c | 15 ++++++++------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/ports/nrf/common-hal/_bleio/Characteristic.c b/ports/nrf/common-hal/_bleio/Characteristic.c index 57c4814489de5..c0f0372c3fb8b 100644 --- a/ports/nrf/common-hal/_bleio/Characteristic.c +++ b/ports/nrf/common-hal/_bleio/Characteristic.c @@ -132,13 +132,6 @@ size_t common_hal_bleio_characteristic_get_value(bleio_characteristic_obj_t *sel } void common_hal_bleio_characteristic_set_value(bleio_characteristic_obj_t *self, mp_buffer_info_t *bufinfo) { - if (self->fixed_length && bufinfo->len != self->max_length) { - mp_raise_ValueError(translate("Value length != required fixed length")); - } - if (bufinfo->len > self->max_length) { - mp_raise_ValueError(translate("Value length > max_length")); - } - // Do GATT operations only if this characteristic has been added to a registered service. if (self->handle != BLE_GATT_HANDLE_INVALID) { @@ -148,6 +141,14 @@ void common_hal_bleio_characteristic_set_value(bleio_characteristic_obj_t *self, common_hal_bleio_gattc_write(self->handle, conn_handle, bufinfo, (self->props & CHAR_PROP_WRITE_NO_RESPONSE)); } else { + // Validate data length for local characteristics only. + if (self->fixed_length && bufinfo->len != self->max_length) { + mp_raise_ValueError(translate("Value length != required fixed length")); + } + if (bufinfo->len > self->max_length) { + mp_raise_ValueError(translate("Value length > max_length")); + } + // Always write the value locally even if no connections are active. // conn_handle is ignored for non-system attributes, so we use BLE_CONN_HANDLE_INVALID. common_hal_bleio_gatts_write(self->handle, BLE_CONN_HANDLE_INVALID, bufinfo); diff --git a/ports/nrf/common-hal/_bleio/Connection.c b/ports/nrf/common-hal/_bleio/Connection.c index 4f747bf976537..36fda0bb357f3 100644 --- a/ports/nrf/common-hal/_bleio/Connection.c +++ b/ports/nrf/common-hal/_bleio/Connection.c @@ -522,7 +522,7 @@ STATIC void on_char_discovery_rsp(ble_gattc_evt_char_disc_rsp_t *response, bleio common_hal_bleio_characteristic_construct( characteristic, m_char_discovery_service, gattc_char->handle_value, uuid, props, SECURITY_MODE_OPEN, SECURITY_MODE_OPEN, - GATT_MAX_DATA_LENGTH, false, // max_length, fixed_length: values may not matter for gattc + GATT_MAX_DATA_LENGTH, false, // max_length, fixed_length: values don't matter for gattc mp_const_empty_bytes); mp_obj_list_append(MP_OBJ_FROM_PTR(m_char_discovery_service->characteristic_list), diff --git a/ports/nrf/common-hal/_bleio/Descriptor.c b/ports/nrf/common-hal/_bleio/Descriptor.c index 9e91107231596..d848659fce296 100644 --- a/ports/nrf/common-hal/_bleio/Descriptor.c +++ b/ports/nrf/common-hal/_bleio/Descriptor.c @@ -73,13 +73,6 @@ size_t common_hal_bleio_descriptor_get_value(bleio_descriptor_obj_t *self, uint8 } void common_hal_bleio_descriptor_set_value(bleio_descriptor_obj_t *self, mp_buffer_info_t *bufinfo) { - if (self->fixed_length && bufinfo->len != self->max_length) { - mp_raise_ValueError(translate("Value length != required fixed length")); - } - if (bufinfo->len > self->max_length) { - mp_raise_ValueError(translate("Value length > max_length")); - } - // Do GATT operations only if this descriptor has been registered. if (self->handle != BLE_GATT_HANDLE_INVALID) { uint16_t conn_handle = bleio_connection_get_conn_handle(self->characteristic->service->connection); @@ -87,6 +80,14 @@ void common_hal_bleio_descriptor_set_value(bleio_descriptor_obj_t *self, mp_buff // false means WRITE_REQ, not write-no-response common_hal_bleio_gattc_write(self->handle, conn_handle, bufinfo, false); } else { + // Validate data length for local descriptors only. + if (self->fixed_length && bufinfo->len != self->max_length) { + mp_raise_ValueError(translate("Value length != required fixed length")); + } + if (bufinfo->len > self->max_length) { + mp_raise_ValueError(translate("Value length > max_length")); + } + common_hal_bleio_gatts_write(self->handle, conn_handle, bufinfo); } } From 37a8c1c57518ac35724ee026cdf6f2f2871aaea2 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Wed, 13 Jan 2021 19:05:07 -0500 Subject: [PATCH 630/770] Complete non-blocking implementations, add socket close checking --- ports/esp32s2/common-hal/socketpool/Socket.c | 162 +++++++++++++++---- ports/esp32s2/common-hal/socketpool/Socket.h | 3 + ports/esp32s2/supervisor/port.c | 5 + shared-bindings/socketpool/Socket.c | 9 +- shared-bindings/socketpool/Socket.h | 2 +- 5 files changed, 143 insertions(+), 38 deletions(-) diff --git a/ports/esp32s2/common-hal/socketpool/Socket.c b/ports/esp32s2/common-hal/socketpool/Socket.c index 757156e08d5bc..743414ae72abd 100644 --- a/ports/esp32s2/common-hal/socketpool/Socket.c +++ b/ports/esp32s2/common-hal/socketpool/Socket.c @@ -38,6 +38,32 @@ #include "components/lwip/lwip/src/include/lwip/sys.h" #include "components/lwip/lwip/src/include/lwip/netdb.h" +STATIC socketpool_socket_obj_t * open_socket_handles[CONFIG_LWIP_MAX_SOCKETS]; // 4 on the wrover/wroom + +void socket_reset(void) { + for (size_t i = 0; i < MP_ARRAY_SIZE(open_socket_handles); i++) { + if (open_socket_handles[i]) { + if (open_socket_handles[i]->num > 0) { + common_hal_socketpool_socket_close(open_socket_handles[i]); + open_socket_handles[i] = NULL; + } else { + // accidentally got a TCP socket in here, or something. + open_socket_handles[i] = NULL; + } + } + } +} + +bool register_open_socket(socketpool_socket_obj_t* self) { + for (size_t i = 0; i < MP_ARRAY_SIZE(open_socket_handles); i++) { + if (open_socket_handles[i] == NULL) { + open_socket_handles[i] = self; + return true; + } + } + return false; +} + STATIC void _lazy_init_LWIP(socketpool_socket_obj_t* self) { if (self->num != -1) { return; //safe to call on existing socket @@ -47,7 +73,7 @@ STATIC void _lazy_init_LWIP(socketpool_socket_obj_t* self) { } int socknum = -1; socknum = lwip_socket(self->family, self->type, self->ipproto); - if (socknum < 0) { + if (socknum < 0 || !register_open_socket(self)) { mp_raise_RuntimeError(translate("Out of sockets")); } self->num = socknum; @@ -78,34 +104,74 @@ bool common_hal_socketpool_socket_bind(socketpool_socket_obj_t* self, bind_addr.sin_family = AF_INET; bind_addr.sin_port = htons(port); - return lwip_bind(self->num, (struct sockaddr *)&bind_addr, sizeof(bind_addr)) == 0; + int opt = 1; + int err = lwip_setsockopt(self->num, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); + if (err != 0) { + mp_raise_RuntimeError(translate("Issue setting SO_REUSEADDR")); + } + int result = lwip_bind(self->num, (struct sockaddr *)&bind_addr, sizeof(bind_addr)) == 0; + return result; } bool common_hal_socketpool_socket_listen(socketpool_socket_obj_t* self, int backlog) { return lwip_listen(self->num, backlog) == 0; } -int common_hal_socketpool_socket_accept(socketpool_socket_obj_t* self, +socketpool_socket_obj_t* common_hal_socketpool_socket_accept(socketpool_socket_obj_t* self, uint8_t* ip, uint *port) { struct sockaddr_in accept_addr; socklen_t socklen = sizeof(accept_addr); - int newsoc = -1; - //(self->timeout_ms == 0 || supervisor_ticks_ms64() - start_ticks <= self->timeout_ms) - while ((newsoc == -1) && !mp_hal_is_interrupted() ) { + bool timed_out = false; + uint64_t start_ticks = supervisor_ticks_ms64(); + + if (self->timeout_ms != (uint)-1) { + mp_printf(&mp_plat_print, "will timeout"); + } else { + mp_printf(&mp_plat_print, "won't timeout"); + } + + // Allow timeouts and interrupts + while (newsoc == -1 && + !timed_out && + !mp_hal_is_interrupted()) { + if (self->timeout_ms != (uint)-1) { + timed_out = supervisor_ticks_ms64() - start_ticks >= self->timeout_ms; + } RUN_BACKGROUND_TASKS; newsoc = lwip_accept(self->num, (struct sockaddr *)&accept_addr, &socklen); + // In non-blocking mode, fail instead of looping + if (newsoc == -1 && self->timeout_ms == 0) { + mp_raise_OSError(MP_EAGAIN); + } } - mp_printf(&mp_plat_print, "oldsoc:%d newsoc:%d\n",self->num, newsoc); - memcpy((void *)ip, (void*)&accept_addr.sin_addr.s_addr, sizeof(accept_addr.sin_addr.s_addr)); - *port = accept_addr.sin_port; + if (!timed_out) { + // harmless on failure but avoiding memcpy is faster + memcpy((void *)ip, (void*)&accept_addr.sin_addr.s_addr, sizeof(accept_addr.sin_addr.s_addr)); + *port = accept_addr.sin_port; + } else { + mp_raise_OSError(ETIMEDOUT); + } if (newsoc > 0) { + // Create the socket + socketpool_socket_obj_t *sock = m_new_obj_with_finaliser(socketpool_socket_obj_t); + sock->base.type = &socketpool_socket_type; + sock->num = newsoc; + sock->tls = NULL; + sock->ssl_context = NULL; + sock->pool = self->pool; + + if (!register_open_socket(sock)) { + mp_raise_OSError(MP_EBADF); + } + lwip_fcntl(newsoc, F_SETFL, O_NONBLOCK); - return newsoc; + return sock; } else { - return 0; + mp_raise_OSError(MP_EBADF); + return NULL; } } @@ -158,9 +224,10 @@ bool common_hal_socketpool_socket_get_connected(socketpool_socket_obj_t* self) { } mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len) { - size_t sent = -1; + int sent = -1; if (self->num != -1) { // LWIP Socket + // TODO: deal with potential failure/add timeout? sent = lwip_send(self->num, buf, len, 0); } else if (self->tls != NULL) { // TLS Socket @@ -174,15 +241,27 @@ mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t* self, const } mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len) { - size_t received = 0; + int received = 0; + bool timed_out = false; if (self->num != -1) { // LWIP Socket - mp_printf(&mp_plat_print, "lwip_recv:\n"); - - received = lwip_recv(self->num, (void*) buf, len - 1, 0); - mp_printf(&mp_plat_print, "received:%d\n",received); + uint64_t start_ticks = supervisor_ticks_ms64(); + received = -1; + while (received == -1 && + !timed_out && + !mp_hal_is_interrupted()) { + if (self->timeout_ms != (uint)-1) { + timed_out = supervisor_ticks_ms64() - start_ticks >= self->timeout_ms; + } + RUN_BACKGROUND_TASKS; + received = lwip_recv(self->num, (void*) buf, len - 1, 0); + // In non-blocking mode, fail instead of looping + if (received == -1 && self->timeout_ms == 0) { + mp_raise_OSError(MP_EAGAIN); + } + } } else if (self->tls != NULL) { // TLS Socket int status = 0; @@ -194,8 +273,11 @@ mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, } while (received == 0 && status >= 0 && - (self->timeout_ms == 0 || supervisor_ticks_ms64() - start_ticks <= self->timeout_ms) && + !timed_out && !mp_hal_is_interrupted()) { + if (self->timeout_ms != (uint)-1) { + timed_out = self->timeout_ms == 0 || supervisor_ticks_ms64() - start_ticks >= self->timeout_ms; + } RUN_BACKGROUND_TASKS; size_t available = esp_tls_get_bytes_avail(self->tls); if (available == 0) { @@ -219,11 +301,13 @@ mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, } } } + } else { + // Socket does not have a valid descriptor of either type + mp_raise_OSError(MP_EBADF); } - if (received == 0) { - // socket closed - mp_raise_OSError(0); + if (timed_out) { + mp_raise_OSError(ETIMEDOUT); } return received; } @@ -270,19 +354,39 @@ mp_uint_t common_hal_socketpool_socket_recvfrom_into(socketpool_socket_obj_t* se struct sockaddr_in source_addr; socklen_t socklen = sizeof(source_addr); - mp_printf(&mp_plat_print, "recvfrom_into\n"); - int bytes_received = lwip_recvfrom(self->num, buf, len - 1, 0, (struct sockaddr *)&source_addr, &socklen); - mp_printf(&mp_plat_print, "received:%d\n",bytes_received); - memcpy((void *)ip, (void*)&source_addr.sin_addr.s_addr, sizeof(source_addr.sin_addr.s_addr)); - *port = source_addr.sin_port; + // LWIP Socket + uint64_t start_ticks = supervisor_ticks_ms64(); + int received = -1; + bool timed_out = false; + while (received == -1 && + !timed_out && + !mp_hal_is_interrupted()) { + if (self->timeout_ms != (uint)-1) { + timed_out = supervisor_ticks_ms64() - start_ticks >= self->timeout_ms; + } + RUN_BACKGROUND_TASKS; + received = lwip_recvfrom(self->num, buf, len - 1, 0, (struct sockaddr *)&source_addr, &socklen); + + // In non-blocking mode, fail instead of looping + if (received == -1 && self->timeout_ms == 0) { + mp_raise_OSError(MP_EAGAIN); + } + } + + if (!timed_out) { + memcpy((void *)ip, (void*)&source_addr.sin_addr.s_addr, sizeof(source_addr.sin_addr.s_addr)); + *port = source_addr.sin_port; + } else { + mp_raise_OSError(ETIMEDOUT); + } - if (bytes_received < 0) { + if (received < 0) { mp_raise_BrokenPipeError(); return 0; } else { - buf[bytes_received] = 0; // Null-terminate whatever we received - return bytes_received; + buf[received] = 0; // Null-terminate whatever we received + return received; } } diff --git a/ports/esp32s2/common-hal/socketpool/Socket.h b/ports/esp32s2/common-hal/socketpool/Socket.h index 3cffeeb6a1c4b..4e6cfa5ef628e 100644 --- a/ports/esp32s2/common-hal/socketpool/Socket.h +++ b/ports/esp32s2/common-hal/socketpool/Socket.h @@ -47,4 +47,7 @@ typedef struct { mp_uint_t timeout_ms; } socketpool_socket_obj_t; +void socket_reset(void); +bool register_open_socket(socketpool_socket_obj_t* self); + #endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_SOCKETPOOL_SOCKET_H diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 7037b4f05132f..1b123d19d1a44 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -46,6 +46,7 @@ #include "common-hal/pwmio/PWMOut.h" #include "common-hal/touchio/TouchIn.h" #include "common-hal/watchdog/WatchDogTimer.h" +#include "common-hal/socketpool/Socket.h" #include "common-hal/wifi/__init__.h" #include "supervisor/memory.h" #include "supervisor/shared/tick.h" @@ -174,6 +175,10 @@ void reset_port(void) { #if CIRCUITPY_WIFI wifi_reset(); #endif + +#if CIRCUITPY_SOCKETPOOL + socket_reset(); +#endif } void reset_to_bootloader(void) { diff --git a/shared-bindings/socketpool/Socket.c b/shared-bindings/socketpool/Socket.c index a92e508b61bc5..0074173405314 100644 --- a/shared-bindings/socketpool/Socket.c +++ b/shared-bindings/socketpool/Socket.c @@ -115,14 +115,7 @@ STATIC mp_obj_t socketpool_socket_accept(mp_obj_t self_in) { uint8_t ip[4]; uint port; - int socknum = common_hal_socketpool_socket_accept(self, ip, &port); - - socketpool_socket_obj_t *sock = m_new_obj_with_finaliser(socketpool_socket_obj_t); - sock->base.type = &socketpool_socket_type; - sock->num = socknum; - sock->tls = NULL; - sock->ssl_context = NULL; - sock->pool = self->pool; + socketpool_socket_obj_t * sock = common_hal_socketpool_socket_accept(self, ip, &port); mp_obj_t tuple_contents[2]; tuple_contents[0] = MP_OBJ_FROM_PTR(sock); diff --git a/shared-bindings/socketpool/Socket.h b/shared-bindings/socketpool/Socket.h index e2ea32d39239e..b5dceb50f4b45 100644 --- a/shared-bindings/socketpool/Socket.h +++ b/shared-bindings/socketpool/Socket.h @@ -35,7 +35,7 @@ void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t* self, mp_u bool common_hal_socketpool_socket_bind(socketpool_socket_obj_t* self, const char* host, size_t hostlen, uint8_t port); bool common_hal_socketpool_socket_listen(socketpool_socket_obj_t* self, int backlog); -int common_hal_socketpool_socket_accept(socketpool_socket_obj_t* self, uint8_t* ip, uint *port); +socketpool_socket_obj_t * common_hal_socketpool_socket_accept(socketpool_socket_obj_t* self, uint8_t* ip, uint *port); bool common_hal_socketpool_socket_connect(socketpool_socket_obj_t* self, const char* host, size_t hostlen, mp_int_t port); mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len); From 8f8af900987833c338d02fe08cac667ee450b514 Mon Sep 17 00:00:00 2001 From: Jonah Yolles-Murphy Date: Wed, 13 Jan 2021 23:51:34 -0500 Subject: [PATCH 631/770] final name and extra board --- .github/workflows/build.yml | 2 +- .gitmodules | 3 + frozen/Adafruit_CircuitPython_LC709203F | 1 + .../boards/{TG-Watch02 => TG-Watch}/board.c | 0 .../{TG-Watch02 => TG-Watch}/mpconfigboard.h | 2 +- .../{TG-Watch02 => TG-Watch}/mpconfigboard.mk | 1 + .../boards/{TG-Watch02 => TG-Watch}/pins.c | 65 ++++++++++--------- 7 files changed, 40 insertions(+), 34 deletions(-) create mode 160000 frozen/Adafruit_CircuitPython_LC709203F rename ports/nrf/boards/{TG-Watch02 => TG-Watch}/board.c (100%) rename ports/nrf/boards/{TG-Watch02 => TG-Watch}/mpconfigboard.h (98%) rename ports/nrf/boards/{TG-Watch02 => TG-Watch}/mpconfigboard.mk (93%) rename ports/nrf/boards/{TG-Watch02 => TG-Watch}/pins.c (59%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d53dc51214483..bf2771c02dd3a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -176,7 +176,7 @@ jobs: board: - "8086_commander" - "ADM_B_NRF52840_1" - - "TG-Watch02" + - "TG-Watch" - "aloriumtech_evo_m51" - "aramcon_badge_2019" - "arduino_mkr1300" diff --git a/.gitmodules b/.gitmodules index 0fb64d4b576ee..f4080de1b2af2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -168,3 +168,6 @@ [submodule "frozen/Adafruit_CircuitPython_ProgressBar"] path = frozen/Adafruit_CircuitPython_ProgressBar url = https://github.com/adafruit/Adafruit_CircuitPython_ProgressBar +[submodule "frozen/Adafruit_CircuitPython_LC709203F"] + path = frozen/Adafruit_CircuitPython_LC709203F + url = https://github.com/adafruit/Adafruit_CircuitPython_LC709203F diff --git a/frozen/Adafruit_CircuitPython_LC709203F b/frozen/Adafruit_CircuitPython_LC709203F new file mode 160000 index 0000000000000..9945e1da2bca5 --- /dev/null +++ b/frozen/Adafruit_CircuitPython_LC709203F @@ -0,0 +1 @@ +Subproject commit 9945e1da2bca561995c6dea387d47877e89cf571 diff --git a/ports/nrf/boards/TG-Watch02/board.c b/ports/nrf/boards/TG-Watch/board.c similarity index 100% rename from ports/nrf/boards/TG-Watch02/board.c rename to ports/nrf/boards/TG-Watch/board.c diff --git a/ports/nrf/boards/TG-Watch02/mpconfigboard.h b/ports/nrf/boards/TG-Watch/mpconfigboard.h similarity index 98% rename from ports/nrf/boards/TG-Watch02/mpconfigboard.h rename to ports/nrf/boards/TG-Watch/mpconfigboard.h index 3ed4288a17be3..07a607b3d7c79 100644 --- a/ports/nrf/boards/TG-Watch02/mpconfigboard.h +++ b/ports/nrf/boards/TG-Watch/mpconfigboard.h @@ -27,7 +27,7 @@ #include "nrfx/hal/nrf_gpio.h" -#define MICROPY_HW_BOARD_NAME "TG-Watch02" +#define MICROPY_HW_BOARD_NAME "TG-Watch" #define MICROPY_HW_MCU_NAME "nRF52840" #define MICROPY_HW_NEOPIXEL (&pin_P0_16) diff --git a/ports/nrf/boards/TG-Watch02/mpconfigboard.mk b/ports/nrf/boards/TG-Watch/mpconfigboard.mk similarity index 93% rename from ports/nrf/boards/TG-Watch02/mpconfigboard.mk rename to ports/nrf/boards/TG-Watch/mpconfigboard.mk index d6eff4fed8c19..6a002d94008b3 100644 --- a/ports/nrf/boards/TG-Watch02/mpconfigboard.mk +++ b/ports/nrf/boards/TG-Watch/mpconfigboard.mk @@ -18,6 +18,7 @@ FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_ProgressBar FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LSM6DS FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_FocalTouch FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DS3231 +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LC709203F FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DRV2605 FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BLE FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center diff --git a/ports/nrf/boards/TG-Watch02/pins.c b/ports/nrf/boards/TG-Watch/pins.c similarity index 59% rename from ports/nrf/boards/TG-Watch02/pins.c rename to ports/nrf/boards/TG-Watch/pins.c index 71eb1c0a96700..275b89b226fd3 100644 --- a/ports/nrf/boards/TG-Watch02/pins.c +++ b/ports/nrf/boards/TG-Watch/pins.c @@ -7,7 +7,17 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, - /* TG-Watch02 specific pins */ + { 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) }, + + /* TG-Watch specific pins */ { MP_ROM_QSTR(MP_QSTR_VBUS_PRESENT), MP_ROM_PTR(&pin_P1_04) }, { MP_ROM_QSTR(MP_QSTR_HAPTIC_ENABLE), MP_ROM_PTR(&pin_P1_06) }, { MP_ROM_QSTR(MP_QSTR_HAPTIC_INT), MP_ROM_PTR(&pin_P1_07) }, @@ -28,46 +38,37 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_RTC_RST), MP_ROM_PTR(&pin_P0_26) }, { MP_ROM_QSTR(MP_QSTR_CHRG_STAT), MP_ROM_PTR(&pin_P0_06) }, { MP_ROM_QSTR(MP_QSTR_BACKLIGHT), MP_ROM_PTR(&pin_P0_07) }, - { MP_ROM_QSTR(MP_QSTR_SMC_RST), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_BAT_INT), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_SMC_RST), MP_ROM_PTR(&pin_P0_04) }, /* nrf52840 compatible pins */ - { 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__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__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__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__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__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__NEOPIXEL), MP_ROM_PTR(&pin_P0_16) }, }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 5f8ad0c5e612f0468732a3de7549892060f31ab7 Mon Sep 17 00:00:00 2001 From: Jonah Yolles-Murphy Date: Thu, 14 Jan 2021 00:02:56 -0500 Subject: [PATCH 632/770] correct USB_PRODUCT for TG-Watch --- ports/nrf/boards/TG-Watch/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/nrf/boards/TG-Watch/mpconfigboard.mk b/ports/nrf/boards/TG-Watch/mpconfigboard.mk index 6a002d94008b3..191637e30abab 100644 --- a/ports/nrf/boards/TG-Watch/mpconfigboard.mk +++ b/ports/nrf/boards/TG-Watch/mpconfigboard.mk @@ -1,6 +1,6 @@ USB_VID = 0x239A USB_PID = 0x802A -USB_PRODUCT = "TG_Watch02" +USB_PRODUCT = "TG-Watch" USB_MANUFACTURER = "TG-Techie" MCU_CHIP = nrf52840 From c63d5a44a0a05d25ba80bbeb9ce1670dacde4e17 Mon Sep 17 00:00:00 2001 From: Jonah Yolles-Murphy Date: Thu, 14 Jan 2021 00:08:34 -0500 Subject: [PATCH 633/770] restore TG-Watch USB_PID from accidental overwrite --- ports/nrf/boards/TG-Watch/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/nrf/boards/TG-Watch/mpconfigboard.mk b/ports/nrf/boards/TG-Watch/mpconfigboard.mk index 191637e30abab..f1aac6d71ecd8 100644 --- a/ports/nrf/boards/TG-Watch/mpconfigboard.mk +++ b/ports/nrf/boards/TG-Watch/mpconfigboard.mk @@ -1,5 +1,5 @@ USB_VID = 0x239A -USB_PID = 0x802A +USB_PID = 0x80DB USB_PRODUCT = "TG-Watch" USB_MANUFACTURER = "TG-Techie" From e519dd3c5269745f4d6c66a012974e622bc08343 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Wed, 13 Jan 2021 23:45:59 -0600 Subject: [PATCH 634/770] Retry on all disconnect reasons other than: 2 exception reasons & 1 manual disconnect reason. --- ports/esp32s2/common-hal/wifi/__init__.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/__init__.c b/ports/esp32s2/common-hal/wifi/__init__.c index 08d7a164f4c2e..b8e8f731bd812 100644 --- a/ports/esp32s2/common-hal/wifi/__init__.c +++ b/ports/esp32s2/common-hal/wifi/__init__.c @@ -65,11 +65,9 @@ static void event_handler(void* arg, esp_event_base_t event_base, uint8_t reason = d->reason; ESP_LOGW(TAG, "reason %d 0x%02x", reason, reason); if (radio->retries_left > 0 && - (reason == WIFI_REASON_AUTH_EXPIRE || - reason == WIFI_REASON_NOT_AUTHED || - reason == WIFI_REASON_ASSOC_EXPIRE || - reason == WIFI_REASON_CONNECTION_FAIL || - reason == WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT)) { + reason != WIFI_REASON_AUTH_FAIL && + reason != WIFI_REASON_NO_AP_FOUND && + reason != WIFI_REASON_ASSOC_LEAVE) { radio->retries_left--; ESP_LOGI(TAG, "Retrying connect. %d retries remaining", radio->retries_left); esp_wifi_connect(); From f75bb5c50f3fac1d12c058abfc3446345d97f013 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Wed, 13 Jan 2021 23:46:35 -0600 Subject: [PATCH 635/770] Rename to match WIFI_REASON. Also return specific reason code. --- ports/esp32s2/common-hal/wifi/Radio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index e9f374a06b06f..9302300889722 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -168,11 +168,11 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t } while ((bits & (WIFI_CONNECTED_BIT | WIFI_DISCONNECTED_BIT)) == 0 && !mp_hal_is_interrupted()); if ((bits & WIFI_DISCONNECTED_BIT) != 0) { if (self->last_disconnect_reason == WIFI_REASON_AUTH_FAIL) { - return WIFI_RADIO_ERROR_AUTH; + return WIFI_RADIO_ERROR_AUTH_FAIL; } else if (self->last_disconnect_reason == WIFI_REASON_NO_AP_FOUND) { return WIFI_RADIO_ERROR_NO_AP_FOUND; } - return WIFI_RADIO_ERROR_UNKNOWN; + return self->last_disconnect_reason; } return WIFI_RADIO_ERROR_NONE; } From d1249fbe470bfdaf376e510c8deb2f35f14bb55c Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Wed, 13 Jan 2021 23:46:52 -0600 Subject: [PATCH 636/770] Include all reason codes. --- shared-bindings/wifi/Radio.h | 37 ++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/shared-bindings/wifi/Radio.h b/shared-bindings/wifi/Radio.h index 1e8f362e34705..64c1052f7b052 100644 --- a/shared-bindings/wifi/Radio.h +++ b/shared-bindings/wifi/Radio.h @@ -36,10 +36,39 @@ const mp_obj_type_t wifi_radio_type; typedef enum { - WIFI_RADIO_ERROR_NONE, - WIFI_RADIO_ERROR_UNKNOWN, - WIFI_RADIO_ERROR_AUTH, - WIFI_RADIO_ERROR_NO_AP_FOUND + // 0 is circuitpython-specific; 1-53 are IEEE; 200+ are Espressif + WIFI_RADIO_ERROR_NONE = 0, + WIFI_RADIO_ERROR_UNSPECIFIED = 1, + WIFI_RADIO_ERROR_AUTH_EXPIRE = 2, + WIFI_RADIO_ERROR_AUTH_LEAVE = 3, + WIFI_RADIO_ERROR_ASSOC_EXPIRE = 4, + WIFI_RADIO_ERROR_ASSOC_TOOMANY = 5, + WIFI_RADIO_ERROR_NOT_AUTHED = 6, + WIFI_RADIO_ERROR_NOT_ASSOCED = 7, + WIFI_RADIO_ERROR_ASSOC_LEAVE = 8, + WIFI_RADIO_ERROR_ASSOC_NOT_AUTHED = 9, + WIFI_RADIO_ERROR_DISASSOC_PWRCAP_BAD = 10, + WIFI_RADIO_ERROR_DISASSOC_SUPCHAN_BAD = 11, + WIFI_RADIO_ERROR_IE_INVALID = 13, + WIFI_RADIO_ERROR_MIC_FAILURE = 14, + WIFI_RADIO_ERROR_4WAY_HANDSHAKE_TIMEOUT = 15, + WIFI_RADIO_ERROR_GROUP_KEY_UPDATE_TIMEOUT = 16, + WIFI_RADIO_ERROR_IE_IN_4WAY_DIFFERS = 17, + WIFI_RADIO_ERROR_GROUP_CIPHER_INVALID = 18, + WIFI_RADIO_ERROR_PAIRWISE_CIPHER_INVALID = 19, + WIFI_RADIO_ERROR_AKMP_INVALID = 20, + WIFI_RADIO_ERROR_UNSUPP_RSN_IE_VERSION = 21, + WIFI_RADIO_ERROR_INVALID_RSN_IE_CAP = 22, + WIFI_RADIO_ERROR_802_1X_AUTH_FAILED = 23, + WIFI_RADIO_ERROR_CIPHER_SUITE_REJECTED = 24, + WIFI_RADIO_ERROR_INVALID_PMKID = 53, + WIFI_RADIO_ERROR_BEACON_TIMEOUT = 200, + WIFI_RADIO_ERROR_NO_AP_FOUND = 201, + WIFI_RADIO_ERROR_AUTH_FAIL = 202, + WIFI_RADIO_ERROR_ASSOC_FAIL = 203, + WIFI_RADIO_ERROR_HANDSHAKE_TIMEOUT = 204, + WIFI_RADIO_ERROR_CONNECTION_FAIL = 205, + WIFI_RADIO_ERROR_AP_TSF_RESET = 206, } wifi_radio_error_t; extern bool common_hal_wifi_radio_get_enabled(wifi_radio_obj_t *self); From 8febdee2640570932c1659817bcaadd429761e8b Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Wed, 13 Jan 2021 23:47:23 -0600 Subject: [PATCH 637/770] Rename to match WIFI_REASON. Also include specific error code in "Unknown failure" Exception. --- shared-bindings/wifi/Radio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index 63f507067a72a..8181fc4c968d2 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -218,12 +218,12 @@ STATIC mp_obj_t wifi_radio_connect(size_t n_args, const mp_obj_t *pos_args, mp_m } wifi_radio_error_t error = common_hal_wifi_radio_connect(self, ssid.buf, ssid.len, password.buf, password.len, args[ARG_channel].u_int, timeout, bssid.buf, bssid.len); - if (error == WIFI_RADIO_ERROR_AUTH) { + if (error == WIFI_RADIO_ERROR_AUTH_FAIL) { mp_raise_ConnectionError(translate("Authentication failure")); } else if (error == WIFI_RADIO_ERROR_NO_AP_FOUND) { mp_raise_ConnectionError(translate("No network with that ssid")); } else if (error != WIFI_RADIO_ERROR_NONE) { - mp_raise_ConnectionError(translate("Unknown failure")); + mp_raise_msg_varg(&mp_type_ConnectionError, translate("Unknown failure %d"), error); } return mp_const_none; From b05c6bac21dedafd60d0a81ea6c6b68c313a57b2 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 14 Jan 2021 11:04:36 -0500 Subject: [PATCH 638/770] change extensa github actions cache key to avoid bad cache --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9899972ebd024..9dde06f7065ad 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -464,7 +464,7 @@ jobs: id: idf-cache with: path: ${{ github.workspace }}/.idf_tools - key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20200801 + key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210114 - name: Clone IDF submodules run: | (cd $IDF_PATH && git submodule update --init) From 54cc9ab4b99f508d38bcb90bfdb924de4652a1b9 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 14 Jan 2021 11:04:36 -0500 Subject: [PATCH 639/770] change extensa github actions cache key to avoid bad cache --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9899972ebd024..9dde06f7065ad 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -464,7 +464,7 @@ jobs: id: idf-cache with: path: ${{ github.workspace }}/.idf_tools - key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20200801 + key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210114 - name: Clone IDF submodules run: | (cd $IDF_PATH && git submodule update --init) From aedc8efeda907d9492ae4f5c04018a4704276275 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 14 Jan 2021 14:43:47 -0500 Subject: [PATCH 640/770] Add pin A1 as alias for AD1; A1 is preferred --- ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c index 645dc12a1b105..ff44d9edb628e 100644 --- a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c +++ b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c @@ -4,7 +4,11 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO18) }, + // Previous name from schematic. { MP_ROM_QSTR(MP_QSTR_AD1), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, { MP_ROM_QSTR(MP_QSTR_SPEAKER), MP_ROM_PTR(&pin_GPIO17) }, From 8e51139da09d981bd2f975db907e1a9c35f4a73d Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 14 Jan 2021 13:42:28 -0600 Subject: [PATCH 641/770] update uzlib to v2.9.5 uzlib isn't actually used in any firmwares, but is built into the "unix" port used for testing. The main benefit of the update is to fix problems encountered on Windows, as the old ref of uzlib had filenames with embedded colons; this has been fixed upstream. uzlib seems to have been reabsed since the version that we took; this doesn't really matter to us. --- lib/uzlib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/uzlib b/lib/uzlib index f966da0fab121..27e4f4c15ba30 160000 --- a/lib/uzlib +++ b/lib/uzlib @@ -1 +1 @@ -Subproject commit f966da0fab121e910ea74f037f074538a2e6dbbb +Subproject commit 27e4f4c15ba30c2cfc89575159e8efb50f95037e From 059363f0e2079a172912360e8ed17e245e1f4d66 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 13 Jan 2021 15:38:47 -0600 Subject: [PATCH 642/770] ports/unix: Fix parallel build problem This is the same as I added to mpy-cross at e666e86035d5, see #3074 --- ports/unix/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/unix/Makefile b/ports/unix/Makefile index 4bfb13c6a2ab9..305c0549d1d11 100644 --- a/ports/unix/Makefile +++ b/ports/unix/Makefile @@ -318,3 +318,5 @@ $(BUILD)/libaxtls.a: $(TOP)/lib/axtls/README | $(OBJ_DIRS) $(TOP)/lib/axtls/README: @echo "You cloned without --recursive, fetching submodules for you." (cd $(TOP); git submodule update --init --recursive) + +$(BUILD)/supervisor/shared/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h From ad87f3768997d54ea5f98bc9a4668c17b4b3e1f9 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 14 Jan 2021 14:16:11 -0600 Subject: [PATCH 643/770] ulab: update to 1.7.0 --- extmod/ulab | 2 +- locale/circuitpython.pot | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/extmod/ulab b/extmod/ulab index d62d07ea0b959..fe3e19ca416b3 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit d62d07ea0b9597535428ebe6012da6b0d6608bf9 +Subproject commit fe3e19ca416b3c5ed92789f151ec6cc4a29eb7f8 diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 82058a6110902..1c92d3765fbd6 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -2278,10 +2278,18 @@ msgstr "" msgid "branch not in range" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "buffer is smaller than requested size" +msgstr "" + #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "buffer size must be a multiple of element size" +msgstr "" + #: shared-module/struct/__init__.c msgid "buffer size must match format" msgstr "" @@ -3339,6 +3347,10 @@ msgstr "" msgid "offset must be >= 0" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "offset must be non-negative and no greater than buffer length" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" From 564dce858f2307c649155bb9c14810aad6b823c1 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Thu, 14 Jan 2021 17:53:37 -0600 Subject: [PATCH 644/770] Update translations --- locale/circuitpython.pot | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 82058a6110902..09ce1718d8aac 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -2013,7 +2013,8 @@ msgid "Unhandled ESP TLS error %d %d %x %d" msgstr "" #: shared-bindings/wifi/Radio.c -msgid "Unknown failure" +#, c-format +msgid "Unknown failure %d" msgstr "" #: ports/nrf/common-hal/_bleio/__init__.c From d85e0716166bc73e4d1bdde4a5ee2287fe811750 Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Thu, 14 Jan 2021 18:04:41 -0600 Subject: [PATCH 645/770] Hard code new copyright date --- conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf.py b/conf.py index 590e5bc2c5e26..fb3c0756dc83a 100644 --- a/conf.py +++ b/conf.py @@ -103,7 +103,7 @@ # General information about the project. project = 'Adafruit CircuitPython' -copyright = '2014-2020, MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)' +copyright = '2014-2021, MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)' # These are overwritten on ReadTheDocs. # The version info for the project you're documenting, acts as replacement for From d88bb0b09b54dedd2508ec4ededb63ae562c0d1a Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Thu, 14 Jan 2021 18:16:34 -0600 Subject: [PATCH 646/770] Set year from execution date Set the date (year) of the copyright notice to be the current year at the time the documentation is generated. --- conf.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/conf.py b/conf.py index fb3c0756dc83a..c2d3d37eeda90 100644 --- a/conf.py +++ b/conf.py @@ -23,6 +23,7 @@ import subprocess import sys import urllib.parse +import time import recommonmark from sphinx.transforms import SphinxTransform @@ -101,9 +102,12 @@ # The master toctree document. #master_doc = 'index' +# Get current date (execution) for copyright year +current_date = time.localtime() + # General information about the project. project = 'Adafruit CircuitPython' -copyright = '2014-2021, MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)' +copyright = f'2014-{current_date.tm_year}, MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)' # These are overwritten on ReadTheDocs. # The version info for the project you're documenting, acts as replacement for From a98df7209d5e0bd73353f435fb9c206f13da36ca Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 15 Jan 2021 09:50:58 -0600 Subject: [PATCH 647/770] Update to 1.7.1 --- extmod/ulab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extmod/ulab b/extmod/ulab index fe3e19ca416b3..3592e54c22346 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit fe3e19ca416b3c5ed92789f151ec6cc4a29eb7f8 +Subproject commit 3592e54c223460d20a05537b5809abea524d21a9 From c843122d3dbc34212c64da40baddf1a7b59ac1e1 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 15 Jan 2021 12:00:29 -0600 Subject: [PATCH 648/770] fix doc build --- extmod/ulab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extmod/ulab b/extmod/ulab index 3592e54c22346..8b804f3bcd8c5 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit 3592e54c223460d20a05537b5809abea524d21a9 +Subproject commit 8b804f3bcd8c5a3ac1b3e09e0ff7faf8270751de From 05cc67f537d5ba6b20efcb21dd33f92628d39f86 Mon Sep 17 00:00:00 2001 From: oon arfiandwi Date: Fri, 15 Jan 2021 05:11:50 +0000 Subject: [PATCH 649/770] Translated using Weblate (Indonesian) Currently translated at 49.1% (449 of 913 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/id/ --- locale/ID.po | 60 +++++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 6aa4f0fba2e3f..f4ac3e4f17e0b 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-01-03 05:29+0000\n" +"PO-Revision-Date: 2021-01-15 19:49+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" "Language: ID\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.4.1-dev\n" +"X-Generator: Weblate 4.5-dev\n" #: main.c msgid "" @@ -2060,32 +2060,34 @@ msgstr "" #: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Unknown gatt error: 0x%04x" -msgstr "" +msgstr "Kesalahan gatt tidak dikenal: 0x%04x" #: supervisor/shared/safe_mode.c msgid "Unknown reason." -msgstr "" +msgstr "Alasan yang tidak diketahui." #: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Unknown security error: 0x%04x" -msgstr "" +msgstr "Kesalahan keamanan tidak dikenal: 0x%04x" #: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Unknown soft device error: %04x" -msgstr "" +msgstr "Kesalahan perangkat lunak tidak dikenal: %04x" #: shared-bindings/_pixelbuf/PixelBuf.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." -msgstr "" +msgstr "Jumlah item pada RHS tidak cocok (diharapkan %d, didapatkan %d)." #: ports/nrf/common-hal/_bleio/__init__.c msgid "" "Unspecified issue. Can be that the pairing prompt on the other device was " "declined or ignored." msgstr "" +"Masalah yang tidak ditentukan. Bisa jadi permintaan pemasangan pada " +"perangkat lain ditolak atau diabaikan." #: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c #: ports/esp32s2/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c @@ -2099,15 +2101,15 @@ msgstr "Baudrate tidak didukung" #: shared-module/audiocore/WaveFile.c msgid "Unsupported format" -msgstr "" +msgstr "Format tidak didukung" #: py/moduerrno.c msgid "Unsupported operation" -msgstr "" +msgstr "Operasi yang tidak didukung" #: shared-bindings/digitalio/DigitalInOut.c msgid "Unsupported pull value." -msgstr "" +msgstr "Nilai tarikan yang tidak didukung." #: ports/esp32s2/common-hal/dualbank/__init__.c msgid "Update Failed" @@ -2116,12 +2118,12 @@ msgstr "" #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" -msgstr "" +msgstr "Panjang nilai != Panjang tetap yang dibutuhkan" #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length > max_length" -msgstr "" +msgstr "Panjang nilai > max_length" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Version was invalid" @@ -2129,11 +2131,11 @@ msgstr "" #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" -msgstr "" +msgstr "Fungsi Viper saat ini tidak mendukung lebih dari 4 argumen" #: ports/stm/common-hal/microcontroller/Processor.c msgid "Voltage read timed out" -msgstr "" +msgstr "Tegangan baca habis waktu" #: main.c msgid "WARNING: Your code filename has two extensions\n" @@ -2185,11 +2187,11 @@ msgstr "" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" -msgstr "" +msgstr "Menulis tidak didukung pada Karakteristik" #: supervisor/shared/safe_mode.c msgid "You are in safe mode: something unanticipated happened.\n" -msgstr "" +msgstr "Anda berada dalam mode aman: sesuatu yang tidak terduga terjadi.\n" #: supervisor/shared/safe_mode.c msgid "You requested starting safe mode by " @@ -2197,7 +2199,7 @@ msgstr "Anda mengajukan untuk memulai mode aman pada (safe mode) pada " #: py/objtype.c msgid "__init__() should return None" -msgstr "" +msgstr "__init __() harus mengembalikan None" #: py/objtype.c msgid "__init__() should return None, not '%q'" @@ -2205,7 +2207,7 @@ msgstr "" #: py/objobject.c msgid "__new__ arg must be a user-type" -msgstr "" +msgstr "__new__ arg harus berupa user-type" #: extmod/modubinascii.c extmod/moduhashlib.c py/objarray.c msgid "a bytes-like object is required" @@ -2222,19 +2224,19 @@ msgstr "alamat %08x tidak selaras dengan %d bytes" #: shared-bindings/i2cperipheral/I2CPeripheral.c msgid "address out of bounds" -msgstr "" +msgstr "alamat di luar batas" #: shared-bindings/i2cperipheral/I2CPeripheral.c msgid "addresses is empty" -msgstr "" +msgstr "alamatnya kosong" #: py/modbuiltins.c msgid "arg is an empty sequence" -msgstr "" +msgstr "arg berisi urutan kosong" #: extmod/ulab/code/numerical/numerical.c msgid "argsort argument must be an ndarray" -msgstr "" +msgstr "Argumen argsort harus berupa ndarray" #: extmod/ulab/code/numerical/numerical.c msgid "argsort is not implemented for flattened arrays" @@ -2242,7 +2244,7 @@ msgstr "" #: py/runtime.c msgid "argument has wrong type" -msgstr "" +msgstr "argumen memiliki tipe yang salah" #: extmod/ulab/code/linalg/linalg.c msgid "argument must be ndarray" @@ -2255,11 +2257,11 @@ msgstr "argumen num/types tidak cocok" #: py/runtime.c msgid "argument should be a '%q' not a '%q'" -msgstr "" +msgstr "argumen harus berupa '%q' bukan '%q'" #: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c msgid "arguments must be ndarrays" -msgstr "" +msgstr "argumen harus berupa ndarrays" #: extmod/ulab/code/ndarray.c msgid "array and index length must be equal" @@ -2268,7 +2270,7 @@ msgstr "" #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" -msgstr "" +msgstr "diperlukan array/byte di sisi kanan" #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" @@ -2276,11 +2278,11 @@ msgstr "" #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" -msgstr "" +msgstr "berusaha mendapatkan argmin/argmax dari urutan kosong" #: py/objstr.c msgid "attributes not supported yet" -msgstr "" +msgstr "atribut belum didukung" #: extmod/ulab/code/numerical/numerical.c msgid "axis is out of bounds" @@ -2300,7 +2302,7 @@ msgstr "mode compile buruk" #: py/objstr.c msgid "bad conversion specifier" -msgstr "" +msgstr "specifier salah konversi" #: py/objstr.c msgid "bad format string" From cab9139975e7647ec36d549c4b6fcccb6e10bbde Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Fri, 15 Jan 2021 20:49:34 +0100 Subject: [PATCH 650/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 12 ++++++++++++ locale/cs.po | 12 ++++++++++++ locale/de_DE.po | 12 ++++++++++++ locale/el.po | 12 ++++++++++++ locale/es.po | 12 ++++++++++++ locale/fil.po | 12 ++++++++++++ locale/fr.po | 12 ++++++++++++ locale/hi.po | 12 ++++++++++++ locale/it_IT.po | 12 ++++++++++++ locale/ja.po | 12 ++++++++++++ locale/ko.po | 12 ++++++++++++ locale/nl.po | 12 ++++++++++++ locale/pl.po | 12 ++++++++++++ locale/pt_BR.po | 12 ++++++++++++ locale/sv.po | 12 ++++++++++++ locale/zh_Latn_pinyin.po | 12 ++++++++++++ 16 files changed, 192 insertions(+) diff --git a/locale/ID.po b/locale/ID.po index f4ac3e4f17e0b..db7269307f751 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -2328,10 +2328,18 @@ msgstr "" msgid "branch not in range" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "buffer is smaller than requested size" +msgstr "" + #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "buffer size must be a multiple of element size" +msgstr "" + #: shared-module/struct/__init__.c #, fuzzy msgid "buffer size must match format" @@ -3390,6 +3398,10 @@ msgstr "" msgid "offset must be >= 0" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "offset must be non-negative and no greater than buffer length" +msgstr "" + #: py/objstr.c py/objstrunicode.c #, fuzzy msgid "offset out of bounds" diff --git a/locale/cs.po b/locale/cs.po index a27a1459a1db4..a29cbebe673ab 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -2281,10 +2281,18 @@ msgstr "" msgid "branch not in range" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "buffer is smaller than requested size" +msgstr "" + #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "buffer size must be a multiple of element size" +msgstr "" + #: shared-module/struct/__init__.c msgid "buffer size must match format" msgstr "" @@ -3342,6 +3350,10 @@ msgstr "" msgid "offset must be >= 0" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "offset must be non-negative and no greater than buffer length" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 350c7aac1a8ce..317687b889222 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -2338,10 +2338,18 @@ msgstr "Es müssen 8 oder 16 bits_per_sample sein" msgid "branch not in range" msgstr "Zweig ist außerhalb der Reichweite" +#: extmod/ulab/code/ulab_create.c +msgid "buffer is smaller than requested size" +msgstr "" + #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" msgstr "Puffer muss ein bytes-artiges Objekt sein" +#: extmod/ulab/code/ulab_create.c +msgid "buffer size must be a multiple of element size" +msgstr "" + #: shared-module/struct/__init__.c msgid "buffer size must match format" msgstr "Die Puffergröße muss zum Format passen" @@ -3419,6 +3427,10 @@ msgstr "" msgid "offset must be >= 0" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "offset must be non-negative and no greater than buffer length" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "offset außerhalb der Grenzen" diff --git a/locale/el.po b/locale/el.po index 7001c2aa23115..d389dc723f273 100644 --- a/locale/el.po +++ b/locale/el.po @@ -2278,10 +2278,18 @@ msgstr "" msgid "branch not in range" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "buffer is smaller than requested size" +msgstr "" + #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "buffer size must be a multiple of element size" +msgstr "" + #: shared-module/struct/__init__.c msgid "buffer size must match format" msgstr "" @@ -3339,6 +3347,10 @@ msgstr "" msgid "offset must be >= 0" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "offset must be non-negative and no greater than buffer length" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" diff --git a/locale/es.po b/locale/es.po index 45695665c1cf9..fae50b13ad5e8 100644 --- a/locale/es.po +++ b/locale/es.po @@ -2339,10 +2339,18 @@ msgstr "bits_per_sample debe ser 8 ó 16" msgid "branch not in range" msgstr "la rama no está dentro del rango" +#: extmod/ulab/code/ulab_create.c +msgid "buffer is smaller than requested size" +msgstr "" + #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" msgstr "buffer debe de ser un objeto bytes-like" +#: extmod/ulab/code/ulab_create.c +msgid "buffer size must be a multiple of element size" +msgstr "" + #: shared-module/struct/__init__.c msgid "buffer size must match format" msgstr "el tamaño del buffer debe de coincidir con el formato" @@ -3413,6 +3421,10 @@ msgstr "offset es demasiado grande" msgid "offset must be >= 0" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "offset must be non-negative and no greater than buffer length" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "offset fuera de límites" diff --git a/locale/fil.po b/locale/fil.po index ddd5f3dfe4669..0798e507848ff 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -2308,10 +2308,18 @@ msgstr "bits_per_sample ay dapat 8 o 16" msgid "branch not in range" msgstr "branch wala sa range" +#: extmod/ulab/code/ulab_create.c +msgid "buffer is smaller than requested size" +msgstr "" + #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" msgstr "buffer ay dapat bytes-like object" +#: extmod/ulab/code/ulab_create.c +msgid "buffer size must be a multiple of element size" +msgstr "" + #: shared-module/struct/__init__.c #, fuzzy msgid "buffer size must match format" @@ -3386,6 +3394,10 @@ msgstr "" msgid "offset must be >= 0" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "offset must be non-negative and no greater than buffer length" +msgstr "" + #: py/objstr.c py/objstrunicode.c #, fuzzy msgid "offset out of bounds" diff --git a/locale/fr.po b/locale/fr.po index ad0ed6e7afe6d..07166b7d22f0f 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -2363,10 +2363,18 @@ msgstr "'bits_per_sample' doivent être 8 ou 16" msgid "branch not in range" msgstr "branche hors-bornes" +#: extmod/ulab/code/ulab_create.c +msgid "buffer is smaller than requested size" +msgstr "" + #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" msgstr "le tampon doit être un objet bytes-like" +#: extmod/ulab/code/ulab_create.c +msgid "buffer size must be a multiple of element size" +msgstr "" + #: shared-module/struct/__init__.c msgid "buffer size must match format" msgstr "la taille du tampon doit correspondre au format" @@ -3446,6 +3454,10 @@ msgstr "offset est trop large" msgid "offset must be >= 0" msgstr "offset doit être >= 0" +#: extmod/ulab/code/ulab_create.c +msgid "offset must be non-negative and no greater than buffer length" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "décalage hors limites" diff --git a/locale/hi.po b/locale/hi.po index 618490b378ff5..84187032bf59f 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -2278,10 +2278,18 @@ msgstr "" msgid "branch not in range" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "buffer is smaller than requested size" +msgstr "" + #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "buffer size must be a multiple of element size" +msgstr "" + #: shared-module/struct/__init__.c msgid "buffer size must match format" msgstr "" @@ -3339,6 +3347,10 @@ msgstr "" msgid "offset must be >= 0" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "offset must be non-negative and no greater than buffer length" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index f9f77b20efb2c..b285034d2184d 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -2314,10 +2314,18 @@ msgstr "i bit devono essere 7, 8 o 9" msgid "branch not in range" msgstr "argomento di chr() non è in range(256)" +#: extmod/ulab/code/ulab_create.c +msgid "buffer is smaller than requested size" +msgstr "" + #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "buffer size must be a multiple of element size" +msgstr "" + #: shared-module/struct/__init__.c #, fuzzy msgid "buffer size must match format" @@ -3392,6 +3400,10 @@ msgstr "" msgid "offset must be >= 0" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "offset must be non-negative and no greater than buffer length" +msgstr "" + #: py/objstr.c py/objstrunicode.c #, fuzzy msgid "offset out of bounds" diff --git a/locale/ja.po b/locale/ja.po index 37d23f9594a76..0b1aad9b911c9 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -2301,10 +2301,18 @@ msgstr "bits_per_sampleは8または16でなければなりません" msgid "branch not in range" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "buffer is smaller than requested size" +msgstr "" + #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" msgstr "バッファはbytes-likeオブジェクトでなければなりません" +#: extmod/ulab/code/ulab_create.c +msgid "buffer size must be a multiple of element size" +msgstr "" + #: shared-module/struct/__init__.c msgid "buffer size must match format" msgstr "" @@ -3367,6 +3375,10 @@ msgstr "" msgid "offset must be >= 0" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "offset must be non-negative and no greater than buffer length" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" diff --git a/locale/ko.po b/locale/ko.po index b7fc29629bb14..27d13f22ed390 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -2282,10 +2282,18 @@ msgstr "bits_per_sample은 8 또는 16이어야합니다." msgid "branch not in range" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "buffer is smaller than requested size" +msgstr "" + #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "buffer size must be a multiple of element size" +msgstr "" + #: shared-module/struct/__init__.c msgid "buffer size must match format" msgstr "" @@ -3343,6 +3351,10 @@ msgstr "" msgid "offset must be >= 0" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "offset must be non-negative and no greater than buffer length" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 52984373c2dbc..d7bd6c3bf5b37 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -2331,10 +2331,18 @@ msgstr "bits_per_sample moet 8 of 16 zijn" msgid "branch not in range" msgstr "pad (branch) niet binnen bereik" +#: extmod/ulab/code/ulab_create.c +msgid "buffer is smaller than requested size" +msgstr "" + #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" msgstr "buffer moet een byte-achtig object zijn" +#: extmod/ulab/code/ulab_create.c +msgid "buffer size must be a multiple of element size" +msgstr "" + #: shared-module/struct/__init__.c msgid "buffer size must match format" msgstr "grootte van de buffer moet overeenkomen met het formaat" @@ -3400,6 +3408,10 @@ msgstr "compensatie is te groot" msgid "offset must be >= 0" msgstr "compensatie moet groter of gelijk 0 zijn" +#: extmod/ulab/code/ulab_create.c +msgid "offset must be non-negative and no greater than buffer length" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "offset buiten bereik" diff --git a/locale/pl.po b/locale/pl.po index 41eee9e74557e..0d09ef8fd5ca0 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -2298,10 +2298,18 @@ msgstr "bits_per_sample musi być 8 lub 16" msgid "branch not in range" msgstr "skok poza zakres" +#: extmod/ulab/code/ulab_create.c +msgid "buffer is smaller than requested size" +msgstr "" + #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" msgstr "bufor mysi być typu bytes" +#: extmod/ulab/code/ulab_create.c +msgid "buffer size must be a multiple of element size" +msgstr "" + #: shared-module/struct/__init__.c msgid "buffer size must match format" msgstr "wielkość bufora musi pasować do formatu" @@ -3360,6 +3368,10 @@ msgstr "" msgid "offset must be >= 0" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "offset must be non-negative and no greater than buffer length" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "offset poza zakresem" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 64723c1938e32..8037ae7d4d936 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -2355,10 +2355,18 @@ msgstr "bits_per_sample deve ser 8 ou 16" msgid "branch not in range" msgstr "ramo fora do alcance" +#: extmod/ulab/code/ulab_create.c +msgid "buffer is smaller than requested size" +msgstr "" + #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" msgstr "o buffer deve ser um objeto como bytes" +#: extmod/ulab/code/ulab_create.c +msgid "buffer size must be a multiple of element size" +msgstr "" + #: shared-module/struct/__init__.c msgid "buffer size must match format" msgstr "o tamanho do buffer deve coincidir com o formato" @@ -3431,6 +3439,10 @@ msgstr "o offset é muito grande" msgid "offset must be >= 0" msgstr "o offset deve ser >= 0" +#: extmod/ulab/code/ulab_create.c +msgid "offset must be non-negative and no greater than buffer length" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "desvio fora dos limites" diff --git a/locale/sv.po b/locale/sv.po index 477664972c44d..3bfc325a04d23 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -2331,10 +2331,18 @@ msgstr "bits_per_sample måste vara 8 eller 16" msgid "branch not in range" msgstr "branch utanför räckvidd" +#: extmod/ulab/code/ulab_create.c +msgid "buffer is smaller than requested size" +msgstr "" + #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" msgstr "buffer måste vara en byte-liknande objekt" +#: extmod/ulab/code/ulab_create.c +msgid "buffer size must be a multiple of element size" +msgstr "" + #: shared-module/struct/__init__.c msgid "buffer size must match format" msgstr "buffertstorleken måste matcha formatet" @@ -3400,6 +3408,10 @@ msgstr "offset är för stor" msgid "offset must be >= 0" msgstr "offset måste vara >= 0" +#: extmod/ulab/code/ulab_create.c +msgid "offset must be non-negative and no greater than buffer length" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "offset utanför gränserna" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index d9a750b348ac4..ec99c3f578ada 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -2317,10 +2317,18 @@ msgstr "měi jiàn yàngběn bìxū wèi 8 huò 16" msgid "branch not in range" msgstr "fēnzhī bùzài fànwéi nèi" +#: extmod/ulab/code/ulab_create.c +msgid "buffer is smaller than requested size" +msgstr "" + #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" msgstr "huǎnchōng qū bìxū shì zì jié lèi duìxiàng" +#: extmod/ulab/code/ulab_create.c +msgid "buffer size must be a multiple of element size" +msgstr "" + #: shared-module/struct/__init__.c msgid "buffer size must match format" msgstr "huǎnchōng qū dàxiǎo bìxū pǐpèi géshì" @@ -3384,6 +3392,10 @@ msgstr "" msgid "offset must be >= 0" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "offset must be non-negative and no greater than buffer length" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "piānlí biānjiè" From 0e3da9b6a3a48c665ae98e8681e91a5c9463382e Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Fri, 15 Jan 2021 20:52:42 +0100 Subject: [PATCH 651/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 3 ++- locale/cs.po | 3 ++- locale/de_DE.po | 3 ++- locale/el.po | 3 ++- locale/es.po | 8 ++++++-- locale/fil.po | 3 ++- locale/fr.po | 8 ++++++-- locale/hi.po | 3 ++- locale/it_IT.po | 3 ++- locale/ja.po | 3 ++- locale/ko.po | 3 ++- locale/nl.po | 8 ++++++-- locale/pl.po | 3 ++- locale/pt_BR.po | 8 ++++++-- locale/sv.po | 8 ++++++-- locale/zh_Latn_pinyin.po | 8 ++++++-- 16 files changed, 56 insertions(+), 22 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index db7269307f751..d0c9bbe307e0c 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -2054,7 +2054,8 @@ msgid "Unhandled ESP TLS error %d %d %x %d" msgstr "" #: shared-bindings/wifi/Radio.c -msgid "Unknown failure" +#, c-format +msgid "Unknown failure %d" msgstr "" #: ports/nrf/common-hal/_bleio/__init__.c diff --git a/locale/cs.po b/locale/cs.po index a29cbebe673ab..bc5bca31fd868 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -2016,7 +2016,8 @@ msgid "Unhandled ESP TLS error %d %d %x %d" msgstr "" #: shared-bindings/wifi/Radio.c -msgid "Unknown failure" +#, c-format +msgid "Unknown failure %d" msgstr "" #: ports/nrf/common-hal/_bleio/__init__.c diff --git a/locale/de_DE.po b/locale/de_DE.po index 317687b889222..31163c141284b 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -2058,7 +2058,8 @@ msgid "Unhandled ESP TLS error %d %d %x %d" msgstr "" #: shared-bindings/wifi/Radio.c -msgid "Unknown failure" +#, c-format +msgid "Unknown failure %d" msgstr "" #: ports/nrf/common-hal/_bleio/__init__.c diff --git a/locale/el.po b/locale/el.po index d389dc723f273..0a56d47486820 100644 --- a/locale/el.po +++ b/locale/el.po @@ -2013,7 +2013,8 @@ msgid "Unhandled ESP TLS error %d %d %x %d" msgstr "" #: shared-bindings/wifi/Radio.c -msgid "Unknown failure" +#, c-format +msgid "Unknown failure %d" msgstr "" #: ports/nrf/common-hal/_bleio/__init__.c diff --git a/locale/es.po b/locale/es.po index fae50b13ad5e8..63ec6d012f73e 100644 --- a/locale/es.po +++ b/locale/es.po @@ -2063,8 +2063,9 @@ msgid "Unhandled ESP TLS error %d %d %x %d" msgstr "Error no manejado de ESP TLS %d %d %x %d" #: shared-bindings/wifi/Radio.c -msgid "Unknown failure" -msgstr "Fallo desconocido" +#, c-format +msgid "Unknown failure %d" +msgstr "" #: ports/nrf/common-hal/_bleio/__init__.c #, c-format @@ -4046,6 +4047,9 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "Unknown failure" +#~ msgstr "Fallo desconocido" + #~ msgid "input argument must be an integer or a 2-tuple" #~ msgstr "el argumento de entrada debe ser un entero o una tupla de par" diff --git a/locale/fil.po b/locale/fil.po index 0798e507848ff..9b635da182e01 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -2034,7 +2034,8 @@ msgid "Unhandled ESP TLS error %d %d %x %d" msgstr "" #: shared-bindings/wifi/Radio.c -msgid "Unknown failure" +#, c-format +msgid "Unknown failure %d" msgstr "" #: ports/nrf/common-hal/_bleio/__init__.c diff --git a/locale/fr.po b/locale/fr.po index 07166b7d22f0f..0819852cf0867 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -2085,8 +2085,9 @@ msgid "Unhandled ESP TLS error %d %d %x %d" msgstr "Erreur ESP TLS non gérée %d %d %x %d" #: shared-bindings/wifi/Radio.c -msgid "Unknown failure" -msgstr "Echec inconnu" +#, c-format +msgid "Unknown failure %d" +msgstr "" #: ports/nrf/common-hal/_bleio/__init__.c #, c-format @@ -4082,6 +4083,9 @@ msgstr "zi doit être de type float" msgid "zi must be of shape (n_section, 2)" msgstr "zi doit être de forme (n_section, 2)" +#~ msgid "Unknown failure" +#~ msgstr "Echec inconnu" + #~ msgid "Only one alarm.touch alarm can be set." #~ msgstr "Seulement une alarme alarm.touch peut être réglée." diff --git a/locale/hi.po b/locale/hi.po index 84187032bf59f..4dfb35b366439 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -2013,7 +2013,8 @@ msgid "Unhandled ESP TLS error %d %d %x %d" msgstr "" #: shared-bindings/wifi/Radio.c -msgid "Unknown failure" +#, c-format +msgid "Unknown failure %d" msgstr "" #: ports/nrf/common-hal/_bleio/__init__.c diff --git a/locale/it_IT.po b/locale/it_IT.po index b285034d2184d..b65638c9d2139 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -2046,7 +2046,8 @@ msgid "Unhandled ESP TLS error %d %d %x %d" msgstr "" #: shared-bindings/wifi/Radio.c -msgid "Unknown failure" +#, c-format +msgid "Unknown failure %d" msgstr "" #: ports/nrf/common-hal/_bleio/__init__.c diff --git a/locale/ja.po b/locale/ja.po index 0b1aad9b911c9..ca13d8a9c5589 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -2036,7 +2036,8 @@ msgid "Unhandled ESP TLS error %d %d %x %d" msgstr "" #: shared-bindings/wifi/Radio.c -msgid "Unknown failure" +#, c-format +msgid "Unknown failure %d" msgstr "" #: ports/nrf/common-hal/_bleio/__init__.c diff --git a/locale/ko.po b/locale/ko.po index 27d13f22ed390..c645d12ae0289 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -2017,7 +2017,8 @@ msgid "Unhandled ESP TLS error %d %d %x %d" msgstr "" #: shared-bindings/wifi/Radio.c -msgid "Unknown failure" +#, c-format +msgid "Unknown failure %d" msgstr "" #: ports/nrf/common-hal/_bleio/__init__.c diff --git a/locale/nl.po b/locale/nl.po index d7bd6c3bf5b37..1435e8634924d 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -2055,8 +2055,9 @@ msgid "Unhandled ESP TLS error %d %d %x %d" msgstr "Niet behandelde ESP TLS fout %d %d %x %d" #: shared-bindings/wifi/Radio.c -msgid "Unknown failure" -msgstr "Onbekende fout" +#, c-format +msgid "Unknown failure %d" +msgstr "" #: ports/nrf/common-hal/_bleio/__init__.c #, c-format @@ -4033,6 +4034,9 @@ msgstr "zi moet van type float zijn" msgid "zi must be of shape (n_section, 2)" msgstr "zi moet vorm (n_section, 2) hebben" +#~ msgid "Unknown failure" +#~ msgstr "Onbekende fout" + #~ msgid "input argument must be an integer or a 2-tuple" #~ msgstr "invoerargument moet een integer of 2-tuple zijn" diff --git a/locale/pl.po b/locale/pl.po index 0d09ef8fd5ca0..c0a3040501a28 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -2027,7 +2027,8 @@ msgid "Unhandled ESP TLS error %d %d %x %d" msgstr "" #: shared-bindings/wifi/Radio.c -msgid "Unknown failure" +#, c-format +msgid "Unknown failure %d" msgstr "" #: ports/nrf/common-hal/_bleio/__init__.c diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 8037ae7d4d936..866a5649ca872 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -2078,8 +2078,9 @@ msgid "Unhandled ESP TLS error %d %d %x %d" msgstr "Erro não tratado do ESP TLS %d %d %x %d" #: shared-bindings/wifi/Radio.c -msgid "Unknown failure" -msgstr "Falha desconhecida" +#, c-format +msgid "Unknown failure %d" +msgstr "" #: ports/nrf/common-hal/_bleio/__init__.c #, c-format @@ -4068,6 +4069,9 @@ msgstr "zi deve ser de um tipo float" msgid "zi must be of shape (n_section, 2)" msgstr "zi deve estar na forma (n_section, 2)" +#~ msgid "Unknown failure" +#~ msgstr "Falha desconhecida" + #~ msgid "Only one alarm.touch alarm can be set." #~ msgstr "Apenas um alarme alarm.touch pode ser definido." diff --git a/locale/sv.po b/locale/sv.po index 3bfc325a04d23..1cc1c3c9f2b6b 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -2058,8 +2058,9 @@ msgid "Unhandled ESP TLS error %d %d %x %d" msgstr "Ej hanterat ESP TLS-fel %d-%d-%x-%d" #: shared-bindings/wifi/Radio.c -msgid "Unknown failure" -msgstr "Okänt fel" +#, c-format +msgid "Unknown failure %d" +msgstr "" #: ports/nrf/common-hal/_bleio/__init__.c #, c-format @@ -4033,6 +4034,9 @@ msgstr "zi måste vara av typ float" msgid "zi must be of shape (n_section, 2)" msgstr "zi måste vara i formen (n_section, 2)" +#~ msgid "Unknown failure" +#~ msgstr "Okänt fel" + #~ msgid "Only one alarm.touch alarm can be set." #~ msgstr "Endast ett larm av typ alarm.touch kan ställas in." diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index ec99c3f578ada..f073c73175106 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -2043,8 +2043,9 @@ msgid "Unhandled ESP TLS error %d %d %x %d" msgstr "Wèi chǔlǐ de ESP TLS cuòwù %d %d %x %d" #: shared-bindings/wifi/Radio.c -msgid "Unknown failure" -msgstr "Wèizhī gùzhàng" +#, c-format +msgid "Unknown failure %d" +msgstr "" #: ports/nrf/common-hal/_bleio/__init__.c #, c-format @@ -4016,6 +4017,9 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "Unknown failure" +#~ msgstr "Wèizhī gùzhàng" + #~ msgid "input argument must be an integer or a 2-tuple" #~ msgstr "shūrù cānshù bìxū shì zhěngshù huò 2 yuán zǔ" From ea0e2f80b7612d7d3119355a455667b3c4beb6d7 Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Mon, 4 Jan 2021 23:11:25 -0600 Subject: [PATCH 652/770] Changing to duck-typing --- .../adafruit_bus_device/I2CDevice.c | 81 +++++++++---------- .../adafruit_bus_device/I2CDevice.h | 4 +- shared-module/adafruit_bus_device/I2CDevice.c | 67 ++++++++++----- shared-module/adafruit_bus_device/I2CDevice.h | 2 +- 4 files changed, 89 insertions(+), 65 deletions(-) diff --git a/shared-bindings/adafruit_bus_device/I2CDevice.c b/shared-bindings/adafruit_bus_device/I2CDevice.c index a4c04e198c805..d3b6fbec4442c 100644 --- a/shared-bindings/adafruit_bus_device/I2CDevice.c +++ b/shared-bindings/adafruit_bus_device/I2CDevice.c @@ -31,6 +31,7 @@ #include "shared-bindings/adafruit_bus_device/I2CDevice.h" #include "shared-bindings/util.h" #include "shared-module/adafruit_bus_device/I2CDevice.h" +#include "shared-bindings/busio/I2C.h" #include "lib/utils/buffer_helper.h" #include "lib/utils/context_manager_helpers.h" @@ -76,7 +77,7 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_make_new(const mp_obj_type_t *type mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - busio_i2c_obj_t* i2c = args[ARG_i2c].u_obj; + mp_obj_t* i2c = args[ARG_i2c].u_obj; common_hal_adafruit_bus_device_i2cdevice_construct(MP_OBJ_TO_PTR(self), i2c, args[ARG_device_address].u_int); if (args[ARG_probe].u_bool == true) { @@ -107,7 +108,7 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_obj___exit__(size_t n_args, const } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(adafruit_bus_device_i2cdevice___exit___obj, 4, 4, adafruit_bus_device_i2cdevice_obj___exit__); -//| def readinto(self, buf: WriteableBuffer, *, start: int = 0, end: int = 0) -> None: +//| def readinto(self, buf: WriteableBuffer, *, start: int = 0, end: Optional[int] = None) -> None: //| """Read into ``buf`` from the device. The number of bytes read will be the //| length of ``buf``. //| If ``start`` or ``end`` is provided, then the buffer will be sliced @@ -118,22 +119,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(adafruit_bus_device_i2cdevice___exit_ //| :param int end: Index to write up to but not include; if None, use ``len(buf)``""" //| ... //| -STATIC void readinto(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, int32_t start, mp_int_t end) { - mp_buffer_info_t bufinfo; - mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_WRITE); - - size_t length = bufinfo.len; - normalize_buffer_bounds(&start, end, &length); - if (length == 0) { - mp_raise_ValueError(translate("Buffer must be at least length 1")); - } - - uint8_t status = common_hal_adafruit_bus_device_i2cdevice_readinto(MP_OBJ_TO_PTR(self), ((uint8_t*)bufinfo.buf) + start, length); - if (status != 0) { - mp_raise_OSError(status); - } -} - STATIC mp_obj_t adafruit_bus_device_i2cdevice_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buffer, ARG_start, ARG_end }; static const mp_arg_t allowed_args[] = { @@ -147,12 +132,21 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_readinto(size_t n_args, const mp_o mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - readinto(self, args[ARG_buffer].u_obj, args[ARG_start].u_int, args[ARG_end].u_int); + mp_obj_t dest[8]; + mp_load_method(self->i2c, MP_QSTR_readfrom_into, dest); + dest[2] = mp_obj_new_int_from_ull(self->device_address); + dest[3] = args[ARG_buffer].u_obj; + dest[4] = mp_obj_new_str("start", 5); + dest[5] = mp_obj_new_int(args[ARG_start].u_int); + dest[6] = mp_obj_new_str("end", 3); + dest[7] = mp_obj_new_int(args[ARG_end].u_int); + mp_call_method_n_kw(2, 2, dest); + return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(adafruit_bus_device_i2cdevice_readinto_obj, 2, adafruit_bus_device_i2cdevice_readinto); -//| def write(self, buf: ReadableBuffer, *, start: int = 0, end: int = 0) -> None: +//| def write(self, buf: ReadableBuffer, *, start: int = 0, end: Optional[int] = None) -> None: //| """Write the bytes from ``buffer`` to the device, then transmit a stop bit. //| If ``start`` or ``end`` is provided, then the buffer will be sliced //| as if ``buffer[start:end]``. This will not cause an allocation like @@ -163,22 +157,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(adafruit_bus_device_i2cdevice_readinto_obj, 2, //| """ //| ... //| -STATIC void write(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, int32_t start, mp_int_t end, bool transmit_stop_bit) { - mp_buffer_info_t bufinfo; - mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_READ); - - size_t length = bufinfo.len; - normalize_buffer_bounds(&start, end, &length); - if (length == 0) { - mp_raise_ValueError(translate("Buffer must be at least length 1")); - } - - uint8_t status = common_hal_adafruit_bus_device_i2cdevice_write(MP_OBJ_TO_PTR(self), ((uint8_t*)bufinfo.buf) + start, length, transmit_stop_bit); - if (status != 0) { - mp_raise_OSError(status); - } -} - STATIC mp_obj_t adafruit_bus_device_i2cdevice_write(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buffer, ARG_start, ARG_end }; static const mp_arg_t allowed_args[] = { @@ -191,13 +169,22 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_write(size_t n_args, const mp_obj_ mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - write(self, args[ARG_buffer].u_obj, args[ARG_start].u_int, args[ARG_end].u_int, true); + mp_obj_t dest[8]; + mp_load_method(self->i2c, MP_QSTR_writeto, dest); + dest[2] = mp_obj_new_int_from_ull(self->device_address); + dest[3] = args[ARG_buffer].u_obj; + dest[4] = mp_obj_new_str("start", 5); + dest[5] = mp_obj_new_int(args[ARG_start].u_int); + dest[6] = mp_obj_new_str("end", 3); + dest[7] = mp_obj_new_int(args[ARG_end].u_int); + mp_call_method_n_kw(2, 2, dest); + return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_KW(adafruit_bus_device_i2cdevice_write_obj, 2, adafruit_bus_device_i2cdevice_write); -//| def write_then_readinto(self, out_buffer: WriteableBuffer, in_buffer: ReadableBuffer, *, out_start: int = 0, out_end: int = 0, in_start: int = 0, in_end: int = 0) -> None: +//| def write_then_readinto(self, out_buffer: WriteableBuffer, in_buffer: ReadableBuffer, *, out_start: int = 0, out_end: Optional[int] = None, in_start: int = 0, in_end: Optional[int] = None) -> None: //| """Write the bytes from ``out_buffer`` to the device, then immediately //| reads into ``in_buffer`` from the device. The number of bytes read //| will be the length of ``in_buffer``. @@ -233,9 +220,21 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_write_then_readinto(size_t n_args, mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - write(self, args[ARG_out_buffer].u_obj, args[ARG_out_start].u_int, args[ARG_out_end].u_int, false); - - readinto(self, args[ARG_in_buffer].u_obj, args[ARG_in_start].u_int, args[ARG_in_end].u_int); + mp_obj_t dest[13]; + mp_load_method(self->i2c, MP_QSTR_writeto_then_readfrom, dest); + dest[2] = mp_obj_new_int_from_ull(self->device_address); + dest[3] = args[ARG_out_buffer].u_obj; + dest[4] = args[ARG_in_buffer].u_obj; + dest[5] = mp_obj_new_str("out_start", 9); + dest[6] = mp_obj_new_int(args[ARG_out_start].u_int); + dest[7] = mp_obj_new_str("out_end", 7); + dest[8] = mp_obj_new_int(args[ARG_out_end].u_int); + dest[9] = mp_obj_new_str("in_start", 8); + dest[10] = mp_obj_new_int(args[ARG_in_start].u_int); + dest[11] = mp_obj_new_str("in_end", 6); + dest[12] = mp_obj_new_int(args[ARG_in_end].u_int); + + mp_call_method_n_kw(3, 4, dest); return mp_const_none; } diff --git a/shared-bindings/adafruit_bus_device/I2CDevice.h b/shared-bindings/adafruit_bus_device/I2CDevice.h index cf7b1321a080e..82ef1feb80f3c 100644 --- a/shared-bindings/adafruit_bus_device/I2CDevice.h +++ b/shared-bindings/adafruit_bus_device/I2CDevice.h @@ -43,9 +43,7 @@ extern const mp_obj_type_t adafruit_bus_device_i2cdevice_type; // Initializes the hardware peripheral. -extern void common_hal_adafruit_bus_device_i2cdevice_construct(adafruit_bus_device_i2cdevice_obj_t *self, busio_i2c_obj_t *i2c, uint8_t device_address); -extern uint8_t common_hal_adafruit_bus_device_i2cdevice_readinto(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length); -extern uint8_t common_hal_adafruit_bus_device_i2cdevice_write(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length, bool transmit_stop_bit); +extern void common_hal_adafruit_bus_device_i2cdevice_construct(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t *i2c, uint8_t device_address); extern void common_hal_adafruit_bus_device_i2cdevice_lock(adafruit_bus_device_i2cdevice_obj_t *self); extern void common_hal_adafruit_bus_device_i2cdevice_unlock(adafruit_bus_device_i2cdevice_obj_t *self); extern void common_hal_adafruit_bus_device_i2cdevice_probe_for_device(adafruit_bus_device_i2cdevice_obj_t *self); diff --git a/shared-module/adafruit_bus_device/I2CDevice.c b/shared-module/adafruit_bus_device/I2CDevice.c index 83abe80d649c0..53811d4910c50 100644 --- a/shared-module/adafruit_bus_device/I2CDevice.c +++ b/shared-module/adafruit_bus_device/I2CDevice.c @@ -31,48 +31,75 @@ #include "py/runtime.h" #include "lib/utils/interrupt_char.h" -void common_hal_adafruit_bus_device_i2cdevice_construct(adafruit_bus_device_i2cdevice_obj_t *self, busio_i2c_obj_t *i2c, uint8_t device_address) { +void common_hal_adafruit_bus_device_i2cdevice_construct(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t *i2c, uint8_t device_address) { self->i2c = i2c; self->device_address = device_address; } void common_hal_adafruit_bus_device_i2cdevice_lock(adafruit_bus_device_i2cdevice_obj_t *self) { - bool success = common_hal_busio_i2c_try_lock(self->i2c); + mp_obj_t dest[2]; + mp_load_method(self->i2c, MP_QSTR_try_lock, dest); - while (!success) { + mp_obj_t success = mp_call_method_n_kw(0, 0, dest); + + while (!mp_obj_is_true(success)) { RUN_BACKGROUND_TASKS; if (mp_hal_is_interrupted()) { break; } - success = common_hal_busio_i2c_try_lock(self->i2c); + success = mp_call_method_n_kw(0, 0, dest); } } void common_hal_adafruit_bus_device_i2cdevice_unlock(adafruit_bus_device_i2cdevice_obj_t *self) { - common_hal_busio_i2c_unlock(self->i2c); -} - -uint8_t common_hal_adafruit_bus_device_i2cdevice_readinto(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length) { - return common_hal_busio_i2c_read(self->i2c, self->device_address, buffer, length); -} - -uint8_t common_hal_adafruit_bus_device_i2cdevice_write(adafruit_bus_device_i2cdevice_obj_t *self, mp_obj_t buffer, size_t length, bool transmit_stop_bit) { - return common_hal_busio_i2c_write(self->i2c, self->device_address, buffer, length, transmit_stop_bit); + mp_obj_t dest[2]; + mp_load_method(self->i2c, MP_QSTR_unlock, dest); + mp_call_method_n_kw(0, 0, dest); } void common_hal_adafruit_bus_device_i2cdevice_probe_for_device(adafruit_bus_device_i2cdevice_obj_t *self) { common_hal_adafruit_bus_device_i2cdevice_lock(self); - mp_buffer_info_t bufinfo; - mp_obj_t buffer = mp_obj_new_bytearray_of_zeros(1); + mp_buffer_info_t write_bufinfo; + mp_obj_t write_buffer = mp_obj_new_bytearray_of_zeros(0); + mp_get_buffer_raise(write_buffer, &write_bufinfo, MP_BUFFER_READ); + + mp_obj_t dest[4]; - mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_WRITE); + /* catch exceptions that may be thrown while probing for the device */ + nlr_buf_t write_nlr; + if (nlr_push(&write_nlr) == 0) { + mp_load_method(self->i2c, MP_QSTR_writeto, dest); + dest[2] = mp_obj_new_int_from_ull(self->device_address); + dest[3] = write_buffer; + mp_call_method_n_kw(2, 0, dest); + nlr_pop(); + } else { + /* some OS's don't like writing an empty bytestring... retry by reading a byte */ + mp_buffer_info_t read_bufinfo; + mp_obj_t read_buffer = mp_obj_new_bytearray_of_zeros(1); + mp_get_buffer_raise(read_buffer, &read_bufinfo, MP_BUFFER_WRITE); - uint8_t status = common_hal_adafruit_bus_device_i2cdevice_readinto(self, (uint8_t*)bufinfo.buf, 1); - if (status != 0) { - common_hal_adafruit_bus_device_i2cdevice_unlock(self); - mp_raise_ValueError_varg(translate("No I2C device at address: %x"), self->device_address); + mp_load_method(self->i2c, MP_QSTR_readfrom_into, dest); + dest[2] = mp_obj_new_int_from_ull(self->device_address); + dest[3] = read_buffer; + + nlr_buf_t read_nlr; + if (nlr_push(&read_nlr) == 0) { + mp_call_method_n_kw(2, 0, dest); + nlr_pop(); + } else { + /* At this point we tried two methods and only got exceptions */ + if (mp_obj_is_subclass_fast(MP_OBJ_FROM_PTR(((mp_obj_base_t*)read_nlr.ret_val)->type), MP_OBJ_FROM_PTR(&mp_type_OSError))) { + common_hal_adafruit_bus_device_i2cdevice_unlock(self); + mp_raise_ValueError_varg(translate("No I2C device at address: %x"), self->device_address); + } + else { + /* In case we receive an unrelated exception pass it up */ + nlr_raise(MP_OBJ_FROM_PTR(read_nlr.ret_val)); + } + } } common_hal_adafruit_bus_device_i2cdevice_unlock(self); diff --git a/shared-module/adafruit_bus_device/I2CDevice.h b/shared-module/adafruit_bus_device/I2CDevice.h index d06adb9f5067f..b76bafb2c11bb 100644 --- a/shared-module/adafruit_bus_device/I2CDevice.h +++ b/shared-module/adafruit_bus_device/I2CDevice.h @@ -32,7 +32,7 @@ typedef struct { mp_obj_base_t base; - busio_i2c_obj_t *i2c; + mp_obj_t *i2c; uint8_t device_address; } adafruit_bus_device_i2cdevice_obj_t; From b609bc012434e1a8753196b2d020a3d05faf7948 Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Tue, 5 Jan 2021 16:29:37 -0600 Subject: [PATCH 653/770] Removed unused include --- shared-bindings/adafruit_bus_device/I2CDevice.c | 1 - 1 file changed, 1 deletion(-) diff --git a/shared-bindings/adafruit_bus_device/I2CDevice.c b/shared-bindings/adafruit_bus_device/I2CDevice.c index d3b6fbec4442c..f76cfb0e11812 100644 --- a/shared-bindings/adafruit_bus_device/I2CDevice.c +++ b/shared-bindings/adafruit_bus_device/I2CDevice.c @@ -31,7 +31,6 @@ #include "shared-bindings/adafruit_bus_device/I2CDevice.h" #include "shared-bindings/util.h" #include "shared-module/adafruit_bus_device/I2CDevice.h" -#include "shared-bindings/busio/I2C.h" #include "lib/utils/buffer_helper.h" #include "lib/utils/context_manager_helpers.h" From d3995eaf9748f641355a92c2929f3330a027b586 Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Sat, 9 Jan 2021 10:07:08 -0600 Subject: [PATCH 654/770] Fixes from draft PR --- .../adafruit_bus_device/I2CDevice.c | 17 +++++----- shared-module/adafruit_bus_device/I2CDevice.c | 33 +++++-------------- 2 files changed, 18 insertions(+), 32 deletions(-) diff --git a/shared-bindings/adafruit_bus_device/I2CDevice.c b/shared-bindings/adafruit_bus_device/I2CDevice.c index f76cfb0e11812..15e8cc706390f 100644 --- a/shared-bindings/adafruit_bus_device/I2CDevice.c +++ b/shared-bindings/adafruit_bus_device/I2CDevice.c @@ -135,9 +135,10 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_readinto(size_t n_args, const mp_o mp_load_method(self->i2c, MP_QSTR_readfrom_into, dest); dest[2] = mp_obj_new_int_from_ull(self->device_address); dest[3] = args[ARG_buffer].u_obj; - dest[4] = mp_obj_new_str("start", 5); + //dest[4] = mp_obj_new_str("start", 5); + dest[4] = MP_OBJ_NEW_QSTR(MP_QSTR_start); dest[5] = mp_obj_new_int(args[ARG_start].u_int); - dest[6] = mp_obj_new_str("end", 3); + dest[6] = MP_OBJ_NEW_QSTR(MP_QSTR_end); dest[7] = mp_obj_new_int(args[ARG_end].u_int); mp_call_method_n_kw(2, 2, dest); @@ -172,9 +173,9 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_write(size_t n_args, const mp_obj_ mp_load_method(self->i2c, MP_QSTR_writeto, dest); dest[2] = mp_obj_new_int_from_ull(self->device_address); dest[3] = args[ARG_buffer].u_obj; - dest[4] = mp_obj_new_str("start", 5); + dest[4] = MP_OBJ_NEW_QSTR(MP_QSTR_start); dest[5] = mp_obj_new_int(args[ARG_start].u_int); - dest[6] = mp_obj_new_str("end", 3); + dest[6] = MP_OBJ_NEW_QSTR(MP_QSTR_end); dest[7] = mp_obj_new_int(args[ARG_end].u_int); mp_call_method_n_kw(2, 2, dest); @@ -224,13 +225,13 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_write_then_readinto(size_t n_args, dest[2] = mp_obj_new_int_from_ull(self->device_address); dest[3] = args[ARG_out_buffer].u_obj; dest[4] = args[ARG_in_buffer].u_obj; - dest[5] = mp_obj_new_str("out_start", 9); + dest[5] = MP_OBJ_NEW_QSTR(MP_QSTR_out_start); dest[6] = mp_obj_new_int(args[ARG_out_start].u_int); - dest[7] = mp_obj_new_str("out_end", 7); + dest[7] = MP_OBJ_NEW_QSTR(MP_QSTR_out_end); dest[8] = mp_obj_new_int(args[ARG_out_end].u_int); - dest[9] = mp_obj_new_str("in_start", 8); + dest[9] = MP_OBJ_NEW_QSTR(MP_QSTR_in_start); dest[10] = mp_obj_new_int(args[ARG_in_start].u_int); - dest[11] = mp_obj_new_str("in_end", 6); + dest[11] = MP_OBJ_NEW_QSTR(MP_QSTR_in_end); dest[12] = mp_obj_new_int(args[ARG_in_end].u_int); mp_call_method_n_kw(3, 4, dest); diff --git a/shared-module/adafruit_bus_device/I2CDevice.c b/shared-module/adafruit_bus_device/I2CDevice.c index 53811d4910c50..792ab7183c831 100644 --- a/shared-module/adafruit_bus_device/I2CDevice.c +++ b/shared-module/adafruit_bus_device/I2CDevice.c @@ -68,37 +68,22 @@ void common_hal_adafruit_bus_device_i2cdevice_probe_for_device(adafruit_bus_devi mp_obj_t dest[4]; /* catch exceptions that may be thrown while probing for the device */ - nlr_buf_t write_nlr; - if (nlr_push(&write_nlr) == 0) { + nlr_buf_t nlr; + if (nlr_push(&nlr) == 0) { mp_load_method(self->i2c, MP_QSTR_writeto, dest); dest[2] = mp_obj_new_int_from_ull(self->device_address); dest[3] = write_buffer; mp_call_method_n_kw(2, 0, dest); nlr_pop(); } else { - /* some OS's don't like writing an empty bytestring... retry by reading a byte */ - mp_buffer_info_t read_bufinfo; - mp_obj_t read_buffer = mp_obj_new_bytearray_of_zeros(1); - mp_get_buffer_raise(read_buffer, &read_bufinfo, MP_BUFFER_WRITE); + common_hal_adafruit_bus_device_i2cdevice_unlock(self); - mp_load_method(self->i2c, MP_QSTR_readfrom_into, dest); - dest[2] = mp_obj_new_int_from_ull(self->device_address); - dest[3] = read_buffer; - - nlr_buf_t read_nlr; - if (nlr_push(&read_nlr) == 0) { - mp_call_method_n_kw(2, 0, dest); - nlr_pop(); - } else { - /* At this point we tried two methods and only got exceptions */ - if (mp_obj_is_subclass_fast(MP_OBJ_FROM_PTR(((mp_obj_base_t*)read_nlr.ret_val)->type), MP_OBJ_FROM_PTR(&mp_type_OSError))) { - common_hal_adafruit_bus_device_i2cdevice_unlock(self); - mp_raise_ValueError_varg(translate("No I2C device at address: %x"), self->device_address); - } - else { - /* In case we receive an unrelated exception pass it up */ - nlr_raise(MP_OBJ_FROM_PTR(read_nlr.ret_val)); - } + if (mp_obj_is_subclass_fast(MP_OBJ_FROM_PTR(((mp_obj_base_t*)nlr.ret_val)->type), MP_OBJ_FROM_PTR(&mp_type_OSError))) { + mp_raise_ValueError_varg(translate("No I2C device at address: %x"), self->device_address); + } + else { + /* In case we receive an unrelated exception pass it up */ + nlr_raise(MP_OBJ_FROM_PTR(nlr.ret_val)); } } From f50c9f4145bbf6409f909a7d0cb83786db905bf8 Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Sat, 16 Jan 2021 14:18:46 -0600 Subject: [PATCH 655/770] Reenabling busdevice in core --- py/circuitpy_mpconfig.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index d0145a90f33a5..5df48debeba6b 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -100,7 +100,7 @@ CFLAGS += -DCIRCUITPY_BLEIO=$(CIRCUITPY_BLEIO) CIRCUITPY_BOARD ?= 1 CFLAGS += -DCIRCUITPY_BOARD=$(CIRCUITPY_BOARD) -CIRCUITPY_BUSDEVICE = 0 +CIRCUITPY_BUSDEVICE ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_BUSDEVICE=$(CIRCUITPY_BUSDEVICE) CIRCUITPY_BUILTINS_POW3 ?= $(CIRCUITPY_FULL_BUILD) From 49e059cdaf8cedccf175cf00d8286788c2077ac1 Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Sat, 16 Jan 2021 16:37:42 -0600 Subject: [PATCH 656/770] Removing frozen libraries --- ports/atmel-samd/boards/8086_commander/mpconfigboard.mk | 1 - .../atmel-samd/boards/circuitplayground_express/mpconfigboard.mk | 1 - .../boards/circuitplayground_express_crickit/mpconfigboard.mk | 1 - .../boards/circuitplayground_express_displayio/mpconfigboard.mk | 1 - .../boards/feather_m0_express_crickit/mpconfigboard.mk | 1 - ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk | 1 - ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk | 1 - ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk | 1 - ports/atmel-samd/boards/pycubed/mpconfigboard.mk | 1 - ports/atmel-samd/boards/pycubed_mram/mpconfigboard.mk | 1 - ports/atmel-samd/boards/sam32/mpconfigboard.mk | 1 - ports/atmel-samd/boards/xinabox_cc03/mpconfigboard.mk | 1 - ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk | 1 - 13 files changed, 13 deletions(-) diff --git a/ports/atmel-samd/boards/8086_commander/mpconfigboard.mk b/ports/atmel-samd/boards/8086_commander/mpconfigboard.mk index b5a4bc735f958..f976dfe787cb8 100644 --- a/ports/atmel-samd/boards/8086_commander/mpconfigboard.mk +++ b/ports/atmel-samd/boards/8086_commander/mpconfigboard.mk @@ -22,7 +22,6 @@ CIRCUITPY_GAMEPAD = 1 CIRCUITPY_BUSDEVICE = 1 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD #FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_ADXL34x diff --git a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk index 505f5c145db1c..0b150a5fbea41 100644 --- a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk @@ -22,7 +22,6 @@ SUPEROPT_GC = 0 CFLAGS_INLINE_LIMIT = 55 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH diff --git a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk index c3be33134cd96..35b6f12293cf5 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk @@ -26,7 +26,6 @@ CFLAGS_INLINE_LIMIT = 50 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Crickit FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH diff --git a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk index 51e9b05af207a..f754f3513ce3e 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk @@ -27,7 +27,6 @@ SUPEROPT_GC = 0 CFLAGS_INLINE_LIMIT = 55 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk index f06163b84af14..309563ff4998c 100644 --- a/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk @@ -21,7 +21,6 @@ CFLAGS_INLINE_LIMIT = 50 CIRCUITPY_MSGPACK = 0 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Crickit FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Motor FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk index 6e089bb90d636..6ea21ed82e824 100644 --- a/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk @@ -28,5 +28,4 @@ CFLAGS_INLINE_LIMIT = 35 SUPEROPT_GC = 0 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_RFM69 diff --git a/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk index 383b6a6df448e..76a6be2e34e28 100644 --- a/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk @@ -29,5 +29,4 @@ CFLAGS_INLINE_LIMIT = 35 SUPEROPT_GC = 0 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_RFM9x diff --git a/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk index 1931ceb9a87a7..2b211abd4e06d 100644 --- a/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk @@ -27,7 +27,6 @@ CFLAGS_INLINE_LIMIT = 55 SUPEROPT_GC = 0 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/atmel-samd/boards/pycubed/mpconfigboard.mk b/ports/atmel-samd/boards/pycubed/mpconfigboard.mk index b7b8073ab9f42..a82362b8d2c3d 100644 --- a/ports/atmel-samd/boards/pycubed/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pycubed/mpconfigboard.mk @@ -21,7 +21,6 @@ CIRCUITPY_GAMEPAD = 0 CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_PS2IO = 0 -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD diff --git a/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.mk b/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.mk index f49bb3fef039b..3bf42d70543b6 100644 --- a/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.mk @@ -21,7 +21,6 @@ CIRCUITPY_GAMEPAD = 0 CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_PS2IO = 0 -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD diff --git a/ports/atmel-samd/boards/sam32/mpconfigboard.mk b/ports/atmel-samd/boards/sam32/mpconfigboard.mk index 1dc686ef8aa69..9ac24a014c60e 100644 --- a/ports/atmel-samd/boards/sam32/mpconfigboard.mk +++ b/ports/atmel-samd/boards/sam32/mpconfigboard.mk @@ -13,5 +13,4 @@ LONGINT_IMPL = MPZ CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_USTACK = 1 -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/atmel-samd/boards/xinabox_cc03/mpconfigboard.mk b/ports/atmel-samd/boards/xinabox_cc03/mpconfigboard.mk index 3562228c71e6e..d6f333b5be6e7 100644 --- a/ports/atmel-samd/boards/xinabox_cc03/mpconfigboard.mk +++ b/ports/atmel-samd/boards/xinabox_cc03/mpconfigboard.mk @@ -24,4 +24,3 @@ CIRCUITPY_TOUCHIO=0 CIRCUITPY_BUSDEVICE=1 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice diff --git a/ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk b/ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk index 53908293f5d1a..fd2fa044a8d1a 100644 --- a/ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk +++ b/ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk @@ -27,5 +27,4 @@ CIRCUITPY_COUNTIO=0 CIRCUITPY_BUSDEVICE=1 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD From d43eb7e84be48d539ab0f61d866fd012399d1696 Mon Sep 17 00:00:00 2001 From: dheera Date: Sat, 16 Jan 2021 17:38:08 -0800 Subject: [PATCH 657/770] prevents going into safe mode for watchdog resets --- ports/esp32s2/supervisor/port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 6491e7430c4c4..21a8868b5fa54 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -143,9 +143,9 @@ safe_mode_t port_init(void) { case ESP_RST_BROWNOUT: return BROWNOUT; case ESP_RST_PANIC: + return HARD_CRASH; case ESP_RST_INT_WDT: case ESP_RST_WDT: - return HARD_CRASH; default: break; } From 41b9196167576c9a593d51e601edd51cba5b72c4 Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Sun, 17 Jan 2021 00:00:06 -0600 Subject: [PATCH 658/770] Disabling in more small boards --- ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.mk | 1 + ports/atmel-samd/boards/serpente/mpconfigboard.mk | 1 + ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk | 1 + ports/atmel-samd/boards/ugame10/mpconfigboard.mk | 1 + ports/nrf/boards/pca10100/mpconfigboard.mk | 1 + ports/stm/boards/espruino_pico/mpconfigboard.mk | 1 + 6 files changed, 6 insertions(+) diff --git a/ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.mk b/ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.mk index 178258b6cd534..2ace30fb53457 100755 --- a/ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.mk @@ -16,6 +16,7 @@ CIRCUITPY_COUNTIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_VECTORIO = 0 +CIRCUITPY_BUSDEVICE = 0 MICROPY_PY_ASYNC_AWAIT = 0 SUPEROPT_GC = 0 diff --git a/ports/atmel-samd/boards/serpente/mpconfigboard.mk b/ports/atmel-samd/boards/serpente/mpconfigboard.mk index 6e953adf72345..09036875f16cc 100644 --- a/ports/atmel-samd/boards/serpente/mpconfigboard.mk +++ b/ports/atmel-samd/boards/serpente/mpconfigboard.mk @@ -14,6 +14,7 @@ LONGINT_IMPL = NONE CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_GAMEPAD = 0 +CIRCUITPY_BUSDEVICE = 0 SUPEROPT_GC = 0 diff --git a/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk b/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk index e71bb07395de7..2e15bc042ac3c 100755 --- a/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk +++ b/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk @@ -14,6 +14,7 @@ LONGINT_IMPL = MPZ CIRCUITPY_AUDIOIO = 0 CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_VECTORIO = 0 +CIRCUITPY_BUSDEVICE = 0 FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar diff --git a/ports/atmel-samd/boards/ugame10/mpconfigboard.mk b/ports/atmel-samd/boards/ugame10/mpconfigboard.mk index b1242d206eced..640d421e8150e 100644 --- a/ports/atmel-samd/boards/ugame10/mpconfigboard.mk +++ b/ports/atmel-samd/boards/ugame10/mpconfigboard.mk @@ -28,6 +28,7 @@ CIRCUITPY_RTC = 0 CIRCUITPY_TOUCHIO = 0 CIRCUITPY_USB_HID = 0 CIRCUITPY_USB_MIDI = 0 +CIRCUITPY_BUSDEVICE = 0 FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/ugame10 diff --git a/ports/nrf/boards/pca10100/mpconfigboard.mk b/ports/nrf/boards/pca10100/mpconfigboard.mk index 76d15e6081ca3..c8cba2877cf5a 100644 --- a/ports/nrf/boards/pca10100/mpconfigboard.mk +++ b/ports/nrf/boards/pca10100/mpconfigboard.mk @@ -25,6 +25,7 @@ CIRCUITPY_RTC = 1 CIRCUITPY_SDCARDIO = 0 CIRCUITPY_TOUCHIO = 0 CIRCUITPY_ULAB = 0 +CIRCUITPY_BUSDEVICE = 0 MICROPY_PY_ASYNC_AWAIT = 0 SUPEROPT_GC = 0 diff --git a/ports/stm/boards/espruino_pico/mpconfigboard.mk b/ports/stm/boards/espruino_pico/mpconfigboard.mk index 14f9323fde49d..81c3772e72103 100644 --- a/ports/stm/boards/espruino_pico/mpconfigboard.mk +++ b/ports/stm/boards/espruino_pico/mpconfigboard.mk @@ -20,5 +20,6 @@ LD_FILE = boards/STM32F401xd_fs.ld # lto for this port, and if other stuff hasn't been added in the # meantime CIRCUITPY_ULAB = 0 +CIRCUITPY_BUSDEVICE = 0 SUPEROPT_GC = 0 From a9389343a85fa701d2c9068de525d9a67a484a92 Mon Sep 17 00:00:00 2001 From: jerryneedell Date: Sun, 17 Jan 2021 05:15:19 -0500 Subject: [PATCH 659/770] Revert "UMFEATHERS2 - implement use of DotStar for status led" --- .../boards/unexpectedmaker_feathers2/board.c | 8 ---- .../unexpectedmaker_feathers2/mpconfigboard.h | 4 +- .../esp32s2/common-hal/microcontroller/Pin.c | 45 ++----------------- .../esp32s2/common-hal/microcontroller/Pin.h | 4 +- 4 files changed, 7 insertions(+), 54 deletions(-) diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c b/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c index ac08190a5bc48..d8fd3a0a2b7bb 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c @@ -27,8 +27,6 @@ #include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -#include "components/driver/include/driver/gpio.h" -#include "components/soc/include/hal/gpio_hal.h" void board_init(void) { // USB @@ -49,12 +47,6 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO30); common_hal_never_reset_pin(&pin_GPIO31); common_hal_never_reset_pin(&pin_GPIO32); - - - // Add LDO2 to never reset list, set to output and enable - common_hal_never_reset_pin(&pin_GPIO21); - gpio_set_direction(pin_GPIO21.number, GPIO_MODE_DEF_OUTPUT); - gpio_set_level(pin_GPIO21.number, true); } bool board_requests_safe_mode(void) { diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h index 6b1a0c4aa527b..e100ac118efda 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h @@ -34,8 +34,8 @@ #define AUTORESET_DELAY_MS 500 -#define MICROPY_HW_APA102_MOSI (&pin_GPIO40) -#define MICROPY_HW_APA102_SCK (&pin_GPIO45) +// #define MICROPY_HW_APA102_MOSI (&pin_GPIO40) +// #define MICROPY_HW_APA102_SCK (&pin_GPIO45) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index 6889720e84171..fca89ce8ec000 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -37,14 +37,13 @@ #ifdef MICROPY_HW_NEOPIXEL bool neopixel_in_use; #endif -#ifdef MICROPY_HW_APA102_MOSI -bool apa102_sck_in_use; -bool apa102_mosi_in_use; -#endif STATIC uint32_t never_reset_pins[2]; STATIC uint32_t in_use[2]; +bool apa102_mosi_in_use; +bool apa102_sck_in_use; + STATIC void floating_gpio_reset(gpio_num_t pin_number) { // This is the same as gpio_reset_pin(), but without the pullup. // Note that gpio_config resets the iomatrix to GPIO_FUNC as well. @@ -87,20 +86,6 @@ void reset_pin_number(gpio_num_t pin_number) { return; } #endif - #ifdef MICROPY_HW_APA102_MOSI - if (pin_number == MICROPY_HW_APA102_MOSI->number || - pin_number == MICROPY_HW_APA102_SCK->number) { - apa102_mosi_in_use = apa102_mosi_in_use && pin_number != MICROPY_HW_APA102_MOSI->number; - apa102_sck_in_use = apa102_sck_in_use && pin_number != MICROPY_HW_APA102_SCK->number; - if (!apa102_sck_in_use && !apa102_mosi_in_use) { - rgb_led_status_init(); - } - return; - } - #endif - - - } void common_hal_reset_pin(const mcu_pin_obj_t* pin) { @@ -125,11 +110,6 @@ void reset_all_pins(void) { #ifdef MICROPY_HW_NEOPIXEL neopixel_in_use = false; #endif - #ifdef MICROPY_HW_APA102_MOSI - apa102_sck_in_use = false; - apa102_mosi_in_use = false; - #endif - } void claim_pin(const mcu_pin_obj_t* pin) { @@ -139,15 +119,6 @@ void claim_pin(const mcu_pin_obj_t* pin) { neopixel_in_use = true; } #endif - #ifdef MICROPY_HW_APA102_MOSI - if (pin == MICROPY_HW_APA102_MOSI) { - apa102_mosi_in_use = true; - } - if (pin == MICROPY_HW_APA102_SCK) { - apa102_sck_in_use = true; - } - #endif - } void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin) { @@ -160,18 +131,10 @@ bool pin_number_is_free(gpio_num_t pin_number) { return !neopixel_in_use; } #endif - #ifdef MICROPY_HW_APA102_MOSI - if (pin_number == MICROPY_HW_APA102_MOSI->number) { - return !apa102_mosi_in_use; - } - if (pin_number == MICROPY_HW_APA102_SCK->number) { - return !apa102_sck_in_use; - } - #endif uint8_t offset = pin_number / 32; uint32_t mask = 1 << (pin_number % 32); - return (in_use[offset] & mask) == 0; + return (never_reset_pins[offset] & mask) == 0 && (in_use[offset] & mask) == 0; } bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) { diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.h b/ports/esp32s2/common-hal/microcontroller/Pin.h index 65f57a82d40cf..f6c0087031c63 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.h +++ b/ports/esp32s2/common-hal/microcontroller/Pin.h @@ -31,10 +31,8 @@ #include "peripherals/pins.h" -#ifdef MICROPY_HW_APA102_MOSI -extern bool apa102_sck_in_use; extern bool apa102_mosi_in_use; -#endif +extern bool apa102_sck_in_use; #ifdef MICROPY_HW_NEOPIXEL extern bool neopixel_in_use; From 377cb517cf677a61ba7d598387a3e6d5c3d27292 Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Sat, 16 Jan 2021 20:17:01 +0000 Subject: [PATCH 660/770] Translated using Weblate (French) Currently translated at 100.0% (916 of 916 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index 0819852cf0867..eccfcc1a0eff2 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,14 +8,14 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-01-13 16:07+0000\n" +"PO-Revision-Date: 2021-01-17 12:55+0000\n" "Last-Translator: Hugo Dahl \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.4.1-dev\n" +"X-Generator: Weblate 4.5-dev\n" #: main.c msgid "" @@ -646,7 +646,7 @@ msgstr "" #: shared-bindings/digitalio/DigitalInOut.c msgid "Cannot set value when direction is input." msgstr "" -"Impossible d'affecter une valeur quand la direction est entrentre ('input')." +"Impossible d'affecter une valeur quand la direction est entrante ('input')." #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c @@ -2087,7 +2087,7 @@ msgstr "Erreur ESP TLS non gérée %d %d %x %d" #: shared-bindings/wifi/Radio.c #, c-format msgid "Unknown failure %d" -msgstr "" +msgstr "Échec inconnu %d" #: ports/nrf/common-hal/_bleio/__init__.c #, c-format @@ -2366,7 +2366,7 @@ msgstr "branche hors-bornes" #: extmod/ulab/code/ulab_create.c msgid "buffer is smaller than requested size" -msgstr "" +msgstr "tampon est plus petit que la taille demandée" #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" @@ -2374,7 +2374,7 @@ msgstr "le tampon doit être un objet bytes-like" #: extmod/ulab/code/ulab_create.c msgid "buffer size must be a multiple of element size" -msgstr "" +msgstr "taille du tampon doit être un multiple de la taille de l'élement" #: shared-module/struct/__init__.c msgid "buffer size must match format" @@ -3457,7 +3457,7 @@ msgstr "offset doit être >= 0" #: extmod/ulab/code/ulab_create.c msgid "offset must be non-negative and no greater than buffer length" -msgstr "" +msgstr "offset doit être non-négatif, et au plus la taille du tampon" #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" From 4b23a7872b28025b757076bf4320bdb6ff076510 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Fri, 15 Jan 2021 21:38:52 +0000 Subject: [PATCH 661/770] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (916 of 916 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 866a5649ca872..d3f57a58ab1ce 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-01-13 02:19+0000\n" +"PO-Revision-Date: 2021-01-17 12:55+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.4.1-dev\n" +"X-Generator: Weblate 4.5-dev\n" #: main.c msgid "" @@ -2080,7 +2080,7 @@ msgstr "Erro não tratado do ESP TLS %d %d %x %d" #: shared-bindings/wifi/Radio.c #, c-format msgid "Unknown failure %d" -msgstr "" +msgstr "Falha desconhecida %d" #: ports/nrf/common-hal/_bleio/__init__.c #, c-format @@ -2358,7 +2358,7 @@ msgstr "ramo fora do alcance" #: extmod/ulab/code/ulab_create.c msgid "buffer is smaller than requested size" -msgstr "" +msgstr "o tamanho do buffer é menor do que o tamanho que foi solicitado" #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" @@ -2366,7 +2366,7 @@ msgstr "o buffer deve ser um objeto como bytes" #: extmod/ulab/code/ulab_create.c msgid "buffer size must be a multiple of element size" -msgstr "" +msgstr "o tamanho do buffer deve ser um múltiplo do tamanho do elemento" #: shared-module/struct/__init__.c msgid "buffer size must match format" @@ -3442,7 +3442,7 @@ msgstr "o offset deve ser >= 0" #: extmod/ulab/code/ulab_create.c msgid "offset must be non-negative and no greater than buffer length" -msgstr "" +msgstr "o offset deve ser positivo e não maior do que o comprimento do buffer" #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" From a2a32907eb57f7fb3d33deda93fa8422a346c753 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Fri, 15 Jan 2021 22:03:34 +0000 Subject: [PATCH 662/770] Translated using Weblate (Swedish) Currently translated at 100.0% (916 of 916 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 56 ++++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 1cc1c3c9f2b6b..6c58ff01e732d 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-01-05 21:03+0000\n" +"PO-Revision-Date: 2021-01-17 12:55+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.4.1-dev\n" +"X-Generator: Weblate 4.5-dev\n" #: main.c msgid "" @@ -123,7 +123,7 @@ msgstr "%q() kräver %d positionsargument men %d gavs" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #, c-format msgid "%s error 0x%x" -msgstr "" +msgstr "%s fel 0x%x" #: py/argcheck.c msgid "'%q' argument required" @@ -289,7 +289,7 @@ msgstr "3-arguments pow() stöds inte" #: shared-module/msgpack/__init__.c msgid "64 bit types" -msgstr "" +msgstr "64-bitars typer" #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c @@ -555,7 +555,7 @@ msgstr "CBC-block måste vara multiplar om 16 byte" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "CRC or checksum was invalid" -msgstr "" +msgstr "CRC eller checksumma var ogiltig" #: py/objtype.c msgid "Call super().__init__() before accessing native object." @@ -1014,7 +1014,7 @@ msgstr "Funktion kräver lås" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Generic Failure" -msgstr "" +msgstr "Generiskt fel" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c @@ -1256,11 +1256,11 @@ msgstr "Ogiltigt säkerhetsläge" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid size" -msgstr "" +msgstr "Ogiltig storlek" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" -msgstr "" +msgstr "Ogiltigt tillstånd" #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" @@ -1304,7 +1304,7 @@ msgstr "Length måste vara positiv" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "MAC address was invalid" -msgstr "" +msgstr "MAC-adressen var ogiltig" #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." @@ -1540,7 +1540,7 @@ msgstr "" #: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c msgid "Only one TouchAlarm can be set in deep sleep." -msgstr "" +msgstr "Endast ett TouchAlarm kan ställas in för djupsömn." #: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." @@ -1556,15 +1556,15 @@ msgstr "Endast raw int stöds för ip" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" -msgstr "" +msgstr "Operation eller funktion stöds inte" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation timed out" -msgstr "" +msgstr "Åtgärden orsakade timeout" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Out of memory" -msgstr "" +msgstr "Slut på minne" #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" @@ -1576,7 +1576,7 @@ msgstr "Översampling måste vara multipel av 8." #: shared-bindings/audiobusio/PDMIn.c msgid "PDMIn not available" -msgstr "" +msgstr "PDMIn inte tillgänglig" #: shared-bindings/pwmio/PWMOut.c msgid "" @@ -1598,7 +1598,7 @@ msgstr "ParallelBus stöds ännu inte" #: ports/esp32s2/common-hal/audiobusio/__init__.c msgid "Peripheral in use" -msgstr "" +msgstr "Periferi i bruk" #: py/moduerrno.c msgid "Permission denied" @@ -1728,7 +1728,7 @@ msgstr "Skrivskyddat objekt" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Received response was invalid" -msgstr "" +msgstr "Mottaget svar var ogiltigt" #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" @@ -1744,7 +1744,7 @@ msgstr "Det begärda AES-läget stöds inte" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Requested resource not found" -msgstr "" +msgstr "Begärd resurs hittades inte" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" @@ -2060,7 +2060,7 @@ msgstr "Ej hanterat ESP TLS-fel %d-%d-%x-%d" #: shared-bindings/wifi/Radio.c #, c-format msgid "Unknown failure %d" -msgstr "" +msgstr "Okänt fel %d" #: ports/nrf/common-hal/_bleio/__init__.c #, c-format @@ -2131,7 +2131,7 @@ msgstr "Värdets längd > max_length" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Version was invalid" -msgstr "" +msgstr "Versionen var ogiltig" #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" @@ -2334,7 +2334,7 @@ msgstr "branch utanför räckvidd" #: extmod/ulab/code/ulab_create.c msgid "buffer is smaller than requested size" -msgstr "" +msgstr "bufferten är mindre än begärd storlek" #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" @@ -2342,7 +2342,7 @@ msgstr "buffer måste vara en byte-liknande objekt" #: extmod/ulab/code/ulab_create.c msgid "buffer size must be a multiple of element size" -msgstr "" +msgstr "buffertstorlek måste vara en multipel av elementstorlek" #: shared-module/struct/__init__.c msgid "buffer size must match format" @@ -2553,7 +2553,7 @@ msgstr "circle kan endast registreras i en förälder" #: shared-bindings/msgpack/ExtType.c msgid "code outside range 0~127" -msgstr "" +msgstr "kod utanför intervallet 0~127" #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" @@ -2641,7 +2641,7 @@ msgstr "standard \"except\" måste ligga sist" #: shared-bindings/msgpack/__init__.c msgid "default is not a function" -msgstr "" +msgstr "default är inte en funktion" #: shared-bindings/audiobusio/PDMIn.c msgid "" @@ -2747,7 +2747,7 @@ msgstr "förväntar nyckel:värde för dict" #: shared-bindings/msgpack/__init__.c msgid "ext_hook is not a function" -msgstr "" +msgstr "ext_hook är inte en funktion" #: py/argcheck.c msgid "extra keyword arguments given" @@ -3286,7 +3286,7 @@ msgstr "ingen bindning för ickelokal hittad" #: shared-module/msgpack/__init__.c msgid "no default packer" -msgstr "" +msgstr "ingen standardpackare" #: py/builtinimport.c msgid "no module named '%q'" @@ -3411,7 +3411,7 @@ msgstr "offset måste vara >= 0" #: extmod/ulab/code/ulab_create.c msgid "offset must be non-negative and no greater than buffer length" -msgstr "" +msgstr "offset måste vara icke-negativt och inte längre än buffertlängd" #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" @@ -3632,7 +3632,7 @@ msgstr "shape måste vara en tuple" #: shared-module/msgpack/__init__.c msgid "short read" -msgstr "" +msgstr "kort läsning" #: py/objstr.c msgid "sign not allowed in string format specifier" @@ -4008,7 +4008,7 @@ msgstr "x-värde utanför intervall" #: ports/esp32s2/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" -msgstr "" +msgstr "xTaskCreate misslyckades" #: shared-bindings/displayio/Shape.c msgid "y should be an int" From c524900a1b5c1a68cd3faec74e47e0fbc6dd0d5c Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Sun, 17 Jan 2021 20:21:31 -0600 Subject: [PATCH 663/770] check connected before connecting --- ports/esp32s2/common-hal/wifi/Radio.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index 9302300889722..696af28f848b7 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -126,7 +126,15 @@ void common_hal_wifi_radio_set_hostname(wifi_radio_obj_t *self, const char *host } wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t* ssid, size_t ssid_len, uint8_t* password, size_t password_len, uint8_t channel, mp_float_t timeout, uint8_t* bssid, size_t bssid_len) { - // check enabled + EventBits_t bits; + bits = xEventGroupWaitBits(self->event_group_handle, + WIFI_CONNECTED_BIT | WIFI_DISCONNECTED_BIT, + pdTRUE, + pdTRUE, + 0); + if ((bits & WIFI_CONNECTED_BIT) != 0) { + return WIFI_RADIO_ERROR_NONE; + } start_station(self); wifi_config_t* config = &self->sta_config; @@ -157,7 +165,6 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t self->retries_left = 5; esp_wifi_connect(); - EventBits_t bits; do { RUN_BACKGROUND_TASKS; bits = xEventGroupWaitBits(self->event_group_handle, From e867d1915e1ebde11518a4cb6617a8eb2b374a46 Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Sun, 17 Jan 2021 19:30:41 -0800 Subject: [PATCH 664/770] make translate --- locale/circuitpython.pot | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index f319b82f8bbbf..d07bf6caf43c1 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: 2021-01-04 12:55-0600\n" +"POT-Creation-Date: 2021-01-17 19:26-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1606,6 +1606,10 @@ msgstr "" msgid "RNG Init Error" msgstr "" +#: ports/nrf/common-hal/busio/UART.c +msgid "RS485 Not yet supported on this device" +msgstr "" + #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "RS485 inversion specified when not in RS485 mode" @@ -1621,7 +1625,7 @@ msgid "RTC is not supported on this board" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/stm/common-hal/busio/UART.c msgid "RTS/CTS/RS485 Not yet supported on this device" msgstr "" @@ -1642,6 +1646,10 @@ msgstr "" msgid "Read-only object" msgstr "" +#: ports/nrf/common-hal/busio/UART.c +msgid "Reading >receiver_buffer_size bytes is not supported" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -2217,10 +2225,18 @@ msgstr "" msgid "branch not in range" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "buffer is smaller than requested size" +msgstr "" + #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "buffer size must be a multiple of element size" +msgstr "" + #: shared-module/struct/__init__.c msgid "buffer size must match format" msgstr "" @@ -3262,6 +3278,10 @@ msgstr "" msgid "offset must be >= 0" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "offset must be non-negative and no greater than buffer length" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" From 07a9593abcb86c676f2f60f487e1bad4805fb0bb Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Sun, 17 Jan 2021 19:33:32 -0800 Subject: [PATCH 665/770] add flow control info to busio_uart_obj_t --- ports/nrf/common-hal/busio/UART.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ports/nrf/common-hal/busio/UART.h b/ports/nrf/common-hal/busio/UART.h index a251162910afd..2eaf584403131 100644 --- a/ports/nrf/common-hal/busio/UART.h +++ b/ports/nrf/common-hal/busio/UART.h @@ -42,10 +42,13 @@ typedef struct { uint32_t timeout_ms; ringbuf_t ringbuf; - uint8_t rx_char; // EasyDMA buf + uint8_t rx_char; // EasyDMA buf + bool rx_paused; // set by irq if no space in rbuf uint8_t tx_pin_number; uint8_t rx_pin_number; + uint8_t cts_pin_number; + uint8_t rts_pin_number; } busio_uart_obj_t; void uart_reset(void); From dea2bcd8f03ef5250e96e99a22d6a00da29f7296 Mon Sep 17 00:00:00 2001 From: mrangen Date: Sun, 17 Jan 2021 21:20:27 -0700 Subject: [PATCH 666/770] Fixed comment in mpconfigboard.h --- ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.h b/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.h index 98920b54f2395..7926967635e45 100644 --- a/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.h +++ b/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.h @@ -12,7 +12,7 @@ // These are pins not to reset. // QSPI Data pins #define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11) -// DotStar pins, QSPI CS, and QSPI SCK +// DotStar SCK, DotStar MOSI, QSPI SCK, and QSPI CS #define MICROPY_PORT_B (PORT_PB02 | PORT_PB03 | PORT_PB10 | PORT_PB11) #define MICROPY_PORT_C (0) #define MICROPY_PORT_D (0) From ee48e4b4528b7cfea7f568d83eb31c0fde1867d8 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 18 Jan 2021 11:52:03 -0500 Subject: [PATCH 667/770] ESP32-S2: Initialize touch in proper order --- ports/esp32s2/peripherals/touch.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/peripherals/touch.c b/ports/esp32s2/peripherals/touch.c index 6cf33b2bdef05..cd895b10be797 100644 --- a/ports/esp32s2/peripherals/touch.c +++ b/ports/esp32s2/peripherals/touch.c @@ -46,8 +46,13 @@ void peripherals_touch_init(const touch_pad_t touchpad) { if (!touch_inited) { touch_pad_init(); touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER); + } + // touch_pad_config() must be done before touch_pad_fsm_start() the first time. + // Otherwise the calibration is wrong and we get maximum raw values if there is + // a trace of any significant length on the pin. + touch_pad_config(touchpad); + if (!touch_inited) { touch_pad_fsm_start(); touch_inited = true; } - touch_pad_config(touchpad); } From 41459d15d9c3bdbcbd82aa05be60f95391bd8b99 Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Mon, 18 Jan 2021 10:13:16 -0800 Subject: [PATCH 668/770] handle exttype & chunk long reads --- shared-module/msgpack/__init__.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/shared-module/msgpack/__init__.c b/shared-module/msgpack/__init__.c index 39178d46e1b15..1030031749a65 100644 --- a/shared-module/msgpack/__init__.c +++ b/shared-module/msgpack/__init__.c @@ -255,11 +255,6 @@ STATIC void pack(mp_obj_t obj, msgpack_stream_t *s, mp_obj_t default_handler) { mp_buffer_info_t bufinfo; mp_get_buffer_raise(ext->data, &bufinfo, MP_BUFFER_READ); pack_ext(s, ext->code, bufinfo.buf, bufinfo.len); - } else if (MP_OBJ_IS_TYPE(obj, &mp_type_bytes)) { - // bytes - mp_buffer_info_t bufinfo; - mp_get_buffer_raise(obj, &bufinfo, MP_BUFFER_READ); - pack_bin(s, bufinfo.buf, bufinfo.len); } else if (MP_OBJ_IS_TYPE(obj, &mp_type_tuple)) { // tuple mp_obj_tuple_t *self = MP_OBJ_TO_PTR(obj); @@ -297,7 +292,11 @@ STATIC void pack(mp_obj_t obj, msgpack_stream_t *s, mp_obj_t default_handler) { } else if (obj == mp_const_true) { write1(s, 0xc3); } else { - if (default_handler != mp_const_none) { + mp_buffer_info_t bufinfo; + if (mp_get_buffer(obj, &bufinfo, MP_BUFFER_READ)) { + // bytes (bin type) + pack_bin(s, bufinfo.buf, bufinfo.len); + } else if (default_handler != mp_const_none) { // set default_handler to mp_const_none to avoid infinite recursion // this also precludes some valid outputs pack(mp_call_function_1(default_handler, obj), s, mp_const_none); @@ -332,7 +331,15 @@ STATIC mp_obj_t unpack_bytes(msgpack_stream_t *s, size_t size) { vstr_t vstr; vstr_init_len(&vstr, size); byte *p = (byte*)vstr.buf; - read(s, p, size); + // read in chunks: (some drivers - e.g. UART) limit the + // maximum number of bytes that can be read at once + // read(s, p, size); + while (size > 0) { + int n = size > 256 ? 256 : size; + read(s, p, n); + size -= n; + p += n; + } return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); } From 1e88b9411d54e5c15a27d4a9c2748c264cb9522f Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Mon, 18 Jan 2021 10:21:27 -0800 Subject: [PATCH 669/770] rebase (main) & make translate --- locale/circuitpython.pot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index d07bf6caf43c1..398a2b15dad17 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: 2021-01-17 19:26-0800\n" +"POT-Creation-Date: 2021-01-18 10:20-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" From a01ff658ea22ee586d0e425e8498620dc28b424b Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Mon, 18 Jan 2021 19:57:01 -0600 Subject: [PATCH 670/770] fix case of connecting when wifi is stopped --- ports/esp32s2/common-hal/wifi/Radio.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index 696af28f848b7..24ec210091537 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -126,15 +126,25 @@ void common_hal_wifi_radio_set_hostname(wifi_radio_obj_t *self, const char *host } wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t* ssid, size_t ssid_len, uint8_t* password, size_t password_len, uint8_t channel, mp_float_t timeout, uint8_t* bssid, size_t bssid_len) { + if (!common_hal_wifi_radio_get_enabled(self)) { + mp_raise_RuntimeError(translate("Can't connect when wifi is not enabled")); + } + EventBits_t bits; + // can't block since both bits are false after wifi_init + // both bits are true after an existing connection stops bits = xEventGroupWaitBits(self->event_group_handle, WIFI_CONNECTED_BIT | WIFI_DISCONNECTED_BIT, pdTRUE, pdTRUE, 0); - if ((bits & WIFI_CONNECTED_BIT) != 0) { - return WIFI_RADIO_ERROR_NONE; - } + if (((bits & WIFI_CONNECTED_BIT) != 0) && + !((bits & WIFI_DISCONNECTED_BIT) != 0)) { + return WIFI_RADIO_ERROR_NONE; + } + // explicitly clear bits since xEventGroupWaitBits may have timed out + xEventGroupClearBits(self->event_group_handle, WIFI_CONNECTED_BIT); + xEventGroupClearBits(self->event_group_handle, WIFI_DISCONNECTED_BIT); start_station(self); wifi_config_t* config = &self->sta_config; From 672d0e27a3a2ab9c0abcceb4b23df1db687834f4 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Mon, 18 Jan 2021 19:57:13 -0600 Subject: [PATCH 671/770] make translate --- locale/circuitpython.pot | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 434684e1373ed..ab404ca002e93 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -564,6 +564,10 @@ msgstr "" msgid "Can only alarm on two low pins from deep sleep." msgstr "" +#: ports/esp32s2/common-hal/wifi/Radio.c +msgid "Can't connect when wifi is not enabled" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" From ebb4df846ff63cf3815624f7a7c233318e7e559a Mon Sep 17 00:00:00 2001 From: Jonathan Giles Date: Tue, 19 Jan 2021 07:46:59 -0500 Subject: [PATCH 672/770] Add support for a 'haxpress' external SPI flash build for the stm32f411ce blackpill board --- .../stm32f411ce_blackpill_haxpress/board.c | 39 ++++++++++++++ .../mpconfigboard.h | 52 +++++++++++++++++++ .../mpconfigboard.mk | 18 +++++++ .../stm32f411ce_blackpill_haxpress/pins.c | 44 ++++++++++++++++ 4 files changed, 153 insertions(+) create mode 100644 ports/stm/boards/stm32f411ce_blackpill_haxpress/board.c create mode 100644 ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.h create mode 100644 ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.mk create mode 100644 ports/stm/boards/stm32f411ce_blackpill_haxpress/pins.c diff --git a/ports/stm/boards/stm32f411ce_blackpill_haxpress/board.c b/ports/stm/boards/stm32f411ce_blackpill_haxpress/board.c new file mode 100644 index 0000000000000..f8e462f938255 --- /dev/null +++ b/ports/stm/boards/stm32f411ce_blackpill_haxpress/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 "supervisor/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/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.h b/ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.h new file mode 100644 index 0000000000000..cd3caab42d211 --- /dev/null +++ b/ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.h @@ -0,0 +1,52 @@ +/* + * 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 "stm32f411ce-blackpill-haxpress" +#define MICROPY_HW_MCU_NAME "STM32F411CE" + +#define FLASH_SIZE (0x80000) +#define FLASH_PAGE_SIZE (0x4000) + +#define HSE_VALUE ((uint32_t)25000000) +#define BOARD_NO_VBUS_SENSE (1) +#define BOARD_HAS_LOW_SPEED_CRYSTAL (0) + +// On-board flash +#define SPI_FLASH_MOSI_PIN (&pin_PA07) +#define SPI_FLASH_MISO_PIN (&pin_PA06) +#define SPI_FLASH_SCK_PIN (&pin_PA05) +#define SPI_FLASH_CS_PIN (&pin_PA04) + +#define DEFAULT_I2C_BUS_SCL (&pin_PB06) +#define DEFAULT_I2C_BUS_SDA (&pin_PB07) + +#define CIRCUITPY_AUTORELOAD_DELAY_MS (500) + +#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x2000 - 0xC000) + +#define AUTORESET_DELAY_MS (500) diff --git a/ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.mk b/ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.mk new file mode 100644 index 0000000000000..329662c538cb2 --- /dev/null +++ b/ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.mk @@ -0,0 +1,18 @@ +USB_VID = 0x239A +USB_PID = 0x806A +USB_PRODUCT = "stm32f411ce blackpill" +USB_MANUFACTURER = "Unknown" + +SPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICE_COUNT = 1 +EXTERNAL_FLASH_DEVICES = W25Q64FV #See supervisor/shared/external_flash/devices.h for options +LONGINT_IMPL = MPZ + +INTERNAL_FLASH_FILESYSTEM = 0 + +MCU_SERIES = F4 +MCU_VARIANT = STM32F411xE +MCU_PACKAGE = UFQFPN48 + +LD_COMMON = boards/common_default.ld +LD_FILE = boards/STM32F411_nvm_nofs.ld diff --git a/ports/stm/boards/stm32f411ce_blackpill_haxpress/pins.c b/ports/stm/boards/stm32f411ce_blackpill_haxpress/pins.c new file mode 100644 index 0000000000000..16946b8bee4e1 --- /dev/null +++ b/ports/stm/boards/stm32f411ce_blackpill_haxpress/pins.c @@ -0,0 +1,44 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR_B12), MP_ROM_PTR(&pin_PB12) }, + { MP_ROM_QSTR(MP_QSTR_B13), MP_ROM_PTR(&pin_PB13) }, + { MP_ROM_QSTR(MP_QSTR_B14), MP_ROM_PTR(&pin_PB14) }, + { MP_ROM_QSTR(MP_QSTR_B15), MP_ROM_PTR(&pin_PB15) }, + { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_PA09) }, //USB (shouldn't be used) + { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_PA10) }, //USB (shouldn't be used) + { MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_PA11) }, //USB (shouldn't be used) + { MP_ROM_QSTR(MP_QSTR_A12), MP_ROM_PTR(&pin_PA12) }, //USB (shouldn't be used) + { MP_ROM_QSTR(MP_QSTR_A15), MP_ROM_PTR(&pin_PA15) }, + { 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_B8), MP_ROM_PTR(&pin_PB08) }, + { MP_ROM_QSTR(MP_QSTR_B9), MP_ROM_PTR(&pin_PB09) }, + + { MP_ROM_QSTR(MP_QSTR_B10), MP_ROM_PTR(&pin_PB10) }, + { MP_ROM_QSTR(MP_QSTR_B2), MP_ROM_PTR(&pin_PB02) }, + { MP_ROM_QSTR(MP_QSTR_B1), MP_ROM_PTR(&pin_PB01) }, + { MP_ROM_QSTR(MP_QSTR_B0), MP_ROM_PTR(&pin_PB00) }, + { 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_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_C15), MP_ROM_PTR(&pin_PC15) }, + { MP_ROM_QSTR(MP_QSTR_C14), MP_ROM_PTR(&pin_PC14) }, + { MP_ROM_QSTR(MP_QSTR_C13), MP_ROM_PTR(&pin_PC13) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PC13) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB07) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB06) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 368751b6e9e007656de77b3f35ab14047a266994 Mon Sep 17 00:00:00 2001 From: Jonathan Giles Date: Tue, 19 Jan 2021 07:48:52 -0500 Subject: [PATCH 673/770] Add support for a 'haxpress' external SPI flash build for the stm32f411ce blackpill board --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0b2a9058f539c..fd46b63b5c631 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -315,6 +315,7 @@ jobs: - "spresense" - "stackrduino_m0_pro" - "stm32f411ce_blackpill" + - "stm32f411ce_blackpill_haxpress" - "stm32f411ve_discovery" - "stm32f412zg_discovery" - "stm32f4_discovery" From 35c836f0960ac89f830cf88797f74d4be164858b Mon Sep 17 00:00:00 2001 From: djix123 Date: Tue, 19 Jan 2021 11:32:41 -0500 Subject: [PATCH 674/770] Update .github/workflows/build.yml Change name from _haxpress to _with_flash Co-authored-by: Dan Halbert --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fd46b63b5c631..fd4840830ee53 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -315,7 +315,7 @@ jobs: - "spresense" - "stackrduino_m0_pro" - "stm32f411ce_blackpill" - - "stm32f411ce_blackpill_haxpress" + - "stm32f411ce_blackpill_with_flash" - "stm32f411ve_discovery" - "stm32f412zg_discovery" - "stm32f4_discovery" From c8046af6e769c4317cdc1f1c369ba30699ba9ce7 Mon Sep 17 00:00:00 2001 From: djix123 Date: Tue, 19 Jan 2021 11:34:47 -0500 Subject: [PATCH 675/770] Update ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.h Change name from _haxpress to _with_flash Co-authored-by: Dan Halbert --- ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.h b/ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.h index cd3caab42d211..65e224e47a353 100644 --- a/ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.h +++ b/ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.h @@ -26,7 +26,7 @@ //Micropython setup -#define MICROPY_HW_BOARD_NAME "stm32f411ce-blackpill-haxpress" +#define MICROPY_HW_BOARD_NAME "stm32f411ce-blackpill-with-flash" #define MICROPY_HW_MCU_NAME "STM32F411CE" #define FLASH_SIZE (0x80000) From 4804032f0934305e78124f7fefcd63bc4e6dd42f Mon Sep 17 00:00:00 2001 From: djix123 Date: Tue, 19 Jan 2021 11:35:03 -0500 Subject: [PATCH 676/770] Update ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.mk Change name from _haxpress to _with_flash Co-authored-by: Dan Halbert --- .../stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.mk b/ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.mk index 329662c538cb2..a7b5f8e2de061 100644 --- a/ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.mk +++ b/ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.mk @@ -1,6 +1,6 @@ USB_VID = 0x239A USB_PID = 0x806A -USB_PRODUCT = "stm32f411ce blackpill" +USB_PRODUCT = "stm32f411ce blackpill with flash" USB_MANUFACTURER = "Unknown" SPI_FLASH_FILESYSTEM = 1 From b4bdf55eda94978060937c6bd07c57ef744a0382 Mon Sep 17 00:00:00 2001 From: djix123 Date: Tue, 19 Jan 2021 11:35:52 -0500 Subject: [PATCH 677/770] Update ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.mk Update PID for _with_flash version to resolve duplicate PID issue Co-authored-by: Dan Halbert --- .../stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.mk b/ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.mk index a7b5f8e2de061..771809e74dcbd 100644 --- a/ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.mk +++ b/ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.mk @@ -1,5 +1,5 @@ USB_VID = 0x239A -USB_PID = 0x806A +USB_PID = 0x006A USB_PRODUCT = "stm32f411ce blackpill with flash" USB_MANUFACTURER = "Unknown" From 55c6d3e92f231cc4e5cb2c97dcb0cc6e9937397f Mon Sep 17 00:00:00 2001 From: Jonathan Giles Date: Tue, 19 Jan 2021 11:48:15 -0500 Subject: [PATCH 678/770] 1. Rename 'stm32f411ce_blackpill_haxpress' to 'stm32f411ce_blackpill_with_flash' 2. Add 'W25Q64JV_IQ' to flash chip list (as per commercial version) --- .../board.c | 0 .../mpconfigboard.h | 0 .../mpconfigboard.mk | 5 +++-- .../pins.c | 0 4 files changed, 3 insertions(+), 2 deletions(-) rename ports/stm/boards/{stm32f411ce_blackpill_haxpress => stm32f411ce_blackpill_with_flash}/board.c (100%) rename ports/stm/boards/{stm32f411ce_blackpill_haxpress => stm32f411ce_blackpill_with_flash}/mpconfigboard.h (100%) rename ports/stm/boards/{stm32f411ce_blackpill_haxpress => stm32f411ce_blackpill_with_flash}/mpconfigboard.mk (70%) rename ports/stm/boards/{stm32f411ce_blackpill_haxpress => stm32f411ce_blackpill_with_flash}/pins.c (100%) diff --git a/ports/stm/boards/stm32f411ce_blackpill_haxpress/board.c b/ports/stm/boards/stm32f411ce_blackpill_with_flash/board.c similarity index 100% rename from ports/stm/boards/stm32f411ce_blackpill_haxpress/board.c rename to ports/stm/boards/stm32f411ce_blackpill_with_flash/board.c diff --git a/ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.h b/ports/stm/boards/stm32f411ce_blackpill_with_flash/mpconfigboard.h similarity index 100% rename from ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.h rename to ports/stm/boards/stm32f411ce_blackpill_with_flash/mpconfigboard.h diff --git a/ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.mk b/ports/stm/boards/stm32f411ce_blackpill_with_flash/mpconfigboard.mk similarity index 70% rename from ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.mk rename to ports/stm/boards/stm32f411ce_blackpill_with_flash/mpconfigboard.mk index 771809e74dcbd..9a95a3539cc42 100644 --- a/ports/stm/boards/stm32f411ce_blackpill_haxpress/mpconfigboard.mk +++ b/ports/stm/boards/stm32f411ce_blackpill_with_flash/mpconfigboard.mk @@ -4,8 +4,9 @@ USB_PRODUCT = "stm32f411ce blackpill with flash" USB_MANUFACTURER = "Unknown" SPI_FLASH_FILESYSTEM = 1 -EXTERNAL_FLASH_DEVICE_COUNT = 1 -EXTERNAL_FLASH_DEVICES = W25Q64FV #See supervisor/shared/external_flash/devices.h for options +EXTERNAL_FLASH_DEVICE_COUNT = 2 +#See supervisor/shared/external_flash/devices.h for options +EXTERNAL_FLASH_DEVICES = W25Q64FV,W25Q64JV_IQ LONGINT_IMPL = MPZ INTERNAL_FLASH_FILESYSTEM = 0 diff --git a/ports/stm/boards/stm32f411ce_blackpill_haxpress/pins.c b/ports/stm/boards/stm32f411ce_blackpill_with_flash/pins.c similarity index 100% rename from ports/stm/boards/stm32f411ce_blackpill_haxpress/pins.c rename to ports/stm/boards/stm32f411ce_blackpill_with_flash/pins.c From a805ff45b2b1d22535037c62f27093bc1fa4ae5b Mon Sep 17 00:00:00 2001 From: Maciej Stankiewicz Date: Tue, 19 Jan 2021 22:15:39 +0000 Subject: [PATCH 679/770] Translated using Weblate (Polish) Currently translated at 68.0% (623 of 916 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pl/ --- locale/pl.po | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/locale/pl.po b/locale/pl.po index c0a3040501a28..8ba0c3d71d575 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2020-12-02 20:29+0000\n" +"PO-Revision-Date: 2021-01-20 02:40+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" "Language: pl\n" @@ -16,7 +16,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2;\n" -"X-Generator: Weblate 4.4-dev\n" +"X-Generator: Weblate 4.5-dev\n" #: main.c msgid "" @@ -770,7 +770,7 @@ msgstr "Nie można rozpocząć przerwania, RX jest zajęty" #: shared-module/audiomp3/MP3Decoder.c msgid "Couldn't allocate decoder" -msgstr "" +msgstr "Nie udało się przydzielić dekodera" #: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c #: shared-module/audiomp3/MP3Decoder.c @@ -1070,7 +1070,7 @@ msgstr "Niewłaściwa wielkość bufora" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" -msgstr "" +msgstr "Inicjalizacja nie powiodła się z powodu braku pamięci" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" @@ -1251,11 +1251,11 @@ msgstr "Nieprawidłowy security_mode" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid size" -msgstr "" +msgstr "Nieprawidłowy rozmiar" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" -msgstr "" +msgstr "Nieprawidłowy stan" #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" @@ -1554,7 +1554,7 @@ msgstr "" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Out of memory" -msgstr "" +msgstr "Brak pamięci" #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" @@ -1707,7 +1707,7 @@ msgstr "Obiekt tylko do odczytu" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Received response was invalid" -msgstr "" +msgstr "Otrzymana odpowiedź była nieprawidłowa" #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" @@ -1723,7 +1723,7 @@ msgstr "Żądany tryb AES nie jest obsługiwany" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Requested resource not found" -msgstr "" +msgstr "Nie znaleziono żądanego zasobu" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" From 733094aead6e84b42da54655b2b0a5d0dbd1a503 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 20 Jan 2021 16:47:18 -0800 Subject: [PATCH 680/770] Add initial RP2040 support The RP2040 is new microcontroller from Raspberry Pi that features two Cortex M0s and eight PIO state machines that are good for crunching lots of data. It has 264k RAM and a built in UF2 bootloader too. Datasheet: https://pico.raspberrypi.org/files/rp2040_datasheet.pdf --- .github/workflows/build.yml | 2 + .gitmodules | 5 +- Makefile | 1 + conf.py | 1 + docs/supported_ports.rst | 3 +- lib/tinyusb | 2 +- ports/raspberrypi/.gitignore | 1 + ports/raspberrypi/Makefile | 273 ++++++++ ports/raspberrypi/README.rst | 18 + ports/raspberrypi/background.c | 44 ++ ports/raspberrypi/background.h | 32 + .../bindings/rp2pio/StateMachine.c | 449 ++++++++++++++ .../bindings/rp2pio/StateMachine.h | 71 +++ ports/raspberrypi/bindings/rp2pio/__init__.c | 45 ++ .../boards/adafruit_feather_rp2040/board.c | 44 ++ .../adafruit_feather_rp2040/mpconfigboard.h | 14 + .../adafruit_feather_rp2040/mpconfigboard.mk | 10 + .../boards/adafruit_feather_rp2040/pins.c | 36 ++ .../boards/raspberry_pi_pico/board.c | 38 ++ .../boards/raspberry_pi_pico/mpconfigboard.h | 15 + .../boards/raspberry_pi_pico/mpconfigboard.mk | 10 + .../boards/raspberry_pi_pico/pins.c | 38 ++ .../bs2_default_padded_checksummed.S | 20 + .../common-hal/analogio/AnalogIn.c | 73 +++ .../common-hal/analogio/AnalogIn.h | 41 ++ .../common-hal/analogio/AnalogOut.c | 48 ++ .../common-hal/analogio/AnalogOut.h | 36 ++ .../common-hal/analogio/__init__.c | 1 + ports/raspberrypi/common-hal/board/__init__.c | 34 + ports/raspberrypi/common-hal/busio/I2C.c | 175 ++++++ ports/raspberrypi/common-hal/busio/I2C.h | 47 ++ ports/raspberrypi/common-hal/busio/OneWire.h | 33 + ports/raspberrypi/common-hal/busio/SPI.c | 294 +++++++++ ports/raspberrypi/common-hal/busio/SPI.h | 52 ++ ports/raspberrypi/common-hal/busio/UART.c | 403 ++++++++++++ ports/raspberrypi/common-hal/busio/UART.h | 47 ++ ports/raspberrypi/common-hal/busio/__init__.c | 1 + .../common-hal/digitalio/DigitalInOut.c | 157 +++++ .../common-hal/digitalio/DigitalInOut.h | 40 ++ .../common-hal/digitalio/__init__.c | 1 + .../common-hal/displayio/ParallelBus.c | 68 ++ .../common-hal/displayio/ParallelBus.h | 36 ++ .../common-hal/microcontroller/Pin.c | 190 ++++++ .../common-hal/microcontroller/Pin.h | 53 ++ .../common-hal/microcontroller/Processor.c | 66 ++ .../common-hal/microcontroller/Processor.h | 39 ++ .../common-hal/microcontroller/__init__.c | 148 +++++ .../common-hal/microcontroller/__init__.h | 36 ++ .../common-hal/neopixel_write/__init__.c | 95 +++ ports/raspberrypi/common-hal/os/__init__.c | 62 ++ ports/raspberrypi/common-hal/pwmio/PWMOut.c | 216 +++++++ ports/raspberrypi/common-hal/pwmio/PWMOut.h | 47 ++ ports/raspberrypi/common-hal/pwmio/__init__.c | 1 + .../common-hal/rp2pio/StateMachine.c | 586 ++++++++++++++++++ .../common-hal/rp2pio/StateMachine.h | 68 ++ .../raspberrypi/common-hal/rp2pio/__init__.c | 1 + .../common-hal/supervisor/Runtime.c | 37 ++ .../common-hal/supervisor/Runtime.h | 37 ++ .../common-hal/supervisor/__init__.c | 40 ++ ports/raspberrypi/fatfs_port.c | 48 ++ ports/raspberrypi/link.ld | 251 ++++++++ ports/raspberrypi/mpconfigport.h | 46 ++ ports/raspberrypi/mpconfigport.mk | 44 ++ ports/raspberrypi/mphalport.c | 57 ++ ports/raspberrypi/mphalport.h | 50 ++ ports/raspberrypi/peripherals/pins.c | 67 ++ ports/raspberrypi/peripherals/pins.h | 71 +++ ports/raspberrypi/qstrdefsport.h | 1 + ports/raspberrypi/sdk | 1 + .../sdk_config/pico/config_autogen.h | 19 + ports/raspberrypi/sdk_config/pico/version.h | 19 + ports/raspberrypi/supervisor/internal_flash.c | 131 ++++ ports/raspberrypi/supervisor/internal_flash.h | 38 ++ .../supervisor/internal_flash_root_pointers.h | 31 + ports/raspberrypi/supervisor/port.c | 200 ++++++ ports/raspberrypi/supervisor/rp2_cpu.s | 35 ++ ports/raspberrypi/supervisor/usb.c | 38 ++ py/circuitpy_defns.mk | 4 + py/circuitpy_mpconfig.h | 29 +- py/circuitpy_mpconfig.mk | 8 +- shared-bindings/microcontroller/__init__.h | 7 + shared-module/sdcardio/SDCard.c | 4 +- supervisor/shared/filesystem.c | 2 + supervisor/shared/safe_mode.c | 2 + supervisor/shared/workflow.c | 4 +- tools/build_board_info.py | 2 + tools/build_memory_info.py | 4 +- 87 files changed, 5676 insertions(+), 18 deletions(-) create mode 100644 ports/raspberrypi/.gitignore create mode 100644 ports/raspberrypi/Makefile create mode 100644 ports/raspberrypi/README.rst create mode 100644 ports/raspberrypi/background.c create mode 100644 ports/raspberrypi/background.h create mode 100644 ports/raspberrypi/bindings/rp2pio/StateMachine.c create mode 100644 ports/raspberrypi/bindings/rp2pio/StateMachine.h create mode 100644 ports/raspberrypi/bindings/rp2pio/__init__.c create mode 100644 ports/raspberrypi/boards/adafruit_feather_rp2040/board.c create mode 100644 ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/adafruit_feather_rp2040/pins.c create mode 100644 ports/raspberrypi/boards/raspberry_pi_pico/board.c create mode 100644 ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/raspberry_pi_pico/pins.c create mode 100644 ports/raspberrypi/bs2_default_padded_checksummed.S create mode 100644 ports/raspberrypi/common-hal/analogio/AnalogIn.c create mode 100644 ports/raspberrypi/common-hal/analogio/AnalogIn.h create mode 100644 ports/raspberrypi/common-hal/analogio/AnalogOut.c create mode 100644 ports/raspberrypi/common-hal/analogio/AnalogOut.h create mode 100644 ports/raspberrypi/common-hal/analogio/__init__.c create mode 100644 ports/raspberrypi/common-hal/board/__init__.c create mode 100644 ports/raspberrypi/common-hal/busio/I2C.c create mode 100644 ports/raspberrypi/common-hal/busio/I2C.h create mode 100644 ports/raspberrypi/common-hal/busio/OneWire.h create mode 100644 ports/raspberrypi/common-hal/busio/SPI.c create mode 100644 ports/raspberrypi/common-hal/busio/SPI.h create mode 100644 ports/raspberrypi/common-hal/busio/UART.c create mode 100644 ports/raspberrypi/common-hal/busio/UART.h create mode 100644 ports/raspberrypi/common-hal/busio/__init__.c create mode 100644 ports/raspberrypi/common-hal/digitalio/DigitalInOut.c create mode 100644 ports/raspberrypi/common-hal/digitalio/DigitalInOut.h create mode 100644 ports/raspberrypi/common-hal/digitalio/__init__.c create mode 100644 ports/raspberrypi/common-hal/displayio/ParallelBus.c create mode 100644 ports/raspberrypi/common-hal/displayio/ParallelBus.h create mode 100644 ports/raspberrypi/common-hal/microcontroller/Pin.c create mode 100644 ports/raspberrypi/common-hal/microcontroller/Pin.h create mode 100644 ports/raspberrypi/common-hal/microcontroller/Processor.c create mode 100644 ports/raspberrypi/common-hal/microcontroller/Processor.h create mode 100644 ports/raspberrypi/common-hal/microcontroller/__init__.c create mode 100644 ports/raspberrypi/common-hal/microcontroller/__init__.h create mode 100644 ports/raspberrypi/common-hal/neopixel_write/__init__.c create mode 100644 ports/raspberrypi/common-hal/os/__init__.c create mode 100644 ports/raspberrypi/common-hal/pwmio/PWMOut.c create mode 100644 ports/raspberrypi/common-hal/pwmio/PWMOut.h create mode 100644 ports/raspberrypi/common-hal/pwmio/__init__.c create mode 100644 ports/raspberrypi/common-hal/rp2pio/StateMachine.c create mode 100644 ports/raspberrypi/common-hal/rp2pio/StateMachine.h create mode 100644 ports/raspberrypi/common-hal/rp2pio/__init__.c create mode 100755 ports/raspberrypi/common-hal/supervisor/Runtime.c create mode 100755 ports/raspberrypi/common-hal/supervisor/Runtime.h create mode 100755 ports/raspberrypi/common-hal/supervisor/__init__.c create mode 100644 ports/raspberrypi/fatfs_port.c create mode 100644 ports/raspberrypi/link.ld create mode 100644 ports/raspberrypi/mpconfigport.h create mode 100644 ports/raspberrypi/mpconfigport.mk create mode 100644 ports/raspberrypi/mphalport.c create mode 100644 ports/raspberrypi/mphalport.h create mode 100644 ports/raspberrypi/peripherals/pins.c create mode 100644 ports/raspberrypi/peripherals/pins.h create mode 100644 ports/raspberrypi/qstrdefsport.h create mode 160000 ports/raspberrypi/sdk create mode 100644 ports/raspberrypi/sdk_config/pico/config_autogen.h create mode 100644 ports/raspberrypi/sdk_config/pico/version.h create mode 100644 ports/raspberrypi/supervisor/internal_flash.c create mode 100644 ports/raspberrypi/supervisor/internal_flash.h create mode 100644 ports/raspberrypi/supervisor/internal_flash_root_pointers.h create mode 100644 ports/raspberrypi/supervisor/port.c create mode 100755 ports/raspberrypi/supervisor/rp2_cpu.s create mode 100644 ports/raspberrypi/supervisor/usb.c diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fd4840830ee53..abde2da0bb2dd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -177,6 +177,7 @@ jobs: - "8086_commander" - "ADM_B_NRF52840_1" - "TG-Watch" + - "adafruit_feather_rp2040" - "aloriumtech_evo_m51" - "aramcon_badge_2019" - "arduino_mkr1300" @@ -294,6 +295,7 @@ jobs: - "pyruler" - "qtpy_m0" - "qtpy_m0_haxpress" + - "raspberry_pi_pico" - "raytac_mdbt50q-db-40" - "robohatmm1_m4" - "sam32" diff --git a/.gitmodules b/.gitmodules index f4080de1b2af2..66fcf186faf96 100644 --- a/.gitmodules +++ b/.gitmodules @@ -75,7 +75,7 @@ url = https://github.com/adafruit/nrfx.git [submodule "lib/tinyusb"] path = lib/tinyusb - url = https://github.com/hathach/tinyusb.git + url = https://github.com/tannewt/tinyusb.git branch = master fetchRecurseSubmodules = false [submodule "tools/huffman"] @@ -171,3 +171,6 @@ [submodule "frozen/Adafruit_CircuitPython_LC709203F"] path = frozen/Adafruit_CircuitPython_LC709203F url = https://github.com/adafruit/Adafruit_CircuitPython_LC709203F +[submodule "ports/raspberrypi/sdk"] + path = ports/raspberrypi/sdk + url = https://github.com/raspberrypi/pico-sdk.git diff --git a/Makefile b/Makefile index adb206d7bc739..845997beb2f8b 100644 --- a/Makefile +++ b/Makefile @@ -255,6 +255,7 @@ stubs: @$(PYTHON) tools/extract_pyi.py shared-bindings/ $(STUBDIR) @$(PYTHON) tools/extract_pyi.py extmod/ulab/code/ $(STUBDIR)/ulab @$(PYTHON) tools/extract_pyi.py ports/atmel-samd/bindings $(STUBDIR) + @$(PYTHON) tools/extract_pyi.py ports/raspberrypi/bindings $(STUBDIR) @$(PYTHON) setup.py -q sdist .PHONY: check-stubs diff --git a/conf.py b/conf.py index c2d3d37eeda90..0a163e7d3c5be 100644 --- a/conf.py +++ b/conf.py @@ -189,6 +189,7 @@ "ports/nrf/nrfx", "ports/nrf/peripherals", "ports/nrf/usb", + "ports/raspberrypi/sdk", "ports/stm/st_driver", "ports/stm/packages", "ports/stm/peripherals", diff --git a/docs/supported_ports.rst b/docs/supported_ports.rst index e74067e28fe9a..b83ef12d3565e 100644 --- a/docs/supported_ports.rst +++ b/docs/supported_ports.rst @@ -13,8 +13,9 @@ is limited. ../ports/atmel-samd/README ../ports/cxd56/README + ../ports/esp32s2/README ../ports/litex/README ../ports/mimxrt10xx/README ../ports/nrf/README + ../ports/raspberrypi/README ../ports/stm/README - ../ports/esp32s2/README diff --git a/lib/tinyusb b/lib/tinyusb index cfcffe94ce62f..b68e4e9d70dde 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit cfcffe94ce62f5ef1fb5aef4641924d64dc4b1c0 +Subproject commit b68e4e9d70ddef442c4d95412414c4221eef59eb diff --git a/ports/raspberrypi/.gitignore b/ports/raspberrypi/.gitignore new file mode 100644 index 0000000000000..414487d53eb83 --- /dev/null +++ b/ports/raspberrypi/.gitignore @@ -0,0 +1 @@ +build-*/ diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile new file mode 100644 index 0000000000000..69bd592c20f58 --- /dev/null +++ b/ports/raspberrypi/Makefile @@ -0,0 +1,273 @@ +# This file is part of the MicroPython project, http://micropython.org/ +# +# The MIT License (MIT) +# +# SPDX-FileCopyrightText: Copyright (c) 2019 Dan Halbert for Adafruit Industries +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +# Select the board to build for. +ifeq ($(BOARD),) + $(error You must provide a BOARD parameter) +else + ifeq ($(wildcard boards/$(BOARD)/.),) + $(error Invalid BOARD specified) + endif +endif + +# If the build directory is not given, make it reflect the board name. +BUILD ?= build-$(BOARD) + +include ../../py/mkenv.mk +# Board-specific +include boards/$(BOARD)/mpconfigboard.mk +# Port-specific +include mpconfigport.mk +# CircuitPython-specific +include $(TOP)/py/circuitpy_mpconfig.mk + +# qstr definitions (must come before including py.mk) +QSTR_DEFS = qstrdefsport.h + +# include py core make definitions +include $(TOP)/py/py.mk + +include $(TOP)/supervisor/supervisor.mk + +# Include make rules and variables common across CircuitPython builds. +include $(TOP)/py/circuitpy_defns.mk + +CROSS_COMPILE = arm-none-eabi- + +HAL_DIR=hal/$(MCU_SERIES) + +INC += -I. \ + -I../.. \ + -I../lib/mp-readline \ + -I../lib/timeutils \ + -Iboards/$(BOARD) \ + -Iboards/ \ + -isystem sdk/ \ + -isystem sdk/src/common/pico_base/include/ \ + -isystem sdk/src/common/pico_binary_info/include/ \ + -isystem sdk/src/common/pico_stdlib/include/ \ + -isystem sdk/src/common/pico_sync/include/ \ + -isystem sdk/src/common/pico_time/include/ \ + -isystem sdk/src/common/pico_util/include/ \ + -isystem sdk/src/rp2040/hardware_regs/include/ \ + -isystem sdk/src/rp2040/hardware_structs/include/ \ + -isystem sdk/src/rp2_common/hardware_adc/include/ \ + -isystem sdk/src/rp2_common/hardware_base/include/ \ + -isystem sdk/src/rp2_common/hardware_claim/include/ \ + -isystem sdk/src/rp2_common/hardware_clocks/include/ \ + -isystem sdk/src/rp2_common/hardware_dma/include/ \ + -isystem sdk/src/rp2_common/hardware_flash/include/ \ + -isystem sdk/src/rp2_common/hardware_gpio/include/ \ + -isystem sdk/src/rp2_common/hardware_irq/include/ \ + -isystem sdk/src/rp2_common/hardware_i2c/include/ \ + -isystem sdk/src/rp2_common/hardware_pio/include/ \ + -isystem sdk/src/rp2_common/hardware_pll/include/ \ + -isystem sdk/src/rp2_common/hardware_resets/include/ \ + -isystem sdk/src/rp2_common/hardware_spi/include/ \ + -isystem sdk/src/rp2_common/hardware_sync/include/ \ + -isystem sdk/src/rp2_common/hardware_timer/include/ \ + -isystem sdk/src/rp2_common/hardware_uart/include/ \ + -isystem sdk/src/rp2_common/hardware_watchdog/include/ \ + -isystem sdk/src/rp2_common/hardware_xosc/include/ \ + -isystem sdk/src/rp2_common/pico_multicore/include/ \ + -isystem sdk/src/rp2_common/pico_fix/rp2040_usb_device_enumeration/include/ \ + -isystem sdk/src/rp2_common/pico_stdio/include/ \ + -isystem sdk/src/rp2_common/pico_printf/include/ \ + -isystem sdk/src/rp2_common/pico_float/include/ \ + -isystem sdk/src/rp2_common/pico_platform/include/ \ + -isystem sdk/src/rp2_common/pico_runtime/printf/include/ \ + -isystem sdk/src/rp2_common/pico_bootrom/include/ \ + -Isdk_config \ + -I../../lib/tinyusb/src \ + -I../../supervisor/shared/usb \ + -I$(BUILD) + +# Pico specific configuration +CFLAGS += -DPICO_ON_DEVICE=1 -DPICO_NO_BINARY_INFO=0 -DPICO_TIME_DEFAULT_ALARM_POOL_DISABLED=1 -DPICO_DIVIDER_CALL_IDIV0=0 -DPICO_DIVIDER_CALL_LDIV0=0 -DPICO_DIVIDER_HARDWARE=1 -DPICO_DOUBLE_ROM=1 -DPICO_FLOAT_ROM=1 -DPICO_MULTICORE=1 -DPICO_BITS_IN_RAM=0 -DPICO_DIVIDER_IN_RAM=0 -DPICO_DOUBLE_PROPAGATE_NANS=0 -DPICO_DOUBLE_IN_RAM=0 -DPICO_MEM_IN_RAM=0 -DPICO_FLOAT_IN_RAM=0 -DPICO_FLOAT_PROPAGATE_NANS=1 -DPICO_NO_FLASH=0 -DPICO_COPY_TO_RAM=0 -DPICO_DISABLE_SHARED_IRQ_HANDLERS=0 +OPTIMIZATION_FLAGS ?= -O3 +# TinyUSB defines +CFLAGS += -DTUD_OPT_RP2040_USB_DEVICE_ENUMERATION_FIX=1 -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 + +# option to override default optimization level, set in boards/$(BOARD)/mpconfigboard.mk +CFLAGS += $(OPTIMIZATION_FLAGS) + +#Debugging/Optimization +ifeq ($(DEBUG), 1) + CFLAGS += -ggdb3 -Og + # No LTO because we may place some functions in RAM instead of flash. +else + CFLAGS += -DNDEBUG + + # No LTO because we may place some functions in RAM instead of flash. + + ifdef CFLAGS_BOARD + CFLAGS += $(CFLAGS_BOARD) + endif +endif + +DISABLE_WARNINGS = -Wno-unused-function -Wno-unused-variable -Wno-strict-overflow -Wno-cast-align -Wno-strict-prototypes -Wno-nested-externs -Wno-double-promotion -Wno-sign-compare + +CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) $(DISABLE_WARNINGS) + +CFLAGS += \ + -march=armv6-m \ + -mthumb \ + -mabi=aapcs-linux \ + -mcpu=cortex-m0plus \ + -msoft-float \ + -mfloat-abi=soft + +PICO_LDFLAGS = --specs=nosys.specs -Wl,--wrap=__aeabi_ldiv0 -Wl,--wrap=__aeabi_idiv0 -Wl,--wrap=__aeabi_lmul -Wl,--wrap=__clzsi2 -Wl,--wrap=__clzdi2 -Wl,--wrap=__ctzsi2 -Wl,--wrap=__ctzdi2 -Wl,--wrap=__popcountsi2 -Wl,--wrap=__popcountdi2 -Wl,--wrap=__clz -Wl,--wrap=__clzl -Wl,--wrap=__clzll -Wl,--wrap=__aeabi_idiv -Wl,--wrap=__aeabi_idivmod -Wl,--wrap=__aeabi_ldivmod -Wl,--wrap=__aeabi_uidiv -Wl,--wrap=__aeabi_uidivmod -Wl,--wrap=__aeabi_uldivmod -Wl,--wrap=__aeabi_dadd -Wl,--wrap=__aeabi_ddiv -Wl,--wrap=__aeabi_dmul -Wl,--wrap=__aeabi_drsub -Wl,--wrap=__aeabi_dsub -Wl,--wrap=__aeabi_cdcmpeq -Wl,--wrap=__aeabi_cdrcmple -Wl,--wrap=__aeabi_cdcmple -Wl,--wrap=__aeabi_dcmpeq -Wl,--wrap=__aeabi_dcmplt -Wl,--wrap=__aeabi_dcmple -Wl,--wrap=__aeabi_dcmpge -Wl,--wrap=__aeabi_dcmpgt -Wl,--wrap=__aeabi_dcmpun -Wl,--wrap=__aeabi_i2d -Wl,--wrap=__aeabi_l2d -Wl,--wrap=__aeabi_ui2d -Wl,--wrap=__aeabi_ul2d -Wl,--wrap=__aeabi_d2iz -Wl,--wrap=__aeabi_d2lz -Wl,--wrap=__aeabi_d2uiz -Wl,--wrap=__aeabi_d2ulz -Wl,--wrap=__aeabi_d2f -Wl,--wrap=sqrt -Wl,--wrap=cos -Wl,--wrap=sin -Wl,--wrap=tan -Wl,--wrap=atan2 -Wl,--wrap=exp -Wl,--wrap=log -Wl,--wrap=ldexp -Wl,--wrap=copysign -Wl,--wrap=trunc -Wl,--wrap=floor -Wl,--wrap=ceil -Wl,--wrap=round -Wl,--wrap=sincos -Wl,--wrap=asin -Wl,--wrap=acos -Wl,--wrap=atan -Wl,--wrap=sinh -Wl,--wrap=cosh -Wl,--wrap=tanh -Wl,--wrap=asinh -Wl,--wrap=acosh -Wl,--wrap=atanh -Wl,--wrap=exp2 -Wl,--wrap=log2 -Wl,--wrap=exp10 -Wl,--wrap=log10 -Wl,--wrap=pow -Wl,--wrap=powint -Wl,--wrap=hypot -Wl,--wrap=cbrt -Wl,--wrap=fmod -Wl,--wrap=drem -Wl,--wrap=remainder -Wl,--wrap=remquo -Wl,--wrap=expm1 -Wl,--wrap=log1p -Wl,--wrap=fma -Wl,--wrap=__aeabi_fadd -Wl,--wrap=__aeabi_fdiv -Wl,--wrap=__aeabi_fmul -Wl,--wrap=__aeabi_frsub -Wl,--wrap=__aeabi_fsub -Wl,--wrap=__aeabi_cfcmpeq -Wl,--wrap=__aeabi_cfrcmple -Wl,--wrap=__aeabi_cfcmple -Wl,--wrap=__aeabi_fcmpeq -Wl,--wrap=__aeabi_fcmplt -Wl,--wrap=__aeabi_fcmple -Wl,--wrap=__aeabi_fcmpge -Wl,--wrap=__aeabi_fcmpgt -Wl,--wrap=__aeabi_fcmpun -Wl,--wrap=__aeabi_i2f -Wl,--wrap=__aeabi_l2f -Wl,--wrap=__aeabi_ui2f -Wl,--wrap=__aeabi_ul2f -Wl,--wrap=__aeabi_f2iz -Wl,--wrap=__aeabi_f2lz -Wl,--wrap=__aeabi_f2uiz -Wl,--wrap=__aeabi_f2ulz -Wl,--wrap=__aeabi_f2d -Wl,--wrap=sqrtf -Wl,--wrap=cosf -Wl,--wrap=sinf -Wl,--wrap=tanf -Wl,--wrap=atan2f -Wl,--wrap=expf -Wl,--wrap=logf -Wl,--wrap=ldexpf -Wl,--wrap=copysignf -Wl,--wrap=truncf -Wl,--wrap=floorf -Wl,--wrap=ceilf -Wl,--wrap=roundf -Wl,--wrap=sincosf -Wl,--wrap=asinf -Wl,--wrap=acosf -Wl,--wrap=atanf -Wl,--wrap=sinhf -Wl,--wrap=coshf -Wl,--wrap=tanhf -Wl,--wrap=asinhf -Wl,--wrap=acoshf -Wl,--wrap=atanhf -Wl,--wrap=exp2f -Wl,--wrap=log2f -Wl,--wrap=exp10f -Wl,--wrap=log10f -Wl,--wrap=powf -Wl,--wrap=powintf -Wl,--wrap=hypotf -Wl,--wrap=cbrtf -Wl,--wrap=fmodf -Wl,--wrap=dremf -Wl,--wrap=remainderf -Wl,--wrap=remquof -Wl,--wrap=expm1f -Wl,--wrap=log1pf -Wl,--wrap=fmaf -Wl,--wrap=memcpy -Wl,--wrap=memset -Wl,--wrap=__aeabi_memcpy -Wl,--wrap=__aeabi_memset -Wl,--wrap=__aeabi_memcpy4 -Wl,--wrap=__aeabi_memset4 -Wl,--wrap=__aeabi_memcpy8 -Wl,--wrap=__aeabi_memset8 + +LDFLAGS = $(CFLAGS) $(PICO_LDFLAGS) -Wl,-T,link.ld -Wl,-Map=$@.map -Wl,-cref -Wl,--gc-sections + +# Use toolchain libm if we're not using our own. +ifndef INTERNAL_LIBM +LIBS += -lm +endif + +LDFLAGS += -mthumb -mcpu=cortex-m0plus + +SRC_SDK := \ + src/common/pico_sync/critical_section.c \ + src/common/pico_sync/lock_core.c \ + src/common/pico_sync/mutex.c \ + src/common/pico_time/time.c \ + src/common/pico_util/pheap.c \ + src/rp2_common/hardware_adc/adc.c \ + src/rp2_common/hardware_claim/claim.c \ + src/rp2_common/hardware_clocks/clocks.c \ + src/rp2_common/hardware_dma/dma.c \ + src/rp2_common/hardware_flash/flash.c \ + src/rp2_common/hardware_gpio/gpio.c \ + src/rp2_common/hardware_i2c/i2c.c \ + src/rp2_common/hardware_irq/irq.c \ + src/rp2_common/hardware_pio/pio.c \ + src/rp2_common/hardware_pll/pll.c \ + src/rp2_common/hardware_spi/spi.c \ + src/rp2_common/hardware_sync/sync.c \ + src/rp2_common/hardware_timer/timer.c \ + src/rp2_common/hardware_uart/uart.c \ + src/rp2_common/hardware_watchdog/watchdog.c \ + src/rp2_common/hardware_xosc/xosc.c \ + src/rp2_common/pico_bootrom/bootrom.c \ + src/rp2_common/pico_double/double_init_rom.c \ + src/rp2_common/pico_fix/rp2040_usb_device_enumeration/rp2040_usb_device_enumeration.c \ + src/rp2_common/pico_float/float_init_rom.c \ + src/rp2_common/pico_float/float_math.c \ + src/rp2_common/pico_multicore/multicore.c \ + src/rp2_common/pico_platform/platform.c \ + src/rp2_common/pico_printf/printf.c \ + src/rp2_common/pico_runtime/runtime.c \ + src/rp2_common/pico_stdio/stdio.c \ + +SRC_SDK := $(addprefix sdk/, $(SRC_SDK)) + +SRC_C += \ + boards/$(BOARD)/board.c \ + boards/$(BOARD)/pins.c \ + bindings/rp2pio/StateMachine.c \ + bindings/rp2pio/__init__.c \ + common-hal/rp2pio/StateMachine.c \ + common-hal/rp2pio/__init__.c \ + background.c \ + peripherals/pins.c \ + fatfs_port.c \ + lib/libc/string0.c \ + lib/mp-readline/readline.c \ + lib/oofatfs/ff.c \ + lib/oofatfs/option/ccsbcs.c \ + lib/timeutils/timeutils.c \ + lib/tinyusb/src/portable/raspberrypi/rp2040/dcd_rp2040.c \ + lib/tinyusb/src/portable/raspberrypi/rp2040/rp2040_usb.c \ + lib/utils/buffer_helper.c \ + lib/utils/context_manager_helpers.c \ + lib/utils/interrupt_char.c \ + lib/utils/pyexec.c \ + lib/utils/stdout_helpers.c \ + lib/utils/sys_stdio_mphal.c \ + mphalport.c \ + supervisor/shared/memory.c \ + +SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(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)) + +# There may be duplicates between SRC_COMMON_HAL_EXPANDED and SRC_SHARED_MODULE_EXPANDED, +# because a few modules have files both in common-hal/ and shared-modules/. +# Doing a $(sort ...) removes duplicates as part of sorting. +SRC_COMMON_HAL_SHARED_MODULE_EXPANDED = $(sort $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED)) + +SRC_S = supervisor/$(CHIP_FAMILY)_cpu.s +SRC_S_UPPER = bs2_default_padded_checksummed.S \ + sdk/src/rp2_common/hardware_divider/divider.S \ + sdk/src/rp2_common/hardware_irq/irq_handler_chain.S \ + sdk/src/rp2_common/pico_bit_ops/bit_ops_aeabi.S \ + sdk/src/rp2_common/pico_double/double_aeabi.S \ + sdk/src/rp2_common/pico_double/double_v1_rom_shim.S \ + sdk/src/rp2_common/pico_divider/divider.S \ + sdk/src/rp2_common/pico_float/float_aeabi.S \ + sdk/src/rp2_common/pico_float/float_v1_rom_shim.S \ + sdk/src/rp2_common/pico_int64_ops/pico_int64_ops_aeabi.S \ + sdk/src/rp2_common/pico_mem_ops/mem_ops_aeabi.S \ + sdk/src/rp2_common/pico_standard_link/crt0.S \ + +OBJ = $(PY_O) $(SUPERVISOR_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) +OBJ += $(addprefix $(BUILD)/, $(SRC_SDK:.c=.o)) +OBJ += $(addprefix $(BUILD)/, $(SRC_COMMON_HAL_SHARED_MODULE_EXPANDED:.c=.o)) +ifeq ($(INTERNAL_LIBM),1) +OBJ += $(addprefix $(BUILD)/, $(SRC_LIBM:.c=.o)) +endif +OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o)) +OBJ += $(addprefix $(BUILD)/, $(SRC_S_UPPER:.S=.o)) +OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o)) + + +SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED) + +all: $(BUILD)/firmware.uf2 + +$(BUILD)/firmware.elf: $(OBJ) link.ld + $(STEPECHO) "LINK $@" + $(Q)$(CC) -o $@ $(LDFLAGS) $(OBJ) + $(Q)$(SIZE) $@ | $(PYTHON3) $(TOP)/tools/build_memory_info.py link.ld + +$(BUILD)/firmware.bin: $(BUILD)/firmware.elf + $(STEPECHO) "Create $@" + $(Q)$(OBJCOPY) -O binary $^ $@ + +$(BUILD)/firmware.uf2: $(BUILD)/firmware.bin + $(STEPECHO) "Create $@" + $(Q)$(PYTHON3) $(TOP)/tools/uf2/utils/uf2conv.py -f 0xe48bff56 -b 0x10000000 -c -o $@ $^ + +include $(TOP)/py/mkrules.mk + +# Print out the value of a make variable. +# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile +print-%: + @echo $* = $($*) diff --git a/ports/raspberrypi/README.rst b/ports/raspberrypi/README.rst new file mode 100644 index 0000000000000..d6ad9b333543a --- /dev/null +++ b/ports/raspberrypi/README.rst @@ -0,0 +1,18 @@ +RP2040 +================== + +This port supports many development boards that utilize RP2040 chips. See +https://circuitpython.org/downloads for all supported boards. + + +Building +-------- + +For build instructions see this guide: https://learn.adafruit.com/building-circuitpython/ + + +Port Specific modules +--------------------- + +.. toctree:: + ../../shared-bindings/rp2pio/index diff --git a/ports/raspberrypi/background.c b/ports/raspberrypi/background.c new file mode 100644 index 0000000000000..c85b83b41ed94 --- /dev/null +++ b/ports/raspberrypi/background.c @@ -0,0 +1,44 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "background.h" + +#include "supervisor/filesystem.h" +#include "supervisor/shared/tick.h" +#include "supervisor/usb.h" + +#include "py/runtime.h" +#include "shared-module/network/__init__.h" +#include "supervisor/shared/stack.h" +#include "supervisor/port.h" + +#if CIRCUITPY_DISPLAYIO +#include "shared-module/displayio/__init__.h" +#endif + +void port_start_background_task(void) {} +void port_finish_background_task(void) {} + +void port_background_task(void) {} diff --git a/ports/raspberrypi/background.h b/ports/raspberrypi/background.h new file mode 100644 index 0000000000000..c8e23e2a578fa --- /dev/null +++ b/ports/raspberrypi/background.h @@ -0,0 +1,32 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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. + */ + +#ifndef MICROPY_INCLUDED_RASPBERRYPI_BACKGROUND_H +#define MICROPY_INCLUDED_RASPBERRYPI_BACKGROUND_H + +#include + +#endif // MICROPY_INCLUDED_RASPBERRYPI_BACKGROUND_H diff --git a/ports/raspberrypi/bindings/rp2pio/StateMachine.c b/ports/raspberrypi/bindings/rp2pio/StateMachine.c new file mode 100644 index 0000000000000..f472583ff1b18 --- /dev/null +++ b/ports/raspberrypi/bindings/rp2pio/StateMachine.c @@ -0,0 +1,449 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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. + */ + +// This file contains all of the Python API definitions for the +// rp2pio.StateMachine class. + +#include + +#include "shared-bindings/microcontroller/Pin.h" +#include "bindings/rp2pio/StateMachine.h" +#include "shared-bindings/util.h" + +#include "lib/utils/buffer_helper.h" +#include "lib/utils/context_manager_helpers.h" +#include "lib/utils/interrupt_char.h" +#include "py/mperrno.h" +#include "py/objproperty.h" +#include "py/runtime.h" +#include "supervisor/shared/translate.h" + + +//| class StateMachine: +//| """A single PIO StateMachine +//| +//| The programmable I/O peripheral on the RP2 series of microcontrollers is +//| unique. It is a collection of generic state machines that can be +//| used for a variety of protocols. State machines may be independent or +//| coordinated. Program memory and IRQs are shared between the state machines +//| in a particular PIO instance. They are independent otherwise. +//| +//| This class is designed to facilitate sharing of PIO resources. By default, +//| it is assumed that the state machine is used on it's own and can be placed +//| in either PIO. State machines with the same program will be placed in the +//| same PIO if possible. To ensure multiple state machines share a PIO use +//| the ``colocate`` kwarg during construction and create them one after another.""" +//| +//| def __init__(self, +//| program: ReadableBuffer, +//| frequency: int, +//| *, +//| init: Optional[ReadableBuffer] = None, +//| first_out_pin: Optional[microcontroller.Pin] = None, +//| out_pin_count: int = 1, +//| first_in_pin: Optional[microcontroller.Pin] = None, +//| in_pin_count: int = 1, +//| first_set_pin: Optional[microcontroller.Pin] = None, +//| set_pin_count: int = 1, +//| first_sideset_pin: Optional[microcontroller.Pin] = None, +//| sideset_pin_count: int = 1, +//| exclusive_pin_use: bool = True, +//| auto_pull: bool = False, +//| pull_threshold : int = 32, +//| out_shift_right : bool = True, +//| auto_push: bool = False, +//| push_threshold : int = 32, +//| in_shift_right : bool = True) -> None: +// //| colocate: Union[int, StateMachine, None] = None +//| +//| """Construct a StateMachine object on the given pins with the given program. +//| +//| :param ReadableBuffer program: the program to run with the state machine +//| :param int frequency: the target clock frequency of the state machine. Actual may be less. +//| :param ReadableBuffer init: a program to run once at start up. This is run after program +//| is started so instructions may be intermingled +//| :param ~microcontroller.Pin first_out_pin: the first pin to use with the OUT instruction +//| :param int out_pin_count: the count of consecutive pins to use with OUT starting at first_out_pin +//| :param ~microcontroller.Pin first_in_pin: the first pin to use with the IN instruction +//| :param int in_pin_count: the count of consecutive pins to use with IN starting at first_in_pin +//| :param ~microcontroller.Pin first_set_pin: the first pin to use with the SET instruction +//| :param int set_pin_count: the count of consecutive pins to use with SET starting at first_set_pin +//| :param ~microcontroller.Pin first_sideset_pin: the first pin to use with a side set +//| :param int sideset_pin_count: the count of consecutive pins to use with a side set starting at first_sideset_pin +//| :param bool exclusive_pin_use: When True, do not share any pins with other state machines. Pins are never shared with other peripherals +//| :param bool auto_pull: When True, automatically load data from the tx FIFO into the +//| output shift register (OSR) when an OUT instruction shifts more than pull_threshold bits +//| :param int pull_threshold: Number of bits to shift before loading a new value into the OSR from the tx FIFO +//| :param bool out_shift_right: When True, data is shifted out the right side (LSB) of the +//| OSR. It is shifted out the left (MSB) otherwise. NOTE! This impacts data alignment +//| when the number of bytes is not a power of two (1, 2 or 4 bytes). +//| :param bool auto_push: When True, automatically save data from input shift register +//| (ISR) into the rx FIFO when an IN instruction shifts more than push_threshold bits +//| :param int push_threshold: Number of bits to shift before saving the ISR value to the RX FIFO +//| :param bool in_shift_right: When True, data is shifted into the right side (LSB) of the +//| ISR. It is shifted into the left (MSB) otherwise. NOTE! This impacts data alignment +//| when the number of bytes is not a power of two (1, 2 or 4 bytes).""" +//| ... +//| + +STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + rp2pio_statemachine_obj_t *self = m_new_obj(rp2pio_statemachine_obj_t); + self->base.type = &rp2pio_statemachine_type; + enum { ARG_program, ARG_frequency, ARG_init, + ARG_first_out_pin, ARG_out_pin_count, + ARG_first_in_pin, ARG_in_pin_count, + ARG_first_set_pin, ARG_set_pin_count, + ARG_first_sideset_pin, ARG_sideset_pin_count, + ARG_exclusive_pin_use, + ARG_auto_pull, ARG_pull_threshold, ARG_out_shift_right, + ARG_auto_push, ARG_push_threshold, ARG_in_shift_right}; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_program, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_frequency, MP_ARG_REQUIRED | MP_ARG_INT }, + { MP_QSTR_init, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, + { MP_QSTR_first_out_pin, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, + { MP_QSTR_out_pin_count, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} }, + { MP_QSTR_first_in_pin, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, + { MP_QSTR_in_pin_count, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} }, + { MP_QSTR_first_set_pin, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, + { MP_QSTR_set_pin_count, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} }, + { MP_QSTR_first_sideset_pin, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, + { MP_QSTR_sideset_pin_count, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} }, + { MP_QSTR_exclusive_pin_use, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = true} }, + { MP_QSTR_auto_pull, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, + { MP_QSTR_pull_threshold, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 32} }, + { MP_QSTR_out_shift_right, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = true} }, + { MP_QSTR_auto_push, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, + { MP_QSTR_push_threshold, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 32} }, + { MP_QSTR_in_shift_right, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = true} }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(args[ARG_program].u_obj, &bufinfo, MP_BUFFER_READ); + + mp_buffer_info_t init_bufinfo; + init_bufinfo.len = 0; + mp_get_buffer(args[ARG_init].u_obj, &init_bufinfo, MP_BUFFER_READ); + + // We don't validate pin in use here because we may be ok sharing them within a PIO. + mcu_pin_obj_t *first_out_pin = validate_obj_is_pin_or_none(args[ARG_first_out_pin].u_obj); + if (args[ARG_out_pin_count].u_int < 1) { + mp_raise_ValueError(translate("Pin count must be at least 1")); + } + mcu_pin_obj_t *first_in_pin = validate_obj_is_pin_or_none(args[ARG_first_in_pin].u_obj); + if (args[ARG_in_pin_count].u_int < 1) { + mp_raise_ValueError(translate("Pin count must be at least 1")); + } + mcu_pin_obj_t *first_set_pin = validate_obj_is_pin_or_none(args[ARG_first_set_pin].u_obj); + if (args[ARG_set_pin_count].u_int < 1) { + mp_raise_ValueError(translate("Pin count must be at least 1")); + } + if (args[ARG_set_pin_count].u_int > 5) { + mp_raise_ValueError(translate("Set pin count must be between 1 and 5")); + } + mcu_pin_obj_t *first_sideset_pin = validate_obj_is_pin_or_none(args[ARG_first_sideset_pin].u_obj); + if (args[ARG_sideset_pin_count].u_int < 1) { + mp_raise_ValueError(translate("Pin count must be at least 1")); + } + if (args[ARG_sideset_pin_count].u_int > 5) { + mp_raise_ValueError(translate("Side set pin count must be between 1 and 5")); + } + + mp_int_t pull_threshold = args[ARG_pull_threshold].u_int; + mp_int_t push_threshold = args[ARG_push_threshold].u_int; + if (pull_threshold < 1 || pull_threshold > 32) { + mp_raise_ValueError(translate("pull_threshold must be between 1 and 32")); + } + if (push_threshold < 1 || push_threshold > 32) { + mp_raise_ValueError(translate("push_threshold must be between 1 and 32")); + } + + if (bufinfo.len < 2) { + mp_raise_ValueError(translate("Program must contain at least one 16-bit instruction.")); + } + if (bufinfo.len % 2 != 0) { + mp_raise_ValueError(translate("Program size invalid")); + } + if (bufinfo.len > 32) { + mp_raise_ValueError(translate("Program too large")); + } + + if (init_bufinfo.len % 2 != 0) { + mp_raise_ValueError(translate("Init program size invalid")); + } + + common_hal_rp2pio_statemachine_construct(self, + bufinfo.buf, bufinfo.len / 2, + args[ARG_frequency].u_int, + init_bufinfo.buf, init_bufinfo.len / 2, + first_out_pin, args[ARG_out_pin_count].u_int, + first_in_pin, args[ARG_in_pin_count].u_int, + first_set_pin, args[ARG_set_pin_count].u_int, + first_sideset_pin, args[ARG_sideset_pin_count].u_int, + args[ARG_exclusive_pin_use].u_bool, + args[ARG_auto_pull].u_bool, pull_threshold, args[ARG_out_shift_right].u_bool, + args[ARG_auto_push].u_bool, push_threshold, args[ARG_in_shift_right].u_bool); + return MP_OBJ_FROM_PTR(self); +} + +//| def deinit(self) -> None: +//| """Turn off the state machine and release it's resources.""" +//| ... +//| +STATIC mp_obj_t rp2pio_statemachine_obj_deinit(mp_obj_t self_in) { + rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_rp2pio_statemachine_deinit(self); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_deinit_obj, rp2pio_statemachine_obj_deinit); + +//| def __enter__(self) -> SPI: +//| """No-op used by Context Managers. +//| Provided by context manager helper.""" +//| ... +//| + +//| def __exit__(self) -> None: +//| """Automatically deinitializes the hardware when exiting a context. See +//| :ref:`lifetime-and-contextmanagers` for more info.""" +//| ... +//| +STATIC mp_obj_t rp2pio_statemachine_obj___exit__(size_t n_args, const mp_obj_t *args) { + (void)n_args; + common_hal_rp2pio_statemachine_deinit(args[0]); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(rp2pio_statemachine_obj___exit___obj, 4, 4, rp2pio_statemachine_obj___exit__); + + +STATIC void check_for_deinit(rp2pio_statemachine_obj_t *self) { + if (common_hal_rp2pio_statemachine_deinited(self)) { + raise_deinited_error(); + } +} + +// // | def restart(self, *other_state_machines) -> None: +// // | """Restarts this state machine and any others given. They must share +// // | an underlying PIO. An exception will be raised otherwise.""" +// // | ... +// // | + +//| def write(self, buffer: ReadableBuffer, *, start: int = 0, end: Optional[int] = None) -> None: +//| """Write the data contained in ``buffer`` to the state machine. If the buffer is empty, nothing happens. +//| +//| :param ~_typing.ReadableBuffer buffer: Write out the data in this buffer +//| :param int start: Start of the slice of ``buffer`` to write out: ``buffer[start:end]`` +//| :param int end: End of the slice; this index is not included. Defaults to ``len(buffer)``""" +//| ... +//| + +STATIC mp_obj_t rp2pio_statemachine_write(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_buffer, ARG_start, ARG_end }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, + }; + rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + check_for_deinit(self); + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_READ); + int32_t start = args[ARG_start].u_int; + size_t length = bufinfo.len; + normalize_buffer_bounds(&start, args[ARG_end].u_int, &length); + + if (length == 0) { + return mp_const_none; + } + + bool ok = common_hal_rp2pio_statemachine_write(self, ((uint8_t*)bufinfo.buf) + start, length); + if (mp_hal_is_interrupted()) { + return mp_const_none; + } + if (!ok) { + mp_raise_OSError(MP_EIO); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_write_obj, 2, rp2pio_statemachine_write); + + +// // | def readinto(self, buffer: WriteableBuffer, *, start: int = 0, end: Optional[int] = None) -> None: +// // | """Read into ``buffer``. If the number of bytes to read is 0, nothing happens. +// // | +// // | :param ~_typing.WriteableBuffer buffer: Read data into this buffer +// // | :param int start: Start of the slice of ``buffer`` to read into: ``buffer[start:end]`` +// // | :param int end: End of the slice; this index is not included. Defaults to ``len(buffer)`` +// // | :param int write_value: Value to write while reading. (Usually ignored.)""" +// // | ... +// // | + +// STATIC mp_obj_t rp2pio_statemachine_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +// enum { ARG_buffer, ARG_start, ARG_end, ARG_write_value }; +// static const mp_arg_t allowed_args[] = { +// { MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, +// { MP_QSTR_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, +// { MP_QSTR_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, +// { MP_QSTR_write_value,MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, +// }; +// rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); +// check_for_deinit(self); +// check_lock(self); +// mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; +// mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + +// mp_buffer_info_t bufinfo; +// mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_WRITE); +// int32_t start = args[ARG_start].u_int; +// size_t length = bufinfo.len; +// normalize_buffer_bounds(&start, args[ARG_end].u_int, &length); + +// if (length == 0) { +// return mp_const_none; +// } + +// bool ok = common_hal_rp2pio_statemachine_read(self, ((uint8_t*)bufinfo.buf) + start, length, args[ARG_write_value].u_int); +// if (!ok) { +// mp_raise_OSError(MP_EIO); +// } +// return mp_const_none; +// } +// MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_readinto_obj, 2, rp2pio_statemachine_readinto); + +// //| def write_readinto(self, buffer_out: ReadableBuffer, buffer_in: WriteableBuffer, *, out_start: int = 0, out_end: Optional[int] = None, in_start: int = 0, in_end: Optional[int] = None) -> None: +// //| """Write out the data in ``buffer_out`` while simultaneously reading data into ``buffer_in``. +// //| The SPI object must be locked. +// //| The lengths of the slices defined by ``buffer_out[out_start:out_end]`` and ``buffer_in[in_start:in_end]`` +// //| must be equal. +// //| If buffer slice lengths are both 0, nothing happens. +// //| +// //| :param ~_typing.ReadableBuffer buffer_out: Write out the data in this buffer +// //| :param ~_typing.WriteableBuffer buffer_in: Read data into this buffer +// //| :param int out_start: Start of the slice of buffer_out to write out: ``buffer_out[out_start:out_end]`` +// //| :param int out_end: End of the slice; this index is not included. Defaults to ``len(buffer_out)`` +// //| :param int in_start: Start of the slice of ``buffer_in`` to read into: ``buffer_in[in_start:in_end]`` +// //| :param int in_end: End of the slice; this index is not included. Defaults to ``len(buffer_in)``""" +// //| ... +// //| + +// STATIC mp_obj_t rp2pio_statemachine_write_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +// enum { ARG_buffer_out, ARG_buffer_in, ARG_out_start, ARG_out_end, ARG_in_start, ARG_in_end }; +// static const mp_arg_t allowed_args[] = { +// { MP_QSTR_buffer_out, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, +// { MP_QSTR_buffer_in, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, +// { MP_QSTR_out_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, +// { MP_QSTR_out_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, +// { MP_QSTR_in_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, +// { MP_QSTR_in_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, +// }; +// rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); +// check_for_deinit(self); +// check_lock(self); +// mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; +// mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + +// mp_buffer_info_t buf_out_info; +// mp_get_buffer_raise(args[ARG_buffer_out].u_obj, &buf_out_info, MP_BUFFER_READ); +// int32_t out_start = args[ARG_out_start].u_int; +// size_t out_length = buf_out_info.len; +// normalize_buffer_bounds(&out_start, args[ARG_out_end].u_int, &out_length); + +// mp_buffer_info_t buf_in_info; +// mp_get_buffer_raise(args[ARG_buffer_in].u_obj, &buf_in_info, MP_BUFFER_WRITE); +// int32_t in_start = args[ARG_in_start].u_int; +// size_t in_length = buf_in_info.len; +// normalize_buffer_bounds(&in_start, args[ARG_in_end].u_int, &in_length); + +// if (out_length != in_length) { +// mp_raise_ValueError(translate("buffer slices must be of equal length")); +// } + +// if (out_length == 0) { +// return mp_const_none; +// } + +// bool ok = common_hal_rp2pio_statemachine_transfer(self, +// ((uint8_t*)buf_out_info.buf) + out_start, +// ((uint8_t*)buf_in_info.buf) + in_start, +// out_length); +// if (!ok) { +// mp_raise_OSError(MP_EIO); +// } +// return mp_const_none; +// } +// MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_write_readinto_obj, 2, rp2pio_statemachine_write_readinto); + +//| frequency: int +//| """The actual state machine frequency. This may not match the frequency requested +//| due to internal limitations.""" +//| + +STATIC mp_obj_t rp2pio_statemachine_obj_get_frequency(mp_obj_t self_in) { + rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_rp2pio_statemachine_get_frequency(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_get_frequency_obj, rp2pio_statemachine_obj_get_frequency); + +const mp_obj_property_t rp2pio_statemachine_frequency_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&rp2pio_statemachine_get_frequency_obj, + (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +STATIC const mp_rom_map_elem_t rp2pio_statemachine_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&rp2pio_statemachine_deinit_obj) }, + { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) }, + { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&rp2pio_statemachine_obj___exit___obj) }, + +// { MP_ROM_QSTR(MP_QSTR_restart), MP_ROM_PTR(&rp2pio_statemachine_configure_obj) }, + +// { MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&rp2pio_statemachine_readinto_obj) }, + { MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&rp2pio_statemachine_write_obj) }, +// { MP_ROM_QSTR(MP_QSTR_write_readinto), MP_ROM_PTR(&rp2pio_statemachine_write_readinto_obj) }, + { MP_ROM_QSTR(MP_QSTR_frequency), MP_ROM_PTR(&rp2pio_statemachine_frequency_obj) } +}; +STATIC MP_DEFINE_CONST_DICT(rp2pio_statemachine_locals_dict, rp2pio_statemachine_locals_dict_table); + +const mp_obj_type_t rp2pio_statemachine_type = { + { &mp_type_type }, + .name = MP_QSTR_StateMachine, + .make_new = rp2pio_statemachine_make_new, + .locals_dict = (mp_obj_dict_t*)&rp2pio_statemachine_locals_dict, +}; + +rp2pio_statemachine_obj_t *validate_obj_is_statemachine(mp_obj_t obj) { + if (!MP_OBJ_IS_TYPE(obj, &rp2pio_statemachine_type)) { + mp_raise_TypeError_varg(translate("Expected a %q"), rp2pio_statemachine_type.name); + } + return MP_OBJ_TO_PTR(obj); +} diff --git a/ports/raspberrypi/bindings/rp2pio/StateMachine.h b/ports/raspberrypi/bindings/rp2pio/StateMachine.h new file mode 100644 index 0000000000000..5ff20a75bf6d0 --- /dev/null +++ b/ports/raspberrypi/bindings/rp2pio/StateMachine.h @@ -0,0 +1,71 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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. + */ + +#ifndef MICROPY_INCLUDED_RASPBERRYPI_BINDINGS_RP2PIO_STATEMACHINE_H +#define MICROPY_INCLUDED_RASPBERRYPI_BINDINGS_RP2PIO_STATEMACHINE_H + +#include "py/obj.h" + +#include "common-hal/microcontroller/Pin.h" +#include "common-hal/rp2pio/StateMachine.h" + +// Type object used in Python. Should be shared between ports. +extern const mp_obj_type_t rp2pio_statemachine_type; + +// Construct an underlying SPI object. +extern void common_hal_rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, + const uint16_t* program, size_t program_len, + size_t frequency, + const uint16_t* init, size_t init_len, + const mcu_pin_obj_t * first_out_pin, uint8_t out_pin_count, + const mcu_pin_obj_t * first_in_pin, uint8_t in_pin_count, + const mcu_pin_obj_t * first_set_pin, uint8_t set_pin_count, + const mcu_pin_obj_t * first_sideset_pin, uint8_t sideset_pin_count, + bool exclusive_pin_use, + bool auto_pull, uint8_t pull_threshold, bool out_shift_right, + bool auto_push, uint8_t push_threshold, bool in_shift_right); + +extern void common_hal_rp2pio_statemachine_deinit(rp2pio_statemachine_obj_t *self); +extern bool common_hal_rp2pio_statemachine_deinited(rp2pio_statemachine_obj_t *self); + +// Writes out the given data. +extern bool common_hal_rp2pio_statemachine_write(rp2pio_statemachine_obj_t *self, const uint8_t *data, size_t len); + +// // Reads in len bytes while outputting zeroes. +// extern bool common_hal_rp2pio_statemachine_read(rp2pio_statemachine_obj_t *self, uint8_t *data, size_t len, uint8_t write_value); + +// // Reads and write len bytes simultaneously. +// extern bool common_hal_rp2pio_statemachine_transfer(rp2pio_statemachine_obj_t *self, +// const uint8_t *data_out, size_t out_len, +// uint8_t *data_in, size_t in_len); + +// Return actual SPI bus frequency. +uint32_t common_hal_rp2pio_statemachine_get_frequency(rp2pio_statemachine_obj_t* self); + +// This is used by the supervisor to claim SPI devices indefinitely. +// extern void common_hal_rp2pio_statemachine_never_reset(rp2pio_statemachine_obj_t *self); + +#endif // MICROPY_INCLUDED_RASPBERRYPI_BINDINGS_RP2PIO_STATEMACHINE_H diff --git a/ports/raspberrypi/bindings/rp2pio/__init__.c b/ports/raspberrypi/bindings/rp2pio/__init__.c new file mode 100644 index 0000000000000..dd5808cd5e4ef --- /dev/null +++ b/ports/raspberrypi/bindings/rp2pio/__init__.c @@ -0,0 +1,45 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "py/obj.h" +#include "py/runtime.h" + +#include "bindings/rp2pio/StateMachine.h" + +//| """Hardware interface to RP2 series' programmable IO (PIO) peripheral.""" +//| + +STATIC const mp_rom_map_elem_t rp2pio_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_rp2pio) }, + { MP_ROM_QSTR(MP_QSTR_StateMachine), MP_ROM_PTR(&rp2pio_statemachine_type) }, +}; + +STATIC MP_DEFINE_CONST_DICT(rp2pio_module_globals, rp2pio_module_globals_table); + +const mp_obj_module_t rp2pio_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&rp2pio_module_globals, +}; diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040/board.c b/ports/raspberrypi/boards/adafruit_feather_rp2040/board.c new file mode 100644 index 0000000000000..8686f6d0c2389 --- /dev/null +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040/board.c @@ -0,0 +1,44 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "supervisor/board.h" + +#include "shared-bindings/microcontroller/Pin.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" + +void board_init(void) { + common_hal_never_reset_pin(&pin_GPIO17); + gpio_init(17); + gpio_set_dir(17, GPIO_OUT); + gpio_put(17, true); +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.h b/ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.h new file mode 100644 index 0000000000000..6a2d063d79a4c --- /dev/null +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.h @@ -0,0 +1,14 @@ +#define MICROPY_HW_BOARD_NAME "Adafruit Feather RP2040" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO16) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO3) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO2) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO18) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO19) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO20) + +// #define DEFAULT_UART_BUS_RX (&pin_PA11) +// #define DEFAULT_UART_BUS_TX (&pin_PA10) diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.mk b/ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.mk new file mode 100644 index 0000000000000..97b3cd9495319 --- /dev/null +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.mk @@ -0,0 +1,10 @@ +USB_VID = 0x239A +USB_PID = 0x80F2 +USB_PRODUCT = "Feather RP2040" +USB_MANUFACTURER = "Adafruit" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +INTERNAL_FLASH_FILESYSTEM = 1 + diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040/pins.c b/ports/raspberrypi/boards/adafruit_feather_rp2040/pins.c new file mode 100644 index 0000000000000..1617ac865e9f4 --- /dev/null +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040/pins.c @@ -0,0 +1,36 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_D24), MP_ROM_PTR(&pin_GPIO24) }, + { MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO17) }, + + { 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/raspberrypi/boards/raspberry_pi_pico/board.c b/ports/raspberrypi/boards/raspberry_pi_pico/board.c new file mode 100644 index 0000000000000..80ec5de32b095 --- /dev/null +++ b/ports/raspberrypi/boards/raspberry_pi_pico/board.c @@ -0,0 +1,38 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "supervisor/board.h" + +void board_init(void) +{ +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} diff --git a/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.h b/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.h new file mode 100644 index 0000000000000..4b0a220287a59 --- /dev/null +++ b/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.h @@ -0,0 +1,15 @@ +// LEDs +// #define MICROPY_HW_LED_STATUS (&pin_PA17) + +#define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico" +#define MICROPY_HW_MCU_NAME "rp2040" + +// #define DEFAULT_I2C_BUS_SCL (&pin_PA23) +// #define DEFAULT_I2C_BUS_SDA (&pin_PA22) + +// #define DEFAULT_SPI_BUS_SCK (&pin_PB11) +// #define DEFAULT_SPI_BUS_MOSI (&pin_PB10) +// #define DEFAULT_SPI_BUS_MISO (&pin_PA12) + +// #define DEFAULT_UART_BUS_RX (&pin_PA11) +// #define DEFAULT_UART_BUS_TX (&pin_PA10) diff --git a/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk b/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk new file mode 100644 index 0000000000000..11b06449c8751 --- /dev/null +++ b/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk @@ -0,0 +1,10 @@ +USB_VID = 0x239A +USB_PID = 0x80F4 +USB_PRODUCT = "Pico" +USB_MANUFACTURER = "Raspberry Pi" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +INTERNAL_FLASH_FILESYSTEM = 1 + diff --git a/ports/raspberrypi/boards/raspberry_pi_pico/pins.c b/ports/raspberrypi/boards/raspberry_pi_pico/pins.c new file mode 100644 index 0000000000000..38ec75c4ade21 --- /dev/null +++ b/ports/raspberrypi/boards/raspberry_pi_pico/pins.c @@ -0,0 +1,38 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_GP25), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); diff --git a/ports/raspberrypi/bs2_default_padded_checksummed.S b/ports/raspberrypi/bs2_default_padded_checksummed.S new file mode 100644 index 0000000000000..d77f4867c6479 --- /dev/null +++ b/ports/raspberrypi/bs2_default_padded_checksummed.S @@ -0,0 +1,20 @@ +// Padded and checksummed version of: /Users/graham/dev/mu/pico_sdk/cmake-build-debug-mu/src/rp2_common/boot_stage2/bs2_default.bin + +.section .boot2, "a" + +.byte 0x00, 0xb5, 0x2f, 0x4b, 0x21, 0x20, 0x58, 0x60, 0x98, 0x68, 0x02, 0x21, 0x88, 0x43, 0x98, 0x60 +.byte 0xd8, 0x60, 0x18, 0x61, 0x58, 0x61, 0x2b, 0x4b, 0x00, 0x21, 0x99, 0x60, 0x02, 0x21, 0x59, 0x61 +.byte 0x01, 0x21, 0xf0, 0x22, 0x99, 0x50, 0x28, 0x49, 0x19, 0x60, 0x01, 0x21, 0x99, 0x60, 0x35, 0x20 +.byte 0x00, 0xf0, 0x3e, 0xf8, 0x02, 0x22, 0x90, 0x42, 0x14, 0xd0, 0x06, 0x21, 0x19, 0x66, 0x00, 0xf0 +.byte 0x2e, 0xf8, 0x19, 0x6e, 0x01, 0x21, 0x19, 0x66, 0x00, 0x20, 0x18, 0x66, 0x1a, 0x66, 0x00, 0xf0 +.byte 0x26, 0xf8, 0x19, 0x6e, 0x19, 0x6e, 0x19, 0x6e, 0x05, 0x20, 0x00, 0xf0, 0x29, 0xf8, 0x01, 0x21 +.byte 0x08, 0x42, 0xf9, 0xd1, 0x00, 0x21, 0x99, 0x60, 0x18, 0x49, 0x19, 0x60, 0x00, 0x21, 0x59, 0x60 +.byte 0x17, 0x49, 0x18, 0x48, 0x01, 0x60, 0x01, 0x21, 0x99, 0x60, 0xeb, 0x21, 0x19, 0x66, 0xa0, 0x21 +.byte 0x19, 0x66, 0x00, 0xf0, 0x0c, 0xf8, 0x00, 0x21, 0x99, 0x60, 0x13, 0x49, 0x11, 0x48, 0x01, 0x60 +.byte 0x01, 0x21, 0x99, 0x60, 0x01, 0xbc, 0x00, 0x28, 0x00, 0xd1, 0x10, 0x48, 0x00, 0x47, 0x03, 0xb5 +.byte 0x99, 0x6a, 0x04, 0x20, 0x01, 0x42, 0xfb, 0xd0, 0x01, 0x20, 0x01, 0x42, 0xf8, 0xd1, 0x03, 0xbd +.byte 0x02, 0xb5, 0x18, 0x66, 0x18, 0x66, 0xff, 0xf7, 0xf2, 0xff, 0x18, 0x6e, 0x18, 0x6e, 0x02, 0xbd +.byte 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x07, 0x00, 0x00, 0x03, 0x5f, 0x00 +.byte 0x21, 0x22, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x18, 0x22, 0x20, 0x00, 0xa0, 0x01, 0x01, 0x00, 0x10 +.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x27, 0x2a, 0x60 diff --git a/ports/raspberrypi/common-hal/analogio/AnalogIn.c b/ports/raspberrypi/common-hal/analogio/AnalogIn.c new file mode 100644 index 0000000000000..c51a749295d1b --- /dev/null +++ b/ports/raspberrypi/common-hal/analogio/AnalogIn.c @@ -0,0 +1,73 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "common-hal/analogio/AnalogIn.h" +#include "py/runtime.h" +#include "supervisor/shared/translate.h" + +#include "src/rp2_common/hardware_adc/include/hardware/adc.h" + +#define ADC_FIRST_PIN_NUMBER 26 +#define ADC_PIN_COUNT 4 + +void common_hal_analogio_analogin_construct(analogio_analogin_obj_t *self, const mcu_pin_obj_t *pin) { + if (pin->number < ADC_FIRST_PIN_NUMBER || pin->number > ADC_FIRST_PIN_NUMBER + ADC_PIN_COUNT) { + mp_raise_ValueError(translate("Pin does not have ADC capabilities")); + } + + adc_init(); + + adc_gpio_init(pin->number); + + claim_pin(pin); + self->pin = pin; +} + +bool common_hal_analogio_analogin_deinited(analogio_analogin_obj_t *self) { + return self->pin == NULL; +} + +void common_hal_analogio_analogin_deinit(analogio_analogin_obj_t *self) { + if (common_hal_analogio_analogin_deinited(self)) { + return; + } + + reset_pin_number(self->pin->number); + self->pin = NULL; +} + +uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) { + adc_select_input(self->pin->number - ADC_FIRST_PIN_NUMBER); + uint16_t value = adc_read(); + + // Map value to from 12 to 16 bits + return (value << 4); +} + +float common_hal_analogio_analogin_get_reference_voltage(analogio_analogin_obj_t *self) { + // The nominal VCC voltage + return 3.3f; +} diff --git a/ports/raspberrypi/common-hal/analogio/AnalogIn.h b/ports/raspberrypi/common-hal/analogio/AnalogIn.h new file mode 100644 index 0000000000000..ee9976e348d5d --- /dev/null +++ b/ports/raspberrypi/common-hal/analogio/AnalogIn.h @@ -0,0 +1,41 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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. + */ + +#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_ANALOGIO_ANALOGIN_H +#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_ANALOGIO_ANALOGIN_H + +#include "common-hal/microcontroller/Pin.h" + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + const mcu_pin_obj_t * pin; +} analogio_analogin_obj_t; + +void analogin_init(void); + +#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_ANALOGIO_ANALOGIN_H diff --git a/ports/raspberrypi/common-hal/analogio/AnalogOut.c b/ports/raspberrypi/common-hal/analogio/AnalogOut.c new file mode 100644 index 0000000000000..adafa15d5c913 --- /dev/null +++ b/ports/raspberrypi/common-hal/analogio/AnalogOut.c @@ -0,0 +1,48 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * 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 "shared-bindings/analogio/AnalogOut.h" + +#include +#include + +#include "py/mperrno.h" +#include "py/runtime.h" +#include "supervisor/shared/translate.h" + +void common_hal_analogio_analogout_construct(analogio_analogout_obj_t* self, const mcu_pin_obj_t *pin) { + mp_raise_RuntimeError(translate("AnalogOut functionality not supported")); +} + +bool common_hal_analogio_analogout_deinited(analogio_analogout_obj_t *self) { + return true; +} + +void common_hal_analogio_analogout_deinit(analogio_analogout_obj_t *self) { +} + +void common_hal_analogio_analogout_set_value(analogio_analogout_obj_t *self, uint16_t value) { +} diff --git a/ports/raspberrypi/common-hal/analogio/AnalogOut.h b/ports/raspberrypi/common-hal/analogio/AnalogOut.h new file mode 100644 index 0000000000000..7c7a61aa2d6d5 --- /dev/null +++ b/ports/raspberrypi/common-hal/analogio/AnalogOut.h @@ -0,0 +1,36 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Scott Shawcroft + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_ANALOGIO_ANALOGOUT_H +#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_ANALOGIO_ANALOGOUT_H + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; +} analogio_analogout_obj_t; + +#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_ANALOGIO_ANALOGOUT_H diff --git a/ports/raspberrypi/common-hal/analogio/__init__.c b/ports/raspberrypi/common-hal/analogio/__init__.c new file mode 100644 index 0000000000000..eea58c77d6315 --- /dev/null +++ b/ports/raspberrypi/common-hal/analogio/__init__.c @@ -0,0 +1 @@ +// No analogio module functions. diff --git a/ports/raspberrypi/common-hal/board/__init__.c b/ports/raspberrypi/common-hal/board/__init__.c new file mode 100644 index 0000000000000..3c7f30df2240e --- /dev/null +++ b/ports/raspberrypi/common-hal/board/__init__.c @@ -0,0 +1,34 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 + +#include "py/runtime.h" +#include "py/mphal.h" +#include "common-hal/microcontroller/Pin.h" + +// Pins aren't actually defined here. They are in the board specific directory +// such as boards/arduino_zero/pins.c. diff --git a/ports/raspberrypi/common-hal/busio/I2C.c b/ports/raspberrypi/common-hal/busio/I2C.c new file mode 100644 index 0000000000000..fa49e375e2da9 --- /dev/null +++ b/ports/raspberrypi/common-hal/busio/I2C.c @@ -0,0 +1,175 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "shared-bindings/busio/I2C.h" +#include "py/mperrno.h" +#include "py/runtime.h" + +#include "shared-bindings/microcontroller/__init__.h" +#include "supervisor/shared/translate.h" + +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" + +// Synopsys DW_apb_i2c (v2.01) IP + +#define NO_PIN 0xff + +STATIC bool never_reset_i2c[2]; +STATIC i2c_inst_t* i2c[2] = {i2c0, i2c1}; + +void reset_i2c(void) { + for (size_t i = 0; i < 2; i++) { + if (never_reset_i2c[i]) { + continue; + } + + i2c_deinit(i2c[i]); + } +} + +void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, + const mcu_pin_obj_t* scl, const mcu_pin_obj_t* sda, uint32_t frequency, uint32_t timeout) { + self->peripheral = NULL; + // I2C pins have a regular pattern. SCL is always odd and SDA is even. They match up in pairs + // so we can divide by two to get the instance. This pattern repeats. + if (scl->number % 2 == 1 && sda->number % 2 == 0 && scl->number / 2 == sda->number / 2) { + size_t instance = (scl->number / 2) % 2; + self->peripheral = i2c[instance]; + } + if (self->peripheral == NULL) { + mp_raise_ValueError(translate("Invalid pins")); + } + if ((i2c_get_hw(self->peripheral)->enable & I2C_IC_ENABLE_ENABLE_BITS) != 0) { + mp_raise_ValueError(translate("I2C peripheral in use")); + } + if (frequency > 1000000) { + mp_raise_ValueError(translate("Unsupported baudrate")); + } + +#if CIRCUITPY_REQUIRE_I2C_PULLUPS + // Test that the pins are in a high state. (Hopefully indicating they are pulled up.) + gpio_set_function(sda->number, GPIO_FUNC_SIO); + gpio_set_function(scl->number, GPIO_FUNC_SIO); + gpio_set_dir(sda->number, GPIO_IN); + gpio_set_dir(scl->number, GPIO_IN); + + gpio_set_pulls(sda->number, false, true); + gpio_set_pulls(scl->number, false, true); + + common_hal_mcu_delay_us(10); + + gpio_set_pulls(sda->number, false, false); + gpio_set_pulls(scl->number, false, false); + + // We must pull up within 3us to achieve 400khz. + common_hal_mcu_delay_us(3); + + if (!gpio_get(sda->number) || !gpio_get(scl->number)) { + reset_pin_number(sda->number); + reset_pin_number(scl->number); + mp_raise_RuntimeError(translate("SDA or SCL needs a pull up")); + } +#endif + + gpio_set_function(sda->number, GPIO_FUNC_I2C); + gpio_set_function(scl->number, GPIO_FUNC_I2C); + + self->baudrate = i2c_init(self->peripheral, frequency); + + self->sda_pin = sda->number; + self->scl_pin = scl->number; + claim_pin(sda); + claim_pin(scl); +} + +bool common_hal_busio_i2c_deinited(busio_i2c_obj_t *self) { + return self->sda_pin == NO_PIN; +} + +void common_hal_busio_i2c_deinit(busio_i2c_obj_t *self) { + if (common_hal_busio_i2c_deinited(self)) { + return; + } + never_reset_i2c[i2c_hw_index(self->peripheral)] = false; + + i2c_deinit(self->peripheral); + + reset_pin_number(self->sda_pin); + reset_pin_number(self->scl_pin); + self->sda_pin = NO_PIN; + self->scl_pin = NO_PIN; +} + +bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) { + uint8_t fake_read = 0; + return i2c_read_blocking(self->peripheral, addr, &fake_read, 1, false) != PICO_ERROR_GENERIC; +} + +bool common_hal_busio_i2c_try_lock(busio_i2c_obj_t *self) { + bool grabbed_lock = false; + if (!self->has_lock) { + grabbed_lock = true; + self->has_lock = true; + } + return grabbed_lock; +} + +bool common_hal_busio_i2c_has_lock(busio_i2c_obj_t *self) { + return self->has_lock; +} + +void common_hal_busio_i2c_unlock(busio_i2c_obj_t *self) { + self->has_lock = false; +} + +uint8_t common_hal_busio_i2c_write(busio_i2c_obj_t *self, uint16_t addr, + const uint8_t *data, size_t len, bool transmit_stop_bit) { + int result = i2c_write_blocking(self->peripheral, addr, data, len, !transmit_stop_bit); + if (result == len) { + return 0; + } else if (result == PICO_ERROR_GENERIC) { + return MP_ENODEV; + } + return MP_EIO; +} + +uint8_t common_hal_busio_i2c_read(busio_i2c_obj_t *self, uint16_t addr, + uint8_t *data, size_t len) { + int result = i2c_read_blocking(self->peripheral, addr, data, len, false); + if (result == len) { + return 0; + } else if (result == PICO_ERROR_GENERIC) { + return MP_ENODEV; + } + return MP_EIO; +} + +void common_hal_busio_i2c_never_reset(busio_i2c_obj_t *self) { + never_reset_i2c[i2c_hw_index(self->peripheral)] = true; + + never_reset_pin_number(self->scl_pin); + never_reset_pin_number(self->sda_pin); +} diff --git a/ports/raspberrypi/common-hal/busio/I2C.h b/ports/raspberrypi/common-hal/busio/I2C.h new file mode 100644 index 0000000000000..d09f29e54cb0e --- /dev/null +++ b/ports/raspberrypi/common-hal/busio/I2C.h @@ -0,0 +1,47 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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. + */ + +#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_BUSIO_I2C_H +#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_BUSIO_I2C_H + +#include "common-hal/microcontroller/Pin.h" + +#include "py/obj.h" + +#include "src/rp2_common/hardware_i2c/include/hardware/i2c.h" + +typedef struct { + mp_obj_base_t base; + i2c_inst_t * peripheral; + bool has_lock; + uint baudrate; + uint8_t scl_pin; + uint8_t sda_pin; +} busio_i2c_obj_t; + +void reset_i2c(void); + +#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_BUSIO_I2C_H diff --git a/ports/raspberrypi/common-hal/busio/OneWire.h b/ports/raspberrypi/common-hal/busio/OneWire.h new file mode 100644 index 0000000000000..e27723ab2ccb0 --- /dev/null +++ b/ports/raspberrypi/common-hal/busio/OneWire.h @@ -0,0 +1,33 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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. + */ + +#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_BUSIO_ONEWIRE_H +#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_BUSIO_ONEWIRE_H + +// Use bitbangio. +#include "shared-module/busio/OneWire.h" + +#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_BUSIO_ONEWIRE_H diff --git a/ports/raspberrypi/common-hal/busio/SPI.c b/ports/raspberrypi/common-hal/busio/SPI.c new file mode 100644 index 0000000000000..b157ae3eb045e --- /dev/null +++ b/ports/raspberrypi/common-hal/busio/SPI.c @@ -0,0 +1,294 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "shared-bindings/busio/SPI.h" + +#include "lib/utils/interrupt_char.h" +#include "py/mperrno.h" +#include "py/runtime.h" + +#include "supervisor/board.h" +#include "common-hal/microcontroller/Pin.h" +#include "supervisor/shared/rgb_led_status.h" +#include "shared-bindings/microcontroller/Pin.h" + +#include "src/rp2_common/hardware_dma/include/hardware/dma.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" + +#define NO_INSTANCE 0xff + +STATIC bool never_reset_spi[2]; +STATIC spi_inst_t* spi[2] = {spi0, spi1}; + +void reset_spi(void) { + for (size_t i = 0; i < 2; i++) { + if (never_reset_spi[i]) { + continue; + } + + spi_deinit(spi[i]); + } +} + +void common_hal_busio_spi_construct(busio_spi_obj_t *self, + const mcu_pin_obj_t * clock, const mcu_pin_obj_t * mosi, + const mcu_pin_obj_t * miso) { + size_t instance_index = NO_INSTANCE; + if (clock->number % 4 == 2) { + instance_index = (clock->number / 8) % 2; + } + if (mosi != NULL) { + // Make sure the set MOSI matches the clock settings. + if (mosi->number % 4 != 3 || + (mosi->number / 8) % 2 != instance_index) { + instance_index = NO_INSTANCE; + } + } + if (miso != NULL) { + // Make sure the set MOSI matches the clock settings. + if (miso->number % 4 != 0 || + (miso->number / 8) % 2 != instance_index) { + instance_index = NO_INSTANCE; + } + } + + // TODO: Check to see if we're sharing the SPI with a native APA102. + + if (instance_index > 1) { + mp_raise_ValueError(translate("Invalid pins")); + } + + if (instance_index == 0) { + self->peripheral = spi0; + } else if (instance_index == 1) { + self->peripheral = spi1; + } + + if ((spi_get_hw(self->peripheral)->cr1 & SPI_SSPCR1_SSE_BITS) != 0) { + mp_raise_ValueError(translate("SPI peripheral in use")); + } + + spi_init(self->peripheral, 250000); + + gpio_set_function(clock->number, GPIO_FUNC_SPI); + claim_pin(clock); + self->clock = clock; + + self->MOSI = mosi; + if (mosi != NULL) { + gpio_set_function(mosi->number, GPIO_FUNC_SPI); + claim_pin(mosi); + } + + self->MISO = miso; + if (miso != NULL) { + gpio_set_function(miso->number, GPIO_FUNC_SPI); + claim_pin(miso); + } +} + +void common_hal_busio_spi_never_reset(busio_spi_obj_t *self) { + never_reset_spi[spi_get_index(self->peripheral)] = true; + + common_hal_never_reset_pin(self->clock); + common_hal_never_reset_pin(self->MOSI); + common_hal_never_reset_pin(self->MISO); +} + +bool common_hal_busio_spi_deinited(busio_spi_obj_t *self) { + return self->clock == NULL; +} + +void common_hal_busio_spi_deinit(busio_spi_obj_t *self) { + if (common_hal_busio_spi_deinited(self)) { + return; + } + never_reset_spi[spi_get_index(self->peripheral)] = false; + spi_deinit(self->peripheral); + + common_hal_reset_pin(self->clock); + common_hal_reset_pin(self->MOSI); + common_hal_reset_pin(self->MISO); + self->clock = NULL; +} + +bool common_hal_busio_spi_configure(busio_spi_obj_t *self, + uint32_t baudrate, uint8_t polarity, uint8_t phase, uint8_t bits) { + if (baudrate == self->target_frequency && + polarity == self->polarity && + phase == self->phase && + bits == self->bits) { + return true; + } + + spi_set_format(self->peripheral, bits, polarity, phase, SPI_MSB_FIRST); + + self->polarity = polarity; + self->phase = phase; + self->bits = bits; + self->target_frequency = baudrate; + self->real_frequency = spi_set_baudrate(self->peripheral, baudrate); + + return true; +} + +bool common_hal_busio_spi_try_lock(busio_spi_obj_t *self) { + bool grabbed_lock = false; + if (!self->has_lock) { + grabbed_lock = true; + self->has_lock = true; + } + return grabbed_lock; +} + +bool common_hal_busio_spi_has_lock(busio_spi_obj_t *self) { + return self->has_lock; +} + +void common_hal_busio_spi_unlock(busio_spi_obj_t *self) { + self->has_lock = false; +} + +static bool _transfer(busio_spi_obj_t *self, + const uint8_t *data_out, size_t out_len, + uint8_t *data_in, size_t in_len) { + // Use DMA for large transfers if channels are available + const size_t dma_min_size_threshold = 32; + int chan_tx = -1; + int chan_rx = -1; + size_t len = MAX(out_len, in_len); + if (len >= dma_min_size_threshold) { + // Use two DMA channels to service the two FIFOs + chan_tx = dma_claim_unused_channel(false); + chan_rx = dma_claim_unused_channel(false); + } + bool use_dma = chan_rx >= 0 && chan_tx >= 0; + if (use_dma) { + dma_channel_config c = dma_channel_get_default_config(chan_tx); + channel_config_set_transfer_data_size(&c, DMA_SIZE_8); + channel_config_set_dreq(&c, spi_get_index(self->peripheral) ? DREQ_SPI1_TX : DREQ_SPI0_TX); + channel_config_set_read_increment(&c, out_len == len); + channel_config_set_write_increment(&c, false); + dma_channel_configure(chan_tx, &c, + &spi_get_hw(self->peripheral)->dr, + data_out, + len, + false); + + c = dma_channel_get_default_config(chan_rx); + channel_config_set_transfer_data_size(&c, DMA_SIZE_8); + channel_config_set_dreq(&c, spi_get_index(self->peripheral) ? DREQ_SPI1_RX : DREQ_SPI0_RX); + channel_config_set_read_increment(&c, false); + channel_config_set_write_increment(&c, in_len == len); + dma_channel_configure(chan_rx, &c, + data_in, + &spi_get_hw(self->peripheral)->dr, + len, + false); + + dma_start_channel_mask((1u << chan_rx) | (1u << chan_tx)); + while (dma_channel_is_busy(chan_rx) || dma_channel_is_busy(chan_tx)) { + // TODO: We should idle here until we get a DMA interrupt or something else. + RUN_BACKGROUND_TASKS; + if (mp_hal_is_interrupted()) { + if (dma_channel_is_busy(chan_rx)) { + dma_channel_abort(chan_rx); + } + if (dma_channel_is_busy(chan_tx)) { + dma_channel_abort(chan_tx); + } + break; + } + } + } + + // If we have claimed only one channel successfully, we should release immediately. This also + // releases the DMA after use_dma has been done. + if (chan_rx >= 0) { + dma_channel_unclaim(chan_rx); + } + if (chan_tx >= 0) { + dma_channel_unclaim(chan_tx); + } + + if (!use_dma && !mp_hal_is_interrupted()) { + // Use software for small transfers, or if couldn't claim two DMA channels + // Never have more transfers in flight than will fit into the RX FIFO, + // else FIFO will overflow if this code is heavily interrupted. + const size_t fifo_depth = 8; + size_t rx_remaining = len; + size_t tx_remaining = len; + + while (!mp_hal_is_interrupted() && (rx_remaining || tx_remaining)) { + if (tx_remaining && spi_is_writable(self->peripheral) && rx_remaining - tx_remaining < fifo_depth) { + spi_get_hw(self->peripheral)->dr = (uint32_t) *data_out; + // Increment only if the buffer is the transfer length. It's 1 otherwise. + if (out_len == len) { + data_out++; + } + --tx_remaining; + } + if (rx_remaining && spi_is_readable(self->peripheral)) { + *data_in = (uint8_t) spi_get_hw(self->peripheral)->dr; + // Increment only if the buffer is the transfer length. It's 1 otherwise. + if (in_len == len) { + data_in++; + } + --rx_remaining; + } + RUN_BACKGROUND_TASKS; + } + } + return true; +} + +bool common_hal_busio_spi_write(busio_spi_obj_t *self, + const uint8_t *data, size_t len) { + uint32_t data_in; + return _transfer(self, data, len, (uint8_t*) &data_in, MIN(len, 4)); +} + +bool common_hal_busio_spi_read(busio_spi_obj_t *self, + uint8_t *data, size_t len, uint8_t write_value) { + uint32_t data_out = write_value << 24 | write_value << 16 | write_value << 8 | write_value; + return _transfer(self, (const uint8_t*) &data_out, MIN(4, len), data, len); +} + +bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_out, uint8_t *data_in, size_t len) { + return _transfer(self, data_out, len, data_in, len); +} + +uint32_t common_hal_busio_spi_get_frequency(busio_spi_obj_t* self) { + return self->real_frequency; +} + +uint8_t common_hal_busio_spi_get_phase(busio_spi_obj_t* self) { + return self->phase; +} + +uint8_t common_hal_busio_spi_get_polarity(busio_spi_obj_t* self) { + return self->polarity; +} diff --git a/ports/raspberrypi/common-hal/busio/SPI.h b/ports/raspberrypi/common-hal/busio/SPI.h new file mode 100644 index 0000000000000..981db46d41dd2 --- /dev/null +++ b/ports/raspberrypi/common-hal/busio/SPI.h @@ -0,0 +1,52 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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. + */ + +#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_BUSIO_SPI_H +#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_BUSIO_SPI_H + +#include "common-hal/microcontroller/Pin.h" + +#include "py/obj.h" + +#include "src/rp2_common/hardware_spi/include/hardware/spi.h" + +typedef struct { + mp_obj_base_t base; + spi_inst_t * peripheral; + bool has_lock; + const mcu_pin_obj_t* clock; + const mcu_pin_obj_t* MOSI; + const mcu_pin_obj_t* MISO; + uint32_t target_frequency; + int32_t real_frequency; + uint8_t polarity; + uint8_t phase; + uint8_t bits; +} busio_spi_obj_t; + +void reset_spi(void); + +#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_BUSIO_SPI_H diff --git a/ports/raspberrypi/common-hal/busio/UART.c b/ports/raspberrypi/common-hal/busio/UART.c new file mode 100644 index 0000000000000..71da6cadd5e93 --- /dev/null +++ b/ports/raspberrypi/common-hal/busio/UART.c @@ -0,0 +1,403 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/busio/UART.h" + +#include "mpconfigport.h" +#include "lib/utils/interrupt_char.h" +#include "py/gc.h" +#include "py/mperrno.h" +#include "py/runtime.h" +#include "py/stream.h" +#include "supervisor/shared/translate.h" +#include "supervisor/shared/tick.h" + +#define UART_DEBUG(...) (void)0 +// #define UART_DEBUG(...) mp_printf(&mp_plat_print __VA_OPT__(,) __VA_ARGS__) + +// Do-nothing callback needed so that usart_async code will enable rx interrupts. +// See comment below re usart_async_register_callback() +// static void usart_async_rxc_callback(const struct usart_async_descriptor *const descr) { +// // Nothing needs to be done by us. +// } + +#define NO_PIN 0xff + +void common_hal_busio_uart_construct(busio_uart_obj_t *self, + const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx, + const mcu_pin_obj_t * rts, const mcu_pin_obj_t * cts, + const mcu_pin_obj_t * rs485_dir, bool rs485_invert, + uint32_t baudrate, uint8_t bits, busio_uart_parity_t parity, uint8_t stop, + mp_float_t timeout, uint16_t receiver_buffer_size, byte* receiver_buffer, + bool sigint_enabled) { + +// Sercom* sercom = NULL; +// uint8_t sercom_index = 255; // Unset index +// uint32_t rx_pinmux = 0; +// uint8_t rx_pad = 255; // Unset pad +// uint32_t tx_pinmux = 0; +// uint8_t tx_pad = 255; // Unset pad + +// if ((rts != NULL) || (cts != NULL) || (rs485_dir != NULL) || (rs485_invert)) { +// mp_raise_ValueError(translate("RTS/CTS/RS485 Not yet supported on this device")); +// } + +// if (bits > 8) { +// mp_raise_NotImplementedError(translate("bytes > 8 bits not supported")); +// } + +// bool have_tx = tx != NULL; +// bool have_rx = rx != NULL; +// if (!have_tx && !have_rx) { +// mp_raise_ValueError(translate("tx and rx cannot both be None")); +// } + +// self->baudrate = baudrate; +// self->character_bits = bits; +// self->timeout_ms = timeout * 1000; + +// // This assignment is only here because the usart_async routines take a *const argument. +// struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; + +// for (int i = 0; i < NUM_SERCOMS_PER_PIN; i++) { +// Sercom* potential_sercom = NULL; +// if (have_tx) { +// sercom_index = tx->sercom[i].index; +// if (sercom_index >= SERCOM_INST_NUM) { +// continue; +// } +// potential_sercom = sercom_insts[sercom_index]; +// #ifdef SAMD21 +// if (potential_sercom->USART.CTRLA.bit.ENABLE != 0 || +// !(tx->sercom[i].pad == 0 || +// tx->sercom[i].pad == 2)) { +// continue; +// } +// #endif +// #ifdef SAM_D5X_E5X +// if (potential_sercom->USART.CTRLA.bit.ENABLE != 0 || +// !(tx->sercom[i].pad == 0)) { +// continue; +// } +// #endif +// tx_pinmux = PINMUX(tx->number, (i == 0) ? MUX_C : MUX_D); +// tx_pad = tx->sercom[i].pad; +// if (rx == NULL) { +// sercom = potential_sercom; +// break; +// } +// } +// for (int j = 0; j < NUM_SERCOMS_PER_PIN; j++) { +// if (((!have_tx && rx->sercom[j].index < SERCOM_INST_NUM && +// sercom_insts[rx->sercom[j].index]->USART.CTRLA.bit.ENABLE == 0) || +// sercom_index == rx->sercom[j].index) && +// rx->sercom[j].pad != tx_pad) { +// rx_pinmux = PINMUX(rx->number, (j == 0) ? MUX_C : MUX_D); +// rx_pad = rx->sercom[j].pad; +// sercom = sercom_insts[rx->sercom[j].index]; +// sercom_index = rx->sercom[j].index; +// break; +// } +// } +// if (sercom != NULL) { +// break; +// } +// } +// if (sercom == NULL) { +// mp_raise_ValueError(translate("Invalid pins")); +// } +// if (!have_tx) { +// tx_pad = 0; +// if (rx_pad == 0) { +// tx_pad = 2; +// } +// } +// if (!have_rx) { +// rx_pad = (tx_pad + 1) % 4; +// } + +// // Set up clocks on SERCOM. +// samd_peripherals_sercom_clock_init(sercom, sercom_index); + +// if (rx && receiver_buffer_size > 0) { +// self->buffer_length = receiver_buffer_size; +// // Initially allocate the UART's buffer in the long-lived part of the +// // heap. UARTs are generally long-lived objects, but the "make long- +// // lived" machinery is incapable of moving internal pointers like +// // self->buffer, so do it manually. (However, as long as internal +// // pointers like this are NOT moved, allocating the buffer +// // in the long-lived pool is not strictly necessary) +// self->buffer = (uint8_t *) gc_alloc(self->buffer_length * sizeof(uint8_t), false, true); +// if (self->buffer == NULL) { +// common_hal_busio_uart_deinit(self); +// mp_raise_msg_varg(&mp_type_MemoryError, translate("Failed to allocate RX buffer of %d bytes"), self->buffer_length * sizeof(uint8_t)); +// } +// } else { +// self->buffer_length = 0; +// self->buffer = NULL; +// } + +// if (usart_async_init(usart_desc_p, sercom, self->buffer, self->buffer_length, NULL) != ERR_NONE) { +// mp_raise_ValueError(translate("Could not initialize UART")); +// } + +// // usart_async_init() sets a number of defaults based on a prototypical SERCOM +// // which don't necessarily match what we need. After calling it, set the values +// // specific to this instantiation of UART. + +// // Set pads computed for this SERCOM. +// // TXPO: +// // 0x0: TX pad 0; no RTS/CTS +// // 0x1: TX pad 2; no RTS/CTS +// // 0x2: TX pad 0; RTS: pad 2, CTS: pad 3 (not used by us right now) +// // So divide by 2 to map pad to value. +// // RXPO: +// // 0x0: RX pad 0 +// // 0x1: RX pad 1 +// // 0x2: RX pad 2 +// // 0x3: RX pad 3 + +// // Doing a group mask and set of the registers saves 60 bytes over setting the bitfields individually. + +// sercom->USART.CTRLA.reg &= ~(SERCOM_USART_CTRLA_TXPO_Msk | +// SERCOM_USART_CTRLA_RXPO_Msk | +// SERCOM_USART_CTRLA_FORM_Msk); +// sercom->USART.CTRLA.reg |= SERCOM_USART_CTRLA_TXPO(tx_pad / 2) | +// SERCOM_USART_CTRLA_RXPO(rx_pad) | +// (parity == BUSIO_UART_PARITY_NONE ? 0 : SERCOM_USART_CTRLA_FORM(1)); + +// // Enable tx and/or rx based on whether the pins were specified. +// // CHSIZE is 0 for 8 bits, 5, 6, 7 for 5, 6, 7 bits. 1 for 9 bits, but we don't support that. +// sercom->USART.CTRLB.reg &= ~(SERCOM_USART_CTRLB_TXEN | +// SERCOM_USART_CTRLB_RXEN | +// SERCOM_USART_CTRLB_PMODE | +// SERCOM_USART_CTRLB_SBMODE | +// SERCOM_USART_CTRLB_CHSIZE_Msk); +// sercom->USART.CTRLB.reg |= (have_tx ? SERCOM_USART_CTRLB_TXEN : 0) | +// (have_rx ? SERCOM_USART_CTRLB_RXEN : 0) | +// (parity == BUSIO_UART_PARITY_ODD ? SERCOM_USART_CTRLB_PMODE : 0) | +// (stop > 1 ? SERCOM_USART_CTRLB_SBMODE : 0) | +// SERCOM_USART_CTRLB_CHSIZE(bits % 8); + +// // Set baud rate +// common_hal_busio_uart_set_baudrate(self, baudrate); + +// // Turn on rx interrupt handling. The UART async driver has its own set of internal callbacks, +// // which are set up by uart_async_init(). These in turn can call user-specified callbacks. +// // In fact, the actual interrupts are not enabled unless we set up a user-specified callback. +// // This is confusing. It's explained in the Atmel START User Guide -> Implementation Description -> +// // Different read function behavior in some asynchronous drivers. As of this writing: +// // http://start.atmel.com/static/help/index.html?GUID-79201A5A-226F-4FBB-B0B8-AB0BE0554836 +// // Look at the ASFv4 code example for async USART. +// usart_async_register_callback(usart_desc_p, USART_ASYNC_RXC_CB, usart_async_rxc_callback); + + +// if (have_tx) { +// gpio_set_pin_direction(tx->number, GPIO_DIRECTION_OUT); +// gpio_set_pin_pull_mode(tx->number, GPIO_PULL_OFF); +// gpio_set_pin_function(tx->number, tx_pinmux); +// self->tx_pin = tx->number; +// claim_pin(tx); +// } else { +// self->tx_pin = NO_PIN; +// } + +// if (have_rx) { +// gpio_set_pin_direction(rx->number, GPIO_DIRECTION_IN); +// gpio_set_pin_pull_mode(rx->number, GPIO_PULL_OFF); +// gpio_set_pin_function(rx->number, rx_pinmux); +// self->rx_pin = rx->number; +// claim_pin(rx); +// } else { +// self->rx_pin = NO_PIN; +// } + +// usart_async_enable(usart_desc_p); +} + +bool common_hal_busio_uart_deinited(busio_uart_obj_t *self) { + return self->rx_pin == NO_PIN && self->tx_pin == NO_PIN; +} + +void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { + if (common_hal_busio_uart_deinited(self)) { + return; + } + // This assignment is only here because the usart_async routines take a *const argument. + // struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; + // usart_async_disable(usart_desc_p); + // usart_async_deinit(usart_desc_p); + reset_pin_number(self->rx_pin); + reset_pin_number(self->tx_pin); + self->rx_pin = NO_PIN; + self->tx_pin = NO_PIN; +} + +// Read characters. +size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) { + if (self->rx_pin == NO_PIN) { + mp_raise_ValueError(translate("No RX pin")); + } + + // This assignment is only here because the usart_async routines take a *const argument. + // struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; + + if (len == 0) { + // Nothing to read. + return 0; + } + + // struct io_descriptor *io; + // usart_async_get_io_descriptor(usart_desc_p, &io); + + size_t total_read = 0; + // uint64_t start_ticks = supervisor_ticks_ms64(); + + // // Busy-wait until timeout or until we've read enough chars. + // while (supervisor_ticks_ms64() - start_ticks <= self->timeout_ms) { + // // Read as many chars as we can right now, up to len. + // size_t num_read = io_read(io, data, len); + + // // Advance pointer in data buffer, and decrease how many chars left to read. + // data += num_read; + // len -= num_read; + // total_read += num_read; + // if (len == 0) { + // // Don't need to read any more: data buf is full. + // break; + // } + // if (num_read > 0) { + // // Reset the timeout on every character read. + // start_ticks = supervisor_ticks_ms64(); + // } + // RUN_BACKGROUND_TASKS; + // // Allow user to break out of a timeout with a KeyboardInterrupt. + // if (mp_hal_is_interrupted()) { + // break; + // } + // // If we are zero timeout, make sure we don't loop again (in the event + // // we read in under 1ms) + // if (self->timeout_ms == 0) { + // break; + // } + // } + + // if (total_read == 0) { + // *errcode = EAGAIN; + // return MP_STREAM_ERROR; + // } + + return total_read; +} + +// Write characters. +size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) { + if (self->tx_pin == NO_PIN) { + mp_raise_ValueError(translate("No TX pin")); + } + + // This assignment is only here because the usart_async routines take a *const argument. + // struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; + + // struct io_descriptor *io; + // usart_async_get_io_descriptor(usart_desc_p, &io); + + // // Start writing characters. This is non-blocking and will + // // return immediately after setting up the write. + // if (io_write(io, data, len) < 0) { + // *errcode = MP_EAGAIN; + // return MP_STREAM_ERROR; + // } + + // // Busy-wait until all characters transmitted. + // struct usart_async_status async_status; + // while (true) { + // usart_async_get_status(usart_desc_p, &async_status); + // if (async_status.txcnt >= len) { + // break; + // } + // RUN_BACKGROUND_TASKS; + // } + + return len; +} + +uint32_t common_hal_busio_uart_get_baudrate(busio_uart_obj_t *self) { + return self->baudrate; +} + +void common_hal_busio_uart_set_baudrate(busio_uart_obj_t *self, uint32_t baudrate) { + // This assignment is only here because the usart_async routines take a *const argument. + // struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; + // usart_async_set_baud_rate(usart_desc_p, + // // Samples and ARITHMETIC vs FRACTIONAL must correspond to USART_SAMPR in + // // hpl_sercom_config.h. + // _usart_async_calculate_baud_rate(baudrate, // e.g. 9600 baud + // PROTOTYPE_SERCOM_USART_ASYNC_CLOCK_FREQUENCY, + // 16, // samples + // USART_BAUDRATE_ASYNCH_ARITHMETIC, + // 0 // fraction - not used for ARITHMETIC + // )); + self->baudrate = baudrate; +} + +mp_float_t common_hal_busio_uart_get_timeout(busio_uart_obj_t *self) { + return (mp_float_t) (self->timeout_ms / 1000.0f); +} + +void common_hal_busio_uart_set_timeout(busio_uart_obj_t *self, mp_float_t timeout) { + self->timeout_ms = timeout * 1000; +} + +uint32_t common_hal_busio_uart_rx_characters_available(busio_uart_obj_t *self) { + // This assignment is only here because the usart_async routines take a *const argument. + // struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; + // struct usart_async_status async_status; + // usart_async_get_status(usart_desc_p, &async_status); + // return async_status.rxcnt; + return 0; +} + +void common_hal_busio_uart_clear_rx_buffer(busio_uart_obj_t *self) { + // This assignment is only here because the usart_async routines take a *const argument. + // struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; + // usart_async_flush_rx_buffer(usart_desc_p); + +} + +// True if there are no characters still to be written. +bool common_hal_busio_uart_ready_to_tx(busio_uart_obj_t *self) { + if (self->tx_pin == NO_PIN) { + return false; + } + return false; + // // This assignment is only here because the usart_async routines take a *const argument. + // struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; + // struct usart_async_status async_status; + // usart_async_get_status(usart_desc_p, &async_status); + // return !(async_status.flags & USART_ASYNC_STATUS_BUSY); +} diff --git a/ports/raspberrypi/common-hal/busio/UART.h b/ports/raspberrypi/common-hal/busio/UART.h new file mode 100644 index 0000000000000..43ed9bee014c7 --- /dev/null +++ b/ports/raspberrypi/common-hal/busio/UART.h @@ -0,0 +1,47 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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. + */ + +#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_BUSIO_UART_H +#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_BUSIO_UART_H + +#include "common-hal/microcontroller/Pin.h" + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + // struct usart_async_descriptor usart_desc; + uint8_t rx_pin; + uint8_t tx_pin; + uint8_t character_bits; + bool rx_error; + uint32_t baudrate; + uint32_t timeout_ms; + uint32_t buffer_length; + uint8_t* buffer; +} busio_uart_obj_t; + +#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_BUSIO_UART_H diff --git a/ports/raspberrypi/common-hal/busio/__init__.c b/ports/raspberrypi/common-hal/busio/__init__.c new file mode 100644 index 0000000000000..41761b6743aea --- /dev/null +++ b/ports/raspberrypi/common-hal/busio/__init__.c @@ -0,0 +1 @@ +// No busio module functions. diff --git a/ports/raspberrypi/common-hal/digitalio/DigitalInOut.c b/ports/raspberrypi/common-hal/digitalio/DigitalInOut.c new file mode 100644 index 0000000000000..06f0cfdd27112 --- /dev/null +++ b/ports/raspberrypi/common-hal/digitalio/DigitalInOut.c @@ -0,0 +1,157 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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 +#include + +#include "py/runtime.h" +#include "py/mphal.h" + +#include "common-hal/microcontroller/Pin.h" +#include "shared-bindings/digitalio/DigitalInOut.h" +#include "supervisor/shared/translate.h" + +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" + +digitalinout_result_t common_hal_digitalio_digitalinout_construct( + digitalio_digitalinout_obj_t* self, const mcu_pin_obj_t* pin) { + claim_pin(pin); + self->pin = pin; + self->output = false; + self->open_drain = false; + + gpio_init(pin->number); + return DIGITALINOUT_OK; +} + +void common_hal_digitalio_digitalinout_never_reset( + digitalio_digitalinout_obj_t *self) { + never_reset_pin_number(self->pin->number); +} + +bool common_hal_digitalio_digitalinout_deinited(digitalio_digitalinout_obj_t* self) { + return self->pin == NULL; +} + +void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t* self) { + if (common_hal_digitalio_digitalinout_deinited(self)) { + return; + } + reset_pin_number(self->pin->number); + self->pin = NULL; +} + +void common_hal_digitalio_digitalinout_switch_to_input( + digitalio_digitalinout_obj_t* self, digitalio_pull_t pull) { + self->output = false; + // This also sets direction to input. + common_hal_digitalio_digitalinout_set_pull(self, pull); +} + +digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_output( + digitalio_digitalinout_obj_t* self, bool value, + digitalio_drive_mode_t drive_mode) { + const uint8_t pin = self->pin->number; + gpio_set_dir(pin, GPIO_OUT); + // Turn on "strong" pin driving (more current available). See DRVSTR doc in datasheet. + // hri_port_set_PINCFG_DRVSTR_bit(PORT, (enum gpio_port)GPIO_PORT(pin), GPIO_PIN(pin)); + + self->output = true; + common_hal_digitalio_digitalinout_set_drive_mode(self, drive_mode); + common_hal_digitalio_digitalinout_set_value(self, value); + return DIGITALINOUT_OK; +} + +digitalio_direction_t common_hal_digitalio_digitalinout_get_direction( + digitalio_digitalinout_obj_t* self) { + return self->output ? DIRECTION_OUTPUT : DIRECTION_INPUT; +} + +void common_hal_digitalio_digitalinout_set_value( + digitalio_digitalinout_obj_t* self, bool value) { + const uint8_t pin = self->pin->number; + if (self->open_drain) { + gpio_set_dir(pin, value ? GPIO_IN : GPIO_OUT); + } else { + gpio_put(pin, value); + } +} + +bool common_hal_digitalio_digitalinout_get_value( + digitalio_digitalinout_obj_t* self) { + return gpio_get(self->pin->number); +} + +digitalinout_result_t common_hal_digitalio_digitalinout_set_drive_mode( + digitalio_digitalinout_obj_t* self, + digitalio_drive_mode_t drive_mode) { + const uint8_t pin = self->pin->number; + bool value = common_hal_digitalio_digitalinout_get_value(self); + self->open_drain = drive_mode == DRIVE_MODE_OPEN_DRAIN; + if (self->open_drain) { + gpio_put(pin, false); + } + // True is implemented differently between modes so reset the value to make + // sure it's correct for the new mode. + if (value) { + common_hal_digitalio_digitalinout_set_value(self, value); + } + return DIGITALINOUT_OK; +} + +digitalio_drive_mode_t common_hal_digitalio_digitalinout_get_drive_mode( + digitalio_digitalinout_obj_t* self) { + if (self->open_drain) { + return DRIVE_MODE_OPEN_DRAIN; + } else { + return DRIVE_MODE_PUSH_PULL; + } +} + +void common_hal_digitalio_digitalinout_set_pull( + digitalio_digitalinout_obj_t* self, digitalio_pull_t pull) { + const uint8_t pin = self->pin->number; + gpio_set_pulls(pin, pull == PULL_UP, pull == PULL_DOWN); + gpio_set_dir(pin, GPIO_IN); +} + +digitalio_pull_t common_hal_digitalio_digitalinout_get_pull( + digitalio_digitalinout_obj_t* self) { + // uint32_t pin = self->pin->number; + // if (self->output) { + // mp_raise_AttributeError(translate("Cannot get pull while in output mode")); + // return PULL_NONE; + // } else { + // if (hri_port_get_PINCFG_PULLEN_bit(PORT, GPIO_PORT(pin), GPIO_PIN(pin)) == 0) { + // return PULL_NONE; + // } if (hri_port_get_OUT_reg(PORT, GPIO_PORT(pin), 1U << GPIO_PIN(pin)) > 0) { + // return PULL_UP; + // } else { + // return PULL_DOWN; + // } + // } + return PULL_NONE; +} diff --git a/ports/raspberrypi/common-hal/digitalio/DigitalInOut.h b/ports/raspberrypi/common-hal/digitalio/DigitalInOut.h new file mode 100644 index 0000000000000..8b14bbad8fefd --- /dev/null +++ b/ports/raspberrypi/common-hal/digitalio/DigitalInOut.h @@ -0,0 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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. + */ + +#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_DIGITALIO_DIGITALINOUT_H +#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_DIGITALIO_DIGITALINOUT_H + +#include "common-hal/microcontroller/Pin.h" +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + const mcu_pin_obj_t * pin; + bool output; + bool open_drain; +} digitalio_digitalinout_obj_t; + +#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_DIGITALIO_DIGITALINOUT_H diff --git a/ports/raspberrypi/common-hal/digitalio/__init__.c b/ports/raspberrypi/common-hal/digitalio/__init__.c new file mode 100644 index 0000000000000..20fad459593ac --- /dev/null +++ b/ports/raspberrypi/common-hal/digitalio/__init__.c @@ -0,0 +1 @@ +// No digitalio module functions. diff --git a/ports/raspberrypi/common-hal/displayio/ParallelBus.c b/ports/raspberrypi/common-hal/displayio/ParallelBus.c new file mode 100644 index 0000000000000..57b2ffc36bcdb --- /dev/null +++ b/ports/raspberrypi/common-hal/displayio/ParallelBus.c @@ -0,0 +1,68 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "shared-bindings/displayio/ParallelBus.h" + +#include + +#include "common-hal/microcontroller/Pin.h" +#include "py/runtime.h" +#include "shared-bindings/digitalio/DigitalInOut.h" +#include "shared-bindings/microcontroller/__init__.h" + +void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* self, + const mcu_pin_obj_t* data0, const mcu_pin_obj_t* command, const mcu_pin_obj_t* chip_select, + const mcu_pin_obj_t* write, const mcu_pin_obj_t* read, const mcu_pin_obj_t* reset) { + + mp_raise_NotImplementedError(translate("ParallelBus not yet supported")); + // TODO: Implement with PIO and DMA. +} + +void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t* self) { + +} + +bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) { + return false; +} + +bool common_hal_displayio_parallelbus_bus_free(mp_obj_t obj) { + return false; +} + +bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) { + + return false; +} + +void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) { + +} + +void common_hal_displayio_parallelbus_end_transaction(mp_obj_t obj) { + +} diff --git a/ports/raspberrypi/common-hal/displayio/ParallelBus.h b/ports/raspberrypi/common-hal/displayio/ParallelBus.h new file mode 100644 index 0000000000000..45989d9900379 --- /dev/null +++ b/ports/raspberrypi/common-hal/displayio/ParallelBus.h @@ -0,0 +1,36 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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. + */ + +#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_DISPLAYIO_PARALLELBUS_H +#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_DISPLAYIO_PARALLELBUS_H + +#include "common-hal/digitalio/DigitalInOut.h" + +typedef struct { + mp_obj_base_t base; +} displayio_parallelbus_obj_t; + +#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_DISPLAYIO_PARALLELBUS_H diff --git a/ports/raspberrypi/common-hal/microcontroller/Pin.c b/ports/raspberrypi/common-hal/microcontroller/Pin.c new file mode 100644 index 0000000000000..90c3274067874 --- /dev/null +++ b/ports/raspberrypi/common-hal/microcontroller/Pin.c @@ -0,0 +1,190 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "py/runtime.h" + +#include "shared-bindings/microcontroller/Pin.h" + +#include "supervisor/shared/rgb_led_status.h" + +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" + +#ifdef MICROPY_HW_NEOPIXEL +bool neopixel_in_use; +#endif +#ifdef MICROPY_HW_APA102_MOSI +bool apa102_sck_in_use; +bool apa102_mosi_in_use; +#endif +#ifdef SPEAKER_ENABLE_PIN +bool speaker_enable_in_use; +#endif + +STATIC uint32_t never_reset_pins; + +void reset_all_pins(void) { + for (size_t i = 0; i < 30; i++) { + if ((never_reset_pins & (1 << i)) != 0) { + continue; + } + reset_pin_number(i); + } +} + +void never_reset_pin_number(uint8_t pin_number) { + if (pin_number >= 32) { + return; + } + + never_reset_pins |= 1 << pin_number; +} + +void reset_pin_number(uint8_t pin_number) { + if (pin_number >= 32 +#if TUD_OPT_RP2040_USB_DEVICE_ENUMERATION_FIX + // Pin 15 is used for Errata so we don't mess with it. + || pin_number == 15 +#endif + ) { + return; + } + + never_reset_pins &= ~(1 << pin_number); + + // We are very aggressive in shutting down the pad fully. Both pulls are + // disabled and both buffers are as well. + gpio_init(pin_number); + hw_clear_bits(&padsbank0_hw->io[pin_number], PADS_BANK0_GPIO0_IE_BITS | + PADS_BANK0_GPIO0_PUE_BITS | + PADS_BANK0_GPIO0_PDE_BITS); + hw_set_bits(&padsbank0_hw->io[pin_number], PADS_BANK0_GPIO0_OD_BITS); + + #ifdef MICROPY_HW_NEOPIXEL + if (pin_number == MICROPY_HW_NEOPIXEL->number) { + neopixel_in_use = false; + rgb_led_status_init(); + return; + } + #endif + #ifdef MICROPY_HW_APA102_MOSI + if (pin_number == MICROPY_HW_APA102_MOSI->number || + pin_number == MICROPY_HW_APA102_SCK->number) { + apa102_mosi_in_use = apa102_mosi_in_use && pin_number != MICROPY_HW_APA102_MOSI->number; + apa102_sck_in_use = apa102_sck_in_use && pin_number != MICROPY_HW_APA102_SCK->number; + if (!apa102_sck_in_use && !apa102_mosi_in_use) { + rgb_led_status_init(); + } + return; + } + #endif + + #ifdef SPEAKER_ENABLE_PIN + if (pin_number == SPEAKER_ENABLE_PIN->number) { + speaker_enable_in_use = false; + } + #endif +} + +void common_hal_never_reset_pin(const mcu_pin_obj_t* pin) { + never_reset_pin_number(pin->number); +} + +void common_hal_reset_pin(const mcu_pin_obj_t* pin) { + reset_pin_number(pin->number); +} + +void claim_pin(const mcu_pin_obj_t* pin) { + #ifdef MICROPY_HW_NEOPIXEL + if (pin == MICROPY_HW_NEOPIXEL) { + neopixel_in_use = true; + } + #endif + #ifdef MICROPY_HW_APA102_MOSI + if (pin == MICROPY_HW_APA102_MOSI) { + apa102_mosi_in_use = true; + } + if (pin == MICROPY_HW_APA102_SCK) { + apa102_sck_in_use = true; + } + #endif + + #ifdef SPEAKER_ENABLE_PIN + if (pin == SPEAKER_ENABLE_PIN) { + speaker_enable_in_use = true; + } + #endif +} + +bool pin_number_is_free(uint8_t pin_number) { + if (pin_number >= 30) { + return false; + } +#if TUD_OPT_RP2040_USB_DEVICE_ENUMERATION_FIX + // Pin 15 is used for Errata so we don't mess with it. + if (pin_number == 15) { + return true; + } +#endif + uint32_t pad_state = padsbank0_hw->io[pin_number]; + return (pad_state & PADS_BANK0_GPIO0_IE_BITS) == 0 && + (pad_state & PADS_BANK0_GPIO0_OD_BITS) != 0; +} + +bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t* pin) { + #ifdef MICROPY_HW_NEOPIXEL + if (pin == MICROPY_HW_NEOPIXEL) { + return !neopixel_in_use; + } + #endif + #ifdef MICROPY_HW_APA102_MOSI + if (pin == MICROPY_HW_APA102_MOSI) { + return !apa102_mosi_in_use; + } + if (pin == MICROPY_HW_APA102_SCK) { + return !apa102_sck_in_use; + } + #endif + + #ifdef SPEAKER_ENABLE_PIN + if (pin == SPEAKER_ENABLE_PIN) { + return !speaker_enable_in_use; + } + #endif + + return pin_number_is_free(pin->number); +} + +uint8_t common_hal_mcu_pin_number(const mcu_pin_obj_t* pin) { + return pin->number; +} + +void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin) { + return claim_pin(pin); +} + +void common_hal_mcu_pin_reset_number(uint8_t pin_no) { + reset_pin_number(pin_no); +} diff --git a/ports/raspberrypi/common-hal/microcontroller/Pin.h b/ports/raspberrypi/common-hal/microcontroller/Pin.h new file mode 100644 index 0000000000000..07c3211850e37 --- /dev/null +++ b/ports/raspberrypi/common-hal/microcontroller/Pin.h @@ -0,0 +1,53 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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. + */ + +#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_MICROCONTROLLER_PIN_H +#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_MICROCONTROLLER_PIN_H + +#include +#include + +#include + +#include "peripherals/pins.h" + +#ifdef MICROPY_HW_NEOPIXEL +extern bool neopixel_in_use; +#endif +#ifdef MICROPY_HW_APA102_MOSI +extern bool apa102_sck_in_use; +extern bool apa102_mosi_in_use; +#endif + +void reset_all_pins(void); +// reset_pin_number takes the pin number instead of the pointer so that objects don't +// need to store a full pointer. +void reset_pin_number(uint8_t pin_number); +void never_reset_pin_number(uint8_t pin_number); +void claim_pin(const mcu_pin_obj_t* pin); +bool pin_number_is_free(uint8_t pin_number); + +#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_MICROCONTROLLER_PIN_H diff --git a/ports/raspberrypi/common-hal/microcontroller/Processor.c b/ports/raspberrypi/common-hal/microcontroller/Processor.c new file mode 100644 index 0000000000000..0ad3a51e28484 --- /dev/null +++ b/ports/raspberrypi/common-hal/microcontroller/Processor.c @@ -0,0 +1,66 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 + +#include "py/mphal.h" +#include "common-hal/microcontroller/Processor.h" +#include "shared-bindings/microcontroller/ResetReason.h" + +#include "src/rp2_common/hardware_adc/include/hardware/adc.h" +#include "src/rp2_common/hardware_clocks/include/hardware/clocks.h" + +float common_hal_mcu_processor_get_temperature(void) { + adc_init(); + adc_set_temp_sensor_enabled(true); + adc_select_input(4); + uint16_t value = adc_read(); + adc_set_temp_sensor_enabled(false); + float voltage = value * 3.3 / (1 << 12); + // TODO: turn the ADC back off + return 27 - (voltage - 0.706) / 0.001721; +} + +float common_hal_mcu_processor_get_voltage(void) { + return 3.3f; +} + +uint32_t common_hal_mcu_processor_get_frequency(void) { + return clock_get_hz(clk_sys); +} + +void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { + // TODO: get the unique id from the flash. The chip itself doesn't have one. + // for (int i=0; i<4; i++) { + // for (int k=0; k<4; k++) { + // raw_id[4 * i + k] = (*(id_addresses[i]) >> k * 8) & 0xff; + // } + // } +} + +mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) { + return RESET_REASON_UNKNOWN; +} diff --git a/ports/raspberrypi/common-hal/microcontroller/Processor.h b/ports/raspberrypi/common-hal/microcontroller/Processor.h new file mode 100644 index 0000000000000..b7c86e85068a4 --- /dev/null +++ b/ports/raspberrypi/common-hal/microcontroller/Processor.h @@ -0,0 +1,39 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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. + */ + +#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H +#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H + +#define COMMON_HAL_MCU_PROCESSOR_UID_LENGTH 16 + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + // Stores no state currently. +} mcu_processor_obj_t; + +#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H diff --git a/ports/raspberrypi/common-hal/microcontroller/__init__.c b/ports/raspberrypi/common-hal/microcontroller/__init__.c new file mode 100644 index 0000000000000..e454ffa1b73f2 --- /dev/null +++ b/ports/raspberrypi/common-hal/microcontroller/__init__.c @@ -0,0 +1,148 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "py/mphal.h" +#include "py/obj.h" +#include "py/runtime.h" + +#include "common-hal/microcontroller/__init__.h" +#if CIRCUITPY_NVM +#include "shared-bindings/nvm/ByteArray.h" +#endif +#include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/microcontroller/Processor.h" +#include "supervisor/shared/safe_mode.h" +#include "supervisor/shared/translate.h" + +#include "src/rp2040/hardware_structs/include/hardware/structs/sio.h" +#include "src/rp2_common/hardware_sync/include/hardware/sync.h" + +void common_hal_mcu_delay_us(uint32_t delay) { + mp_hal_delay_us(delay); +} + +volatile uint32_t nesting_count = 0; +void common_hal_mcu_disable_interrupts(void) { + // We don't use save_and_disable_interrupts() from the sdk because we don't want to worry about PRIMASK. + // This is what we do on the SAMD21 via CMSIS. + asm volatile ("cpsid i" : : : "memory"); + __dmb(); + nesting_count++; +} + +void common_hal_mcu_enable_interrupts(void) { + if (nesting_count == 0) { + // reset_into_safe_mode(LOCKING_ERROR); + } + nesting_count--; + if (nesting_count > 0) { + return; + } + __dmb(); + asm volatile ("cpsie i" : : : "memory"); +} + +void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { + if (runmode == RUNMODE_BOOTLOADER) { + } else { + } + if (runmode == RUNMODE_SAFE_MODE) { + safe_mode_on_next_reset(PROGRAMMATIC_SAFE_MODE); + } +} + +void common_hal_mcu_reset(void) { +} + +// The singleton microcontroller.Processor object, bound to microcontroller.cpu +// It currently only has properties, and no state. +static const mcu_processor_obj_t processor0 = { + .base = { + .type = &mcu_processor_type, + }, +}; + +static const mcu_processor_obj_t processor1 = { + .base = { + .type = &mcu_processor_type, + }, +}; + +const mp_rom_obj_tuple_t common_hal_mcu_processor_obj = { + {&mp_type_tuple}, + CIRCUITPY_PROCESSOR_COUNT, + { + MP_ROM_PTR(&processor0), + MP_ROM_PTR(&processor1) + } +}; + +#if CIRCUITPY_NVM && CIRCUITPY_INTERNAL_NVM_SIZE > 0 +// The singleton nvm.ByteArray object. +const nvm_bytearray_obj_t common_hal_mcu_nvm_obj = { + .base = { + .type = &nvm_bytearray_type, + }, + .len = CIRCUITPY_INTERNAL_NVM_SIZE, + .start_address = (uint8_t*) (CIRCUITPY_INTERNAL_NVM_START_ADDR) +}; +#endif + +// This maps MCU pin names to pin objects. +const mp_rom_map_elem_t mcu_pin_global_dict_table[TOTAL_GPIO_COUNT] = { + { MP_ROM_QSTR(MP_QSTR_GPIO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_GPIO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_GPIO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_GPIO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_GPIO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_GPIO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_GPIO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GPIO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_GPIO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_GPIO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_GPIO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_GPIO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_GPIO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_GPIO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_GPIO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_GPIO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_GPIO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GPIO17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_GPIO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_GPIO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_GPIO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_GPIO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_GPIO22), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_GPIO23), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_GPIO24), MP_ROM_PTR(&pin_GPIO24) }, + { MP_ROM_QSTR(MP_QSTR_GPIO25), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_GPIO26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GPIO27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_GPIO28), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_GPIO29), MP_ROM_PTR(&pin_GPIO29) }, +}; +MP_DEFINE_CONST_DICT(mcu_pin_globals, mcu_pin_global_dict_table); diff --git a/ports/raspberrypi/common-hal/microcontroller/__init__.h b/ports/raspberrypi/common-hal/microcontroller/__init__.h new file mode 100644 index 0000000000000..cc509b6b12181 --- /dev/null +++ b/ports/raspberrypi/common-hal/microcontroller/__init__.h @@ -0,0 +1,36 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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. + */ + +#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_MICROCONTROLLER___INIT___H +#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_MICROCONTROLLER___INIT___H + +#include "src/rp2040/hardware_regs/include/hardware/platform_defs.h" + +#define TOTAL_GPIO_COUNT NUM_BANK0_GPIOS + +extern const mp_rom_map_elem_t mcu_pin_global_dict_table[TOTAL_GPIO_COUNT]; + +#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_MICROCONTROLLER___INIT___H diff --git a/ports/raspberrypi/common-hal/neopixel_write/__init__.c b/ports/raspberrypi/common-hal/neopixel_write/__init__.c new file mode 100644 index 0000000000000..10462b5a33532 --- /dev/null +++ b/ports/raspberrypi/common-hal/neopixel_write/__init__.c @@ -0,0 +1,95 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "shared-bindings/neopixel_write/__init__.h" + +#include "bindings/rp2pio/StateMachine.h" +#include "common-hal/rp2pio/StateMachine.h" +#include "shared-bindings/microcontroller/__init__.h" + +#include "supervisor/port.h" + +uint64_t next_start_raw_ticks = 0; + +// NeoPixels are 800khz bit streams. Zeroes are 1/3 duty cycle (~416ns) and ones +// are 2/3 duty cycle (~833ns). Each of the instructions below take 1/3 duty +// cycle. The first two instructions always run while only one of the two final +// instructions run per bit. We start with the low period because it can be +// longer than 1/3 period while waiting for more data. +const uint16_t neopixel_program[] = { +// bitloop: +// out x 1 side 0 [1]; Side-set still takes place before instruction stalls + 0x6121, +// jmp !x do_zero side 1 [1]; Branch on the bit we shifted out after 1/3 duty delay. Positive pulse + 0x1123, +// do_one: +// jmp bitloop side 1 [1]; Continue driving high, for a long pulse + 0x1100, +// do_zero: +// nop side 0 [1]; Or drive low, for a short pulse + 0xa142 +}; + +const uint16_t init_program[] = { + 0xe081 +}; + +void common_hal_neopixel_write(const digitalio_digitalinout_obj_t* digitalinout, uint8_t *pixels, uint32_t num_bytes) { + // Set everything up. + rp2pio_statemachine_obj_t state_machine; + + // TODO: Cache the state machine after we create it once. We'll need a way to + // change the pins then though. + uint8_t pin_number = digitalinout->pin->number; + bool ok = rp2pio_statemachine_construct(&state_machine, + neopixel_program, sizeof(neopixel_program) / sizeof(neopixel_program[0]), + 800000 * 6, // 800 khz * 6 cycles per bit + init_program, 1, + NULL, 1, + NULL, 1, + digitalinout->pin, 1, + digitalinout->pin, 1, + 1 << pin_number, true, false, + true, 8, false, // TX, auto pull every 8 bits. shift left to output msb first + false, 32, true, // RX setting we don't use + false); // claim pins + if (!ok) { + // Do nothing. Maybe bitbang? + return; + } + + // Wait to make sure we don't append onto the last transmission. This should only be a tick or + // two. + while (port_get_raw_ticks(NULL) < next_start_raw_ticks) {} + + common_hal_rp2pio_statemachine_write(&state_machine, pixels, num_bytes); + + // Use a private deinit of the state machine that doesn't reset the pin. + rp2pio_statemachine_deinit(&state_machine, true); + gpio_init(digitalinout->pin->number); + // Update the next start. + next_start_raw_ticks = port_get_raw_ticks(NULL) + 1; +} diff --git a/ports/raspberrypi/common-hal/os/__init__.c b/ports/raspberrypi/common-hal/os/__init__.c new file mode 100644 index 0000000000000..dcbd06e937d3d --- /dev/null +++ b/ports/raspberrypi/common-hal/os/__init__.c @@ -0,0 +1,62 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "genhdr/mpversion.h" +#include "py/mpconfig.h" +#include "py/objstr.h" +#include "py/objtuple.h" +#include "py/qstr.h" + + +STATIC const qstr os_uname_info_fields[] = { + MP_QSTR_sysname, MP_QSTR_nodename, + MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine +}; +STATIC const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, "rp2040"); +STATIC const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, "rp2040"); +STATIC const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING); +STATIC const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE); +STATIC const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME); + + +STATIC MP_DEFINE_ATTRTUPLE( + os_uname_info_obj, + os_uname_info_fields, + 5, + (mp_obj_t)&os_uname_info_sysname_obj, + (mp_obj_t)&os_uname_info_nodename_obj, + (mp_obj_t)&os_uname_info_release_obj, + (mp_obj_t)&os_uname_info_version_obj, + (mp_obj_t)&os_uname_info_machine_obj +); + +mp_obj_t common_hal_os_uname(void) { + return (mp_obj_t)&os_uname_info_obj; +} + +bool common_hal_os_urandom(uint8_t* buffer, uint32_t length) { + return false; +} diff --git a/ports/raspberrypi/common-hal/pwmio/PWMOut.c b/ports/raspberrypi/common-hal/pwmio/PWMOut.c new file mode 100644 index 0000000000000..567ec5ef54fba --- /dev/null +++ b/ports/raspberrypi/common-hal/pwmio/PWMOut.c @@ -0,0 +1,216 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 + +#include "py/runtime.h" +#include "common-hal/pwmio/PWMOut.h" +#include "shared-bindings/pwmio/PWMOut.h" +#include "shared-bindings/microcontroller/Processor.h" + +#include "supervisor/shared/translate.h" + +#include "src/rp2040/hardware_regs/include/hardware/platform_defs.h" +#include "src/rp2_common/hardware_clocks/include/hardware/clocks.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" +#include "src/rp2_common/hardware_pwm/include/hardware/pwm.h" + +uint32_t target_slice_frequencies[NUM_PWM_SLICES]; +uint32_t slice_fixed_frequency; + +#define CHANNELS_PER_SLICE 2 +static uint32_t channel_use; +static uint32_t never_reset_channel; + +static uint32_t _mask(uint8_t slice, uint8_t channel) { + return 1 << (slice * CHANNELS_PER_SLICE + channel); +} + +void common_hal_pwmio_pwmout_never_reset(pwmio_pwmout_obj_t *self) { + never_reset_channel |= _mask(self->slice, self->channel); + + never_reset_pin_number(self->pin->number); +} + +void common_hal_pwmio_pwmout_reset_ok(pwmio_pwmout_obj_t *self) { + never_reset_channel &= ~_mask(self->slice, self->channel); +} + +void pwmout_reset(void) { + // Reset all slices + for (size_t slice = 0; slice < NUM_PWM_SLICES; slice++) { + bool reset = true; + for (size_t channel = 0; channel < CHANNELS_PER_SLICE; channel++) { + uint32_t channel_use_mask = _mask(slice, channel); + if ((never_reset_channel & channel_use_mask) != 0) { + reset = false; + continue; + } + channel_use &= ~channel_use_mask; + } + if (!reset) { + continue; + } + pwm_set_enabled(slice, false); + target_slice_frequencies[slice] = 0; + slice_fixed_frequency &= ~(1 << slice); + } +} + +pwmout_result_t common_hal_pwmio_pwmout_construct(pwmio_pwmout_obj_t* self, + const mcu_pin_obj_t* pin, + uint16_t duty, + uint32_t frequency, + bool variable_frequency) { + self->pin = pin; + self->variable_frequency = variable_frequency; + self->duty_cycle = duty; + + if (frequency == 0 || frequency > (common_hal_mcu_processor_get_frequency() / 2)) { + return PWMOUT_INVALID_FREQUENCY; + } + + uint8_t slice = pwm_gpio_to_slice_num(pin->number); + uint8_t channel = pwm_gpio_to_channel(pin->number); + uint32_t channel_use_mask = _mask(slice, channel); + + // Check the channel first. + if ((channel_use & channel_use_mask) != 0) { + return PWMOUT_ALL_TIMERS_ON_PIN_IN_USE; + } + // Now check if the slice is in use and if we can share with it. + if (target_slice_frequencies[slice] > 0) { + // If we want to change frequency then we can't share. + if (variable_frequency) { + return PWMOUT_ALL_TIMERS_ON_PIN_IN_USE; + } + // If the other user wants to change frequency then we can't share either. + if ((slice_fixed_frequency & (1 << slice)) != 0) { + return PWMOUT_ALL_TIMERS_ON_PIN_IN_USE; + } + // If we're both fixed frequency but we don't match target frequencies then we can't share. + if (target_slice_frequencies[slice] != frequency) { + return PWMOUT_ALL_TIMERS_ON_PIN_IN_USE; + } + } + self->slice = slice; + self->channel = channel; + channel_use |= channel_use_mask; + if (!variable_frequency) { + slice_fixed_frequency |= 1 << slice; + } + + if (target_slice_frequencies[slice] != frequency) { + // Reset the counter and compare values. + pwm_hw->slice[slice].ctr = PWM_CH0_CTR_RESET; + common_hal_pwmio_pwmout_set_duty_cycle(self, duty); + common_hal_pwmio_pwmout_set_frequency(self, frequency); + pwm_set_enabled(slice, true); + } else { + common_hal_pwmio_pwmout_set_duty_cycle(self, duty); + } + + // Connect to the pad last to avoid any glitches from changing settings. + gpio_set_function(pin->number, GPIO_FUNC_PWM); + + return PWMOUT_OK; +} + +bool common_hal_pwmio_pwmout_deinited(pwmio_pwmout_obj_t* self) { + return self->pin == NULL; +} + +void common_hal_pwmio_pwmout_deinit(pwmio_pwmout_obj_t* self) { + if (common_hal_pwmio_pwmout_deinited(self)) { + return; + } + uint32_t channel_mask = _mask(self->slice, self->channel); + channel_use &= ~channel_mask; + never_reset_channel &= ~channel_mask; + uint32_t slice_mask = ((1 << CHANNELS_PER_SLICE) - 1) << (self->slice * CHANNELS_PER_SLICE + self->channel); + if ((channel_use & slice_mask) == 0) { + target_slice_frequencies[self->slice] = 0; + slice_fixed_frequency &= ~(1 << self->slice); + pwm_set_enabled(self->slice, false); + } + + reset_pin_number(self->pin->number); + self->pin = NULL; +} + +extern void common_hal_pwmio_pwmout_set_duty_cycle(pwmio_pwmout_obj_t* self, uint16_t duty) { + self->duty_cycle = duty; + uint16_t actual_duty = duty * self->top / ((1 << 16) - 1); + pwm_set_chan_level(self->slice, self->channel, actual_duty); +} + +uint16_t common_hal_pwmio_pwmout_get_duty_cycle(pwmio_pwmout_obj_t* self) { + return self->duty_cycle; +} + +void common_hal_pwmio_pwmout_set_frequency(pwmio_pwmout_obj_t* self, uint32_t frequency) { + if (frequency == 0 || frequency > (common_hal_mcu_processor_get_frequency() / 2)) { + mp_raise_ValueError(translate("Invalid PWM frequency")); + } + + target_slice_frequencies[self->slice] = frequency; + + // For low frequencies use the divider to give us full resolution duty_cycle. + if (frequency < (common_hal_mcu_processor_get_frequency() / (1 << 16))) { + // Compute the divisor. It's an 8 bit integer and 4 bit fraction. Therefore, + // we compute everything * 16 for the fractional part. + // This is 1 << 12 because 4 bits are the * 16. + uint64_t frequency16 = ((uint64_t) clock_get_hz(clk_sys)) / (1 << 12); + uint64_t div16 = frequency16 / frequency; + // Round the divisor to try and get closest to the target frequency. We could + // also always round up and use TOP to get us closer. We may not need that though. + if (frequency16 % frequency >= frequency / 2) { + div16 += 1; + } + if (div16 >= (1 << 12)) { + div16 = (1 << 12) - 1; + } + self->actual_frequency = frequency16 / div16; + self->top = 1 << 16; + pwm_set_clkdiv_int_frac(self->slice, div16 / 16, div16 % 16); + pwm_set_wrap(self->slice, self->top - 1); + } else { + uint32_t top = common_hal_mcu_processor_get_frequency() / frequency; + self->actual_frequency = common_hal_mcu_processor_get_frequency() / top; + self->top = top; + pwm_set_clkdiv_int_frac(self->slice, 1, 0); + pwm_set_wrap(self->slice, self->top - 1); + } + common_hal_pwmio_pwmout_set_duty_cycle(self, self->duty_cycle); +} + +uint32_t common_hal_pwmio_pwmout_get_frequency(pwmio_pwmout_obj_t* self) { + return self->actual_frequency; +} + +bool common_hal_pwmio_pwmout_get_variable_frequency(pwmio_pwmout_obj_t* self) { + return self->variable_frequency; +} diff --git a/ports/raspberrypi/common-hal/pwmio/PWMOut.h b/ports/raspberrypi/common-hal/pwmio/PWMOut.h new file mode 100644 index 0000000000000..50f84777b5101 --- /dev/null +++ b/ports/raspberrypi/common-hal/pwmio/PWMOut.h @@ -0,0 +1,47 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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. + */ + +#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PWMIO_PWMOUT_H +#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PWMIO_PWMOUT_H + +#include "common-hal/microcontroller/Pin.h" + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + const mcu_pin_obj_t *pin; + uint8_t slice; + uint8_t channel; + bool variable_frequency; + uint16_t duty_cycle; + uint32_t actual_frequency; + uint32_t top; +} pwmio_pwmout_obj_t; + +void pwmout_reset(void); + +#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PWMIO_PWMOUT_H diff --git a/ports/raspberrypi/common-hal/pwmio/__init__.c b/ports/raspberrypi/common-hal/pwmio/__init__.c new file mode 100644 index 0000000000000..9e551a1072b3c --- /dev/null +++ b/ports/raspberrypi/common-hal/pwmio/__init__.c @@ -0,0 +1 @@ +// No pwmio module functions. diff --git a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c new file mode 100644 index 0000000000000..d613771a4f80b --- /dev/null +++ b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c @@ -0,0 +1,586 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "bindings/rp2pio/StateMachine.h" + +#include "common-hal/microcontroller/__init__.h" +#include "shared-bindings/microcontroller/Pin.h" + +#include "src/rp2040/hardware_regs/include/hardware/platform_defs.h" +#include "src/rp2_common/hardware_clocks/include/hardware/clocks.h" +#include "src/rp2_common/hardware_dma/include/hardware/dma.h" +#include "src/rp2_common/hardware_pio/include/hardware/pio_instructions.h" +#include "src/rp2040/hardware_structs/include/hardware/structs/iobank0.h" + +#include "lib/utils/interrupt_char.h" +#include "py/obj.h" +#include "py/objproperty.h" +#include "py/runtime.h" + +// Count how many state machines are using each pin. +STATIC uint8_t _pin_reference_count[TOTAL_GPIO_COUNT]; +STATIC uint32_t _current_program_id[NUM_PIOS][NUM_PIO_STATE_MACHINES]; +STATIC uint8_t _current_program_offset[NUM_PIOS][NUM_PIO_STATE_MACHINES]; +STATIC uint8_t _current_program_len[NUM_PIOS][NUM_PIO_STATE_MACHINES]; +STATIC bool _never_reset[NUM_PIOS][NUM_PIO_STATE_MACHINES]; + +STATIC uint32_t _current_pins[NUM_PIOS]; +STATIC uint32_t _current_sm_pins[NUM_PIOS][NUM_PIO_STATE_MACHINES]; + +STATIC PIO pio_instances[2] = {pio0, pio1}; + +void _reset_statemachine(PIO pio, uint8_t sm, bool leave_pins) { + uint8_t pio_index = pio_get_index(pio); + pio_sm_unclaim(pio, sm); + uint32_t program_id = _current_program_id[pio_index][sm]; + if (program_id == 0) { + return; + } + _current_program_id[pio_index][sm] = 0; + bool program_in_use = false; + for (size_t i = 0; i < NUM_PIO_STATE_MACHINES; i++) { + if (_current_program_id[pio_index][i] == program_id) { + program_in_use = true; + break; + } + } + if (!program_in_use) { + uint8_t offset = _current_program_offset[pio_index][sm]; + pio_program_t program_struct = { + .length = _current_program_len[pio_index][sm] + }; + pio_remove_program(pio, &program_struct, offset); + } + + uint32_t pins = _current_sm_pins[pio_index][sm]; + for (size_t pin_number = 0; pin_number < TOTAL_GPIO_COUNT; pin_number++) { + if ((pins & (1 << pin_number)) == 0) { + continue; + } + _pin_reference_count[pin_number]--; + if (_pin_reference_count[pin_number] == 0) { + if (!leave_pins) { + reset_pin_number(pin_number); + } + _current_pins[pio_index] &= ~(1 << pin_number); + } + } + _current_sm_pins[pio_index][sm] = 0; +} + +void reset_rp2pio_statemachine(void) { + for (size_t i = 0; i < NUM_PIOS; i++) { + PIO pio = pio_instances[i]; + for (size_t j = 0; j < NUM_PIO_STATE_MACHINES; j++) { + if (_never_reset[i][j]) { + continue; + } + _reset_statemachine(pio, j, false); + } + } +} + +STATIC uint32_t _check_pins_free(const mcu_pin_obj_t * first_pin, uint8_t pin_count, bool exclusive_pin_use) { + uint32_t pins_we_use = 0; + if (first_pin != NULL) { + for (size_t i = 0; i < pin_count; i++) { + uint8_t pin_number = first_pin->number + i; + if (pin_number >= TOTAL_GPIO_COUNT) { + mp_raise_ValueError(translate("Pin count too large")); + } + const mcu_pin_obj_t * pin = mcu_pin_global_dict_table[pin_number].value; + if (exclusive_pin_use || _pin_reference_count[pin_number] == 0) { + assert_pin_free(pin); + } + pins_we_use |= 1 << pin_number; + } + } + return pins_we_use; +} + + +bool rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, + const uint16_t* program, size_t program_len, + size_t frequency, + const uint16_t* init, size_t init_len, + const mcu_pin_obj_t * first_out_pin, uint8_t out_pin_count, + const mcu_pin_obj_t * first_in_pin, uint8_t in_pin_count, + const mcu_pin_obj_t * first_set_pin, uint8_t set_pin_count, + const mcu_pin_obj_t * first_sideset_pin, uint8_t sideset_pin_count, + uint32_t pins_we_use, bool tx_fifo, bool rx_fifo, + bool auto_pull, uint8_t pull_threshold, bool out_shift_right, + bool auto_push, uint8_t push_threshold, bool in_shift_right, + bool claim_pins) { + // Create a program id that isn't the pointer so we can store it without storing the original object. + uint32_t program_id = ~((uint32_t) program); + + // Next, find a PIO and state machine to use. + size_t pio_index = NUM_PIOS; + uint8_t program_offset = 32; + pio_program_t program_struct = { + .instructions = (uint16_t*) program, + .length = program_len, + .origin = 0 + }; + for (size_t i = 0; i < NUM_PIOS; i++) { + PIO pio = pio_instances[i]; + uint8_t free_count = 0; + for (size_t j = 0; j < NUM_PIO_STATE_MACHINES; j++) { + if (_current_program_id[i][j] == program_id && + _current_program_len[i][j] == program_len) { + program_offset = _current_program_offset[i][j]; + } + int temp_claim = pio_claim_unused_sm(pio, false); + if (temp_claim >= 0) { + pio_sm_unclaim(pio, temp_claim); + free_count++; + } + } + if (free_count > 0 && (program_offset < 32 || pio_can_add_program(pio, &program_struct))) { + pio_index = i; + if (program_offset < 32) { + break; + } + } + // Reset program offset if we weren't able to find a free state machine + // on that PIO. (We would have broken the loop otherwise.) + program_offset = 32; + } + + int state_machine = -1; + if (pio_index < NUM_PIOS) { + PIO pio = pio_instances[pio_index]; + for (size_t i = 0; i < NUM_PIOS; i++) { + if (i == pio_index) { + continue; + } + if ((_current_pins[i] & pins_we_use) != 0) { + // Pin in use by another PIO already. + return false; + } + } + state_machine = pio_claim_unused_sm(pio, false); + } + if (pio_index == NUM_PIOS || state_machine < 0 || state_machine >= NUM_PIO_STATE_MACHINES) { + return false; + } + + self->pio = pio_instances[pio_index]; + self->state_machine = state_machine; + if (program_offset == 32) { + program_offset = pio_add_program(self->pio, &program_struct); + } + _current_program_id[pio_index][state_machine] = program_id; + _current_program_len[pio_index][state_machine] = program_len; + _current_program_offset[pio_index][state_machine] = program_offset; + _current_sm_pins[pio_index][state_machine] = pins_we_use; + _current_pins[pio_index] |= pins_we_use; + + for (size_t pin_number = 0; pin_number < TOTAL_GPIO_COUNT; pin_number++) { + if ((pins_we_use & (1 << pin_number)) == 0) { + continue; + } + _pin_reference_count[pin_number]++; + const mcu_pin_obj_t * pin = mcu_pin_global_dict_table[pin_number].value; + // Also claim the pin at the top level when we're the first to grab it. + if (_pin_reference_count[pin_number] == 1) { + if (claim_pins) { + claim_pin(pin); + } + pio_gpio_init(self->pio, pin_number); + } + } + + pio_sm_config c = {0, 0, 0}; + + if (frequency == 0) { + frequency = clock_get_hz(clk_sys); + } + uint64_t frequency256 = ((uint64_t) clock_get_hz(clk_sys)) * 256; + uint64_t div256 = frequency256 / frequency; + if (frequency256 % div256 > 0) { + div256 += 1; + } + self->actual_frequency = frequency256 / div256; + sm_config_set_clkdiv_int_frac(&c, div256 / 256, div256 % 256); + + if (first_out_pin != NULL) { + sm_config_set_out_pins(&c, first_out_pin->number, out_pin_count); + } + if (first_in_pin != NULL) { + sm_config_set_in_pins(&c, first_in_pin->number); + } + if (first_set_pin != NULL) { + sm_config_set_set_pins(&c, first_set_pin->number, set_pin_count); + } + if (first_sideset_pin != NULL) { + sm_config_set_sideset(&c, sideset_pin_count, false /* optional */, false /* pin direction */); + sm_config_set_sideset_pins(&c, first_sideset_pin->number); + } + sm_config_set_wrap(&c, program_offset, program_offset + program_len - 1); + sm_config_set_in_shift(&c, in_shift_right, auto_push, push_threshold); + sm_config_set_out_shift(&c, out_shift_right, auto_pull, pull_threshold); + + enum pio_fifo_join join = PIO_FIFO_JOIN_NONE; + if (!rx_fifo) { + join = PIO_FIFO_JOIN_TX; + } else if (!tx_fifo) { + join = PIO_FIFO_JOIN_RX; + } + if (rx_fifo) { + self->rx_dreq = pio_get_dreq(self->pio, self->state_machine, false); + } + if (tx_fifo) { + self->tx_dreq = pio_get_dreq(self->pio, self->state_machine, true); + } + self->in = rx_fifo; + self->out = tx_fifo; + self->out_shift_right = out_shift_right; + self->in_shift_right = in_shift_right; + + sm_config_set_fifo_join(&c, join); + + pio_sm_init(self->pio, self->state_machine, program_offset, &c); + pio_sm_set_enabled(self->pio, self->state_machine, true); + for (size_t i = 0; i < init_len; i++) { + pio_sm_exec(self->pio, self->state_machine, init[i]); + } + return true; +} + +void common_hal_rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, + const uint16_t* program, size_t program_len, + size_t frequency, + const uint16_t* init, size_t init_len, + const mcu_pin_obj_t * first_out_pin, uint8_t out_pin_count, + const mcu_pin_obj_t * first_in_pin, uint8_t in_pin_count, + const mcu_pin_obj_t * first_set_pin, uint8_t set_pin_count, + const mcu_pin_obj_t * first_sideset_pin, uint8_t sideset_pin_count, + bool exclusive_pin_use, + bool auto_pull, uint8_t pull_threshold, bool out_shift_right, + bool auto_push, uint8_t push_threshold, bool in_shift_right) { + + // First, check that all pins are free OR already in use by any PIO if exclusive_pin_use is false. + uint32_t pins_we_use = 0; + pins_we_use |= _check_pins_free(first_out_pin, out_pin_count, exclusive_pin_use); + pins_we_use |= _check_pins_free(first_in_pin, in_pin_count, exclusive_pin_use); + pins_we_use |= _check_pins_free(first_set_pin, set_pin_count, exclusive_pin_use); + pins_we_use |= _check_pins_free(first_sideset_pin, sideset_pin_count, exclusive_pin_use); + + // Look through the program to see what we reference and make sure it was provided. + bool tx_fifo = false; + bool rx_fifo = false; + bool in_loaded = false; // can be loaded in other ways besides the fifo + bool out_loaded = false; + bool in_used = false; + bool out_used = false; + for (size_t i = 0; i < program_len; i++) { + uint16_t full_instruction = program[i]; + uint16_t instruction = full_instruction & 0xe000; + if (instruction == 0x8000) { + if ((full_instruction & 0xe080) == pio_instr_bits_push) { + rx_fifo = true; + in_loaded = true; + } else { // pull otherwise. + tx_fifo = true; + out_loaded = true; + } + } + if (instruction == pio_instr_bits_jmp) { + uint16_t condition = (full_instruction & 0x00e0) >> 5; + if (condition == 0x6) { // GPIO + mp_raise_NotImplementedError_varg(translate("Instruction %d jumps on pin"), i); + } + } + if (instruction == pio_instr_bits_wait) { + uint16_t wait_source = (full_instruction & 0x0060) >> 5; + uint16_t wait_index = full_instruction & 0x001f; + if (wait_source == 0 && (pins_we_use & (1 << wait_index)) == 0) { // GPIO + mp_raise_ValueError_varg(translate("Instruction %d uses extra pin"), i); + } + if (wait_source == 1) { // Input pin + if (first_in_pin == NULL) { + mp_raise_ValueError_varg(translate("Missing first_in_pin. Instruction %d waits based on pin"), i); + } + if (wait_index > in_pin_count) { + mp_raise_ValueError_varg(translate("Instruction %d waits on input outside of count"), i); + } + } + } + if (instruction == pio_instr_bits_in) { + uint16_t source = (full_instruction & 0x00e0) >> 5; + uint16_t bit_count = full_instruction & 0x001f; + if (source == 0) { + if (first_in_pin == NULL) { + mp_raise_ValueError_varg(translate("Missing first_in_pin. Instruction %d shifts in from pin(s)"), i); + } + if (bit_count > in_pin_count) { + mp_raise_ValueError_varg(translate("Instruction %d shifts in more bits than pin count"), i); + } + } + if (auto_push) { + in_loaded = true; + rx_fifo = true; + } + in_used = true; + } + if (instruction == pio_instr_bits_out) { + uint16_t bit_count = full_instruction & 0x001f; + uint16_t destination = (full_instruction & 0x00e0) >> 5; + // Check for pins or pindirs destination. + if (destination == 0x0 || destination == 0x4) { + if (first_out_pin == NULL) { + mp_raise_ValueError_varg(translate("Missing first_out_pin. Instruction %d shifts out to pin(s)"), i); + } + if (bit_count > out_pin_count) { + mp_raise_ValueError_varg(translate("Instruction %d shifts out more bits than pin count"), i); + } + } + if (auto_pull) { + out_loaded = true; + tx_fifo = true; + } + out_used = true; + } + if (instruction == pio_instr_bits_set) { + uint16_t destination = (full_instruction & 0x00e0) >> 5; + // Check for pins or pindirs destination. + if ((destination == 0x00 || destination == 0x4) && first_set_pin == NULL) { + mp_raise_ValueError_varg(translate("Missing first_set_pin. Instruction %d sets pin(s)"), i); + } + } + if (instruction == pio_instr_bits_mov) { + uint16_t source = full_instruction & 0x0007; + uint16_t destination = (full_instruction & 0x00e0) >> 5; + // Check for pins or pindirs destination. + if (destination == 0x0 && first_out_pin == NULL) { + mp_raise_ValueError_varg(translate("Missing first_out_pin. Instruction %d writes pin(s)"), i); + } + if (source == 0x0 && first_in_pin == NULL) { + mp_raise_ValueError_varg(translate("Missing first_in_pin. Instruction %d reads pin(s)"), i); + } + if (destination == 0x6) { + in_loaded = true; + } else if (destination == 0x7) { + out_loaded = true; + } + } + } + + if (!in_loaded && in_used) { + mp_raise_ValueError_varg(translate("Program does IN without loading ISR")); + } + if (!out_loaded && out_used) { + mp_raise_ValueError_varg(translate("Program does OUT without loading OSR")); + } + + if (in_pin_count > 8 || out_pin_count > 8) { + mp_raise_NotImplementedError(translate("Only IN/OUT of up to 8 supported")); + } + + bool ok = rp2pio_statemachine_construct(self, + program, program_len, + frequency, + init, init_len, + first_out_pin, out_pin_count, + first_in_pin, in_pin_count, + first_set_pin, set_pin_count, + first_sideset_pin, sideset_pin_count, + pins_we_use, tx_fifo, rx_fifo, + auto_pull, pull_threshold, out_shift_right, + auto_push, push_threshold, in_shift_right, + true /* claim pins */); + if (!ok) { + mp_raise_RuntimeError(translate("All state machines in use")); + } +} + +uint32_t common_hal_rp2pio_statemachine_get_frequency(rp2pio_statemachine_obj_t* self) { + return self->actual_frequency; +} + +void rp2pio_statemachine_deinit(rp2pio_statemachine_obj_t *self, bool leave_pins) { + uint8_t sm = self->state_machine; + uint8_t pio_index = pio_get_index(self->pio); + _never_reset[pio_index][sm] = false; + _reset_statemachine(self->pio, sm, leave_pins); + self->state_machine = NUM_PIO_STATE_MACHINES; +} + +void common_hal_rp2pio_statemachine_deinit(rp2pio_statemachine_obj_t *self) { + rp2pio_statemachine_deinit(self, false); +} + +void common_hal_rp2pio_statemachine_never_reset(rp2pio_statemachine_obj_t *self) { + uint8_t sm = self->state_machine; + uint8_t pio_index = pio_get_index(self->pio); + _never_reset[pio_index][sm] = true; + // TODO: never reset all the pins +} + +bool common_hal_rp2pio_statemachine_deinited(rp2pio_statemachine_obj_t *self) { + return self->state_machine == NUM_PIO_STATE_MACHINES; +} + +static bool _transfer(rp2pio_statemachine_obj_t *self, + const uint8_t *data_out, size_t out_len, + uint8_t *data_in, size_t in_len) { + // This implementation is based on SPI but varies because the tx and rx buffers + // may be different lengths and occur at different times or speeds. + + // Use DMA for large transfers if channels are available + const size_t dma_min_size_threshold = 32; + int chan_tx = -1; + int chan_rx = -1; + size_t len = MAX(out_len, in_len); + bool tx = data_out != NULL; + bool rx = data_in != NULL; + if (len >= dma_min_size_threshold) { + // Use DMA channels to service the two FIFOs + if (tx) { + chan_tx = dma_claim_unused_channel(false); + } + if (rx) { + chan_rx = dma_claim_unused_channel(false); + } + } + volatile uint8_t* tx_destination = NULL; + const volatile uint8_t* rx_source = NULL; + if (tx) { + tx_destination = (volatile uint8_t*) &self->pio->txf[self->state_machine]; + if (!self->out_shift_right) { + tx_destination += 3; + } + } + if (rx) { + rx_source = (const volatile uint8_t*) &self->pio->rxf[self->state_machine]; + if (!self->in_shift_right) { + rx_source += 3; + } + } + bool use_dma = (!rx || chan_rx >= 0) && (!tx || chan_tx >= 0); + if (use_dma) { + dma_channel_config c; + uint32_t channel_mask = 0; + if (tx) { + c = dma_channel_get_default_config(chan_tx); + channel_config_set_transfer_data_size(&c, DMA_SIZE_8); + channel_config_set_dreq(&c, self->tx_dreq); + channel_config_set_read_increment(&c, true); + channel_config_set_write_increment(&c, false); + dma_channel_configure(chan_tx, &c, + tx_destination, + data_out, + len, + false); + channel_mask |= 1u << chan_tx; + } + if (rx) { + c = dma_channel_get_default_config(chan_rx); + channel_config_set_transfer_data_size(&c, DMA_SIZE_8); + channel_config_set_dreq(&c, self->rx_dreq); + channel_config_set_read_increment(&c, false); + channel_config_set_write_increment(&c, true); + dma_channel_configure(chan_rx, &c, + data_in, + rx_source, + len, + false); + channel_mask |= 1u << chan_rx; + } + + dma_start_channel_mask(channel_mask); + while ((rx && dma_channel_is_busy(chan_rx)) || + (tx && dma_channel_is_busy(chan_tx))) { + // TODO: We should idle here until we get a DMA interrupt or something else. + RUN_BACKGROUND_TASKS; + if (mp_hal_is_interrupted()) { + if (rx && dma_channel_is_busy(chan_rx)) { + dma_channel_abort(chan_rx); + } + if (tx && dma_channel_is_busy(chan_tx)) { + dma_channel_abort(chan_tx); + } + break; + } + } + // Clear the stall bit so we can detect when the state machine is done transmitting. + self->pio->fdebug = PIO_FDEBUG_TXSTALL_BITS; + } + + // If we have claimed only one channel successfully, we should release immediately. This also + // releases the DMA after use_dma has been done. + if (chan_rx >= 0) { + dma_channel_unclaim(chan_rx); + } + if (chan_tx >= 0) { + dma_channel_unclaim(chan_tx); + } + + if (!use_dma && !mp_hal_is_interrupted()) { + // Use software for small transfers, or if couldn't claim two DMA channels + size_t rx_remaining = in_len; + size_t tx_remaining = out_len; + + while (rx_remaining || tx_remaining) { + if (tx_remaining && !pio_sm_is_tx_fifo_full(self->pio, self->state_machine)) { + *tx_destination = *data_out; + data_out++; + --tx_remaining; + } + if (rx_remaining && !pio_sm_is_rx_fifo_empty(self->pio, self->state_machine)) { + *data_in = (uint8_t) *rx_source; + data_in++; + --rx_remaining; + } + RUN_BACKGROUND_TASKS; + if (mp_hal_is_interrupted()) { + break; + } + } + // Clear the stall bit so we can detect when the state machine is done transmitting. + self->pio->fdebug = PIO_FDEBUG_TXSTALL_BITS; + } + // Wait for the state machine to finish transmitting the data we've queued + // up. + if (tx) { + while (!pio_sm_is_tx_fifo_empty(self->pio, self->state_machine) || + (self->pio->fdebug & PIO_FDEBUG_TXSTALL_BITS) == 0) { + RUN_BACKGROUND_TASKS; + } + } + return true; +} + +// Writes out the given data. +bool common_hal_rp2pio_statemachine_write(rp2pio_statemachine_obj_t *self, + const uint8_t *data, size_t len) { + if (!self->out) { + mp_raise_RuntimeError(translate("No out in program")); + } + return _transfer(self, data, len, NULL, 0); +} + diff --git a/ports/raspberrypi/common-hal/rp2pio/StateMachine.h b/ports/raspberrypi/common-hal/rp2pio/StateMachine.h new file mode 100644 index 0000000000000..6b70b6b5b5b2e --- /dev/null +++ b/ports/raspberrypi/common-hal/rp2pio/StateMachine.h @@ -0,0 +1,68 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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. + */ + +#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_RP2PIO_STATEMACHINE_H +#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_RP2PIO_STATEMACHINE_H + +#include "py/obj.h" + +#include "src/rp2_common/hardware_pio/include/hardware/pio.h" + +typedef struct { + mp_obj_base_t base; + uint32_t pins; // Bitmask of what pins this state machine uses. + int state_machine; + PIO pio; + bool in; + bool out; + uint tx_dreq; + uint rx_dreq; + bool out_shift_right; + bool in_shift_right; + uint32_t actual_frequency; +} rp2pio_statemachine_obj_t; + +void reset_rp2pio_statemachine(void); + +// Minimal internal version that only fails on pin error (not in use) or full PIO. +bool rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, + const uint16_t* program, size_t program_len, + size_t frequency, + const uint16_t* init, size_t init_len, + const mcu_pin_obj_t * first_out_pin, uint8_t out_pin_count, + const mcu_pin_obj_t * first_in_pin, uint8_t in_pin_count, + const mcu_pin_obj_t * first_set_pin, uint8_t set_pin_count, + const mcu_pin_obj_t * first_sideset_pin, uint8_t sideset_pin_count, + uint32_t pins_we_use, bool tx_fifo, bool rx_fifo, + bool auto_pull, uint8_t pull_threshold, bool out_shift_right, + bool auto_push, uint8_t push_threshold, bool in_shift_right, + bool claim_pins); + +void rp2pio_statemachine_deinit(rp2pio_statemachine_obj_t *self, bool leave_pins); + +extern const mp_obj_type_t rp2pio_statemachine_type; + +#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_RP2PIO_STATEMACHINE_H diff --git a/ports/raspberrypi/common-hal/rp2pio/__init__.c b/ports/raspberrypi/common-hal/rp2pio/__init__.c new file mode 100644 index 0000000000000..21699dfa36958 --- /dev/null +++ b/ports/raspberrypi/common-hal/rp2pio/__init__.c @@ -0,0 +1 @@ +// Nothing yet. diff --git a/ports/raspberrypi/common-hal/supervisor/Runtime.c b/ports/raspberrypi/common-hal/supervisor/Runtime.c new file mode 100755 index 0000000000000..6be38f216ac16 --- /dev/null +++ b/ports/raspberrypi/common-hal/supervisor/Runtime.c @@ -0,0 +1,37 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2018 Michael Schroeder + * + * 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 +#include "shared-bindings/supervisor/Runtime.h" +#include "supervisor/serial.h" + +bool common_hal_get_serial_connected(void) { + return (bool) serial_connected(); +} + +bool common_hal_get_serial_bytes_available(void) { + return (bool) serial_bytes_available(); +} diff --git a/ports/raspberrypi/common-hal/supervisor/Runtime.h b/ports/raspberrypi/common-hal/supervisor/Runtime.h new file mode 100755 index 0000000000000..45db489bda9c2 --- /dev/null +++ b/ports/raspberrypi/common-hal/supervisor/Runtime.h @@ -0,0 +1,37 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2018 Michael Schroeder + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_SUPERVISOR_RUNTIME_H +#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_SUPERVISOR_RUNTIME_H + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + // Stores no state currently. +} super_runtime_obj_t; + +#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_SUPERVISOR_RUNTIME_H diff --git a/ports/raspberrypi/common-hal/supervisor/__init__.c b/ports/raspberrypi/common-hal/supervisor/__init__.c new file mode 100755 index 0000000000000..6dca35fb5aeb1 --- /dev/null +++ b/ports/raspberrypi/common-hal/supervisor/__init__.c @@ -0,0 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2018 Michael Schroeder + * + * 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 "py/obj.h" + +#include "shared-bindings/supervisor/__init__.h" +#include "shared-bindings/supervisor/Runtime.h" + + +// The singleton supervisor.Runtime object, bound to supervisor.runtime +// It currently only has properties, and no state. +const super_runtime_obj_t common_hal_supervisor_runtime_obj = { + .base = { + .type = &supervisor_runtime_type, + }, +}; diff --git a/ports/raspberrypi/fatfs_port.c b/ports/raspberrypi/fatfs_port.c new file mode 100644 index 0000000000000..c65a73a428fcc --- /dev/null +++ b/ports/raspberrypi/fatfs_port.c @@ -0,0 +1,48 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George + * + * 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 "py/mphal.h" +#include "py/runtime.h" +#include "lib/oofatfs/ff.h" /* FatFs lower layer API */ +#include "lib/oofatfs/diskio.h" /* FatFs lower layer API */ +#include "lib/timeutils/timeutils.h" + +#if CIRCUITPY_RTC +#include "shared-bindings/rtc/RTC.h" +#endif + +DWORD get_fattime(void) { +#if CIRCUITPY_RTC + timeutils_struct_time_t tm; + common_hal_rtc_get_time(&tm); + return ((tm.tm_year - 1980) << 25) | (tm.tm_mon << 21) | (tm.tm_mday << 16) | + (tm.tm_hour << 11) | (tm.tm_min << 5) | (tm.tm_sec >> 1); +#else + return ((2016 - 1980) << 25) | ((9) << 21) | ((1) << 16) | ((16) << 11) | ((43) << 5) | (35 / 2); +#endif + + +} diff --git a/ports/raspberrypi/link.ld b/ports/raspberrypi/link.ld new file mode 100644 index 0000000000000..dcf5c9a37a147 --- /dev/null +++ b/ports/raspberrypi/link.ld @@ -0,0 +1,251 @@ +/* Based on GCC ARM embedded samples. + Defines the following symbols for use by code: + __exidx_start + __exidx_end + __etext + __data_start__ + __preinit_array_start + __preinit_array_end + __init_array_start + __init_array_end + __fini_array_start + __fini_array_end + __data_end__ + __bss_start__ + __bss_end__ + __end__ + end + __HeapLimit + __StackLimit + __StackTop + __stack (== StackTop) +*/ + +MEMORY +{ + FLASH_FIRMWARE (rx) : ORIGIN = 0x10000000, LENGTH = 1024k + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256k + SCRATCH_X (rwx) : ORIGIN = 0x20040000, LENGTH = 4k + SCRATCH_Y (rwx) : ORIGIN = 0x20041000, LENGTH = 4k +} + +ENTRY(_entry_point) + +SECTIONS +{ + /* Second stage bootloader is prepended to the image. It must be 256 bytes big + and checksummed. It is usually built by the boot_stage2 target + in the Pico SDK + */ + + .flash_begin : { + __flash_binary_start = .; + } > FLASH_FIRMWARE + + .boot2 : { + __boot2_start__ = .; + KEEP (*(.boot2)) + __boot2_end__ = .; + } > FLASH_FIRMWARE + + ASSERT(__boot2_end__ - __boot2_start__ == 256, + "ERROR: Pico second stage bootloader must be 256 bytes in size") + + /* The second stage will always enter the image at the start of .text. + The debugger will use the ELF entry point, which is the _entry_point + symbol if present, otherwise defaults to start of .text. + This can be used to transfer control back to the bootrom on debugger + launches only, to perform proper flash setup. + */ + + .text : { + __reset_start = .; + KEEP (*(.reset)) + . = ALIGN(256); + __reset_end = .; + ASSERT(__reset_end - __reset_start == 256, "ERROR: reset section should only be 256 bytes"); + KEEP (*(.vectors)) + /* TODO revisit this now memset/memcpy/float in ROM */ + /* bit of a hack right now to exclude all floating point and time critical (e.g. memset, memcpy) code from + * FLASH ... we will include any thing excluded here in .data below by default */ + *(.init) + *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .text*) + *(.fini) + /* Pull all c'tors into .text */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + /* Followed by destructors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.eh_frame*) + . = ALIGN(4); + } > FLASH_FIRMWARE + + .rodata : { + *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .rodata*) + . = ALIGN(4); + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.flashdata*))) + . = ALIGN(4); + } > FLASH_FIRMWARE + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH_FIRMWARE + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH_FIRMWARE + __exidx_end = .; + + /* Machine inspectable binary information */ + . = ALIGN(4); + __binary_info_start = .; + .binary_info : + { + KEEP(*(.binary_info.keep.*)) + *(.binary_info.*) + } > FLASH_FIRMWARE + __binary_info_end = .; + . = ALIGN(4); + + /* End of .text-like segments */ + __etext = .; + + .ram_vector_table (COPY): { + *(.ram_vector_table) + } > RAM + + .data : { + __data_start__ = .; + *(vtable) + + *(.time_critical*) + + /* remaining .text and .rodata; i.e. stuff we exclude above because we want it in RAM */ + *(.text*) + . = ALIGN(4); + *(.rodata*) + . = ALIGN(4); + + *(.data*) + + . = ALIGN(4); + *(.after_data.*) + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__mutex_array_start = .); + KEEP(*(SORT(.mutex_array.*))) + KEEP(*(.mutex_array)) + PROVIDE_HIDDEN (__mutex_array_end = .); + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(SORT(.preinit_array.*))) + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + *(SORT(.fini_array.*)) + *(.fini_array) + PROVIDE_HIDDEN (__fini_array_end = .); + + *(.jcr) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + } > RAM AT> FLASH_FIRMWARE + + .uninitialized_data (COPY): { + . = ALIGN(4); + *(.uninitialized_data*) + } > RAM + + /* Start and end symbols must be word-aligned */ + .scratch_x : { + __scratch_x_start__ = .; + *(.scratch_x.*) + . = ALIGN(4); + __scratch_x_end__ = .; + } > SCRATCH_X AT > FLASH_FIRMWARE + __scratch_x_source__ = LOADADDR(.scratch_x); + + .scratch_y : { + __scratch_y_start__ = .; + *(.scratch_y.*) + . = ALIGN(4); + __scratch_y_end__ = .; + } > SCRATCH_Y AT > FLASH_FIRMWARE + __scratch_y_source__ = LOADADDR(.scratch_y); + + .bss : { + . = ALIGN(4); + __bss_start__ = .; + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.bss*))) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + end = __end__; + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack*_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later + * + * stack1 section may be empty/missing if platform_launch_core1 is not used */ + + /* by default we put core 0 stack at the end of scratch Y, so that if core 1 + * stack is not used then all of SCRATCH_X is free. + */ + .stack1_dummy (COPY): + { + *(.stack1*) + } > SCRATCH_X + .stack_dummy (COPY): + { + *(.stack*) + } > SCRATCH_Y + + .flash_end : { + __flash_binary_end = .; + } > FLASH_FIRMWARE + + /* stack limit is poorly named, but historically is maximum heap ptr */ + __StackLimit = ORIGIN(RAM) + LENGTH(RAM); + __StackOneTop = ORIGIN(SCRATCH_X) + LENGTH(SCRATCH_X); + __StackTop = ORIGIN(SCRATCH_Y) + LENGTH(SCRATCH_Y); + __StackOneBottom = __StackOneTop - SIZEOF(.stack1_dummy); + __StackBottom = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed") + /* todo assert on extra code */ +} + diff --git a/ports/raspberrypi/mpconfigport.h b/ports/raspberrypi/mpconfigport.h new file mode 100644 index 0000000000000..3fdc8febbf0bb --- /dev/null +++ b/ports/raspberrypi/mpconfigport.h @@ -0,0 +1,46 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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. + */ + +#ifndef __INCLUDED_MPCONFIGPORT_H +#define __INCLUDED_MPCONFIGPORT_H + +#define MICROPY_PY_UJSON (1) + +#define CIRCUITPY_INTERNAL_NVM_SIZE 0 + +#define CIRCUITPY_DEFAULT_STACK_SIZE (24*1024) + +#define MICROPY_USE_INTERNAL_PRINTF (1) + +#define CIRCUITPY_PROCESSOR_COUNT (2) + +// This also includes mpconfigboard.h. +#include "py/circuitpy_mpconfig.h" + +#define MICROPY_PORT_ROOT_POINTERS \ + CIRCUITPY_COMMON_ROOT_POINTERS; + +#endif // __INCLUDED_MPCONFIGPORT_H diff --git a/ports/raspberrypi/mpconfigport.mk b/ports/raspberrypi/mpconfigport.mk new file mode 100644 index 0000000000000..a6211be73d75d --- /dev/null +++ b/ports/raspberrypi/mpconfigport.mk @@ -0,0 +1,44 @@ +# Define an equivalent for MICROPY_LONGINT_IMPL, to pass to $(MPY-TOOL) in py/mkrules.mk +# $(MPY-TOOL) needs to know what kind of longint to use (if any) to freeze long integers. +# This should correspond to the MICROPY_LONGINT_IMPL definition in mpconfigport.h. + +ifeq ($(LONGINT_IMPL),NONE) +MPY_TOOL_LONGINT_IMPL = -mlongint-impl=none +endif + +ifeq ($(LONGINT_IMPL),MPZ) +MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz +endif + +ifeq ($(LONGINT_IMPL),LONGLONG) +MPY_TOOL_LONGINT_IMPL = -mlongint-impl=longlong +endif + +ifndef CIRCUITPY_RP2PIO +CIRCUITPY_RP2PIO = 1 +else +CIRCUITPY_NEOPIXEL_WRITE = 0 +endif + +CIRCUITPY_FULL_BUILD = 1 +CIRCUITPY_PWMIO = 1 + +# Things that need to be implemented. +CIRCUITPY_AUDIOBUSIO = 0 # Use PIO interally for I2S +CIRCUITPY_AUDIOMP3 = 0 +CIRCUITPY_COUNTIO = 0 # Use PWM interally +CIRCUITPY_FREQUENCYIO = 0 # Use PWM interally +CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_NVM = 0 +CIRCUITPY_PULSEIO = 0 # Use PIO interally +CIRCUITPY_ROTARYIO = 0 # Use PIO interally +CIRCUITPY_RTC = 0 + +# Things that are unsupported by the hardware. +CIRCUITPY_AUDIOIO = 0 + +INTERNAL_LIBM = 1 + +USB_SERIAL_NUMBER_LENGTH = 32 + +USB_NUM_EP = 8 diff --git a/ports/raspberrypi/mphalport.c b/ports/raspberrypi/mphalport.c new file mode 100644 index 0000000000000..89b597bc74134 --- /dev/null +++ b/ports/raspberrypi/mphalport.c @@ -0,0 +1,57 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 + +#include "lib/mp-readline/readline.h" +#include "lib/utils/interrupt_char.h" +#include "py/mphal.h" +#include "py/mpstate.h" +#include "py/runtime.h" +#include "py/smallint.h" +#include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/time/__init__.h" +#include "supervisor/shared/autoreload.h" + +#include "mpconfigboard.h" +#include "mphalport.h" +#include "supervisor/shared/tick.h" + +#include "src/rp2_common/hardware_timer/include/hardware/timer.h" + +extern uint32_t common_hal_mcu_processor_get_frequency(void); + +void mp_hal_delay_us(mp_uint_t delay) { + busy_wait_us_32(delay); +} + +void mp_hal_disable_all_interrupts(void) { + common_hal_mcu_disable_interrupts(); +} + +void mp_hal_enable_all_interrupts(void) { + common_hal_mcu_enable_interrupts(); +} diff --git a/ports/raspberrypi/mphalport.h b/ports/raspberrypi/mphalport.h new file mode 100644 index 0000000000000..8d2d7d51a2fb8 --- /dev/null +++ b/ports/raspberrypi/mphalport.h @@ -0,0 +1,50 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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. + */ + +#ifndef MICROPY_INCLUDED_RASPBERRYPI_MPHALPORT_H +#define MICROPY_INCLUDED_RASPBERRYPI_MPHALPORT_H + +#include "py/obj.h" + +#include "lib/oofatfs/ff.h" + +#include "supervisor/shared/tick.h" + +// Global millisecond tick count (driven by SysTick interrupt). +#define mp_hal_ticks_ms() ((mp_uint_t) supervisor_ticks_ms32()) + +// Number of bytes in receive buffer +extern volatile uint8_t usb_rx_count; +extern volatile bool mp_cdc_enabled; + +int receive_usb(void); + +void mp_hal_set_interrupt_char(int c); + +void mp_hal_disable_all_interrupts(void); +void mp_hal_enable_all_interrupts(void); + +#endif // MICROPY_INCLUDED_RASPBERRYPI_MPHALPORT_H diff --git a/ports/raspberrypi/peripherals/pins.c b/ports/raspberrypi/peripherals/pins.c new file mode 100644 index 0000000000000..a2a7b85bd337b --- /dev/null +++ b/ports/raspberrypi/peripherals/pins.c @@ -0,0 +1,67 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "pins.h" + +#include "shared-bindings/microcontroller/Pin.h" + +// This macro is used to simplify pin definition in boards//pins.c +#define PIN(p_number) \ +const mcu_pin_obj_t pin_GPIO## p_number = { \ + { &mcu_pin_type }, \ + .number = p_number \ +} + +PIN(0); +PIN(1); +PIN(2); +PIN(3); +PIN(4); +PIN(5); +PIN(6); +PIN(7); +PIN(8); +PIN(9); +PIN(10); +PIN(11); +PIN(12); +PIN(13); +PIN(14); +PIN(15); +PIN(16); +PIN(17); +PIN(18); +PIN(19); +PIN(20); +PIN(21); +PIN(22); +PIN(23); +PIN(24); +PIN(25); +PIN(26); +PIN(27); +PIN(28); +PIN(29); diff --git a/ports/raspberrypi/peripherals/pins.h b/ports/raspberrypi/peripherals/pins.h new file mode 100644 index 0000000000000..99ab9cfe48d05 --- /dev/null +++ b/ports/raspberrypi/peripherals/pins.h @@ -0,0 +1,71 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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. + */ + +// DO NOT include this file directly. Use shared-bindings/microcontroller/Pin.h instead to ensure +// that all necessary includes are already included. + +#ifndef MICROPY_INCLUDED_RASPBERRYPI_PERIPHERALS_PINS_H +#define MICROPY_INCLUDED_RASPBERRYPI_PERIPHERALS_PINS_H + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + uint8_t number; +} mcu_pin_obj_t; + +extern const mcu_pin_obj_t pin_GPIO0; +extern const mcu_pin_obj_t pin_GPIO1; +extern const mcu_pin_obj_t pin_GPIO2; +extern const mcu_pin_obj_t pin_GPIO3; +extern const mcu_pin_obj_t pin_GPIO4; +extern const mcu_pin_obj_t pin_GPIO5; +extern const mcu_pin_obj_t pin_GPIO6; +extern const mcu_pin_obj_t pin_GPIO7; +extern const mcu_pin_obj_t pin_GPIO8; +extern const mcu_pin_obj_t pin_GPIO9; +extern const mcu_pin_obj_t pin_GPIO10; +extern const mcu_pin_obj_t pin_GPIO11; +extern const mcu_pin_obj_t pin_GPIO12; +extern const mcu_pin_obj_t pin_GPIO13; +extern const mcu_pin_obj_t pin_GPIO14; +extern const mcu_pin_obj_t pin_GPIO15; +extern const mcu_pin_obj_t pin_GPIO16; +extern const mcu_pin_obj_t pin_GPIO17; +extern const mcu_pin_obj_t pin_GPIO18; +extern const mcu_pin_obj_t pin_GPIO19; +extern const mcu_pin_obj_t pin_GPIO20; +extern const mcu_pin_obj_t pin_GPIO21; +extern const mcu_pin_obj_t pin_GPIO22; +extern const mcu_pin_obj_t pin_GPIO23; +extern const mcu_pin_obj_t pin_GPIO24; +extern const mcu_pin_obj_t pin_GPIO25; +extern const mcu_pin_obj_t pin_GPIO26; +extern const mcu_pin_obj_t pin_GPIO27; +extern const mcu_pin_obj_t pin_GPIO28; +extern const mcu_pin_obj_t pin_GPIO29; + +#endif // MICROPY_INCLUDED_RASPBERRYPI_PERIPHERALS_PINS_H diff --git a/ports/raspberrypi/qstrdefsport.h b/ports/raspberrypi/qstrdefsport.h new file mode 100644 index 0000000000000..3ba897069bf73 --- /dev/null +++ b/ports/raspberrypi/qstrdefsport.h @@ -0,0 +1 @@ +// qstrs specific to this port diff --git a/ports/raspberrypi/sdk b/ports/raspberrypi/sdk new file mode 160000 index 0000000000000..26653ea81e340 --- /dev/null +++ b/ports/raspberrypi/sdk @@ -0,0 +1 @@ +Subproject commit 26653ea81e340cacee55025d110c3e014a252a87 diff --git a/ports/raspberrypi/sdk_config/pico/config_autogen.h b/ports/raspberrypi/sdk_config/pico/config_autogen.h new file mode 100644 index 0000000000000..688f367c3490e --- /dev/null +++ b/ports/raspberrypi/sdk_config/pico/config_autogen.h @@ -0,0 +1,19 @@ +#pragma once + +#define PICO_IE_26_29_UNCHANGED_ON_RESET (0) +#define PICO_USE_STACK_GUARDS (0) +#define PICO_ENTER_USB_BOOT_ON_EXIT (0) +#define PICO_USE_OPTIMISTIC_SBRK (0) +#define PICO_NO_HARDWARE (0) +#define PICO_ON_DEVICE (1) +#define PICO_USE_CRT_PRINTF (0) +#define PICO_NO_PRINTF (0) +#define PICO_FLOAT_SUPPORT_ROM_V1 (1) +#define PICO_DOUBLE_SUPPORT_ROM_V1 (1) +#define PICO_STDIO_UART (0) +#define PICO_STDIO_USB (0) +#define PICO_STDIO_SEMIHOSTING (0) +#define PICO_STDIO_IGNORE_NESTED_STDOUT (0) +#define PICO_PRINTF_PICO (0) +#define PICO_PRINTF_NONE (0) +#define PICO_PRINTF_ALWAYS_INCLUDED (1) diff --git a/ports/raspberrypi/sdk_config/pico/version.h b/ports/raspberrypi/sdk_config/pico/version.h new file mode 100644 index 0000000000000..3a1e1a3d27ff5 --- /dev/null +++ b/ports/raspberrypi/sdk_config/pico/version.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +// ---------------------------------------------------------- +// THIS FILE IS (NOT) AUTOGENERATED; EDIT when updating sdk/ +// ---------------------------------------------------------- + +#ifndef _PICO_VERSION_H +#define _PICO_VERSION_H + +#define PICO_SDK_VERSION_MAJOR 1 +#define PICO_SDK_VERSION_MINOR 0 +#define PICO_SDK_VERSION_REVISION 0 +#define PICO_SDK_VERSION_STRING "1.0.0" + +#endif diff --git a/ports/raspberrypi/supervisor/internal_flash.c b/ports/raspberrypi/supervisor/internal_flash.c new file mode 100644 index 0000000000000..d333830de985e --- /dev/null +++ b/ports/raspberrypi/supervisor/internal_flash.c @@ -0,0 +1,131 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "supervisor/internal_flash.h" + +#include +#include +#include + +#include "extmod/vfs.h" +#include "extmod/vfs_fat.h" +#include "py/mphal.h" +#include "py/obj.h" +#include "py/runtime.h" +#include "lib/oofatfs/ff.h" +#include "shared-bindings/microcontroller/__init__.h" + +#include "supervisor/usb.h" + +#include "src/rp2040/hardware_structs/include/hardware/structs/sio.h" +#include "src/rp2_common/hardware_flash/include/hardware/flash.h" +#include "src/common/pico_binary_info/include/pico/binary_info.h" + +#define RESERVED_FLASH 1 * 1024 * 1024 + +// TODO: Parameterize flash size based on the configured flash. +#define TOTAL_FLASH_SIZE 2 * 1024 * 1024 + +// TODO: Split the caching out of supervisor/shared/external_flash so we can use it. +#define SECTOR_SIZE 4096 +#define NO_CACHE 0xffffffff +STATIC uint8_t _cache[SECTOR_SIZE]; +STATIC uint32_t _cache_lba = NO_CACHE; + +void supervisor_flash_init(void) { + bi_decl_if_func_used(bi_block_device( + BINARY_INFO_MAKE_TAG('C', 'P'), + "CircuitPython", + RESERVED_FLASH, + TOTAL_FLASH_SIZE - RESERVED_FLASH, + NULL, + BINARY_INFO_BLOCK_DEV_FLAG_READ | + BINARY_INFO_BLOCK_DEV_FLAG_WRITE | + BINARY_INFO_BLOCK_DEV_FLAG_PT_UNKNOWN)); +} + +uint32_t supervisor_flash_get_block_size(void) { + return FILESYSTEM_BLOCK_SIZE; +} + +uint32_t supervisor_flash_get_block_count(void) { + return (TOTAL_FLASH_SIZE - RESERVED_FLASH) / FILESYSTEM_BLOCK_SIZE; +} + +void port_internal_flash_flush(void) { + if (_cache_lba == NO_CACHE) { + return; + } + common_hal_mcu_disable_interrupts(); + flash_range_erase(RESERVED_FLASH + _cache_lba, SECTOR_SIZE); + flash_range_program(RESERVED_FLASH + _cache_lba, _cache, SECTOR_SIZE); + common_hal_mcu_enable_interrupts(); + _cache_lba = NO_CACHE; +} + +mp_uint_t supervisor_flash_read_blocks(uint8_t *dest, uint32_t block, uint32_t num_blocks) { + memcpy(dest, + (void*)(XIP_BASE + RESERVED_FLASH + block * FILESYSTEM_BLOCK_SIZE), + num_blocks * FILESYSTEM_BLOCK_SIZE); + return 0; +} + +mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t lba, uint32_t num_blocks) { + uint32_t blocks_per_sector = SECTOR_SIZE / FILESYSTEM_BLOCK_SIZE; + uint32_t block = 0; + while (block < num_blocks) { + uint32_t block_address = lba + block; + uint32_t sector_offset = block_address / blocks_per_sector * SECTOR_SIZE; + uint8_t block_offset = block_address % blocks_per_sector; + + if (_cache_lba != block_address) { + memcpy(_cache, + (void*)(XIP_BASE + RESERVED_FLASH + sector_offset), + SECTOR_SIZE); + _cache_lba = sector_offset; + } + for (uint8_t b = block_offset; b < blocks_per_sector; b++) { + // Stop copying after the last block. + if (block >= num_blocks) { + break; + } + memcpy(_cache + b * FILESYSTEM_BLOCK_SIZE, + src + block * FILESYSTEM_BLOCK_SIZE, + FILESYSTEM_BLOCK_SIZE); + block++; + } + // Make sure we don't have an interrupt while we do flash operations. + common_hal_mcu_disable_interrupts(); + flash_range_erase(RESERVED_FLASH + sector_offset, SECTOR_SIZE); + flash_range_program(RESERVED_FLASH + sector_offset, _cache, SECTOR_SIZE); + common_hal_mcu_enable_interrupts(); + } + + return 0; // success +} + +void supervisor_flash_release_cache(void) { +} diff --git a/ports/raspberrypi/supervisor/internal_flash.h b/ports/raspberrypi/supervisor/internal_flash.h new file mode 100644 index 0000000000000..0dc9f154585c9 --- /dev/null +++ b/ports/raspberrypi/supervisor/internal_flash.h @@ -0,0 +1,38 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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. + */ +#ifndef MICROPY_INCLUDED_RASPBERRYPI_INTERNAL_FLASH_H +#define MICROPY_INCLUDED_RASPBERRYPI_INTERNAL_FLASH_H + +#include + +#include "mpconfigport.h" + +// #define INTERNAL_FLASH_PART1_NUM_BLOCKS (CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE / FILESYSTEM_BLOCK_SIZE) + +// #define INTERNAL_FLASH_SYSTICK_MASK (0x1ff) // 512ms +// #define INTERNAL_FLASH_IDLE_TICK(tick) (((tick) & INTERNAL_FLASH_SYSTICK_MASK) == 2) + +#endif // MICROPY_INCLUDED_RASPBERRYPI_INTERNAL_FLASH_H diff --git a/ports/raspberrypi/supervisor/internal_flash_root_pointers.h b/ports/raspberrypi/supervisor/internal_flash_root_pointers.h new file mode 100644 index 0000000000000..419a4c9435010 --- /dev/null +++ b/ports/raspberrypi/supervisor/internal_flash_root_pointers.h @@ -0,0 +1,31 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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. + */ +#ifndef MICROPY_INCLUDED_RASPBERRYPI_INTERNAL_FLASH_ROOT_POINTERS_H +#define MICROPY_INCLUDED_RASPBERRYPI_INTERNAL_FLASH_ROOT_POINTERS_H + +#define FLASH_ROOT_POINTERS + +#endif // MICROPY_INCLUDED_RASPBERRYPI_INTERNAL_FLASH_ROOT_POINTERS_H diff --git a/ports/raspberrypi/supervisor/port.c b/ports/raspberrypi/supervisor/port.c new file mode 100644 index 0000000000000..b2f73c7b4cd68 --- /dev/null +++ b/ports/raspberrypi/supervisor/port.c @@ -0,0 +1,200 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 +#include + +#include "supervisor/board.h" +#include "supervisor/port.h" + +#include "bindings/rp2pio/StateMachine.h" +#include "genhdr/mpversion.h" +#include "shared-bindings/busio/I2C.h" +#include "shared-bindings/busio/SPI.h" +#include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/rtc/__init__.h" +#include "shared-bindings/pwmio/PWMOut.h" + +#include "supervisor/shared/safe_mode.h" +#include "supervisor/shared/stack.h" +#include "supervisor/shared/tick.h" + +#include "src/rp2040/hardware_structs/include/hardware/structs/watchdog.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" +#include "src/rp2_common/hardware_uart/include/hardware/uart.h" +#include "src/rp2_common/hardware_sync/include/hardware/sync.h" +#include "src/rp2_common/hardware_timer/include/hardware/timer.h" +#include "src/common/pico_time/include/pico/time.h" +#include "src/common/pico_binary_info/include/pico/binary_info.h" + +#include "tusb.h" + + +extern volatile bool mp_msc_enabled; + +STATIC void _tick_callback(uint alarm_num); + +STATIC void _binary_info(void) { + // Binary info readable with `picotool`. + bi_decl(bi_program_name("CircuitPython")); + bi_decl(bi_program_version_string(MICROPY_GIT_TAG)); + bi_decl(bi_program_build_date_string(MICROPY_BUILD_DATE)); + bi_decl(bi_program_url("https://circuitpython.org")); + + bi_decl(bi_program_build_attribute("BOARD=" CIRCUITPY_BOARD_ID)); + // TODO: Add build attribute for debug builds. Needs newer CircuitPython with CIRCUITPY_DEBUG. +} + +safe_mode_t port_init(void) { + _binary_info(); + // Set brown out. + + // Reset everything into a known state before board_init. + reset_port(); + + // For the tick. + hardware_alarm_claim(0); + hardware_alarm_set_callback(0, _tick_callback); + + // Check brownout. + + if (board_requests_safe_mode()) { + return USER_SAFE_MODE; + } + + return NO_SAFE_MODE; +} + +void reset_port(void) { + #if CIRCUITPY_BUSIO + reset_i2c(); + reset_spi(); + #endif + + #if CIRCUITPY_RP2PIO + reset_rp2pio_statemachine(); + #endif + + #if CIRCUITPY_PWMIO + pwmout_reset(); + #endif + + reset_all_pins(); +} + +void reset_to_bootloader(void) { + // reset(); + while (true) {} +} + +void reset_cpu(void) { + // reset(); + while (true) {} +} + +bool port_has_fixed_stack(void) { + return false; +} + +// From the linker script +extern uint32_t __HeapLimit; +extern uint32_t __StackTop; +uint32_t *port_stack_get_limit(void) { + return &__HeapLimit; +} + +uint32_t *port_stack_get_top(void) { + return &__StackTop; +} + +uint32_t *port_heap_get_bottom(void) { + return port_stack_get_limit(); +} + +uint32_t *port_heap_get_top(void) { + return port_stack_get_top(); +} + +void port_set_saved_word(uint32_t value) { + // NOTE: This doesn't survive pressing the reset button (aka toggling RUN). + watchdog_hw->scratch[0] = value; +} + +uint32_t port_get_saved_word(void) { + return watchdog_hw->scratch[0]; +} + +uint64_t port_get_raw_ticks(uint8_t* subticks) { + uint64_t microseconds = time_us_64(); + return 1024 * (microseconds / 1000000) + (microseconds % 1000000) / 977; +} + +STATIC void _tick_callback(uint alarm_num) { + supervisor_tick(); + hardware_alarm_set_target(0, delayed_by_us(get_absolute_time(), 977)); +} + +// Enable 1/1024 second tick. +void port_enable_tick(void) { + hardware_alarm_set_target(0, delayed_by_us(get_absolute_time(), 977)); +} + +// Disable 1/1024 second tick. +void port_disable_tick(void) { + // hardware_alarm_cancel(0); +} + +// This is called by sleep, we ignore it when our ticks are enabled because +// they'll wake us up earlier. If we don't, we'll mess up ticks by overwriting +// the next RTC wake up time. +void port_interrupt_after_ticks(uint32_t ticks) { +} + +void port_idle_until_interrupt(void) { + common_hal_mcu_disable_interrupts(); + if (!tud_task_event_ready()) { +// asm volatile ("dsb 0xF":::"memory"); +// __wfi(); + } + common_hal_mcu_enable_interrupts(); +} + +/** + * \brief Default interrupt handler for unused IRQs. + */ +__attribute__((used)) void HardFault_Handler(void) +{ +#ifdef ENABLE_MICRO_TRACE_BUFFER + // Turn off the micro trace buffer so we don't fill it up in the infinite + // loop below. + REG_MTB_MASTER = 0x00000000 + 6; +#endif + + reset_into_safe_mode(HARD_CRASH); + while (true) { + asm("nop;"); + } +} diff --git a/ports/raspberrypi/supervisor/rp2_cpu.s b/ports/raspberrypi/supervisor/rp2_cpu.s new file mode 100755 index 0000000000000..741bb21358ad2 --- /dev/null +++ b/ports/raspberrypi/supervisor/rp2_cpu.s @@ -0,0 +1,35 @@ +.syntax unified +.cpu cortex-m0 +.thumb +.text +.align 2 + +@ uint cpu_get_regs_and_sp(r0=uint regs[10]) +.global cpu_get_regs_and_sp +.thumb +.thumb_func +.type cpu_get_regs_and_sp, %function +cpu_get_regs_and_sp: +@ store registers into given array +str r4, [r0, #0] +str r5, [r0, #4] +str r6, [r0, #8] +str r7, [r0, #12] +push {r1} +mov r1, r8 +str r1, [r0, #16] +mov r1, r9 +str r1, [r0, #20] +mov r1, r10 +str r1, [r0, #24] +mov r1, r11 +str r1, [r0, #28] +mov r1, r12 +str r1, [r0, #32] +mov r1, r13 +str r1, [r0, #36] +pop {r1} + +@ return the sp +mov r0, sp +bx lr diff --git a/ports/raspberrypi/supervisor/usb.c b/ports/raspberrypi/supervisor/usb.c new file mode 100644 index 0000000000000..db2c298f5d5c4 --- /dev/null +++ b/ports/raspberrypi/supervisor/usb.c @@ -0,0 +1,38 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "lib/tinyusb/src/device/usbd.h" +#include "supervisor/background_callback.h" +#include "supervisor/usb.h" +#include "src/rp2_common/pico_platform/include/pico/platform.h" +#include "src/rp2040/hardware_regs/include/hardware/regs/intctrl.h" + +void init_usb_hardware(void) { +} + +void __isr __used isr_usbctrl(void) { + usb_irq_handler(); +} diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 21bd5b9658905..3ce7c0117353c 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -51,6 +51,7 @@ BASE_CFLAGS = \ -DCIRCUITPY_SOFTWARE_SAFE_MODE=0x0ADABEEF \ -DCIRCUITPY_CANARY_WORD=0xADAF00 \ -DCIRCUITPY_SAFE_RESTART_WORD=0xDEADBEEF \ + -DCIRCUITPY_BOARD_ID="\"$(BOARD)\"" \ --param max-inline-insns-single=500 # Use these flags to debug build times and header includes. @@ -234,6 +235,9 @@ endif ifeq ($(CIRCUITPY_RANDOM),1) SRC_PATTERNS += random/% endif +ifeq ($(CIRCUITPY_RP2PIO),1) +SRC_PATTERNS += rp2pio/% +endif ifeq ($(CIRCUITPY_ROTARYIO),1) SRC_PATTERNS += rotaryio/% endif diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index a3411b7adb15f..b0bca0f2508b9 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -228,7 +228,7 @@ typedef long mp_off_t; #endif #ifndef MICROPY_PY_REVERSE_SPECIAL_METHODS -#define MICROPY_PY_REVERSE_SPECIAL_METHODS (CIRCUITPY_FULL_BUILD) +#define MICROPY_PY_REVERSE_SPECIAL_METHODS (CIRCUITPY_ULAB || CIRCUITPY_FULL_BUILD) #endif #if INTERNAL_FLASH_FILESYSTEM == 0 && QSPI_FLASH_FILESYSTEM == 0 && SPI_FLASH_FILESYSTEM == 0 && !DISABLE_FILESYSTEM @@ -581,13 +581,6 @@ extern const struct _mp_obj_module_t pwmio_module; #define PWMIO_MODULE #endif -#if CIRCUITPY_RGBMATRIX -extern const struct _mp_obj_module_t rgbmatrix_module; -#define RGBMATRIX_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_rgbmatrix),(mp_obj_t)&rgbmatrix_module }, -#else -#define RGBMATRIX_MODULE -#endif - #if CIRCUITPY_RANDOM extern const struct _mp_obj_module_t random_module; #define RANDOM_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_random), (mp_obj_t)&random_module }, @@ -595,6 +588,20 @@ extern const struct _mp_obj_module_t random_module; #define RANDOM_MODULE #endif +#if CIRCUITPY_RP2PIO +extern const struct _mp_obj_module_t rp2pio_module; +#define RP2PIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_rp2pio),(mp_obj_t)&rp2pio_module }, +#else +#define RP2PIO_MODULE +#endif + +#if CIRCUITPY_RGBMATRIX +extern const struct _mp_obj_module_t rgbmatrix_module; +#define RGBMATRIX_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_rgbmatrix),(mp_obj_t)&rgbmatrix_module }, +#else +#define RGBMATRIX_MODULE +#endif + #if CIRCUITPY_ROTARYIO extern const struct _mp_obj_module_t rotaryio_module; #define ROTARYIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_rotaryio), (mp_obj_t)&rotaryio_module }, @@ -849,6 +856,7 @@ extern const struct _mp_obj_module_t msgpack_module; PULSEIO_MODULE \ PWMIO_MODULE \ RANDOM_MODULE \ + RP2PIO_MODULE \ RE_MODULE \ RGBMATRIX_MODULE \ ROTARYIO_MODULE \ @@ -928,12 +936,15 @@ void supervisor_run_background_tasks_if_tick(void); #define CIRCUITPY_PYSTACK_SIZE 1536 #endif - // Wait this long imediately after startup to see if we are connected to USB. #ifndef CIRCUITPY_USB_CONNECTED_SLEEP_DELAY #define CIRCUITPY_USB_CONNECTED_SLEEP_DELAY 5 #endif +#ifndef CIRCUITPY_PROCESSOR_COUNT +#define CIRCUITPY_PROCESSOR_COUNT (1) +#endif + #define CIRCUITPY_BOOT_OUTPUT_FILE "/boot_out.txt" #define CIRCUITPY_VERBOSE_BLE 0 diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index d0145a90f33a5..9c9b17f4b750f 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -198,12 +198,18 @@ CFLAGS += -DCIRCUITPY_PULSEIO=$(CIRCUITPY_PULSEIO) # For now we tie PWMIO to PULSEIO so they always both exist. In CircuitPython 7 # we can enable and disable them separately once PWMOut is removed from `pulseio`. -CIRCUITPY_PWMIO = $(CIRCUITPY_PULSEIO) +CIRCUITPY_PWMIO ?= $(CIRCUITPY_PULSEIO) CFLAGS += -DCIRCUITPY_PWMIO=$(CIRCUITPY_PWMIO) CIRCUITPY_RANDOM ?= 1 CFLAGS += -DCIRCUITPY_RANDOM=$(CIRCUITPY_RANDOM) +# CIRCUITPY_RP2PIO is handled in the raspberrypi tree. +# Only for rp2 chips. +# Assume not a rp2 build. +CIRCUITPY_RP2PIO ?= 0 +CFLAGS += -DCIRCUITPY_RP2PIO=$(CIRCUITPY_RP2PIO) + CIRCUITPY_RGBMATRIX ?= 0 CFLAGS += -DCIRCUITPY_RGBMATRIX=$(CIRCUITPY_RGBMATRIX) diff --git a/shared-bindings/microcontroller/__init__.h b/shared-bindings/microcontroller/__init__.h index 0dafc74c72ff4..39d3e718b4da0 100644 --- a/shared-bindings/microcontroller/__init__.h +++ b/shared-bindings/microcontroller/__init__.h @@ -29,6 +29,7 @@ #include "py/obj.h" #include "py/mpconfig.h" +#include "py/objtuple.h" #include "common-hal/microcontroller/Processor.h" #include "shared-bindings/microcontroller/ResetReason.h" @@ -44,7 +45,13 @@ extern void common_hal_mcu_reset(void); extern const mp_obj_dict_t mcu_pin_globals; +#if CIRCUITPY_PROCESSOR_COUNT == 1 extern const mcu_processor_obj_t common_hal_mcu_processor_obj; +#elif CIRCUITPY_PROCESSOR_COUNT > 1 +extern const mp_rom_obj_tuple_t common_hal_mcu_processor_obj; +#else +#error "Invalid processor count" +#endif #if CIRCUITPY_INTERNAL_NVM_SIZE > 0 diff --git a/shared-module/sdcardio/SDCard.c b/shared-module/sdcardio/SDCard.c index 9e861279d3952..1712f58ee4432 100644 --- a/shared-module/sdcardio/SDCard.c +++ b/shared-module/sdcardio/SDCard.c @@ -375,7 +375,7 @@ int common_hal_sdcardio_sdcard_readblocks(sdcardio_sdcard_obj_t *self, uint32_t return r; } -int _write(sdcardio_sdcard_obj_t *self, uint8_t token, void *buf, size_t size) { +STATIC int _write(sdcardio_sdcard_obj_t *self, uint8_t token, void *buf, size_t size) { wait_for_ready(self); uint8_t cmd[2]; @@ -420,7 +420,7 @@ int _write(sdcardio_sdcard_obj_t *self, uint8_t token, void *buf, size_t size) { return 0; } -int writeblocks(sdcardio_sdcard_obj_t *self, uint32_t start_block, mp_buffer_info_t *buf) { +STATIC int writeblocks(sdcardio_sdcard_obj_t *self, uint32_t start_block, mp_buffer_info_t *buf) { common_hal_sdcardio_check_for_deinit(self); uint32_t nblocks = buf->len / 512; if (nblocks == 1) { diff --git a/supervisor/shared/filesystem.c b/supervisor/shared/filesystem.c index 618dc796b89b0..09b30b6bad4e9 100644 --- a/supervisor/shared/filesystem.c +++ b/supervisor/shared/filesystem.c @@ -79,6 +79,8 @@ static void make_sample_code_file(FATFS *fatfs) { f_open(fatfs, &fs, "/code.py", FA_WRITE | FA_CREATE_ALWAYS); f_write(&fs, buffer, sizeof(buffer) - 1, &char_written); f_close(&fs); + #else + make_empty_file(fatfs, "/code.py"); #endif } diff --git a/supervisor/shared/safe_mode.c b/supervisor/shared/safe_mode.c index 9032e4045180c..f8e871f9759f6 100644 --- a/supervisor/shared/safe_mode.c +++ b/supervisor/shared/safe_mode.c @@ -28,7 +28,9 @@ #include "mphalport.h" +#if defined(MICROPY_HW_LED_STATUS) #include "shared-bindings/digitalio/DigitalInOut.h" +#endif #include "shared-bindings/microcontroller/Processor.h" #include "shared-bindings/microcontroller/ResetReason.h" diff --git a/supervisor/shared/workflow.c b/supervisor/shared/workflow.c index 4986c09570301..9aac7c4d05e70 100644 --- a/supervisor/shared/workflow.c +++ b/supervisor/shared/workflow.c @@ -36,7 +36,9 @@ void supervisor_workflow_reset(void) { // Not that some chips don't notice when USB is unplugged after first being plugged in, // so this is not perfect, but tud_suspended() check helps. bool supervisor_workflow_connecting(void) { - return tud_connected() && !tud_suspended(); + return true; + // TODO: Use the below once we've updated TinyUSB for the RP2040. + // return tud_connected() && !tud_suspended(); } // Return true if host has completed connection to us (such as USB enumeration). diff --git a/tools/build_board_info.py b/tools/build_board_info.py index ce9d45fe2f9e6..7b556ee5d29aa 100644 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -26,6 +26,7 @@ "litex", "mimxrt10xx", "nrf", + "raspberrypi", "stm", ] @@ -47,6 +48,7 @@ "mimxrt10xx": HEX_UF2, "litex": DFU, "esp32s2": BIN_UF2, + "raspberrypi": UF2, } # Per board overrides diff --git a/tools/build_memory_info.py b/tools/build_memory_info.py index 26697b97403b3..89aedf0f40581 100644 --- a/tools/build_memory_info.py +++ b/tools/build_memory_info.py @@ -9,10 +9,10 @@ import sys # Handle size constants with K or M suffixes (allowed in .ld but not in Python). -K_PATTERN = re.compile(r'([0-9]+)K') +K_PATTERN = re.compile(r'([0-9]+)[kK]') K_REPLACE = r'(\1*1024)' -M_PATTERN = re.compile(r'([0-9]+)M') +M_PATTERN = re.compile(r'([0-9]+)[mM]') M_REPLACE = r'(\1*1024*1024)' print() From 2b4ad1ed0399dc77632bf7dca61b269517320ad9 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 20 Jan 2021 17:10:28 -0800 Subject: [PATCH 681/770] Fix warnings that come from -O3 (I think) --- extmod/vfs.c | 5 +++-- shared-bindings/microcontroller/Pin.c | 8 ++++---- shared-module/os/__init__.c | 2 ++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/extmod/vfs.c b/extmod/vfs.c index c9c1fe3c31c45..420f8305f742e 100644 --- a/extmod/vfs.c +++ b/extmod/vfs.c @@ -71,6 +71,7 @@ mp_vfs_mount_t *mp_vfs_lookup_path(const char *path, const char **path_out) { STATIC mp_vfs_mount_t *lookup_path(mp_obj_t path_in, mp_obj_t *path_out) { const char *path = mp_obj_str_get_str(path_in); const char *p_out; + *path_out = mp_const_none; mp_vfs_mount_t *vfs = mp_vfs_lookup_path(path, &p_out); if (vfs != MP_VFS_NONE && vfs != MP_VFS_ROOT) { *path_out = mp_obj_new_str_of_type(mp_obj_get_type(path_in), @@ -329,7 +330,7 @@ mp_obj_t mp_vfs_ilistdir(size_t n_args, const mp_obj_t *args) { path_in = MP_OBJ_NEW_QSTR(MP_QSTR_); } - mp_obj_t path_out; + mp_obj_t path_out = mp_const_none; mp_vfs_mount_t *vfs = lookup_path(path_in, &path_out); if (vfs == MP_VFS_ROOT) { @@ -359,7 +360,7 @@ mp_obj_t mp_vfs_listdir(size_t n_args, const mp_obj_t *args) { MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_vfs_listdir_obj, 0, 1, mp_vfs_listdir); mp_obj_t mp_vfs_mkdir(mp_obj_t path_in) { - mp_obj_t path_out; + mp_obj_t path_out = mp_const_none; mp_vfs_mount_t *vfs = lookup_path(path_in, &path_out); if (vfs == MP_VFS_ROOT || (vfs != MP_VFS_NONE && !strcmp(mp_obj_str_get_str(path_out), "/"))) { mp_raise_OSError(MP_EEXIST); diff --git a/shared-bindings/microcontroller/Pin.c b/shared-bindings/microcontroller/Pin.c index 6ba02a0e7d448..2a97b54b3de08 100644 --- a/shared-bindings/microcontroller/Pin.c +++ b/shared-bindings/microcontroller/Pin.c @@ -66,12 +66,12 @@ static void get_pin_name(const mcu_pin_obj_t *self, qstr* package, qstr* module, STATIC void mcu_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { mcu_pin_obj_t *self = MP_OBJ_TO_PTR(self_in); - qstr package; + qstr package = MP_QSTR_Pin; qstr module; - qstr name; + qstr name = MP_QSTR_Pin; get_pin_name(self, &package, &module, &name); - if (package){ + if (package) { mp_printf(print, "%q.%q.%q", package, module, name); } else { mp_printf(print, "%q.%q", module , name); @@ -131,7 +131,7 @@ void assert_pin_free(const mcu_pin_obj_t* pin) { if (pin != NULL && pin != MP_OBJ_TO_PTR(mp_const_none) && !common_hal_mcu_pin_is_free(pin)) { qstr package; qstr module; - qstr name; + qstr name = MP_QSTR_Pin; get_pin_name(pin, &package, &module, &name); mp_raise_ValueError_varg(translate("%q in use"), name); diff --git a/shared-module/os/__init__.c b/shared-module/os/__init__.c index 39cf40fda3d91..159b54e315746 100644 --- a/shared-module/os/__init__.c +++ b/shared-module/os/__init__.c @@ -42,6 +42,7 @@ // Version of mp_vfs_lookup_path that takes and returns uPy string objects. STATIC mp_vfs_mount_t *lookup_path(const char* path, mp_obj_t *path_out) { const char *p_out; + *path_out = mp_const_none; mp_vfs_mount_t *vfs = mp_vfs_lookup_path(path, &p_out); if (vfs != MP_VFS_NONE && vfs != MP_VFS_ROOT) { *path_out = mp_obj_new_str_of_type(&mp_type_str, @@ -53,6 +54,7 @@ STATIC mp_vfs_mount_t *lookup_path(const char* path, mp_obj_t *path_out) { // Strip off trailing slashes to please underlying libraries STATIC mp_vfs_mount_t *lookup_dir_path(const char* path, mp_obj_t *path_out) { const char *p_out; + *path_out = mp_const_none; mp_vfs_mount_t *vfs = mp_vfs_lookup_path(path, &p_out); if (vfs != MP_VFS_NONE && vfs != MP_VFS_ROOT) { size_t len = strlen(p_out); From 48721584f95ec881ca62ace00b02323d9c38096c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 20 Jan 2021 18:25:01 -0800 Subject: [PATCH 682/770] Temporarily turn off string op overflow check --- ports/raspberrypi/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile index 69bd592c20f58..a604acb47087d 100644 --- a/ports/raspberrypi/Makefile +++ b/ports/raspberrypi/Makefile @@ -126,7 +126,8 @@ else endif endif -DISABLE_WARNINGS = -Wno-unused-function -Wno-unused-variable -Wno-strict-overflow -Wno-cast-align -Wno-strict-prototypes -Wno-nested-externs -Wno-double-promotion -Wno-sign-compare +# Remove -Wno-stringop-overflow after we can test with CI's GCC 10. Mac's looks weird. +DISABLE_WARNINGS = -Wno-stringop-overflow -Wno-unused-function -Wno-unused-variable -Wno-strict-overflow -Wno-cast-align -Wno-strict-prototypes -Wno-nested-externs -Wno-double-promotion -Wno-sign-compare CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) $(DISABLE_WARNINGS) From fb1e0106b51a03007eae71cc8489b85d1cdb9bda Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 20 Jan 2021 18:40:53 -0800 Subject: [PATCH 683/770] Fix press any key message --- main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 91b6a062d20bf..d9cdcca1da59e 100755 --- a/main.c +++ b/main.c @@ -317,7 +317,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { // Program has finished running. - bool serial_connected_before_animation = serial_connected(); + bool printed_press_any_key = false; #if CIRCUITPY_DISPLAYIO bool refreshed_epaper_display = false; #endif @@ -364,7 +364,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { } #endif - if (!serial_connected_before_animation && serial_connected()) { + if (!printed_press_any_key && serial_connected()) { if (!serial_connected_at_start) { print_code_py_status_message(safe_mode); } @@ -372,11 +372,12 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { print_safe_mode_message(safe_mode); serial_write("\n"); serial_write_compressed(translate("Press any key to enter the REPL. Use CTRL-D to reload.\n")); + printed_press_any_key = true; } - if (serial_connected_before_animation && !serial_connected()) { + if (!serial_connected()) { serial_connected_at_start = false; + printed_press_any_key = false; } - serial_connected_before_animation = serial_connected(); // Refresh the ePaper display if we have one. That way it'll show an error message. #if CIRCUITPY_DISPLAYIO From 6a6f22b0e6d8e99a8c9c264f4f10679d6b874415 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 20 Jan 2021 23:30:15 -0800 Subject: [PATCH 684/770] pre-commit --- .../raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.mk | 1 - ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk | 1 - ports/raspberrypi/common-hal/rp2pio/StateMachine.c | 1 - ports/raspberrypi/link.ld | 1 - 4 files changed, 4 deletions(-) diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.mk b/ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.mk index 97b3cd9495319..f4106b94a2c2e 100644 --- a/ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.mk +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.mk @@ -7,4 +7,3 @@ CHIP_VARIANT = RP2040 CHIP_FAMILY = rp2 INTERNAL_FLASH_FILESYSTEM = 1 - diff --git a/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk b/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk index 11b06449c8751..69ff56fef84f8 100644 --- a/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk +++ b/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk @@ -7,4 +7,3 @@ CHIP_VARIANT = RP2040 CHIP_FAMILY = rp2 INTERNAL_FLASH_FILESYSTEM = 1 - diff --git a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c index d613771a4f80b..6510410b0ec33 100644 --- a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c +++ b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c @@ -583,4 +583,3 @@ bool common_hal_rp2pio_statemachine_write(rp2pio_statemachine_obj_t *self, } return _transfer(self, data, len, NULL, 0); } - diff --git a/ports/raspberrypi/link.ld b/ports/raspberrypi/link.ld index dcf5c9a37a147..d642fd680711f 100644 --- a/ports/raspberrypi/link.ld +++ b/ports/raspberrypi/link.ld @@ -248,4 +248,3 @@ SECTIONS ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed") /* todo assert on extra code */ } - From b0f7fd933f82c3d8d0dac63978a622114019468c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 20 Jan 2021 23:33:00 -0800 Subject: [PATCH 685/770] type fix --- ports/raspberrypi/bindings/rp2pio/StateMachine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/bindings/rp2pio/StateMachine.c b/ports/raspberrypi/bindings/rp2pio/StateMachine.c index f472583ff1b18..c1f9a4773e095 100644 --- a/ports/raspberrypi/bindings/rp2pio/StateMachine.c +++ b/ports/raspberrypi/bindings/rp2pio/StateMachine.c @@ -222,7 +222,7 @@ STATIC mp_obj_t rp2pio_statemachine_obj_deinit(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_deinit_obj, rp2pio_statemachine_obj_deinit); -//| def __enter__(self) -> SPI: +//| def __enter__(self) -> StateMachine: //| """No-op used by Context Managers. //| Provided by context manager helper.""" //| ... From dbd5b7d9f021487a1e45fd238c068b082a4e3f8d Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 21 Jan 2021 07:29:54 -0500 Subject: [PATCH 686/770] Change xtensa cache key again, we need to stop using a bad cache for ESP32-S2 builds --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index abde2da0bb2dd..cc5ad4f7bc874 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -467,7 +467,7 @@ jobs: id: idf-cache with: path: ${{ github.workspace }}/.idf_tools - key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210114 + key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210121 - name: Clone IDF submodules run: | (cd $IDF_PATH && git submodule update --init) From b47fd08b20f0917874461dc1a0e201e7cc7e55db Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 21 Jan 2021 10:17:40 -0800 Subject: [PATCH 687/770] copy editing --- ports/raspberrypi/bindings/rp2pio/StateMachine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/raspberrypi/bindings/rp2pio/StateMachine.c b/ports/raspberrypi/bindings/rp2pio/StateMachine.c index c1f9a4773e095..0f6f84a565744 100644 --- a/ports/raspberrypi/bindings/rp2pio/StateMachine.c +++ b/ports/raspberrypi/bindings/rp2pio/StateMachine.c @@ -52,7 +52,7 @@ //| in a particular PIO instance. They are independent otherwise. //| //| This class is designed to facilitate sharing of PIO resources. By default, -//| it is assumed that the state machine is used on it's own and can be placed +//| it is assumed that the state machine is used on its own and can be placed //| in either PIO. State machines with the same program will be placed in the //| same PIO if possible. To ensure multiple state machines share a PIO use //| the ``colocate`` kwarg during construction and create them one after another.""" @@ -212,7 +212,7 @@ STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n } //| def deinit(self) -> None: -//| """Turn off the state machine and release it's resources.""" +//| """Turn off the state machine and release its resources.""" //| ... //| STATIC mp_obj_t rp2pio_statemachine_obj_deinit(mp_obj_t self_in) { From b7a63dc4980808e5f9716c1851a015ae65a16eb7 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 21 Jan 2021 10:18:04 -0800 Subject: [PATCH 688/770] Alphabetical --- py/circuitpy_mpconfig.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index b0bca0f2508b9..35f1227a9e63e 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -588,13 +588,6 @@ extern const struct _mp_obj_module_t random_module; #define RANDOM_MODULE #endif -#if CIRCUITPY_RP2PIO -extern const struct _mp_obj_module_t rp2pio_module; -#define RP2PIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_rp2pio),(mp_obj_t)&rp2pio_module }, -#else -#define RP2PIO_MODULE -#endif - #if CIRCUITPY_RGBMATRIX extern const struct _mp_obj_module_t rgbmatrix_module; #define RGBMATRIX_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_rgbmatrix),(mp_obj_t)&rgbmatrix_module }, @@ -609,6 +602,13 @@ extern const struct _mp_obj_module_t rotaryio_module; #define ROTARYIO_MODULE #endif +#if CIRCUITPY_RP2PIO +extern const struct _mp_obj_module_t rp2pio_module; +#define RP2PIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_rp2pio),(mp_obj_t)&rp2pio_module }, +#else +#define RP2PIO_MODULE +#endif + #if CIRCUITPY_RTC extern const struct _mp_obj_module_t rtc_module; #define RTC_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_rtc), (mp_obj_t)&rtc_module }, @@ -856,10 +856,10 @@ extern const struct _mp_obj_module_t msgpack_module; PULSEIO_MODULE \ PWMIO_MODULE \ RANDOM_MODULE \ - RP2PIO_MODULE \ RE_MODULE \ RGBMATRIX_MODULE \ ROTARYIO_MODULE \ + RP2PIO_MODULE \ RTC_MODULE \ SAMD_MODULE \ SDCARDIO_MODULE \ From af8cc9345d8facd36d1e65cdbfc69f044a942a17 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 21 Jan 2021 10:24:21 -0800 Subject: [PATCH 689/770] Fix ESP build --- supervisor/shared/safe_mode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervisor/shared/safe_mode.c b/supervisor/shared/safe_mode.c index f8e871f9759f6..b37b38e08874d 100644 --- a/supervisor/shared/safe_mode.c +++ b/supervisor/shared/safe_mode.c @@ -28,7 +28,7 @@ #include "mphalport.h" -#if defined(MICROPY_HW_LED_STATUS) +#if defined(MICROPY_HW_LED_STATUS) || defined(CIRCUITPY_BOOT_BUTTON) #include "shared-bindings/digitalio/DigitalInOut.h" #endif #include "shared-bindings/microcontroller/Processor.h" From b73b30ff9f890ffd4e38d4c7ce7bcef7c92c1afb Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 21 Jan 2021 11:33:13 -0800 Subject: [PATCH 690/770] Switch to upstream TinyUSB --- .gitmodules | 2 +- lib/tinyusb | 2 +- ports/raspberrypi/supervisor/usb.c | 19 +++++++++++++++++-- supervisor/shared/usb/usb.c | 4 ++++ supervisor/shared/workflow.c | 4 +--- supervisor/usb.h | 3 +++ 6 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.gitmodules b/.gitmodules index 66fcf186faf96..99de2c91860d1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -75,7 +75,7 @@ url = https://github.com/adafruit/nrfx.git [submodule "lib/tinyusb"] path = lib/tinyusb - url = https://github.com/tannewt/tinyusb.git + url = https://github.com/hathach/tinyusb.git branch = master fetchRecurseSubmodules = false [submodule "tools/huffman"] diff --git a/lib/tinyusb b/lib/tinyusb index b68e4e9d70dde..388abe9d9cc0a 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit b68e4e9d70ddef442c4d95412414c4221eef59eb +Subproject commit 388abe9d9cc0a7c360fd902e01461a53bb7b3f42 diff --git a/ports/raspberrypi/supervisor/usb.c b/ports/raspberrypi/supervisor/usb.c index db2c298f5d5c4..1d2425aed2488 100644 --- a/ports/raspberrypi/supervisor/usb.c +++ b/ports/raspberrypi/supervisor/usb.c @@ -27,12 +27,27 @@ #include "lib/tinyusb/src/device/usbd.h" #include "supervisor/background_callback.h" #include "supervisor/usb.h" +#include "src/rp2_common/hardware_irq/include/hardware/irq.h" #include "src/rp2_common/pico_platform/include/pico/platform.h" #include "src/rp2040/hardware_regs/include/hardware/regs/intctrl.h" +static background_callback_t usb_callback; +static void usb_background_do(void* unused) { + usb_background(); +} + +static void queue_background(void) { + background_callback_add(&usb_callback, usb_background_do, NULL); +} + void init_usb_hardware(void) { } -void __isr __used isr_usbctrl(void) { - usb_irq_handler(); +void post_usb_init(void) { + irq_handler_t usb_handler = irq_get_exclusive_handler(USBCTRL_IRQ); + if (usb_handler) { + irq_remove_handler(USBCTRL_IRQ, usb_handler); + irq_add_shared_handler(USBCTRL_IRQ, usb_handler, PICO_DEFAULT_IRQ_PRIORITY); + } + irq_add_shared_handler(USBCTRL_IRQ, queue_background, PICO_LOWEST_IRQ_PRIORITY); } diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c index ff08ade18a1ce..07c6aee6c1a31 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -59,12 +59,16 @@ bool usb_enabled(void) { return tusb_inited(); } +MP_WEAK void post_usb_init(void) {} + void usb_init(void) { init_usb_hardware(); load_serial_number(); tusb_init(); + post_usb_init(); + #if MICROPY_KBD_EXCEPTION // Set Ctrl+C as wanted char, tud_cdc_rx_wanted_cb() usb_callback will be invoked when Ctrl+C is received // This usb_callback always got invoked regardless of mp_interrupt_char value since we only set it once here diff --git a/supervisor/shared/workflow.c b/supervisor/shared/workflow.c index 9aac7c4d05e70..4986c09570301 100644 --- a/supervisor/shared/workflow.c +++ b/supervisor/shared/workflow.c @@ -36,9 +36,7 @@ void supervisor_workflow_reset(void) { // Not that some chips don't notice when USB is unplugged after first being plugged in, // so this is not perfect, but tud_suspended() check helps. bool supervisor_workflow_connecting(void) { - return true; - // TODO: Use the below once we've updated TinyUSB for the RP2040. - // return tud_connected() && !tud_suspended(); + return tud_connected() && !tud_suspended(); } // Return true if host has completed connection to us (such as USB enumeration). diff --git a/supervisor/usb.h b/supervisor/usb.h index 0dead3e265333..ccb35470cd0d5 100644 --- a/supervisor/usb.h +++ b/supervisor/usb.h @@ -42,6 +42,9 @@ void usb_irq_handler(void); // TinyUSB. void init_usb_hardware(void); +// Temporary hook for code after init. Only used for RP2040. +void post_usb_init(void); + // Shared implementation. bool usb_enabled(void); void usb_init(void); From 1f6cd496c7b547d7ec25b11184c9dda25de1d541 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Thu, 21 Jan 2021 13:54:19 -0600 Subject: [PATCH 691/770] 1. check enabled before scan; 2. make start-station() the single control point for esp_wifi_set_mode() --- locale/circuitpython.pot | 8 ++++---- ports/esp32s2/common-hal/wifi/Radio.c | 8 +++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index ab404ca002e93..5d870f30f2921 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -564,10 +564,6 @@ msgstr "" msgid "Can only alarm on two low pins from deep sleep." msgstr "" -#: ports/esp32s2/common-hal/wifi/Radio.c -msgid "Can't connect when wifi is not enabled" -msgstr "" - #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -3910,6 +3906,10 @@ msgstr "" msgid "width must be greater than zero" msgstr "" +#: ports/esp32s2/common-hal/wifi/Radio.c +msgid "wifi is not enabled" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "" diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index 24ec210091537..574bab0a1912f 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -72,7 +72,7 @@ void common_hal_wifi_radio_set_enabled(wifi_radio_obj_t *self, bool enabled) { } if (!self->started && enabled) { // esp_wifi_start() would default to soft-AP, thus setting it to station - ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA)); + start_station(self); ESP_ERROR_CHECK(esp_wifi_start()); self->started = true; return; @@ -89,7 +89,9 @@ mp_obj_t common_hal_wifi_radio_start_scanning_networks(wifi_radio_obj_t *self) { if (self->current_scan != NULL) { mp_raise_RuntimeError(translate("Already scanning for wifi networks")); } - // check enabled + if (!common_hal_wifi_radio_get_enabled(self)) { + mp_raise_RuntimeError(translate("wifi is not enabled")); + } start_station(self); wifi_scannednetworks_obj_t *scan = m_new_obj(wifi_scannednetworks_obj_t); @@ -127,7 +129,7 @@ void common_hal_wifi_radio_set_hostname(wifi_radio_obj_t *self, const char *host wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t* ssid, size_t ssid_len, uint8_t* password, size_t password_len, uint8_t channel, mp_float_t timeout, uint8_t* bssid, size_t bssid_len) { if (!common_hal_wifi_radio_get_enabled(self)) { - mp_raise_RuntimeError(translate("Can't connect when wifi is not enabled")); + mp_raise_RuntimeError(translate("wifi is not enabled")); } EventBits_t bits; From 9b8246f889bda79b5945c7acbd016de4886419ef Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 21 Jan 2021 15:56:30 -0500 Subject: [PATCH 692/770] shrink sparkfun_samd21_dev de_DE build --- .../atmel-samd/boards/sparkfun_samd21_dev/mpconfigboard.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ports/atmel-samd/boards/sparkfun_samd21_dev/mpconfigboard.mk b/ports/atmel-samd/boards/sparkfun_samd21_dev/mpconfigboard.mk index a2bd577cd3d6f..3104be0a0fd96 100644 --- a/ports/atmel-samd/boards/sparkfun_samd21_dev/mpconfigboard.mk +++ b/ports/atmel-samd/boards/sparkfun_samd21_dev/mpconfigboard.mk @@ -10,4 +10,10 @@ INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 +ifeq ($(TRANSLATION),de_DE) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +SUPEROPT_VM = 0 +endif + SUPEROPT_GC = 0 From 7263302c8cb93a1d1529dd73d70b12f303120713 Mon Sep 17 00:00:00 2001 From: hexthat Date: Thu, 21 Jan 2021 19:11:44 +0000 Subject: [PATCH 693/770] Translated using Weblate (Chinese (Pinyin)) Currently translated at 95.1% (872 of 916 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/ --- locale/zh_Latn_pinyin.po | 98 ++++++++++++++++++++++------------------ 1 file changed, 53 insertions(+), 45 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index f073c73175106..19fe4a61bdaa3 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2020-11-19 01:28+0000\n" +"PO-Revision-Date: 2021-01-21 22:25+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" "Language: zh_Latn_pinyin\n" @@ -15,19 +15,23 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.4-dev\n" +"X-Generator: Weblate 4.5-dev\n" #: main.c msgid "" "\n" "Code done running.\n" msgstr "" +"\n" +"Dàimǎ yùnxíng wánbì.\n" #: main.c msgid "" "\n" "Code stopped by auto-reload.\n" msgstr "" +"\n" +"zì dòng chóng xīn jiā zǎi tíng zhǐ de dài mǎ.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -121,7 +125,7 @@ msgstr "%q() cǎiyòng %d wèizhì cānshù, dàn gěi chū %d" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #, c-format msgid "%s error 0x%x" -msgstr "" +msgstr "%s cuò wù 0x%x" #: py/argcheck.c msgid "'%q' argument required" @@ -287,7 +291,7 @@ msgstr "bù zhīchí 3-arg pow ()" #: shared-module/msgpack/__init__.c msgid "64 bit types" -msgstr "" +msgstr "64 wèi lèi xíng" #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c @@ -553,7 +557,7 @@ msgstr "CBC kuài bì xū shì 16 zì jié de bèi shù" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "CRC or checksum was invalid" -msgstr "" +msgstr "CRC huò jiào yàn hé wú xiào" #: py/objtype.c msgid "Call super().__init__() before accessing native object." @@ -561,15 +565,17 @@ msgstr "Zài fǎngwèn běn jī wùjiàn zhīqián diàoyòng super().__init__() #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." -msgstr "" +msgstr "zhǐ néng zài RTC Io shàng cóng shēn dù shuì mián zhōng bào jǐng." #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on one low pin while others alarm high from deep sleep." msgstr "" +"Zhǐ néng zài yīgè dī diàn píng yǐn jiǎo shàng fāchū jǐngbào, ér qítā yǐn " +"jiǎo cóng shēndù shuìmián zhōng fāchū gāo diàn píng jǐngbào." #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on two low pins from deep sleep." -msgstr "" +msgstr "zhǐ néng cóng shēn dù shuì mián zhōng bào jǐng liǎng gè dī yǐn jiǎo." #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" @@ -605,7 +611,7 @@ msgstr "Wúfǎ shūchū tóng yīgè yǐn jiǎo shàng de liǎng gè píndào" #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." -msgstr "" +msgstr "wú fǎ lā dòng jǐn shū rù yǐn jiǎo." #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." @@ -652,7 +658,7 @@ msgstr "Wúfǎ gēnggǎi yǐ zài shǐyòng de jìshí qì shàng de pínlǜ" #: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge. Only level." -msgstr "" +msgstr "wú fǎ zài yǐn jiǎo biān yuán huàn xǐng. jǐn jí bié." #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." @@ -894,7 +900,7 @@ msgstr "Qídài yīgè dìzhǐ" #: shared-bindings/alarm/__init__.c msgid "Expected an alarm" -msgstr "" +msgstr "yù qī yǒu jǐng bào" #: shared-module/_pixelbuf/PixelBuf.c #, c-format @@ -911,7 +917,7 @@ msgstr "FFT jǐn wéi ndarrays dìng yì" #: extmod/ulab/code/fft/fft.c msgid "FFT is implemented for linear arrays only" -msgstr "" +msgstr "FFT jǐn shì yòng yú xiàn xìng zhèn liè" #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" @@ -985,7 +991,7 @@ msgstr "guò lǜ qì tài fù zá" #: ports/esp32s2/common-hal/dualbank/__init__.c msgid "Firmware image is invalid" -msgstr "" +msgstr "gù jiàn yìng xiàng wú xiào" #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" @@ -1007,7 +1013,7 @@ msgstr "Hánshù xūyào suǒdìng" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Generic Failure" -msgstr "" +msgstr "tōng yòng gù zhàng" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c @@ -1047,7 +1053,7 @@ msgstr "I2SOut bù kě yòng" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" -msgstr "" +msgstr "IOS 0, 2 + 4 bù zhī chí shuì mián zhōng de nèi bù shàng lā" #: shared-bindings/aesio/aes.c #, c-format @@ -1135,7 +1141,7 @@ msgstr "Wúxiào de PWM pínlǜ" #: ports/esp32s2/common-hal/analogio/AnalogIn.c msgid "Invalid Pin" -msgstr "" +msgstr "wú xiào yǐn jiǎo" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c @@ -1249,11 +1255,11 @@ msgstr "Ānquán móshì wúxiào" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid size" -msgstr "" +msgstr "dà xiǎo wú xiào" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" -msgstr "" +msgstr "wú xiào zhuàng tài" #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" @@ -1297,7 +1303,7 @@ msgstr "Chángdù bìxū shìfēi fùshù" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "MAC address was invalid" -msgstr "" +msgstr "MAC dì zhǐ wú xiào" #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." @@ -1347,7 +1353,7 @@ msgstr "bì xū shǐ yòng 6 RGB yǐn jiǎo de bèi shù, ér bù shì %d" #: ports/esp32s2/common-hal/nvm/ByteArray.c msgid "NVS Error" -msgstr "" +msgstr "NVS cuò wù" #: py/parse.c msgid "Name too long" @@ -1370,7 +1376,7 @@ msgstr "Wèi zhǎodào DMA píndào" #: shared-module/adafruit_bus_device/I2CDevice.c #, c-format msgid "No I2C device at address: %x" -msgstr "" +msgstr "dì zhǐ wú I2C shè bèi: %x" #: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c @@ -1511,7 +1517,7 @@ msgstr "Jǐn zhīchí IPv4 dìzhǐ" #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Only IPv4 sockets supported" -msgstr "" +msgstr "jǐn zhī chí IPv4 tào jiē zì" #: shared-module/displayio/OnDiskBitmap.c #, c-format @@ -1532,11 +1538,11 @@ msgstr "" #: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c msgid "Only one TouchAlarm can be set in deep sleep." -msgstr "" +msgstr "zhǐ yǒu yí gè chù mō bì kě yǐ shè zhì zài shēn dù shuì mián." #: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." -msgstr "" +msgstr "zhǐ néng shè zhì yí gè bào jǐng." #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" @@ -1548,15 +1554,15 @@ msgstr "Ip jǐn zhīchí raw int" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" -msgstr "" +msgstr "bù zhī chí cāo zuò huò gōng néng" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation timed out" -msgstr "" +msgstr "cāo zuò yǐ fēn shí" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Out of memory" -msgstr "" +msgstr "nèi cún bù zú" #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" @@ -1568,7 +1574,7 @@ msgstr "Guò cǎiyàng bìxū shì 8 de bèishù." #: shared-bindings/audiobusio/PDMIn.c msgid "PDMIn not available" -msgstr "" +msgstr "PDMIn bù kě yòng" #: shared-bindings/pwmio/PWMOut.c msgid "" @@ -1589,7 +1595,7 @@ msgstr "Shàng bù zhīchí ParallelBus" #: ports/esp32s2/common-hal/audiobusio/__init__.c msgid "Peripheral in use" -msgstr "" +msgstr "shǐ yòng zhōng de wài shè" #: py/moduerrno.c msgid "Permission denied" @@ -1658,11 +1664,13 @@ msgstr "Qiánzhuì huǎnchōng qū bìxū zài duī shàng" #: main.c msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" -msgstr "" +msgstr "àn rèn hé jiàn jìn rù REPL. shǐ yòng CTRL-D zhòng xīn jiā zǎi .\n" #: main.c msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" +"jiǎ zhuāng shēn dù shuì mián , zhí dào bào jǐng , CTRL-C huò wén jiàn xiě rù " +".\n" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -1714,7 +1722,7 @@ msgstr "Zhǐ dú duìxiàng" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Received response was invalid" -msgstr "" +msgstr "shōu dào de xiǎng yìng wú xiào" #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" @@ -1730,7 +1738,7 @@ msgstr "Qǐngqiú de AES móshì bù shòu zhīchí" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Requested resource not found" -msgstr "" +msgstr "wèi zhǎo dào qǐng qiú de zī yuán" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" @@ -1842,7 +1850,7 @@ msgstr "Dìngyì zhìshǎo yīgè UART yǐn jiǎo" #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" -msgstr "" +msgstr "tí gòng qí zhōng yī monotonic_time huò epoch_time" #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" @@ -1916,7 +1924,7 @@ msgstr "Píng pū kuāndù bìxū huàfēn wèi tú kuāndù" #: shared-bindings/alarm/time/TimeAlarm.c msgid "Time is in the past." -msgstr "" +msgstr "shí jiān yǐ jīng guò qù." #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format @@ -2031,7 +2039,7 @@ msgstr "Wúfǎ xiě rù nvm." #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." -msgstr "" +msgstr "wú fǎ xiě rù sleep_memory。" #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" @@ -2045,7 +2053,7 @@ msgstr "Wèi chǔlǐ de ESP TLS cuòwù %d %d %x %d" #: shared-bindings/wifi/Radio.c #, c-format msgid "Unknown failure %d" -msgstr "" +msgstr "wèi zhī gù zhàng %d" #: ports/nrf/common-hal/_bleio/__init__.c #, c-format @@ -2102,7 +2110,7 @@ msgstr "Bù zhīchí de lādòng zhí." #: ports/esp32s2/common-hal/dualbank/__init__.c msgid "Update Failed" -msgstr "" +msgstr "gēng xīn shī bài" #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -2116,7 +2124,7 @@ msgstr "Zhí chángdù > zuìdà chángdù" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Version was invalid" -msgstr "" +msgstr "bǎn běn wú xiào" #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" @@ -2173,7 +2181,7 @@ msgstr "WiFi mìmǎ bìxū jiè yú 8 dào 63 gè zìfú zhī jiān" #: main.c msgid "Woken up by alarm.\n" -msgstr "" +msgstr "bèi jǐng bào chǎo xǐng.\n" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" @@ -2230,7 +2238,7 @@ msgstr "argsort cānshù bìxū shì ndarray" #: extmod/ulab/code/numerical/numerical.c msgid "argsort is not implemented for flattened arrays" -msgstr "" +msgstr "wèi wéi pīn hé shù zǔ shí xiàn argsort" #: py/runtime.c msgid "argument has wrong type" @@ -2255,7 +2263,7 @@ msgstr "cānshù bìxū shì ndarrays" #: extmod/ulab/code/ndarray.c msgid "array and index length must be equal" -msgstr "" +msgstr "shù zǔ hé suǒ yǐn cháng dù bì xū xiāng děng" #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c @@ -2264,7 +2272,7 @@ msgstr "yòu cè xūyào shùzǔ/zì jié" #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" -msgstr "" +msgstr "cháng shì huò qǔ (arg) zuì xiǎo zhí /(arg) zuì dà kōng xù liè" #: extmod/ulab/code/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" @@ -2276,15 +2284,15 @@ msgstr "shǔxìng shàngwèi zhīchí" #: extmod/ulab/code/numerical/numerical.c msgid "axis is out of bounds" -msgstr "" +msgstr "zhóu chāo chū biān jiè" #: extmod/ulab/code/numerical/numerical.c msgid "axis must be None, or an integer" -msgstr "" +msgstr "zhóu bì xū wéi \" wú \" huò zhěng shù" #: extmod/ulab/code/numerical/numerical.c msgid "axis too long" -msgstr "" +msgstr "zhóu tài cháng" #: py/builtinevex.c msgid "bad compile mode" @@ -2320,7 +2328,7 @@ msgstr "fēnzhī bùzài fànwéi nèi" #: extmod/ulab/code/ulab_create.c msgid "buffer is smaller than requested size" -msgstr "" +msgstr "huǎn chōng qū xiǎo yú qǐng qiú de dà xiǎo" #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" From 2c086d68f8c0c05689162299dd800200ea6c10eb Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 21 Jan 2021 23:25:25 +0100 Subject: [PATCH 694/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 18 +++++++++++++++++- locale/cs.po | 18 +++++++++++++++++- locale/de_DE.po | 18 +++++++++++++++++- locale/el.po | 18 +++++++++++++++++- locale/es.po | 18 +++++++++++++++++- locale/fil.po | 18 +++++++++++++++++- locale/fr.po | 18 +++++++++++++++++- locale/hi.po | 18 +++++++++++++++++- locale/it_IT.po | 18 +++++++++++++++++- locale/ja.po | 18 +++++++++++++++++- locale/ko.po | 18 +++++++++++++++++- locale/nl.po | 18 +++++++++++++++++- locale/pl.po | 18 +++++++++++++++++- locale/pt_BR.po | 18 +++++++++++++++++- locale/sv.po | 18 +++++++++++++++++- locale/zh_Latn_pinyin.po | 22 +++++++++++++++++++--- 16 files changed, 274 insertions(+), 18 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index d0c9bbe307e0c..a6682dfa93532 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -869,6 +869,10 @@ msgstr "Channel EXTINT sedang digunakan" msgid "Error in regex" msgstr "Error pada regex" +#: shared-bindings/socketpool/Socket.c +msgid "Error: Failure to bind" +msgstr "" + #: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c @@ -1261,10 +1265,18 @@ msgstr "security_mode tidak valid" msgid "Invalid size" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid socket for TLS" +msgstr "" + #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid use of TLS Socket" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "Suara tidak valid" @@ -1281,6 +1293,10 @@ msgstr "File wave tidak valid" msgid "Invalid word/bit length" msgstr "Panjang kata/bit tidak valid" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Issue setting SO_REUSEADDR" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "Panjang kunci harus 16, 24, atau 32 byte" @@ -1569,7 +1585,7 @@ msgstr "" msgid "Out of memory" msgstr "" -#: ports/esp32s2/common-hal/socketpool/SocketPool.c +#: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index bc5bca31fd868..de20ea8ac0810 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -853,6 +853,10 @@ msgstr "" msgid "Error in regex" msgstr "" +#: shared-bindings/socketpool/Socket.c +msgid "Error: Failure to bind" +msgstr "" + #: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c @@ -1243,10 +1247,18 @@ msgstr "" msgid "Invalid size" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid socket for TLS" +msgstr "" + #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid use of TLS Socket" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1263,6 +1275,10 @@ msgstr "" msgid "Invalid word/bit length" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Issue setting SO_REUSEADDR" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "" @@ -1545,7 +1561,7 @@ msgstr "" msgid "Out of memory" msgstr "" -#: ports/esp32s2/common-hal/socketpool/SocketPool.c +#: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 31163c141284b..5de21df91dc9e 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -865,6 +865,10 @@ msgstr "EXTINT Kanal ist schon in Benutzung" msgid "Error in regex" msgstr "Fehler in regex" +#: shared-bindings/socketpool/Socket.c +msgid "Error: Failure to bind" +msgstr "" + #: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c @@ -1260,10 +1264,18 @@ msgstr "Ungültiger security_mode" msgid "Invalid size" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid socket for TLS" +msgstr "" + #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid use of TLS Socket" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "Ungültige Stimme" @@ -1280,6 +1292,10 @@ msgstr "Ungültige wave Datei" msgid "Invalid word/bit length" msgstr "Ungültige Wort- / Bitlänge" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Issue setting SO_REUSEADDR" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "Der Schlüssel muss 16, 24 oder 32 Byte lang sein" @@ -1570,7 +1586,7 @@ msgstr "" msgid "Out of memory" msgstr "" -#: ports/esp32s2/common-hal/socketpool/SocketPool.c +#: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "" diff --git a/locale/el.po b/locale/el.po index 0a56d47486820..d8feee50a975d 100644 --- a/locale/el.po +++ b/locale/el.po @@ -850,6 +850,10 @@ msgstr "" msgid "Error in regex" msgstr "" +#: shared-bindings/socketpool/Socket.c +msgid "Error: Failure to bind" +msgstr "" + #: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c @@ -1240,10 +1244,18 @@ msgstr "" msgid "Invalid size" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid socket for TLS" +msgstr "" + #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid use of TLS Socket" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1260,6 +1272,10 @@ msgstr "" msgid "Invalid word/bit length" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Issue setting SO_REUSEADDR" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "" @@ -1542,7 +1558,7 @@ msgstr "" msgid "Out of memory" msgstr "" -#: ports/esp32s2/common-hal/socketpool/SocketPool.c +#: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "" diff --git a/locale/es.po b/locale/es.po index 63ec6d012f73e..0543ddfcb6ac5 100644 --- a/locale/es.po +++ b/locale/es.po @@ -868,6 +868,10 @@ msgstr "El canal EXTINT ya está siendo utilizado" msgid "Error in regex" msgstr "Error en regex" +#: shared-bindings/socketpool/Socket.c +msgid "Error: Failure to bind" +msgstr "" + #: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c @@ -1261,10 +1265,18 @@ msgstr "'security_mode' no válido" msgid "Invalid size" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid socket for TLS" +msgstr "" + #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid use of TLS Socket" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "Voz inválida" @@ -1281,6 +1293,10 @@ msgstr "Archivo wave inválido" msgid "Invalid word/bit length" msgstr "Tamaño no válido de palabra/bit" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Issue setting SO_REUSEADDR" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "La llave debe tener 16, 24 o 32 bytes de longitud" @@ -1569,7 +1585,7 @@ msgstr "" msgid "Out of memory" msgstr "" -#: ports/esp32s2/common-hal/socketpool/SocketPool.c +#: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "Se acabaron los enchufes" diff --git a/locale/fil.po b/locale/fil.po index 9b635da182e01..6138d142edf77 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -861,6 +861,10 @@ msgstr "Ginagamit na ang EXTINT channel" msgid "Error in regex" msgstr "May pagkakamali sa REGEX" +#: shared-bindings/socketpool/Socket.c +msgid "Error: Failure to bind" +msgstr "" + #: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c @@ -1255,10 +1259,18 @@ msgstr "" msgid "Invalid size" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid socket for TLS" +msgstr "" + #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid use of TLS Socket" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1275,6 +1287,10 @@ msgstr "May hindi tama sa wave file" msgid "Invalid word/bit length" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Issue setting SO_REUSEADDR" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "" @@ -1560,7 +1576,7 @@ msgstr "" msgid "Out of memory" msgstr "" -#: ports/esp32s2/common-hal/socketpool/SocketPool.c +#: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index eccfcc1a0eff2..6641a436a836f 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -882,6 +882,10 @@ msgstr "Canal EXTINT déjà utilisé" msgid "Error in regex" msgstr "Erreur dans l'expression régulière" +#: shared-bindings/socketpool/Socket.c +msgid "Error: Failure to bind" +msgstr "" + #: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c @@ -1277,10 +1281,18 @@ msgstr "'security_mode' invalide" msgid "Invalid size" msgstr "Taille invalide" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid socket for TLS" +msgstr "" + #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" msgstr "État invalide" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid use of TLS Socket" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "Voix invalide" @@ -1297,6 +1309,10 @@ msgstr "Fichier WAVE invalide" msgid "Invalid word/bit length" msgstr "Longueur de mot / bit invalide" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Issue setting SO_REUSEADDR" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "La clé doit comporter 16, 24 ou 32 octets" @@ -1585,7 +1601,7 @@ msgstr "Timeout de l'opération" msgid "Out of memory" msgstr "Hors de mémoire" -#: ports/esp32s2/common-hal/socketpool/SocketPool.c +#: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "Plus de sockets" diff --git a/locale/hi.po b/locale/hi.po index 4dfb35b366439..b0a2e6763d841 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -850,6 +850,10 @@ msgstr "" msgid "Error in regex" msgstr "" +#: shared-bindings/socketpool/Socket.c +msgid "Error: Failure to bind" +msgstr "" + #: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c @@ -1240,10 +1244,18 @@ msgstr "" msgid "Invalid size" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid socket for TLS" +msgstr "" + #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid use of TLS Socket" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1260,6 +1272,10 @@ msgstr "" msgid "Invalid word/bit length" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Issue setting SO_REUSEADDR" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "" @@ -1542,7 +1558,7 @@ msgstr "" msgid "Out of memory" msgstr "" -#: ports/esp32s2/common-hal/socketpool/SocketPool.c +#: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index b65638c9d2139..6b59365ccc8aa 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -861,6 +861,10 @@ msgstr "Canale EXTINT già in uso" msgid "Error in regex" msgstr "Errore nella regex" +#: shared-bindings/socketpool/Socket.c +msgid "Error: Failure to bind" +msgstr "" + #: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c @@ -1257,10 +1261,18 @@ msgstr "" msgid "Invalid size" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid socket for TLS" +msgstr "" + #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid use of TLS Socket" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1278,6 +1290,10 @@ msgstr "File wave non valido" msgid "Invalid word/bit length" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Issue setting SO_REUSEADDR" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "" @@ -1565,7 +1581,7 @@ msgstr "" msgid "Out of memory" msgstr "" -#: ports/esp32s2/common-hal/socketpool/SocketPool.c +#: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "" diff --git a/locale/ja.po b/locale/ja.po index ca13d8a9c5589..ad9c2740d8409 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -861,6 +861,10 @@ msgstr "EXTINTチャネルはすでに使用されています" msgid "Error in regex" msgstr "正規表現にエラーがあります" +#: shared-bindings/socketpool/Socket.c +msgid "Error: Failure to bind" +msgstr "" + #: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c @@ -1253,10 +1257,18 @@ msgstr "不正なsecurity_mode" msgid "Invalid size" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid socket for TLS" +msgstr "" + #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid use of TLS Socket" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "不正なボイス" @@ -1273,6 +1285,10 @@ msgstr "不正なwaveファイル" msgid "Invalid word/bit length" msgstr "不正なワード/ビット長" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Issue setting SO_REUSEADDR" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "Keyの長さは、16, 24, 32バイトのいずれかでなければなりません" @@ -1557,7 +1573,7 @@ msgstr "" msgid "Out of memory" msgstr "" -#: ports/esp32s2/common-hal/socketpool/SocketPool.c +#: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "" diff --git a/locale/ko.po b/locale/ko.po index c645d12ae0289..b8e892fb7c112 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -853,6 +853,10 @@ msgstr "" msgid "Error in regex" msgstr "Regex에 오류가 있습니다." +#: shared-bindings/socketpool/Socket.c +msgid "Error: Failure to bind" +msgstr "" + #: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c @@ -1243,10 +1247,18 @@ msgstr "" msgid "Invalid size" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid socket for TLS" +msgstr "" + #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid use of TLS Socket" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1263,6 +1275,10 @@ msgstr "" msgid "Invalid word/bit length" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Issue setting SO_REUSEADDR" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "" @@ -1545,7 +1561,7 @@ msgstr "" msgid "Out of memory" msgstr "" -#: ports/esp32s2/common-hal/socketpool/SocketPool.c +#: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 1435e8634924d..50250701d4427 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -861,6 +861,10 @@ msgstr "EXTINT kanaal al in gebruik" msgid "Error in regex" msgstr "Fout in regex" +#: shared-bindings/socketpool/Socket.c +msgid "Error: Failure to bind" +msgstr "" + #: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c @@ -1254,10 +1258,18 @@ msgstr "Ongeldige security_mode" msgid "Invalid size" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid socket for TLS" +msgstr "" + #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" msgstr "" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid use of TLS Socket" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "Ongeldige stem" @@ -1274,6 +1286,10 @@ msgstr "Ongeldig wave bestand" msgid "Invalid word/bit length" msgstr "Ongeldig woord/bit lengte" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Issue setting SO_REUSEADDR" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "Sleutel moet 16, 24, of 32 bytes lang zijn" @@ -1562,7 +1578,7 @@ msgstr "" msgid "Out of memory" msgstr "" -#: ports/esp32s2/common-hal/socketpool/SocketPool.c +#: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "Geen sockets meer beschikbaar" diff --git a/locale/pl.po b/locale/pl.po index 8ba0c3d71d575..2562994b4dd82 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -861,6 +861,10 @@ msgstr "Kanał EXTINT w użyciu" msgid "Error in regex" msgstr "Błąd w regex" +#: shared-bindings/socketpool/Socket.c +msgid "Error: Failure to bind" +msgstr "" + #: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c @@ -1253,10 +1257,18 @@ msgstr "Nieprawidłowy security_mode" msgid "Invalid size" msgstr "Nieprawidłowy rozmiar" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid socket for TLS" +msgstr "" + #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" msgstr "Nieprawidłowy stan" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid use of TLS Socket" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1273,6 +1285,10 @@ msgstr "Zły plik wave" msgid "Invalid word/bit length" msgstr "Niepoprawna długość słowa/bitu" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Issue setting SO_REUSEADDR" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "Klucz musi mieć długość 16, 24 lub 32 bajtów" @@ -1556,7 +1572,7 @@ msgstr "" msgid "Out of memory" msgstr "Brak pamięci" -#: ports/esp32s2/common-hal/socketpool/SocketPool.c +#: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index d3f57a58ab1ce..5e1f61ca0099a 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -877,6 +877,10 @@ msgstr "Canal EXTINT em uso" msgid "Error in regex" msgstr "Erro no regex" +#: shared-bindings/socketpool/Socket.c +msgid "Error: Failure to bind" +msgstr "" + #: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c @@ -1270,10 +1274,18 @@ msgstr "O Security_mode é inválido" msgid "Invalid size" msgstr "Tamanho inválido" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid socket for TLS" +msgstr "" + #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" msgstr "Estado inválido" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid use of TLS Socket" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "A voz é inválida" @@ -1290,6 +1302,10 @@ msgstr "Aqruivo de ondas inválido" msgid "Invalid word/bit length" msgstr "O comprimento do bit/palavra são inválidos" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Issue setting SO_REUSEADDR" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "A chave deve ter 16, 24 ou 32 bytes de comprimento" @@ -1577,7 +1593,7 @@ msgstr "A operação expirou" msgid "Out of memory" msgstr "Sem memória" -#: ports/esp32s2/common-hal/socketpool/SocketPool.c +#: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "Sem soquetes" diff --git a/locale/sv.po b/locale/sv.po index 6c58ff01e732d..3ab9f43dca7cf 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -866,6 +866,10 @@ msgstr "EXTINT-kanalen används redan" msgid "Error in regex" msgstr "Fel i regex" +#: shared-bindings/socketpool/Socket.c +msgid "Error: Failure to bind" +msgstr "" + #: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c @@ -1258,10 +1262,18 @@ msgstr "Ogiltigt säkerhetsläge" msgid "Invalid size" msgstr "Ogiltig storlek" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid socket for TLS" +msgstr "" + #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" msgstr "Ogiltigt tillstånd" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid use of TLS Socket" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "Ogiltig kanal" @@ -1278,6 +1290,10 @@ msgstr "Ogiltig wave-fil" msgid "Invalid word/bit length" msgstr "Ogiltig word-/bitlängd" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Issue setting SO_REUSEADDR" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "Nyckeln måste vara 16, 24 eller 32 byte lång" @@ -1566,7 +1582,7 @@ msgstr "Åtgärden orsakade timeout" msgid "Out of memory" msgstr "Slut på minne" -#: ports/esp32s2/common-hal/socketpool/SocketPool.c +#: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "Slut på sockets" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 19fe4a61bdaa3..9d4eb38ab98aa 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -865,6 +865,10 @@ msgstr "EXTINT píndào yǐjīng shǐyòng" msgid "Error in regex" msgstr "Zhèngzé biǎodá shì cuòwù" +#: shared-bindings/socketpool/Socket.c +msgid "Error: Failure to bind" +msgstr "" + #: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c @@ -1257,10 +1261,18 @@ msgstr "Ānquán móshì wúxiào" msgid "Invalid size" msgstr "dà xiǎo wú xiào" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid socket for TLS" +msgstr "" + #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" msgstr "wú xiào zhuàng tài" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Invalid use of TLS Socket" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "Yǔyīn wúxiào" @@ -1277,6 +1289,10 @@ msgstr "Wúxiào de làng làngcháo wénjiàn" msgid "Invalid word/bit length" msgstr "Wúxiào de zì/wèi chángdù" +#: ports/esp32s2/common-hal/socketpool/Socket.c +msgid "Issue setting SO_REUSEADDR" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "mì yào bì xū wéi 16, 24 huò 32 zì jié cháng" @@ -1564,7 +1580,7 @@ msgstr "cāo zuò yǐ fēn shí" msgid "Out of memory" msgstr "nèi cún bù zú" -#: ports/esp32s2/common-hal/socketpool/SocketPool.c +#: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "tào jiē zì wài" @@ -1669,8 +1685,8 @@ msgstr "àn rèn hé jiàn jìn rù REPL. shǐ yòng CTRL-D zhòng xīn jiā zǎ #: main.c msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" -"jiǎ zhuāng shēn dù shuì mián , zhí dào bào jǐng , CTRL-C huò wén jiàn xiě rù " -".\n" +"jiǎ zhuāng shēn dù shuì mián , zhí dào bào jǐng , CTRL-C huò wén jiàn xiě " +"rù .\n" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." From 3aab17c98e0bcae803c1201a7a8292ac79f980b6 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 21 Jan 2021 16:40:57 -0600 Subject: [PATCH 695/770] Adding longint support on RP2040 --- ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk b/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk index 69ff56fef84f8..2c9f9e2339a51 100644 --- a/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk +++ b/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk @@ -7,3 +7,4 @@ CHIP_VARIANT = RP2040 CHIP_FAMILY = rp2 INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = MPZ From f39ca0a1d68c0b78ed1f41f6ed63ce8dea8aafac Mon Sep 17 00:00:00 2001 From: root Date: Thu, 21 Jan 2021 16:42:16 -0600 Subject: [PATCH 696/770] Adding longing support on RP2040 --- .../raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.mk b/ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.mk index f4106b94a2c2e..309b9a0cf968a 100644 --- a/ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.mk +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.mk @@ -7,3 +7,4 @@ CHIP_VARIANT = RP2040 CHIP_FAMILY = rp2 INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = MPZ From ea9fe249713583989a510ea4489d74da07b949c5 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 21 Jan 2021 18:02:35 -0500 Subject: [PATCH 697/770] shrink arduino_mkrzero build --- ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.mk b/ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.mk index 7eb83a1230fa2..20307fc051c07 100644 --- a/ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.mk +++ b/ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.mk @@ -11,3 +11,5 @@ LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 SUPEROPT_GC = 0 +SUPEROPT_VM = 0 +CFLAGS_INLINE_LIMIT = 40 From e8e8c593acc1d31888c22d1f192856796dad5af2 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 21 Jan 2021 22:50:15 -0500 Subject: [PATCH 698/770] move longint choice to mpconfigport.mk --- .../boards/adafruit_feather_rp2040/mpconfigboard.mk | 1 - ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk | 1 - ports/raspberrypi/mpconfigport.mk | 3 +++ 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.mk b/ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.mk index 309b9a0cf968a..f4106b94a2c2e 100644 --- a/ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.mk +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.mk @@ -7,4 +7,3 @@ CHIP_VARIANT = RP2040 CHIP_FAMILY = rp2 INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ diff --git a/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk b/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk index 2c9f9e2339a51..69ff56fef84f8 100644 --- a/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk +++ b/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk @@ -7,4 +7,3 @@ CHIP_VARIANT = RP2040 CHIP_FAMILY = rp2 INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ diff --git a/ports/raspberrypi/mpconfigport.mk b/ports/raspberrypi/mpconfigport.mk index a6211be73d75d..138896d41c572 100644 --- a/ports/raspberrypi/mpconfigport.mk +++ b/ports/raspberrypi/mpconfigport.mk @@ -14,6 +14,9 @@ ifeq ($(LONGINT_IMPL),LONGLONG) MPY_TOOL_LONGINT_IMPL = -mlongint-impl=longlong endif +# All raspberrypi ports have longints. +LONGINT_IMPL = MPZ + ifndef CIRCUITPY_RP2PIO CIRCUITPY_RP2PIO = 1 else From 63b5e56c721421d311e2b29da94ff0bd4e300e7a Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 21 Jan 2021 23:49:49 -0500 Subject: [PATCH 699/770] shrink feather_m0_adalogger and gemma_m0 --- ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.mk | 1 + ports/atmel-samd/boards/gemma_m0/mpconfigboard.mk | 1 + 2 files changed, 2 insertions(+) diff --git a/ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.mk index 143910318d61b..ab6c4ed99d51f 100644 --- a/ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.mk @@ -11,3 +11,4 @@ LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 SUPEROPT_GC = 0 +SUPEROPT_VM = 0 diff --git a/ports/atmel-samd/boards/gemma_m0/mpconfigboard.mk b/ports/atmel-samd/boards/gemma_m0/mpconfigboard.mk index 0345417a98844..e1c0f4b9a7080 100644 --- a/ports/atmel-samd/boards/gemma_m0/mpconfigboard.mk +++ b/ports/atmel-samd/boards/gemma_m0/mpconfigboard.mk @@ -20,4 +20,5 @@ endif ifeq ($(TRANSLATION), de_DE) RELEASE_NEEDS_CLEAN_BUILD = 1 CFLAGS_INLINE_LIMIT = 35 +SUPEROPT_VM = 0 endif From 500512fb535c4817ec7552264440e00d181da2a8 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Fri, 22 Jan 2021 03:43:44 +0000 Subject: [PATCH 700/770] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (920 of 920 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 5e1f61ca0099a..437c42f7766c4 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-01-17 12:55+0000\n" +"PO-Revision-Date: 2021-01-22 08:49+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -879,7 +879,7 @@ msgstr "Erro no regex" #: shared-bindings/socketpool/Socket.c msgid "Error: Failure to bind" -msgstr "" +msgstr "Erro: Falha na vinculação" #: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c @@ -1276,7 +1276,7 @@ msgstr "Tamanho inválido" #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Invalid socket for TLS" -msgstr "" +msgstr "Soquete inválido para o TLS" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" @@ -1284,7 +1284,7 @@ msgstr "Estado inválido" #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Invalid use of TLS Socket" -msgstr "" +msgstr "Uso inválido do soquete TLS" #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" @@ -1304,7 +1304,7 @@ msgstr "O comprimento do bit/palavra são inválidos" #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Issue setting SO_REUSEADDR" -msgstr "" +msgstr "Problema na configuração do SO_REUSEADDR" #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" From 9dbf2039f234aa25fb7b148a7c61941d0eae95a4 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Fri, 22 Jan 2021 09:49:34 +0100 Subject: [PATCH 701/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 8 ++++++++ locale/cs.po | 8 ++++++++ locale/de_DE.po | 8 ++++++++ locale/el.po | 8 ++++++++ locale/es.po | 8 ++++++++ locale/fil.po | 8 ++++++++ locale/fr.po | 8 ++++++++ locale/hi.po | 8 ++++++++ locale/it_IT.po | 8 ++++++++ locale/ja.po | 8 ++++++++ locale/ko.po | 8 ++++++++ locale/nl.po | 8 ++++++++ locale/pl.po | 8 ++++++++ locale/pt_BR.po | 8 ++++++++ locale/sv.po | 8 ++++++++ locale/zh_Latn_pinyin.po | 8 ++++++++ 16 files changed, 128 insertions(+) diff --git a/locale/ID.po b/locale/ID.po index a6682dfa93532..f6f8d5d50507a 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -48,6 +48,10 @@ msgstr " File \"%q\"" msgid " File \"%q\", line %d" msgstr " File \"%q\", baris %d" +#: py/builtinhelp.c +msgid " is of type %q\n" +msgstr "" + #: main.c msgid " output:\n" msgstr "output:\n" @@ -3359,6 +3363,10 @@ msgstr "" msgid "number of points must be at least 2" msgstr "" +#: py/builtinhelp.c +msgid "object " +msgstr "" + #: py/obj.c msgid "object '%q' is not a tuple or list" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index de20ea8ac0810..fea0861f48c53 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -46,6 +46,10 @@ msgstr " Soubor \"%q\"" msgid " File \"%q\", line %d" msgstr " Soubor \"%q\", řádek %d" +#: py/builtinhelp.c +msgid " is of type %q\n" +msgstr "" + #: main.c msgid " output:\n" msgstr " výstup:\n" @@ -3311,6 +3315,10 @@ msgstr "" msgid "number of points must be at least 2" msgstr "" +#: py/builtinhelp.c +msgid "object " +msgstr "" + #: py/obj.c msgid "object '%q' is not a tuple or list" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 5de21df91dc9e..7e9c30f950850 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -47,6 +47,10 @@ msgstr " Datei \"%q\"" msgid " File \"%q\", line %d" msgstr " Datei \"%q\", Zeile %d" +#: py/builtinhelp.c +msgid " is of type %q\n" +msgstr "" + #: main.c msgid " output:\n" msgstr " Ausgabe:\n" @@ -3388,6 +3392,10 @@ msgstr "Nicht genügend Argumente für den Formatierungs-String" msgid "number of points must be at least 2" msgstr "Die Anzahl der Punkte muss mindestens 2 betragen" +#: py/builtinhelp.c +msgid "object " +msgstr "" + #: py/obj.c msgid "object '%q' is not a tuple or list" msgstr "" diff --git a/locale/el.po b/locale/el.po index d8feee50a975d..7df2479150f45 100644 --- a/locale/el.po +++ b/locale/el.po @@ -43,6 +43,10 @@ msgstr "" msgid " File \"%q\", line %d" msgstr "" +#: py/builtinhelp.c +msgid " is of type %q\n" +msgstr "" + #: main.c msgid " output:\n" msgstr "" @@ -3308,6 +3312,10 @@ msgstr "" msgid "number of points must be at least 2" msgstr "" +#: py/builtinhelp.c +msgid "object " +msgstr "" + #: py/obj.c msgid "object '%q' is not a tuple or list" msgstr "" diff --git a/locale/es.po b/locale/es.po index 0543ddfcb6ac5..da503e784db65 100644 --- a/locale/es.po +++ b/locale/es.po @@ -48,6 +48,10 @@ msgstr " Archivo \"%q\"" msgid " File \"%q\", line %d" msgstr " Archivo \"%q\", línea %d" +#: py/builtinhelp.c +msgid " is of type %q\n" +msgstr "" + #: main.c msgid " output:\n" msgstr " salida:\n" @@ -3382,6 +3386,10 @@ msgstr "no suficientes argumentos para format string" msgid "number of points must be at least 2" msgstr "el número de puntos debe ser al menos 2" +#: py/builtinhelp.c +msgid "object " +msgstr "" + #: py/obj.c msgid "object '%q' is not a tuple or list" msgstr "objeto '%q' no es tupla o lista" diff --git a/locale/fil.po b/locale/fil.po index 6138d142edf77..420e6dc8beaa6 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -42,6 +42,10 @@ msgstr " File \"%q\"" msgid " File \"%q\", line %d" msgstr " File \"%q\", line %d" +#: py/builtinhelp.c +msgid " is of type %q\n" +msgstr "" + #: main.c msgid " output:\n" msgstr " output:\n" @@ -3355,6 +3359,10 @@ msgstr "kulang sa arguments para sa format string" msgid "number of points must be at least 2" msgstr "" +#: py/builtinhelp.c +msgid "object " +msgstr "" + #: py/obj.c msgid "object '%q' is not a tuple or list" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index 6641a436a836f..e8e24fd17712d 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -52,6 +52,10 @@ msgstr " Fichier \"%q\"" msgid " File \"%q\", line %d" msgstr " Fichier \"%q\", ligne %d" +#: py/builtinhelp.c +msgid " is of type %q\n" +msgstr "" + #: main.c msgid " output:\n" msgstr " sortie :\n" @@ -3415,6 +3419,10 @@ msgstr "pas assez d'arguments pour la chaîne de format" msgid "number of points must be at least 2" msgstr "le nombre de points doit être d'au moins 2" +#: py/builtinhelp.c +msgid "object " +msgstr "" + #: py/obj.c msgid "object '%q' is not a tuple or list" msgstr "l'objet '%q' n'est pas un tuple ou une list" diff --git a/locale/hi.po b/locale/hi.po index b0a2e6763d841..69bfa1722d17a 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -43,6 +43,10 @@ msgstr "" msgid " File \"%q\", line %d" msgstr "" +#: py/builtinhelp.c +msgid " is of type %q\n" +msgstr "" + #: main.c msgid " output:\n" msgstr "" @@ -3308,6 +3312,10 @@ msgstr "" msgid "number of points must be at least 2" msgstr "" +#: py/builtinhelp.c +msgid "object " +msgstr "" + #: py/obj.c msgid "object '%q' is not a tuple or list" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 6b59365ccc8aa..a0ef7a6ad4123 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -42,6 +42,10 @@ msgstr " File \"%q\"" msgid " File \"%q\", line %d" msgstr " File \"%q\", riga %d" +#: py/builtinhelp.c +msgid " is of type %q\n" +msgstr "" + #: main.c msgid " output:\n" msgstr " output:\n" @@ -3361,6 +3365,10 @@ msgstr "argomenti non sufficienti per la stringa di formattazione" msgid "number of points must be at least 2" msgstr "" +#: py/builtinhelp.c +msgid "object " +msgstr "" + #: py/obj.c msgid "object '%q' is not a tuple or list" msgstr "" diff --git a/locale/ja.po b/locale/ja.po index ad9c2740d8409..9742f2662dc26 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -48,6 +48,10 @@ msgstr " ファイル \"%q\"" msgid " File \"%q\", line %d" msgstr " ファイル \"%q\", 行 %d" +#: py/builtinhelp.c +msgid " is of type %q\n" +msgstr "" + #: main.c msgid " output:\n" msgstr " 出力:\n" @@ -3336,6 +3340,10 @@ msgstr "書式化文字列への引数が足りません" msgid "number of points must be at least 2" msgstr "" +#: py/builtinhelp.c +msgid "object " +msgstr "" + #: py/obj.c msgid "object '%q' is not a tuple or list" msgstr "オブジェクト'%q'がタプルやリストでありません" diff --git a/locale/ko.po b/locale/ko.po index b8e892fb7c112..92251fdc1b198 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -44,6 +44,10 @@ msgstr " 파일 \"%q\"" msgid " File \"%q\", line %d" msgstr " 파일 \"%q\", 라인 %d" +#: py/builtinhelp.c +msgid " is of type %q\n" +msgstr "" + #: main.c msgid " output:\n" msgstr " 산출:\n" @@ -3312,6 +3316,10 @@ msgstr "" msgid "number of points must be at least 2" msgstr "" +#: py/builtinhelp.c +msgid "object " +msgstr "" + #: py/obj.c msgid "object '%q' is not a tuple or list" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 50250701d4427..a617f80a13f65 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -46,6 +46,10 @@ msgstr " Bestand" msgid " File \"%q\", line %d" msgstr " Bestand \"%q\", regel %d" +#: py/builtinhelp.c +msgid " is of type %q\n" +msgstr "" + #: main.c msgid " output:\n" msgstr " uitvoer:\n" @@ -3369,6 +3373,10 @@ msgstr "niet genoeg argumenten om string te formatteren" msgid "number of points must be at least 2" msgstr "aantal punten moet minimaal 2 zijn" +#: py/builtinhelp.c +msgid "object " +msgstr "" + #: py/obj.c msgid "object '%q' is not a tuple or list" msgstr "object '%q' is geen tuple of lijst" diff --git a/locale/pl.po b/locale/pl.po index 2562994b4dd82..4862fa6ff433a 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -48,6 +48,10 @@ msgstr " Plik \"%q\"" msgid " File \"%q\", line %d" msgstr " Plik \"%q\", linia %d" +#: py/builtinhelp.c +msgid " is of type %q\n" +msgstr "" + #: main.c msgid " output:\n" msgstr " wyjście:\n" @@ -3329,6 +3333,10 @@ msgstr "nie dość argumentów przy formatowaniu" msgid "number of points must be at least 2" msgstr "liczba punktów musi wynosić co najmniej 2" +#: py/builtinhelp.c +msgid "object " +msgstr "" + #: py/obj.c msgid "object '%q' is not a tuple or list" msgstr "" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 437c42f7766c4..e214dbb80a2c4 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -50,6 +50,10 @@ msgstr " Arquivo \"%q\"" msgid " File \"%q\", line %d" msgstr " Arquivo \"%q\", linha %d" +#: py/builtinhelp.c +msgid " is of type %q\n" +msgstr "" + #: main.c msgid " output:\n" msgstr " saída:\n" @@ -3400,6 +3404,10 @@ msgstr "argumentos insuficientes para o formato da string" msgid "number of points must be at least 2" msgstr "a quantidade dos pontos deve ser pelo menos 2" +#: py/builtinhelp.c +msgid "object " +msgstr "" + #: py/obj.c msgid "object '%q' is not a tuple or list" msgstr "o objeto '%q' não é uma tupla ou uma lista" diff --git a/locale/sv.po b/locale/sv.po index 3ab9f43dca7cf..a11788df0e2ab 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -50,6 +50,10 @@ msgstr " Filen \"%q\"" msgid " File \"%q\", line %d" msgstr " Fil \"%q\", rad %d" +#: py/builtinhelp.c +msgid " is of type %q\n" +msgstr "" + #: main.c msgid " output:\n" msgstr " utdata:\n" @@ -3369,6 +3373,10 @@ msgstr "inte tillräckligt med argument för formatsträng" msgid "number of points must be at least 2" msgstr "antal punkter måste vara minst 2" +#: py/builtinhelp.c +msgid "object " +msgstr "" + #: py/obj.c msgid "object '%q' is not a tuple or list" msgstr "objektet '%q' är inte en tuple eller list" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 9d4eb38ab98aa..b5b79998bff5a 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -51,6 +51,10 @@ msgstr " Wénjiàn \"%q\"" msgid " File \"%q\", line %d" msgstr " Wénjiàn \"%q\", dì %d xíng" +#: py/builtinhelp.c +msgid " is of type %q\n" +msgstr "" + #: main.c msgid " output:\n" msgstr " shūchū:\n" @@ -3361,6 +3365,10 @@ msgstr "géshì zìfú chuàn cān shǔ bùzú" msgid "number of points must be at least 2" msgstr "diǎnshù bìxū zhìshǎo wèi 2" +#: py/builtinhelp.c +msgid "object " +msgstr "" + #: py/obj.c msgid "object '%q' is not a tuple or list" msgstr "duìxiàng '%q' bùshì yuán zǔ huò lièbiǎo" From d74097c8a700ec4711e89ee8b291ded036a4f607 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 22 Jan 2021 03:54:51 -0500 Subject: [PATCH 702/770] update github actions cache key for xtensa build --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0b2a9058f539c..ce2627bc28e93 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -464,7 +464,7 @@ jobs: id: idf-cache with: path: ${{ github.workspace }}/.idf_tools - key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210114 + key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210122 - name: Clone IDF submodules run: | (cd $IDF_PATH && git submodule update --init) From 19da28d817834dae187575f3e37beafa3024bf15 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Fri, 22 Jan 2021 11:48:31 +0100 Subject: [PATCH 703/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 4 ++++ locale/cs.po | 4 ++++ locale/de_DE.po | 4 ++++ locale/el.po | 4 ++++ locale/es.po | 4 ++++ locale/fil.po | 4 ++++ locale/fr.po | 4 ++++ locale/hi.po | 4 ++++ locale/it_IT.po | 4 ++++ locale/ja.po | 4 ++++ locale/ko.po | 4 ++++ locale/nl.po | 4 ++++ locale/pl.po | 4 ++++ locale/pt_BR.po | 4 ++++ locale/sv.po | 4 ++++ locale/zh_Latn_pinyin.po | 4 ++++ 16 files changed, 64 insertions(+) diff --git a/locale/ID.po b/locale/ID.po index f6f8d5d50507a..7ae5b50bd44bd 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -3983,6 +3983,10 @@ msgstr "" msgid "width must be greater than zero" msgstr "" +#: ports/esp32s2/common-hal/wifi/Radio.c +msgid "wifi is not enabled" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index fea0861f48c53..d7ab891b6eca2 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -3933,6 +3933,10 @@ msgstr "" msgid "width must be greater than zero" msgstr "" +#: ports/esp32s2/common-hal/wifi/Radio.c +msgid "wifi is not enabled" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 7e9c30f950850..25321f63eb6c2 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -4020,6 +4020,10 @@ msgstr "" msgid "width must be greater than zero" msgstr "" +#: ports/esp32s2/common-hal/wifi/Radio.c +msgid "wifi is not enabled" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "Fenster muss <= Intervall sein" diff --git a/locale/el.po b/locale/el.po index 7df2479150f45..104dff4ee56fa 100644 --- a/locale/el.po +++ b/locale/el.po @@ -3930,6 +3930,10 @@ msgstr "" msgid "width must be greater than zero" msgstr "" +#: ports/esp32s2/common-hal/wifi/Radio.c +msgid "wifi is not enabled" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "" diff --git a/locale/es.po b/locale/es.po index da503e784db65..58634a597ef5f 100644 --- a/locale/es.po +++ b/locale/es.po @@ -4007,6 +4007,10 @@ msgstr "el tiempo de espera del perro guardián debe ser mayor a 0" msgid "width must be greater than zero" msgstr "el ancho debe ser mayor que cero" +#: ports/esp32s2/common-hal/wifi/Radio.c +msgid "wifi is not enabled" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "la ventana debe ser <= intervalo" diff --git a/locale/fil.po b/locale/fil.po index 420e6dc8beaa6..cd59ad213d324 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -3983,6 +3983,10 @@ msgstr "" msgid "width must be greater than zero" msgstr "" +#: ports/esp32s2/common-hal/wifi/Radio.c +msgid "wifi is not enabled" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index e8e24fd17712d..1c47148259122 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -4043,6 +4043,10 @@ msgstr "watchdog timeout doit être supérieur à 0" msgid "width must be greater than zero" msgstr "width doit être plus grand que zero" +#: ports/esp32s2/common-hal/wifi/Radio.c +msgid "wifi is not enabled" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "la fenêtre (window) doit être <= intervalle (interval)" diff --git a/locale/hi.po b/locale/hi.po index 69bfa1722d17a..f9fa68f5c86f2 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -3930,6 +3930,10 @@ msgstr "" msgid "width must be greater than zero" msgstr "" +#: ports/esp32s2/common-hal/wifi/Radio.c +msgid "wifi is not enabled" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index a0ef7a6ad4123..e6402f9294f94 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -3991,6 +3991,10 @@ msgstr "" msgid "width must be greater than zero" msgstr "" +#: ports/esp32s2/common-hal/wifi/Radio.c +msgid "wifi is not enabled" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "" diff --git a/locale/ja.po b/locale/ja.po index 9742f2662dc26..42c882e9a4237 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -3961,6 +3961,10 @@ msgstr "watchdogのtimeoutは0以上でなければなりません" msgid "width must be greater than zero" msgstr "" +#: ports/esp32s2/common-hal/wifi/Radio.c +msgid "wifi is not enabled" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "windowはinterval以下でなければなりません" diff --git a/locale/ko.po b/locale/ko.po index 92251fdc1b198..97de46fcd5aba 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -3934,6 +3934,10 @@ msgstr "" msgid "width must be greater than zero" msgstr "" +#: ports/esp32s2/common-hal/wifi/Radio.c +msgid "wifi is not enabled" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index a617f80a13f65..58cc8e6030f75 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -3994,6 +3994,10 @@ msgstr "watchdog time-out moet groter zijn dan 0" msgid "width must be greater than zero" msgstr "breedte moet groter dan nul zijn" +#: ports/esp32s2/common-hal/wifi/Radio.c +msgid "wifi is not enabled" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "window moet <= interval zijn" diff --git a/locale/pl.po b/locale/pl.po index 4862fa6ff433a..14a57b4ea265e 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -3953,6 +3953,10 @@ msgstr "" msgid "width must be greater than zero" msgstr "" +#: ports/esp32s2/common-hal/wifi/Radio.c +msgid "wifi is not enabled" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index e214dbb80a2c4..fa7bac364b287 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -4029,6 +4029,10 @@ msgstr "o tempo limite do watchdog deve ser maior que 0" msgid "width must be greater than zero" msgstr "a largura deve ser maior que zero" +#: ports/esp32s2/common-hal/wifi/Radio.c +msgid "wifi is not enabled" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "a janela deve ser <= intervalo" diff --git a/locale/sv.po b/locale/sv.po index a11788df0e2ab..0fe05421beed4 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -3994,6 +3994,10 @@ msgstr "watchdog timeout måste vara större än 0" msgid "width must be greater than zero" msgstr "width måste vara större än noll" +#: ports/esp32s2/common-hal/wifi/Radio.c +msgid "wifi is not enabled" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "window måste vara <= interval" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index b5b79998bff5a..1d869a0f20fcd 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -3985,6 +3985,10 @@ msgstr "kān mén gǒu chāoshí bìxū dàyú 0" msgid "width must be greater than zero" msgstr "kuāndù bìxū dàyú líng" +#: ports/esp32s2/common-hal/wifi/Radio.c +msgid "wifi is not enabled" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "Chuāngkǒu bìxū shì <= jiàngé" From 4e11e2d584fc5273f861686a106b572c4670e0c2 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Fri, 22 Jan 2021 14:47:24 +0000 Subject: [PATCH 704/770] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (923 of 923 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index fa7bac364b287..92d46a4cf95fb 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-01-22 08:49+0000\n" +"PO-Revision-Date: 2021-01-22 15:30+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -52,7 +52,7 @@ msgstr " Arquivo \"%q\", linha %d" #: py/builtinhelp.c msgid " is of type %q\n" -msgstr "" +msgstr " é do tipo %q\n" #: main.c msgid " output:\n" @@ -3406,7 +3406,7 @@ msgstr "a quantidade dos pontos deve ser pelo menos 2" #: py/builtinhelp.c msgid "object " -msgstr "" +msgstr "objeto " #: py/obj.c msgid "object '%q' is not a tuple or list" @@ -4031,7 +4031,7 @@ msgstr "a largura deve ser maior que zero" #: ports/esp32s2/common-hal/wifi/Radio.c msgid "wifi is not enabled" -msgstr "" +msgstr "o wifi não está ativo" #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" From 8c49c8df0ad9b94b76f0f6aeace17b61b632d769 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 22 Jan 2021 11:26:33 -0500 Subject: [PATCH 705/770] shrink arduino_mkr1300 --- ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.mk b/ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.mk index d31d1f54a443b..36d463697d3f8 100644 --- a/ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.mk +++ b/ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.mk @@ -10,3 +10,4 @@ INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 SUPEROPT_GC = 0 +SUPEROPT_VM = 0 From 811a34fc3db4761d4bb184b545f8930df02d296e Mon Sep 17 00:00:00 2001 From: Kevin Matocha Date: Fri, 22 Jan 2021 14:42:09 -0600 Subject: [PATCH 706/770] Add initial ParallelBus support for ESP32-S2 --- .../common-hal/displayio/ParallelBus.c | 162 +++++++++++++++++- .../common-hal/displayio/ParallelBus.h | 9 + 2 files changed, 164 insertions(+), 7 deletions(-) diff --git a/ports/esp32s2/common-hal/displayio/ParallelBus.c b/ports/esp32s2/common-hal/displayio/ParallelBus.c index d0c98f36116ff..d734c030f926d 100644 --- a/ports/esp32s2/common-hal/displayio/ParallelBus.c +++ b/ports/esp32s2/common-hal/displayio/ParallelBus.c @@ -33,35 +33,183 @@ #include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/microcontroller/__init__.h" +/* +* Current pin limitations: +* data0 pin must be byte aligned and use pin numbers < 32 (data0 options: 0, 8, 16 or 24) +* write pin must be pin number < 32. +* +* Future extensions: +* 1. Allow data0 pin numbers >= 32. +* 2. Allow write pin numbers >= 32. +*/ + void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* self, const mcu_pin_obj_t* data0, const mcu_pin_obj_t* command, const mcu_pin_obj_t* chip_select, const mcu_pin_obj_t* write, const mcu_pin_obj_t* read, const mcu_pin_obj_t* reset) { - mp_raise_NotImplementedError(translate("ParallelBus not yet supported")); + + uint8_t data_pin = data0->number; + if ( (data_pin % 8 != 0) && (data_pin >= 32) ) { + mp_raise_ValueError(translate("Data 0 pin must be byte aligned and < 32")); + } + + for (uint8_t i = 0; i < 8; i++) { + if (!pin_number_is_free(data_pin + i)) { + mp_raise_ValueError_varg(translate("Bus pin %d is already in use"), i); + } + } + + if (write->number >= 32) { + mp_raise_ValueError(translate("Write pin must be < 32")); + } + + gpio_dev_t *g = &GPIO; /* this is the GPIO registers, see "extern gpio_dev_t GPIO" from file:gpio_struct.h */ + + /* Setup the pins as "Simple GPIO outputs" see section 19.3.3 of the ESP32-S2 Reference Manual */ + /* Enable pins with "enable_w1ts" */ + + for (uint8_t i = 0; i < 8; i++) { + g->enable_w1ts = (0x1 << (data_pin + i)); + g->func_out_sel_cfg[data_pin + i].val= 256; /* setup output pin for simple GPIO Output, (0x100 = 256) */ + + } + + /* I think there is a limitation of the ESP32-S2 that does not allow single-byte writes into + the GPIO registers. See section 10.3.3 regarding "non-aligned writes" into the registers. + If a method for writing single-byte writes is uncovered, this code can be modified to provide + single-byte access into the output register */ + + self->bus = (uint32_t*) &g->out; //pointer to GPIO output register (for pins 0-31) + + /* SNIP - common setup of command, chip select, write and read pins, same as from SAMD and NRF ports */ + self->command.base.type = &digitalio_digitalinout_type; + common_hal_digitalio_digitalinout_construct(&self->command, command); + common_hal_digitalio_digitalinout_switch_to_output(&self->command, true, DRIVE_MODE_PUSH_PULL); + + self->chip_select.base.type = &digitalio_digitalinout_type; + common_hal_digitalio_digitalinout_construct(&self->chip_select, chip_select); + common_hal_digitalio_digitalinout_switch_to_output(&self->chip_select, true, DRIVE_MODE_PUSH_PULL); + + self->write.base.type = &digitalio_digitalinout_type; + common_hal_digitalio_digitalinout_construct(&self->write, write); + common_hal_digitalio_digitalinout_switch_to_output(&self->write, true, DRIVE_MODE_PUSH_PULL); + + self->read.base.type = &digitalio_digitalinout_type; + common_hal_digitalio_digitalinout_construct(&self->read, read); + common_hal_digitalio_digitalinout_switch_to_output(&self->read, true, DRIVE_MODE_PUSH_PULL); + + self->data0_pin = data_pin; + self->write_group = &GPIO; + /* Should modify the .h structure definitions if want to allow a write pin >= 32. + If so, consider putting separate "clear_write" and "set_write" pointers into the .h in place of "write_group" + to select between out_w1tc/out1_w1tc (clear) and out_w1ts/out1_w1ts (set) registers. */ + + self->write_mask = 1 << (write->number % 32); /* the write pin triggers the LCD to latch the data */ + /* Note: As currently written for the ESP32-S2 port, the write pin must be a pin number less than 32 + This could be updated to accommodate 32 and higher by using the different construction of the + address for writing to output pins >= 32, see related note above for 'self->write_group' */ + + /* SNIP - common setup of the reset pin, same as from SAMD and NRF ports */ + self->reset.base.type = &mp_type_NoneType; + if (reset != NULL) { + self->reset.base.type = &digitalio_digitalinout_type; + common_hal_digitalio_digitalinout_construct(&self->reset, reset); + common_hal_digitalio_digitalinout_switch_to_output(&self->reset, true, DRIVE_MODE_PUSH_PULL); + never_reset_pin_number(reset->number); + common_hal_displayio_parallelbus_reset(self); + } + + never_reset_pin_number(command->number); + never_reset_pin_number(chip_select->number); + never_reset_pin_number(write->number); + never_reset_pin_number(read->number); + for (uint8_t i = 0; i < 8; i++) { + never_reset_pin_number(data_pin + i); + } + } void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t* self) { + /* SNIP - same as from SAMD and NRF ports */ + for (uint8_t i = 0; i < 8; i++) { + reset_pin_number(self->data0_pin + i); + } + reset_pin_number(self->command.pin->number); + reset_pin_number(self->chip_select.pin->number); + reset_pin_number(self->write.pin->number); + reset_pin_number(self->read.pin->number); + reset_pin_number(self->reset.pin->number); } bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) { - return false; + /* SNIP - same as from SAMD and NRF ports */ + displayio_parallelbus_obj_t* self = MP_OBJ_TO_PTR(obj); + if (self->reset.base.type == &mp_type_NoneType) { + return false; + } + + common_hal_digitalio_digitalinout_set_value(&self->reset, false); + common_hal_mcu_delay_us(4); + common_hal_digitalio_digitalinout_set_value(&self->reset, true); + return true; + } bool common_hal_displayio_parallelbus_bus_free(mp_obj_t obj) { - return false; + /* SNIP - same as from SAMD and NRF ports */ + return true; } bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) { - - return false; + /* SNIP - same as from SAMD and NRF ports */ + displayio_parallelbus_obj_t* self = MP_OBJ_TO_PTR(obj); + common_hal_digitalio_digitalinout_set_value(&self->chip_select, false); + return true; } void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, - display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) { + display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) { + displayio_parallelbus_obj_t* self = MP_OBJ_TO_PTR(obj); + common_hal_digitalio_digitalinout_set_value(&self->command, byte_type == DISPLAY_DATA); + + /* Currently the write pin number must be < 32. + Future: To accommodate write pin numbers >= 32, will need to update to choose a different register + for set/reset (out1_w1tc and out1_w1ts) */ + + uint32_t* clear_write = (uint32_t*) &self->write_group->out_w1tc; + uint32_t* set_write = (uint32_t*) &self->write_group->out_w1ts; + uint32_t mask = self->write_mask; + + /* Setup structures for data writing. The ESP32-S2 port differs from the SAMD and NRF ports + because I have not found a way to write a single byte into the ESP32-S2 registers. + For the ESP32-S2, I create a 32-bit data_buffer that is used to transfer the data bytes. */ + + *clear_write = mask; // Clear the write pin to prepare the registers before storing register settings into data_buffer + uint32_t data_buffer = *self->bus; // store the initial output register values into the data output buffer + uint8_t* data_address = ((uint8_t*) &data_buffer) + (self->data0_pin / 8); /* address inside data_buffer where + each data byte will be written (as offset by (data0_pin/8) number of bytes) */ + + for (uint32_t i = 0; i < data_length; i++) { + + /* Question: Is there a faster way of stuffing the data byte into the data_buffer, is bit arithmetic + faster than writing to the byte address? */ + + /* Note: May be able to eliminate either the clear_write or set_write since the data buffer + can be written with the write pin cleared or set already, and depending upon whether the display + latches the data on the rising or falling edge of the write pin. Remember: This method + will require the write pin to be controlled by the same GPIO register as the data pins. */ + + *clear_write = mask; // clear the write pin (See comment above, this may not be necessary). + *(data_address) = data[i]; // stuff the data byte into the data_buffer at the correct offset byte location + *self->bus = data_buffer; // write the data to the output register + *set_write = mask; // set the write pin + } } void common_hal_displayio_parallelbus_end_transaction(mp_obj_t obj) { - + /* SNIP - same as from SAMD and NRF ports */ + displayio_parallelbus_obj_t* self = MP_OBJ_TO_PTR(obj); + common_hal_digitalio_digitalinout_set_value(&self->chip_select, true); } diff --git a/ports/esp32s2/common-hal/displayio/ParallelBus.h b/ports/esp32s2/common-hal/displayio/ParallelBus.h index cd636921d9310..20fc2f1bc7823 100644 --- a/ports/esp32s2/common-hal/displayio/ParallelBus.h +++ b/ports/esp32s2/common-hal/displayio/ParallelBus.h @@ -31,6 +31,15 @@ typedef struct { mp_obj_base_t base; + uint32_t* bus; // pointer where 8 bits of data are written to the display + digitalio_digitalinout_obj_t command; + digitalio_digitalinout_obj_t chip_select; + digitalio_digitalinout_obj_t reset; + digitalio_digitalinout_obj_t write; // write pin, must be a pin number < 32 currently + digitalio_digitalinout_obj_t read; + uint8_t data0_pin; // pin number for the lowest number pin. Must be 0, 8, 16 or 24 with current + gpio_dev_t* write_group; // pointer to the write group for setting/clearing the write bit to latch the data on the LCD + uint32_t write_mask; // bit mask for the single bit for the write pin, currently write pin must be a pin number < 32 } displayio_parallelbus_obj_t; #endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_DISPLAYIO_PARALLELBUS_H From dff3423c231c07751175ded39a18beef28aecd4f Mon Sep 17 00:00:00 2001 From: James Bowman Date: Fri, 22 Jan 2021 15:52:46 -0800 Subject: [PATCH 707/770] Change from fixed-point integer arguments to floating point in EVE API functions Changed calls: PointSize(), LineWidth(), VertexTranslateX() and VertexTranslateY() Units for all the above are now pixels, not fixed-point integers. This matches OpenGL. Docstrings updated accordingly --- shared-bindings/_eve/__init__.c | 150 ++++++++++++++++---------------- shared-bindings/_eve/__init__.h | 8 +- shared-module/_eve/__init__.c | 20 +++-- 3 files changed, 92 insertions(+), 86 deletions(-) diff --git a/shared-bindings/_eve/__init__.c b/shared-bindings/_eve/__init__.c index 0f628b6fb08c5..c043aa5faeb4f 100644 --- a/shared-bindings/_eve/__init__.c +++ b/shared-bindings/_eve/__init__.c @@ -604,22 +604,6 @@ STATIC mp_obj_t _jump(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(jump_obj, _jump); -//| def LineWidth(self, width: int) -> None: -//| """Set the width of rasterized lines -//| -//| :param int width: line width in :math:`1/16` pixel. Range 0-4095. The initial value is 16 -//| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" -//| ... -//| - -STATIC mp_obj_t _linewidth(mp_obj_t self, mp_obj_t a0) { - uint32_t width = mp_obj_get_int_truncated(a0); - common_hal__eve_LineWidth(EVEHAL(self), width); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(linewidth_obj, _linewidth); - //| def Macro(self, m: int) -> None: //| """Execute a single command from a macro register //| @@ -662,22 +646,6 @@ STATIC mp_obj_t _palettesource(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(palettesource_obj, _palettesource); -//| def PointSize(self, size: int) -> None: -//| """Set the radius of rasterized points -//| -//| :param int size: point radius in :math:`1/16` pixel. Range 0-8191. The initial value is 16 -//| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" -//| ... -//| - -STATIC mp_obj_t _pointsize(mp_obj_t self, mp_obj_t a0) { - uint32_t size = mp_obj_get_int_truncated(a0); - common_hal__eve_PointSize(EVEHAL(self), size); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(pointsize_obj, _pointsize); - //| def RestoreContext(self) -> None: //| """Restore the current graphics context from the context stack""" //| ... @@ -836,48 +804,6 @@ STATIC mp_obj_t _tag(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(tag_obj, _tag); -//| def VertexTranslateX(self, x: int) -> None: -//| """Set the vertex transformation's x translation component -//| -//| :param int x: signed x-coordinate in :math:`1/16` pixel. Range 0-131071. The initial value is 0 -//| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" -//| ... -//| - -STATIC mp_obj_t _vertextranslatex(mp_obj_t self, mp_obj_t a0) { - uint32_t x = mp_obj_get_int_truncated(a0); - common_hal__eve_VertexTranslateX(EVEHAL(self), x); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatex_obj, _vertextranslatex); - -//| def VertexTranslateY(self, y: int) -> None: -//| """Set the vertex transformation's y translation component -//| -//| :param int y: signed y-coordinate in :math:`1/16` pixel. Range 0-131071. The initial value is 0 -//| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" -//| ... -//| - - -STATIC mp_obj_t _vertextranslatey(mp_obj_t self, mp_obj_t a0) { - uint32_t y = mp_obj_get_int_truncated(a0); - common_hal__eve_VertexTranslateY(EVEHAL(self), y); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatey_obj, _vertextranslatey); - -//| def VertexFormat(self, frac: int) -> None: -//| """Set the precision of vertex2f coordinates -//| -//| :param int frac: Number of fractional bits in X,Y coordinates, 0-4. Range 0-7. The initial value is 4 -//| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" -//| ... -//| - STATIC mp_obj_t _vertexformat(mp_obj_t self, mp_obj_t a0) { uint32_t frac = mp_obj_get_int_truncated(a0); common_hal__eve_VertexFormat(EVEHAL(self), frac); @@ -975,6 +901,82 @@ STATIC mp_obj_t _vertex2f(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { } STATIC MP_DEFINE_CONST_FUN_OBJ_3(vertex2f_obj, _vertex2f); +//| def LineWidth(self, width: float) -> None: +//| """Set the width of rasterized lines +//| +//| :param float width: line width in pixels. Range 0-511. The initial value is 1 +//| +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| ... +//| + +STATIC mp_obj_t _linewidth(mp_obj_t self, mp_obj_t a0) { + mp_float_t width = mp_obj_get_float(a0); + common_hal__eve_LineWidth(EVEHAL(self), width); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(linewidth_obj, _linewidth); + +//| def PointSize(self, size: float) -> None: +//| """Set the diameter of rasterized points +//| +//| :param float size: point diameter in pixels. Range 0-1023. The initial value is 1 +//| +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| ... +//| + +STATIC mp_obj_t _pointsize(mp_obj_t self, mp_obj_t a0) { + mp_float_t size = mp_obj_get_float(a0); + common_hal__eve_PointSize(EVEHAL(self), size); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(pointsize_obj, _pointsize); + +//| def VertexTranslateX(self, x: float) -> None: +//| """Set the vertex transformation's x translation component +//| +//| :param float x: signed x-coordinate in pixels. Range ±4095. The initial value is 0 +//| +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| ... +//| + +STATIC mp_obj_t _vertextranslatex(mp_obj_t self, mp_obj_t a0) { + mp_float_t x = mp_obj_get_float(a0); + common_hal__eve_VertexTranslateX(EVEHAL(self), x); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatex_obj, _vertextranslatex); + +//| def VertexTranslateY(self, y: float) -> None: +//| """Set the vertex transformation's y translation component +//| +//| :param float y: signed y-coordinate in pixels. Range ±4095. The initial value is 0 +//| +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| ... +//| + + +STATIC mp_obj_t _vertextranslatey(mp_obj_t self, mp_obj_t a0) { + mp_float_t y = mp_obj_get_float(a0); + common_hal__eve_VertexTranslateY(EVEHAL(self), y); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatey_obj, _vertextranslatey); + +//| def VertexFormat(self, frac: int) -> None: +//| """Set the precision of vertex2f coordinates +//| +//| :param int frac: Number of fractional bits in X,Y coordinates, 0-4. Range 0-7. The initial value is 4 +//| +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| ... +//| + +//} + // Append an object x to the FIFO #define ADD_X(self, x) \ common_hal__eve_add(EVEHAL(self), sizeof(x), &(x)); diff --git a/shared-bindings/_eve/__init__.h b/shared-bindings/_eve/__init__.h index 759a629bbddbb..883b1a15bfba6 100644 --- a/shared-bindings/_eve/__init__.h +++ b/shared-bindings/_eve/__init__.h @@ -61,11 +61,11 @@ void common_hal__eve_ColorRGB(common_hal__eve_t *eve, uint32_t red, uint32_t gre void common_hal__eve_Display(common_hal__eve_t *eve); void common_hal__eve_End(common_hal__eve_t *eve); void common_hal__eve_Jump(common_hal__eve_t *eve, uint32_t dest); -void common_hal__eve_LineWidth(common_hal__eve_t *eve, uint32_t width); +void common_hal__eve_LineWidth(common_hal__eve_t *eve, mp_float_t width); void common_hal__eve_Macro(common_hal__eve_t *eve, uint32_t m); void common_hal__eve_Nop(common_hal__eve_t *eve); void common_hal__eve_PaletteSource(common_hal__eve_t *eve, uint32_t addr); -void common_hal__eve_PointSize(common_hal__eve_t *eve, uint32_t size); +void common_hal__eve_PointSize(common_hal__eve_t *eve, mp_float_t size); void common_hal__eve_RestoreContext(common_hal__eve_t *eve); void common_hal__eve_Return(common_hal__eve_t *eve); void common_hal__eve_SaveContext(common_hal__eve_t *eve); @@ -76,8 +76,8 @@ void common_hal__eve_StencilMask(common_hal__eve_t *eve, uint32_t mask); void common_hal__eve_StencilOp(common_hal__eve_t *eve, uint32_t sfail, uint32_t spass); void common_hal__eve_TagMask(common_hal__eve_t *eve, uint32_t mask); void common_hal__eve_Tag(common_hal__eve_t *eve, uint32_t s); -void common_hal__eve_VertexTranslateX(common_hal__eve_t *eve, uint32_t x); -void common_hal__eve_VertexTranslateY(common_hal__eve_t *eve, uint32_t y); +void common_hal__eve_VertexTranslateX(common_hal__eve_t *eve, mp_float_t x); +void common_hal__eve_VertexTranslateY(common_hal__eve_t *eve, mp_float_t y); void common_hal__eve_VertexFormat(common_hal__eve_t *eve, uint32_t frac); void common_hal__eve_Vertex2ii(common_hal__eve_t *eve, uint32_t x, uint32_t y, uint32_t handle, uint32_t cell); diff --git a/shared-module/_eve/__init__.c b/shared-module/_eve/__init__.c index d95c777dc4fd8..579729d42c9d9 100644 --- a/shared-module/_eve/__init__.c +++ b/shared-module/_eve/__init__.c @@ -226,8 +226,9 @@ void common_hal__eve_Jump(common_hal__eve_t *eve, uint32_t dest) { } -void common_hal__eve_LineWidth(common_hal__eve_t *eve, uint32_t width) { - C4(eve, ((14 << 24) | ((width & 4095)))); +void common_hal__eve_LineWidth(common_hal__eve_t *eve, mp_float_t width) { + int16_t iw = (int)(8 * width); + C4(eve, ((14 << 24) | ((iw & 4095)))); } @@ -246,8 +247,9 @@ void common_hal__eve_PaletteSource(common_hal__eve_t *eve, uint32_t addr) { } -void common_hal__eve_PointSize(common_hal__eve_t *eve, uint32_t size) { - C4(eve, ((13 << 24) | ((size & 8191)))); +void common_hal__eve_PointSize(common_hal__eve_t *eve, mp_float_t size) { + int16_t is = (int)(8 * size); + C4(eve, ((13 << 24) | ((is & 8191)))); } @@ -301,13 +303,15 @@ void common_hal__eve_Tag(common_hal__eve_t *eve, uint32_t s) { } -void common_hal__eve_VertexTranslateX(common_hal__eve_t *eve, uint32_t x) { - C4(eve, ((43 << 24) | (((x) & 131071)))); +void common_hal__eve_VertexTranslateX(common_hal__eve_t *eve, mp_float_t x) { + int16_t ix = (int)(16 * x); + C4(eve, ((43 << 24) | (ix & 131071))); } -void common_hal__eve_VertexTranslateY(common_hal__eve_t *eve, uint32_t y) { - C4(eve, ((44 << 24) | (((y) & 131071)))); +void common_hal__eve_VertexTranslateY(common_hal__eve_t *eve, mp_float_t y) { + int16_t iy = (int)(16 * y); + C4(eve, ((44 << 24) | (iy & 131071))); } From de6b05a17bd22d0ff6a8e07547128ec6001c62ea Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 22 Jan 2021 19:00:37 -0800 Subject: [PATCH 708/770] Fix DigitalInOut.pull on RP2040 It used to always return None. Fixes #4035 --- .../common-hal/digitalio/DigitalInOut.c | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/ports/raspberrypi/common-hal/digitalio/DigitalInOut.c b/ports/raspberrypi/common-hal/digitalio/DigitalInOut.c index 06f0cfdd27112..b0bc1b96e819a 100644 --- a/ports/raspberrypi/common-hal/digitalio/DigitalInOut.c +++ b/ports/raspberrypi/common-hal/digitalio/DigitalInOut.c @@ -76,8 +76,7 @@ digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_output( digitalio_drive_mode_t drive_mode) { const uint8_t pin = self->pin->number; gpio_set_dir(pin, GPIO_OUT); - // Turn on "strong" pin driving (more current available). See DRVSTR doc in datasheet. - // hri_port_set_PINCFG_DRVSTR_bit(PORT, (enum gpio_port)GPIO_PORT(pin), GPIO_PIN(pin)); + // TODO: Turn on "strong" pin driving (more current available). self->output = true; common_hal_digitalio_digitalinout_set_drive_mode(self, drive_mode); @@ -140,18 +139,16 @@ void common_hal_digitalio_digitalinout_set_pull( digitalio_pull_t common_hal_digitalio_digitalinout_get_pull( digitalio_digitalinout_obj_t* self) { - // uint32_t pin = self->pin->number; - // if (self->output) { - // mp_raise_AttributeError(translate("Cannot get pull while in output mode")); - // return PULL_NONE; - // } else { - // if (hri_port_get_PINCFG_PULLEN_bit(PORT, GPIO_PORT(pin), GPIO_PIN(pin)) == 0) { - // return PULL_NONE; - // } if (hri_port_get_OUT_reg(PORT, GPIO_PORT(pin), 1U << GPIO_PIN(pin)) > 0) { - // return PULL_UP; - // } else { - // return PULL_DOWN; - // } - // } + uint32_t pin = self->pin->number; + if (self->output) { + mp_raise_AttributeError(translate("Cannot get pull while in output mode")); + return PULL_NONE; + } else { + if (gpio_is_pulled_up(pin)) { + return PULL_UP; + } else if (gpio_is_pulled_down(pin)) { + return PULL_DOWN; + } + } return PULL_NONE; } From 34aa01c5f9c45a85f4c6c73bc4e094a717b68451 Mon Sep 17 00:00:00 2001 From: Kevin Matocha Date: Fri, 22 Jan 2021 22:29:51 -0600 Subject: [PATCH 709/770] Remove redundant clear_write, add make translate --- locale/circuitpython.pot | 10 ++++++- .../common-hal/displayio/ParallelBus.c | 28 +++++++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 434684e1373ed..4dfce747d7055 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -527,6 +527,7 @@ msgid "Buffer too short by %d bytes" msgstr "" #: ports/atmel-samd/common-hal/displayio/ParallelBus.c +#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/nrf/common-hal/displayio/ParallelBus.c #, c-format msgid "Bus pin %d is already in use" @@ -796,6 +797,10 @@ msgstr "" msgid "Data 0 pin must be byte aligned" msgstr "" +#: ports/esp32s2/common-hal/displayio/ParallelBus.c +msgid "Data 0 pin must be byte aligned and < 32" +msgstr "" + #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" msgstr "" @@ -1564,7 +1569,6 @@ msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "" -#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" @@ -2136,6 +2140,10 @@ msgstr "" msgid "Woken up by alarm.\n" msgstr "" +#: ports/esp32s2/common-hal/displayio/ParallelBus.c +msgid "Write pin must be < 32" +msgstr "" + #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "" diff --git a/ports/esp32s2/common-hal/displayio/ParallelBus.c b/ports/esp32s2/common-hal/displayio/ParallelBus.c index d734c030f926d..04e24b2914374 100644 --- a/ports/esp32s2/common-hal/displayio/ParallelBus.c +++ b/ports/esp32s2/common-hal/displayio/ParallelBus.c @@ -177,19 +177,33 @@ void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byt Future: To accommodate write pin numbers >= 32, will need to update to choose a different register for set/reset (out1_w1tc and out1_w1ts) */ + // **** Bit shifting trial + // uint32_t* output_register = self->bus; + // const uint8_t bit_shift=self->data0_pin; + uint32_t* clear_write = (uint32_t*) &self->write_group->out_w1tc; uint32_t* set_write = (uint32_t*) &self->write_group->out_w1ts; - uint32_t mask = self->write_mask; + + const uint32_t mask = self->write_mask; + /* Setup structures for data writing. The ESP32-S2 port differs from the SAMD and NRF ports because I have not found a way to write a single byte into the ESP32-S2 registers. For the ESP32-S2, I create a 32-bit data_buffer that is used to transfer the data bytes. */ *clear_write = mask; // Clear the write pin to prepare the registers before storing register settings into data_buffer - uint32_t data_buffer = *self->bus; // store the initial output register values into the data output buffer + + const uint32_t data_buffer = *self->bus; // store the initial output register values into the data output buffer uint8_t* data_address = ((uint8_t*) &data_buffer) + (self->data0_pin / 8); /* address inside data_buffer where each data byte will be written (as offset by (data0_pin/8) number of bytes) */ + // *** Bit shifting trial + // *data_address = 0; //clear the 8 data bits + + //mp_printf(&mp_plat_print, "\n\ndata_buffer: %x\n", data_buffer); + //mp_printf(&mp_plat_print, "data[0]: %x\n", data[0]); + //mp_printf(&mp_plat_print, "data_buffer[0]: %x\n\n", (data_buffer | (((uint32_t) data[0]) << self->data0_pin))); + for (uint32_t i = 0; i < data_length; i++) { /* Question: Is there a faster way of stuffing the data byte into the data_buffer, is bit arithmetic @@ -200,9 +214,17 @@ void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byt latches the data on the rising or falling edge of the write pin. Remember: This method will require the write pin to be controlled by the same GPIO register as the data pins. */ - *clear_write = mask; // clear the write pin (See comment above, this may not be necessary). + // Can ignore this line if the write pin is in the same register as the data pins + // *clear_write = mask; // clear the write pin (See comment above, this may not be necessary). + + // *** Original code *(data_address) = data[i]; // stuff the data byte into the data_buffer at the correct offset byte location *self->bus = data_buffer; // write the data to the output register + + // *** Bit shifting trial - didn't have much improvement in performance + // *output_register = (data_buffer | (((uint32_t) data[i]) << bit_shift)); + + *set_write = mask; // set the write pin } From dc421a6ca89cc0946d8b1f2b15bd57a59c110a6a Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sat, 23 Jan 2021 06:18:15 -0500 Subject: [PATCH 710/770] squeeze some builds --- .../circuitplayground_express_crickit/mpconfigboard.mk | 2 +- ports/atmel-samd/boards/qtpy_m0/mpconfigboard.mk | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk index c3be33134cd96..3e5131a62b8cf 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk @@ -22,7 +22,7 @@ CIRCUITPY_ROTARYIO = 0 CIRCUITPY_RTC = 0 SUPEROPT_GC = 0 -CFLAGS_INLINE_LIMIT = 50 +CFLAGS_INLINE_LIMIT = 40 # Include these Python libraries in firmware. diff --git a/ports/atmel-samd/boards/qtpy_m0/mpconfigboard.mk b/ports/atmel-samd/boards/qtpy_m0/mpconfigboard.mk index 964cbe643ad86..e100e2da6230c 100644 --- a/ports/atmel-samd/boards/qtpy_m0/mpconfigboard.mk +++ b/ports/atmel-samd/boards/qtpy_m0/mpconfigboard.mk @@ -11,14 +11,6 @@ LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 SUPEROPT_GC = 0 +SUPEROPT_VM = 0 CFLAGS_BOARD = --param max-inline-insns-auto=15 -ifeq ($(TRANSLATION), zh_Latn_pinyin) -RELEASE_NEEDS_CLEAN_BUILD = 1 -CFLAGS_INLINE_LIMIT = 35 -endif -ifeq ($(TRANSLATION), de_DE) -RELEASE_NEEDS_CLEAN_BUILD = 1 -CFLAGS_INLINE_LIMIT = 35 -SUPEROPT_VM = 0 -endif From 10965e59896b9fd7b1261792d5ed450beae6c1eb Mon Sep 17 00:00:00 2001 From: Kevin Matocha Date: Sat, 23 Jan 2021 11:30:17 -0600 Subject: [PATCH 711/770] Delete unnecessary comments --- .../common-hal/displayio/ParallelBus.c | 90 ++++++++----------- 1 file changed, 39 insertions(+), 51 deletions(-) diff --git a/ports/esp32s2/common-hal/displayio/ParallelBus.c b/ports/esp32s2/common-hal/displayio/ParallelBus.c index 04e24b2914374..b644610f21236 100644 --- a/ports/esp32s2/common-hal/displayio/ParallelBus.c +++ b/ports/esp32s2/common-hal/displayio/ParallelBus.c @@ -34,20 +34,18 @@ #include "shared-bindings/microcontroller/__init__.h" /* -* Current pin limitations: -* data0 pin must be byte aligned and use pin numbers < 32 (data0 options: 0, 8, 16 or 24) -* write pin must be pin number < 32. -* -* Future extensions: -* 1. Allow data0 pin numbers >= 32. -* 2. Allow write pin numbers >= 32. -*/ + * + * Current pin limitations for ESP32-S2 ParallelBus: + * 1. data0 pin must be byte aligned (data0 pin options: 0, 8, 16 or 24) + * 2. The 8 data lines must use pin numbers < 32 + * 3. The write pin must be pin number < 32. + * + */ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* self, const mcu_pin_obj_t* data0, const mcu_pin_obj_t* command, const mcu_pin_obj_t* chip_select, const mcu_pin_obj_t* write, const mcu_pin_obj_t* read, const mcu_pin_obj_t* reset) { - uint8_t data_pin = data0->number; if ( (data_pin % 8 != 0) && (data_pin >= 32) ) { mp_raise_ValueError(translate("Data 0 pin must be byte aligned and < 32")); @@ -63,10 +61,10 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* sel mp_raise_ValueError(translate("Write pin must be < 32")); } - gpio_dev_t *g = &GPIO; /* this is the GPIO registers, see "extern gpio_dev_t GPIO" from file:gpio_struct.h */ + gpio_dev_t *g = &GPIO; // this is the GPIO registers, see "extern gpio_dev_t GPIO" from file:gpio_struct.h - /* Setup the pins as "Simple GPIO outputs" see section 19.3.3 of the ESP32-S2 Reference Manual */ - /* Enable pins with "enable_w1ts" */ + // Setup the pins as "Simple GPIO outputs" see section 19.3.3 of the ESP32-S2 Reference Manual + // Enable pins with "enable_w1ts" for (uint8_t i = 0; i < 8; i++) { g->enable_w1ts = (0x1 << (data_pin + i)); @@ -74,10 +72,11 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* sel } - /* I think there is a limitation of the ESP32-S2 that does not allow single-byte writes into - the GPIO registers. See section 10.3.3 regarding "non-aligned writes" into the registers. - If a method for writing single-byte writes is uncovered, this code can be modified to provide - single-byte access into the output register */ + /* From my understanding, there is a limitation of the ESP32-S2 that does not allow single-byte writes + * into the GPIO registers. See section 10.3.3 regarding "non-aligned writes" into the registers. + * If a method for writing single-byte writes is uncovered, this code can be modified to provide + * single-byte access into the output register + */ self->bus = (uint32_t*) &g->out; //pointer to GPIO output register (for pins 0-31) @@ -100,14 +99,16 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* sel self->data0_pin = data_pin; self->write_group = &GPIO; - /* Should modify the .h structure definitions if want to allow a write pin >= 32. - If so, consider putting separate "clear_write" and "set_write" pointers into the .h in place of "write_group" - to select between out_w1tc/out1_w1tc (clear) and out_w1ts/out1_w1ts (set) registers. */ + /* If we want to allow a write pin >= 32, should consider putting separate "clear_write" and + * "set_write" pointers into the .h in place of "write_group" + * to select between out_w1tc/out1_w1tc (clear) and out_w1ts/out1_w1ts (set) registers. + */ self->write_mask = 1 << (write->number % 32); /* the write pin triggers the LCD to latch the data */ /* Note: As currently written for the ESP32-S2 port, the write pin must be a pin number less than 32 - This could be updated to accommodate 32 and higher by using the different construction of the - address for writing to output pins >= 32, see related note above for 'self->write_group' */ + * This could be updated to accommodate 32 and higher by using the different construction of the + * address for writing to output pins >= 32, see related note above for 'self->write_group' + */ /* SNIP - common setup of the reset pin, same as from SAMD and NRF ports */ self->reset.base.type = &mp_type_NoneType; @@ -174,57 +175,44 @@ void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byt common_hal_digitalio_digitalinout_set_value(&self->command, byte_type == DISPLAY_DATA); /* Currently the write pin number must be < 32. - Future: To accommodate write pin numbers >= 32, will need to update to choose a different register - for set/reset (out1_w1tc and out1_w1ts) */ - - // **** Bit shifting trial - // uint32_t* output_register = self->bus; - // const uint8_t bit_shift=self->data0_pin; + * Future: To accommodate write pin numbers >= 32, will need to update to choose the correct register + * for the write pin set/clear (out_w1ts/out1_w1ts and out_w1tc/out1_w1tc) + */ uint32_t* clear_write = (uint32_t*) &self->write_group->out_w1tc; uint32_t* set_write = (uint32_t*) &self->write_group->out_w1ts; const uint32_t mask = self->write_mask; - /* Setup structures for data writing. The ESP32-S2 port differs from the SAMD and NRF ports - because I have not found a way to write a single byte into the ESP32-S2 registers. - For the ESP32-S2, I create a 32-bit data_buffer that is used to transfer the data bytes. */ + * because I have not found a way to write a single byte into the ESP32-S2 registers. + * For the ESP32-S2, I create a 32-bit data_buffer that is used to transfer the data bytes. + */ - *clear_write = mask; // Clear the write pin to prepare the registers before storing register settings into data_buffer + *clear_write = mask; // Clear the write pin to prepare the registers before storing the + // register value into data_buffer const uint32_t data_buffer = *self->bus; // store the initial output register values into the data output buffer uint8_t* data_address = ((uint8_t*) &data_buffer) + (self->data0_pin / 8); /* address inside data_buffer where - each data byte will be written (as offset by (data0_pin/8) number of bytes) */ - - // *** Bit shifting trial - // *data_address = 0; //clear the 8 data bits - - //mp_printf(&mp_plat_print, "\n\ndata_buffer: %x\n", data_buffer); - //mp_printf(&mp_plat_print, "data[0]: %x\n", data[0]); - //mp_printf(&mp_plat_print, "data_buffer[0]: %x\n\n", (data_buffer | (((uint32_t) data[0]) << self->data0_pin))); + * each data byte will be written to the data pin registers + */ for (uint32_t i = 0; i < data_length; i++) { /* Question: Is there a faster way of stuffing the data byte into the data_buffer, is bit arithmetic - faster than writing to the byte address? */ + * faster than writing to the byte address? + */ - /* Note: May be able to eliminate either the clear_write or set_write since the data buffer - can be written with the write pin cleared or set already, and depending upon whether the display - latches the data on the rising or falling edge of the write pin. Remember: This method - will require the write pin to be controlled by the same GPIO register as the data pins. */ + /* Note: If the write pin and data pins are controlled by the same GPIO register, we can eliminate + * the "clear_write" step below, since the write pin is cleared when the data_buffer is written + * to the bus. + * Remember: This method requires the write pin to be controlled by the same GPIO register as the data pins. + */ - // Can ignore this line if the write pin is in the same register as the data pins // *clear_write = mask; // clear the write pin (See comment above, this may not be necessary). - // *** Original code *(data_address) = data[i]; // stuff the data byte into the data_buffer at the correct offset byte location *self->bus = data_buffer; // write the data to the output register - - // *** Bit shifting trial - didn't have much improvement in performance - // *output_register = (data_buffer | (((uint32_t) data[i]) << bit_shift)); - - *set_write = mask; // set the write pin } From abd9f7894df4118dc70dca0f1fa3aa3c0349edae Mon Sep 17 00:00:00 2001 From: David Glaude Date: Sun, 24 Jan 2021 12:53:06 +0100 Subject: [PATCH 712/770] Permit Gameduino 3X Dazzler support on that board. Totally untested, change request based on change made in #2581. It might be my first PR in CircuitPython core... Maybe this should be confirmed by @jamesbowman Those are the two boards that seems supported: * Metro M4 Express * Metro nRF52840 Express The only Metro that this PR concern: * Metro M4 AirLift Lite Other Metro I found and are maybe not supported: * Metro ESP32-S2 * Metro M0 Express * Metro M7 1011 --- ports/atmel-samd/boards/metro_m4_airlift_lite/mpconfigboard.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/atmel-samd/boards/metro_m4_airlift_lite/mpconfigboard.mk b/ports/atmel-samd/boards/metro_m4_airlift_lite/mpconfigboard.mk index 4895cda77b043..58d4e49805c04 100644 --- a/ports/atmel-samd/boards/metro_m4_airlift_lite/mpconfigboard.mk +++ b/ports/atmel-samd/boards/metro_m4_airlift_lite/mpconfigboard.mk @@ -10,3 +10,5 @@ QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICE_COUNT = 3 EXTERNAL_FLASH_DEVICES = "S25FL116K, S25FL216K, GD25Q16C" LONGINT_IMPL = MPZ + +CIRCUITPY__EVE = 1 From 69869e1439a1ebad383b75b28e7e88f21ccab732 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sun, 24 Jan 2021 22:49:28 -0500 Subject: [PATCH 713/770] CIRCUITPY_* switches for JSON, RE, etc. Doc cleanup --- docs/library/{uerrno.rst => errno.rst} | 10 +-- docs/library/index.rst | 51 ++++--------- docs/library/{uio.rst => io.rst} | 6 +- docs/library/{ujson.rst => json.rst} | 6 +- docs/library/{ure.rst => re.rst} | 8 +- docs/shared_bindings_matrix.py | 4 +- .../mpconfigboard.h | 3 +- ports/atmel-samd/mpconfigport.h | 7 -- ports/atmel-samd/mpconfigport.mk | 52 ++++--------- ports/esp32s2/mpconfigport.h | 1 - ports/litex/mpconfigport.h | 2 - ports/mimxrt10xx/mpconfigport.h | 2 - ports/nrf/mpconfigport.h | 3 - ports/raspberrypi/mpconfigport.h | 4 +- ports/stm/mpconfigport.h | 2 - py/circuitpy_mpconfig.h | 73 ++++++++++--------- py/circuitpy_mpconfig.mk | 12 +++ shared-bindings/support_matrix.rst | 4 +- 18 files changed, 96 insertions(+), 154 deletions(-) rename docs/library/{uerrno.rst => errno.rst} (76%) rename docs/library/{uio.rst => io.rst} (97%) rename docs/library/{ujson.rst => json.rst} (87%) rename docs/library/{ure.rst => re.rst} (94%) diff --git a/docs/library/uerrno.rst b/docs/library/errno.rst similarity index 76% rename from docs/library/uerrno.rst rename to docs/library/errno.rst index 72f71f0aacd7c..96777b2052c23 100644 --- a/docs/library/uerrno.rst +++ b/docs/library/errno.rst @@ -1,9 +1,7 @@ -:mod:`uerrno` -- system error codes +:mod:`errno` -- system error codes =================================== -.. include:: ../templates/unsupported_in_circuitpython.inc - -.. module:: uerrno +.. module:: errno :synopsis: system error codes |see_cpython_module| :mod:`cpython:errno`. @@ -22,7 +20,7 @@ Constants try: os.mkdir("my_dir") except OSError as exc: - if exc.args[0] == uerrno.EEXIST: + if exc.args[0] == errno.EEXIST: print("Directory already exists") .. data:: errorcode @@ -30,5 +28,5 @@ Constants Dictionary mapping numeric error codes to strings with symbolic error code (see above):: - >>> print(uerrno.errorcode[uerrno.EEXIST]) + >>> print(errno.errorcode[uerrno.EEXIST]) EEXIST diff --git a/docs/library/index.rst b/docs/library/index.rst index e9138724210d2..94bd8a65698d1 100644 --- a/docs/library/index.rst +++ b/docs/library/index.rst @@ -7,34 +7,20 @@ Python standard libraries and micro-libraries --------------------------------------------- These libraries are inherited from MicroPython. -They are similar to the standard Python libraries with the same name -or with the "u" prefix dropped. +They are similar to the standard Python libraries with the same name. They implement a subset of or a variant of the corresponding standard Python library. -.. warning:: - - Though these MicroPython-based libraries are available in CircuitPython, - their functionality may change in the future, perhaps significantly. - As CircuitPython continues to develop, new versions of these libraries will - be created that are more compliant with the standard Python libraries. - You may need to change your code later if you rely - on any non-standard functionality they currently provide. - CircuitPython's long-term goal is that code written in CircuitPython using Python standard libraries will be runnable on CPython without changes. -Some libraries below are not enabled on CircuitPython builds with +These libraries are not enabled on CircuitPython builds with limited flash memory, usually on non-Express builds: -``uerrno``, ``ure``. - -Some libraries are not currently enabled in any CircuitPython build, but may be in the future: -``uio``, ``ujson``, ``uzlib``. +``binascii``, ``errno``, ``json``, ``re``. -Some libraries are only enabled only WiFi-capable ports (ESP8266, nRF) -because they are typically used for network software: -``binascii``, ``hashlib``, ``uheapq``, ``uselect``, ``ussl``. -Not all of these are enabled on all WiFi-capable ports. +These libraries are not currently enabled in any CircuitPython build, but may be in the future, +with the ``u`` prefix dropped: +``uctypes`, ``uhashlib``, ``uio``, ``uzlib``. .. toctree:: :maxdepth: 1 @@ -44,13 +30,14 @@ Not all of these are enabled on all WiFi-capable ports. array.rst binascii.rst collections.rst + errno.rst gc.rst hashlib.rst + io.rst + json.rst + re.rst sys.rst - uerrno.rst - uio.rst - ujson.rst - ure.rst + uctypes.rst uselect.rst usocket.rst ussl.rst @@ -59,8 +46,8 @@ Not all of these are enabled on all WiFi-capable ports. Omitted functions in the ``string`` library ------------------------------------------- -A few string operations are not enabled on CircuitPython -M0 non-Express builds, due to limited flash memory: +A few string operations are not enabled on small builds +(usually non-Express), due to limited flash memory: ``string.center()``, ``string.partition()``, ``string.splitlines()``, ``string.reversed()``. @@ -78,15 +65,3 @@ versions of CircuitPython. btree.rst framebuf.rst micropython.rst - network.rst - uctypes.rst - -Libraries specific to the ESP8266 ---------------------------------- - -The following libraries are specific to the ESP8266. - -.. toctree:: - :maxdepth: 2 - - esp.rst diff --git a/docs/library/uio.rst b/docs/library/io.rst similarity index 97% rename from docs/library/uio.rst rename to docs/library/io.rst index d1f7c111fa516..37e3eb7c941f0 100644 --- a/docs/library/uio.rst +++ b/docs/library/io.rst @@ -1,9 +1,7 @@ -:mod:`uio` -- input/output streams +:mod:`io` -- input/output streams ================================== -.. include:: ../templates/unsupported_in_circuitpython.inc - -.. module:: uio +.. module:: io :synopsis: input/output streams |see_cpython_module| :mod:`cpython:io`. diff --git a/docs/library/ujson.rst b/docs/library/json.rst similarity index 87% rename from docs/library/ujson.rst rename to docs/library/json.rst index 4ed91f053a10f..21574e556b5ca 100644 --- a/docs/library/ujson.rst +++ b/docs/library/json.rst @@ -1,9 +1,7 @@ -:mod:`ujson` -- JSON encoding and decoding +:mod:`json` -- JSON encoding and decoding ========================================== -.. include:: ../templates/unsupported_in_circuitpython.inc - -.. module:: ujson +.. module:: json :synopsis: JSON encoding and decoding |see_cpython_module| :mod:`cpython:json`. diff --git a/docs/library/ure.rst b/docs/library/re.rst similarity index 94% rename from docs/library/ure.rst rename to docs/library/re.rst index 4af182b016879..bdcc9f52c1052 100644 --- a/docs/library/ure.rst +++ b/docs/library/re.rst @@ -1,9 +1,7 @@ -:mod:`ure` -- simple regular expressions +:mod:`re` -- simple regular expressions ======================================== -.. include:: ../templates/unsupported_in_circuitpython.inc - -.. module:: ure +.. module:: re :synopsis: regular expressions |see_cpython_module| :mod:`cpython:re`. @@ -77,7 +75,7 @@ Regex objects ------------- Compiled regular expression. Instances of this class are created using -`ure.compile()`. +`re.compile()`. .. method:: regex.match(string) regex.search(string) diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index f38c0b64a07bb..ca6ddd3ed7a2d 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -30,7 +30,7 @@ from concurrent.futures import ThreadPoolExecutor -SUPPORTED_PORTS = ['atmel-samd', 'esp32s2', 'litex', 'mimxrt10xx', 'nrf', 'stm'] +SUPPORTED_PORTS = ['atmel-samd', 'esp32s2', 'litex', 'mimxrt10xx', 'nrf', 'raspberrypi', 'stm'] def get_circuitpython_root_dir(): """ The path to the root './circuitpython' directory @@ -44,7 +44,7 @@ def get_shared_bindings(): """ Get a list of modules in shared-bindings based on folder names """ shared_bindings_dir = get_circuitpython_root_dir() / "shared-bindings" - return [item.name for item in shared_bindings_dir.iterdir()] + ["ulab"] + return [item.name for item in shared_bindings_dir.iterdir()] + ["binascii", "errno", "json", "re", "ulab"] def read_mpconfig(): diff --git a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h index 4b0c324faa0c2..fc189e6627b86 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +++ b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h @@ -44,4 +44,5 @@ #define IGNORE_PIN_PA24 1 #define IGNORE_PIN_PA25 1 -#define MICROPY_PY_URE 0 +// Can't fit. +#define CIRCUITPY_RE 0 diff --git a/ports/atmel-samd/mpconfigport.h b/ports/atmel-samd/mpconfigport.h index bce89e0b99290..d2a529485e6a4 100644 --- a/ports/atmel-samd/mpconfigport.h +++ b/ports/atmel-samd/mpconfigport.h @@ -45,11 +45,7 @@ #define MICROPY_PY_BUILTINS_COMPLEX (0) #define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0) #define MICROPY_PY_FUNCTION_ATTRS (0) -// MICROPY_PY_UJSON depends on MICROPY_PY_IO -#define MICROPY_PY_IO (0) #define MICROPY_PY_REVERSE_SPECIAL_METHODS (0) -#define MICROPY_PY_UBINASCII (0) -#define MICROPY_PY_UJSON (0) #define MICROPY_PY_COLLECTIONS_ORDEREDDICT (0) #define MICROPY_PY_UERRNO_LIST \ X(EPERM) \ @@ -84,9 +80,6 @@ #define SPI_FLASH_MAX_BAUDRATE 24000000 #define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (1) #define MICROPY_PY_FUNCTION_ATTRS (1) -// MICROPY_PY_UJSON depends on MICROPY_PY_IO -#define MICROPY_PY_IO (1) -#define MICROPY_PY_UJSON (1) // MICROPY_PY_UERRNO_LIST - Use the default #endif // SAM_D5X_E5X diff --git a/ports/atmel-samd/mpconfigport.mk b/ports/atmel-samd/mpconfigport.mk index 17e3995bf5c23..fb9cdf2e66c67 100644 --- a/ports/atmel-samd/mpconfigport.mk +++ b/ports/atmel-samd/mpconfigport.mk @@ -20,26 +20,16 @@ endif # Put samd21-only choices here. ifeq ($(CHIP_FAMILY),samd21) -# frequencyio not yet verified as working on SAMD21, though make it possible to override. -ifndef CIRCUITPY_AUDIOMIXER -CIRCUITPY_AUDIOMIXER = 0 -endif - -ifndef CIRCUITPY_AUDIOMP3 -CIRCUITPY_AUDIOMP3 = 0 -endif - -ifndef CIRCUITPY_BUILTINS_POW3 -CIRCUITPY_BUILTINS_POW3 = 0 -endif -ifndef CIRCUITPY_FREQUENCYIO -CIRCUITPY_FREQUENCYIO = 0 -endif +# The ?='s allow overriding in mpconfigboard.mk. -ifndef CIRCUITPY_TOUCHIO_USE_NATIVE -CIRCUITPY_TOUCHIO_USE_NATIVE = 1 -endif +CIRCUITPY_AUDIOMIXER ?= 0 +CIRCUITPY_BINASCII ?= 0 +CIRCUITPY_AUDIOMP3 ?= 0 +CIRCUITPY_BUILTINS_POW3 ?= 0 +CIRCUITPY_FREQUENCYIO ?= 0 +CIRCUITPY_JSON ?= 0 +CIRCUITPY_TOUCHIO_USE_NATIVE ?= 1 # No room for HCI _bleio on SAMD21. CIRCUITPY_BLEIO_HCI = 0 @@ -71,27 +61,13 @@ ifeq ($(CHIP_FAMILY),samd51) # No native touchio on SAMD51. CIRCUITPY_TOUCHIO_USE_NATIVE = 0 -# The ifndef's allow overriding in mpconfigboard.mk. - -ifndef CIRCUITPY_NETWORK -CIRCUITPY_NETWORK = 0 -endif - -ifndef CIRCUITPY_PS2IO -CIRCUITPY_PS2IO = 1 -endif - -ifndef CIRCUITPY_SAMD -CIRCUITPY_SAMD = 1 -endif - -ifndef CIRCUITPY_RGBMATRIX -CIRCUITPY_RGBMATRIX = $(CIRCUITPY_FULL_BUILD) -endif +# The ?='s allow overriding in mpconfigboard.mk. -ifndef CIRCUITPY_FRAMEBUFFERIO -CIRCUITPY_FRAMEBUFFERIO = $(CIRCUITPY_FULL_BUILD) -endif +CIRCUITPY_NETWORK ?= 0 +CIRCUITPY_PS2IO ?= 1 +CIRCUITPY_SAMD ?= 1 +CIRCUITPY_RGBMATRIX ?= $(CIRCUITPY_FULL_BUILD) +CIRCUITPY_FRAMEBUFFERIO ?= $(CIRCUITPY_FULL_BUILD) endif # samd51 diff --git a/ports/esp32s2/mpconfigport.h b/ports/esp32s2/mpconfigport.h index 9c0fd9da3e81e..0cf695bc9807c 100644 --- a/ports/esp32s2/mpconfigport.h +++ b/ports/esp32s2/mpconfigport.h @@ -30,7 +30,6 @@ #define MICROPY_NLR_THUMB (0) -#define MICROPY_PY_UJSON (1) #define MICROPY_USE_INTERNAL_PRINTF (0) #define MICROPY_PY_SYS_PLATFORM "Espressif ESP32-S2" diff --git a/ports/litex/mpconfigport.h b/ports/litex/mpconfigport.h index a7caf8526c449..5f739e49ead60 100644 --- a/ports/litex/mpconfigport.h +++ b/ports/litex/mpconfigport.h @@ -31,8 +31,6 @@ #define CIRCUITPY_INTERNAL_NVM_SIZE (0) #define MICROPY_NLR_THUMB (0) #define MICROPY_PY_REVERSE_SPECIAL_METHODS (1) -#define MICROPY_PY_UBINASCII (1) -#define MICROPY_PY_UJSON (1) #include "py/circuitpy_mpconfig.h" diff --git a/ports/mimxrt10xx/mpconfigport.h b/ports/mimxrt10xx/mpconfigport.h index 7496256d03674..51e0ef9ff515c 100644 --- a/ports/mimxrt10xx/mpconfigport.h +++ b/ports/mimxrt10xx/mpconfigport.h @@ -41,8 +41,6 @@ extern uint8_t _ld_default_stack_size; #define CIRCUITPY_DEFAULT_STACK_SIZE ((uint32_t) &_ld_default_stack_size) #define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0) #define MICROPY_PY_FUNCTION_ATTRS (0) -#define MICROPY_PY_IO (1) -#define MICROPY_PY_UJSON (1) #define MICROPY_PY_REVERSE_SPECIAL_METHODS (1) diff --git a/ports/nrf/mpconfigport.h b/ports/nrf/mpconfigport.h index 4ed42cd8297e4..3ac41a5e47958 100644 --- a/ports/nrf/mpconfigport.h +++ b/ports/nrf/mpconfigport.h @@ -35,11 +35,8 @@ #include "peripherals/nrf/nvm.h" // for FLASH_PAGE_SIZE #define MICROPY_PY_FUNCTION_ATTRS (1) -#define MICROPY_PY_IO (1) #define MICROPY_PY_REVERSE_SPECIAL_METHODS (1) #define MICROPY_PY_SYS_STDIO_BUFFER (1) -#define MICROPY_PY_UBINASCII (1) -#define MICROPY_PY_UJSON (1) // 24kiB stack #define CIRCUITPY_DEFAULT_STACK_SIZE (24*1024) diff --git a/ports/raspberrypi/mpconfigport.h b/ports/raspberrypi/mpconfigport.h index 3fdc8febbf0bb..75cbd1ba8507f 100644 --- a/ports/raspberrypi/mpconfigport.h +++ b/ports/raspberrypi/mpconfigport.h @@ -27,7 +27,9 @@ #ifndef __INCLUDED_MPCONFIGPORT_H #define __INCLUDED_MPCONFIGPORT_H -#define MICROPY_PY_UJSON (1) +#define CIRCUITPY_BINASCII (1) +#define CIRCUITPY_ERRNO (1) +#define CIRCUITPY_JSON (1) #define CIRCUITPY_INTERNAL_NVM_SIZE 0 diff --git a/ports/stm/mpconfigport.h b/ports/stm/mpconfigport.h index 9489b476579f1..7cdab04f62d8f 100644 --- a/ports/stm/mpconfigport.h +++ b/ports/stm/mpconfigport.h @@ -31,9 +31,7 @@ #include #define MICROPY_PY_FUNCTION_ATTRS (1) -#define MICROPY_PY_IO (1) #define MICROPY_PY_REVERSE_SPECIAL_METHODS (1) -#define MICROPY_PY_UJSON (1) extern uint8_t _ld_default_stack_size; diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 35f1227a9e63e..c193e61c49642 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -195,21 +195,14 @@ typedef long mp_off_t; #define MICROPY_PY_BUILTINS_STR_CENTER (CIRCUITPY_FULL_BUILD) #define MICROPY_PY_BUILTINS_STR_PARTITION (CIRCUITPY_FULL_BUILD) #define MICROPY_PY_BUILTINS_STR_SPLITLINES (CIRCUITPY_FULL_BUILD) -#define MICROPY_PY_UERRNO (CIRCUITPY_FULL_BUILD) #ifndef MICROPY_PY_COLLECTIONS_ORDEREDDICT #define MICROPY_PY_COLLECTIONS_ORDEREDDICT (CIRCUITPY_FULL_BUILD) #endif -#ifndef MICROPY_PY_UBINASCII -#define MICROPY_PY_UBINASCII (CIRCUITPY_FULL_BUILD) -#endif // Opposite setting is deliberate. -#define MICROPY_PY_UERRNO_ERRORCODE (!CIRCUITPY_FULL_BUILD) -#ifndef MICROPY_PY_URE -#define MICROPY_PY_URE (CIRCUITPY_FULL_BUILD) -#endif -#define MICROPY_PY_URE_MATCH_GROUPS (CIRCUITPY_FULL_BUILD) -#define MICROPY_PY_URE_MATCH_SPAN_START_END (CIRCUITPY_FULL_BUILD) -#define MICROPY_PY_URE_SUB (CIRCUITPY_FULL_BUILD) +#define MICROPY_PY_UERRNO_ERRORCODE (!CIRCUITPY_RE) +#define MICROPY_PY_URE_MATCH_GROUPS (CIRCUITPY_RE) +#define MICROPY_PY_URE_MATCH_SPAN_START_END (CIRCUITPY_RE) +#define MICROPY_PY_URE_SUB (CIRCUITPY_RE) // LONGINT_IMPL_xxx are defined in the Makefile. // @@ -301,6 +294,13 @@ extern const struct _mp_obj_module_t audiopwmio_module; #define AUDIOPWMIO_MODULE #endif +#if CIRCUITPY_BINASCII +#define MICROPY_PY_UBINASCII CIRCUITPY_BINASCII +#define BINASCII_MODULE { MP_ROM_QSTR(MP_QSTR_binascii), MP_ROM_PTR(&mp_module_ubinascii) }, +#else +#define BINASCII_MODULE +#endif + #if CIRCUITPY_BITBANGIO #define BITBANGIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_bitbangio), (mp_obj_t)&bitbangio_module }, extern const struct _mp_obj_module_t bitbangio_module; @@ -399,6 +399,13 @@ extern const struct _mp_obj_module_t terminalio_module; #define TERMINALIO_MODULE #endif +#if CIRCUITPY_ERRNO +#define MICROPY_PY_UERRNO (1) +#define ERRNO_MODULE { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_uerrno) }, +#else +#define ERRNO_MODULE +#endif + #if CIRCUITPY_ESPIDF extern const struct _mp_obj_module_t espidf_module; #define ESPIDF_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_espidf),(mp_obj_t)&espidf_module }, @@ -470,6 +477,18 @@ extern const struct _mp_obj_module_t ipaddress_module; #define IPADDRESS_MODULE #endif +#if CIRCUITPY_JSON +#define MICROPY_PY_UJSON (1) +#define MICROPY_PY_IO (1) +#define JSON_MODULE { MP_ROM_QSTR(MP_QSTR_json), MP_ROM_PTR(&mp_module_ujson) }, +#else +#ifndef MICROPY_PY_IO +// We don't need MICROPY_PY_IO unless someone else wants it. +#define MICROPY_PY_IO (0) +#endif +#define JSON_MODULE +#endif + #if CIRCUITPY_MATH extern const struct _mp_obj_module_t math_module; #define MATH_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_math), (mp_obj_t)&math_module }, @@ -588,6 +607,13 @@ extern const struct _mp_obj_module_t random_module; #define RANDOM_MODULE #endif +#if CIRCUITPY_RE +#define MICROPY_PY_URE (1) +#define RE_MODULE { MP_ROM_QSTR(MP_QSTR_re), MP_ROM_PTR(&mp_module_ure) }, +#else +#define RE_MODULE +#endif + #if CIRCUITPY_RGBMATRIX extern const struct _mp_obj_module_t rgbmatrix_module; #define RGBMATRIX_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_rgbmatrix),(mp_obj_t)&rgbmatrix_module }, @@ -730,25 +756,6 @@ extern const struct _mp_obj_module_t ustack_module; #define USTACK_MODULE #endif -// These modules are not yet in shared-bindings, but we prefer the non-uxxx names. -#if MICROPY_PY_UBINASCII -#define BINASCII_MODULE { MP_ROM_QSTR(MP_QSTR_binascii), MP_ROM_PTR(&mp_module_ubinascii) }, -#else -#define BINASCII_MODULE -#endif - -#if MICROPY_PY_UERRNO -#define ERRNO_MODULE { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_uerrno) }, -#else -#define ERRNO_MODULE -#endif - -#if MICROPY_PY_UJSON -#define JSON_MODULE { MP_ROM_QSTR(MP_QSTR_json), MP_ROM_PTR(&mp_module_ujson) }, -#else -#define JSON_MODULE -#endif - #if defined(CIRCUITPY_ULAB) && CIRCUITPY_ULAB // ulab requires reverse special methods #if defined(MICROPY_PY_REVERSE_SPECIAL_METHODS) && !MICROPY_PY_REVERSE_SPECIAL_METHODS @@ -760,12 +767,6 @@ extern const struct _mp_obj_module_t ustack_module; #define ULAB_MODULE #endif -#if MICROPY_PY_URE -#define RE_MODULE { MP_ROM_QSTR(MP_QSTR_re), MP_ROM_PTR(&mp_module_ure) }, -#else -#define RE_MODULE -#endif - // This is not a top-level module; it's microcontroller.watchdog. #if CIRCUITPY_WATCHDOG extern const struct _mp_obj_module_t watchdog_module; diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 9c9b17f4b750f..141ad05f8232e 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -86,6 +86,9 @@ endif endif CFLAGS += -DCIRCUITPY_AUDIOMP3=$(CIRCUITPY_AUDIOMP3) +CIRCUITPY_BINASCII ?= $(CIRCUITPY_FULL_BUILD) +CFLAGS += -DCIRCUITPY_BINASCII=$(CIRCUITPY_BINASCII) + CIRCUITPY_BITBANGIO ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_BITBANGIO=$(CIRCUITPY_BITBANGIO) @@ -124,6 +127,9 @@ CFLAGS += -DCIRCUITPY_COUNTIO=$(CIRCUITPY_COUNTIO) CIRCUITPY_DISPLAYIO ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_DISPLAYIO=$(CIRCUITPY_DISPLAYIO) +CIRCUITPY_ERRNO ?= $(CIRCUITPY_FULL_BUILD) +CFLAGS += -DCIRCUITPY_ERRNO=$(CIRCUITPY_ERRNO) + # CIRCUITPY_ESPIDF is handled in the esp32s2 tree. # Only for ESP32S chips. # Assume not a ESP build. @@ -158,6 +164,9 @@ CFLAGS += -DCIRCUITPY_I2CPERIPHERAL=$(CIRCUITPY_I2CPERIPHERAL) CIRCUITPY_IPADDRESS ?= $(CIRCUITPY_WIFI) CFLAGS += -DCIRCUITPY_IPADDRESS=$(CIRCUITPY_IPADDRESS) +CIRCUITPY_JSON ?= $(CIRCUITPY_FULL_BUILD) +CFLAGS += -DCIRCUITPY_JSON=$(CIRCUITPY_JSON) + CIRCUITPY_MATH ?= 1 CFLAGS += -DCIRCUITPY_MATH=$(CIRCUITPY_MATH) @@ -204,6 +213,9 @@ CFLAGS += -DCIRCUITPY_PWMIO=$(CIRCUITPY_PWMIO) CIRCUITPY_RANDOM ?= 1 CFLAGS += -DCIRCUITPY_RANDOM=$(CIRCUITPY_RANDOM) +CIRCUITPY_RE ?= $(CIRCUITPY_FULL_BUILD) +CFLAGS += -DCIRCUITPY_RE=$(CIRCUITPY_RE) + # CIRCUITPY_RP2PIO is handled in the raspberrypi tree. # Only for rp2 chips. # Assume not a rp2 build. diff --git a/shared-bindings/support_matrix.rst b/shared-bindings/support_matrix.rst index 1b75e02567dc7..a2fb7987d28d8 100644 --- a/shared-bindings/support_matrix.rst +++ b/shared-bindings/support_matrix.rst @@ -1,7 +1,7 @@ .. _module-support-matrix: -Support Matrix -=============== +Module Support Matrix - Which Modules Are Available on Which Boards +=================================================================== The following table lists the available built-in modules for each CircuitPython capable board. From 34d63debd5c339a37009b961b9b51defcdf540ae Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 25 Jan 2021 08:21:55 -0500 Subject: [PATCH 714/770] Remove obsolete esp.rst, network.rst --- docs/library/esp.rst | 85 ------------ docs/library/network.rst | 278 --------------------------------------- 2 files changed, 363 deletions(-) delete mode 100644 docs/library/esp.rst delete mode 100644 docs/library/network.rst diff --git a/docs/library/esp.rst b/docs/library/esp.rst deleted file mode 100644 index 125aaa890f975..0000000000000 --- a/docs/library/esp.rst +++ /dev/null @@ -1,85 +0,0 @@ -:mod:`esp` --- functions related to the ESP8266 -=============================================== - -.. include:: ../templates/unsupported_in_circuitpython.inc - -.. module:: esp - :synopsis: functions related to the ESP8266 - -The ``esp`` module contains specific functions related to the ESP8266 module. - - -Functions ---------- - -.. function:: sleep_type([sleep_type]) - - Get or set the sleep type. - - If the *sleep_type* parameter is provided, sets the sleep type to its - value. If the function is called without parameters, returns the current - sleep type. - - The possible sleep types are defined as constants: - - * ``SLEEP_NONE`` -- all functions enabled, - * ``SLEEP_MODEM`` -- modem sleep, shuts down the WiFi Modem circuit. - * ``SLEEP_LIGHT`` -- light sleep, shuts down the WiFi Modem circuit - and suspends the processor periodically. - - The system enters the set sleep mode automatically when possible. - -.. function:: deepsleep(time=0) - - Enter deep sleep. - - The whole module powers down, except for the RTC clock circuit, which can - be used to restart the module after the specified time if the pin 16 is - connected to the reset pin. Otherwise the module will sleep until manually - reset. - -.. function:: flash_id() - - Read the device ID of the flash memory. - -.. function:: flash_read(byte_offset, length_or_buffer) - -.. function:: flash_write(byte_offset, bytes) - -.. function:: flash_erase(sector_no) - -.. function:: set_native_code_location(start, length) - - Set the location that native code will be placed for execution after it is - compiled. Native code is emitted when the ``@micropython.native``, - ``@micropython.viper`` and ``@micropython.asm_xtensa`` decorators are applied - to a function. The ESP8266 must execute code from either iRAM or the lower - 1MByte of flash (which is memory mapped), and this function controls the - location. - - If *start* and *length* are both ``None`` then the native code location is - set to the unused portion of memory at the end of the iRAM1 region. The - size of this unused portion depends on the firmware and is typically quite - small (around 500 bytes), and is enough to store a few very small - functions. The advantage of using this iRAM1 region is that it does not - get worn out by writing to it. - - If neither *start* nor *length* are ``None`` then they should be integers. - *start* should specify the byte offset from the beginning of the flash at - which native code should be stored. *length* specifies how many bytes of - flash from *start* can be used to store native code. *start* and *length* - should be multiples of the sector size (being 4096 bytes). The flash will - be automatically erased before writing to it so be sure to use a region of - flash that is not otherwise used, for example by the firmware or the - filesystem. - - When using the flash to store native code *start+length* must be less - than or equal to 1MByte. Note that the flash can be worn out if repeated - erasures (and writes) are made so use this feature sparingly. - In particular, native code needs to be recompiled and rewritten to flash - on each boot (including wake from deepsleep). - - In both cases above, using iRAM1 or flash, if there is no more room left - in the specified region then the use of a native decorator on a function - will lead to `MemoryError` exception being raised during compilation of - that function. diff --git a/docs/library/network.rst b/docs/library/network.rst deleted file mode 100644 index 3bd41150d5ec2..0000000000000 --- a/docs/library/network.rst +++ /dev/null @@ -1,278 +0,0 @@ -**************************************** -:mod:`network` --- network configuration -**************************************** - -.. include:: ../templates/unsupported_in_circuitpython.inc - -.. module:: network - :noindex: - :synopsis: network configuration - -This module provides network drivers and routing configuration. To use this -module, a MicroPython variant/build with network capabilities must be installed. -Network drivers for specific hardware are available within this module and are -used to configure hardware network interface(s). Network services provided -by configured interfaces are then available for use via the :mod:`usocket` -module. - -For example:: - - # connect/ show IP config a specific network interface - # see below for examples of specific drivers - import network - import utime - nic = network.Driver(...) - if not nic.isconnected(): - nic.connect() - print("Waiting for connection...") - while not nic.isconnected(): - utime.sleep(1) - print(nic.ifconfig()) - - # now use usocket as usual - import usocket as socket - addr = socket.getaddrinfo('micropython.org', 80)[0][-1] - s = socket.socket() - s.connect(addr) - s.send(b'GET / HTTP/1.1\r\nHost: micropython.org\r\n\r\n') - data = s.recv(1000) - s.close() - -Common network adapter interface -================================ - -This section describes an (implied) abstract base class for all network -interface classes implemented by ``MicroPython ports `` -for different hardware. This means that MicroPython does not actually -provide ``AbstractNIC`` class, but any actual NIC class, as described -in the following sections, implements methods as described here. - -.. class:: AbstractNIC(id=None, ...) - -Instantiate a network interface object. Parameters are network interface -dependent. If there are more than one interface of the same type, the first -parameter should be `id`. - - .. method:: active([is_active]) - - Activate ("up") or deactivate ("down") the network interface, if - a boolean argument is passed. Otherwise, query current state if - no argument is provided. Most other methods require an active - interface (behavior of calling them on inactive interface is - undefined). - - .. method:: connect([service_id, key=None, \*, ...]) - - Connect the interface to a network. This method is optional, and - available only for interfaces which are not "always connected". - If no parameters are given, connect to the default (or the only) - service. If a single parameter is given, it is the primary identifier - of a service to connect to. It may be accompanied by a key - (password) required to access said service. There can be further - arbitrary keyword-only parameters, depending on the networking medium - type and/or particular device. Parameters can be used to: a) - specify alternative service identifier types; b) provide additional - connection parameters. For various medium types, there are different - sets of predefined/recommended parameters, among them: - - * WiFi: *bssid* keyword to connect to a specific BSSID (MAC address) - - .. method:: disconnect() - - Disconnect from network. - - .. method:: isconnected() - - Returns ``True`` if connected to network, otherwise returns ``False``. - - .. method:: scan(\*, ...) - - Scan for the available network services/connections. Returns a - list of tuples with discovered service parameters. For various - network media, there are different variants of predefined/ - recommended tuple formats, among them: - - * WiFi: (ssid, bssid, channel, RSSI, authmode, hidden). There - may be further fields, specific to a particular device. - - The function may accept additional keyword arguments to filter scan - results (e.g. scan for a particular service, on a particular channel, - for services of a particular set, etc.), and to affect scan - duration and other parameters. Where possible, parameter names - should match those in connect(). - - .. method:: status() - - Return detailed status of the interface, values are dependent - on the network medium/technology. - - .. method:: ifconfig([(ip, subnet, gateway, dns)]) - - Get/set IP-level network interface parameters: IP address, subnet mask, - gateway and DNS server. When called with no arguments, this method returns - a 4-tuple with the above information. To set the above values, pass a - 4-tuple with the required information. For example:: - - nic.ifconfig(('192.168.0.4', '255.255.255.0', '192.168.0.1', '8.8.8.8')) - - .. method:: config('param') - config(param=value, ...) - - Get or set general network interface parameters. These methods allow to work - with additional parameters beyond standard IP configuration (as dealt with by - `ifconfig()`). These include network-specific and hardware-specific - parameters and status values. For setting parameters, the keyword argument - syntax should be used, and multiple parameters can be set at once. For - querying, a parameter name should be quoted as a string, and only one - parameter can be queried at a time:: - - # Set WiFi access point name (formally known as ESSID) and WiFi channel - ap.config(essid='My AP', channel=11) - # Query params one by one - print(ap.config('essid')) - print(ap.config('channel')) - # Extended status information also available this way - print(sta.config('rssi')) - -.. _network.WLAN: - -Functions -========= - -.. function:: phy_mode([mode]) - - Get or set the PHY mode. - - If the *mode* parameter is provided, sets the mode to its value. If - the function is called without parameters, returns the current mode. - - The possible modes are defined as constants: - * ``MODE_11B`` -- IEEE 802.11b, - * ``MODE_11G`` -- IEEE 802.11g, - * ``MODE_11N`` -- IEEE 802.11n. - -class WLAN -========== - -This class provides a driver for WiFi network processor in the ESP8266. Example usage:: - - import network - # enable station interface and connect to WiFi access point - nic = network.WLAN(network.STA_IF) - nic.active(True) - nic.connect('your-ssid', 'your-password') - # now use sockets as usual - -Constructors ------------- -.. class:: WLAN(interface_id) - -Create a WLAN network interface object. Supported interfaces are -``network.STA_IF`` (station aka client, connects to upstream WiFi access -points) and ``network.AP_IF`` (access point, allows other WiFi clients to -connect). Availability of the methods below depends on interface type. -For example, only STA interface may `connect()` to an access point. - -Methods -------- - -.. method:: wlan.active([is_active]) - - Activate ("up") or deactivate ("down") network interface, if boolean - argument is passed. Otherwise, query current state if no argument is - provided. Most other methods require active interface. - -.. method:: wlan.connect(ssid=None, password=None, \*, bssid=None) - - Connect to the specified wireless network, using the specified password. - If *bssid* is given then the connection will be restricted to the - access-point with that MAC address (the *ssid* must also be specified - in this case). - -.. method:: wlan.disconnect() - - Disconnect from the currently connected wireless network. - -.. method:: wlan.scan() - - Scan for the available wireless networks. - - Scanning is only possible on STA interface. Returns list of tuples with - the information about WiFi access points: - - (ssid, bssid, channel, RSSI, authmode, hidden) - - *bssid* is hardware address of an access point, in binary form, returned as - bytes object. You can use `binascii.hexlify()` to convert it to ASCII form. - - There are five values for authmode: - - * 0 -- open - * 1 -- WEP - * 2 -- WPA-PSK - * 3 -- WPA2-PSK - * 4 -- WPA/WPA2-PSK - - and two for hidden: - - * 0 -- visible - * 1 -- hidden - -.. method:: wlan.status() - - Return the current status of the wireless connection. - - The possible statuses are defined as constants: - - * ``STAT_IDLE`` -- no connection and no activity, - * ``STAT_CONNECTING`` -- connecting in progress, - * ``STAT_WRONG_PASSWORD`` -- failed due to incorrect password, - * ``STAT_NO_AP_FOUND`` -- failed because no access point replied, - * ``STAT_CONNECT_FAIL`` -- failed due to other problems, - * ``STAT_GOT_IP`` -- connection successful. - -.. method:: wlan.isconnected() - - In case of STA mode, returns ``True`` if connected to a WiFi access - point and has a valid IP address. In AP mode returns ``True`` when a - station is connected. Returns ``False`` otherwise. - -.. method:: wlan.ifconfig([(ip, subnet, gateway, dns)]) - - Get/set IP-level network interface parameters: IP address, subnet mask, - gateway and DNS server. When called with no arguments, this method returns - a 4-tuple with the above information. To set the above values, pass a - 4-tuple with the required information. For example:: - - nic.ifconfig(('192.168.0.4', '255.255.255.0', '192.168.0.1', '8.8.8.8')) - -.. method:: wlan.config('param') - wlan.config(param=value, ...) - - Get or set general network interface parameters. These methods allow to work - with additional parameters beyond standard IP configuration (as dealt with by - `wlan.ifconfig()`). These include network-specific and hardware-specific - parameters. For setting parameters, keyword argument syntax should be used, - multiple parameters can be set at once. For querying, parameters name should - be quoted as a string, and only one parameter can be queries at time:: - - # Set WiFi access point name (formally known as ESSID) and WiFi channel - ap.config(essid='My AP', channel=11) - # Query params one by one - print(ap.config('essid')) - print(ap.config('channel')) - - Following are commonly supported parameters (availability of a specific parameter - depends on network technology type, driver, and ``MicroPython port``). - - ============= =========== - Parameter Description - ============= =========== - mac MAC address (bytes) - essid WiFi access point name (string) - channel WiFi channel (integer) - hidden Whether ESSID is hidden (boolean) - authmode Authentication mode supported (enumeration, see module constants) - password Access password (string) - dhcp_hostname The DHCP hostname to use - ============= =========== From 1e97d384ff469731832147f7dc07aa1f358cd572 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 25 Jan 2021 11:02:32 -0500 Subject: [PATCH 715/770] add GP15 --- ports/raspberrypi/boards/raspberry_pi_pico/pins.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/raspberrypi/boards/raspberry_pi_pico/pins.c b/ports/raspberrypi/boards/raspberry_pi_pico/pins.c index 38ec75c4ade21..913676ad265f6 100644 --- a/ports/raspberrypi/boards/raspberry_pi_pico/pins.c +++ b/ports/raspberrypi/boards/raspberry_pi_pico/pins.c @@ -16,6 +16,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, From 69c71bd52238bda5c021a825849ce28229a33e0f Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 25 Jan 2021 11:54:10 -0500 Subject: [PATCH 716/770] fix some build errors --- .../circuitplayground_express_displayio/mpconfigboard.h | 3 --- .../circuitplayground_express_displayio/mpconfigboard.mk | 1 + ports/raspberrypi/mpconfigport.h | 4 ---- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h index fc189e6627b86..1586a328906ac 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +++ b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h @@ -43,6 +43,3 @@ // USB is always used internally so skip the pin objects for it. #define IGNORE_PIN_PA24 1 #define IGNORE_PIN_PA25 1 - -// Can't fit. -#define CIRCUITPY_RE 0 diff --git a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk index 51e9b05af207a..d3ce35f6d90f6 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk @@ -18,6 +18,7 @@ CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_MSGPACK = 0 CIRCUITPY_PIXELBUF = 0 +CIRCUITPY_RE = 0 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_RTC = 0 # So not all of displayio, sorry! diff --git a/ports/raspberrypi/mpconfigport.h b/ports/raspberrypi/mpconfigport.h index 75cbd1ba8507f..7431519317d02 100644 --- a/ports/raspberrypi/mpconfigport.h +++ b/ports/raspberrypi/mpconfigport.h @@ -27,10 +27,6 @@ #ifndef __INCLUDED_MPCONFIGPORT_H #define __INCLUDED_MPCONFIGPORT_H -#define CIRCUITPY_BINASCII (1) -#define CIRCUITPY_ERRNO (1) -#define CIRCUITPY_JSON (1) - #define CIRCUITPY_INTERNAL_NVM_SIZE 0 #define CIRCUITPY_DEFAULT_STACK_SIZE (24*1024) From c5992a3101bc7f4d94ac52934b8ca63148f193eb Mon Sep 17 00:00:00 2001 From: Kamil Tomaszewski Date: Mon, 25 Jan 2021 17:59:40 +0100 Subject: [PATCH 717/770] spresense: update Spresense SDK to 2.0.2 --- ports/cxd56/README.md | 2 +- ports/cxd56/configs/circuitpython/defconfig | 1 + ports/cxd56/spresense-exported-sdk | 2 +- ports/cxd56/supervisor/internal_flash.c | 16 ++++++++-------- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ports/cxd56/README.md b/ports/cxd56/README.md index 7fa439aacb82f..c399b8a4d715c 100644 --- a/ports/cxd56/README.md +++ b/ports/cxd56/README.md @@ -75,7 +75,7 @@ Bootloader information: * You have to accept the End User License Agreement to be able to download and use the Spresense bootloader binary. -Download the spresense binaries zip archive from: [Spresense firmware v2-0-000](https://developer.sony.com/file/download/download-spresense-firmware-v2-0-000) +Download the spresense binaries zip archive from: [Spresense firmware v2-0-002](https://developer.sony.com/file/download/download-spresense-firmware-v2-0-002) Extract spresense binaries in your PC to ports/spresense/spresense-exported-sdk/firmware/ diff --git a/ports/cxd56/configs/circuitpython/defconfig b/ports/cxd56/configs/circuitpython/defconfig index a97f821dfafee..096b53b800863 100644 --- a/ports/cxd56/configs/circuitpython/defconfig +++ b/ports/cxd56/configs/circuitpython/defconfig @@ -165,6 +165,7 @@ CONFIG_USBDEV=y CONFIG_USBDEV_DMA=y CONFIG_USBDEV_DUALSPEED=y CONFIG_USEC_PER_TICK=1000 +CONFIG_USERMAIN_STACKSIZE=8192 CONFIG_USER_ENTRYPOINT="spresense_main" CONFIG_VIDEO_ISX012=y CONFIG_VIDEO_STREAM=y diff --git a/ports/cxd56/spresense-exported-sdk b/ports/cxd56/spresense-exported-sdk index 752c4cd56dd0a..2ec2a15383626 160000 --- a/ports/cxd56/spresense-exported-sdk +++ b/ports/cxd56/spresense-exported-sdk @@ -1 +1 @@ -Subproject commit 752c4cd56dd0a270a559c28272ceb61ddcb7806c +Subproject commit 2ec2a1538362696118dc3fdf56f33dacaf8f4067 diff --git a/ports/cxd56/supervisor/internal_flash.c b/ports/cxd56/supervisor/internal_flash.c index 2726fa4a23080..9c103fb19e0d2 100644 --- a/ports/cxd56/supervisor/internal_flash.c +++ b/ports/cxd56/supervisor/internal_flash.c @@ -30,10 +30,10 @@ /* Prototypes for Remote API */ -int FM_RawWrite(uint32_t offset, const void *buf, uint32_t size); -int FM_RawVerifyWrite(uint32_t offset, const void *buf, uint32_t size); -int FM_RawRead(uint32_t offset, void *buf, uint32_t size); -int FM_RawEraseSector(uint32_t sector); +int fw_fm_rawwrite(uint32_t offset, const void *buf, uint32_t size); +int fw_fm_rawverifywrite(uint32_t offset, const void *buf, uint32_t size); +int fw_fm_rawread(uint32_t offset, void *buf, uint32_t size); +int fw_fm_rawerasesector(uint32_t sector); #define CXD56_SPIFLASHSIZE (16 * 1024 * 1024) @@ -64,8 +64,8 @@ void port_internal_flash_flush(void) { return; } - FM_RawEraseSector(flash_sector); - FM_RawWrite(flash_sector << SECTOR_SHIFT, flash_cache, SECTOR_SIZE); + fw_fm_rawerasesector(flash_sector); + fw_fm_rawwrite(flash_sector << SECTOR_SHIFT, flash_cache, SECTOR_SIZE); flash_sector = NO_SECTOR; } @@ -73,7 +73,7 @@ void port_internal_flash_flush(void) { mp_uint_t supervisor_flash_read_blocks(uint8_t *dest, uint32_t block, uint32_t num_blocks) { supervisor_flash_flush(); - if (FM_RawRead(block << PAGE_SHIFT, dest, num_blocks << PAGE_SHIFT) < 0) { + if (fw_fm_rawread(block << PAGE_SHIFT, dest, num_blocks << PAGE_SHIFT) < 0) { return 1; } @@ -92,7 +92,7 @@ mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t lba, uint32 if (sector != flash_sector) { supervisor_flash_flush(); - if (FM_RawRead(sector << SECTOR_SHIFT, flash_cache, SECTOR_SIZE) < 0) { + if (fw_fm_rawread(sector << SECTOR_SHIFT, flash_cache, SECTOR_SIZE) < 0) { return 1; } From 30a1c52e757622969dedf03c988c59a35b4a1302 Mon Sep 17 00:00:00 2001 From: Kamil Tomaszewski Date: Mon, 25 Jan 2021 18:05:48 +0100 Subject: [PATCH 718/770] Update TinyUSB --- lib/tinyusb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tinyusb b/lib/tinyusb index 388abe9d9cc0a..045674745afa5 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit 388abe9d9cc0a7c360fd902e01461a53bb7b3f42 +Subproject commit 045674745afa59028fbeed6dac5cb5a9c4a6033e From d6c04e85d01b38eb8bd0371bf6ca997c39c2ae8c Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Sun, 24 Jan 2021 19:18:22 +0000 Subject: [PATCH 719/770] Translated using Weblate (Swedish) Currently translated at 100.0% (923 of 923 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 0fe05421beed4..c3b55d5a03e57 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-01-17 12:55+0000\n" +"PO-Revision-Date: 2021-01-25 19:32+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -52,7 +52,7 @@ msgstr " Fil \"%q\", rad %d" #: py/builtinhelp.c msgid " is of type %q\n" -msgstr "" +msgstr " är av typen %q\n" #: main.c msgid " output:\n" @@ -872,7 +872,7 @@ msgstr "Fel i regex" #: shared-bindings/socketpool/Socket.c msgid "Error: Failure to bind" -msgstr "" +msgstr "Fel: Bind misslyckades" #: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c @@ -1268,7 +1268,7 @@ msgstr "Ogiltig storlek" #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Invalid socket for TLS" -msgstr "" +msgstr "Ogiltig socket för TLS" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" @@ -1276,7 +1276,7 @@ msgstr "Ogiltigt tillstånd" #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Invalid use of TLS Socket" -msgstr "" +msgstr "Ogiltig användning av TLS Socket" #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" @@ -1296,7 +1296,7 @@ msgstr "Ogiltig word-/bitlängd" #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Issue setting SO_REUSEADDR" -msgstr "" +msgstr "Misslyckades att sätta SO_REUSEADDR" #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" @@ -3375,7 +3375,7 @@ msgstr "antal punkter måste vara minst 2" #: py/builtinhelp.c msgid "object " -msgstr "" +msgstr "objekt " #: py/obj.c msgid "object '%q' is not a tuple or list" @@ -3996,7 +3996,7 @@ msgstr "width måste vara större än noll" #: ports/esp32s2/common-hal/wifi/Radio.c msgid "wifi is not enabled" -msgstr "" +msgstr "wifi är inte aktiverat" #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" From 2a55ff73b15242cc165d303552a5c21392a9a072 Mon Sep 17 00:00:00 2001 From: hexthat Date: Sat, 23 Jan 2021 20:58:17 +0000 Subject: [PATCH 720/770] Translated using Weblate (Chinese (Pinyin)) Currently translated at 100.0% (923 of 923 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/ --- locale/zh_Latn_pinyin.po | 104 +++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 1d869a0f20fcd..c2ff0404492c2 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-01-21 22:25+0000\n" +"PO-Revision-Date: 2021-01-25 19:32+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" "Language: zh_Latn_pinyin\n" @@ -53,7 +53,7 @@ msgstr " Wénjiàn \"%q\", dì %d xíng" #: py/builtinhelp.c msgid " is of type %q\n" -msgstr "" +msgstr " shì %q lèi xíng\n" #: main.c msgid " output:\n" @@ -871,7 +871,7 @@ msgstr "Zhèngzé biǎodá shì cuòwù" #: shared-bindings/socketpool/Socket.c msgid "Error: Failure to bind" -msgstr "" +msgstr "cuò wù: bǎng dìng shī bài" #: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c @@ -1267,7 +1267,7 @@ msgstr "dà xiǎo wú xiào" #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Invalid socket for TLS" -msgstr "" +msgstr "TLS de chā zuò wú xiào" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" @@ -1275,7 +1275,7 @@ msgstr "wú xiào zhuàng tài" #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Invalid use of TLS Socket" -msgstr "" +msgstr "TLS tào jiē zì de wú xiào shǐ yòng" #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" @@ -1295,7 +1295,7 @@ msgstr "Wúxiào de zì/wèi chángdù" #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Issue setting SO_REUSEADDR" -msgstr "" +msgstr "wèn tí shè zhì SO_REUSEADDR" #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" @@ -2356,7 +2356,7 @@ msgstr "huǎnchōng qū bìxū shì zì jié lèi duìxiàng" #: extmod/ulab/code/ulab_create.c msgid "buffer size must be a multiple of element size" -msgstr "" +msgstr "huǎn chōng qū dà xiǎo bì xū shì yuán sù dà xiǎo de bèi shù" #: shared-module/struct/__init__.c msgid "buffer size must match format" @@ -2525,7 +2525,7 @@ msgstr "wúfǎ cóng shǒudòng zìduàn guīgé qiēhuàn dào zìdòng zìduà #: extmod/ulab/code/ndarray_operators.c msgid "cannot cast output with casting rule" -msgstr "" +msgstr "wú fǎ shǐ yòng qiáng zhì zhuǎn huàn guī zé qiáng zhì zhuǎn huàn shū chū" #: py/objtype.c msgid "cannot create '%q' instances" @@ -2565,7 +2565,7 @@ msgstr "quānzi zhǐ néng zài yī wèi jiāzhǎng zhōng zhùcè" #: shared-bindings/msgpack/ExtType.c msgid "code outside range 0~127" -msgstr "" +msgstr "dài mǎ chāo chū fàn wéi 0~127" #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" @@ -2632,7 +2632,7 @@ msgstr "wúfǎ quèdìng SD kǎ bǎnběn" #: extmod/ulab/code/numerical/numerical.c msgid "cross is defined for 1D arrays of length 3" -msgstr "" +msgstr "duì yú cháng dù wéi 3 de 1D shù zǔ dìng yì cross" #: extmod/ulab/code/approx/approx.c msgid "data must be iterable" @@ -2644,7 +2644,7 @@ msgstr "shùjù chángdù bìxū xiāngděng" #: extmod/ulab/code/ndarray.c msgid "data type not understood" -msgstr "" +msgstr "wèi lǐ jiě de shù jù lèi xíng" #: py/parsenum.c msgid "decimal numbers not supported" @@ -2656,7 +2656,7 @@ msgstr "mòrèn 'except' bìxū shì zuìhòu yīgè" #: shared-bindings/msgpack/__init__.c msgid "default is not a function" -msgstr "" +msgstr "mò rèn zhí bú shì hán shù" #: shared-bindings/audiobusio/PDMIn.c msgid "" @@ -2683,7 +2683,7 @@ msgstr "bùtóng de cānshù bìxū shì ndarray" #: extmod/ulab/code/numerical/numerical.c msgid "differentiation order out of range" -msgstr "" +msgstr "chā yì shùn xù fàn wéi" #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c @@ -2716,7 +2716,7 @@ msgstr "jiéwěi_x yīnggāi shì yīgè zhěngshù" #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" -msgstr "" +msgstr "epoch_time bǎn bù zhī chí cǐ bǎn běn" #: ports/nrf/common-hal/busio/UART.c #, c-format @@ -2761,7 +2761,7 @@ msgstr "qídài guānjiàn: Zìdiǎn de jiàzhí" #: shared-bindings/msgpack/__init__.c msgid "ext_hook is not a function" -msgstr "" +msgstr "ext_hook bú shì hán shù" #: py/argcheck.c msgid "extra keyword arguments given" @@ -2810,7 +2810,7 @@ msgstr "dì yīgè cānshù bìxū shì yī gè hánshù" #: extmod/ulab/code/ulab_create.c msgid "first argument must be a tuple of ndarrays" -msgstr "" +msgstr "dì yī gè cān shù bì xū shì yí gè yuán zǔ ndarrays" #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" @@ -2867,7 +2867,7 @@ msgstr "hánshù zài jiàngé mòwěi jùyǒu xiāngtóng de fúhào" #: extmod/ulab/code/ndarray.c msgid "function is defined for ndarrays only" -msgstr "" +msgstr "hán shù jǐn wéi ndarrays dìng yì" #: py/argcheck.c #, c-format @@ -2963,11 +2963,11 @@ msgstr "nèi lián jíhé bìxū shì yīgè hánshù" #: extmod/ulab/code/ndarray.c msgid "input and output shapes are not compatible" -msgstr "" +msgstr "shū rù hé shū chū xíng zhuàng bù jiān róng" #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer, a tuple, or a list" -msgstr "" +msgstr "shū rù cān shù bì xū shì zhěng shù, yuán zǔ huò liè biǎo" #: extmod/ulab/code/fft/fft.c msgid "input array length must be power of 2" @@ -2975,7 +2975,7 @@ msgstr "shūrù shùzǔ de chángdù bìxū shì 2 de mì" #: extmod/ulab/code/ulab_create.c msgid "input arrays are not compatible" -msgstr "" +msgstr "shū rù shù zǔ bù jiān róng" #: extmod/ulab/code/poly/poly.c msgid "input data must be an iterable" @@ -2991,19 +2991,19 @@ msgstr "shūrù jǔzhèn shì qíyì de" #: extmod/ulab/code/user/user.c msgid "input must be a dense ndarray" -msgstr "" +msgstr "shū rù bì xū shì mì jí de ndarray" #: extmod/ulab/code/ulab_create.c msgid "input must be a tensor of rank 2" -msgstr "" +msgstr "shū rù bì xū shì děng jí 2 de zhāng liàng" #: extmod/ulab/code/ulab_create.c extmod/ulab/code/user/user.c msgid "input must be an ndarray" -msgstr "" +msgstr "shū rù bì xū shì ndarray" #: extmod/ulab/code/filter/filter.c msgid "input must be one-dimensional" -msgstr "" +msgstr "shū rù bì xū shì yì wéi de" #: extmod/ulab/code/linalg/linalg.c msgid "input must be square matrix" @@ -3019,7 +3019,7 @@ msgstr "shūrù xiàngliàng de chángdù bìxū xiāngděng" #: extmod/ulab/code/poly/poly.c msgid "inputs are not iterable" -msgstr "" +msgstr "shū rù bù kě yí dòng" #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" @@ -3093,7 +3093,7 @@ msgstr "wúxiào de hàomǎ yǔfǎ" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "io must be rtc io" -msgstr "" +msgstr "IO bì xū shì RTC IO" #: py/objtype.c msgid "issubclass() arg 1 must be a class" @@ -3192,11 +3192,11 @@ msgstr "Dāng gùdìng chángdù wèi %s shí, zuìdà chángdù bìxū wèi 0-% #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c msgid "max_length must be >= 0" -msgstr "" +msgstr "zuì dà cháng dù bì xū >= 0" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" -msgstr "" +msgstr "zuì dà chǐ cùn shù wéi 4" #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3212,7 +3212,7 @@ msgstr "maxiter yìng wéi > 0" #: extmod/ulab/code/numerical/numerical.c msgid "median argument must be an ndarray" -msgstr "" +msgstr "zhōng wèi shù cān shù bì xū shì ndarray" #: py/runtime.c #, c-format @@ -3298,7 +3298,7 @@ msgstr "zhǎo bù dào fēi běndì de bǎng dìng" #: shared-module/msgpack/__init__.c msgid "no default packer" -msgstr "" +msgstr "wú mò rèn bāo zhuāng jī" #: py/builtinimport.c msgid "no module named '%q'" @@ -3339,15 +3339,15 @@ msgstr "guānjiàn zì cānshù zhīhòu de fēi guānjiàn zì cānshù" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" -msgstr "" +msgstr "fēi líng chāo shí bì xū > 0.01" #: shared-bindings/_bleio/Adapter.c msgid "non-zero timeout must be >= interval" -msgstr "" +msgstr "fēi líng chāo shí bì xū wéi >= jiàn gé" #: extmod/ulab/code/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" -msgstr "" +msgstr "wéi 1D hé 2D shù zǔ dìng yì guī fàn" #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" @@ -3367,7 +3367,7 @@ msgstr "diǎnshù bìxū zhìshǎo wèi 2" #: py/builtinhelp.c msgid "object " -msgstr "" +msgstr "duì xiàng " #: py/obj.c msgid "object '%q' is not a tuple or list" @@ -3419,15 +3419,15 @@ msgstr "jīshù zìfú chuàn" #: extmod/ulab/code/ulab_create.c msgid "offset is too large" -msgstr "" +msgstr "piān yí tài dà" #: shared-bindings/dualbank/__init__.c msgid "offset must be >= 0" -msgstr "" +msgstr "piān yí liàng bì xū >= 0" #: extmod/ulab/code/ulab_create.c msgid "offset must be non-negative and no greater than buffer length" -msgstr "" +msgstr "piān yí liàng bì xū wéi fēi fù shù qiě bù dà yú huǎn chōng qū cháng dù" #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" @@ -3453,7 +3453,7 @@ msgstr "cāozuò shǔ bùnéng yīqǐ guǎngbò" #: extmod/ulab/code/ndarray.c msgid "operation is implemented for 1D Boolean arrays only" -msgstr "" +msgstr "jǐn duì 1D bù ěr shù zǔ shí xiàn cāo zuò" #: extmod/ulab/code/numerical/numerical.c msgid "operation is not implemented on ndarrays" @@ -3593,7 +3593,7 @@ msgstr "qǐngqiú chángdù %d dàn duìxiàng chángdù %d" #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" -msgstr "" +msgstr "wú fǎ jiāng jié guǒ qiáng zhì zhuǎn huàn dào zhǐ dìng lèi xíng" #: py/compile.c msgid "return annotation must be an identifier" @@ -3615,7 +3615,7 @@ msgstr "rgb_pins[%d] yǔ shízhōng bùzài tóng yīgè duānkǒu shàng" #: extmod/ulab/code/numerical/numerical.c msgid "roll argument must be an ndarray" -msgstr "" +msgstr "gǔn dòng cān shù bì xū shì ndarray" #: py/objstr.c msgid "rsplit(None,n)" @@ -3643,11 +3643,11 @@ msgstr "bù zhīchí jiǎoběn biānyì" #: extmod/ulab/code/ndarray.c msgid "shape must be a tuple" -msgstr "" +msgstr "xíng zhuàng bì xū shì yí gè yuán zǔ" #: shared-module/msgpack/__init__.c msgid "short read" -msgstr "" +msgstr "duǎn dú" #: py/objstr.c msgid "sign not allowed in string format specifier" @@ -3780,7 +3780,7 @@ msgstr "Chāo shí shíjiān bìxū wèi 0.0 Dào 100.0 Miǎo" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "timeout must be < 655.35 secs" -msgstr "" +msgstr "chāo shí bì xū < 655.35 miǎo" #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" @@ -3800,7 +3800,7 @@ msgstr "time_t shíjiān chuō chāochū píngtái fànwéi" #: extmod/ulab/code/ndarray.c msgid "tobytes can be invoked for dense arrays only" -msgstr "" +msgstr "tobytes zhǐ néng duì mì jí shù zǔ diào yòng" #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" @@ -3808,7 +3808,7 @@ msgstr "tígōng jǐ dìng géshì de cānshù tài duō" #: extmod/ulab/code/ulab_create.c msgid "too many dimensions" -msgstr "" +msgstr "chǐ cùn tài duō" #: extmod/ulab/code/ndarray.c msgid "too many indices" @@ -3821,7 +3821,7 @@ msgstr "dǎkāi tài duō zhí (yùqí %d)" #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays" -msgstr "" +msgstr "wéi 1D shù zǔ dìng yì xiàn jǐng" #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays of equal length" @@ -3829,7 +3829,7 @@ msgstr "Trapz shì wèi děng zhǎng de 1D shùzǔ dìngyì de" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "trigger level must be 0 or 1" -msgstr "" +msgstr "chù fā jí bié bì xū wéi 0 huò 1" #: py/obj.c msgid "tuple/list has wrong length" @@ -3971,7 +3971,7 @@ msgstr "xiàngliàng bìxū jùyǒu xiāngtóng de chángdù" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "wakeup conflict" -msgstr "" +msgstr "huàn xǐng chōng tū" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" @@ -3987,7 +3987,7 @@ msgstr "kuāndù bìxū dàyú líng" #: ports/esp32s2/common-hal/wifi/Radio.c msgid "wifi is not enabled" -msgstr "" +msgstr "wèi qǐ yòng WIFI" #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" @@ -3995,11 +3995,11 @@ msgstr "Chuāngkǒu bìxū shì <= jiàngé" #: extmod/ulab/code/numerical/numerical.c msgid "wrong axis index" -msgstr "" +msgstr "cuò wù de zhóu suǒ yǐn" #: extmod/ulab/code/ulab_create.c msgid "wrong axis specified" -msgstr "" +msgstr "zhǐ dìng de zhóu cuò wù" #: extmod/ulab/code/vector/vectorise.c msgid "wrong input type" @@ -4027,7 +4027,7 @@ msgstr "x zhí chāochū biānjiè" #: ports/esp32s2/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" -msgstr "" +msgstr "xTaskCreate shī bài" #: shared-bindings/displayio/Shape.c msgid "y should be an int" From 0fa5aa359df3827a90be6c4e82719bb2ed8713e7 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 25 Jan 2021 16:07:01 -0500 Subject: [PATCH 721/770] Stop treating pin 15 specially. --- ports/raspberrypi/common-hal/microcontroller/Pin.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/ports/raspberrypi/common-hal/microcontroller/Pin.c b/ports/raspberrypi/common-hal/microcontroller/Pin.c index 90c3274067874..6e531560e27d2 100644 --- a/ports/raspberrypi/common-hal/microcontroller/Pin.c +++ b/ports/raspberrypi/common-hal/microcontroller/Pin.c @@ -63,12 +63,7 @@ void never_reset_pin_number(uint8_t pin_number) { } void reset_pin_number(uint8_t pin_number) { - if (pin_number >= 32 -#if TUD_OPT_RP2040_USB_DEVICE_ENUMERATION_FIX - // Pin 15 is used for Errata so we don't mess with it. - || pin_number == 15 -#endif - ) { + if (pin_number >= 32) { return; } @@ -142,12 +137,7 @@ bool pin_number_is_free(uint8_t pin_number) { if (pin_number >= 30) { return false; } -#if TUD_OPT_RP2040_USB_DEVICE_ENUMERATION_FIX - // Pin 15 is used for Errata so we don't mess with it. - if (pin_number == 15) { - return true; - } -#endif + uint32_t pad_state = padsbank0_hw->io[pin_number]; return (pad_state & PADS_BANK0_GPIO0_IE_BITS) == 0 && (pad_state & PADS_BANK0_GPIO0_OD_BITS) != 0; From 41400124301a4099bbe1f72fedc7cbd233602b7b Mon Sep 17 00:00:00 2001 From: Kevin Matocha Date: Mon, 25 Jan 2021 16:25:56 -0600 Subject: [PATCH 722/770] Allow pins >= 32, allow write pin on different register than data pins --- locale/circuitpython.pot | 6 +- .../common-hal/displayio/ParallelBus.c | 106 ++++++++++-------- .../common-hal/displayio/ParallelBus.h | 10 +- 3 files changed, 69 insertions(+), 53 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 4dfce747d7055..f5c3da62cbd26 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -798,7 +798,7 @@ msgid "Data 0 pin must be byte aligned" msgstr "" #: ports/esp32s2/common-hal/displayio/ParallelBus.c -msgid "Data 0 pin must be byte aligned and < 32" +msgid "Data 0 pin must be byte aligned." msgstr "" #: shared-module/audiocore/WaveFile.c @@ -2140,10 +2140,6 @@ msgstr "" msgid "Woken up by alarm.\n" msgstr "" -#: ports/esp32s2/common-hal/displayio/ParallelBus.c -msgid "Write pin must be < 32" -msgstr "" - #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" msgstr "" diff --git a/ports/esp32s2/common-hal/displayio/ParallelBus.c b/ports/esp32s2/common-hal/displayio/ParallelBus.c index b644610f21236..273a3a7ad06de 100644 --- a/ports/esp32s2/common-hal/displayio/ParallelBus.c +++ b/ports/esp32s2/common-hal/displayio/ParallelBus.c @@ -36,9 +36,7 @@ /* * * Current pin limitations for ESP32-S2 ParallelBus: - * 1. data0 pin must be byte aligned (data0 pin options: 0, 8, 16 or 24) - * 2. The 8 data lines must use pin numbers < 32 - * 3. The write pin must be pin number < 32. + * - data0 pin must be byte aligned (data0 pin options: 0, 8, 16 or 24) * */ @@ -48,7 +46,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* sel uint8_t data_pin = data0->number; if ( (data_pin % 8 != 0) && (data_pin >= 32) ) { - mp_raise_ValueError(translate("Data 0 pin must be byte aligned and < 32")); + mp_raise_ValueError(translate("Data 0 pin must be byte aligned.")); } for (uint8_t i = 0; i < 8; i++) { @@ -57,10 +55,6 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* sel } } - if (write->number >= 32) { - mp_raise_ValueError(translate("Write pin must be < 32")); - } - gpio_dev_t *g = &GPIO; // this is the GPIO registers, see "extern gpio_dev_t GPIO" from file:gpio_struct.h // Setup the pins as "Simple GPIO outputs" see section 19.3.3 of the ESP32-S2 Reference Manual @@ -74,11 +68,14 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* sel /* From my understanding, there is a limitation of the ESP32-S2 that does not allow single-byte writes * into the GPIO registers. See section 10.3.3 regarding "non-aligned writes" into the registers. - * If a method for writing single-byte writes is uncovered, this code can be modified to provide - * single-byte access into the output register */ - self->bus = (uint32_t*) &g->out; //pointer to GPIO output register (for pins 0-31) + + if (data_pin < 31) { + self->bus = (uint32_t*) &g->out; //pointer to GPIO output register (for pins 0-31) + } else { + self->bus = (uint32_t*) &g->out1.val; //pointer to GPIO output register (for pins >= 32) + } /* SNIP - common setup of command, chip select, write and read pins, same as from SAMD and NRF ports */ self->command.base.type = &digitalio_digitalinout_type; @@ -98,17 +95,38 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* sel common_hal_digitalio_digitalinout_switch_to_output(&self->read, true, DRIVE_MODE_PUSH_PULL); self->data0_pin = data_pin; - self->write_group = &GPIO; - /* If we want to allow a write pin >= 32, should consider putting separate "clear_write" and - * "set_write" pointers into the .h in place of "write_group" - * to select between out_w1tc/out1_w1tc (clear) and out_w1ts/out1_w1ts (set) registers. - */ + + if (write->number < 32) { + self->write_clear_register = (uint32_t*) &g->out_w1tc; + self->write_set_register = (uint32_t*) &g->out_w1ts; + } else { + self->write_clear_register = (uint32_t*) &g->out1_w1tc.val; + self->write_set_register = (uint32_t*) &g->out1_w1ts.val; + } + + // Check to see if the data and write pins are on the same register: + if ( ( ((self->data0_pin < 32) && (write->number < 32)) ) || + ( ((self->data0_pin > 31) && (write->number > 31)) ) ) { + self->data_write_same_register = true; // data pins and write pin are on the same register + } else { + self->data_write_same_register = false; // data pins and write pins are on different registers + } + + + mp_printf(&mp_plat_print, "write_clear: %x, write_set: %x\n", self->write_clear_register, self->write_set_register); self->write_mask = 1 << (write->number % 32); /* the write pin triggers the LCD to latch the data */ - /* Note: As currently written for the ESP32-S2 port, the write pin must be a pin number less than 32 - * This could be updated to accommodate 32 and higher by using the different construction of the - * address for writing to output pins >= 32, see related note above for 'self->write_group' - */ + mp_printf(&mp_plat_print, "write_mask: %x\n", self->write_mask); + + mp_printf(&mp_plat_print, "out1 register: %x\n", g->out1.val); + mp_printf(&mp_plat_print, "clear a bit\n"); + *self->write_clear_register = self->write_mask; + mp_printf(&mp_plat_print, "out1 register: %x\n", g->out1.val); + mp_printf(&mp_plat_print, "write a bit\n"); + *self->write_set_register = self->write_mask; + mp_printf(&mp_plat_print, "out1 register: %x\n", g->out1.val); + + *self->write_clear_register = self->write_mask; /* SNIP - common setup of the reset pin, same as from SAMD and NRF ports */ self->reset.base.type = &mp_type_NoneType; @@ -174,13 +192,8 @@ void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byt displayio_parallelbus_obj_t* self = MP_OBJ_TO_PTR(obj); common_hal_digitalio_digitalinout_set_value(&self->command, byte_type == DISPLAY_DATA); - /* Currently the write pin number must be < 32. - * Future: To accommodate write pin numbers >= 32, will need to update to choose the correct register - * for the write pin set/clear (out_w1ts/out1_w1ts and out_w1tc/out1_w1tc) - */ - - uint32_t* clear_write = (uint32_t*) &self->write_group->out_w1tc; - uint32_t* set_write = (uint32_t*) &self->write_group->out_w1ts; + uint32_t* clear_write = self->write_clear_register; + uint32_t* set_write = self->write_set_register; const uint32_t mask = self->write_mask; @@ -197,24 +210,29 @@ void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byt * each data byte will be written to the data pin registers */ - for (uint32_t i = 0; i < data_length; i++) { - /* Question: Is there a faster way of stuffing the data byte into the data_buffer, is bit arithmetic - * faster than writing to the byte address? - */ - - /* Note: If the write pin and data pins are controlled by the same GPIO register, we can eliminate - * the "clear_write" step below, since the write pin is cleared when the data_buffer is written - * to the bus. - * Remember: This method requires the write pin to be controlled by the same GPIO register as the data pins. - */ - - // *clear_write = mask; // clear the write pin (See comment above, this may not be necessary). - - *(data_address) = data[i]; // stuff the data byte into the data_buffer at the correct offset byte location - *self->bus = data_buffer; // write the data to the output register - *set_write = mask; // set the write pin - } + if ( self->data_write_same_register ) { // data and write pins are on the same register + for (uint32_t i = 0; i < data_length; i++) { + + /* Note: If the write pin and data pins are controlled by the same GPIO register, we can eliminate + * the "clear_write" step below, since the write pin is cleared when the data_buffer is written + * to the bus. + */ + + *(data_address) = data[i]; // stuff the data byte into the data_buffer at the correct offset byte location + *self->bus = data_buffer; // write the data to the output register + *set_write = mask; // set the write pin + } + } + else { // data and write pins are on different registers + for (uint32_t i = 0; i < data_length; i++) { + *clear_write = mask; // clear the write pin (See comment above, this may not be necessary). + *(data_address) = data[i]; // stuff the data byte into the data_buffer at the correct offset byte location + *self->bus = data_buffer; // write the data to the output register + *set_write = mask; // set the write pin + + } + } } diff --git a/ports/esp32s2/common-hal/displayio/ParallelBus.h b/ports/esp32s2/common-hal/displayio/ParallelBus.h index 20fc2f1bc7823..84302118bda43 100644 --- a/ports/esp32s2/common-hal/displayio/ParallelBus.h +++ b/ports/esp32s2/common-hal/displayio/ParallelBus.h @@ -35,11 +35,13 @@ typedef struct { digitalio_digitalinout_obj_t command; digitalio_digitalinout_obj_t chip_select; digitalio_digitalinout_obj_t reset; - digitalio_digitalinout_obj_t write; // write pin, must be a pin number < 32 currently + digitalio_digitalinout_obj_t write; digitalio_digitalinout_obj_t read; - uint8_t data0_pin; // pin number for the lowest number pin. Must be 0, 8, 16 or 24 with current - gpio_dev_t* write_group; // pointer to the write group for setting/clearing the write bit to latch the data on the LCD - uint32_t write_mask; // bit mask for the single bit for the write pin, currently write pin must be a pin number < 32 + uint8_t data0_pin; // pin number for the lowest number data pin. Must be 8-bit aligned + bool data_write_same_register; // if data and write pins are in the sare + uint32_t* write_set_register; // pointer to the write group for setting the write bit to latch the data on the LCD + uint32_t* write_clear_register; // pointer to the write group for clearing the write bit to latch the data on the LCD + uint32_t write_mask; // bit mask for the single bit for the write pin register } displayio_parallelbus_obj_t; #endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_DISPLAYIO_PARALLELBUS_H From 61850acd143d9f8732d0ce48dc51eac9fb7e4c4c Mon Sep 17 00:00:00 2001 From: Kevin Matocha Date: Mon, 25 Jan 2021 16:51:12 -0600 Subject: [PATCH 723/770] Fixed bug in pin error handling, deleted debug prints --- .../common-hal/displayio/ParallelBus.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/ports/esp32s2/common-hal/displayio/ParallelBus.c b/ports/esp32s2/common-hal/displayio/ParallelBus.c index 273a3a7ad06de..f77b37b57cf67 100644 --- a/ports/esp32s2/common-hal/displayio/ParallelBus.c +++ b/ports/esp32s2/common-hal/displayio/ParallelBus.c @@ -34,10 +34,8 @@ #include "shared-bindings/microcontroller/__init__.h" /* - * * Current pin limitations for ESP32-S2 ParallelBus: - * - data0 pin must be byte aligned (data0 pin options: 0, 8, 16 or 24) - * + * - data0 pin must be byte aligned */ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* self, @@ -45,7 +43,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* sel const mcu_pin_obj_t* write, const mcu_pin_obj_t* read, const mcu_pin_obj_t* reset) { uint8_t data_pin = data0->number; - if ( (data_pin % 8 != 0) && (data_pin >= 32) ) { + if (data_pin % 8 != 0) { mp_raise_ValueError(translate("Data 0 pin must be byte aligned.")); } @@ -113,20 +111,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* sel } - mp_printf(&mp_plat_print, "write_clear: %x, write_set: %x\n", self->write_clear_register, self->write_set_register); - self->write_mask = 1 << (write->number % 32); /* the write pin triggers the LCD to latch the data */ - mp_printf(&mp_plat_print, "write_mask: %x\n", self->write_mask); - - mp_printf(&mp_plat_print, "out1 register: %x\n", g->out1.val); - mp_printf(&mp_plat_print, "clear a bit\n"); - *self->write_clear_register = self->write_mask; - mp_printf(&mp_plat_print, "out1 register: %x\n", g->out1.val); - mp_printf(&mp_plat_print, "write a bit\n"); - *self->write_set_register = self->write_mask; - mp_printf(&mp_plat_print, "out1 register: %x\n", g->out1.val); - - *self->write_clear_register = self->write_mask; /* SNIP - common setup of the reset pin, same as from SAMD and NRF ports */ self->reset.base.type = &mp_type_NoneType; From be4cfdd3d6d08796757a4582061e819e3f903ce4 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 25 Jan 2021 17:23:57 -0500 Subject: [PATCH 724/770] Use TOTAL_GPIO_COUNT instead of magic number 30 --- ports/raspberrypi/common-hal/microcontroller/Pin.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ports/raspberrypi/common-hal/microcontroller/Pin.c b/ports/raspberrypi/common-hal/microcontroller/Pin.c index 6e531560e27d2..ca5cf5a045aaa 100644 --- a/ports/raspberrypi/common-hal/microcontroller/Pin.c +++ b/ports/raspberrypi/common-hal/microcontroller/Pin.c @@ -26,6 +26,7 @@ #include "py/runtime.h" +#include "common-hal/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Pin.h" #include "supervisor/shared/rgb_led_status.h" @@ -46,7 +47,7 @@ bool speaker_enable_in_use; STATIC uint32_t never_reset_pins; void reset_all_pins(void) { - for (size_t i = 0; i < 30; i++) { + for (size_t i = 0; i < TOTAL_GPIO_COUNT; i++) { if ((never_reset_pins & (1 << i)) != 0) { continue; } @@ -55,7 +56,7 @@ void reset_all_pins(void) { } void never_reset_pin_number(uint8_t pin_number) { - if (pin_number >= 32) { + if (pin_number >= TOTAL_GPIO_COUNT) { return; } @@ -63,7 +64,7 @@ void never_reset_pin_number(uint8_t pin_number) { } void reset_pin_number(uint8_t pin_number) { - if (pin_number >= 32) { + if (pin_number >= TOTAL_GPIO_COUNT) { return; } @@ -134,7 +135,7 @@ void claim_pin(const mcu_pin_obj_t* pin) { } bool pin_number_is_free(uint8_t pin_number) { - if (pin_number >= 30) { + if (pin_number >= TOTAL_GPIO_COUNT) { return false; } From a9f339b4619a55cf5748124180e43afca32d8fb7 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 25 Jan 2021 22:40:31 -0500 Subject: [PATCH 725/770] typo in circuitpy_mpconfig.h; forgot cxd56 port --- docs/shared_bindings_matrix.py | 2 +- py/circuitpy_mpconfig.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index ca6ddd3ed7a2d..e62b1d2186ae6 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -30,7 +30,7 @@ from concurrent.futures import ThreadPoolExecutor -SUPPORTED_PORTS = ['atmel-samd', 'esp32s2', 'litex', 'mimxrt10xx', 'nrf', 'raspberrypi', 'stm'] +SUPPORTED_PORTS = ['atmel-samd', 'cxd56', 'esp32s2', 'litex', 'mimxrt10xx', 'nrf', 'raspberrypi', 'stm'] def get_circuitpython_root_dir(): """ The path to the root './circuitpython' directory diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index c193e61c49642..7c776839186bd 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -199,7 +199,7 @@ typedef long mp_off_t; #define MICROPY_PY_COLLECTIONS_ORDEREDDICT (CIRCUITPY_FULL_BUILD) #endif // Opposite setting is deliberate. -#define MICROPY_PY_UERRNO_ERRORCODE (!CIRCUITPY_RE) +#define MICROPY_PY_UERRNO_ERRORCODE (!CIRCUITPY_FULL_BUILD) #define MICROPY_PY_URE_MATCH_GROUPS (CIRCUITPY_RE) #define MICROPY_PY_URE_MATCH_SPAN_START_END (CIRCUITPY_RE) #define MICROPY_PY_URE_SUB (CIRCUITPY_RE) From 5b4249e365f620f7732ff2079fe345eda5074cbf Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 25 Jan 2021 23:06:47 -0500 Subject: [PATCH 726/770] fix doc typos --- docs/library/index.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/library/index.rst b/docs/library/index.rst index 94bd8a65698d1..181ff0109a8a4 100644 --- a/docs/library/index.rst +++ b/docs/library/index.rst @@ -6,7 +6,7 @@ MicroPython libraries Python standard libraries and micro-libraries --------------------------------------------- -These libraries are inherited from MicroPython. +The libraries below are inherited from MicroPython. They are similar to the standard Python libraries with the same name. They implement a subset of or a variant of the corresponding standard Python library. @@ -20,7 +20,7 @@ limited flash memory, usually on non-Express builds: These libraries are not currently enabled in any CircuitPython build, but may be in the future, with the ``u`` prefix dropped: -``uctypes`, ``uhashlib``, ``uio``, ``uzlib``. +``uctypes``, ``uhashlib``, ``uzlib``. .. toctree:: :maxdepth: 1 From 0ba49d7303ef40abc73d281d1cfe867a6db3a748 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 25 Jan 2021 23:20:37 -0500 Subject: [PATCH 727/770] typo; thanks @Neradoc --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 19992d284bcae..f14cf41ff3dcd 100644 --- a/README.rst +++ b/README.rst @@ -125,7 +125,7 @@ Behavior get back into normal mode. - RGB status LED indicating CircuitPython state, and errors through a sequence of colored flashes. - Re-runs ``code.py`` or other main file after file system writes over USB mass storage. (Disable with - ``samd.disable_autoreload()``) + ``supervisor.disable_autoreload()``) - Entering the REPL after the main code is finished requires a key press which enters the REPL and disables autoreload. - Main is one of these: ``code.txt``, ``code.py``, ``main.py``, From da6869dbd5366c0f3d186b32a2b058585b0c5192 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 26 Jan 2021 08:37:05 -0500 Subject: [PATCH 728/770] Set MICROPY_PY_UERRNO_ERRORCODE correctly --- py/circuitpy_mpconfig.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 7c776839186bd..ee23c715698e5 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -198,8 +198,6 @@ typedef long mp_off_t; #ifndef MICROPY_PY_COLLECTIONS_ORDEREDDICT #define MICROPY_PY_COLLECTIONS_ORDEREDDICT (CIRCUITPY_FULL_BUILD) #endif -// Opposite setting is deliberate. -#define MICROPY_PY_UERRNO_ERRORCODE (!CIRCUITPY_FULL_BUILD) #define MICROPY_PY_URE_MATCH_GROUPS (CIRCUITPY_RE) #define MICROPY_PY_URE_MATCH_SPAN_START_END (CIRCUITPY_RE) #define MICROPY_PY_URE_SUB (CIRCUITPY_RE) @@ -401,9 +399,12 @@ extern const struct _mp_obj_module_t terminalio_module; #if CIRCUITPY_ERRNO #define MICROPY_PY_UERRNO (1) +// Uses about 80 bytes. +#define MICROPY_PY_UERRNO_ERRORCODE (1) #define ERRNO_MODULE { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_uerrno) }, #else #define ERRNO_MODULE +# #endif #if CIRCUITPY_ESPIDF From 51f054440516d21bd2e8d07a3e6f1f8e3acfbd55 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 26 Jan 2021 09:19:44 -0600 Subject: [PATCH 729/770] protmatter: Update to version that supports tiling --- lib/protomatter | 2 +- shared-bindings/rgbmatrix/RGBMatrix.c | 27 ++++++++++++++++++--------- shared-bindings/rgbmatrix/RGBMatrix.h | 2 +- shared-module/rgbmatrix/RGBMatrix.c | 5 +++-- shared-module/rgbmatrix/RGBMatrix.h | 1 + 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/lib/protomatter b/lib/protomatter index 902c16f49197a..5e925cea7a552 160000 --- a/lib/protomatter +++ b/lib/protomatter @@ -1 +1 @@ -Subproject commit 902c16f49197a8baf5e71ec924a812a86e733a74 +Subproject commit 5e925cea7a55273e375a6129761cb29b4e750d4f diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index 5f5ea4fae7943..ad693066cd018 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -24,6 +24,8 @@ * THE SOFTWARE. */ +#include + #include "py/obj.h" #include "py/objproperty.h" #include "py/runtime.h" @@ -132,11 +134,11 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_ } } -//| def __init__(self, *, width: int, bit_depth: int, rgb_pins: Sequence[digitalio.DigitalInOut], addr_pins: Sequence[digitalio.DigitalInOut], clock_pin: digitalio.DigitalInOut, latch_pin: digitalio.DigitalInOut, output_enable_pin: digitalio.DigitalInOut, doublebuffer: bool = True, framebuffer: Optional[WriteableBuffer] = None, height: int = 0) -> None: +//| def __init__(self, *, width: int, bit_depth: int, rgb_pins: Sequence[digitalio.DigitalInOut], addr_pins: Sequence[digitalio.DigitalInOut], clock_pin: digitalio.DigitalInOut, latch_pin: digitalio.DigitalInOut, output_enable_pin: digitalio.DigitalInOut, doublebuffer: bool = True, framebuffer: Optional[WriteableBuffer] = None, height: int = 0, tile: int = 1, serpentine: bool = False) -> None: //| """Create a RGBMatrix object with the given attributes. The height of -//| the display is determined by the number of rgb and address pins: -//| len(rgb_pins) // 3 * 2 ** len(address_pins). With 6 RGB pins and 4 -//| address lines, the display will be 32 pixels tall. If the optional height +//| the display is determined by the number of rgb and address pins and the number of tiles: +//| ``len(rgb_pins) // 3 * 2 ** len(address_pins) * abs(tile)``. With 6 RGB pins, 4 +//| address lines, and a single matrix, the display will be 32 pixels tall. If the optional height //| parameter is specified and is not 0, it is checked against the calculated //| height. //| @@ -172,7 +174,7 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_width, ARG_bit_depth, ARG_rgb_list, ARG_addr_list, - ARG_clock_pin, ARG_latch_pin, ARG_output_enable_pin, ARG_doublebuffer, ARG_framebuffer, ARG_height }; + ARG_clock_pin, ARG_latch_pin, ARG_output_enable_pin, ARG_doublebuffer, ARG_framebuffer, ARG_height, ARG_tile, ARG_serpentine }; static const mp_arg_t allowed_args[] = { { MP_QSTR_width, MP_ARG_INT | MP_ARG_REQUIRED | MP_ARG_KW_ONLY }, { MP_QSTR_bit_depth, MP_ARG_INT | MP_ARG_REQUIRED | MP_ARG_KW_ONLY }, @@ -184,6 +186,8 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n { MP_QSTR_doublebuffer, MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = true } }, { MP_QSTR_framebuffer, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = mp_const_none } }, { MP_QSTR_height, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 0 } }, + { MP_QSTR_tile, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 1 } }, + { MP_QSTR_serpentine, MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = false } }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); @@ -210,15 +214,20 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n mp_raise_ValueError_varg(translate("Must use a multiple of 6 rgb pins, not %d"), rgb_count); } - // TODO(@jepler) Use fewer than all rows of pixels if height < computed_height + int tile = args[ARG_tile].u_int; + if (args[ARG_height].u_int != 0) { - int computed_height = (rgb_count / 3) << (addr_count); + int computed_height = (rgb_count / 3) << (addr_count) * abs(tile); if (computed_height != args[ARG_height].u_int) { mp_raise_ValueError_varg( - translate("%d address pins and %d rgb pins indicate a height of %d, not %d"), addr_count, rgb_count, computed_height, args[ARG_height].u_int); + translate("%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d"), addr_count, rgb_count, tile, computed_height, args[ARG_height].u_int); } } + if (args[ARG_serpentine].u_bool) { + tile = -tile; + } + if (args[ARG_width].u_int <= 0) { mp_raise_ValueError(translate("width must be greater than zero")); } @@ -239,7 +248,7 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n addr_count, addr_pins, clock_pin, latch_pin, output_enable_pin, args[ARG_doublebuffer].u_bool, - framebuffer, NULL); + framebuffer, tile, NULL); claim_and_never_reset_pins(args[ARG_rgb_list].u_obj); claim_and_never_reset_pins(args[ARG_addr_list].u_obj); diff --git a/shared-bindings/rgbmatrix/RGBMatrix.h b/shared-bindings/rgbmatrix/RGBMatrix.h index bfe37c3404937..3e8a4db5f370e 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.h +++ b/shared-bindings/rgbmatrix/RGBMatrix.h @@ -31,7 +31,7 @@ extern const mp_obj_type_t rgbmatrix_RGBMatrix_type; -void common_hal_rgbmatrix_rgbmatrix_construct(rgbmatrix_rgbmatrix_obj_t* self, int width, int bit_depth, uint8_t rgb_count, uint8_t* rgb_pins, uint8_t addr_count, uint8_t* addr_pins, uint8_t clock_pin, uint8_t latch_pin, uint8_t oe_pin, bool doublebuffer, mp_obj_t framebuffer, void* timer); +void common_hal_rgbmatrix_rgbmatrix_construct(rgbmatrix_rgbmatrix_obj_t* self, int width, int bit_depth, uint8_t rgb_count, uint8_t* rgb_pins, uint8_t addr_count, uint8_t* addr_pins, uint8_t clock_pin, uint8_t latch_pin, uint8_t oe_pin, bool doublebuffer, mp_obj_t framebuffer, int8_t tile, void* timer); void common_hal_rgbmatrix_rgbmatrix_deinit(rgbmatrix_rgbmatrix_obj_t*); void rgbmatrix_rgbmatrix_collect_ptrs(rgbmatrix_rgbmatrix_obj_t*); void common_hal_rgbmatrix_rgbmatrix_reconstruct(rgbmatrix_rgbmatrix_obj_t* self, mp_obj_t framebuffer); diff --git a/shared-module/rgbmatrix/RGBMatrix.c b/shared-module/rgbmatrix/RGBMatrix.c index a09767b62267e..95a7eda75dfd1 100644 --- a/shared-module/rgbmatrix/RGBMatrix.c +++ b/shared-module/rgbmatrix/RGBMatrix.c @@ -42,7 +42,7 @@ extern Protomatter_core *_PM_protoPtr; -void common_hal_rgbmatrix_rgbmatrix_construct(rgbmatrix_rgbmatrix_obj_t *self, int width, int bit_depth, uint8_t rgb_count, uint8_t *rgb_pins, uint8_t addr_count, uint8_t *addr_pins, uint8_t clock_pin, uint8_t latch_pin, uint8_t oe_pin, bool doublebuffer, mp_obj_t framebuffer, void *timer) { +void common_hal_rgbmatrix_rgbmatrix_construct(rgbmatrix_rgbmatrix_obj_t *self, int width, int bit_depth, uint8_t rgb_count, uint8_t *rgb_pins, uint8_t addr_count, uint8_t *addr_pins, uint8_t clock_pin, uint8_t latch_pin, uint8_t oe_pin, bool doublebuffer, mp_obj_t framebuffer, int8_t tile, void *timer) { self->width = width; self->bit_depth = bit_depth; self->rgb_count = rgb_count; @@ -53,6 +53,7 @@ void common_hal_rgbmatrix_rgbmatrix_construct(rgbmatrix_rgbmatrix_obj_t *self, i self->oe_pin = oe_pin; self->latch_pin = latch_pin; self->doublebuffer = doublebuffer; + self->tile = tile; self->timer = timer ? timer : common_hal_rgbmatrix_timer_allocate(); if (self->timer == NULL) { @@ -95,7 +96,7 @@ void common_hal_rgbmatrix_rgbmatrix_reconstruct(rgbmatrix_rgbmatrix_obj_t* self, self->rgb_count/6, self->rgb_pins, self->addr_count, self->addr_pins, self->clock_pin, self->latch_pin, self->oe_pin, - self->doublebuffer, self->timer); + self->doublebuffer, self->tile, self->timer); if (stat == PROTOMATTER_OK) { _PM_protoPtr = &self->protomatter; diff --git a/shared-module/rgbmatrix/RGBMatrix.h b/shared-module/rgbmatrix/RGBMatrix.h index 6dbc6fd41e30e..7fce73c8b1bb3 100644 --- a/shared-module/rgbmatrix/RGBMatrix.h +++ b/shared-module/rgbmatrix/RGBMatrix.h @@ -44,4 +44,5 @@ typedef struct { bool core_is_initialized; bool paused; bool doublebuffer; + int8_t tile; } rgbmatrix_rgbmatrix_obj_t; From f154ee855d2e307f3ff24f25f138faa6e5210ad6 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 26 Jan 2021 10:23:37 -0500 Subject: [PATCH 730/770] shrink simmel --- ports/nrf/boards/simmel/mpconfigboard.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ports/nrf/boards/simmel/mpconfigboard.mk b/ports/nrf/boards/simmel/mpconfigboard.mk index 4eb6c98c7e921..032caac408c59 100644 --- a/ports/nrf/boards/simmel/mpconfigboard.mk +++ b/ports/nrf/boards/simmel/mpconfigboard.mk @@ -13,11 +13,13 @@ INTERNAL_FLASH_FILESYSTEM = 1 CIRCUITPY_AESIO = 1 CIRCUITPY_AUDIOMP3 = 0 +CIRCUITPY_BUSDEVICE = 0 CIRCUITPY_BUSIO = 1 CIRCUITPY_DISPLAYIO = 0 +CIRCUITPY_ERRNO = 0 CIRCUITPY_FRAMEBUFFERIO = 0 -CIRCUITPY_MSGPACK = 0 CIRCUITPY_GAMEPAD = 0 +CIRCUITPY_MSGPACK = 0 CIRCUITPY_NEOPIXEL_WRITE = 0 CIRCUITPY_NVM = 0 CIRCUITPY_PIXELBUF = 0 @@ -28,7 +30,6 @@ CIRCUITPY_SDCARDIO = 0 CIRCUITPY_TOUCHIO = 0 CIRCUITPY_ULAB = 0 CIRCUITPY_WATCHDOG = 1 -CIRCUITPY_BUSDEVICE = 0 # Enable micropython.native #CIRCUITPY_ENABLE_MPY_NATIVE = 1 From ccdc97d23e93ed827a66491ea2908fcab889d3e4 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 26 Jan 2021 09:47:21 -0600 Subject: [PATCH 731/770] Update documentation for microprossors with multiple cpus --- shared-bindings/microcontroller/Processor.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/shared-bindings/microcontroller/Processor.c b/shared-bindings/microcontroller/Processor.c index 90cc02fe39073..573f53282194f 100644 --- a/shared-bindings/microcontroller/Processor.c +++ b/shared-bindings/microcontroller/Processor.c @@ -41,7 +41,14 @@ //| //| import microcontroller //| print(microcontroller.cpu.frequency) -//| print(microcontroller.cpu.temperature)""" +//| print(microcontroller.cpu.temperature) +//| +//| Note that on chips with more than one cpu (such as the RP2040) +//| you will need to index the cpu to select which one to get the +//| readings from. i.e. +//| +//| print(microcontroller.cpu[0].temperature) +//| print(microcontroller.cpu[1].frequency)""" //| //| def __init__(self) -> None: From 365fafb32bc2e395b1d50e75c1a7160ee31eefcd Mon Sep 17 00:00:00 2001 From: "Ryan A. Pavlik" Date: Tue, 26 Jan 2021 10:36:40 -0600 Subject: [PATCH 732/770] Update design_guide.rst Add CO2 as a member name, and clarify the description of eCO2. --- docs/design_guide.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/design_guide.rst b/docs/design_guide.rst index 75825893a99d9..7a8c76b50775c 100644 --- a/docs/design_guide.rst +++ b/docs/design_guide.rst @@ -520,7 +520,9 @@ properties. +-----------------------+-----------------------+-------------------------------------------------------------------------+ | ``temperature`` | float | degrees centigrade | +-----------------------+-----------------------+-------------------------------------------------------------------------+ -| ``eCO2`` | float | equivalent CO2 in ppm | +| ``CO2`` | float | measured CO2 in ppm | ++-----------------------+-----------------------+-------------------------------------------------------------------------+ +| ``eCO2`` | float | equivalent/estimated CO2 in ppm (estimated from some other measurement) | +-----------------------+-----------------------+-------------------------------------------------------------------------+ | ``TVOC`` | float | Total Volatile Organic Compounds in ppb | +-----------------------+-----------------------+-------------------------------------------------------------------------+ From b42e94ee2cf9b1d35ddabe36292a980bf0ed0c4f Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 26 Jan 2021 08:48:30 -0800 Subject: [PATCH 733/770] Raise an error on UART use --- ports/raspberrypi/common-hal/busio/UART.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/raspberrypi/common-hal/busio/UART.c b/ports/raspberrypi/common-hal/busio/UART.c index 71da6cadd5e93..f9a75b4996885 100644 --- a/ports/raspberrypi/common-hal/busio/UART.c +++ b/ports/raspberrypi/common-hal/busio/UART.c @@ -54,6 +54,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, uint32_t baudrate, uint8_t bits, busio_uart_parity_t parity, uint8_t stop, mp_float_t timeout, uint16_t receiver_buffer_size, byte* receiver_buffer, bool sigint_enabled) { + mp_raise_NotImplementedError(translate("UART not yet supported")); // Sercom* sercom = NULL; // uint8_t sercom_index = 255; // Unset index From 345c2ae8a95f63834aea4f7ee5f1288fbc84e279 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 26 Jan 2021 11:04:18 -0600 Subject: [PATCH 734/770] make translate --- locale/circuitpython.pot | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 3ffc31cc6cae0..b896688b51b0b 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -58,7 +58,8 @@ msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format -msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgid "" +"%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" #: ports/atmel-samd/common-hal/sdioio/SDCard.c @@ -516,7 +517,6 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/adafruit_bus_device/I2CDevice.c #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "" From 368977fb906e6561bd67977a47dc0b415547cc33 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 26 Jan 2021 14:33:48 -0600 Subject: [PATCH 735/770] RGBMatrix: Additional tile tweaks * Introduce explicit serpentine: bool argument instead of using negative numbers (thanks, ghost of @tannewt sitting on one shoulder) * Fix several calculations of height Testing performed (matrixportal): * set up a serpentine 64x64 virtual display with 2 64x32 tiles * tried all 4 rotations * looked at output of REPL --- shared-bindings/rgbmatrix/RGBMatrix.c | 17 ++++++++--------- shared-bindings/rgbmatrix/RGBMatrix.h | 2 +- shared-module/rgbmatrix/RGBMatrix.c | 10 ++++++---- shared-module/rgbmatrix/RGBMatrix.h | 1 + 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index ad693066cd018..7218b2a9ea973 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -24,8 +24,6 @@ * THE SOFTWARE. */ -#include - #include "py/obj.h" #include "py/objproperty.h" #include "py/runtime.h" @@ -216,18 +214,19 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n int tile = args[ARG_tile].u_int; + if (tile < 0) { + mp_raise_ValueError_varg( + translate("tile must be greater than or equal to zero")); + } + if (args[ARG_height].u_int != 0) { - int computed_height = (rgb_count / 3) << (addr_count) * abs(tile); + int computed_height = (rgb_count / 3) * (1 << (addr_count)) * tile; if (computed_height != args[ARG_height].u_int) { mp_raise_ValueError_varg( translate("%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d"), addr_count, rgb_count, tile, computed_height, args[ARG_height].u_int); } } - if (args[ARG_serpentine].u_bool) { - tile = -tile; - } - if (args[ARG_width].u_int <= 0) { mp_raise_ValueError(translate("width must be greater than zero")); } @@ -237,7 +236,7 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n mp_obj_t framebuffer = args[ARG_framebuffer].u_obj; if (framebuffer == mp_const_none) { int width = args[ARG_width].u_int; - int bufsize = 2 * width * rgb_count / 3 * (1 << addr_count); + int bufsize = 2 * width * rgb_count / 3 * (1 << addr_count) * tile; framebuffer = mp_obj_new_bytearray_of_zeros(bufsize); } @@ -248,7 +247,7 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n addr_count, addr_pins, clock_pin, latch_pin, output_enable_pin, args[ARG_doublebuffer].u_bool, - framebuffer, tile, NULL); + framebuffer, tile, args[ARG_serpentine].u_bool, NULL); claim_and_never_reset_pins(args[ARG_rgb_list].u_obj); claim_and_never_reset_pins(args[ARG_addr_list].u_obj); diff --git a/shared-bindings/rgbmatrix/RGBMatrix.h b/shared-bindings/rgbmatrix/RGBMatrix.h index 3e8a4db5f370e..4eb3c04b27f0e 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.h +++ b/shared-bindings/rgbmatrix/RGBMatrix.h @@ -31,7 +31,7 @@ extern const mp_obj_type_t rgbmatrix_RGBMatrix_type; -void common_hal_rgbmatrix_rgbmatrix_construct(rgbmatrix_rgbmatrix_obj_t* self, int width, int bit_depth, uint8_t rgb_count, uint8_t* rgb_pins, uint8_t addr_count, uint8_t* addr_pins, uint8_t clock_pin, uint8_t latch_pin, uint8_t oe_pin, bool doublebuffer, mp_obj_t framebuffer, int8_t tile, void* timer); +void common_hal_rgbmatrix_rgbmatrix_construct(rgbmatrix_rgbmatrix_obj_t* self, int width, int bit_depth, uint8_t rgb_count, uint8_t* rgb_pins, uint8_t addr_count, uint8_t* addr_pins, uint8_t clock_pin, uint8_t latch_pin, uint8_t oe_pin, bool doublebuffer, mp_obj_t framebuffer, int8_t tile, bool serpentine, void* timer); void common_hal_rgbmatrix_rgbmatrix_deinit(rgbmatrix_rgbmatrix_obj_t*); void rgbmatrix_rgbmatrix_collect_ptrs(rgbmatrix_rgbmatrix_obj_t*); void common_hal_rgbmatrix_rgbmatrix_reconstruct(rgbmatrix_rgbmatrix_obj_t* self, mp_obj_t framebuffer); diff --git a/shared-module/rgbmatrix/RGBMatrix.c b/shared-module/rgbmatrix/RGBMatrix.c index 95a7eda75dfd1..4318604c64abd 100644 --- a/shared-module/rgbmatrix/RGBMatrix.c +++ b/shared-module/rgbmatrix/RGBMatrix.c @@ -42,7 +42,7 @@ extern Protomatter_core *_PM_protoPtr; -void common_hal_rgbmatrix_rgbmatrix_construct(rgbmatrix_rgbmatrix_obj_t *self, int width, int bit_depth, uint8_t rgb_count, uint8_t *rgb_pins, uint8_t addr_count, uint8_t *addr_pins, uint8_t clock_pin, uint8_t latch_pin, uint8_t oe_pin, bool doublebuffer, mp_obj_t framebuffer, int8_t tile, void *timer) { +void common_hal_rgbmatrix_rgbmatrix_construct(rgbmatrix_rgbmatrix_obj_t *self, int width, int bit_depth, uint8_t rgb_count, uint8_t *rgb_pins, uint8_t addr_count, uint8_t *addr_pins, uint8_t clock_pin, uint8_t latch_pin, uint8_t oe_pin, bool doublebuffer, mp_obj_t framebuffer, int8_t tile, bool serpentine, void *timer) { self->width = width; self->bit_depth = bit_depth; self->rgb_count = rgb_count; @@ -54,6 +54,7 @@ void common_hal_rgbmatrix_rgbmatrix_construct(rgbmatrix_rgbmatrix_obj_t *self, i self->latch_pin = latch_pin; self->doublebuffer = doublebuffer; self->tile = tile; + self->serpentine = serpentine; self->timer = timer ? timer : common_hal_rgbmatrix_timer_allocate(); if (self->timer == NULL) { @@ -61,7 +62,7 @@ void common_hal_rgbmatrix_rgbmatrix_construct(rgbmatrix_rgbmatrix_obj_t *self, i } self->width = width; - self->bufsize = 2 * width * rgb_count / 3 * (1 << addr_count); + self->bufsize = 2 * width * rgb_count / 3 * (1 << addr_count) * tile; common_hal_rgbmatrix_rgbmatrix_reconstruct(self, framebuffer); } @@ -96,7 +97,8 @@ void common_hal_rgbmatrix_rgbmatrix_reconstruct(rgbmatrix_rgbmatrix_obj_t* self, self->rgb_count/6, self->rgb_pins, self->addr_count, self->addr_pins, self->clock_pin, self->latch_pin, self->oe_pin, - self->doublebuffer, self->tile, self->timer); + self->doublebuffer, self->serpentine ? -self->tile : self->tile, + self->timer); if (stat == PROTOMATTER_OK) { _PM_protoPtr = &self->protomatter; @@ -210,7 +212,7 @@ int common_hal_rgbmatrix_rgbmatrix_get_width(rgbmatrix_rgbmatrix_obj_t* self) { } int common_hal_rgbmatrix_rgbmatrix_get_height(rgbmatrix_rgbmatrix_obj_t* self) { - int computed_height = (self->rgb_count / 3) << (self->addr_count); + int computed_height = (self->rgb_count / 3) * (1 << (self->addr_count)) * self->tile; return computed_height; } diff --git a/shared-module/rgbmatrix/RGBMatrix.h b/shared-module/rgbmatrix/RGBMatrix.h index 7fce73c8b1bb3..4a0e9235e74ef 100644 --- a/shared-module/rgbmatrix/RGBMatrix.h +++ b/shared-module/rgbmatrix/RGBMatrix.h @@ -44,5 +44,6 @@ typedef struct { bool core_is_initialized; bool paused; bool doublebuffer; + bool serpentine; int8_t tile; } rgbmatrix_rgbmatrix_obj_t; From 20c9f25a654df33e4fb719edfeaad8c4d4396f5e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 26 Jan 2021 14:35:26 -0600 Subject: [PATCH 736/770] rgbmatrix: Eliminate some duplicated height-calculating code This was hard to write, so let's have it written in 2 places instead of 4. --- shared-bindings/rgbmatrix/RGBMatrix.c | 4 ++-- shared-module/rgbmatrix/RGBMatrix.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index 7218b2a9ea973..3b2039e4d1ee2 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -219,8 +219,8 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n translate("tile must be greater than or equal to zero")); } + int computed_height = (rgb_count / 3) * (1 << (addr_count)) * tile; if (args[ARG_height].u_int != 0) { - int computed_height = (rgb_count / 3) * (1 << (addr_count)) * tile; if (computed_height != args[ARG_height].u_int) { mp_raise_ValueError_varg( translate("%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d"), addr_count, rgb_count, tile, computed_height, args[ARG_height].u_int); @@ -236,7 +236,7 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n mp_obj_t framebuffer = args[ARG_framebuffer].u_obj; if (framebuffer == mp_const_none) { int width = args[ARG_width].u_int; - int bufsize = 2 * width * rgb_count / 3 * (1 << addr_count) * tile; + int bufsize = 2 * width * computed_height; framebuffer = mp_obj_new_bytearray_of_zeros(bufsize); } diff --git a/shared-module/rgbmatrix/RGBMatrix.c b/shared-module/rgbmatrix/RGBMatrix.c index 4318604c64abd..b8db0d89391a1 100644 --- a/shared-module/rgbmatrix/RGBMatrix.c +++ b/shared-module/rgbmatrix/RGBMatrix.c @@ -62,7 +62,7 @@ void common_hal_rgbmatrix_rgbmatrix_construct(rgbmatrix_rgbmatrix_obj_t *self, i } self->width = width; - self->bufsize = 2 * width * rgb_count / 3 * (1 << addr_count) * tile; + self->bufsize = 2 * width * common_hal_rgbmatrix_rgbmatrix_get_height(self); common_hal_rgbmatrix_rgbmatrix_reconstruct(self, framebuffer); } From 1c10ec99a774538e0e39414beb99ca3f0a0b5694 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 26 Jan 2021 15:04:45 -0600 Subject: [PATCH 737/770] make translate --- locale/circuitpython.pot | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index b896688b51b0b..4d8aceb85e0a8 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -3710,6 +3710,10 @@ msgstr "" msgid "threshold must be in the range 0-65536" msgstr "" +#: shared-bindings/rgbmatrix/RGBMatrix.c +msgid "tile must be greater than or equal to zero" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" From 85508d7cc17b96b4cb3ac41fbf03b0371f1b441d Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 26 Jan 2021 22:08:06 +0100 Subject: [PATCH 738/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 6 +++++- locale/cs.po | 6 +++++- locale/de_DE.po | 6 +++++- locale/el.po | 6 +++++- locale/es.po | 6 +++++- locale/fil.po | 6 +++++- locale/fr.po | 6 +++++- locale/hi.po | 6 +++++- locale/it_IT.po | 6 +++++- locale/ja.po | 6 +++++- locale/ko.po | 6 +++++- locale/nl.po | 6 +++++- locale/pl.po | 6 +++++- locale/pt_BR.po | 6 +++++- locale/sv.po | 6 +++++- locale/zh_Latn_pinyin.po | 9 +++++++-- 16 files changed, 82 insertions(+), 17 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 7ae5b50bd44bd..b4385c74187c3 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -538,6 +538,7 @@ msgid "Buffer too short by %d bytes" msgstr "Buffer terlalu pendek untuk %d byte" #: ports/atmel-samd/common-hal/displayio/ParallelBus.c +#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/nrf/common-hal/displayio/ParallelBus.c #, c-format msgid "Bus pin %d is already in use" @@ -818,6 +819,10 @@ msgstr "DAC sudah digunakan" msgid "Data 0 pin must be byte aligned" msgstr "Data 0 pin harus byte disejajarkan" +#: ports/esp32s2/common-hal/displayio/ParallelBus.c +msgid "Data 0 pin must be byte aligned." +msgstr "" + #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" msgstr "Potongan data harus mengikuti fmt chunk" @@ -1613,7 +1618,6 @@ msgstr "" "Frekuensi PWM tidak dapat ditulis ketika variabel_frequency Salah pada " "konstruksi." -#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" diff --git a/locale/cs.po b/locale/cs.po index d7ab891b6eca2..8e187440f33b7 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -534,6 +534,7 @@ msgid "Buffer too short by %d bytes" msgstr "" #: ports/atmel-samd/common-hal/displayio/ParallelBus.c +#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/nrf/common-hal/displayio/ParallelBus.c #, c-format msgid "Bus pin %d is already in use" @@ -803,6 +804,10 @@ msgstr "" msgid "Data 0 pin must be byte aligned" msgstr "" +#: ports/esp32s2/common-hal/displayio/ParallelBus.c +msgid "Data 0 pin must be byte aligned." +msgstr "" + #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" msgstr "" @@ -1587,7 +1592,6 @@ msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "" -#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" diff --git a/locale/de_DE.po b/locale/de_DE.po index 25321f63eb6c2..c6c8e14ad4cca 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -539,6 +539,7 @@ msgid "Buffer too short by %d bytes" msgstr "Buffer um %d Bytes zu kurz" #: ports/atmel-samd/common-hal/displayio/ParallelBus.c +#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/nrf/common-hal/displayio/ParallelBus.c #, c-format msgid "Bus pin %d is already in use" @@ -815,6 +816,10 @@ msgstr "DAC wird schon benutzt" msgid "Data 0 pin must be byte aligned" msgstr "Data 0 pin muss am Byte ausgerichtet sein" +#: ports/esp32s2/common-hal/displayio/ParallelBus.c +msgid "Data 0 pin must be byte aligned." +msgstr "" + #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" msgstr "Dem fmt Block muss ein Datenblock folgen" @@ -1612,7 +1617,6 @@ msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "Die PWM-Frequenz ist nicht schreibbar wenn variable_Frequenz = False." -#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" diff --git a/locale/el.po b/locale/el.po index 104dff4ee56fa..cf1ae7cffb976 100644 --- a/locale/el.po +++ b/locale/el.po @@ -531,6 +531,7 @@ msgid "Buffer too short by %d bytes" msgstr "" #: ports/atmel-samd/common-hal/displayio/ParallelBus.c +#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/nrf/common-hal/displayio/ParallelBus.c #, c-format msgid "Bus pin %d is already in use" @@ -800,6 +801,10 @@ msgstr "" msgid "Data 0 pin must be byte aligned" msgstr "" +#: ports/esp32s2/common-hal/displayio/ParallelBus.c +msgid "Data 0 pin must be byte aligned." +msgstr "" + #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" msgstr "" @@ -1584,7 +1589,6 @@ msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "" -#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" diff --git a/locale/es.po b/locale/es.po index 58634a597ef5f..6c24698401405 100644 --- a/locale/es.po +++ b/locale/es.po @@ -543,6 +543,7 @@ msgid "Buffer too short by %d bytes" msgstr "Búffer muy corto por %d bytes" #: ports/atmel-samd/common-hal/displayio/ParallelBus.c +#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/nrf/common-hal/displayio/ParallelBus.c #, c-format msgid "Bus pin %d is already in use" @@ -818,6 +819,10 @@ msgstr "DAC ya está siendo utilizado" msgid "Data 0 pin must be byte aligned" msgstr "El pin Data 0 debe estar alineado a bytes" +#: ports/esp32s2/common-hal/displayio/ParallelBus.c +msgid "Data 0 pin must be byte aligned." +msgstr "" + #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" msgstr "Trozo de datos debe seguir fmt chunk" @@ -1613,7 +1618,6 @@ msgstr "" "La frecuencia de PWM no se puede escribir variable_frequency es False en la " "construcción." -#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" diff --git a/locale/fil.po b/locale/fil.po index cd59ad213d324..f277c784c5591 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -536,6 +536,7 @@ msgid "Buffer too short by %d bytes" msgstr "" #: ports/atmel-samd/common-hal/displayio/ParallelBus.c +#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/nrf/common-hal/displayio/ParallelBus.c #, fuzzy, c-format msgid "Bus pin %d is already in use" @@ -809,6 +810,10 @@ msgstr "Ginagamit na ang DAC" msgid "Data 0 pin must be byte aligned" msgstr "graphic ay dapat 2048 bytes ang haba" +#: ports/esp32s2/common-hal/displayio/ParallelBus.c +msgid "Data 0 pin must be byte aligned." +msgstr "" + #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" msgstr "Dapat sunurin ng Data chunk ang fmt chunk" @@ -1603,7 +1608,6 @@ msgid "" msgstr "" "PWM frequency hindi writable kapag variable_frequency ay False sa pag buo." -#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" diff --git a/locale/fr.po b/locale/fr.po index 1c47148259122..979fb201b35b1 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -548,6 +548,7 @@ msgid "Buffer too short by %d bytes" msgstr "Tampon trop court de %d octets" #: ports/atmel-samd/common-hal/displayio/ParallelBus.c +#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/nrf/common-hal/displayio/ParallelBus.c #, c-format msgid "Bus pin %d is already in use" @@ -831,6 +832,10 @@ msgstr "DAC déjà utilisé" msgid "Data 0 pin must be byte aligned" msgstr "La broche 'Data 0' doit être aligné sur l'octet" +#: ports/esp32s2/common-hal/displayio/ParallelBus.c +msgid "Data 0 pin must be byte aligned." +msgstr "" + #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" msgstr "Un bloc de données doit suivre un bloc fmt" @@ -1631,7 +1636,6 @@ msgstr "" "La fréquence de PWM n'est pas modifiable quand variable_frequency est False " "à la construction." -#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" diff --git a/locale/hi.po b/locale/hi.po index f9fa68f5c86f2..902cd255649b2 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -531,6 +531,7 @@ msgid "Buffer too short by %d bytes" msgstr "" #: ports/atmel-samd/common-hal/displayio/ParallelBus.c +#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/nrf/common-hal/displayio/ParallelBus.c #, c-format msgid "Bus pin %d is already in use" @@ -800,6 +801,10 @@ msgstr "" msgid "Data 0 pin must be byte aligned" msgstr "" +#: ports/esp32s2/common-hal/displayio/ParallelBus.c +msgid "Data 0 pin must be byte aligned." +msgstr "" + #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" msgstr "" @@ -1584,7 +1589,6 @@ msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "" -#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" diff --git a/locale/it_IT.po b/locale/it_IT.po index e6402f9294f94..58784a06317a2 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -536,6 +536,7 @@ msgid "Buffer too short by %d bytes" msgstr "" #: ports/atmel-samd/common-hal/displayio/ParallelBus.c +#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/nrf/common-hal/displayio/ParallelBus.c #, fuzzy, c-format msgid "Bus pin %d is already in use" @@ -810,6 +811,10 @@ msgstr "DAC già in uso" msgid "Data 0 pin must be byte aligned" msgstr "graphic deve essere lunga 2048 byte" +#: ports/esp32s2/common-hal/displayio/ParallelBus.c +msgid "Data 0 pin must be byte aligned." +msgstr "" + #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" msgstr "" @@ -1612,7 +1617,6 @@ msgstr "" "frequenza PWM frequency non è scrivibile quando variable_frequency è " "impostato nel costruttore a False." -#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" diff --git a/locale/ja.po b/locale/ja.po index 42c882e9a4237..4169131d409a5 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -538,6 +538,7 @@ msgid "Buffer too short by %d bytes" msgstr "バッファが %d バイト足りません" #: ports/atmel-samd/common-hal/displayio/ParallelBus.c +#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/nrf/common-hal/displayio/ParallelBus.c #, c-format msgid "Bus pin %d is already in use" @@ -811,6 +812,10 @@ msgstr "DACはすでに使用中" msgid "Data 0 pin must be byte aligned" msgstr "Data 0 ピンは、バイト整列されていなければなりません" +#: ports/esp32s2/common-hal/displayio/ParallelBus.c +msgid "Data 0 pin must be byte aligned." +msgstr "" + #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" msgstr "fmtチャンクの後にdataチャンクが続かなければなりません" @@ -1600,7 +1605,6 @@ msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "PWM周波数は生成時のvariable_frequencyがFalseのとき書き換え不可" -#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" diff --git a/locale/ko.po b/locale/ko.po index 97de46fcd5aba..13a1ea5d1645f 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -534,6 +534,7 @@ msgid "Buffer too short by %d bytes" msgstr "" #: ports/atmel-samd/common-hal/displayio/ParallelBus.c +#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/nrf/common-hal/displayio/ParallelBus.c #, c-format msgid "Bus pin %d is already in use" @@ -803,6 +804,10 @@ msgstr "DAC가 현재 사용 중입니다" msgid "Data 0 pin must be byte aligned" msgstr "" +#: ports/esp32s2/common-hal/displayio/ParallelBus.c +msgid "Data 0 pin must be byte aligned." +msgstr "" + #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" msgstr "" @@ -1587,7 +1592,6 @@ msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "" -#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" diff --git a/locale/nl.po b/locale/nl.po index 58cc8e6030f75..c1c0eef26689d 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -536,6 +536,7 @@ msgid "Buffer too short by %d bytes" msgstr "Buffer is %d bytes te klein" #: ports/atmel-samd/common-hal/displayio/ParallelBus.c +#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/nrf/common-hal/displayio/ParallelBus.c #, c-format msgid "Bus pin %d is already in use" @@ -811,6 +812,10 @@ msgstr "DAC al in gebruik" msgid "Data 0 pin must be byte aligned" msgstr "Data 0 pin moet byte uitgelijnd zijn" +#: ports/esp32s2/common-hal/displayio/ParallelBus.c +msgid "Data 0 pin must be byte aligned." +msgstr "" + #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" msgstr "Data chunk moet gevolgd worden door fmt chunk" @@ -1607,7 +1612,6 @@ msgstr "" "PWM frequentie is niet schrijfbaar wanneer de variable_frequency False is " "tijdens constructie." -#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" diff --git a/locale/pl.po b/locale/pl.po index 14a57b4ea265e..a6bb1c2165bc6 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -538,6 +538,7 @@ msgid "Buffer too short by %d bytes" msgstr "Bufor za krótki o %d bajtów" #: ports/atmel-samd/common-hal/displayio/ParallelBus.c +#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/nrf/common-hal/displayio/ParallelBus.c #, c-format msgid "Bus pin %d is already in use" @@ -811,6 +812,10 @@ msgstr "DAC w użyciu" msgid "Data 0 pin must be byte aligned" msgstr "Nóżka data 0 musi być wyrównana do bajtu" +#: ports/esp32s2/common-hal/displayio/ParallelBus.c +msgid "Data 0 pin must be byte aligned." +msgstr "" + #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" msgstr "Fragment danych musi następować po fragmencie fmt" @@ -1598,7 +1603,6 @@ msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "Nie można zmienić częstotliwości PWM gdy variable_frequency=False." -#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 92d46a4cf95fb..84b3f55e54e54 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -548,6 +548,7 @@ msgid "Buffer too short by %d bytes" msgstr "O buffer é muito curto em %d bytes" #: ports/atmel-samd/common-hal/displayio/ParallelBus.c +#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/nrf/common-hal/displayio/ParallelBus.c #, c-format msgid "Bus pin %d is already in use" @@ -827,6 +828,10 @@ msgstr "DAC em uso" msgid "Data 0 pin must be byte aligned" msgstr "O pino de dados 0 deve ser alinhado por bytes" +#: ports/esp32s2/common-hal/displayio/ParallelBus.c +msgid "Data 0 pin must be byte aligned." +msgstr "" + #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" msgstr "Pedaço de dados deve seguir o pedaço de cortes" @@ -1623,7 +1628,6 @@ msgstr "" "A frequência do PWM não pode ser gravada quando variable_frequency for False " "na construção." -#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" diff --git a/locale/sv.po b/locale/sv.po index c3b55d5a03e57..f7d7c0108fdc0 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -540,6 +540,7 @@ msgid "Buffer too short by %d bytes" msgstr "Buffert är %d bytes för kort" #: ports/atmel-samd/common-hal/displayio/ParallelBus.c +#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/nrf/common-hal/displayio/ParallelBus.c #, c-format msgid "Bus pin %d is already in use" @@ -816,6 +817,10 @@ msgstr "DAC används redan" msgid "Data 0 pin must be byte aligned" msgstr "Datapinne 0 måste vara bytejusterad" +#: ports/esp32s2/common-hal/displayio/ParallelBus.c +msgid "Data 0 pin must be byte aligned." +msgstr "" + #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" msgstr "Datasegmentet måste följa fmt-segmentet" @@ -1610,7 +1615,6 @@ msgstr "" "PWM-frekvensen är inte skrivbar när variable_frequency är falsk vid " "skapandet." -#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index c2ff0404492c2..1bfa43b8d6a9e 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -542,6 +542,7 @@ msgid "Buffer too short by %d bytes" msgstr "Huǎn chōng qū tài duǎn , àn %d zì jié" #: ports/atmel-samd/common-hal/displayio/ParallelBus.c +#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/nrf/common-hal/displayio/ParallelBus.c #, c-format msgid "Bus pin %d is already in use" @@ -815,6 +816,10 @@ msgstr "Fā yuán huì yǐjīng shǐyòng" msgid "Data 0 pin must be byte aligned" msgstr "Shùjù 0 de yǐn jiǎo bìxū shì zì jié duìqí" +#: ports/esp32s2/common-hal/displayio/ParallelBus.c +msgid "Data 0 pin must be byte aligned." +msgstr "" + #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" msgstr "Shùjù kuài bìxū zūnxún fmt qū kuài" @@ -1607,7 +1612,6 @@ msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "Dāng biànliàng_pínlǜ shì False zài jiànzhú shí PWM pínlǜ bùkě xiě." -#: ports/esp32s2/common-hal/displayio/ParallelBus.c #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" @@ -2525,7 +2529,8 @@ msgstr "wúfǎ cóng shǒudòng zìduàn guīgé qiēhuàn dào zìdòng zìduà #: extmod/ulab/code/ndarray_operators.c msgid "cannot cast output with casting rule" -msgstr "wú fǎ shǐ yòng qiáng zhì zhuǎn huàn guī zé qiáng zhì zhuǎn huàn shū chū" +msgstr "" +"wú fǎ shǐ yòng qiáng zhì zhuǎn huàn guī zé qiáng zhì zhuǎn huàn shū chū" #: py/objtype.c msgid "cannot create '%q' instances" From 189ec2fc60f8dbfb5b054174f0062b9baeb27ca3 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 26 Jan 2021 15:05:24 -0600 Subject: [PATCH 739/770] Disallow tile=0 --- locale/circuitpython.pot | 2 +- shared-bindings/rgbmatrix/RGBMatrix.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 4d8aceb85e0a8..81ee31e1ecc9b 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -3711,7 +3711,7 @@ msgid "threshold must be in the range 0-65536" msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "tile must be greater than or equal to zero" +msgid "tile must be greater than zero" msgstr "" #: shared-bindings/time/__init__.c diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index 3b2039e4d1ee2..2a81bb53c2505 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -214,9 +214,9 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n int tile = args[ARG_tile].u_int; - if (tile < 0) { + if (tile <= 0) { mp_raise_ValueError_varg( - translate("tile must be greater than or equal to zero")); + translate("tile must be greater than zero")); } int computed_height = (rgb_count / 3) * (1 << (addr_count)) * tile; From 2918b73828ea68e6a9765923173021fe95b7d808 Mon Sep 17 00:00:00 2001 From: Maciej Stankiewicz Date: Tue, 26 Jan 2021 21:16:01 +0000 Subject: [PATCH 740/770] Translated using Weblate (Polish) Currently translated at 67.7% (626 of 924 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pl/ --- locale/pl.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/pl.po b/locale/pl.po index a6bb1c2165bc6..66758b36aae14 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-01-20 02:40+0000\n" +"PO-Revision-Date: 2021-01-27 01:31+0000\n" "Last-Translator: Maciej Stankiewicz \n" "Language-Team: pl\n" "Language: pl\n" @@ -3138,7 +3138,7 @@ msgstr "" #: py/parse.c msgid "malformed f-string" -msgstr "" +msgstr "źle sformatowany f-string" #: shared-bindings/_stage/Layer.c msgid "map buffer too small" @@ -3407,11 +3407,11 @@ msgstr "offset poza zakresem" #: ports/nrf/common-hal/audiobusio/PDMIn.c msgid "only bit_depth=16 is supported" -msgstr "" +msgstr "obsługiwane jest tylko bit_depth=16" #: ports/nrf/common-hal/audiobusio/PDMIn.c msgid "only sample_rate=16000 is supported" -msgstr "" +msgstr "obsługiwane jest tylko sample_rate=16000" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c #: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c From c1b1ddd724dd77594954ab995e3389ffd7603944 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Wed, 27 Jan 2021 02:31:39 +0100 Subject: [PATCH 741/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 13 ++++++++++--- locale/cs.po | 13 ++++++++++--- locale/de_DE.po | 14 +++++++++++--- locale/el.po | 8 ++++++-- locale/es.po | 13 ++++++++++--- locale/fil.po | 8 ++++++-- locale/fr.po | 15 +++++++++++---- locale/hi.po | 8 ++++++-- locale/it_IT.po | 8 ++++++-- locale/ja.po | 8 ++++++-- locale/ko.po | 8 ++++++-- locale/nl.po | 13 ++++++++++--- locale/pl.po | 8 ++++++-- locale/pt_BR.po | 14 +++++++++++--- locale/sv.po | 13 ++++++++++--- locale/zh_Latn_pinyin.po | 14 +++++++++++--- 16 files changed, 136 insertions(+), 42 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index b4385c74187c3..e1112339823c8 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -63,8 +63,9 @@ msgstr "%%c harus int atau char" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format -msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" -msgstr "pin alamat %d dan pin rgb %d menunjukkan tinggi %d, bukan %d" +msgid "" +"%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" +msgstr "" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" @@ -523,7 +524,6 @@ msgstr "Panjang buffer harus kelipatan 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/adafruit_bus_device/I2CDevice.c #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Penyangga harus memiliki panjang setidaknya 1" @@ -3766,6 +3766,10 @@ msgstr "sintaksis error pada pendeskripsi uctypes" msgid "threshold must be in the range 0-65536" msgstr "" +#: shared-bindings/rgbmatrix/RGBMatrix.c +msgid "tile must be greater than zero" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" @@ -4055,6 +4059,9 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +#~ msgstr "pin alamat %d dan pin rgb %d menunjukkan tinggi %d, bukan %d" + #~ msgid "" #~ "\n" #~ "Code done running. Waiting for reload.\n" diff --git a/locale/cs.po b/locale/cs.po index 8e187440f33b7..9181d1f709421 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -61,8 +61,9 @@ msgstr "%%c vyžaduje int nebo char" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format -msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" -msgstr "%d adresní piny a %d rgb piny označují výšku %d, nikoli %d" +msgid "" +"%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" +msgstr "" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" @@ -519,7 +520,6 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/adafruit_bus_device/I2CDevice.c #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "" @@ -3717,6 +3717,10 @@ msgstr "" msgid "threshold must be in the range 0-65536" msgstr "" +#: shared-bindings/rgbmatrix/RGBMatrix.c +msgid "tile must be greater than zero" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" @@ -4005,6 +4009,9 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +#~ msgstr "%d adresní piny a %d rgb piny označují výšku %d, nikoli %d" + #~ msgid "" #~ "\n" #~ "Code done running. Waiting for reload.\n" diff --git a/locale/de_DE.po b/locale/de_DE.po index c6c8e14ad4cca..8d8f2d52103d6 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -62,8 +62,9 @@ msgstr "%%c erwartet int oder char" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format -msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" -msgstr "%d Adress-Pins und %d rgb-Pins zeigen eine Höhe von %d, nicht von %d" +msgid "" +"%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" +msgstr "" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" @@ -524,7 +525,6 @@ msgstr "Die Pufferlänge muss ein vielfaches von 512 sein" msgid "Buffer must be a multiple of 512 bytes" msgstr "Der Puffer muss ein vielfaches von 512 bytes sein" -#: shared-bindings/adafruit_bus_device/I2CDevice.c #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Der Puffer muss eine Mindestenslänge von 1 haben" @@ -3800,6 +3800,10 @@ msgstr "Syntaxfehler in uctypes Deskriptor" msgid "threshold must be in the range 0-65536" msgstr "threshold muss im Intervall 0-65536 liegen" +#: shared-bindings/rgbmatrix/RGBMatrix.c +msgid "tile must be greater than zero" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() nimmt eine 9-Sequenz an" @@ -4092,6 +4096,10 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +#~ msgstr "" +#~ "%d Adress-Pins und %d rgb-Pins zeigen eine Höhe von %d, nicht von %d" + #~ msgid "input argument must be an integer or a 2-tuple" #~ msgstr "Das Eingabeargument muss eine Ganzzahl oder ein 2-Tupel sein" diff --git a/locale/el.po b/locale/el.po index cf1ae7cffb976..04b63261eaddb 100644 --- a/locale/el.po +++ b/locale/el.po @@ -58,7 +58,8 @@ msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format -msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgid "" +"%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" #: ports/atmel-samd/common-hal/sdioio/SDCard.c @@ -516,7 +517,6 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/adafruit_bus_device/I2CDevice.c #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "" @@ -3714,6 +3714,10 @@ msgstr "" msgid "threshold must be in the range 0-65536" msgstr "" +#: shared-bindings/rgbmatrix/RGBMatrix.c +msgid "tile must be greater than zero" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" diff --git a/locale/es.po b/locale/es.po index 6c24698401405..29b238768a641 100644 --- a/locale/es.po +++ b/locale/es.po @@ -63,9 +63,9 @@ msgstr "%%c requiere int o char" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format -msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgid "" +"%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" -"%d pines de dirección y %d pines rgb indican una altura de %d, no de %d" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" @@ -528,7 +528,6 @@ msgstr "El tamaño del búfer debe ser múltiplo de 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "Búfer deber ser un múltiplo de 512 bytes" -#: shared-bindings/adafruit_bus_device/I2CDevice.c #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Buffer debe ser de longitud 1 como minimo" @@ -3790,6 +3789,10 @@ msgstr "error de sintaxis en el descriptor uctypes" msgid "threshold must be in the range 0-65536" msgstr "limite debe ser en el rango 0-65536" +#: shared-bindings/rgbmatrix/RGBMatrix.c +msgid "tile must be greater than zero" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() toma un sequencio 9" @@ -4079,6 +4082,10 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +#~ msgstr "" +#~ "%d pines de dirección y %d pines rgb indican una altura de %d, no de %d" + #~ msgid "Unknown failure" #~ msgstr "Fallo desconocido" diff --git a/locale/fil.po b/locale/fil.po index f277c784c5591..2fdcd2f0488d3 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -57,7 +57,8 @@ msgstr "%%c nangangailangan ng int o char" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format -msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgid "" +"%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" #: ports/atmel-samd/common-hal/sdioio/SDCard.c @@ -521,7 +522,6 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/adafruit_bus_device/I2CDevice.c #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Buffer dapat ay hindi baba sa 1 na haba" @@ -3766,6 +3766,10 @@ msgstr "may pagkakamali sa sintaks sa uctypes descriptor" msgid "threshold must be in the range 0-65536" msgstr "ang threshold ay dapat sa range 0-65536" +#: shared-bindings/rgbmatrix/RGBMatrix.c +msgid "tile must be greater than zero" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() kumukuha ng 9-sequence" diff --git a/locale/fr.po b/locale/fr.po index 979fb201b35b1..1842d6d3e5c75 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -67,10 +67,9 @@ msgstr "%%c nécessite un chiffre entier 'int' ou un caractère 'char'" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format -msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgid "" +"%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" -"Les broches d'adresse %d et les broches RVB %d indiquent une hauteur de %d, " -"pas %d" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" @@ -533,7 +532,6 @@ msgstr "La longueur de la mémoire tampon doit être un multiple de 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "La mémoire tampon doit être un multiple de 512" -#: shared-bindings/adafruit_bus_device/I2CDevice.c #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Le tampon doit être de longueur au moins 1" @@ -3827,6 +3825,10 @@ msgstr "erreur de syntaxe dans le descripteur d'uctypes" msgid "threshold must be in the range 0-65536" msgstr "le seuil doit être dans la portée 0-65536" +#: shared-bindings/rgbmatrix/RGBMatrix.c +msgid "tile must be greater than zero" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() prend une séquence de longueur 9" @@ -4115,6 +4117,11 @@ msgstr "zi doit être de type float" msgid "zi must be of shape (n_section, 2)" msgstr "zi doit être de forme (n_section, 2)" +#~ msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +#~ msgstr "" +#~ "Les broches d'adresse %d et les broches RVB %d indiquent une hauteur de " +#~ "%d, pas %d" + #~ msgid "Unknown failure" #~ msgstr "Echec inconnu" diff --git a/locale/hi.po b/locale/hi.po index 902cd255649b2..88c82d4b80550 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -58,7 +58,8 @@ msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format -msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgid "" +"%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" #: ports/atmel-samd/common-hal/sdioio/SDCard.c @@ -516,7 +517,6 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/adafruit_bus_device/I2CDevice.c #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "" @@ -3714,6 +3714,10 @@ msgstr "" msgid "threshold must be in the range 0-65536" msgstr "" +#: shared-bindings/rgbmatrix/RGBMatrix.c +msgid "tile must be greater than zero" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 58784a06317a2..b380b2fae11d5 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -57,7 +57,8 @@ msgstr "%%c necessita di int o char" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format -msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgid "" +"%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" #: ports/atmel-samd/common-hal/sdioio/SDCard.c @@ -521,7 +522,6 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/adafruit_bus_device/I2CDevice.c #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Il buffer deve essere lungo almeno 1" @@ -3774,6 +3774,10 @@ msgstr "errore di sintassi nel descrittore uctypes" msgid "threshold must be in the range 0-65536" msgstr "la soglia deve essere nell'intervallo 0-65536" +#: shared-bindings/rgbmatrix/RGBMatrix.c +msgid "tile must be greater than zero" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" diff --git a/locale/ja.po b/locale/ja.po index 4169131d409a5..bae5704a1222e 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -63,7 +63,8 @@ msgstr "%%c にはintまたはcharが必要" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format -msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgid "" +"%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" #: ports/atmel-samd/common-hal/sdioio/SDCard.c @@ -523,7 +524,6 @@ msgstr "バッファ長は512の倍数でなければなりません" msgid "Buffer must be a multiple of 512 bytes" msgstr "バッファは512の倍数でなければなりません" -#: shared-bindings/adafruit_bus_device/I2CDevice.c #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "バッファ長は少なくとも1以上でなければなりません" @@ -3745,6 +3745,10 @@ msgstr "uctypedディスクリプタの構文エラー" msgid "threshold must be in the range 0-65536" msgstr "threshouldは0から65536まで" +#: shared-bindings/rgbmatrix/RGBMatrix.c +msgid "tile must be greater than zero" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time()は9要素のシーケンスを受け取ります" diff --git a/locale/ko.po b/locale/ko.po index 13a1ea5d1645f..c284971af20c9 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -59,7 +59,8 @@ msgstr "%%c 전수(int)또는 캐릭터(char)필요합니다" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format -msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgid "" +"%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" #: ports/atmel-samd/common-hal/sdioio/SDCard.c @@ -519,7 +520,6 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/adafruit_bus_device/I2CDevice.c #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "잘못된 크기의 버퍼. >1 여야합니다" @@ -3718,6 +3718,10 @@ msgstr "" msgid "threshold must be in the range 0-65536" msgstr "" +#: shared-bindings/rgbmatrix/RGBMatrix.c +msgid "tile must be greater than zero" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index c1c0eef26689d..2829bd9e89edb 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -61,8 +61,9 @@ msgstr "%%c vereist een int of char" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format -msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" -msgstr "%d adres pins en %d RGB pins geven een hoogte van %d aan, niet %d" +msgid "" +"%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" +msgstr "" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" @@ -521,7 +522,6 @@ msgstr "Buffer lengte moet een veelvoud van 512 zijn" msgid "Buffer must be a multiple of 512 bytes" msgstr "Buffer moet een veelvoud van 512 bytes zijn" -#: shared-bindings/adafruit_bus_device/I2CDevice.c #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Buffer moet op zijn minst lengte 1 zijn" @@ -3778,6 +3778,10 @@ msgstr "syntaxisfout in uctypes aanduiding" msgid "threshold must be in the range 0-65536" msgstr "drempelwaarde moet in het bereik 0-65536 liggen" +#: shared-bindings/rgbmatrix/RGBMatrix.c +msgid "tile must be greater than zero" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() accepteert een 9-rij" @@ -4066,6 +4070,9 @@ msgstr "zi moet van type float zijn" msgid "zi must be of shape (n_section, 2)" msgstr "zi moet vorm (n_section, 2) hebben" +#~ msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +#~ msgstr "%d adres pins en %d RGB pins geven een hoogte van %d aan, niet %d" + #~ msgid "Unknown failure" #~ msgstr "Onbekende fout" diff --git a/locale/pl.po b/locale/pl.po index 66758b36aae14..0c03a0ee0a9b0 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -63,7 +63,8 @@ msgstr "%%c wymaga int lub char" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format -msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgid "" +"%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" #: ports/atmel-samd/common-hal/sdioio/SDCard.c @@ -523,7 +524,6 @@ msgstr "Długość bufora musi być wielokrotnością 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "Bufor musi być wielokrotnością 512 bajtów" -#: shared-bindings/adafruit_bus_device/I2CDevice.c #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Bufor musi mieć długość 1 lub więcej" @@ -3737,6 +3737,10 @@ msgstr "błąd składni w deskryptorze uctypes" msgid "threshold must be in the range 0-65536" msgstr "threshold musi być w zakresie 0-65536" +#: shared-bindings/rgbmatrix/RGBMatrix.c +msgid "tile must be greater than zero" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() wymaga 9-elementowej sekwencji" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 84b3f55e54e54..3e397a0ed4664 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -65,8 +65,9 @@ msgstr "%%c requer int ou char" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format -msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" -msgstr "%d endereços dos pinos e %d pinos rgb indicam uma altura do %d, não %d" +msgid "" +"%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" +msgstr "" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" @@ -533,7 +534,6 @@ msgstr "O comprimento do Buffer deve ser um múltiplo de 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "O buffer deve ser um múltiplo de 512 bytes" -#: shared-bindings/adafruit_bus_device/I2CDevice.c #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "O comprimento do buffer deve ter pelo menos 1" @@ -3813,6 +3813,10 @@ msgstr "houve um erro de sintaxe no descritor uctypes" msgid "threshold must be in the range 0-65536" msgstr "Limite deve estar no alcance de 0-65536" +#: shared-bindings/rgbmatrix/RGBMatrix.c +msgid "tile must be greater than zero" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() leva uma sequência com 9" @@ -4101,6 +4105,10 @@ msgstr "zi deve ser de um tipo float" msgid "zi must be of shape (n_section, 2)" msgstr "zi deve estar na forma (n_section, 2)" +#~ msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +#~ msgstr "" +#~ "%d endereços dos pinos e %d pinos rgb indicam uma altura do %d, não %d" + #~ msgid "Unknown failure" #~ msgstr "Falha desconhecida" diff --git a/locale/sv.po b/locale/sv.po index f7d7c0108fdc0..3aa0dcc1e72dd 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -65,8 +65,9 @@ msgstr "%%c kräver int eller char" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format -msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" -msgstr "%d adresspinnar och %d RGB-pinnar indikerar en höjd av %d, inte %d" +msgid "" +"%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" +msgstr "" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" @@ -525,7 +526,6 @@ msgstr "Buffertlängd måste vara en multipel av 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "Bufferten måste vara en multipel av 512 byte" -#: shared-bindings/adafruit_bus_device/I2CDevice.c #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Bufferten måste ha minst längd 1" @@ -3778,6 +3778,10 @@ msgstr "syntaxfel i uctypes deskriptor" msgid "threshold must be in the range 0-65536" msgstr "tröskelvärdet måste ligga i intervallet 0-65536" +#: shared-bindings/rgbmatrix/RGBMatrix.c +msgid "tile must be greater than zero" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() kräver en 9-sekvens" @@ -4066,6 +4070,9 @@ msgstr "zi måste vara av typ float" msgid "zi must be of shape (n_section, 2)" msgstr "zi måste vara i formen (n_section, 2)" +#~ msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +#~ msgstr "%d adresspinnar och %d RGB-pinnar indikerar en höjd av %d, inte %d" + #~ msgid "Unknown failure" #~ msgstr "Okänt fel" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 1bfa43b8d6a9e..07e461bf89d86 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -66,9 +66,9 @@ msgstr "%%c xūyào zhěngshù huò char" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format -msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgid "" +"%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" -"%d dìzhǐ yǐn jiǎo hé %d rgb yǐn jiǎo jiāng gāodù biǎoshì wèi %d, ér bùshì %d" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" @@ -527,7 +527,6 @@ msgstr "Huǎn chōng qū cháng dù bì xū wéi 512 de bèi shù" msgid "Buffer must be a multiple of 512 bytes" msgstr "Huǎn chōng qū bì xū shì 512 zì jié de bèi shù" -#: shared-bindings/adafruit_bus_device/I2CDevice.c #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Huǎnchōng qū bìxū zhìshǎo chángdù 1" @@ -3770,6 +3769,10 @@ msgstr "uctypes miáoshù fú zhōng de yǔfǎ cuòwù" msgid "threshold must be in the range 0-65536" msgstr "yùzhí bìxū zài fànwéi 0-65536" +#: shared-bindings/rgbmatrix/RGBMatrix.c +msgid "tile must be greater than zero" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() xūyào 9 xùliè" @@ -4058,6 +4061,11 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +#~ msgstr "" +#~ "%d dìzhǐ yǐn jiǎo hé %d rgb yǐn jiǎo jiāng gāodù biǎoshì wèi %d, ér bùshì " +#~ "%d" + #~ msgid "Unknown failure" #~ msgstr "Wèizhī gùzhàng" From 16d54586c1b5cbf839ee8fbb78cf56dd105096f3 Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Wed, 27 Jan 2021 09:20:45 -0800 Subject: [PATCH 742/770] remove long read error message --- ports/nrf/common-hal/busio/UART.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/nrf/common-hal/busio/UART.c b/ports/nrf/common-hal/busio/UART.c index 625807d866f50..6ecf7e0ba3dbb 100644 --- a/ports/nrf/common-hal/busio/UART.c +++ b/ports/nrf/common-hal/busio/UART.c @@ -266,9 +266,12 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t uint64_t start_ticks = supervisor_ticks_ms64(); + // check removed to reduce code size + /* if (len > ringbuf_capacity(&self->ringbuf)) { mp_raise_ValueError(translate("Reading >receiver_buffer_size bytes is not supported")); } + */ // Wait for all bytes received or timeout while ( (ringbuf_num_filled(&self->ringbuf) < len) && (supervisor_ticks_ms64() - start_ticks < self->timeout_ms) ) { From 0d3771ece3ada68d043c41691d9776bedc4de64b Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Wed, 27 Jan 2021 09:24:03 -0800 Subject: [PATCH 743/770] make translate --- locale/circuitpython.pot | 4 ---- 1 file changed, 4 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index ad605a2dbfd84..4209e6e9ace5a 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -1719,10 +1719,6 @@ msgstr "" msgid "Read-only object" msgstr "" -#: ports/nrf/common-hal/busio/UART.c -msgid "Reading >receiver_buffer_size bytes is not supported" -msgstr "" - #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Received response was invalid" msgstr "" From 9325509b54c46a0e22f4b093b8b145ede8bf5161 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 27 Jan 2021 14:07:14 -0800 Subject: [PATCH 744/770] Fix blinka release PR language list --- tools/build_board_info.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/build_board_info.py b/tools/build_board_info.py index 7b556ee5d29aa..70d5e2bc7a151 100644 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -271,6 +271,7 @@ def generate_download_info(): info = current_info[board] for version in info["versions"]: previous_releases.add(version["version"]) + previous_languages.update(version["languages"]) if version["stable"] == new_stable or ( new_stable and version["version"].startswith(this_version) ): From a54b57ea40739c53dc56ea5904da1931f71c71e7 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 28 Jan 2021 15:15:15 +0530 Subject: [PATCH 745/770] watchdog implementation for rp2040 --- .../common-hal/microcontroller/__init__.c | 11 +++ .../common-hal/watchdog/WatchDogMode.c | 1 + .../common-hal/watchdog/WatchDogTimer.c | 83 +++++++++++++++++++ .../common-hal/watchdog/WatchDogTimer.h | 43 ++++++++++ .../common-hal/watchdog/__init__.c | 1 + ports/raspberrypi/mpconfigport.mk | 1 + 6 files changed, 140 insertions(+) create mode 100644 ports/raspberrypi/common-hal/watchdog/WatchDogMode.c create mode 100644 ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c create mode 100644 ports/raspberrypi/common-hal/watchdog/WatchDogTimer.h create mode 100644 ports/raspberrypi/common-hal/watchdog/__init__.c diff --git a/ports/raspberrypi/common-hal/microcontroller/__init__.c b/ports/raspberrypi/common-hal/microcontroller/__init__.c index e454ffa1b73f2..774e313bb4411 100644 --- a/ports/raspberrypi/common-hal/microcontroller/__init__.c +++ b/ports/raspberrypi/common-hal/microcontroller/__init__.c @@ -112,6 +112,17 @@ const nvm_bytearray_obj_t common_hal_mcu_nvm_obj = { }; #endif +#if CIRCUITPY_WATCHDOG +// The singleton watchdog.WatchDogTimer object. +watchdog_watchdogtimer_obj_t common_hal_mcu_watchdogtimer_obj = { + .base = { + .type = &watchdog_watchdogtimer_type, + }, + .timeout = 0.0f, + .mode = WATCHDOGMODE_NONE, +}; +#endif + // This maps MCU pin names to pin objects. const mp_rom_map_elem_t mcu_pin_global_dict_table[TOTAL_GPIO_COUNT] = { { MP_ROM_QSTR(MP_QSTR_GPIO0), MP_ROM_PTR(&pin_GPIO0) }, diff --git a/ports/raspberrypi/common-hal/watchdog/WatchDogMode.c b/ports/raspberrypi/common-hal/watchdog/WatchDogMode.c new file mode 100644 index 0000000000000..fc4e0e008cd53 --- /dev/null +++ b/ports/raspberrypi/common-hal/watchdog/WatchDogMode.c @@ -0,0 +1 @@ +// No watchdog module functions. diff --git a/ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c b/ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c new file mode 100644 index 0000000000000..9184d1561a20b --- /dev/null +++ b/ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c @@ -0,0 +1,83 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * 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 "py/runtime.h" +#include "common-hal/watchdog/WatchDogTimer.h" + +#include "shared-bindings/watchdog/__init__.h" +#include "shared-bindings/microcontroller/__init__.h" + +#include "hardware/watchdog.h" + +void common_hal_watchdog_feed(watchdog_watchdogtimer_obj_t *self) { + watchdog_update(); +} + +void common_hal_watchdog_deinit(watchdog_watchdogtimer_obj_t *self) { + if (self->mode == WATCHDOGMODE_RESET) { + mp_raise_RuntimeError(translate("WatchDogTimer cannot be deinitialized once mode is set to RESET")); + } else { + self->mode = WATCHDOGMODE_NONE; + } +} + +/* +void watchdog_reset(void) { + common_hal_watchdog_deinit(&common_hal_mcu_watchdogtimer_obj); +} +*/ + +mp_float_t common_hal_watchdog_get_timeout(watchdog_watchdogtimer_obj_t *self) { + return self->timeout; +} + +void common_hal_watchdog_set_timeout(watchdog_watchdogtimer_obj_t *self, mp_float_t new_timeout) { + // max timeout is 8.388607 sec + // this is rounded down to 8.388 sec + uint64_t timeout = new_timeout * 1000; + if (timeout > 8388) { + mp_raise_ValueError(translate("timeout duration exceeded the maximum supported value")); + } + if ((uint16_t)self->timeout != timeout) { + watchdog_enable(timeout, false); + self->timeout = new_timeout; + } +} + +watchdog_watchdogmode_t common_hal_watchdog_get_mode(watchdog_watchdogtimer_obj_t *self) { + return self->mode; +} + +void common_hal_watchdog_set_mode(watchdog_watchdogtimer_obj_t *self, watchdog_watchdogmode_t new_mode) { + if (self->mode != new_mode) { + if (new_mode == WATCHDOGMODE_RAISE) { + mp_raise_NotImplementedError(translate("RAISE mode is not implemented")); + } else if (new_mode == WATCHDOGMODE_NONE) { + common_hal_watchdog_deinit(self); + } + self->mode = new_mode; + } +} diff --git a/ports/raspberrypi/common-hal/watchdog/WatchDogTimer.h b/ports/raspberrypi/common-hal/watchdog/WatchDogTimer.h new file mode 100644 index 0000000000000..ec1e2f6592829 --- /dev/null +++ b/ports/raspberrypi/common-hal/watchdog/WatchDogTimer.h @@ -0,0 +1,43 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_WATCHDOG_WATCHDOGTIMER_H +#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_WATCHDOG_WATCHDOGTIMER_H + +#include "py/obj.h" +#include "shared-bindings/watchdog/WatchDogMode.h" +#include "shared-bindings/watchdog/WatchDogTimer.h" + +struct _watchdog_watchdogtimer_obj_t { + mp_obj_base_t base; + mp_float_t timeout; + watchdog_watchdogmode_t mode; +}; + +// This needs to be called in order to disable the watchdog +// void watchdog_reset(void); + +#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_WATCHDOG_WATCHDOGTIMER_H diff --git a/ports/raspberrypi/common-hal/watchdog/__init__.c b/ports/raspberrypi/common-hal/watchdog/__init__.c new file mode 100644 index 0000000000000..fc4e0e008cd53 --- /dev/null +++ b/ports/raspberrypi/common-hal/watchdog/__init__.c @@ -0,0 +1 @@ +// No watchdog module functions. diff --git a/ports/raspberrypi/mpconfigport.mk b/ports/raspberrypi/mpconfigport.mk index 138896d41c572..5c930d7cc8e60 100644 --- a/ports/raspberrypi/mpconfigport.mk +++ b/ports/raspberrypi/mpconfigport.mk @@ -36,6 +36,7 @@ CIRCUITPY_NVM = 0 CIRCUITPY_PULSEIO = 0 # Use PIO interally CIRCUITPY_ROTARYIO = 0 # Use PIO interally CIRCUITPY_RTC = 0 +CIRCUITPY_WATCHDOG = 1 # Things that are unsupported by the hardware. CIRCUITPY_AUDIOIO = 0 From 76256821ec2486b43a2eb405dcef10024a1fda4b Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 28 Jan 2021 20:02:00 +0530 Subject: [PATCH 746/770] add translations for raspberrypi port --- Makefile | 9 +-- locale/circuitpython.pot | 152 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 152 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 845997beb2f8b..5857299c51b97 100644 --- a/Makefile +++ b/Makefile @@ -40,17 +40,18 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(BASEOPTS) # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(BASEOPTS) -TRANSLATE_SOURCES = extmod lib main.c ports/atmel-samd ports/cxd56 ports/esp32s2 ports/mimxrt10xx ports/nrf ports/stm py shared-bindings shared-module supervisor +TRANSLATE_SOURCES = extmod lib main.c ports/atmel-samd ports/cxd56 ports/esp32s2 ports/mimxrt10xx ports/nrf ports/raspberrypi ports/stm py shared-bindings shared-module supervisor # Paths to exclude from TRANSLATE_SOURCES # Each must be preceded by "-path"; if any wildcards, enclose in quotes. # Separate by "-o" (Find's "or" operand) TRANSLATE_SOURCES_EXC = -path "ports/*/build-*" \ -o -path "ports/*/build" \ - -o -path ports/esp32s2/esp-idf \ - -o -path ports/cxd56/spresense-exported-sdk \ - -o -path ports/stm/st_driver \ -o -path ports/atmel-samd/asf4 \ + -o -path ports/cxd56/spresense-exported-sdk \ + -o -path ports/esp32s2/esp-idf \ -o -path ports/mimxrt10xx/sdk \ + -o -path ports/raspberrypi/sdk \ + -o -path ports/stm/st_driver \ -o -path lib/tinyusb \ -o -path lib/lwip \ diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index de902f62fc4d9..0220063353668 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -339,6 +339,10 @@ msgstr "" msgid "All event channels in use" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "All state machines in use" +msgstr "" + #: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "All sync event channels in use" msgstr "" @@ -387,6 +391,7 @@ msgstr "" #: ports/cxd56/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c msgid "AnalogOut functionality not supported" msgstr "" @@ -586,6 +591,7 @@ msgstr "" #: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c +#: ports/raspberrypi/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" msgstr "" @@ -863,7 +869,8 @@ msgstr "" msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c +#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c #: shared-bindings/terminalio/Terminal.c @@ -1045,6 +1052,10 @@ msgstr "" msgid "I2C Init Error" msgstr "" +#: ports/raspberrypi/common-hal/busio/I2C.c +msgid "I2C peripheral in use" +msgstr "" + #: shared-bindings/audiobusio/I2SOut.c msgid "I2SOut not available" msgstr "" @@ -1068,6 +1079,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Init program size invalid" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" msgstr "" @@ -1080,6 +1095,31 @@ msgstr "" msgid "Input/output error" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d jumps on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d waits on input outside of count" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "" @@ -1131,7 +1171,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pwmio/PWMOut.c #: ports/cxd56/common-hal/pwmio/PWMOut.c ports/nrf/common-hal/pwmio/PWMOut.c -#: shared-bindings/pwmio/PWMOut.c +#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c msgid "Invalid PWM frequency" msgstr "" @@ -1225,6 +1265,8 @@ msgstr "" #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/SPI.c msgid "Invalid pins" msgstr "" @@ -1346,6 +1388,36 @@ msgstr "" msgid "Missing MISO or MOSI Pin" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgstr "" + #: shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "" @@ -1399,14 +1471,14 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No TX pin" msgstr "" @@ -1463,6 +1535,10 @@ msgstr "" msgid "No network with that ssid" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "No out in program" +msgstr "" + #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" msgstr "" @@ -1518,6 +1594,10 @@ msgstr "" msgid "Only 8 or 16 bit mono with " msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Only IN/OUT of up to 8 supported" +msgstr "" + #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" @@ -1590,6 +1670,7 @@ msgid "" msgstr "" #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c +#: ports/raspberrypi/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" msgstr "" @@ -1602,11 +1683,20 @@ msgstr "" msgid "Permission denied" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Pin count must be at least 1" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Pin count too large" +msgstr "" + #: ports/atmel-samd/common-hal/analogio/AnalogIn.c #: ports/cxd56/common-hal/analogio/AnalogIn.c #: ports/esp32s2/common-hal/analogio/AnalogIn.c #: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c #: ports/nrf/common-hal/analogio/AnalogIn.c +#: ports/raspberrypi/common-hal/analogio/AnalogIn.c #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Pin does not have ADC capabilities" msgstr "" @@ -1667,10 +1757,34 @@ msgstr "" msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does IN without loading ISR" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does OUT without loading OSR" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program must contain at least one 16-bit instruction." +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program size invalid" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program too large" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c +msgid "RAISE mode is not implemented" +msgstr "" + #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" msgstr "" @@ -1753,6 +1867,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" msgstr "" @@ -1774,6 +1889,10 @@ msgstr "" msgid "SPI Re-initialization error" msgstr "" +#: ports/raspberrypi/common-hal/busio/SPI.c +msgid "SPI peripheral in use" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Sample rate must be positive" msgstr "" @@ -1804,6 +1923,14 @@ msgstr "" msgid "Server side context cannot have hostname" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Set pin count must be between 1 and 5" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Side set pin count must be between 1 and 5" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "" @@ -1968,6 +2095,10 @@ msgstr "" msgid "UART Re-init error" msgstr "" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART not yet supported" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART write error" msgstr "" @@ -2072,7 +2203,8 @@ msgid "" msgstr "" #: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/esp32s2/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/esp32s2/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c msgid "Unsupported baudrate" msgstr "" @@ -2123,6 +2255,7 @@ msgid "WARNING: Your code filename has two extensions\n" msgstr "" #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" @@ -3521,6 +3654,14 @@ msgstr "" msgid "pressing both buttons at start up.\n" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "pull_threshold must be between 1 and 32" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "push_threshold must be between 1 and 32" +msgstr "" + #: extmod/modutimeq.c msgid "queue overflow" msgstr "" @@ -3724,6 +3865,7 @@ msgstr "" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" From 0098909757c80e4e924b400b7b6f35319e0458a9 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 28 Jan 2021 11:42:19 -0600 Subject: [PATCH 747/770] RGBMatrix: change default to serpentine=True The "serpentine" display order leads to much better wiring (shorter ribbon cables) and is preferred. Change the default accordingly. --- shared-bindings/rgbmatrix/RGBMatrix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index 2a81bb53c2505..30b72dffd6437 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -132,7 +132,7 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_ } } -//| def __init__(self, *, width: int, bit_depth: int, rgb_pins: Sequence[digitalio.DigitalInOut], addr_pins: Sequence[digitalio.DigitalInOut], clock_pin: digitalio.DigitalInOut, latch_pin: digitalio.DigitalInOut, output_enable_pin: digitalio.DigitalInOut, doublebuffer: bool = True, framebuffer: Optional[WriteableBuffer] = None, height: int = 0, tile: int = 1, serpentine: bool = False) -> None: +//| def __init__(self, *, width: int, bit_depth: int, rgb_pins: Sequence[digitalio.DigitalInOut], addr_pins: Sequence[digitalio.DigitalInOut], clock_pin: digitalio.DigitalInOut, latch_pin: digitalio.DigitalInOut, output_enable_pin: digitalio.DigitalInOut, doublebuffer: bool = True, framebuffer: Optional[WriteableBuffer] = None, height: int = 0, tile: int = 1, serpentine: bool = True) -> None: //| """Create a RGBMatrix object with the given attributes. The height of //| the display is determined by the number of rgb and address pins and the number of tiles: //| ``len(rgb_pins) // 3 * 2 ** len(address_pins) * abs(tile)``. With 6 RGB pins, 4 @@ -185,7 +185,7 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n { MP_QSTR_framebuffer, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = mp_const_none } }, { MP_QSTR_height, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 0 } }, { MP_QSTR_tile, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 1 } }, - { MP_QSTR_serpentine, MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = false } }, + { MP_QSTR_serpentine, MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = true } }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); From 65a883a74c0d423cd36ff392a9d02d7869470556 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 28 Jan 2021 13:01:11 -0600 Subject: [PATCH 748/770] bump esp-idf cache tag .. we are seeing failures that we have previously diagnosed as a bad cache. The github ui provides no way to update or delete a cache, so this is our workaround. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0dbccdf4dde11..60244dae64872 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -467,7 +467,7 @@ jobs: id: idf-cache with: path: ${{ github.workspace }}/.idf_tools - key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210122 + key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210128 - name: Clone IDF submodules run: | (cd $IDF_PATH && git submodule update --init) From 67f128c0cf95910c03fb1e0e3d8582efc8c03d09 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 28 Jan 2021 14:42:39 -0600 Subject: [PATCH 749/770] Fixing microcontroller.cpu on muti-core cpus and adding microcontroller.cpus --- .../raspberrypi/common-hal/microcontroller/__init__.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ports/raspberrypi/common-hal/microcontroller/__init__.c b/ports/raspberrypi/common-hal/microcontroller/__init__.c index e454ffa1b73f2..acb4b971cc489 100644 --- a/ports/raspberrypi/common-hal/microcontroller/__init__.c +++ b/ports/raspberrypi/common-hal/microcontroller/__init__.c @@ -80,6 +80,7 @@ void common_hal_mcu_reset(void) { // The singleton microcontroller.Processor object, bound to microcontroller.cpu // It currently only has properties, and no state. +#if CIRCUITPY_PROCESSOR_COUNT > 1 static const mcu_processor_obj_t processor0 = { .base = { .type = &mcu_processor_type, @@ -92,7 +93,7 @@ static const mcu_processor_obj_t processor1 = { }, }; -const mp_rom_obj_tuple_t common_hal_mcu_processor_obj = { +const mp_rom_obj_tuple_t common_hal_multi_processor_obj = { {&mp_type_tuple}, CIRCUITPY_PROCESSOR_COUNT, { @@ -100,6 +101,13 @@ const mp_rom_obj_tuple_t common_hal_mcu_processor_obj = { MP_ROM_PTR(&processor1) } }; +#endif + +const mcu_processor_obj_t common_hal_mcu_processor_obj = { + .base = { + .type = &mcu_processor_type, + }, +}; #if CIRCUITPY_NVM && CIRCUITPY_INTERNAL_NVM_SIZE > 0 // The singleton nvm.ByteArray object. From cfd6ffc649eadbc3b8d0f33d13ec302873cb9743 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 28 Jan 2021 16:06:30 -0600 Subject: [PATCH 750/770] Adding files for cpu temperature fix --- shared-bindings/microcontroller/Processor.c | 9 +++++---- shared-bindings/microcontroller/__init__.c | 11 ++++++++++- shared-bindings/microcontroller/__init__.h | 3 ++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/shared-bindings/microcontroller/Processor.c b/shared-bindings/microcontroller/Processor.c index 573f53282194f..67001c8314cd4 100644 --- a/shared-bindings/microcontroller/Processor.c +++ b/shared-bindings/microcontroller/Processor.c @@ -44,11 +44,12 @@ //| print(microcontroller.cpu.temperature) //| //| Note that on chips with more than one cpu (such as the RP2040) -//| you will need to index the cpu to select which one to get the -//| readings from. i.e. +//| microcontroller.cpu will return the value for CPU 0. +//| To get values from other CPUs use microcontroller.cpus indexed by +//| the number of the desired cpu. i.e. //| -//| print(microcontroller.cpu[0].temperature) -//| print(microcontroller.cpu[1].frequency)""" +//| print(microcontroller.cpus[0].temperature) +//| print(microcontroller.cpus[1].frequency)""" //| //| def __init__(self) -> None: diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index 035587c30f247..4ba8561312753 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -53,7 +53,13 @@ //| cpu: Processor //| """CPU information and control, such as ``cpu.temperature`` and ``cpu.frequency`` //| (clock frequency). -//| This object is the sole instance of `microcontroller.Processor`.""" +//| This object is an instance of `microcontroller.Processor`.""" +//| + +//| cpus: Processor +//| """CPU information and control, such as ``cpus[0].temperature`` and ``cpus[1].frequency`` +//| (clock frequency) on chips with more than 1 cpu. the index selects which cpu. +//| This object is an instance of `microcontroller.Processor`.""" //| //| def delay_us(delay: int) -> None: @@ -155,6 +161,9 @@ const mp_obj_module_t mcu_pin_module = { STATIC const mp_rom_map_elem_t mcu_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_microcontroller) }, { MP_ROM_QSTR(MP_QSTR_cpu), MP_ROM_PTR(&common_hal_mcu_processor_obj) }, +#if CIRCUITPY_PROCESSOR_COUNT > 1 + { MP_ROM_QSTR(MP_QSTR_cpus), MP_ROM_PTR(&common_hal_multi_processor_obj) }, +#endif { MP_ROM_QSTR(MP_QSTR_delay_us), MP_ROM_PTR(&mcu_delay_us_obj) }, { MP_ROM_QSTR(MP_QSTR_disable_interrupts), MP_ROM_PTR(&mcu_disable_interrupts_obj) }, { MP_ROM_QSTR(MP_QSTR_enable_interrupts), MP_ROM_PTR(&mcu_enable_interrupts_obj) }, diff --git a/shared-bindings/microcontroller/__init__.h b/shared-bindings/microcontroller/__init__.h index 39d3e718b4da0..733127d561d7b 100644 --- a/shared-bindings/microcontroller/__init__.h +++ b/shared-bindings/microcontroller/__init__.h @@ -48,7 +48,8 @@ extern const mp_obj_dict_t mcu_pin_globals; #if CIRCUITPY_PROCESSOR_COUNT == 1 extern const mcu_processor_obj_t common_hal_mcu_processor_obj; #elif CIRCUITPY_PROCESSOR_COUNT > 1 -extern const mp_rom_obj_tuple_t common_hal_mcu_processor_obj; +extern const mcu_processor_obj_t common_hal_mcu_processor_obj; +extern const mp_rom_obj_tuple_t common_hal_multi_processor_obj; #else #error "Invalid processor count" #endif From 689fba764a364a9284e80b59aa4b5dcc9e23c38c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 29 Jan 2021 09:45:00 -0600 Subject: [PATCH 751/770] ulab: update to 1.7.2 Closes #4086 --- extmod/ulab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extmod/ulab b/extmod/ulab index 8b804f3bcd8c5..743d86487c83e 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit 8b804f3bcd8c5a3ac1b3e09e0ff7faf8270751de +Subproject commit 743d86487c83e42024ed508ed50499ad0a527d5d From 66e0f2dcff75cebefa6a8cdc85169d21682b0032 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 29 Jan 2021 11:36:27 -0600 Subject: [PATCH 752/770] workflows: use actions/cache@v2 --- .github/workflows/build.yml | 2 +- .github/workflows/pre-commit.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 60244dae64872..644c67c69c3e4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -462,7 +462,7 @@ jobs: - run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/* - name: CircuitPython version run: git describe --dirty --tags - - uses: actions/cache@v1 + - uses: actions/cache@v2 name: Fetch IDF tool cache id: idf-cache with: diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index af62072c89ac8..76bfd7786bfc6 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -21,7 +21,7 @@ jobs: run: git submodule update --init extmod/ulab - name: set PY run: echo >>$GITHUB_ENV PY="$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" - - uses: actions/cache@v1 + - uses: actions/cache@v2 with: path: ~/.cache/pre-commit key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} From e1838ff335f2daef9ad2389b7231b73da43057eb Mon Sep 17 00:00:00 2001 From: root Date: Fri, 29 Jan 2021 11:57:36 -0600 Subject: [PATCH 753/770] Fix typo in documentation. --- shared-bindings/microcontroller/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index 4ba8561312753..dba66fa4f2b1f 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -58,7 +58,7 @@ //| cpus: Processor //| """CPU information and control, such as ``cpus[0].temperature`` and ``cpus[1].frequency`` -//| (clock frequency) on chips with more than 1 cpu. the index selects which cpu. +//| (clock frequency) on chips with more than 1 cpu. The index selects which cpu. //| This object is an instance of `microcontroller.Processor`.""" //| From 067f42b4f869b34a108ccd9bf6de049f928b10b5 Mon Sep 17 00:00:00 2001 From: James Bowman Date: Fri, 29 Jan 2021 12:25:59 -0800 Subject: [PATCH 754/770] Add Gameduino 3X Dazzler support on raspberry_pi_pico Tested with hardware. Looks good. Follow on from #4054 --- ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk b/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk index 69ff56fef84f8..54c1306606480 100644 --- a/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk +++ b/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk @@ -7,3 +7,5 @@ CHIP_VARIANT = RP2040 CHIP_FAMILY = rp2 INTERNAL_FLASH_FILESYSTEM = 1 + +CIRCUITPY__EVE = 1 From acbf66dacc198588323d1887e2599acb5d71cf12 Mon Sep 17 00:00:00 2001 From: James Bowman Date: Fri, 29 Jan 2021 12:33:37 -0800 Subject: [PATCH 755/770] Make sys.platform "RP2040" on raspberrypi [#4091] --- ports/raspberrypi/mpconfigport.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/raspberrypi/mpconfigport.h b/ports/raspberrypi/mpconfigport.h index 7431519317d02..77d1ff08058cd 100644 --- a/ports/raspberrypi/mpconfigport.h +++ b/ports/raspberrypi/mpconfigport.h @@ -27,6 +27,8 @@ #ifndef __INCLUDED_MPCONFIGPORT_H #define __INCLUDED_MPCONFIGPORT_H +#define MICROPY_PY_SYS_PLATFORM "RP2040" + #define CIRCUITPY_INTERNAL_NVM_SIZE 0 #define CIRCUITPY_DEFAULT_STACK_SIZE (24*1024) From 534512878422b5335cb41f24333a9340b2738048 Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Fri, 29 Jan 2021 01:59:53 +0000 Subject: [PATCH 756/770] Translated using Weblate (French) Currently translated at 100.0% (925 of 925 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index 1842d6d3e5c75..1734241fbb9ea 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-01-17 12:55+0000\n" +"PO-Revision-Date: 2021-01-30 02:32+0000\n" "Last-Translator: Hugo Dahl \n" "Language: fr\n" "MIME-Version: 1.0\n" @@ -70,6 +70,8 @@ msgstr "%%c nécessite un chiffre entier 'int' ou un caractère 'char'" msgid "" "%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" +"%d broches d'adresse, %d broches RGB et %d pour tile indique une hauteur de " +"%d, et non %d" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" @@ -3827,7 +3829,7 @@ msgstr "le seuil doit être dans la portée 0-65536" #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "tile must be greater than zero" -msgstr "" +msgstr "tile doit être plus que zéro" #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" @@ -4047,7 +4049,7 @@ msgstr "watchdog timeout doit être supérieur à 0" #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" -msgstr "width doit être plus grand que zero" +msgstr "width doit être plus que zero" #: ports/esp32s2/common-hal/wifi/Radio.c msgid "wifi is not enabled" From 65da2bb125aaabc2f926ac8679a025661c6eed74 Mon Sep 17 00:00:00 2001 From: Antonin ENFRUN Date: Thu, 28 Jan 2021 15:14:28 +0000 Subject: [PATCH 757/770] Translated using Weblate (French) Currently translated at 100.0% (925 of 925 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index 1734241fbb9ea..20c8ea74341b3 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -9,7 +9,7 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" "PO-Revision-Date: 2021-01-30 02:32+0000\n" -"Last-Translator: Hugo Dahl \n" +"Last-Translator: Antonin ENFRUN \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" @@ -54,7 +54,7 @@ msgstr " Fichier \"%q\", ligne %d" #: py/builtinhelp.c msgid " is of type %q\n" -msgstr "" +msgstr " est de type %q\n" #: main.c msgid " output:\n" @@ -834,7 +834,7 @@ msgstr "La broche 'Data 0' doit être aligné sur l'octet" #: ports/esp32s2/common-hal/displayio/ParallelBus.c msgid "Data 0 pin must be byte aligned." -msgstr "" +msgstr "La broche Data 0 doit être aligné sur l'octet." #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" @@ -893,7 +893,7 @@ msgstr "Erreur dans l'expression régulière" #: shared-bindings/socketpool/Socket.c msgid "Error: Failure to bind" -msgstr "" +msgstr "Erreur : Impossible de lier" #: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c @@ -1292,7 +1292,7 @@ msgstr "Taille invalide" #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Invalid socket for TLS" -msgstr "" +msgstr "Socket non valide pour TLS" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" @@ -1300,7 +1300,7 @@ msgstr "État invalide" #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Invalid use of TLS Socket" -msgstr "" +msgstr "Utilisation incorrecte de socket TLS" #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" @@ -1320,7 +1320,7 @@ msgstr "Longueur de mot / bit invalide" #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Issue setting SO_REUSEADDR" -msgstr "" +msgstr "Problème en activant SO_REUSEADDR" #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" @@ -3425,7 +3425,7 @@ msgstr "le nombre de points doit être d'au moins 2" #: py/builtinhelp.c msgid "object " -msgstr "" +msgstr "objet " #: py/obj.c msgid "object '%q' is not a tuple or list" @@ -4053,7 +4053,7 @@ msgstr "width doit être plus que zero" #: ports/esp32s2/common-hal/wifi/Radio.c msgid "wifi is not enabled" -msgstr "" +msgstr "wifi n’est pas activé" #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" From 5975dee4d7f5866fba674584340c79baeaff115b Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Wed, 27 Jan 2021 16:06:05 +0000 Subject: [PATCH 758/770] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (925 of 925 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 3e397a0ed4664..b8e98ebd61f1c 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-01-22 15:30+0000\n" +"PO-Revision-Date: 2021-01-30 02:32+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -68,6 +68,8 @@ msgstr "%%c requer int ou char" msgid "" "%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" +"%d pinos de endereço, %d pinos rgb e %d blocos indicam uma altura com %d, " +"não %d" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" @@ -830,7 +832,7 @@ msgstr "O pino de dados 0 deve ser alinhado por bytes" #: ports/esp32s2/common-hal/displayio/ParallelBus.c msgid "Data 0 pin must be byte aligned." -msgstr "" +msgstr "O pino de dados 0 deve ser alinhado por bytes." #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" @@ -3815,7 +3817,7 @@ msgstr "Limite deve estar no alcance de 0-65536" #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "tile must be greater than zero" -msgstr "" +msgstr "o bloco deve ser maior que zero" #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" From 75f7753a73c9b929cd1bb21939a12d7755c92887 Mon Sep 17 00:00:00 2001 From: hexthat Date: Wed, 27 Jan 2021 20:34:00 +0000 Subject: [PATCH 759/770] Translated using Weblate (Chinese (Pinyin)) Currently translated at 100.0% (925 of 925 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/ --- locale/zh_Latn_pinyin.po | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 07e461bf89d86..2af80013b133a 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-01-25 19:32+0000\n" +"PO-Revision-Date: 2021-01-30 02:32+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" "Language: zh_Latn_pinyin\n" @@ -69,6 +69,8 @@ msgstr "%%c xūyào zhěngshù huò char" msgid "" "%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" +"%d de zhǐ yǐn jiǎo , %d rgb yǐn jiǎo hé %d qiē piàn biǎo shì %d de gāo dù, " +"ér bù shì %d" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" @@ -817,7 +819,7 @@ msgstr "Shùjù 0 de yǐn jiǎo bìxū shì zì jié duìqí" #: ports/esp32s2/common-hal/displayio/ParallelBus.c msgid "Data 0 pin must be byte aligned." -msgstr "" +msgstr "shù jù 0 yǐn jiǎo bì xū àn zì jié duì qí." #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" @@ -3771,7 +3773,7 @@ msgstr "yùzhí bìxū zài fànwéi 0-65536" #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "tile must be greater than zero" -msgstr "" +msgstr "cí tiē bì xū dà yú líng" #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" From 34fe152fcff402a71482e5866a0f840021b44eaa Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Sat, 30 Jan 2021 14:00:14 +0530 Subject: [PATCH 760/770] extend include path --- ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c b/ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c index 9184d1561a20b..f23ccda7774e8 100644 --- a/ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c +++ b/ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c @@ -30,7 +30,7 @@ #include "shared-bindings/watchdog/__init__.h" #include "shared-bindings/microcontroller/__init__.h" -#include "hardware/watchdog.h" +#include "src/rp2_common/hardware_watchdog/include/hardware/watchdog.h" void common_hal_watchdog_feed(watchdog_watchdogtimer_obj_t *self) { watchdog_update(); From ddd516a6833aba684fa37a099da7e8646e2d375d Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Fri, 29 Jan 2021 16:40:49 -0500 Subject: [PATCH 761/770] Fix default timeout --- ports/esp32s2/common-hal/socketpool/Socket.c | 6 +++--- ports/esp32s2/common-hal/socketpool/SocketPool.c | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ports/esp32s2/common-hal/socketpool/Socket.c b/ports/esp32s2/common-hal/socketpool/Socket.c index 69ef41c6ec1b2..fc50ca3ab2599 100644 --- a/ports/esp32s2/common-hal/socketpool/Socket.c +++ b/ports/esp32s2/common-hal/socketpool/Socket.c @@ -135,7 +135,7 @@ socketpool_socket_obj_t* common_hal_socketpool_socket_accept(socketpool_socket_o while (newsoc == -1 && !timed_out && !mp_hal_is_interrupted()) { - if (self->timeout_ms != (uint)-1) { + if (self->timeout_ms != (uint)-1 && self->timeout_ms != 0) { timed_out = supervisor_ticks_ms64() - start_ticks >= self->timeout_ms; } RUN_BACKGROUND_TASKS; @@ -251,7 +251,7 @@ mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, while (received == -1 && !timed_out && !mp_hal_is_interrupted()) { - if (self->timeout_ms != (uint)-1) { + if (self->timeout_ms != (uint)-1 && self->timeout_ms != 0) { timed_out = supervisor_ticks_ms64() - start_ticks >= self->timeout_ms; } RUN_BACKGROUND_TASKS; @@ -362,7 +362,7 @@ mp_uint_t common_hal_socketpool_socket_recvfrom_into(socketpool_socket_obj_t* se while (received == -1 && !timed_out && !mp_hal_is_interrupted()) { - if (self->timeout_ms != (uint)-1) { + if (self->timeout_ms != (uint)-1 && self->timeout_ms != 0) { timed_out = supervisor_ticks_ms64() - start_ticks >= self->timeout_ms; } RUN_BACKGROUND_TASKS; diff --git a/ports/esp32s2/common-hal/socketpool/SocketPool.c b/ports/esp32s2/common-hal/socketpool/SocketPool.c index 5821728ce51e5..70a8b4eca5069 100644 --- a/ports/esp32s2/common-hal/socketpool/SocketPool.c +++ b/ports/esp32s2/common-hal/socketpool/SocketPool.c @@ -77,6 +77,7 @@ socketpool_socket_obj_t* common_hal_socketpool_socket(socketpool_socketpool_obj_ sock->type = socket_type; sock->family = addr_family; sock->ipproto = ipproto; + sock->timeout_ms = (uint)-1; sock->tls = NULL; sock->ssl_context = NULL; From 0dbd3293a94e6f7ca6f0ad095c6834d801d726eb Mon Sep 17 00:00:00 2001 From: Patrick Van Oosterwijck Date: Sat, 30 Jan 2021 18:35:35 -0700 Subject: [PATCH 762/770] Add board Silicognition LLC M4-Shim --- .../boards/silicognition-m4-shim/board.c | 38 +++++++++++++ .../silicognition-m4-shim/mpconfigboard.h | 33 ++++++++++++ .../silicognition-m4-shim/mpconfigboard.mk | 14 +++++ .../boards/silicognition-m4-shim/pins.c | 54 +++++++++++++++++++ 4 files changed, 139 insertions(+) create mode 100644 ports/atmel-samd/boards/silicognition-m4-shim/board.c create mode 100644 ports/atmel-samd/boards/silicognition-m4-shim/mpconfigboard.h create mode 100644 ports/atmel-samd/boards/silicognition-m4-shim/mpconfigboard.mk create mode 100644 ports/atmel-samd/boards/silicognition-m4-shim/pins.c diff --git a/ports/atmel-samd/boards/silicognition-m4-shim/board.c b/ports/atmel-samd/boards/silicognition-m4-shim/board.c new file mode 100644 index 0000000000000..5fca974e9edae --- /dev/null +++ b/ports/atmel-samd/boards/silicognition-m4-shim/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 "supervisor/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/atmel-samd/boards/silicognition-m4-shim/mpconfigboard.h b/ports/atmel-samd/boards/silicognition-m4-shim/mpconfigboard.h new file mode 100644 index 0000000000000..5028679edc12b --- /dev/null +++ b/ports/atmel-samd/boards/silicognition-m4-shim/mpconfigboard.h @@ -0,0 +1,33 @@ +#define MICROPY_HW_BOARD_NAME "Silicognition LLC M4-Shim" +#define MICROPY_HW_MCU_NAME "samd51j19" + +#define CIRCUITPY_MCU_FAMILY samd51 + +// Rev E + +#define MICROPY_HW_LED_STATUS (&pin_PA23) +#define MICROPY_HW_NEOPIXEL (&pin_PB03) + +// These are pins not to reset. +// QSPI Data pins +#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11) +// QSPI CS, QSPI SCK and NeoPixel pin +#define MICROPY_PORT_B (PORT_PB03 | PORT_PB10 | PORT_PB11) +#define MICROPY_PORT_C (0) +#define MICROPY_PORT_D (0) + +#define BOARD_HAS_CRYSTAL 1 + +#define DEFAULT_I2C_BUS_SCL (&pin_PA13) +#define DEFAULT_I2C_BUS_SDA (&pin_PA12) + +#define DEFAULT_SPI_BUS_SCK (&pin_PA17) +#define DEFAULT_SPI_BUS_MOSI (&pin_PB23) +#define DEFAULT_SPI_BUS_MISO (&pin_PB22) + +#define DEFAULT_UART_BUS_RX (&pin_PB17) +#define DEFAULT_UART_BUS_TX (&pin_PB16) + +// 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/silicognition-m4-shim/mpconfigboard.mk b/ports/atmel-samd/boards/silicognition-m4-shim/mpconfigboard.mk new file mode 100644 index 0000000000000..bf88cd52d0080 --- /dev/null +++ b/ports/atmel-samd/boards/silicognition-m4-shim/mpconfigboard.mk @@ -0,0 +1,14 @@ +USB_VID = 0x1209 +USB_PID = 0xF500 +USB_PRODUCT = "M4-Shim" +USB_MANUFACTURER = "Silicognition LLC" + +CHIP_VARIANT = SAMD51J19A +CHIP_FAMILY = samd51 + +QSPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICE_COUNT = 1 +EXTERNAL_FLASH_DEVICES = GD25Q16C +LONGINT_IMPL = MPZ + +CIRCUITPY_VECTORIO = 1 diff --git a/ports/atmel-samd/boards/silicognition-m4-shim/pins.c b/ports/atmel-samd/boards/silicognition-m4-shim/pins.c new file mode 100644 index 0000000000000..b7afd044e9afa --- /dev/null +++ b/ports/atmel-samd/boards/silicognition-m4-shim/pins.c @@ -0,0 +1,54 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA02) }, + + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA05) }, + + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB08) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_PB08) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PB09) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_PB09) }, + + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA04) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_PA04) }, + + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_PA06) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_PA17) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB23) }, + { MP_ROM_QSTR(MP_QSTR_D24), MP_ROM_PTR(&pin_PB23) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB22) }, + { MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_PB22) }, + + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PB17) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB17) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PB16) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB16) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA12) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA14) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA16) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA20) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA21) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA23) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PB03) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); From 414db718e45f3ee59083e211428da7aa0002faa9 Mon Sep 17 00:00:00 2001 From: Patrick Van Oosterwijck Date: Sat, 30 Jan 2021 19:17:20 -0700 Subject: [PATCH 763/770] Add board to github workflow --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 644c67c69c3e4..b0f1dd1607dc0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -304,6 +304,7 @@ jobs: - "seeeduino_xiao" - "serpente" - "shirtty" + - "silicognition-m4-shim" - "simmel" - "snekboard" - "sparkfun_lumidrive" From 6dba7a146d806f09d90b1d3ceec4af699603605e Mon Sep 17 00:00:00 2001 From: Aditya Date: Wed, 6 Jan 2021 22:58:30 +0100 Subject: [PATCH 764/770] Add support for Lilygo TTGO T8 ESP32-S2 --- .github/workflows/build.yml | 1 + locale/circuitpython.pot | 1 + .../boards/lilygo_ttgo_t8_s2_st7789/board.c | 52 ++++++++++++++++++ .../lilygo_ttgo_t8_s2_st7789/mpconfigboard.h | 36 ++++++++++++ .../lilygo_ttgo_t8_s2_st7789/mpconfigboard.mk | 18 ++++++ .../boards/lilygo_ttgo_t8_s2_st7789/pins.c | 55 +++++++++++++++++++ .../boards/lilygo_ttgo_t8_s2_st7789/sdkconfig | 31 +++++++++++ 7 files changed, 194 insertions(+) create mode 100644 ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/board.c create mode 100644 ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h create mode 100644 ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.mk create mode 100644 ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/pins.c create mode 100644 ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/sdkconfig diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 644c67c69c3e4..adf76f7aa99e2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -443,6 +443,7 @@ jobs: - "espressif_kaluga_1" - "espressif_saola_1_wroom" - "espressif_saola_1_wrover" + - "lilygo_ttgo_t8_s2_st7789" - "microdev_micro_s2" - "muselab_nanoesp32_s2" - "targett_module_clip_wroom" diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index de902f62fc4d9..c0aa893279c2d 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -3504,6 +3504,7 @@ msgstr "" #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h +#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h #: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h diff --git a/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/board.c b/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/board.c new file mode 100644 index 0000000000000..aaef97c7d1404 --- /dev/null +++ b/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/board.c @@ -0,0 +1,52 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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 "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // USB + common_hal_never_reset_pin(&pin_GPIO19); + common_hal_never_reset_pin(&pin_GPIO20); + + // Debug UART +#ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} + +void board_deinit(void) { +} diff --git a/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h b/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h new file mode 100644 index 0000000000000..c9020c2002035 --- /dev/null +++ b/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h @@ -0,0 +1,36 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 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. + */ + +//Micropython setup + +#define MICROPY_HW_BOARD_NAME "LILYGO TTGO T8 ESP32-S2 w/Display" +#define MICROPY_HW_MCU_NAME "ESP32S2" + +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) + +#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") + +#define AUTORESET_DELAY_MS 500 diff --git a/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.mk b/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.mk new file mode 100644 index 0000000000000..38a7ed1fb7bda --- /dev/null +++ b/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.mk @@ -0,0 +1,18 @@ +USB_VID = 0x303a +USB_PID = 0x8007 +USB_PRODUCT = "TTGO T8 ESP32-S2" +USB_MANUFACTURER = "LILYGO" +USB_DEVICES = "CDC,MSC,HID" + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = MPZ + +# The default queue depth of 16 overflows on release builds, +# so increase it to 32. +CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_MODULE = wroom diff --git a/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/pins.c b/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/pins.c new file mode 100644 index 0000000000000..bda0fd227acc1 --- /dev/null +++ b/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/pins.c @@ -0,0 +1,55 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_TX1), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_RX1), MP_ROM_PTR(&pin_GPIO18) }, + + // SD Card + { MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_SD_CLK), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO10) }, + + // 1.14 inch LCD ST7789 + { MP_ROM_QSTR(MP_QSTR_LCD_MISO), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_LCD_MOSI), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_LCD_CLK), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_LCD_RST), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_LCD_BCKL), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D_C), MP_ROM_PTR(&pin_GPIO37) }, + + // Peripheral Power control + { MP_ROM_QSTR(MP_QSTR_PE_POWER), MP_ROM_PTR(&pin_GPIO14) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); diff --git a/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/sdkconfig b/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/sdkconfig new file mode 100644 index 0000000000000..ce6fe832bfe9f --- /dev/null +++ b/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/sdkconfig @@ -0,0 +1,31 @@ +CONFIG_ESP32S2_SPIRAM_SUPPORT=y + +# +# SPI RAM config +# +CONFIG_SPIRAM_TYPE_ESPPSRAM64=y +CONFIG_SPIRAM_SIZE=8388608 + +# +# PSRAM clock and cs IO for ESP32S2 +# +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM clock and cs IO for ESP32S2 + +CONFIG_SPIRAM_SPIWP_SD3_PIN=28 +CONFIG_SPIRAM_SPEED_40M=y +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +CONFIG_SPIRAM_USE_MALLOC=y +CONFIG_SPIRAM_MEMTEST=y +CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=16384 +CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768 +# end of SPI RAM config + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="TTGO-T8-ESP32-S2" +CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y +# end of LWIP From 9e160985d7260c9cfe953ffe3118439d6c9cab59 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Mon, 1 Feb 2021 04:45:51 +0100 Subject: [PATCH 765/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 152 +++++++++++++++++++++++++++++++++++++-- locale/cs.po | 152 +++++++++++++++++++++++++++++++++++++-- locale/de_DE.po | 152 +++++++++++++++++++++++++++++++++++++-- locale/el.po | 152 +++++++++++++++++++++++++++++++++++++-- locale/es.po | 152 +++++++++++++++++++++++++++++++++++++-- locale/fil.po | 152 +++++++++++++++++++++++++++++++++++++-- locale/fr.po | 152 +++++++++++++++++++++++++++++++++++++-- locale/hi.po | 152 +++++++++++++++++++++++++++++++++++++-- locale/it_IT.po | 152 +++++++++++++++++++++++++++++++++++++-- locale/ja.po | 152 +++++++++++++++++++++++++++++++++++++-- locale/ko.po | 152 +++++++++++++++++++++++++++++++++++++-- locale/nl.po | 152 +++++++++++++++++++++++++++++++++++++-- locale/pl.po | 152 +++++++++++++++++++++++++++++++++++++-- locale/pt_BR.po | 152 +++++++++++++++++++++++++++++++++++++-- locale/sv.po | 152 +++++++++++++++++++++++++++++++++++++-- locale/zh_Latn_pinyin.po | 152 +++++++++++++++++++++++++++++++++++++-- 16 files changed, 2352 insertions(+), 80 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index e1112339823c8..651ecff3f0363 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -344,6 +344,10 @@ msgstr "Semua perangkat UART sedang digunakan" msgid "All event channels in use" msgstr "Semua channel event sedang digunakan" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "All state machines in use" +msgstr "" + #: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "All sync event channels in use" msgstr "Semua channel event yang disinkronisasi sedang digunakan" @@ -392,6 +396,7 @@ msgstr "AnalogIn tidak didukung pada pin yang diberikan" #: ports/cxd56/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c msgid "AnalogOut functionality not supported" msgstr "fungsionalitas AnalogOut tidak didukung" @@ -593,6 +598,7 @@ msgstr "Tidak dapat menghapus nilai" #: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c +#: ports/raspberrypi/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" msgstr "Tidak bisa mendapatkan pull pada saat mode output" @@ -882,7 +888,8 @@ msgstr "Error pada regex" msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c +#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c #: shared-bindings/terminalio/Terminal.c @@ -1064,6 +1071,10 @@ msgstr "operasi I/O pada file tertutup" msgid "I2C Init Error" msgstr "Gagal Inisialisasi I2C" +#: ports/raspberrypi/common-hal/busio/I2C.c +msgid "I2C peripheral in use" +msgstr "" + #: shared-bindings/audiobusio/I2SOut.c msgid "I2SOut not available" msgstr "" @@ -1089,6 +1100,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Ukuran penyangga salah" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Init program size invalid" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" msgstr "" @@ -1101,6 +1116,31 @@ msgstr "" msgid "Input/output error" msgstr "Kesalahan input/output" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d jumps on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d waits on input outside of count" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "Otentikasi tidak cukup" @@ -1152,7 +1192,7 @@ msgstr "Pin DAC yang diberikan tidak valid" #: ports/atmel-samd/common-hal/pwmio/PWMOut.c #: ports/cxd56/common-hal/pwmio/PWMOut.c ports/nrf/common-hal/pwmio/PWMOut.c -#: shared-bindings/pwmio/PWMOut.c +#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c msgid "Invalid PWM frequency" msgstr "Frekuensi PWM tidak valid" @@ -1246,6 +1286,8 @@ msgstr "Pin untuk channel kanan tidak valid" #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/SPI.c msgid "Invalid pins" msgstr "Pin-pin tidak valid" @@ -1367,6 +1409,36 @@ msgstr "Penundaan mulai mikrofon harus dalam kisaran 0,0 hingga 1,0" msgid "Missing MISO or MOSI Pin" msgstr "Tidak menemukan Pin MISO atau MOSI" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgstr "" + #: shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "Harus berupa subclass %q." @@ -1420,14 +1492,14 @@ msgstr "Tidak ada Pin MOSI" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Tidak pin RX" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No TX pin" msgstr "Tidak ada pin TX" @@ -1484,6 +1556,10 @@ msgstr "Tidak ada lagi penghitung waktu yang tersedia pada pin ini." msgid "No network with that ssid" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "No out in program" +msgstr "" + #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" msgstr "Tidak ada pull-down pada pin; 1Mohm direkomendasikan" @@ -1541,6 +1617,10 @@ msgstr "Parity ganjil tidak didukung" msgid "Only 8 or 16 bit mono with " msgstr "Hanya 8 atau 16 bit mono dengan " +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Only IN/OUT of up to 8 supported" +msgstr "" + #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" @@ -1619,6 +1699,7 @@ msgstr "" "konstruksi." #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c +#: ports/raspberrypi/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" msgstr "ParallelBus belum didukung" @@ -1631,11 +1712,20 @@ msgstr "" msgid "Permission denied" msgstr "Izin ditolak" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Pin count must be at least 1" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Pin count too large" +msgstr "" + #: ports/atmel-samd/common-hal/analogio/AnalogIn.c #: ports/cxd56/common-hal/analogio/AnalogIn.c #: ports/esp32s2/common-hal/analogio/AnalogIn.c #: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c #: ports/nrf/common-hal/analogio/AnalogIn.c +#: ports/raspberrypi/common-hal/analogio/AnalogIn.c #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Pin does not have ADC capabilities" msgstr "Pin tidak mempunya kemampuan untuk ADC (Analog Digital Converter)" @@ -1699,10 +1789,34 @@ msgstr "" msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does IN without loading ISR" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does OUT without loading OSR" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program must contain at least one 16-bit instruction." +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program size invalid" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program too large" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Pull tidak digunakan saat arah output." +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c +msgid "RAISE mode is not implemented" +msgstr "" + #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" msgstr "Kesalahan DeInit RNG" @@ -1786,6 +1900,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" msgstr "SDA atau SCL membutuhkan pull up" @@ -1807,6 +1922,10 @@ msgstr "Kesalahan Init SPI" msgid "SPI Re-initialization error" msgstr "Kesalahan Inisialisasi ulang SPI" +#: ports/raspberrypi/common-hal/busio/SPI.c +msgid "SPI peripheral in use" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Sample rate must be positive" msgstr "Tingkat sampel harus positif" @@ -1837,6 +1956,14 @@ msgstr "Serializer sedang digunakan" msgid "Server side context cannot have hostname" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Set pin count must be between 1 and 5" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Side set pin count must be between 1 and 5" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "" @@ -2009,6 +2136,10 @@ msgstr "Kesalahan Init UART" msgid "UART Re-init error" msgstr "Kesalahan Re-init UART" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART not yet supported" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART write error" msgstr "Kesalahan penulisan UART" @@ -2115,7 +2246,8 @@ msgstr "" "perangkat lain ditolak atau diabaikan." #: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/esp32s2/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/esp32s2/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c msgid "Unsupported baudrate" msgstr "Baudrate tidak didukung" @@ -2167,6 +2299,7 @@ msgid "WARNING: Your code filename has two extensions\n" msgstr "PERINGATAN: Nama file kode anda mempunyai dua ekstensi\n" #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" @@ -3573,6 +3706,14 @@ msgstr "" msgid "pressing both buttons at start up.\n" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "pull_threshold must be between 1 and 32" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "push_threshold must be between 1 and 32" +msgstr "" + #: extmod/modutimeq.c msgid "queue overflow" msgstr "antrian meluap (overflow)" @@ -3776,6 +3917,7 @@ msgstr "" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index 9181d1f709421..dfb4b53660423 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -342,6 +342,10 @@ msgstr "" msgid "All event channels in use" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "All state machines in use" +msgstr "" + #: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "All sync event channels in use" msgstr "" @@ -390,6 +394,7 @@ msgstr "" #: ports/cxd56/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c msgid "AnalogOut functionality not supported" msgstr "" @@ -589,6 +594,7 @@ msgstr "" #: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c +#: ports/raspberrypi/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" msgstr "" @@ -866,7 +872,8 @@ msgstr "" msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c +#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c #: shared-bindings/terminalio/Terminal.c @@ -1048,6 +1055,10 @@ msgstr "" msgid "I2C Init Error" msgstr "" +#: ports/raspberrypi/common-hal/busio/I2C.c +msgid "I2C peripheral in use" +msgstr "" + #: shared-bindings/audiobusio/I2SOut.c msgid "I2SOut not available" msgstr "" @@ -1071,6 +1082,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Init program size invalid" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" msgstr "" @@ -1083,6 +1098,31 @@ msgstr "" msgid "Input/output error" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d jumps on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d waits on input outside of count" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "" @@ -1134,7 +1174,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pwmio/PWMOut.c #: ports/cxd56/common-hal/pwmio/PWMOut.c ports/nrf/common-hal/pwmio/PWMOut.c -#: shared-bindings/pwmio/PWMOut.c +#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c msgid "Invalid PWM frequency" msgstr "" @@ -1228,6 +1268,8 @@ msgstr "" #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/SPI.c msgid "Invalid pins" msgstr "" @@ -1349,6 +1391,36 @@ msgstr "" msgid "Missing MISO or MOSI Pin" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgstr "" + #: shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "" @@ -1402,14 +1474,14 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No TX pin" msgstr "" @@ -1466,6 +1538,10 @@ msgstr "" msgid "No network with that ssid" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "No out in program" +msgstr "" + #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" msgstr "" @@ -1521,6 +1597,10 @@ msgstr "" msgid "Only 8 or 16 bit mono with " msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Only IN/OUT of up to 8 supported" +msgstr "" + #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" @@ -1593,6 +1673,7 @@ msgid "" msgstr "" #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c +#: ports/raspberrypi/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" msgstr "" @@ -1605,11 +1686,20 @@ msgstr "" msgid "Permission denied" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Pin count must be at least 1" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Pin count too large" +msgstr "" + #: ports/atmel-samd/common-hal/analogio/AnalogIn.c #: ports/cxd56/common-hal/analogio/AnalogIn.c #: ports/esp32s2/common-hal/analogio/AnalogIn.c #: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c #: ports/nrf/common-hal/analogio/AnalogIn.c +#: ports/raspberrypi/common-hal/analogio/AnalogIn.c #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Pin does not have ADC capabilities" msgstr "" @@ -1670,10 +1760,34 @@ msgstr "" msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does IN without loading ISR" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does OUT without loading OSR" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program must contain at least one 16-bit instruction." +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program size invalid" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program too large" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c +msgid "RAISE mode is not implemented" +msgstr "" + #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" msgstr "" @@ -1756,6 +1870,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" msgstr "" @@ -1777,6 +1892,10 @@ msgstr "" msgid "SPI Re-initialization error" msgstr "" +#: ports/raspberrypi/common-hal/busio/SPI.c +msgid "SPI peripheral in use" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Sample rate must be positive" msgstr "" @@ -1807,6 +1926,14 @@ msgstr "" msgid "Server side context cannot have hostname" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Set pin count must be between 1 and 5" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Side set pin count must be between 1 and 5" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "" @@ -1971,6 +2098,10 @@ msgstr "" msgid "UART Re-init error" msgstr "" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART not yet supported" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART write error" msgstr "" @@ -2075,7 +2206,8 @@ msgid "" msgstr "" #: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/esp32s2/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/esp32s2/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c msgid "Unsupported baudrate" msgstr "" @@ -2126,6 +2258,7 @@ msgid "WARNING: Your code filename has two extensions\n" msgstr "" #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" @@ -3524,6 +3657,14 @@ msgstr "" msgid "pressing both buttons at start up.\n" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "pull_threshold must be between 1 and 32" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "push_threshold must be between 1 and 32" +msgstr "" + #: extmod/modutimeq.c msgid "queue overflow" msgstr "" @@ -3727,6 +3868,7 @@ msgstr "" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 8d8f2d52103d6..f613426b58665 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -343,6 +343,10 @@ msgstr "Alle UART-Peripheriegeräte sind in Benutzung" msgid "All event channels in use" msgstr "Alle event Kanäle werden benutzt" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "All state machines in use" +msgstr "" + #: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "All sync event channels in use" msgstr "Alle sync event Kanäle werden benutzt" @@ -391,6 +395,7 @@ msgstr "AnalogIn ist an diesem Pin nicht unterstützt" #: ports/cxd56/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c msgid "AnalogOut functionality not supported" msgstr "AnalogOut-Funktion wird nicht unterstützt" @@ -594,6 +599,7 @@ msgstr "Kann Werte nicht löschen" #: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c +#: ports/raspberrypi/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" msgstr "Pull up im Ausgabemodus nicht möglich" @@ -878,7 +884,8 @@ msgstr "Fehler in regex" msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c +#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c #: shared-bindings/terminalio/Terminal.c @@ -1063,6 +1070,10 @@ msgstr "Lese/Schreibe-operation an geschlossener Datei" msgid "I2C Init Error" msgstr "I2C-Init-Fehler" +#: ports/raspberrypi/common-hal/busio/I2C.c +msgid "I2C peripheral in use" +msgstr "" + #: shared-bindings/audiobusio/I2SOut.c msgid "I2SOut not available" msgstr "I2SOut nicht verfügbar" @@ -1088,6 +1099,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Inkorrekte Puffergröße" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Init program size invalid" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" msgstr "Initialisierung aufgrund von Speichermangel fehlgeschlagen" @@ -1100,6 +1115,31 @@ msgstr "" msgid "Input/output error" msgstr "Eingabe-/Ausgabefehler" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d jumps on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d waits on input outside of count" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "Unzureichende Authentifizierung" @@ -1151,7 +1191,7 @@ msgstr "Ungültiger DAC-Pin angegeben" #: ports/atmel-samd/common-hal/pwmio/PWMOut.c #: ports/cxd56/common-hal/pwmio/PWMOut.c ports/nrf/common-hal/pwmio/PWMOut.c -#: shared-bindings/pwmio/PWMOut.c +#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c msgid "Invalid PWM frequency" msgstr "Ungültige PWM Frequenz" @@ -1245,6 +1285,8 @@ msgstr "Ungültiger Pin für rechten Kanal" #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/SPI.c msgid "Invalid pins" msgstr "Ungültige Pins" @@ -1368,6 +1410,36 @@ msgstr "" msgid "Missing MISO or MOSI Pin" msgstr "Fehlender MISO- oder MOSI-Pin" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgstr "" + #: shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "Muss eine %q Unterklasse sein." @@ -1421,14 +1493,14 @@ msgstr "Kein MOSI Pin" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Kein RX Pin" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No TX pin" msgstr "Kein TX Pin" @@ -1485,6 +1557,10 @@ msgstr "An diesem Pin sind keine Timer mehr verfügbar." msgid "No network with that ssid" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "No out in program" +msgstr "" + #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" msgstr "Kein Pulldown Widerstand am Pin; 1Mohm wird vorgeschlagen" @@ -1542,6 +1618,10 @@ msgstr "Eine ungerade Parität wird nicht unterstützt" msgid "Only 8 or 16 bit mono with " msgstr "Nur 8 oder 16 bit mono mit " +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Only IN/OUT of up to 8 supported" +msgstr "" + #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" @@ -1618,6 +1698,7 @@ msgid "" msgstr "Die PWM-Frequenz ist nicht schreibbar wenn variable_Frequenz = False." #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c +#: ports/raspberrypi/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" msgstr "ParallelBus wird noch nicht unterstützt" @@ -1630,11 +1711,20 @@ msgstr "" msgid "Permission denied" msgstr "Zugang verweigert" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Pin count must be at least 1" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Pin count too large" +msgstr "" + #: ports/atmel-samd/common-hal/analogio/AnalogIn.c #: ports/cxd56/common-hal/analogio/AnalogIn.c #: ports/esp32s2/common-hal/analogio/AnalogIn.c #: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c #: ports/nrf/common-hal/analogio/AnalogIn.c +#: ports/raspberrypi/common-hal/analogio/AnalogIn.c #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Pin does not have ADC capabilities" msgstr "Pin hat keine ADC Funktionalität" @@ -1698,10 +1788,34 @@ msgstr "" msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does IN without loading ISR" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does OUT without loading OSR" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program must contain at least one 16-bit instruction." +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program size invalid" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program too large" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Pull wird nicht verwendet, wenn die Richtung output ist." +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c +msgid "RAISE mode is not implemented" +msgstr "" + #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" msgstr "RNG DeInit-Fehler" @@ -1784,6 +1898,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" msgstr "SDA oder SCL brauchen pull up" @@ -1805,6 +1920,10 @@ msgstr "SPI-Init-Fehler" msgid "SPI Re-initialization error" msgstr "SPI-Neuinitialisierungsfehler" +#: ports/raspberrypi/common-hal/busio/SPI.c +msgid "SPI peripheral in use" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Sample rate must be positive" msgstr "Abtastrate muss positiv sein" @@ -1835,6 +1954,14 @@ msgstr "Serializer wird benutzt" msgid "Server side context cannot have hostname" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Set pin count must be between 1 and 5" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Side set pin count must be between 1 and 5" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "" @@ -2013,6 +2140,10 @@ msgstr "UART Init Fehler" msgid "UART Re-init error" msgstr "UART Re-Init-Fehler" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART not yet supported" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART write error" msgstr "UART-Schreibfehler" @@ -2121,7 +2252,8 @@ msgstr "" "Eingabeaufforderung auf dem anderen Gerät abgelehnt oder ignoriert." #: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/esp32s2/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/esp32s2/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c msgid "Unsupported baudrate" msgstr "Baudrate wird nicht unterstützt" @@ -2173,6 +2305,7 @@ msgstr "" "WARNUNG: Der Dateiname deines Programms hat zwei Dateityperweiterungen\n" #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" @@ -3604,6 +3737,14 @@ msgstr "" msgid "pressing both buttons at start up.\n" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "pull_threshold must be between 1 and 32" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "push_threshold must be between 1 and 32" +msgstr "" + #: extmod/modutimeq.c msgid "queue overflow" msgstr "Warteschlangenüberlauf" @@ -3810,6 +3951,7 @@ msgstr "time.struct_time() nimmt eine 9-Sequenz an" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "Das Zeitlimit hat den maximal zulässigen Wert überschritten" diff --git a/locale/el.po b/locale/el.po index 04b63261eaddb..a4aa93f9f1914 100644 --- a/locale/el.po +++ b/locale/el.po @@ -339,6 +339,10 @@ msgstr "" msgid "All event channels in use" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "All state machines in use" +msgstr "" + #: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "All sync event channels in use" msgstr "" @@ -387,6 +391,7 @@ msgstr "" #: ports/cxd56/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c msgid "AnalogOut functionality not supported" msgstr "" @@ -586,6 +591,7 @@ msgstr "" #: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c +#: ports/raspberrypi/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" msgstr "" @@ -863,7 +869,8 @@ msgstr "" msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c +#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c #: shared-bindings/terminalio/Terminal.c @@ -1045,6 +1052,10 @@ msgstr "" msgid "I2C Init Error" msgstr "" +#: ports/raspberrypi/common-hal/busio/I2C.c +msgid "I2C peripheral in use" +msgstr "" + #: shared-bindings/audiobusio/I2SOut.c msgid "I2SOut not available" msgstr "" @@ -1068,6 +1079,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Init program size invalid" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" msgstr "" @@ -1080,6 +1095,31 @@ msgstr "" msgid "Input/output error" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d jumps on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d waits on input outside of count" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "" @@ -1131,7 +1171,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pwmio/PWMOut.c #: ports/cxd56/common-hal/pwmio/PWMOut.c ports/nrf/common-hal/pwmio/PWMOut.c -#: shared-bindings/pwmio/PWMOut.c +#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c msgid "Invalid PWM frequency" msgstr "" @@ -1225,6 +1265,8 @@ msgstr "" #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/SPI.c msgid "Invalid pins" msgstr "" @@ -1346,6 +1388,36 @@ msgstr "" msgid "Missing MISO or MOSI Pin" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgstr "" + #: shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "" @@ -1399,14 +1471,14 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No TX pin" msgstr "" @@ -1463,6 +1535,10 @@ msgstr "" msgid "No network with that ssid" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "No out in program" +msgstr "" + #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" msgstr "" @@ -1518,6 +1594,10 @@ msgstr "" msgid "Only 8 or 16 bit mono with " msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Only IN/OUT of up to 8 supported" +msgstr "" + #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" @@ -1590,6 +1670,7 @@ msgid "" msgstr "" #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c +#: ports/raspberrypi/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" msgstr "" @@ -1602,11 +1683,20 @@ msgstr "" msgid "Permission denied" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Pin count must be at least 1" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Pin count too large" +msgstr "" + #: ports/atmel-samd/common-hal/analogio/AnalogIn.c #: ports/cxd56/common-hal/analogio/AnalogIn.c #: ports/esp32s2/common-hal/analogio/AnalogIn.c #: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c #: ports/nrf/common-hal/analogio/AnalogIn.c +#: ports/raspberrypi/common-hal/analogio/AnalogIn.c #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Pin does not have ADC capabilities" msgstr "" @@ -1667,10 +1757,34 @@ msgstr "" msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does IN without loading ISR" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does OUT without loading OSR" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program must contain at least one 16-bit instruction." +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program size invalid" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program too large" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c +msgid "RAISE mode is not implemented" +msgstr "" + #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" msgstr "" @@ -1753,6 +1867,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" msgstr "" @@ -1774,6 +1889,10 @@ msgstr "" msgid "SPI Re-initialization error" msgstr "" +#: ports/raspberrypi/common-hal/busio/SPI.c +msgid "SPI peripheral in use" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Sample rate must be positive" msgstr "" @@ -1804,6 +1923,14 @@ msgstr "" msgid "Server side context cannot have hostname" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Set pin count must be between 1 and 5" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Side set pin count must be between 1 and 5" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "" @@ -1968,6 +2095,10 @@ msgstr "" msgid "UART Re-init error" msgstr "" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART not yet supported" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART write error" msgstr "" @@ -2072,7 +2203,8 @@ msgid "" msgstr "" #: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/esp32s2/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/esp32s2/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c msgid "Unsupported baudrate" msgstr "" @@ -2123,6 +2255,7 @@ msgid "WARNING: Your code filename has two extensions\n" msgstr "" #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" @@ -3521,6 +3654,14 @@ msgstr "" msgid "pressing both buttons at start up.\n" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "pull_threshold must be between 1 and 32" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "push_threshold must be between 1 and 32" +msgstr "" + #: extmod/modutimeq.c msgid "queue overflow" msgstr "" @@ -3724,6 +3865,7 @@ msgstr "" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" diff --git a/locale/es.po b/locale/es.po index 29b238768a641..bca7eada069a6 100644 --- a/locale/es.po +++ b/locale/es.po @@ -344,6 +344,10 @@ msgstr "Todos los periféricos UART están siendo usados" msgid "All event channels in use" msgstr "Todos los canales de eventos estan siendo usados" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "All state machines in use" +msgstr "" + #: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "All sync event channels in use" msgstr "" @@ -394,6 +398,7 @@ msgstr "El pin proporcionado no soporta AnalogIn" #: ports/cxd56/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c msgid "AnalogOut functionality not supported" msgstr "Funcionalidad AnalogOut no soportada" @@ -597,6 +602,7 @@ msgstr "No se puede eliminar valores" #: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c +#: ports/raspberrypi/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" msgstr "No puede ser pull mientras este en modo de salida" @@ -880,7 +886,8 @@ msgstr "Error en regex" msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c +#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c #: shared-bindings/terminalio/Terminal.c @@ -1063,6 +1070,10 @@ msgstr "Operación I/O en archivo cerrado" msgid "I2C Init Error" msgstr "I2C Error de inicio" +#: ports/raspberrypi/common-hal/busio/I2C.c +msgid "I2C peripheral in use" +msgstr "" + #: shared-bindings/audiobusio/I2SOut.c msgid "I2SOut not available" msgstr "I2SOut no disponible" @@ -1088,6 +1099,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Tamaño incorrecto del buffer" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Init program size invalid" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" msgstr "Inicializacion fallida por falta de memoria" @@ -1100,6 +1115,31 @@ msgstr "La entrada está durando mucho tiempo" msgid "Input/output error" msgstr "error Input/output" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d jumps on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d waits on input outside of count" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "Autenticación insuficiente" @@ -1151,7 +1191,7 @@ msgstr "Pin suministrado inválido para DAC" #: ports/atmel-samd/common-hal/pwmio/PWMOut.c #: ports/cxd56/common-hal/pwmio/PWMOut.c ports/nrf/common-hal/pwmio/PWMOut.c -#: shared-bindings/pwmio/PWMOut.c +#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c msgid "Invalid PWM frequency" msgstr "Frecuencia PWM inválida" @@ -1245,6 +1285,8 @@ msgstr "Pin inválido para canal derecho" #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/SPI.c msgid "Invalid pins" msgstr "pines inválidos" @@ -1366,6 +1408,36 @@ msgstr "Micrófono demora de inicio debe estar en el rango 0.0 a 1.0" msgid "Missing MISO or MOSI Pin" msgstr "Falta el pin MISO o MOSI" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgstr "" + #: shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "Debe de ser una subclase de %q." @@ -1419,14 +1491,14 @@ msgstr "Sin pin MOSI" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Sin pin RX" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No TX pin" msgstr "Sin pin TX" @@ -1483,6 +1555,10 @@ msgstr "No hay más temporizadores disponibles en este pin." msgid "No network with that ssid" msgstr "No hay una red con ese ssid" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "No out in program" +msgstr "" + #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" msgstr "No hay pulldown en el pin; 1Mohm recomendado" @@ -1540,6 +1616,10 @@ msgstr "Paridad impar no soportada" msgid "Only 8 or 16 bit mono with " msgstr "Solo mono de 8 ó 16 bit con " +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Only IN/OUT of up to 8 supported" +msgstr "" + #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "Solo hay capacidad para direcciones IPv4" @@ -1618,6 +1698,7 @@ msgstr "" "construcción." #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c +#: ports/raspberrypi/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" msgstr "ParallelBus todavía no soportado" @@ -1630,11 +1711,20 @@ msgstr "" msgid "Permission denied" msgstr "Permiso denegado" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Pin count must be at least 1" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Pin count too large" +msgstr "" + #: ports/atmel-samd/common-hal/analogio/AnalogIn.c #: ports/cxd56/common-hal/analogio/AnalogIn.c #: ports/esp32s2/common-hal/analogio/AnalogIn.c #: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c #: ports/nrf/common-hal/analogio/AnalogIn.c +#: ports/raspberrypi/common-hal/analogio/AnalogIn.c #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Pin does not have ADC capabilities" msgstr "Pin no tiene capacidad ADC" @@ -1702,10 +1792,34 @@ msgstr "" msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does IN without loading ISR" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does OUT without loading OSR" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program must contain at least one 16-bit instruction." +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program size invalid" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program too large" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Pull no se usa cuando la dirección es output." +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c +msgid "RAISE mode is not implemented" +msgstr "" + #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" msgstr "Error de desinicialización de RNG" @@ -1788,6 +1902,7 @@ msgstr "Sin capacidad para formato CSD para tarjeta SD" #: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" msgstr "SDA o SCL necesitan una pull up" @@ -1809,6 +1924,10 @@ msgstr "Error de inicio de SPI" msgid "SPI Re-initialization error" msgstr "Error de reinicialización de SPI" +#: ports/raspberrypi/common-hal/busio/SPI.c +msgid "SPI peripheral in use" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Sample rate must be positive" msgstr "Sample rate debe ser positivo" @@ -1839,6 +1958,14 @@ msgstr "Serializer está siendo utilizado" msgid "Server side context cannot have hostname" msgstr "El contexto del lado del servidor no puede tener un hostname" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Set pin count must be between 1 and 5" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Side set pin count must be between 1 and 5" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "Sin capacidades para el tamaño" @@ -2017,6 +2144,10 @@ msgstr "Error de inicialización de UART" msgid "UART Re-init error" msgstr "Error de reinicialización de UART" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART not yet supported" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART write error" msgstr "Error de escritura UART" @@ -2123,7 +2254,8 @@ msgstr "" "dispositivo fue denegada o ignorada." #: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/esp32s2/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/esp32s2/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c msgid "Unsupported baudrate" msgstr "Baudrate no soportado" @@ -2174,6 +2306,7 @@ msgid "WARNING: Your code filename has two extensions\n" msgstr "ADVERTENCIA: El nombre de archivo de tu código tiene dos extensiones\n" #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" "WatchDogTimer no se puede desinicializar luego de definirse en modo RESET" @@ -3594,6 +3727,14 @@ msgstr "presionando botón de arranque al inicio.\n" msgid "pressing both buttons at start up.\n" msgstr "presionando ambos botones al inicio.\n" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "pull_threshold must be between 1 and 32" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "push_threshold must be between 1 and 32" +msgstr "" + #: extmod/modutimeq.c msgid "queue overflow" msgstr "desbordamiento de cola(queue)" @@ -3799,6 +3940,7 @@ msgstr "time.struct_time() toma un sequencio 9" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" "la duración de tiempo de espera ha excedido la capacidad máxima del valor" diff --git a/locale/fil.po b/locale/fil.po index 2fdcd2f0488d3..97e99cfd57549 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -342,6 +342,10 @@ msgstr "Lahat ng I2C peripherals ginagamit" msgid "All event channels in use" msgstr "Lahat ng event channels ginagamit" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "All state machines in use" +msgstr "" + #: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "All sync event channels in use" msgstr "Lahat ng sync event channels ay ginagamit" @@ -390,6 +394,7 @@ msgstr "" #: ports/cxd56/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c msgid "AnalogOut functionality not supported" msgstr "Hindi supportado ang AnalogOut" @@ -592,6 +597,7 @@ msgstr "Hindi mabura ang values" #: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c +#: ports/raspberrypi/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" msgstr "Hindi makakakuha ng pull habang nasa output mode" @@ -874,7 +880,8 @@ msgstr "May pagkakamali sa REGEX" msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c +#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c #: shared-bindings/terminalio/Terminal.c @@ -1058,6 +1065,10 @@ msgstr "I/O operasyon sa saradong file" msgid "I2C Init Error" msgstr "" +#: ports/raspberrypi/common-hal/busio/I2C.c +msgid "I2C peripheral in use" +msgstr "" + #: shared-bindings/audiobusio/I2SOut.c msgid "I2SOut not available" msgstr "" @@ -1083,6 +1094,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Init program size invalid" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" msgstr "" @@ -1095,6 +1110,31 @@ msgstr "" msgid "Input/output error" msgstr "May mali sa Input/Output" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d jumps on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d waits on input outside of count" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "" @@ -1146,7 +1186,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pwmio/PWMOut.c #: ports/cxd56/common-hal/pwmio/PWMOut.c ports/nrf/common-hal/pwmio/PWMOut.c -#: shared-bindings/pwmio/PWMOut.c +#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c msgid "Invalid PWM frequency" msgstr "Mali ang PWM frequency" @@ -1240,6 +1280,8 @@ msgstr "Mali ang pin para sa kanang channel" #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/SPI.c msgid "Invalid pins" msgstr "Mali ang pins" @@ -1361,6 +1403,36 @@ msgstr "Ang delay ng startup ng mikropono ay dapat na nasa 0.0 hanggang 1.0" msgid "Missing MISO or MOSI Pin" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgstr "" + #: shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "" @@ -1414,14 +1486,14 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Walang RX pin" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No TX pin" msgstr "Walang TX pin" @@ -1478,6 +1550,10 @@ msgstr "" msgid "No network with that ssid" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "No out in program" +msgstr "" + #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" msgstr "" @@ -1536,6 +1612,10 @@ msgstr "Odd na parity ay hindi supportado" msgid "Only 8 or 16 bit mono with " msgstr "Tanging 8 o 16 na bit mono na may " +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Only IN/OUT of up to 8 supported" +msgstr "" + #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" @@ -1609,6 +1689,7 @@ msgstr "" "PWM frequency hindi writable kapag variable_frequency ay False sa pag buo." #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c +#: ports/raspberrypi/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" msgstr "" @@ -1621,11 +1702,20 @@ msgstr "" msgid "Permission denied" msgstr "Walang pahintulot" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Pin count must be at least 1" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Pin count too large" +msgstr "" + #: ports/atmel-samd/common-hal/analogio/AnalogIn.c #: ports/cxd56/common-hal/analogio/AnalogIn.c #: ports/esp32s2/common-hal/analogio/AnalogIn.c #: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c #: ports/nrf/common-hal/analogio/AnalogIn.c +#: ports/raspberrypi/common-hal/analogio/AnalogIn.c #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Pin does not have ADC capabilities" msgstr "Ang pin ay walang kakayahan sa ADC" @@ -1686,10 +1776,34 @@ msgstr "" msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does IN without loading ISR" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does OUT without loading OSR" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program must contain at least one 16-bit instruction." +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program size invalid" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program too large" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Pull hindi ginagamit kapag ang direksyon ay output." +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c +msgid "RAISE mode is not implemented" +msgstr "" + #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" msgstr "" @@ -1773,6 +1887,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" msgstr "Kailangan ng pull up resistors ang SDA o SCL" @@ -1794,6 +1909,10 @@ msgstr "" msgid "SPI Re-initialization error" msgstr "" +#: ports/raspberrypi/common-hal/busio/SPI.c +msgid "SPI peripheral in use" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Sample rate must be positive" msgstr "Sample rate ay dapat positibo" @@ -1824,6 +1943,14 @@ msgstr "Serializer ginagamit" msgid "Server side context cannot have hostname" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Set pin count must be between 1 and 5" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Side set pin count must be between 1 and 5" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "" @@ -1988,6 +2115,10 @@ msgstr "" msgid "UART Re-init error" msgstr "" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART not yet supported" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART write error" msgstr "" @@ -2093,7 +2224,8 @@ msgid "" msgstr "" #: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/esp32s2/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/esp32s2/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c msgid "Unsupported baudrate" msgstr "Hindi supportadong baudrate" @@ -2147,6 +2279,7 @@ msgid "WARNING: Your code filename has two extensions\n" msgstr "BABALA: Ang pangalan ng file ay may dalawang extension\n" #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" @@ -3570,6 +3703,14 @@ msgstr "" msgid "pressing both buttons at start up.\n" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "pull_threshold must be between 1 and 32" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "push_threshold must be between 1 and 32" +msgstr "" + #: extmod/modutimeq.c msgid "queue overflow" msgstr "puno na ang pila (overflow)" @@ -3776,6 +3917,7 @@ msgstr "time.struct_time() kumukuha ng 9-sequence" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index 20c8ea74341b3..ac78a6f7d81fb 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -350,6 +350,10 @@ msgstr "Tous les périphériques UART sont utilisés" msgid "All event channels in use" msgstr "Tous les canaux d'événements sont utilisés" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "All state machines in use" +msgstr "" + #: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "All sync event channels in use" msgstr "Tous les canaux d'événements sync (sync event channels) sont utilisés" @@ -398,6 +402,7 @@ msgstr "'AnalogOut' n'est pas supporté sur la broche indiquée" #: ports/cxd56/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c msgid "AnalogOut functionality not supported" msgstr "Fonctionnalité AnalogOut non supportée" @@ -608,6 +613,7 @@ msgstr "Impossible de supprimer les valeurs" #: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c +#: ports/raspberrypi/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" msgstr "Ne peut être tiré ('pull') en mode sortie ('output')" @@ -895,7 +901,8 @@ msgstr "Erreur dans l'expression régulière" msgid "Error: Failure to bind" msgstr "Erreur : Impossible de lier" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c +#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c #: shared-bindings/terminalio/Terminal.c @@ -1080,6 +1087,10 @@ msgstr "Opération d'E/S sur un fichier fermé" msgid "I2C Init Error" msgstr "Erreur d'initialisation I2C" +#: ports/raspberrypi/common-hal/busio/I2C.c +msgid "I2C peripheral in use" +msgstr "" + #: shared-bindings/audiobusio/I2SOut.c msgid "I2SOut not available" msgstr "I2SOut n'est pas disponible" @@ -1105,6 +1116,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Taille de tampon incorrecte" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Init program size invalid" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" msgstr "Échec d'initialisation par manque de mémoire" @@ -1117,6 +1132,31 @@ msgstr "L'entrée prend trop de temps" msgid "Input/output error" msgstr "Erreur d'entrée/sortie" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d jumps on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d waits on input outside of count" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "Authentification insuffisante" @@ -1168,7 +1208,7 @@ msgstr "Broche DAC non valide fournie" #: ports/atmel-samd/common-hal/pwmio/PWMOut.c #: ports/cxd56/common-hal/pwmio/PWMOut.c ports/nrf/common-hal/pwmio/PWMOut.c -#: shared-bindings/pwmio/PWMOut.c +#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c msgid "Invalid PWM frequency" msgstr "Fréquence de PWM invalide" @@ -1262,6 +1302,8 @@ msgstr "Broche invalide pour le canal droit" #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/SPI.c msgid "Invalid pins" msgstr "Broches invalides" @@ -1383,6 +1425,36 @@ msgstr "Le délais au démarrage du micro doit être entre 0.0 et 1.0" msgid "Missing MISO or MOSI Pin" msgstr "Broche MISO ou MOSI manquante" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgstr "" + #: shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "Doit être une sous-classe de %q." @@ -1436,14 +1508,14 @@ msgstr "Pas de broche MOSI" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Pas de broche RX" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No TX pin" msgstr "Pas de broche TX" @@ -1500,6 +1572,10 @@ msgstr "Plus de minuteurs disponibles sur cette broche." msgid "No network with that ssid" msgstr "Aucun réseau avec ce ssid" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "No out in program" +msgstr "" + #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" msgstr "Pas de pulldown sur la broche ; 1Mohm recommandé" @@ -1557,6 +1633,10 @@ msgstr "Parité impaire non supportée" msgid "Only 8 or 16 bit mono with " msgstr "Uniquement 8 ou 16 bit mono avec " +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Only IN/OUT of up to 8 supported" +msgstr "" + #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "Seulement les adresses IPv4 sont supportées" @@ -1637,6 +1717,7 @@ msgstr "" "à la construction." #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c +#: ports/raspberrypi/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" msgstr "ParallelBus pas encore supporté" @@ -1649,11 +1730,20 @@ msgstr "Périphérique en utilisation" msgid "Permission denied" msgstr "Permission refusée" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Pin count must be at least 1" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Pin count too large" +msgstr "" + #: ports/atmel-samd/common-hal/analogio/AnalogIn.c #: ports/cxd56/common-hal/analogio/AnalogIn.c #: ports/esp32s2/common-hal/analogio/AnalogIn.c #: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c #: ports/nrf/common-hal/analogio/AnalogIn.c +#: ports/raspberrypi/common-hal/analogio/AnalogIn.c #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Pin does not have ADC capabilities" msgstr "La broche 'pin' ne supporte pas les capacitées ADC" @@ -1724,10 +1814,34 @@ msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" "Feinte de someil profond jusqu'à l'alarme, CTRL-C ou écriture au fichier.\n" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does IN without loading ISR" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does OUT without loading OSR" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program must contain at least one 16-bit instruction." +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program size invalid" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program too large" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Le tirage 'pull' n'est pas utilisé quand la direction est 'output'." +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c +msgid "RAISE mode is not implemented" +msgstr "" + #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" msgstr "Erreur de désinitiation du RNG (RNG DeInit)" @@ -1810,6 +1924,7 @@ msgstr "Le format de carte SD CSD n'est pas supporté" #: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" msgstr "SDA ou SCL a besoin d'une résistance de tirage ('pull up')" @@ -1831,6 +1946,10 @@ msgstr "Erreur d'initialisation SPI" msgid "SPI Re-initialization error" msgstr "Erreur de réinitialisation SPI" +#: ports/raspberrypi/common-hal/busio/SPI.c +msgid "SPI peripheral in use" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Sample rate must be positive" msgstr "Le taux d'échantillonage doit être positif" @@ -1861,6 +1980,14 @@ msgstr "Sérialiseur en cours d'utilisation" msgid "Server side context cannot have hostname" msgstr "Un contexte niveau serveur ne peut avoir de hostname" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Set pin count must be between 1 and 5" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Side set pin count must be between 1 and 5" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "Taille n'est pas supportée" @@ -2037,6 +2164,10 @@ msgstr "Erreur d'initialisation UART" msgid "UART Re-init error" msgstr "Erreur de réinitialisation UART" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART not yet supported" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART write error" msgstr "Erreur d'écriture UART" @@ -2147,7 +2278,8 @@ msgstr "" "appareil ait été refusée ou ignorée." #: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/esp32s2/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/esp32s2/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c msgid "Unsupported baudrate" msgstr "Débit en bauds non supporté" @@ -2199,6 +2331,7 @@ msgid "WARNING: Your code filename has two extensions\n" msgstr "ATTENTION : le nom de fichier de votre code a deux extensions\n" #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" "WatchDogTimer ne peut pas être désinitialisé une fois que le mode est réglé " @@ -3631,6 +3764,14 @@ msgstr "bouton boot appuyé lors du démarrage.\n" msgid "pressing both buttons at start up.\n" msgstr "les deux boutons appuyés lors du démarrage.\n" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "pull_threshold must be between 1 and 32" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "push_threshold must be between 1 and 32" +msgstr "" + #: extmod/modutimeq.c msgid "queue overflow" msgstr "dépassement de file" @@ -3837,6 +3978,7 @@ msgstr "time.struct_time() prend une séquence de longueur 9" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "le délai d'expiration a dépassé la valeur maximale prise en charge" diff --git a/locale/hi.po b/locale/hi.po index 88c82d4b80550..e713d6b86c364 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -339,6 +339,10 @@ msgstr "" msgid "All event channels in use" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "All state machines in use" +msgstr "" + #: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "All sync event channels in use" msgstr "" @@ -387,6 +391,7 @@ msgstr "" #: ports/cxd56/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c msgid "AnalogOut functionality not supported" msgstr "" @@ -586,6 +591,7 @@ msgstr "" #: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c +#: ports/raspberrypi/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" msgstr "" @@ -863,7 +869,8 @@ msgstr "" msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c +#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c #: shared-bindings/terminalio/Terminal.c @@ -1045,6 +1052,10 @@ msgstr "" msgid "I2C Init Error" msgstr "" +#: ports/raspberrypi/common-hal/busio/I2C.c +msgid "I2C peripheral in use" +msgstr "" + #: shared-bindings/audiobusio/I2SOut.c msgid "I2SOut not available" msgstr "" @@ -1068,6 +1079,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Init program size invalid" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" msgstr "" @@ -1080,6 +1095,31 @@ msgstr "" msgid "Input/output error" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d jumps on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d waits on input outside of count" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "" @@ -1131,7 +1171,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pwmio/PWMOut.c #: ports/cxd56/common-hal/pwmio/PWMOut.c ports/nrf/common-hal/pwmio/PWMOut.c -#: shared-bindings/pwmio/PWMOut.c +#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c msgid "Invalid PWM frequency" msgstr "" @@ -1225,6 +1265,8 @@ msgstr "" #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/SPI.c msgid "Invalid pins" msgstr "" @@ -1346,6 +1388,36 @@ msgstr "" msgid "Missing MISO or MOSI Pin" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgstr "" + #: shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "" @@ -1399,14 +1471,14 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No TX pin" msgstr "" @@ -1463,6 +1535,10 @@ msgstr "" msgid "No network with that ssid" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "No out in program" +msgstr "" + #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" msgstr "" @@ -1518,6 +1594,10 @@ msgstr "" msgid "Only 8 or 16 bit mono with " msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Only IN/OUT of up to 8 supported" +msgstr "" + #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" @@ -1590,6 +1670,7 @@ msgid "" msgstr "" #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c +#: ports/raspberrypi/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" msgstr "" @@ -1602,11 +1683,20 @@ msgstr "" msgid "Permission denied" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Pin count must be at least 1" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Pin count too large" +msgstr "" + #: ports/atmel-samd/common-hal/analogio/AnalogIn.c #: ports/cxd56/common-hal/analogio/AnalogIn.c #: ports/esp32s2/common-hal/analogio/AnalogIn.c #: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c #: ports/nrf/common-hal/analogio/AnalogIn.c +#: ports/raspberrypi/common-hal/analogio/AnalogIn.c #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Pin does not have ADC capabilities" msgstr "" @@ -1667,10 +1757,34 @@ msgstr "" msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does IN without loading ISR" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does OUT without loading OSR" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program must contain at least one 16-bit instruction." +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program size invalid" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program too large" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c +msgid "RAISE mode is not implemented" +msgstr "" + #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" msgstr "" @@ -1753,6 +1867,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" msgstr "" @@ -1774,6 +1889,10 @@ msgstr "" msgid "SPI Re-initialization error" msgstr "" +#: ports/raspberrypi/common-hal/busio/SPI.c +msgid "SPI peripheral in use" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Sample rate must be positive" msgstr "" @@ -1804,6 +1923,14 @@ msgstr "" msgid "Server side context cannot have hostname" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Set pin count must be between 1 and 5" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Side set pin count must be between 1 and 5" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "" @@ -1968,6 +2095,10 @@ msgstr "" msgid "UART Re-init error" msgstr "" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART not yet supported" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART write error" msgstr "" @@ -2072,7 +2203,8 @@ msgid "" msgstr "" #: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/esp32s2/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/esp32s2/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c msgid "Unsupported baudrate" msgstr "" @@ -2123,6 +2255,7 @@ msgid "WARNING: Your code filename has two extensions\n" msgstr "" #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" @@ -3521,6 +3654,14 @@ msgstr "" msgid "pressing both buttons at start up.\n" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "pull_threshold must be between 1 and 32" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "push_threshold must be between 1 and 32" +msgstr "" + #: extmod/modutimeq.c msgid "queue overflow" msgstr "" @@ -3724,6 +3865,7 @@ msgstr "" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index b380b2fae11d5..61e492a7a9984 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -341,6 +341,10 @@ msgstr "Tutte le periferiche I2C sono in uso" msgid "All event channels in use" msgstr "Tutti i canali eventi utilizati" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "All state machines in use" +msgstr "" + #: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "All sync event channels in use" msgstr "Tutti i canali di eventi sincronizzati in uso" @@ -389,6 +393,7 @@ msgstr "" #: ports/cxd56/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c msgid "AnalogOut functionality not supported" msgstr "funzionalità AnalogOut non supportata" @@ -592,6 +597,7 @@ msgstr "Impossibile cancellare valori" #: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c +#: ports/raspberrypi/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" msgstr "non si può tirare quando nella modalita output" @@ -874,7 +880,8 @@ msgstr "Errore nella regex" msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c +#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c #: shared-bindings/terminalio/Terminal.c @@ -1058,6 +1065,10 @@ msgstr "operazione I/O su file chiuso" msgid "I2C Init Error" msgstr "" +#: ports/raspberrypi/common-hal/busio/I2C.c +msgid "I2C peripheral in use" +msgstr "" + #: shared-bindings/audiobusio/I2SOut.c msgid "I2SOut not available" msgstr "" @@ -1083,6 +1094,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Init program size invalid" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" msgstr "" @@ -1095,6 +1110,31 @@ msgstr "" msgid "Input/output error" msgstr "Errore input/output" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d jumps on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d waits on input outside of count" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "" @@ -1146,7 +1186,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pwmio/PWMOut.c #: ports/cxd56/common-hal/pwmio/PWMOut.c ports/nrf/common-hal/pwmio/PWMOut.c -#: shared-bindings/pwmio/PWMOut.c +#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c msgid "Invalid PWM frequency" msgstr "Frequenza PWM non valida" @@ -1242,6 +1282,8 @@ msgstr "Pin non valido per il canale destro" #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/SPI.c msgid "Invalid pins" msgstr "Pin non validi" @@ -1365,6 +1407,36 @@ msgstr "" msgid "Missing MISO or MOSI Pin" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgstr "" + #: shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "" @@ -1418,14 +1490,14 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Nessun pin RX" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No TX pin" msgstr "Nessun pin TX" @@ -1482,6 +1554,10 @@ msgstr "" msgid "No network with that ssid" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "No out in program" +msgstr "" + #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" msgstr "" @@ -1541,6 +1617,10 @@ msgstr "operazione I2C non supportata" msgid "Only 8 or 16 bit mono with " msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Only IN/OUT of up to 8 supported" +msgstr "" + #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" @@ -1618,6 +1698,7 @@ msgstr "" "impostato nel costruttore a False." #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c +#: ports/raspberrypi/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" msgstr "" @@ -1630,11 +1711,20 @@ msgstr "" msgid "Permission denied" msgstr "Permesso negato" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Pin count must be at least 1" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Pin count too large" +msgstr "" + #: ports/atmel-samd/common-hal/analogio/AnalogIn.c #: ports/cxd56/common-hal/analogio/AnalogIn.c #: ports/esp32s2/common-hal/analogio/AnalogIn.c #: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c #: ports/nrf/common-hal/analogio/AnalogIn.c +#: ports/raspberrypi/common-hal/analogio/AnalogIn.c #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Pin does not have ADC capabilities" msgstr "Il pin non ha capacità di ADC" @@ -1696,10 +1786,34 @@ msgstr "" msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does IN without loading ISR" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does OUT without loading OSR" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program must contain at least one 16-bit instruction." +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program size invalid" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program too large" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c +msgid "RAISE mode is not implemented" +msgstr "" + #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" msgstr "" @@ -1783,6 +1897,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" msgstr "SDA o SCL necessitano un pull-up" @@ -1804,6 +1919,10 @@ msgstr "" msgid "SPI Re-initialization error" msgstr "" +#: ports/raspberrypi/common-hal/busio/SPI.c +msgid "SPI peripheral in use" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c #, fuzzy msgid "Sample rate must be positive" @@ -1836,6 +1955,14 @@ msgstr "Serializer in uso" msgid "Server side context cannot have hostname" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Set pin count must be between 1 and 5" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Side set pin count must be between 1 and 5" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "" @@ -2000,6 +2127,10 @@ msgstr "" msgid "UART Re-init error" msgstr "" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART not yet supported" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART write error" msgstr "" @@ -2105,7 +2236,8 @@ msgid "" msgstr "" #: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/esp32s2/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/esp32s2/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c msgid "Unsupported baudrate" msgstr "baudrate non supportato" @@ -2157,6 +2289,7 @@ msgid "WARNING: Your code filename has two extensions\n" msgstr "ATTENZIONE: Il nome del sorgente ha due estensioni\n" #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" @@ -3578,6 +3711,14 @@ msgstr "" msgid "pressing both buttons at start up.\n" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "pull_threshold must be between 1 and 32" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "push_threshold must be between 1 and 32" +msgstr "" + #: extmod/modutimeq.c msgid "queue overflow" msgstr "overflow della coda" @@ -3784,6 +3925,7 @@ msgstr "" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" diff --git a/locale/ja.po b/locale/ja.po index bae5704a1222e..a7d4835bc6171 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -344,6 +344,10 @@ msgstr "全てのUART周辺機器が使用中" msgid "All event channels in use" msgstr "全てのイベントチャネルが使用中" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "All state machines in use" +msgstr "" + #: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "All sync event channels in use" msgstr "全ての同期イベントチャネルが使用中" @@ -392,6 +396,7 @@ msgstr "指定のピンはAnalogInに対応していません" #: ports/cxd56/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c msgid "AnalogOut functionality not supported" msgstr "AnalogOut機能に対応していません" @@ -595,6 +600,7 @@ msgstr "値を削除できません" #: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c +#: ports/raspberrypi/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" msgstr "出力モード時はpullを取得できません" @@ -874,7 +880,8 @@ msgstr "正規表現にエラーがあります" msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c +#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c #: shared-bindings/terminalio/Terminal.c @@ -1056,6 +1063,10 @@ msgstr "閉じられたファイルへのI/O操作" msgid "I2C Init Error" msgstr "I2C初期化エラー" +#: ports/raspberrypi/common-hal/busio/I2C.c +msgid "I2C peripheral in use" +msgstr "" + #: shared-bindings/audiobusio/I2SOut.c msgid "I2SOut not available" msgstr "I2SOutが利用できません" @@ -1081,6 +1092,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "バッファサイズが正しくありません" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Init program size invalid" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" msgstr "" @@ -1093,6 +1108,31 @@ msgstr "" msgid "Input/output error" msgstr "入力/出力エラー" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d jumps on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d waits on input outside of count" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "認証が不十分" @@ -1144,7 +1184,7 @@ msgstr "不正なDACピンが与えられました" #: ports/atmel-samd/common-hal/pwmio/PWMOut.c #: ports/cxd56/common-hal/pwmio/PWMOut.c ports/nrf/common-hal/pwmio/PWMOut.c -#: shared-bindings/pwmio/PWMOut.c +#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c msgid "Invalid PWM frequency" msgstr "無効なPWM周波数" @@ -1238,6 +1278,8 @@ msgstr "右チャネルのピンが不正" #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/SPI.c msgid "Invalid pins" msgstr "ピンが不正" @@ -1359,6 +1401,36 @@ msgstr "マイクのスタートアップディレイは 0.0 から 1.0 の間 msgid "Missing MISO or MOSI Pin" msgstr "MISOまたはMOSIピンがありません" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgstr "" + #: shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "%q のサブクラスでなければなりません" @@ -1412,14 +1484,14 @@ msgstr "MOSIピンがありません" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "RXピンがありません" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No TX pin" msgstr "TXピンがありません" @@ -1476,6 +1548,10 @@ msgstr "このピンには使えるタイマーがもうありません" msgid "No network with that ssid" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "No out in program" +msgstr "" + #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" msgstr "ピンにプルダウンがありません。1Mオーム推奨" @@ -1533,6 +1609,10 @@ msgstr "奇数パリティには対応していません" msgid "Only 8 or 16 bit mono with " msgstr "8または16ビットの " +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Only IN/OUT of up to 8 supported" +msgstr "" + #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" @@ -1606,6 +1686,7 @@ msgid "" msgstr "PWM周波数は生成時のvariable_frequencyがFalseのとき書き換え不可" #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c +#: ports/raspberrypi/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" msgstr "ParallelBusにはまだ対応していません" @@ -1618,11 +1699,20 @@ msgstr "" msgid "Permission denied" msgstr "パーミッション拒否" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Pin count must be at least 1" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Pin count too large" +msgstr "" + #: ports/atmel-samd/common-hal/analogio/AnalogIn.c #: ports/cxd56/common-hal/analogio/AnalogIn.c #: ports/esp32s2/common-hal/analogio/AnalogIn.c #: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c #: ports/nrf/common-hal/analogio/AnalogIn.c +#: ports/raspberrypi/common-hal/analogio/AnalogIn.c #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Pin does not have ADC capabilities" msgstr "ピンにADCの能力がありません" @@ -1683,10 +1773,34 @@ msgstr "" msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does IN without loading ISR" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does OUT without loading OSR" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program must contain at least one 16-bit instruction." +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program size invalid" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program too large" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "方向がoutputのときpullは使われません" +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c +msgid "RAISE mode is not implemented" +msgstr "" + #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" msgstr "RNG解体エラー" @@ -1769,6 +1883,7 @@ msgstr "SDカードのCSDフォーマットは非対応" #: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" msgstr "SDAとSCLにプルアップが必要" @@ -1790,6 +1905,10 @@ msgstr "SPI初期化エラー" msgid "SPI Re-initialization error" msgstr "SPI再初期化エラー" +#: ports/raspberrypi/common-hal/busio/SPI.c +msgid "SPI peripheral in use" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Sample rate must be positive" msgstr "サンプルレートは正数でなければなりません" @@ -1820,6 +1939,14 @@ msgstr "シリアライザは使用中" msgid "Server side context cannot have hostname" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Set pin count must be between 1 and 5" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Side set pin count must be between 1 and 5" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "サイズは対応していません" @@ -1990,6 +2117,10 @@ msgstr "UARTの初期化エラー" msgid "UART Re-init error" msgstr "UARTの再初期化エラー" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART not yet supported" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART write error" msgstr "UART書き込みエラー" @@ -2095,7 +2226,8 @@ msgid "" msgstr "" #: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/esp32s2/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/esp32s2/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c msgid "Unsupported baudrate" msgstr "非対応のbaudrate" @@ -2146,6 +2278,7 @@ msgid "WARNING: Your code filename has two extensions\n" msgstr "" #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" @@ -3551,6 +3684,14 @@ msgstr "" msgid "pressing both buttons at start up.\n" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "pull_threshold must be between 1 and 32" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "push_threshold must be between 1 and 32" +msgstr "" + #: extmod/modutimeq.c msgid "queue overflow" msgstr "キューがオーバーフローしました" @@ -3755,6 +3896,7 @@ msgstr "time.struct_time()は9要素のシーケンスを受け取ります" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "タイムアウト長は対応する最大値を超えています" diff --git a/locale/ko.po b/locale/ko.po index c284971af20c9..762d876ee4bdd 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -340,6 +340,10 @@ msgstr "사용중인 모든 UART주변 기기" msgid "All event channels in use" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "All state machines in use" +msgstr "" + #: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "All sync event channels in use" msgstr "" @@ -388,6 +392,7 @@ msgstr "" #: ports/cxd56/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c msgid "AnalogOut functionality not supported" msgstr "" @@ -589,6 +594,7 @@ msgstr "값을 삭제할 수 없습니다" #: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c +#: ports/raspberrypi/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" msgstr "" @@ -866,7 +872,8 @@ msgstr "Regex에 오류가 있습니다." msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c +#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c #: shared-bindings/terminalio/Terminal.c @@ -1048,6 +1055,10 @@ msgstr "" msgid "I2C Init Error" msgstr "" +#: ports/raspberrypi/common-hal/busio/I2C.c +msgid "I2C peripheral in use" +msgstr "" + #: shared-bindings/audiobusio/I2SOut.c msgid "I2SOut not available" msgstr "" @@ -1071,6 +1082,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Init program size invalid" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" msgstr "" @@ -1083,6 +1098,31 @@ msgstr "" msgid "Input/output error" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d jumps on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d waits on input outside of count" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "" @@ -1134,7 +1174,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pwmio/PWMOut.c #: ports/cxd56/common-hal/pwmio/PWMOut.c ports/nrf/common-hal/pwmio/PWMOut.c -#: shared-bindings/pwmio/PWMOut.c +#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c msgid "Invalid PWM frequency" msgstr "" @@ -1228,6 +1268,8 @@ msgstr "오른쪽 채널 핀이 잘못되었습니다" #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/SPI.c msgid "Invalid pins" msgstr "핀이 유효하지 않습니다" @@ -1349,6 +1391,36 @@ msgstr "" msgid "Missing MISO or MOSI Pin" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgstr "" + #: shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "" @@ -1402,14 +1474,14 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No TX pin" msgstr "" @@ -1466,6 +1538,10 @@ msgstr "" msgid "No network with that ssid" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "No out in program" +msgstr "" + #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" msgstr "" @@ -1521,6 +1597,10 @@ msgstr "" msgid "Only 8 or 16 bit mono with " msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Only IN/OUT of up to 8 supported" +msgstr "" + #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" @@ -1593,6 +1673,7 @@ msgid "" msgstr "" #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c +#: ports/raspberrypi/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" msgstr "" @@ -1605,11 +1686,20 @@ msgstr "" msgid "Permission denied" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Pin count must be at least 1" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Pin count too large" +msgstr "" + #: ports/atmel-samd/common-hal/analogio/AnalogIn.c #: ports/cxd56/common-hal/analogio/AnalogIn.c #: ports/esp32s2/common-hal/analogio/AnalogIn.c #: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c #: ports/nrf/common-hal/analogio/AnalogIn.c +#: ports/raspberrypi/common-hal/analogio/AnalogIn.c #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Pin does not have ADC capabilities" msgstr "" @@ -1670,10 +1760,34 @@ msgstr "" msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does IN without loading ISR" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does OUT without loading OSR" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program must contain at least one 16-bit instruction." +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program size invalid" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program too large" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c +msgid "RAISE mode is not implemented" +msgstr "" + #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" msgstr "" @@ -1756,6 +1870,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" msgstr "" @@ -1777,6 +1892,10 @@ msgstr "" msgid "SPI Re-initialization error" msgstr "" +#: ports/raspberrypi/common-hal/busio/SPI.c +msgid "SPI peripheral in use" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Sample rate must be positive" msgstr "" @@ -1807,6 +1926,14 @@ msgstr "" msgid "Server side context cannot have hostname" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Set pin count must be between 1 and 5" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Side set pin count must be between 1 and 5" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "" @@ -1971,6 +2098,10 @@ msgstr "" msgid "UART Re-init error" msgstr "" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART not yet supported" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART write error" msgstr "" @@ -2076,7 +2207,8 @@ msgid "" msgstr "" #: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/esp32s2/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/esp32s2/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c msgid "Unsupported baudrate" msgstr "" @@ -2127,6 +2259,7 @@ msgid "WARNING: Your code filename has two extensions\n" msgstr "" #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" @@ -3525,6 +3658,14 @@ msgstr "" msgid "pressing both buttons at start up.\n" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "pull_threshold must be between 1 and 32" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "push_threshold must be between 1 and 32" +msgstr "" + #: extmod/modutimeq.c msgid "queue overflow" msgstr "" @@ -3728,6 +3869,7 @@ msgstr "" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 2829bd9e89edb..a82eeb20700cb 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -342,6 +342,10 @@ msgstr "Alle UART peripherals zijn in gebruik" msgid "All event channels in use" msgstr "Alle event kanalen zijn in gebruik" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "All state machines in use" +msgstr "" + #: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "All sync event channels in use" msgstr "Alle sync event kanalen zijn in gebruik" @@ -390,6 +394,7 @@ msgstr "AnalogIn niet ondersteund door gegeven pin" #: ports/cxd56/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c msgid "AnalogOut functionality not supported" msgstr "AnalogOut functionaliteit niet ondersteund" @@ -591,6 +596,7 @@ msgstr "Kan waardes niet verwijderen" #: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c +#: ports/raspberrypi/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" msgstr "get pull kan niet gedurende output mode" @@ -874,7 +880,8 @@ msgstr "Fout in regex" msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c +#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c #: shared-bindings/terminalio/Terminal.c @@ -1057,6 +1064,10 @@ msgstr "I/O actie op gesloten bestand" msgid "I2C Init Error" msgstr "I2C Init Fout" +#: ports/raspberrypi/common-hal/busio/I2C.c +msgid "I2C peripheral in use" +msgstr "" + #: shared-bindings/audiobusio/I2SOut.c msgid "I2SOut not available" msgstr "I2SOut is niet beschikbaar" @@ -1082,6 +1093,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Incorrecte buffer grootte" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Init program size invalid" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" msgstr "De initialisatie is mislukt vanwege een gebrek aan geheugen" @@ -1094,6 +1109,31 @@ msgstr "Invoer duurt te lang" msgid "Input/output error" msgstr "Input/Output fout" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d jumps on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d waits on input outside of count" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "Onvoldoende authenticatie" @@ -1145,7 +1185,7 @@ msgstr "Ongeldige DAC pin opgegeven" #: ports/atmel-samd/common-hal/pwmio/PWMOut.c #: ports/cxd56/common-hal/pwmio/PWMOut.c ports/nrf/common-hal/pwmio/PWMOut.c -#: shared-bindings/pwmio/PWMOut.c +#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c msgid "Invalid PWM frequency" msgstr "Ongeldige PWM frequentie" @@ -1239,6 +1279,8 @@ msgstr "Ongeldige pin voor rechter kanaal" #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/SPI.c msgid "Invalid pins" msgstr "Ongeldige pinnen" @@ -1360,6 +1402,36 @@ msgstr "Microfoon opstart vertraging moet in bereik van 0.0 tot 1.0 zijn" msgid "Missing MISO or MOSI Pin" msgstr "Ontbrekende MISO of MOSI Pin" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgstr "" + #: shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "%q moet een subklasse zijn." @@ -1413,14 +1485,14 @@ msgstr "Geen MOSI pin" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Geen RX pin" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No TX pin" msgstr "Geen TX pin" @@ -1477,6 +1549,10 @@ msgstr "Geen timers meer beschikbaar op deze pin." msgid "No network with that ssid" msgstr "Geen netwerk met dat SSID gevonden" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "No out in program" +msgstr "" + #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" msgstr "Geen pulldown op pin; 1MOhm aangeraden" @@ -1534,6 +1610,10 @@ msgstr "Oneven pariteit is niet ondersteund" msgid "Only 8 or 16 bit mono with " msgstr "Alleen 8 of 16 bit mono met " +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Only IN/OUT of up to 8 supported" +msgstr "" + #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "Alleen IPv4 adressen worden ondersteund" @@ -1613,6 +1693,7 @@ msgstr "" "tijdens constructie." #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c +#: ports/raspberrypi/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" msgstr "ParallelBus nog niet ondersteund" @@ -1625,11 +1706,20 @@ msgstr "" msgid "Permission denied" msgstr "Toegang geweigerd" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Pin count must be at least 1" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Pin count too large" +msgstr "" + #: ports/atmel-samd/common-hal/analogio/AnalogIn.c #: ports/cxd56/common-hal/analogio/AnalogIn.c #: ports/esp32s2/common-hal/analogio/AnalogIn.c #: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c #: ports/nrf/common-hal/analogio/AnalogIn.c +#: ports/raspberrypi/common-hal/analogio/AnalogIn.c #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Pin does not have ADC capabilities" msgstr "Pin heeft geen ADC mogelijkheden" @@ -1699,10 +1789,34 @@ msgstr "" msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does IN without loading ISR" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does OUT without loading OSR" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program must contain at least one 16-bit instruction." +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program size invalid" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program too large" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Pull niet gebruikt wanneer de richting output is." +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c +msgid "RAISE mode is not implemented" +msgstr "" + #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" msgstr "RNG DeInit Fout" @@ -1785,6 +1899,7 @@ msgstr "SD kaart CSD formaat niet ondersteund" #: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" msgstr "SDA of SCL hebben een pullup nodig" @@ -1806,6 +1921,10 @@ msgstr "SPI Init Fout" msgid "SPI Re-initialization error" msgstr "SPI Herinitialisatie Fout" +#: ports/raspberrypi/common-hal/busio/SPI.c +msgid "SPI peripheral in use" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Sample rate must be positive" msgstr "Sample rate moet positief zijn" @@ -1836,6 +1955,14 @@ msgstr "Serializer in gebruik" msgid "Server side context cannot have hostname" msgstr "Context aan de serverkant kan geen hostnaam hebben" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Set pin count must be between 1 and 5" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Side set pin count must be between 1 and 5" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "Afmeting niet ondersteund" @@ -2010,6 +2137,10 @@ msgstr "UART Init Fout" msgid "UART Re-init error" msgstr "UART Re-init Fout" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART not yet supported" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART write error" msgstr "UART schrijf fout" @@ -2116,7 +2247,8 @@ msgstr "" "apparaat geweigerd of genegeerd werd." #: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/esp32s2/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/esp32s2/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c msgid "Unsupported baudrate" msgstr "Niet-ondersteunde baudsnelheid" @@ -2167,6 +2299,7 @@ msgid "WARNING: Your code filename has two extensions\n" msgstr "WAARSCHUWING: De bestandsnaam van de code heeft twee extensies\n" #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" "WatchDogTimer kan niet worden gedeïnitialiseerd zodra de modus in ingesteld " @@ -3583,6 +3716,14 @@ msgstr "druk bootknop in bij opstarten.\n" msgid "pressing both buttons at start up.\n" msgstr "druk beide knoppen in bij opstarten.\n" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "pull_threshold must be between 1 and 32" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "push_threshold must be between 1 and 32" +msgstr "" + #: extmod/modutimeq.c msgid "queue overflow" msgstr "wachtrij overloop" @@ -3788,6 +3929,7 @@ msgstr "time.struct_time() accepteert een 9-rij" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "time-outduur is groter dan de ondersteunde maximale waarde" diff --git a/locale/pl.po b/locale/pl.po index 0c03a0ee0a9b0..fcd675784db5d 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -344,6 +344,10 @@ msgstr "Wszystkie peryferia UART w użyciu" msgid "All event channels in use" msgstr "Wszystkie kanały zdarzeń w użyciu" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "All state machines in use" +msgstr "" + #: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "All sync event channels in use" msgstr "Wszystkie kanały zdarzeń synchronizacji w użyciu" @@ -392,6 +396,7 @@ msgstr "AnalogIn nie jest obsługiwany na danym pinie" #: ports/cxd56/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c msgid "AnalogOut functionality not supported" msgstr "AnalogOut jest niewspierane" @@ -593,6 +598,7 @@ msgstr "Nie można usunąć" #: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c +#: ports/raspberrypi/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" msgstr "Nie ma podciągnięcia w trybie wyjścia" @@ -874,7 +880,8 @@ msgstr "Błąd w regex" msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c +#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c #: shared-bindings/terminalio/Terminal.c @@ -1056,6 +1063,10 @@ msgstr "Operacja I/O na zamkniętym pliku" msgid "I2C Init Error" msgstr "Błąd inicjalizacji I2C" +#: ports/raspberrypi/common-hal/busio/I2C.c +msgid "I2C peripheral in use" +msgstr "" + #: shared-bindings/audiobusio/I2SOut.c msgid "I2SOut not available" msgstr "I2SOut niedostępne" @@ -1081,6 +1092,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Niewłaściwa wielkość bufora" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Init program size invalid" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" msgstr "Inicjalizacja nie powiodła się z powodu braku pamięci" @@ -1093,6 +1108,31 @@ msgstr "" msgid "Input/output error" msgstr "Błąd I/O" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d jumps on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d waits on input outside of count" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "Niewystarczające uwierzytelnienie" @@ -1144,7 +1184,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pwmio/PWMOut.c #: ports/cxd56/common-hal/pwmio/PWMOut.c ports/nrf/common-hal/pwmio/PWMOut.c -#: shared-bindings/pwmio/PWMOut.c +#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c msgid "Invalid PWM frequency" msgstr "Zła częstotliwość PWM" @@ -1238,6 +1278,8 @@ msgstr "Zła nóżka dla prawego kanału" #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/SPI.c msgid "Invalid pins" msgstr "Złe nóżki" @@ -1360,6 +1402,36 @@ msgstr "Opóźnienie włączenia mikrofonu musi być w zakresie od 0.0 do 1.0" msgid "Missing MISO or MOSI Pin" msgstr "Brak pinu MISO lub MOSI" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgstr "" + #: shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "" @@ -1413,14 +1485,14 @@ msgstr "Brak pinu MOSI" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Brak nóżki RX" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No TX pin" msgstr "Brak nóżki TX" @@ -1477,6 +1549,10 @@ msgstr "" msgid "No network with that ssid" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "No out in program" +msgstr "" + #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" msgstr "" @@ -1532,6 +1608,10 @@ msgstr "Nieparzysta parzystość nie jest wspierana" msgid "Only 8 or 16 bit mono with " msgstr "Tylko 8 lub 16 bitów mono z " +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Only IN/OUT of up to 8 supported" +msgstr "" + #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" @@ -1604,6 +1684,7 @@ msgid "" msgstr "Nie można zmienić częstotliwości PWM gdy variable_frequency=False." #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c +#: ports/raspberrypi/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" msgstr "ParallelBus nie jest jeszcze obsługiwany" @@ -1616,11 +1697,20 @@ msgstr "" msgid "Permission denied" msgstr "Odmowa dostępu" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Pin count must be at least 1" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Pin count too large" +msgstr "" + #: ports/atmel-samd/common-hal/analogio/AnalogIn.c #: ports/cxd56/common-hal/analogio/AnalogIn.c #: ports/esp32s2/common-hal/analogio/AnalogIn.c #: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c #: ports/nrf/common-hal/analogio/AnalogIn.c +#: ports/raspberrypi/common-hal/analogio/AnalogIn.c #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Pin does not have ADC capabilities" msgstr "Nóżka nie obsługuje ADC" @@ -1681,10 +1771,34 @@ msgstr "" msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does IN without loading ISR" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does OUT without loading OSR" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program must contain at least one 16-bit instruction." +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program size invalid" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program too large" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Podciągnięcie nieużywane w trybie wyjścia." +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c +msgid "RAISE mode is not implemented" +msgstr "" + #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" msgstr "" @@ -1767,6 +1881,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" msgstr "SDA lub SCL wymagają podciągnięcia" @@ -1788,6 +1903,10 @@ msgstr "Błąd inicjowania SPI" msgid "SPI Re-initialization error" msgstr "Błąd ponownej inicjalizacji SPI" +#: ports/raspberrypi/common-hal/busio/SPI.c +msgid "SPI peripheral in use" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Sample rate must be positive" msgstr "Częstotliwość próbkowania musi być dodatnia" @@ -1818,6 +1937,14 @@ msgstr "Serializator w użyciu" msgid "Server side context cannot have hostname" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Set pin count must be between 1 and 5" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Side set pin count must be between 1 and 5" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "" @@ -1982,6 +2109,10 @@ msgstr "" msgid "UART Re-init error" msgstr "" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART not yet supported" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART write error" msgstr "Błąd zapisu UART" @@ -2086,7 +2217,8 @@ msgid "" msgstr "" #: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/esp32s2/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/esp32s2/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c msgid "Unsupported baudrate" msgstr "Zła szybkość transmisji" @@ -2137,6 +2269,7 @@ msgid "WARNING: Your code filename has two extensions\n" msgstr "UWAGA: Nazwa pliku ma dwa rozszerzenia\n" #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" @@ -3543,6 +3676,14 @@ msgstr "" msgid "pressing both buttons at start up.\n" msgstr "" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "pull_threshold must be between 1 and 32" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "push_threshold must be between 1 and 32" +msgstr "" + #: extmod/modutimeq.c msgid "queue overflow" msgstr "przepełnienie kolejki" @@ -3747,6 +3888,7 @@ msgstr "time.struct_time() wymaga 9-elementowej sekwencji" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index b8e98ebd61f1c..b1e5757b5f7b9 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -352,6 +352,10 @@ msgstr "Todos os periféricos UART estão em uso" msgid "All event channels in use" msgstr "Todos os canais de eventos em uso" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "All state machines in use" +msgstr "" + #: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "All sync event channels in use" msgstr "Todos os canais dos eventos de sincronização em uso" @@ -400,6 +404,7 @@ msgstr "O AnalogIn não é compatível no pino informado" #: ports/cxd56/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c msgid "AnalogOut functionality not supported" msgstr "Funcionalidade AnalogOut não suportada" @@ -608,6 +613,7 @@ msgstr "Não é possível excluir valores" #: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c +#: ports/raspberrypi/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" msgstr "Não é possível obter (pull) enquanto estiver no modo saída" @@ -892,7 +898,8 @@ msgstr "Erro no regex" msgid "Error: Failure to bind" msgstr "Erro: Falha na vinculação" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c +#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c #: shared-bindings/terminalio/Terminal.c @@ -1075,6 +1082,10 @@ msgstr "Operação I/O no arquivo fechado" msgid "I2C Init Error" msgstr "Erro de inicialização do I2C" +#: ports/raspberrypi/common-hal/busio/I2C.c +msgid "I2C peripheral in use" +msgstr "" + #: shared-bindings/audiobusio/I2SOut.c msgid "I2SOut not available" msgstr "O I2SOut não está disponível" @@ -1100,6 +1111,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "O tamanho do buffer está incorreto" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Init program size invalid" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" msgstr "A inicialização falhou devido à falta de memória" @@ -1112,6 +1127,31 @@ msgstr "A entrada está demorando demais" msgid "Input/output error" msgstr "Erro de entrada/saída" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d jumps on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d waits on input outside of count" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "Autenticação insuficiente" @@ -1163,7 +1203,7 @@ msgstr "O pino DAC informado é inválido" #: ports/atmel-samd/common-hal/pwmio/PWMOut.c #: ports/cxd56/common-hal/pwmio/PWMOut.c ports/nrf/common-hal/pwmio/PWMOut.c -#: shared-bindings/pwmio/PWMOut.c +#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c msgid "Invalid PWM frequency" msgstr "Frequência PWM inválida" @@ -1257,6 +1297,8 @@ msgstr "Pino inválido para canal direito" #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/SPI.c msgid "Invalid pins" msgstr "Pinos inválidos" @@ -1378,6 +1420,36 @@ msgstr "O atraso na inicialização do microfone deve estar entre 0,0 e 1,0" msgid "Missing MISO or MOSI Pin" msgstr "O pino MISO ou MOSI está ausente" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgstr "" + #: shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "Deve ser uma subclasse %q." @@ -1431,14 +1503,14 @@ msgstr "Nenhum pino MOSI" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Nenhum pino RX" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No TX pin" msgstr "Nenhum pino TX" @@ -1495,6 +1567,10 @@ msgstr "Não há mais temporizadores disponíveis neste pino." msgid "No network with that ssid" msgstr "Não há rede com este ssid" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "No out in program" +msgstr "" + #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" msgstr "Não há pulldown no pino; É recomendável utilizar um resistor de 1M ohm" @@ -1551,6 +1627,10 @@ msgstr "A paridade ímpar não é compatível" msgid "Only 8 or 16 bit mono with " msgstr "Apenas mono com 8 ou 16 bits com " +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Only IN/OUT of up to 8 supported" +msgstr "" + #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "Somente os endereços IPv4 são suportados" @@ -1631,6 +1711,7 @@ msgstr "" "na construção." #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c +#: ports/raspberrypi/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" msgstr "O ParallelBus ainda não é compatível" @@ -1643,11 +1724,20 @@ msgstr "O periférico está em uso" msgid "Permission denied" msgstr "Permissão negada" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Pin count must be at least 1" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Pin count too large" +msgstr "" + #: ports/atmel-samd/common-hal/analogio/AnalogIn.c #: ports/cxd56/common-hal/analogio/AnalogIn.c #: ports/esp32s2/common-hal/analogio/AnalogIn.c #: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c #: ports/nrf/common-hal/analogio/AnalogIn.c +#: ports/raspberrypi/common-hal/analogio/AnalogIn.c #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Pin does not have ADC capabilities" msgstr "O pino não tem recursos de ADC" @@ -1720,10 +1810,34 @@ msgstr "" "Tentando entrar no deep sleep até o alarme, pressione CTRL-C ou grave o " "arquivo.\n" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does IN without loading ISR" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does OUT without loading OSR" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program must contain at least one 16-bit instruction." +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program size invalid" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program too large" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "O Pull não foi usado quando a direção for gerada." +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c +msgid "RAISE mode is not implemented" +msgstr "" + #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" msgstr "Erro DeInit RNG" @@ -1806,6 +1920,7 @@ msgstr "O formato CSD do Cartão SD não é compatível" #: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" msgstr "SDA ou SCL precisa de um pull up" @@ -1827,6 +1942,10 @@ msgstr "Houve um erro na inicialização SPI" msgid "SPI Re-initialization error" msgstr "Houve um erro na reinicialização SPI" +#: ports/raspberrypi/common-hal/busio/SPI.c +msgid "SPI peripheral in use" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Sample rate must be positive" msgstr "A taxa de amostragem deve ser positiva" @@ -1857,6 +1976,14 @@ msgstr "Serializer em uso" msgid "Server side context cannot have hostname" msgstr "O contexto do lado do servidor não pode ter nome de host" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Set pin count must be between 1 and 5" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Side set pin count must be between 1 and 5" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "O tamanho não é suportado" @@ -2035,6 +2162,10 @@ msgstr "Houve um erro na inicialização do UART" msgid "UART Re-init error" msgstr "Houve um erro na reinicialização do UART" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART not yet supported" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART write error" msgstr "Houve um erro na gravação UART" @@ -2141,7 +2272,8 @@ msgstr "" "dispositivo tenha sido recusado ou ignorado." #: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/esp32s2/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/esp32s2/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c msgid "Unsupported baudrate" msgstr "Taxa de transmissão não suportada" @@ -2192,6 +2324,7 @@ msgid "WARNING: Your code filename has two extensions\n" msgstr "AVISO: Seu arquivo de código tem duas extensões\n" #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" "O WatchDogTimer não pode ser não-inicializado uma vez que o modo é definido " @@ -3620,6 +3753,14 @@ msgstr "pressionando o botão de boot na inicialização.\n" msgid "pressing both buttons at start up.\n" msgstr "pressionando ambos os botões durante a inicialização.\n" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "pull_threshold must be between 1 and 32" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "push_threshold must be between 1 and 32" +msgstr "" + #: extmod/modutimeq.c msgid "queue overflow" msgstr "estouro de fila" @@ -3825,6 +3966,7 @@ msgstr "time.struct_time() leva uma sequência com 9" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "a duração do tempo limite excedeu o valor máximo suportado" diff --git a/locale/sv.po b/locale/sv.po index 3aa0dcc1e72dd..f1595dfde24d3 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -346,6 +346,10 @@ msgstr "Alla UART-kringutrustning används" msgid "All event channels in use" msgstr "Alla händelsekanaler används" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "All state machines in use" +msgstr "" + #: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "All sync event channels in use" msgstr "Alla händelsekanaler används" @@ -394,6 +398,7 @@ msgstr "AnalogIn stöds inte på angiven pinne" #: ports/cxd56/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c msgid "AnalogOut functionality not supported" msgstr "AnalogOut-funktionalitet stöds inte" @@ -596,6 +601,7 @@ msgstr "Kan inte radera värden" #: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c +#: ports/raspberrypi/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" msgstr "Kan inte ange pull i output-läge" @@ -879,7 +885,8 @@ msgstr "Fel i regex" msgid "Error: Failure to bind" msgstr "Fel: Bind misslyckades" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c +#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c #: shared-bindings/terminalio/Terminal.c @@ -1061,6 +1068,10 @@ msgstr "I/O-operation på stängd fil" msgid "I2C Init Error" msgstr "I2C init-fel" +#: ports/raspberrypi/common-hal/busio/I2C.c +msgid "I2C peripheral in use" +msgstr "" + #: shared-bindings/audiobusio/I2SOut.c msgid "I2SOut not available" msgstr "I2SOut är inte tillgängligt" @@ -1086,6 +1097,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Fel buffertstorlek" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Init program size invalid" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" msgstr "Initieringen misslyckades på grund av minnesbrist" @@ -1098,6 +1113,31 @@ msgstr "Indata tar för lång tid" msgid "Input/output error" msgstr "Indata-/utdatafel" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d jumps on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d waits on input outside of count" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "Otillräcklig autentisering" @@ -1149,7 +1189,7 @@ msgstr "Ogiltig DAC-pinne angiven" #: ports/atmel-samd/common-hal/pwmio/PWMOut.c #: ports/cxd56/common-hal/pwmio/PWMOut.c ports/nrf/common-hal/pwmio/PWMOut.c -#: shared-bindings/pwmio/PWMOut.c +#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c msgid "Invalid PWM frequency" msgstr "Ogiltig PWM-frekvens" @@ -1243,6 +1283,8 @@ msgstr "Ogiltig pinne för höger kanal" #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/SPI.c msgid "Invalid pins" msgstr "Ogiltiga pinnar" @@ -1365,6 +1407,36 @@ msgstr "" msgid "Missing MISO or MOSI Pin" msgstr "MISO- eller MOSI-pinne saknas" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgstr "" + #: shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "Måste vara en %q-subklass." @@ -1418,14 +1490,14 @@ msgstr "Ingen MOSI-pinne" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Ingen RX-pinne" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No TX pin" msgstr "Ingen TX-pinne" @@ -1482,6 +1554,10 @@ msgstr "Inga fler timers tillgängliga på denna pinne." msgid "No network with that ssid" msgstr "Inget nätverk med sådant ssid" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "No out in program" +msgstr "" + #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" msgstr "Ingen pulldown på pinnen; 1Mohm rekommenderas" @@ -1539,6 +1615,10 @@ msgstr "Udda paritet stöds inte" msgid "Only 8 or 16 bit mono with " msgstr "Endast 8 eller 16 bitars mono med " +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Only IN/OUT of up to 8 supported" +msgstr "" + #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "Endast IPv4-adresser stöds" @@ -1616,6 +1696,7 @@ msgstr "" "skapandet." #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c +#: ports/raspberrypi/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" msgstr "ParallelBus stöds ännu inte" @@ -1628,11 +1709,20 @@ msgstr "Periferi i bruk" msgid "Permission denied" msgstr "Åtkomst nekad" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Pin count must be at least 1" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Pin count too large" +msgstr "" + #: ports/atmel-samd/common-hal/analogio/AnalogIn.c #: ports/cxd56/common-hal/analogio/AnalogIn.c #: ports/esp32s2/common-hal/analogio/AnalogIn.c #: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c #: ports/nrf/common-hal/analogio/AnalogIn.c +#: ports/raspberrypi/common-hal/analogio/AnalogIn.c #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Pin does not have ADC capabilities" msgstr "Pinnen har inte ADC-funktionalitet" @@ -1702,10 +1792,34 @@ msgstr "" msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "Fingerar djup sömn tills larm, Ctrl-C eller filskrivning.\n" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does IN without loading ISR" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does OUT without loading OSR" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program must contain at least one 16-bit instruction." +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program size invalid" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program too large" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Pull används inte när riktningen är output." +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c +msgid "RAISE mode is not implemented" +msgstr "" + #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" msgstr "RNG DeInit-fel" @@ -1788,6 +1902,7 @@ msgstr "SD-kort CSD-format stöds inte" #: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" msgstr "SDA eller SCL behöver en pullup" @@ -1809,6 +1924,10 @@ msgstr "SPI Init-fel" msgid "SPI Re-initialization error" msgstr "SPI reinitialiseringsfel" +#: ports/raspberrypi/common-hal/busio/SPI.c +msgid "SPI peripheral in use" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Sample rate must be positive" msgstr "Samplingsfrekvensen måste vara positiv" @@ -1839,6 +1958,14 @@ msgstr "Serializern används redan" msgid "Server side context cannot have hostname" msgstr "Serversidans kontext kan inte ha värdnamn" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Set pin count must be between 1 and 5" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Side set pin count must be between 1 and 5" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "Storleken stöds inte" @@ -2013,6 +2140,10 @@ msgstr "UART Init-fel" msgid "UART Re-init error" msgstr "UART reinit-fel" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART not yet supported" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART write error" msgstr "UART skrivfel" @@ -2119,7 +2250,8 @@ msgstr "" "eller ignorerades." #: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/esp32s2/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/esp32s2/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c msgid "Unsupported baudrate" msgstr "Baudrate stöd inte" @@ -2170,6 +2302,7 @@ msgid "WARNING: Your code filename has two extensions\n" msgstr "VARNING: Ditt filnamn för kod har två tillägg\n" #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "WatchDogTimer kan inte avinitialiseras när läget är inställt på RESET" @@ -3583,6 +3716,14 @@ msgstr "trycka på startknappen vid start.\n" msgid "pressing both buttons at start up.\n" msgstr "trycka båda knapparna vid uppstart.\n" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "pull_threshold must be between 1 and 32" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "push_threshold must be between 1 and 32" +msgstr "" + #: extmod/modutimeq.c msgid "queue overflow" msgstr "köstorlek överskreds" @@ -3788,6 +3929,7 @@ msgstr "time.struct_time() kräver en 9-sekvens" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "timeout-längd överskred det maximala värde som stöds" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 2af80013b133a..37f1fbd35e3d4 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -349,6 +349,10 @@ msgstr "Suǒyǒu UART wàiwéi zhèngzài shǐyòng" msgid "All event channels in use" msgstr "Suǒyǒu shǐyòng de shìjiàn píndào" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "All state machines in use" +msgstr "" + #: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "All sync event channels in use" msgstr "Suǒyǒu tóngbù shìjiàn píndào shǐyòng" @@ -397,6 +401,7 @@ msgstr "Gěi dìng de yǐn jiǎo bù zhīchí AnalogIn" #: ports/cxd56/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c msgid "AnalogOut functionality not supported" msgstr "Bù zhīchí AnalogOut gōngnéng" @@ -600,6 +605,7 @@ msgstr "Wúfǎ shānchú zhí" #: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c +#: ports/raspberrypi/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" msgstr "Zài shūchū móshì xià wúfǎ huòqǔ lādòng" @@ -879,7 +885,8 @@ msgstr "Zhèngzé biǎodá shì cuòwù" msgid "Error: Failure to bind" msgstr "cuò wù: bǎng dìng shī bài" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c +#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c #: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c #: shared-bindings/terminalio/Terminal.c @@ -1061,6 +1068,10 @@ msgstr "Wénjiàn shàng de I/ O cāozuò" msgid "I2C Init Error" msgstr "I2C chūshǐhuà cuòwù" +#: ports/raspberrypi/common-hal/busio/I2C.c +msgid "I2C peripheral in use" +msgstr "" + #: shared-bindings/audiobusio/I2SOut.c msgid "I2SOut not available" msgstr "I2SOut bù kě yòng" @@ -1086,6 +1097,10 @@ msgstr "" msgid "Incorrect buffer size" msgstr "Huǎnchōng qū dàxiǎo bù zhèngquè" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Init program size invalid" +msgstr "" + #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" msgstr "yóu yú nèi cún bù zú, chū shǐ huà shī bài" @@ -1098,6 +1113,31 @@ msgstr "Shūrù shíjiānguò zhǎng" msgid "Input/output error" msgstr "Shūrù/shūchū cuòwù" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d jumps on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Instruction %d waits on input outside of count" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "Rènzhèng bùzú" @@ -1149,7 +1189,7 @@ msgstr "Tí gōng liǎo wúxiào de DAC yǐn jiǎo" #: ports/atmel-samd/common-hal/pwmio/PWMOut.c #: ports/cxd56/common-hal/pwmio/PWMOut.c ports/nrf/common-hal/pwmio/PWMOut.c -#: shared-bindings/pwmio/PWMOut.c +#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c msgid "Invalid PWM frequency" msgstr "Wúxiào de PWM pínlǜ" @@ -1243,6 +1283,8 @@ msgstr "Yòuxián tōngdào yǐn jiǎo wúxiào" #: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/SPI.c msgid "Invalid pins" msgstr "Wúxiào de yǐn jiǎo" @@ -1364,6 +1406,36 @@ msgstr "Màikèfēng qǐdòng yánchí bìxū zài 0.0 Dào 1.0 De fànwéi nèi msgid "Missing MISO or MOSI Pin" msgstr "Quēshǎo MISO huò MOSI yǐn jiǎo" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#, c-format +msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgstr "" + #: shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "Bìxū shì %q zi lèi." @@ -1417,14 +1489,14 @@ msgstr "Méiyǒu MOSI yǐn jiǎo" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Wèi zhǎodào RX yǐn jiǎo" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/esp32s2/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No TX pin" msgstr "Wèi zhǎodào TX yǐn jiǎo" @@ -1481,6 +1553,10 @@ msgstr "Gāi yǐn jiǎo shàng méiyǒu kěyòng de dìngshí qì." msgid "No network with that ssid" msgstr "Méiyǒu wǎngluò yǔ gāi ssid" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "No out in program" +msgstr "" + #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" msgstr "Yǐn jiǎo shàng méiyǒu xiàlā; 1Mohm tuījiàn" @@ -1537,6 +1613,10 @@ msgstr "Bù zhīchí jīshù" msgid "Only 8 or 16 bit mono with " msgstr "Zhǐyǒu 8 huò 16 wèi dānwèi " +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Only IN/OUT of up to 8 supported" +msgstr "" + #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "Jǐn zhīchí IPv4 dìzhǐ" @@ -1614,6 +1694,7 @@ msgid "" msgstr "Dāng biànliàng_pínlǜ shì False zài jiànzhú shí PWM pínlǜ bùkě xiě." #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c +#: ports/raspberrypi/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" msgstr "Shàng bù zhīchí ParallelBus" @@ -1626,11 +1707,20 @@ msgstr "shǐ yòng zhōng de wài shè" msgid "Permission denied" msgstr "Quánxiàn bèi jùjué" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Pin count must be at least 1" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Pin count too large" +msgstr "" + #: ports/atmel-samd/common-hal/analogio/AnalogIn.c #: ports/cxd56/common-hal/analogio/AnalogIn.c #: ports/esp32s2/common-hal/analogio/AnalogIn.c #: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c #: ports/nrf/common-hal/analogio/AnalogIn.c +#: ports/raspberrypi/common-hal/analogio/AnalogIn.c #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Pin does not have ADC capabilities" msgstr "Pin méiyǒu ADC nénglì" @@ -1697,10 +1787,34 @@ msgstr "" "jiǎ zhuāng shēn dù shuì mián , zhí dào bào jǐng , CTRL-C huò wén jiàn xiě " "rù .\n" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does IN without loading ISR" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Program does OUT without loading OSR" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program must contain at least one 16-bit instruction." +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program size invalid" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Program too large" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Fāngxiàng shūchū shí Pull méiyǒu shǐyòng." +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c +msgid "RAISE mode is not implemented" +msgstr "" + #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" msgstr "RNG qǔxiāo chūshǐhuà cuòwù" @@ -1783,6 +1897,7 @@ msgstr "Bù zhīchí SD kǎ CSD géshì" #: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" msgstr "SDA huò SCL xūyào lādòng" @@ -1804,6 +1919,10 @@ msgstr "SPI chūshǐhuà cuòwù" msgid "SPI Re-initialization error" msgstr "SPI chóngxīn chūshǐhuà cuòwù" +#: ports/raspberrypi/common-hal/busio/SPI.c +msgid "SPI peripheral in use" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Sample rate must be positive" msgstr "Cǎiyàng lǜ bìxū wèi zhèng shù" @@ -1834,6 +1953,14 @@ msgstr "Xùliè huà yǐjīng shǐyòngguò" msgid "Server side context cannot have hostname" msgstr "Fúwùqì duān shàngxiàwén bùnéng jùyǒu zhǔjī míng" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Set pin count must be between 1 and 5" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "Side set pin count must be between 1 and 5" +msgstr "" + #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "bù zhī chí dà xiǎo" @@ -2007,6 +2134,10 @@ msgstr "UART chūshǐhuà cuòwù" msgid "UART Re-init error" msgstr "UART chóngxīn chūshǐhuà cuòwù" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART not yet supported" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART write error" msgstr "UART xiě cuòwù" @@ -2113,7 +2244,8 @@ msgstr "" "huò hūlüè." #: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/esp32s2/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/esp32s2/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c msgid "Unsupported baudrate" msgstr "Bù zhīchí de baudrate" @@ -2164,6 +2296,7 @@ msgid "WARNING: Your code filename has two extensions\n" msgstr "Jǐnggào: Nǐ de dàimǎ wénjiàn míng yǒu liǎng gè kuòzhǎn míng\n" #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "Yīdàn jiāng móshì shèzhì wèi RESET, jiù wúfǎ chūshǐhuà WatchDog Timer" @@ -3576,6 +3709,14 @@ msgstr "Zài qǐdòng shí àn qǐdòng ànniǔ.\n" msgid "pressing both buttons at start up.\n" msgstr "zài qǐdòng shí tóngshí àn xià liǎng gè ànniǔ.\n" +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "pull_threshold must be between 1 and 32" +msgstr "" + +#: ports/raspberrypi/bindings/rp2pio/StateMachine.c +msgid "push_threshold must be between 1 and 32" +msgstr "" + #: extmod/modutimeq.c msgid "queue overflow" msgstr "duìliè yìchū" @@ -3781,6 +3922,7 @@ msgstr "time.struct_time() xūyào 9 xùliè" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c +#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "chāoshí shíjiān chāoguò zuìdà zhīchí zhí" From 86fbf5cc3df3e8d6bd102ebb4f4ae2461c1f8fc8 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Mon, 1 Feb 2021 04:50:44 +0100 Subject: [PATCH 766/770] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 1 + locale/cs.po | 1 + locale/de_DE.po | 1 + locale/el.po | 1 + locale/es.po | 1 + locale/fil.po | 1 + locale/fr.po | 1 + locale/hi.po | 1 + locale/it_IT.po | 1 + locale/ja.po | 1 + locale/ko.po | 1 + locale/nl.po | 1 + locale/pl.po | 1 + locale/pt_BR.po | 1 + locale/sv.po | 1 + locale/zh_Latn_pinyin.po | 1 + 16 files changed, 16 insertions(+) diff --git a/locale/ID.po b/locale/ID.po index 651ecff3f0363..3e0762069863f 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -3689,6 +3689,7 @@ msgstr "" #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h +#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h #: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h diff --git a/locale/cs.po b/locale/cs.po index dfb4b53660423..e6ad0a83f7c9b 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -3640,6 +3640,7 @@ msgstr "" #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h +#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h #: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h diff --git a/locale/de_DE.po b/locale/de_DE.po index f613426b58665..e23f27bfe3e98 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -3720,6 +3720,7 @@ msgstr "pow () mit 3 Argumenten erfordert Integer" #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h +#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h #: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h diff --git a/locale/el.po b/locale/el.po index a4aa93f9f1914..0c7cb5f6bb481 100644 --- a/locale/el.po +++ b/locale/el.po @@ -3637,6 +3637,7 @@ msgstr "" #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h +#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h #: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h diff --git a/locale/es.po b/locale/es.po index bca7eada069a6..b446ceb4847ba 100644 --- a/locale/es.po +++ b/locale/es.po @@ -3710,6 +3710,7 @@ msgstr "pow() con 3 argumentos requiere enteros" #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h +#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h #: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h diff --git a/locale/fil.po b/locale/fil.po index 97e99cfd57549..bba9761ad97c0 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -3686,6 +3686,7 @@ msgstr "pow() na may 3 argumento kailangan ng integers" #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h +#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h #: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h diff --git a/locale/fr.po b/locale/fr.po index ac78a6f7d81fb..83af1f9f7c262 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -3747,6 +3747,7 @@ msgstr "pow() avec 3 arguments nécessite des entiers" #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h +#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h #: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h diff --git a/locale/hi.po b/locale/hi.po index e713d6b86c364..5150d164e1c0b 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -3637,6 +3637,7 @@ msgstr "" #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h +#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h #: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h diff --git a/locale/it_IT.po b/locale/it_IT.po index 61e492a7a9984..cecfe112987a1 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -3694,6 +3694,7 @@ msgstr "pow() con 3 argomenti richiede interi" #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h +#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h #: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h diff --git a/locale/ja.po b/locale/ja.po index a7d4835bc6171..c139ec3cc8a18 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -3667,6 +3667,7 @@ msgstr "pow()の第3引数には整数が必要" #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h +#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h #: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h diff --git a/locale/ko.po b/locale/ko.po index 762d876ee4bdd..54e57f191fc37 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -3641,6 +3641,7 @@ msgstr "" #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h +#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h #: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h diff --git a/locale/nl.po b/locale/nl.po index a82eeb20700cb..de9aed9e7d00c 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -3699,6 +3699,7 @@ msgstr "pow() met 3 argumenten vereist integers" #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h +#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h #: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h diff --git a/locale/pl.po b/locale/pl.po index fcd675784db5d..e9a794cac8b86 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -3659,6 +3659,7 @@ msgstr "trzyargumentowe pow() wymaga liczb całkowitych" #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h +#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h #: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h diff --git a/locale/pt_BR.po b/locale/pt_BR.po index b1e5757b5f7b9..4194bcc93990e 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -3736,6 +3736,7 @@ msgstr "o pow() com 3 argumentos requer números inteiros" #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h +#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h #: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h diff --git a/locale/sv.po b/locale/sv.po index f1595dfde24d3..c4c51fcc00716 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -3699,6 +3699,7 @@ msgstr "pow() med 3 argument kräver heltal" #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h +#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h #: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 37f1fbd35e3d4..09def433009eb 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -3692,6 +3692,7 @@ msgstr "pow() yǒu 3 cānshù xūyào zhěngshù" #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h +#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h #: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h #: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h From 745ba01768e4f72fcd47c39a8a719f982772ca61 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 1 Feb 2021 12:22:35 -0500 Subject: [PATCH 767/770] shrink simmel --- ports/nrf/boards/simmel/mpconfigboard.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/nrf/boards/simmel/mpconfigboard.mk b/ports/nrf/boards/simmel/mpconfigboard.mk index 032caac408c59..6bc05a7f0849e 100644 --- a/ports/nrf/boards/simmel/mpconfigboard.mk +++ b/ports/nrf/boards/simmel/mpconfigboard.mk @@ -3,6 +3,8 @@ USB_PID = 0xc051 USB_PRODUCT = "Simmel" USB_MANUFACTURER = "Betrusted" +CIRCUITPY_DEVICES="CDC,MSC,HID" + MCU_CHIP = nrf52833 # SPI_FLASH_FILESYSTEM = 1 @@ -29,6 +31,7 @@ CIRCUITPY_RTC = 1 CIRCUITPY_SDCARDIO = 0 CIRCUITPY_TOUCHIO = 0 CIRCUITPY_ULAB = 0 +CIRCUITPY_USB_MIDI = 0 CIRCUITPY_WATCHDOG = 1 # Enable micropython.native From c3aa1ec10edff00513ecb1deac8d563e4617a2d5 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Mon, 1 Feb 2021 08:00:37 +0000 Subject: [PATCH 768/770] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (955 of 955 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 61 +++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 4194bcc93990e..2b9f9afa2eacb 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-01-30 02:32+0000\n" +"PO-Revision-Date: 2021-02-01 17:50+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -354,7 +354,7 @@ msgstr "Todos os canais de eventos em uso" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" -msgstr "" +msgstr "O estado de todas as máquinas em uso" #: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "All sync event channels in use" @@ -1084,7 +1084,7 @@ msgstr "Erro de inicialização do I2C" #: ports/raspberrypi/common-hal/busio/I2C.c msgid "I2C peripheral in use" -msgstr "" +msgstr "Periférico I2C em uso" #: shared-bindings/audiobusio/I2SOut.c msgid "I2SOut not available" @@ -1113,7 +1113,7 @@ msgstr "O tamanho do buffer está incorreto" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Init program size invalid" -msgstr "" +msgstr "O tamanho do programa Init é inválido" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" @@ -1130,27 +1130,27 @@ msgstr "Erro de entrada/saída" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Instruction %d jumps on pin" -msgstr "" +msgstr "A instrução %d salta no pino" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Instruction %d shifts in more bits than pin count" -msgstr "" +msgstr "A instrução %d muda com mais bits do que a quantidade dos pinos" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Instruction %d shifts out more bits than pin count" -msgstr "" +msgstr "A instrução %d desloca mais bits do que a quantidade dos pinos" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Instruction %d uses extra pin" -msgstr "" +msgstr "A instrução %d usa um pino extra" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Instruction %d waits on input outside of count" -msgstr "" +msgstr "A instrução %d aguarda a entrada de fora da contagem" #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" @@ -1423,32 +1423,32 @@ msgstr "O pino MISO ou MOSI está ausente" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" -msgstr "" +msgstr "Faltando first_in_pin. A instrução %d lê pinos(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" -msgstr "" +msgstr "Faltando first_in_pin. A instrução %d muda a partir do(s) pino(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d waits based on pin" -msgstr "" +msgstr "Faltando first_in_pin. A instrução %d aguarda com base no pino" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" -msgstr "" +msgstr "Faltando first_out_pin. A instrução %d muda para o(s) pinos(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_out_pin. Instruction %d writes pin(s)" -msgstr "" +msgstr "Faltando first_out_pin. A instrução %d escreve nos pinos(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_set_pin. Instruction %d sets pin(s)" -msgstr "" +msgstr "Faltando first_set_pin. A instrução %d define os pinos(s)" #: shared-bindings/displayio/Group.c msgid "Must be a %q subclass." @@ -1569,7 +1569,7 @@ msgstr "Não há rede com este ssid" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No out in program" -msgstr "" +msgstr "Sem saída no programa" #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" @@ -1629,7 +1629,7 @@ msgstr "Apenas mono com 8 ou 16 bits com " #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Only IN/OUT of up to 8 supported" -msgstr "" +msgstr "Somente IN/OUT de até 8 suportados" #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" @@ -1726,11 +1726,11 @@ msgstr "Permissão negada" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Pin count must be at least 1" -msgstr "" +msgstr "A contagem dos pinos deve ser com pelo menos 1" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Pin count too large" -msgstr "" +msgstr "A contagem dos pinos é muito grande" #: ports/atmel-samd/common-hal/analogio/AnalogIn.c #: ports/cxd56/common-hal/analogio/AnalogIn.c @@ -1812,23 +1812,23 @@ msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Program does IN without loading ISR" -msgstr "" +msgstr "O programa faz IN sem carregar o ISR" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Program does OUT without loading OSR" -msgstr "" +msgstr "O programa faz OUT sem carregar o OSR" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program must contain at least one 16-bit instruction." -msgstr "" +msgstr "O programa deve conter pelo menos uma instrução com 16 bits." #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program size invalid" -msgstr "" +msgstr "O tamanho do programa é inválido" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program too large" -msgstr "" +msgstr "O programa é muito grande" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -1836,7 +1836,7 @@ msgstr "O Pull não foi usado quando a direção for gerada." #: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "RAISE mode is not implemented" -msgstr "" +msgstr "O modo RAISE não foi implementado" #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" @@ -1944,7 +1944,7 @@ msgstr "Houve um erro na reinicialização SPI" #: ports/raspberrypi/common-hal/busio/SPI.c msgid "SPI peripheral in use" -msgstr "" +msgstr "O periférico SPI está em uso" #: shared-bindings/audiomixer/Mixer.c msgid "Sample rate must be positive" @@ -1978,11 +1978,12 @@ msgstr "O contexto do lado do servidor não pode ter nome de host" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Set pin count must be between 1 and 5" -msgstr "" +msgstr "A definição da contagem dos pinos deve estar entre 1 e 5" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Side set pin count must be between 1 and 5" msgstr "" +"A definição da contagem dos pinos do conjunto lateral deve estar entre 1 e 5" #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" @@ -2164,7 +2165,7 @@ msgstr "Houve um erro na reinicialização do UART" #: ports/raspberrypi/common-hal/busio/UART.c msgid "UART not yet supported" -msgstr "" +msgstr "O UART ainda não é suportado" #: ports/stm/common-hal/busio/UART.c msgid "UART write error" @@ -3756,11 +3757,11 @@ msgstr "pressionando ambos os botões durante a inicialização.\n" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "pull_threshold must be between 1 and 32" -msgstr "" +msgstr "O pull_threshold deve ser entre 1 e 32" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "push_threshold must be between 1 and 32" -msgstr "" +msgstr "O pull_threshold deve ser entre 1 e 32" #: extmod/modutimeq.c msgid "queue overflow" From ec03267035d84c0cb0ba7ed645a487b059401946 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Tue, 2 Feb 2021 00:00:00 +0530 Subject: [PATCH 769/770] rtc implementation for rp2040 --- locale/circuitpython.pot | 1 + ports/raspberrypi/Makefile | 2 + ports/raspberrypi/common-hal/rtc/RTC.c | 81 +++++++++++++++++++++ ports/raspberrypi/common-hal/rtc/RTC.h | 32 ++++++++ ports/raspberrypi/common-hal/rtc/__init__.c | 1 + ports/raspberrypi/mpconfigport.mk | 1 - ports/raspberrypi/supervisor/port.c | 8 +- shared-bindings/rtc/RTC.h | 1 + 8 files changed, 124 insertions(+), 3 deletions(-) create mode 100644 ports/raspberrypi/common-hal/rtc/RTC.c create mode 100644 ports/raspberrypi/common-hal/rtc/RTC.h create mode 100644 ports/raspberrypi/common-hal/rtc/__init__.c diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 8443fb85bf1ae..a7e2fbf445841 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -1800,6 +1800,7 @@ msgstr "" #: ports/cxd56/common-hal/rtc/RTC.c ports/esp32s2/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c +#: ports/raspberrypi/common-hal/rtc/RTC.c msgid "RTC calibration is not supported on this board" msgstr "" diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile index a604acb47087d..eab7deee68807 100644 --- a/ports/raspberrypi/Makefile +++ b/ports/raspberrypi/Makefile @@ -84,6 +84,7 @@ INC += -I. \ -isystem sdk/src/rp2_common/hardware_pio/include/ \ -isystem sdk/src/rp2_common/hardware_pll/include/ \ -isystem sdk/src/rp2_common/hardware_resets/include/ \ + -isystem sdk/src/rp2_common/hardware_rtc/include/ \ -isystem sdk/src/rp2_common/hardware_spi/include/ \ -isystem sdk/src/rp2_common/hardware_sync/include/ \ -isystem sdk/src/rp2_common/hardware_timer/include/ \ @@ -166,6 +167,7 @@ SRC_SDK := \ src/rp2_common/hardware_irq/irq.c \ src/rp2_common/hardware_pio/pio.c \ src/rp2_common/hardware_pll/pll.c \ + src/rp2_common/hardware_rtc/rtc.c \ src/rp2_common/hardware_spi/spi.c \ src/rp2_common/hardware_sync/sync.c \ src/rp2_common/hardware_timer/timer.c \ diff --git a/ports/raspberrypi/common-hal/rtc/RTC.c b/ports/raspberrypi/common-hal/rtc/RTC.c new file mode 100644 index 0000000000000..89c23fc190e6b --- /dev/null +++ b/ports/raspberrypi/common-hal/rtc/RTC.c @@ -0,0 +1,81 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright 2020 microDev + * + * 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 "shared-bindings/rtc/RTC.h" + +#include + +#include "py/runtime.h" +#include "src/rp2_common/hardware_rtc/include/hardware/rtc.h" + +void common_hal_rtc_init(void) { + rtc_init(); +} + +void common_hal_rtc_get_time(timeutils_struct_time_t *tm) { + datetime_t t; + rtc_get_datetime(&t); + + tm->tm_year = t.year; + tm->tm_mon = t.month; + tm->tm_mday = t.day; + tm->tm_wday = t.dotw; + tm->tm_hour = t.hour; + tm->tm_min = t.min; + tm->tm_sec = t.sec; + + if (tm->tm_wday == 0) { + tm->tm_wday = 6; + } else { + tm->tm_wday-=1; + } +} + +void common_hal_rtc_set_time(timeutils_struct_time_t *tm) { + if (tm->tm_wday == 6) { + tm->tm_wday = 0; + } else { + tm->tm_wday+=1; + } + + datetime_t t = { + .year = tm->tm_year, + .month = tm->tm_mon, + .day = tm->tm_mday, + .dotw = tm->tm_wday, + .hour = tm->tm_hour, + .min = tm->tm_min, + .sec = tm->tm_sec + }; + rtc_set_datetime(&t); +} + +int common_hal_rtc_get_calibration(void) { + return 0; +} + +void common_hal_rtc_set_calibration(int calibration) { + mp_raise_NotImplementedError(translate("RTC calibration is not supported on this board")); +} diff --git a/ports/raspberrypi/common-hal/rtc/RTC.h b/ports/raspberrypi/common-hal/rtc/RTC.h new file mode 100644 index 0000000000000..426a4ec7a9dbd --- /dev/null +++ b/ports/raspberrypi/common-hal/rtc/RTC.h @@ -0,0 +1,32 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_RTC_RTC_H +#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_RTC_RTC_H + +extern void common_hal_rtc_init(void); + +#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_RTC_RTC_H diff --git a/ports/raspberrypi/common-hal/rtc/__init__.c b/ports/raspberrypi/common-hal/rtc/__init__.c new file mode 100644 index 0000000000000..f5e6b6bdd462e --- /dev/null +++ b/ports/raspberrypi/common-hal/rtc/__init__.c @@ -0,0 +1 @@ +// No RTC module functions diff --git a/ports/raspberrypi/mpconfigport.mk b/ports/raspberrypi/mpconfigport.mk index 5c930d7cc8e60..d0a21a7b41d27 100644 --- a/ports/raspberrypi/mpconfigport.mk +++ b/ports/raspberrypi/mpconfigport.mk @@ -35,7 +35,6 @@ CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_NVM = 0 CIRCUITPY_PULSEIO = 0 # Use PIO interally CIRCUITPY_ROTARYIO = 0 # Use PIO interally -CIRCUITPY_RTC = 0 CIRCUITPY_WATCHDOG = 1 # Things that are unsupported by the hardware. diff --git a/ports/raspberrypi/supervisor/port.c b/ports/raspberrypi/supervisor/port.c index b2f73c7b4cd68..b14f5173d6bc0 100644 --- a/ports/raspberrypi/supervisor/port.c +++ b/ports/raspberrypi/supervisor/port.c @@ -94,12 +94,16 @@ void reset_port(void) { reset_spi(); #endif + #if CIRCUITPY_PWMIO + pwmout_reset(); + #endif + #if CIRCUITPY_RP2PIO reset_rp2pio_statemachine(); #endif - #if CIRCUITPY_PWMIO - pwmout_reset(); + #if CIRCUITPY_RTC + rtc_reset(); #endif reset_all_pins(); diff --git a/shared-bindings/rtc/RTC.h b/shared-bindings/rtc/RTC.h index 76510bd729f11..02bf54f501ee8 100644 --- a/shared-bindings/rtc/RTC.h +++ b/shared-bindings/rtc/RTC.h @@ -30,6 +30,7 @@ #include #include +#include "py/obj.h" #include "lib/timeutils/timeutils.h" extern void common_hal_rtc_get_time(timeutils_struct_time_t *tm); From 0cf2df48c43f34d81dfb5fc466878716e3555b37 Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Mon, 1 Feb 2021 17:58:34 -0600 Subject: [PATCH 770/770] Fixed for boards without longint --- .../adafruit_bus_device/I2CDevice.c | 56 +++++++++++++------ shared-module/adafruit_bus_device/I2CDevice.c | 2 +- 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/shared-bindings/adafruit_bus_device/I2CDevice.c b/shared-bindings/adafruit_bus_device/I2CDevice.c index 15e8cc706390f..3c5d33f52d962 100644 --- a/shared-bindings/adafruit_bus_device/I2CDevice.c +++ b/shared-bindings/adafruit_bus_device/I2CDevice.c @@ -35,6 +35,7 @@ #include "lib/utils/buffer_helper.h" #include "lib/utils/context_manager_helpers.h" #include "py/runtime.h" +#include "py/smallint.h" #include "supervisor/shared/translate.h" @@ -132,15 +133,20 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_readinto(size_t n_args, const mp_o mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); mp_obj_t dest[8]; + uint8_t num_kws = 1; + mp_load_method(self->i2c, MP_QSTR_readfrom_into, dest); - dest[2] = mp_obj_new_int_from_ull(self->device_address); + dest[2] = MP_OBJ_NEW_SMALL_INT(self->device_address); dest[3] = args[ARG_buffer].u_obj; //dest[4] = mp_obj_new_str("start", 5); dest[4] = MP_OBJ_NEW_QSTR(MP_QSTR_start); - dest[5] = mp_obj_new_int(args[ARG_start].u_int); - dest[6] = MP_OBJ_NEW_QSTR(MP_QSTR_end); - dest[7] = mp_obj_new_int(args[ARG_end].u_int); - mp_call_method_n_kw(2, 2, dest); + dest[5] = MP_OBJ_NEW_SMALL_INT(args[ARG_start].u_int); + if (args[ARG_end].u_int != INT_MAX) { + dest[6] = MP_OBJ_NEW_QSTR(MP_QSTR_end); + dest[7] = MP_OBJ_NEW_SMALL_INT(args[ARG_end].u_int); + num_kws++; + } + mp_call_method_n_kw(2, num_kws, dest); return mp_const_none; } @@ -170,14 +176,20 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_write(size_t n_args, const mp_obj_ mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); mp_obj_t dest[8]; + uint8_t num_kws = 1; + mp_load_method(self->i2c, MP_QSTR_writeto, dest); - dest[2] = mp_obj_new_int_from_ull(self->device_address); + dest[2] = MP_OBJ_NEW_SMALL_INT(self->device_address); dest[3] = args[ARG_buffer].u_obj; dest[4] = MP_OBJ_NEW_QSTR(MP_QSTR_start); - dest[5] = mp_obj_new_int(args[ARG_start].u_int); - dest[6] = MP_OBJ_NEW_QSTR(MP_QSTR_end); - dest[7] = mp_obj_new_int(args[ARG_end].u_int); - mp_call_method_n_kw(2, 2, dest); + dest[5] = MP_OBJ_NEW_SMALL_INT(args[ARG_start].u_int); + if (args[ARG_end].u_int != INT_MAX) { + dest[6] = MP_OBJ_NEW_QSTR(MP_QSTR_end); + dest[7] = MP_OBJ_NEW_SMALL_INT(args[ARG_end].u_int); + num_kws++; + } + + mp_call_method_n_kw(2, num_kws, dest); return mp_const_none; } @@ -221,20 +233,28 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_write_then_readinto(size_t n_args, mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); mp_obj_t dest[13]; + uint8_t num_kws = 2; + mp_load_method(self->i2c, MP_QSTR_writeto_then_readfrom, dest); - dest[2] = mp_obj_new_int_from_ull(self->device_address); + dest[2] = MP_OBJ_NEW_SMALL_INT(self->device_address); dest[3] = args[ARG_out_buffer].u_obj; dest[4] = args[ARG_in_buffer].u_obj; dest[5] = MP_OBJ_NEW_QSTR(MP_QSTR_out_start); - dest[6] = mp_obj_new_int(args[ARG_out_start].u_int); - dest[7] = MP_OBJ_NEW_QSTR(MP_QSTR_out_end); - dest[8] = mp_obj_new_int(args[ARG_out_end].u_int); + dest[6] = MP_OBJ_NEW_SMALL_INT(args[ARG_out_start].u_int); + if (args[ARG_out_end].u_int != INT_MAX) { + dest[7] = MP_OBJ_NEW_QSTR(MP_QSTR_out_end); + dest[8] = MP_OBJ_NEW_SMALL_INT(args[ARG_out_end].u_int); + num_kws++; + } dest[9] = MP_OBJ_NEW_QSTR(MP_QSTR_in_start); - dest[10] = mp_obj_new_int(args[ARG_in_start].u_int); - dest[11] = MP_OBJ_NEW_QSTR(MP_QSTR_in_end); - dest[12] = mp_obj_new_int(args[ARG_in_end].u_int); + dest[10] = MP_OBJ_NEW_SMALL_INT(args[ARG_in_start].u_int); + if (args[ARG_in_end].u_int != INT_MAX) { + dest[11] = MP_OBJ_NEW_QSTR(MP_QSTR_in_end); + dest[12] = MP_OBJ_NEW_SMALL_INT(args[ARG_in_end].u_int); + num_kws++; + } - mp_call_method_n_kw(3, 4, dest); + mp_call_method_n_kw(3, num_kws, dest); return mp_const_none; } diff --git a/shared-module/adafruit_bus_device/I2CDevice.c b/shared-module/adafruit_bus_device/I2CDevice.c index 792ab7183c831..6d80cf599d92b 100644 --- a/shared-module/adafruit_bus_device/I2CDevice.c +++ b/shared-module/adafruit_bus_device/I2CDevice.c @@ -71,7 +71,7 @@ void common_hal_adafruit_bus_device_i2cdevice_probe_for_device(adafruit_bus_devi nlr_buf_t nlr; if (nlr_push(&nlr) == 0) { mp_load_method(self->i2c, MP_QSTR_writeto, dest); - dest[2] = mp_obj_new_int_from_ull(self->device_address); + dest[2] = MP_OBJ_NEW_SMALL_INT(self->device_address); dest[3] = write_buffer; mp_call_method_n_kw(2, 0, dest); nlr_pop();