summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2020-08-21 11:13:53 -0700
committerScott Shawcroft <scott@tannewt.org>2020-08-21 11:13:53 -0700
commita5b01f73612f23407d059879664834b40441f34e (patch)
treefbb1bde1cb5967de27a7bcecb755b1b19f5f36fd
parent6857f984269149b46d1cd4283506420f341b2601 (diff)
parent988e5caafc0866de6593d99632622a8fe62a9a9c (diff)
Merge remote-tracking branch 'adafruit/main' into add_pwmio
-rw-r--r--lib/mp-readline/readline.c11
-rw-r--r--locale/ID.po17
-rw-r--r--locale/circuitpython.pot17
-rw-r--r--locale/cs.po17
-rw-r--r--locale/de_DE.po20
-rw-r--r--locale/es.po20
-rw-r--r--locale/fil.po17
-rw-r--r--locale/fr.po20
-rw-r--r--locale/hi.po17
-rw-r--r--locale/it_IT.po17
-rw-r--r--locale/ja.po17
-rw-r--r--locale/ko.po17
-rw-r--r--locale/nl.po20
-rw-r--r--locale/pl.po17
-rw-r--r--locale/pt_BR.po20
-rw-r--r--locale/sv.po20
-rw-r--r--locale/zh_Latn_pinyin.po17
-rw-r--r--ports/atmel-samd/Makefile2
-rw-r--r--ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.mk4
-rw-r--r--ports/atmel-samd/common-hal/pulseio/PulseOut.c10
-rw-r--r--ports/atmel-samd/mpconfigport.mk2
-rw-r--r--ports/cxd56/common-hal/pulseio/PulseOut.c12
-rw-r--r--ports/cxd56/supervisor/port.c9
-rw-r--r--ports/esp32s2/background.c7
-rw-r--r--ports/esp32s2/common-hal/neopixel_write/__init__.c3
-rw-r--r--ports/esp32s2/common-hal/pulseio/PulseIn.c151
-rw-r--r--ports/esp32s2/common-hal/pulseio/PulseIn.h9
-rw-r--r--ports/esp32s2/common-hal/pulseio/PulseOut.c59
-rw-r--r--ports/esp32s2/common-hal/pulseio/PulseOut.h7
-rw-r--r--ports/esp32s2/mpconfigport.h13
-rw-r--r--ports/esp32s2/peripherals/rmt.c12
-rw-r--r--ports/esp32s2/peripherals/rmt.h1
-rw-r--r--ports/esp32s2/supervisor/port.c9
-rw-r--r--ports/mimxrt10xx/common-hal/pulseio/PulseOut.c5
-rw-r--r--ports/nrf/boards/simmel/mpconfigboard.h3
-rw-r--r--ports/nrf/boards/simmel/pins.c10
-rw-r--r--ports/nrf/common-hal/pulseio/PulseOut.c10
-rw-r--r--ports/stm/common-hal/pulseio/PulseOut.c10
-rw-r--r--shared-bindings/pulseio/PulseOut.c30
-rw-r--r--shared-bindings/pulseio/PulseOut.h6
-rw-r--r--supervisor/supervisor.mk5
-rw-r--r--tools/gen_display_resources.py5
-rw-r--r--tools/gen_usb_descriptor.py11
43 files changed, 587 insertions, 119 deletions
diff --git a/lib/mp-readline/readline.c b/lib/mp-readline/readline.c
index 464916ca4..6da71c40f 100644
--- a/lib/mp-readline/readline.c
+++ b/lib/mp-readline/readline.c
@@ -144,7 +144,7 @@ int readline_process_char(int c) {
goto right_arrow_key;
} else if (c == CHAR_CTRL_K) {
// CTRL-K is kill from cursor to end-of-line, inclusive
- vstr_cut_tail_bytes(rl.line, last_line_len - rl.cursor_pos);
+ vstr_cut_tail_bytes(rl.line, rl.line->len - rl.cursor_pos);
// set redraw parameters
redraw_from_cursor = true;
} else if (c == CHAR_CTRL_N) {
@@ -155,6 +155,7 @@ int readline_process_char(int c) {
goto up_arrow_key;
} else if (c == CHAR_CTRL_U) {
// CTRL-U is kill from beginning-of-line up to cursor
+ cont_chars = count_cont_bytes(rl.line->buf+rl.orig_line_len, rl.line->buf+rl.cursor_pos);
vstr_cut_out_bytes(rl.line, rl.orig_line_len, rl.cursor_pos - rl.orig_line_len);
// set redraw parameters
redraw_step_back = rl.cursor_pos - rl.orig_line_len;
@@ -342,6 +343,7 @@ left_arrow_key:
if (c == '~') {
if (rl.escape_seq_buf[0] == '1' || rl.escape_seq_buf[0] == '7') {
home_key:
+ cont_chars = count_cont_bytes(rl.line->buf+rl.orig_line_len, rl.line->buf+rl.cursor_pos);
redraw_step_back = rl.cursor_pos - rl.orig_line_len;
} else if (rl.escape_seq_buf[0] == '4' || rl.escape_seq_buf[0] == '8') {
end_key:
@@ -352,7 +354,12 @@ end_key:
delete_key:
#endif
if (rl.cursor_pos < rl.line->len) {
- vstr_cut_out_bytes(rl.line, rl.cursor_pos, 1);
+ size_t len = 1;
+ while (UTF8_IS_CONT(rl.line->buf[rl.cursor_pos+len]) &&
+ rl.cursor_pos+len < rl.line->len) {
+ len++;
+ }
+ vstr_cut_out_bytes(rl.line, rl.cursor_pos, len);
redraw_from_cursor = true;
}
} else {
diff --git a/locale/ID.po b/locale/ID.po
index b553c6749..ec5b6f6e8 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-08-14 09:36-0400\n"
+"POT-Creation-Date: 2020-08-18 11:19-0400\n"
"PO-Revision-Date: 2020-07-06 18:10+0000\n"
"Last-Translator: oon arfiandwi <oon.arfiandwi@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -764,7 +764,7 @@ msgstr "Error pada regex"
#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c
#: shared-bindings/microcontroller/Pin.c
-#: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c
+#: shared-bindings/neopixel_write/__init__.c
#: shared-bindings/terminalio/Terminal.c
msgid "Expected a %q"
msgstr "Diharapkan %q"
@@ -1352,6 +1352,15 @@ msgstr "Tambahkan module apapun pada filesystem\n"
msgid "Polygon needs at least 3 points"
msgstr ""
+#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
+#: ports/cxd56/common-hal/pulseio/PulseOut.c
+#: ports/nrf/common-hal/pulseio/PulseOut.c
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid ""
+"Port does not accept pins or frequency. "
+"Construct and pass a PWMOut Carrier instead"
+msgstr ""
+
#: shared-bindings/_bleio/Adapter.c
msgid "Prefix buffer must be on the heap"
msgstr ""
@@ -1366,6 +1375,10 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr ""
+#: ports/stm/ref/pulseout-pre-timeralloc.c
+msgid "PulseOut not supported on this chip"
+msgstr ""
+
#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr ""
diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot
index ffb2e91ef..1e227dcbc 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-08-14 09:36-0400\n"
+"POT-Creation-Date: 2020-08-18 11:19-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -744,7 +744,7 @@ msgstr ""
#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c
#: shared-bindings/microcontroller/Pin.c
-#: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c
+#: shared-bindings/neopixel_write/__init__.c
#: shared-bindings/terminalio/Terminal.c
msgid "Expected a %q"
msgstr ""
@@ -1328,6 +1328,15 @@ msgstr ""
msgid "Polygon needs at least 3 points"
msgstr ""
+#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
+#: ports/cxd56/common-hal/pulseio/PulseOut.c
+#: ports/nrf/common-hal/pulseio/PulseOut.c
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid ""
+"Port does not accept pins or frequency. "
+"Construct and pass a PWMOut Carrier instead"
+msgstr ""
+
#: shared-bindings/_bleio/Adapter.c
msgid "Prefix buffer must be on the heap"
msgstr ""
@@ -1340,6 +1349,10 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr ""
+#: ports/stm/ref/pulseout-pre-timeralloc.c
+msgid "PulseOut not supported on this chip"
+msgstr ""
+
#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr ""
diff --git a/locale/cs.po b/locale/cs.po
index c1a8ded4e..b353f4630 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-08-14 09:36-0400\n"
+"POT-Creation-Date: 2020-08-18 11:19-0400\n"
"PO-Revision-Date: 2020-05-24 03:22+0000\n"
"Last-Translator: dronecz <mzuzelka@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -750,7 +750,7 @@ msgstr ""
#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c
#: shared-bindings/microcontroller/Pin.c
-#: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c
+#: shared-bindings/neopixel_write/__init__.c
#: shared-bindings/terminalio/Terminal.c
msgid "Expected a %q"
msgstr ""
@@ -1334,6 +1334,15 @@ msgstr ""
msgid "Polygon needs at least 3 points"
msgstr ""
+#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
+#: ports/cxd56/common-hal/pulseio/PulseOut.c
+#: ports/nrf/common-hal/pulseio/PulseOut.c
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid ""
+"Port does not accept pins or frequency. "
+"Construct and pass a PWMOut Carrier instead"
+msgstr ""
+
#: shared-bindings/_bleio/Adapter.c
msgid "Prefix buffer must be on the heap"
msgstr ""
@@ -1346,6 +1355,10 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr ""
+#: ports/stm/ref/pulseout-pre-timeralloc.c
+msgid "PulseOut not supported on this chip"
+msgstr ""
+
#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr ""
diff --git a/locale/de_DE.po b/locale/de_DE.po
index 10c07f667..87cca4a77 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-08-14 09:36-0400\n"
+"POT-Creation-Date: 2020-08-18 11:19-0400\n"
"PO-Revision-Date: 2020-06-16 18:24+0000\n"
"Last-Translator: Andreas Buchen <andreas.buchen@gmail.com>\n"
"Language: de_DE\n"
@@ -760,7 +760,7 @@ msgstr "Fehler in regex"
#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c
#: shared-bindings/microcontroller/Pin.c
-#: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c
+#: shared-bindings/neopixel_write/__init__.c
#: shared-bindings/terminalio/Terminal.c
msgid "Expected a %q"
msgstr "Erwartet ein(e) %q"
@@ -1362,6 +1362,15 @@ msgstr "und alle Module im Dateisystem \n"
msgid "Polygon needs at least 3 points"
msgstr "Polygone brauchen mindestens 3 Punkte"
+#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
+#: ports/cxd56/common-hal/pulseio/PulseOut.c
+#: ports/nrf/common-hal/pulseio/PulseOut.c
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid ""
+"Port does not accept pins or frequency. "
+"Construct and pass a PWMOut Carrier instead"
+msgstr ""
+
#: shared-bindings/_bleio/Adapter.c
msgid "Prefix buffer must be on the heap"
msgstr "Der Präfixbuffer muss sich auf dem Heap befinden"
@@ -1376,6 +1385,10 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr "Pull wird nicht verwendet, wenn die Richtung output ist."
+#: ports/stm/ref/pulseout-pre-timeralloc.c
+msgid "PulseOut not supported on this chip"
+msgstr "PulseOut wird auf diesem Chip nicht unterstützt"
+
#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr "RNG DeInit-Fehler"
@@ -3553,9 +3566,6 @@ msgstr ""
#~ msgid "'async for' or 'async with' outside async function"
#~ msgstr "'async for' oder 'async with' außerhalb der asynchronen Funktion"
-#~ msgid "PulseOut not supported on this chip"
-#~ msgstr "PulseOut wird auf diesem Chip nicht unterstützt"
-
#~ msgid "PulseIn not supported on this chip"
#~ msgstr "PulseIn wird auf diesem Chip nicht unterstützt"
diff --git a/locale/es.po b/locale/es.po
index 5012b749b..882904f64 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-08-14 09:36-0400\n"
+"POT-Creation-Date: 2020-08-18 11:19-0400\n"
"PO-Revision-Date: 2020-08-17 21:11+0000\n"
"Last-Translator: Alvaro Figueroa <alvaro@greencore.co.cr>\n"
"Language-Team: \n"
@@ -765,7 +765,7 @@ msgstr "Error en regex"
#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c
#: shared-bindings/microcontroller/Pin.c
-#: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c
+#: shared-bindings/neopixel_write/__init__.c
#: shared-bindings/terminalio/Terminal.c
msgid "Expected a %q"
msgstr "Se espera un %q"
@@ -1362,6 +1362,15 @@ msgstr "Además de cualquier módulo en el sistema de archivos\n"
msgid "Polygon needs at least 3 points"
msgstr "El polígono necesita al menos 3 puntos"
+#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
+#: ports/cxd56/common-hal/pulseio/PulseOut.c
+#: ports/nrf/common-hal/pulseio/PulseOut.c
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid ""
+"Port does not accept pins or frequency. "
+"Construct and pass a PWMOut Carrier instead"
+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"
@@ -1375,6 +1384,10 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr "Pull no se usa cuando la dirección es output."
+#: ports/stm/ref/pulseout-pre-timeralloc.c
+msgid "PulseOut not supported on this chip"
+msgstr "PulseOut no es compatible con este chip"
+
#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr "Error de desinicializado del RNG"
@@ -3539,9 +3552,6 @@ msgstr "zi debe ser una forma (n_section,2)"
#~ msgid "'async for' or 'async with' outside async function"
#~ msgstr "'async for' o 'async with' fuera de la función async"
-#~ msgid "PulseOut not supported on this chip"
-#~ msgstr "PulseOut no es compatible con este chip"
-
#~ msgid "PulseIn not supported on this chip"
#~ msgstr "PulseIn no es compatible con este chip"
diff --git a/locale/fil.po b/locale/fil.po
index 37a21dc6a..ec4f9f685 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-08-14 09:36-0400\n"
+"POT-Creation-Date: 2020-08-18 11:19-0400\n"
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
"Language-Team: fil\n"
@@ -754,7 +754,7 @@ msgstr "May pagkakamali sa REGEX"
#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c
#: shared-bindings/microcontroller/Pin.c
-#: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c
+#: shared-bindings/neopixel_write/__init__.c
#: shared-bindings/terminalio/Terminal.c
msgid "Expected a %q"
msgstr "Umasa ng %q"
@@ -1346,6 +1346,15 @@ msgstr "Kasama ang kung ano pang modules na sa filesystem\n"
msgid "Polygon needs at least 3 points"
msgstr ""
+#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
+#: ports/cxd56/common-hal/pulseio/PulseOut.c
+#: ports/nrf/common-hal/pulseio/PulseOut.c
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid ""
+"Port does not accept pins or frequency. "
+"Construct and pass a PWMOut Carrier instead"
+msgstr ""
+
#: shared-bindings/_bleio/Adapter.c
msgid "Prefix buffer must be on the heap"
msgstr ""
@@ -1360,6 +1369,10 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr "Pull hindi ginagamit kapag ang direksyon ay output."
+#: ports/stm/ref/pulseout-pre-timeralloc.c
+msgid "PulseOut not supported on this chip"
+msgstr ""
+
#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr ""
diff --git a/locale/fr.po b/locale/fr.po
index 419cef785..0562053f1 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-08-14 09:36-0400\n"
+"POT-Creation-Date: 2020-08-18 11:19-0400\n"
"PO-Revision-Date: 2020-07-27 21:27+0000\n"
"Last-Translator: Nathan <bonnemainsnathan@gmail.com>\n"
"Language: fr\n"
@@ -768,7 +768,7 @@ msgstr "Erreur dans l'expression régulière"
#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c
#: shared-bindings/microcontroller/Pin.c
-#: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c
+#: shared-bindings/neopixel_write/__init__.c
#: shared-bindings/terminalio/Terminal.c
msgid "Expected a %q"
msgstr "Attendu un %q"
@@ -1369,6 +1369,15 @@ msgstr "Ainsi que tout autre module présent sur le système de fichiers\n"
msgid "Polygon needs at least 3 points"
msgstr "Polygone a besoin d’au moins 3 points"
+#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
+#: ports/cxd56/common-hal/pulseio/PulseOut.c
+#: ports/nrf/common-hal/pulseio/PulseOut.c
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid ""
+"Port does not accept pins or frequency. "
+"Construct and pass a PWMOut Carrier instead"
+msgstr ""
+
#: shared-bindings/_bleio/Adapter.c
msgid "Prefix buffer must be on the heap"
msgstr "Le tampon de préfixe doit être sur le tas"
@@ -1381,6 +1390,10 @@ msgstr "Appuyez sur une touche pour entrer sur REPL ou CTRL-D pour recharger."
msgid "Pull not used when direction is output."
msgstr "Le tirage 'pull' n'est pas utilisé quand la direction est 'output'."
+#: ports/stm/ref/pulseout-pre-timeralloc.c
+msgid "PulseOut not supported on this chip"
+msgstr "PulseOut non pris en charge sur cette puce"
+
#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr "Erreur RNG DeInit"
@@ -3557,9 +3570,6 @@ msgstr ""
#~ msgid "'async for' or 'async with' outside async function"
#~ msgstr "'async for' ou 'async with' sans fonction asynchrone extérieure"
-#~ msgid "PulseOut not supported on this chip"
-#~ msgstr "PulseOut non pris en charge sur cette puce"
-
#~ msgid "PulseIn not supported on this chip"
#~ msgstr "PulseIn non pris en charge sur cette puce"
diff --git a/locale/hi.po b/locale/hi.po
index 9d0dd74e9..50a1887f6 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-08-14 09:36-0400\n"
+"POT-Creation-Date: 2020-08-18 11:19-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
@@ -743,7 +743,7 @@ msgstr ""
#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c
#: shared-bindings/microcontroller/Pin.c
-#: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c
+#: shared-bindings/neopixel_write/__init__.c
#: shared-bindings/terminalio/Terminal.c
msgid "Expected a %q"
msgstr ""
@@ -1327,6 +1327,15 @@ msgstr ""
msgid "Polygon needs at least 3 points"
msgstr ""
+#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
+#: ports/cxd56/common-hal/pulseio/PulseOut.c
+#: ports/nrf/common-hal/pulseio/PulseOut.c
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid ""
+"Port does not accept pins or frequency. "
+"Construct and pass a PWMOut Carrier instead"
+msgstr ""
+
#: shared-bindings/_bleio/Adapter.c
msgid "Prefix buffer must be on the heap"
msgstr ""
@@ -1339,6 +1348,10 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr ""
+#: ports/stm/ref/pulseout-pre-timeralloc.c
+msgid "PulseOut not supported on this chip"
+msgstr ""
+
#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr ""
diff --git a/locale/it_IT.po b/locale/it_IT.po
index e128b7ef9..9635220af 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-08-14 09:36-0400\n"
+"POT-Creation-Date: 2020-08-18 11:19-0400\n"
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
"Language-Team: \n"
@@ -754,7 +754,7 @@ msgstr "Errore nella regex"
#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c
#: shared-bindings/microcontroller/Pin.c
-#: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c
+#: shared-bindings/neopixel_write/__init__.c
#: shared-bindings/terminalio/Terminal.c
msgid "Expected a %q"
msgstr "Atteso un %q"
@@ -1356,6 +1356,15 @@ msgstr "Imposssibile rimontare il filesystem"
msgid "Polygon needs at least 3 points"
msgstr ""
+#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
+#: ports/cxd56/common-hal/pulseio/PulseOut.c
+#: ports/nrf/common-hal/pulseio/PulseOut.c
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid ""
+"Port does not accept pins or frequency. "
+"Construct and pass a PWMOut Carrier instead"
+msgstr ""
+
#: shared-bindings/_bleio/Adapter.c
msgid "Prefix buffer must be on the heap"
msgstr ""
@@ -1369,6 +1378,10 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr ""
+#: ports/stm/ref/pulseout-pre-timeralloc.c
+msgid "PulseOut not supported on this chip"
+msgstr ""
+
#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr ""
diff --git a/locale/ja.po b/locale/ja.po
index 8385cce1b..7c3b42580 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-08-14 09:36-0400\n"
+"POT-Creation-Date: 2020-08-18 11:19-0400\n"
"PO-Revision-Date: 2020-08-16 13:25+0000\n"
"Last-Translator: Taku Fukada <naninunenor@gmail.com>\n"
"Language-Team: none\n"
@@ -759,7 +759,7 @@ msgstr "正規表現にエラーがあります"
#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c
#: shared-bindings/microcontroller/Pin.c
-#: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c
+#: shared-bindings/neopixel_write/__init__.c
#: shared-bindings/terminalio/Terminal.c
msgid "Expected a %q"
msgstr ""
@@ -1348,6 +1348,15 @@ msgstr ""
msgid "Polygon needs at least 3 points"
msgstr "ポリゴンには少なくとも3つの点が必要"
+#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
+#: ports/cxd56/common-hal/pulseio/PulseOut.c
+#: ports/nrf/common-hal/pulseio/PulseOut.c
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid ""
+"Port does not accept pins or frequency. "
+"Construct and pass a PWMOut Carrier instead"
+msgstr ""
+
#: shared-bindings/_bleio/Adapter.c
msgid "Prefix buffer must be on the heap"
msgstr "Prefixバッファはヒープ上になければなりません"
@@ -1361,6 +1370,10 @@ msgstr "何らかのキーを押すとREPLに入ります。CTRL-Dでリロー
msgid "Pull not used when direction is output."
msgstr "方向がoutputのときpullは使われません"
+#: ports/stm/ref/pulseout-pre-timeralloc.c
+msgid "PulseOut not supported on this chip"
+msgstr ""
+
#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr "乱数生成器の解体エラー"
diff --git a/locale/ko.po b/locale/ko.po
index e86372bcb..ecf539946 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-08-14 09:36-0400\n"
+"POT-Creation-Date: 2020-08-18 11:19-0400\n"
"PO-Revision-Date: 2019-05-06 14:22-0700\n"
"Last-Translator: \n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -746,7 +746,7 @@ msgstr "Regex에 오류가 있습니다."
#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c
#: shared-bindings/microcontroller/Pin.c
-#: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c
+#: shared-bindings/neopixel_write/__init__.c
#: shared-bindings/terminalio/Terminal.c
msgid "Expected a %q"
msgstr "%q 이 예상되었습니다."
@@ -1330,6 +1330,15 @@ msgstr ""
msgid "Polygon needs at least 3 points"
msgstr ""
+#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
+#: ports/cxd56/common-hal/pulseio/PulseOut.c
+#: ports/nrf/common-hal/pulseio/PulseOut.c
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid ""
+"Port does not accept pins or frequency. "
+"Construct and pass a PWMOut Carrier instead"
+msgstr ""
+
#: shared-bindings/_bleio/Adapter.c
msgid "Prefix buffer must be on the heap"
msgstr ""
@@ -1342,6 +1351,10 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr ""
+#: ports/stm/ref/pulseout-pre-timeralloc.c
+msgid "PulseOut not supported on this chip"
+msgstr ""
+
#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr ""
diff --git a/locale/nl.po b/locale/nl.po
index b26592f1e..313359668 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-08-14 09:36-0400\n"
+"POT-Creation-Date: 2020-08-18 11:19-0400\n"
"PO-Revision-Date: 2020-08-10 19:59+0000\n"
"Last-Translator: _fonzlate <vooralfred@gmail.com>\n"
"Language-Team: none\n"
@@ -762,7 +762,7 @@ msgstr "Fout in regex"
#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c
#: shared-bindings/microcontroller/Pin.c
-#: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c
+#: shared-bindings/neopixel_write/__init__.c
#: shared-bindings/terminalio/Terminal.c
msgid "Expected a %q"
msgstr "Verwacht een %q"
@@ -1364,6 +1364,15 @@ msgstr "En iedere module in het bestandssysteem\n"
msgid "Polygon needs at least 3 points"
msgstr "Polygon heeft op zijn minst 3 punten nodig"
+#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
+#: ports/cxd56/common-hal/pulseio/PulseOut.c
+#: ports/nrf/common-hal/pulseio/PulseOut.c
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid ""
+"Port does not accept pins or frequency. "
+"Construct and pass a PWMOut Carrier instead"
+msgstr ""
+
#: shared-bindings/_bleio/Adapter.c
msgid "Prefix buffer must be on the heap"
msgstr "Prefix buffer moet op de heap zijn"
@@ -1378,6 +1387,10 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr "Pull niet gebruikt wanneer de richting output is."
+#: ports/stm/ref/pulseout-pre-timeralloc.c
+msgid "PulseOut not supported on this chip"
+msgstr "PulseOut niet ondersteund door deze chip"
+
#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr "RNG DeInit Fout"
@@ -3531,9 +3544,6 @@ msgstr "zi moet vorm (n_section, 2) hebben"
#~ msgid "PulseIn not supported on this chip"
#~ msgstr "PusleIn niet ondersteund door deze chip"
-#~ msgid "PulseOut not supported on this chip"
-#~ msgstr "PulseOut niet ondersteund door deze chip"
-
#~ msgid "I2C operation not supported"
#~ msgstr "I2C actie niet ondersteund"
diff --git a/locale/pl.po b/locale/pl.po
index 8250f840d..6c52062d9 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-08-14 09:36-0400\n"
+"POT-Creation-Date: 2020-08-18 11:19-0400\n"
"PO-Revision-Date: 2019-03-19 18:37-0700\n"
"Last-Translator: Radomir Dopieralski <circuitpython@sheep.art.pl>\n"
"Language-Team: pl\n"
@@ -746,7 +746,7 @@ msgstr "Błąd w regex"
#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c
#: shared-bindings/microcontroller/Pin.c
-#: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c
+#: shared-bindings/neopixel_write/__init__.c
#: shared-bindings/terminalio/Terminal.c
msgid "Expected a %q"
msgstr "Oczekiwano %q"
@@ -1332,6 +1332,15 @@ msgstr "Oraz moduły w systemie plików\n"
msgid "Polygon needs at least 3 points"
msgstr ""
+#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
+#: ports/cxd56/common-hal/pulseio/PulseOut.c
+#: ports/nrf/common-hal/pulseio/PulseOut.c
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid ""
+"Port does not accept pins or frequency. "
+"Construct and pass a PWMOut Carrier instead"
+msgstr ""
+
#: shared-bindings/_bleio/Adapter.c
msgid "Prefix buffer must be on the heap"
msgstr ""
@@ -1344,6 +1353,10 @@ msgstr "Dowolny klawisz aby uruchomić konsolę. CTRL-D aby przeładować."
msgid "Pull not used when direction is output."
msgstr "Podciągnięcie nieużywane w trybie wyjścia."
+#: ports/stm/ref/pulseout-pre-timeralloc.c
+msgid "PulseOut not supported on this chip"
+msgstr ""
+
#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr ""
diff --git a/locale/pt_BR.po b/locale/pt_BR.po
index 459b198df..b2967cf99 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-08-14 09:36-0400\n"
+"POT-Creation-Date: 2020-08-18 11:19-0400\n"
"PO-Revision-Date: 2020-08-16 02:25+0000\n"
"Last-Translator: Wellington Terumi Uemura <wellingtonuemura@gmail.com>\n"
"Language-Team: \n"
@@ -767,7 +767,7 @@ msgstr "Erro no regex"
#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c
#: shared-bindings/microcontroller/Pin.c
-#: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c
+#: shared-bindings/neopixel_write/__init__.c
#: shared-bindings/terminalio/Terminal.c
msgid "Expected a %q"
msgstr "Esperado um"
@@ -1367,6 +1367,15 @@ msgstr "Além de quaisquer módulos no sistema de arquivos\n"
msgid "Polygon needs at least 3 points"
msgstr "O Polígono precisa de pelo menos 3 pontos"
+#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
+#: ports/cxd56/common-hal/pulseio/PulseOut.c
+#: ports/nrf/common-hal/pulseio/PulseOut.c
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid ""
+"Port does not accept pins or frequency. "
+"Construct and pass a PWMOut Carrier instead"
+msgstr ""
+
#: shared-bindings/_bleio/Adapter.c
msgid "Prefix buffer must be on the heap"
msgstr ""
@@ -1382,6 +1391,10 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr "O Pull não foi usado quando a direção for gerada."
+#: ports/stm/ref/pulseout-pre-timeralloc.c
+msgid "PulseOut not supported on this chip"
+msgstr "O PulseOut não é compatível neste CI"
+
#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr "Erro DeInit RNG"
@@ -3552,9 +3565,6 @@ msgstr "zi deve estar na forma (n_section, 2)"
#~ msgid "'async for' or 'async with' outside async function"
#~ msgstr "'assíncrono para' ou 'assíncrono com' função assíncrona externa"
-#~ msgid "PulseOut not supported on this chip"
-#~ msgstr "O PulseOut não é compatível neste CI"
-
#~ msgid "PulseIn not supported on this chip"
#~ msgstr "O PulseIn não é compatível neste CI"
diff --git a/locale/sv.po b/locale/sv.po
index d747de177..df205b109 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-08-14 09:36-0400\n"
+"POT-Creation-Date: 2020-08-18 11:19-0400\n"
"PO-Revision-Date: 2020-07-25 20:58+0000\n"
"Last-Translator: Jonny Bergdahl <jonny@bergdahl.it>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -758,7 +758,7 @@ msgstr "Fel i regex"
#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c
#: shared-bindings/microcontroller/Pin.c
-#: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c
+#: shared-bindings/neopixel_write/__init__.c
#: shared-bindings/terminalio/Terminal.c
msgid "Expected a %q"
msgstr "Förväntade %q"
@@ -1355,6 +1355,15 @@ msgstr "Plus eventuella moduler i filsystemet\n"
msgid "Polygon needs at least 3 points"
msgstr "Polygonen behöver minst 3 punkter"
+#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
+#: ports/cxd56/common-hal/pulseio/PulseOut.c
+#: ports/nrf/common-hal/pulseio/PulseOut.c
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid ""
+"Port does not accept pins or frequency. "
+"Construct and pass a PWMOut Carrier instead"
+msgstr ""
+
#: shared-bindings/_bleio/Adapter.c
msgid "Prefix buffer must be on the heap"
msgstr "Prefixbufferten måste finnas på heap"
@@ -1368,6 +1377,10 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr "Pull används inte när riktningen är output."
+#: ports/stm/ref/pulseout-pre-timeralloc.c
+msgid "PulseOut not supported on this chip"
+msgstr "PulseIn stöds inte av detta chip"
+
#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr "RNG DeInit-fel"
@@ -3519,9 +3532,6 @@ msgstr "zi måste vara i formen (n_section, 2)"
#~ msgid "'async for' or 'async with' outside async function"
#~ msgstr "'async for' eller 'async with' utanför async-funktion"
-#~ msgid "PulseOut not supported on this chip"
-#~ msgstr "PulseIn stöds inte av detta chip"
-
#~ msgid "PulseIn not supported on this chip"
#~ msgstr "PulseIn stöds inte av detta chip"
diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po
index 3e5d21d45..725491f5b 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-08-14 09:36-0400\n"
+"POT-Creation-Date: 2020-08-18 11:19-0400\n"
"PO-Revision-Date: 2019-04-13 10:10-0700\n"
"Last-Translator: hexthat\n"
"Language-Team: Chinese Hanyu Pinyin\n"
@@ -755,7 +755,7 @@ msgstr "Zhèngzé biǎodá shì cuòwù"
#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c
#: shared-bindings/microcontroller/Pin.c
-#: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c
+#: shared-bindings/neopixel_write/__init__.c
#: shared-bindings/terminalio/Terminal.c
msgid "Expected a %q"
msgstr "Yùqí %q"
@@ -1350,6 +1350,15 @@ msgstr "Zài wénjiàn xìtǒng shàng tiānjiā rènhé mókuài\n"
msgid "Polygon needs at least 3 points"
msgstr "Duōbiānxíng zhìshǎo xūyào 3 diǎn"
+#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
+#: ports/cxd56/common-hal/pulseio/PulseOut.c
+#: ports/nrf/common-hal/pulseio/PulseOut.c
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid ""
+"Port does not accept pins or frequency. "
+"Construct and pass a PWMOut Carrier instead"
+msgstr ""
+
#: shared-bindings/_bleio/Adapter.c
msgid "Prefix buffer must be on the heap"
msgstr "Qiánzhuì huǎnchōng qū bìxū zài duī shàng"
@@ -1362,6 +1371,10 @@ msgstr "Àn xià rènhé jiàn jìnrù REPL. Shǐyòng CTRL-D chóngxīn jiāzà
msgid "Pull not used when direction is output."
msgstr "Fāngxiàng shūchū shí Pull méiyǒu shǐyòng."
+#: ports/stm/ref/pulseout-pre-timeralloc.c
+msgid "PulseOut not supported on this chip"
+msgstr ""
+
#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr "RNG qǔxiāo chūshǐhuà cuòwù"
diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile
index 65542354e..30487ae3e 100644
--- a/ports/atmel-samd/Makefile
+++ b/ports/atmel-samd/Makefile
@@ -103,7 +103,7 @@ ifeq ($(CHIP_FAMILY), same54)
PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x
OPTIMIZATION_FLAGS ?= -O2
# 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
+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
# option to override default optimization level, set in boards/$(BOARD)/mpconfigboard.mk
diff --git a/ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.mk b/ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.mk
index ae2a1e973..393adf839 100644
--- a/ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.mk
@@ -7,8 +7,8 @@ CHIP_VARIANT = SAMD51G19A
CHIP_FAMILY = samd51
QSPI_FLASH_FILESYSTEM = 1
-EXTERNAL_FLASH_DEVICE_COUNT = 1
-EXTERNAL_FLASH_DEVICES = "W25Q16JV_IM"
+EXTERNAL_FLASH_DEVICE_COUNT = 2
+EXTERNAL_FLASH_DEVICES = "W25Q16JV_IM, W25Q16JV_IQ"
LONGINT_IMPL = MPZ
# No I2S on SAMD51G
diff --git a/ports/atmel-samd/common-hal/pulseio/PulseOut.c b/ports/atmel-samd/common-hal/pulseio/PulseOut.c
index 59714f9b5..3463bb5e2 100644
--- a/ports/atmel-samd/common-hal/pulseio/PulseOut.c
+++ b/ports/atmel-samd/common-hal/pulseio/PulseOut.c
@@ -96,7 +96,15 @@ void pulseout_reset() {
}
void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
- const pwmio_pwmout_obj_t* carrier) {
+ const pwmio_pwmout_obj_t* carrier,
+ const mcu_pin_obj_t* pin,
+ uint32_t frequency,
+ uint16_t duty_cycle) {
+ if (!carrier || pin || frequency) {
+ mp_raise_NotImplementedError(translate("Port does not accept pins or frequency. \
+ Construct and pass a PWMOut Carrier instead"));
+ }
+
if (refcount == 0) {
// Find a spare timer.
Tc *tc = NULL;
diff --git a/ports/atmel-samd/mpconfigport.mk b/ports/atmel-samd/mpconfigport.mk
index 3fecf867e..a16daf4b0 100644
--- a/ports/atmel-samd/mpconfigport.mk
+++ b/ports/atmel-samd/mpconfigport.mk
@@ -91,3 +91,5 @@ endif # samd51
INTERNAL_LIBM = 1
USB_SERIAL_NUMBER_LENGTH = 32
+
+USB_NUM_EP = 8
diff --git a/ports/cxd56/common-hal/pulseio/PulseOut.c b/ports/cxd56/common-hal/pulseio/PulseOut.c
index a0c77b0a3..764a5860a 100644
--- a/ports/cxd56/common-hal/pulseio/PulseOut.c
+++ b/ports/cxd56/common-hal/pulseio/PulseOut.c
@@ -58,8 +58,16 @@ static bool pulseout_timer_handler(unsigned int *next_interval_us, void *arg)
return true;
}
-void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t *self,
- const pwmio_pwmout_obj_t *carrier) {
+void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
+ const pwmio_pwmout_obj_t* carrier,
+ const mcu_pin_obj_t* pin,
+ uint32_t frequency,
+ uint16_t duty_cycle) {
+ if (!carrier || pin || frequency) {
+ mp_raise_NotImplementedError(translate("Port does not accept pins or frequency. \
+ Construct and pass a PWMOut Carrier instead"));
+ }
+
if (pulse_fd < 0) {
pulse_fd = open("/dev/timer0", O_RDONLY);
}
diff --git a/ports/cxd56/supervisor/port.c b/ports/cxd56/supervisor/port.c
index 94eda66dc..7038ca478 100644
--- a/ports/cxd56/supervisor/port.c
+++ b/ports/cxd56/supervisor/port.c
@@ -36,6 +36,8 @@
#include "boards/board.h"
#include "supervisor/port.h"
+#include "supervisor/background_callback.h"
+#include "supervisor/usb.h"
#include "supervisor/shared/tick.h"
#include "common-hal/microcontroller/Pin.h"
@@ -116,6 +118,11 @@ uint32_t port_get_saved_word(void) {
return _ebss;
}
+static background_callback_t callback;
+static void usb_background_do(void* unused) {
+ usb_background();
+}
+
volatile bool _tick_enabled;
void board_timerhook(void)
{
@@ -123,6 +130,8 @@ void board_timerhook(void)
if (_tick_enabled) {
supervisor_tick();
}
+
+ background_callback_add(&callback, usb_background_do, NULL);
}
uint64_t port_get_raw_ticks(uint8_t* subticks) {
diff --git a/ports/esp32s2/background.c b/ports/esp32s2/background.c
index 40ce9ecfd..3160d9974 100644
--- a/ports/esp32s2/background.c
+++ b/ports/esp32s2/background.c
@@ -35,10 +35,17 @@
#include "shared-module/displayio/__init__.h"
#endif
+#if CIRCUITPY_PULSEIO
+#include "common-hal/pulseio/PulseIn.h"
+#endif
+
void port_background_task(void) {
// Zero delay in case FreeRTOS wants to switch to something else.
vTaskDelay(0);
+ #if CIRCUITPY_PULSEIO
+ pulsein_background();
+ #endif
}
void port_start_background_task(void) {}
diff --git a/ports/esp32s2/common-hal/neopixel_write/__init__.c b/ports/esp32s2/common-hal/neopixel_write/__init__.c
index 1fc976ec3..193d754f4 100644
--- a/ports/esp32s2/common-hal/neopixel_write/__init__.c
+++ b/ports/esp32s2/common-hal/neopixel_write/__init__.c
@@ -93,6 +93,9 @@ void common_hal_neopixel_write (const digitalio_digitalinout_obj_t* digitalinout
// Reserve channel
uint8_t number = digitalinout->pin->number;
rmt_channel_t channel = esp32s2_peripherals_find_and_reserve_rmt();
+ if (channel == RMT_CHANNEL_MAX) {
+ mp_raise_RuntimeError(translate("All timers in use"));
+ }
// Configure Channel
rmt_config_t config = RMT_DEFAULT_CONFIG_TX(number, channel);
diff --git a/ports/esp32s2/common-hal/pulseio/PulseIn.c b/ports/esp32s2/common-hal/pulseio/PulseIn.c
index 65fc6631d..f7429ec12 100644
--- a/ports/esp32s2/common-hal/pulseio/PulseIn.c
+++ b/ports/esp32s2/common-hal/pulseio/PulseIn.c
@@ -25,51 +25,184 @@
*/
#include "common-hal/pulseio/PulseIn.h"
+#include "shared-bindings/microcontroller/__init__.h"
#include "py/runtime.h"
-// STATIC void pulsein_handler(uint8_t num) {
-// }
+STATIC uint8_t refcount = 0;
+STATIC pulseio_pulsein_obj_t * handles[RMT_CHANNEL_MAX];
+
+// Requires rmt.c void esp32s2_peripherals_reset_all(void) to reset
+
+STATIC void update_internal_buffer(pulseio_pulsein_obj_t* self) {
+ uint32_t length = 0;
+ rmt_item32_t *items = (rmt_item32_t *) xRingbufferReceive(self->buf_handle, &length, 0);
+ if (items) {
+ length /= 4;
+ for (size_t i=0; i < length; i++) {
+ uint16_t pos = (self->start + self->len) % self->maxlen;
+ self->buffer[pos] = items[i].duration0 * 3;
+ // Check if second item exists before incrementing
+ if (items[i].duration1) {
+ self->buffer[pos+1] = items[i].duration1 * 3;
+ if (self->len < (self->maxlen - 1)) {
+ self->len += 2;
+ } else {
+ self->start += 2;
+ }
+ } else {
+ if (self->len < self->maxlen) {
+ self->len++;
+ } else {
+ self->start++;
+ }
+ }
+ }
+ vRingbufferReturnItem(self->buf_handle, (void *) items);
+ }
+}
+
+// We can't access the RMT interrupt, so we need a global service to prevent
+// the ringbuffer from overflowing and crashing the peripheral
+void pulsein_background(void) {
+ for (size_t i = 0; i < RMT_CHANNEL_MAX; i++) {
+ if (handles[i]) {
+ update_internal_buffer(handles[i]);
+ UBaseType_t items_waiting;
+ vRingbufferGetInfo(handles[i]->buf_handle, NULL, NULL, NULL, NULL, &items_waiting);
+ }
+ }
+}
void pulsein_reset(void) {
+ for (size_t i = 0; i < RMT_CHANNEL_MAX; i++) {
+ handles[i] = NULL;
+ }
+ supervisor_disable_tick();
+ refcount = 0;
}
void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self, const mcu_pin_obj_t* pin,
uint16_t maxlen, bool idle_state) {
- mp_raise_NotImplementedError(translate("PulseIn not supported on this chip"));
+ self->buffer = (uint16_t *) m_malloc(maxlen * sizeof(uint16_t), false);
+ if (self->buffer == NULL) {
+ mp_raise_msg_varg(&mp_type_MemoryError, translate("Failed to allocate RX buffer of %d bytes"), maxlen * sizeof(uint16_t));
+ }
+ self->pin = pin;
+ self->maxlen = maxlen;
+ self->idle_state = idle_state;
+ self->start = 0;
+ self->len = 0;
+ self->paused = false;
+
+ // Set pull settings
+ gpio_pullup_dis(pin->number);
+ gpio_pulldown_dis(pin->number);
+ if (idle_state) {
+ gpio_pullup_en(pin->number);
+ } else {
+ gpio_pulldown_en(pin->number);
+ }
+
+ // Find a free RMT Channel and configure it
+ rmt_channel_t channel = esp32s2_peripherals_find_and_reserve_rmt();
+ if (channel == RMT_CHANNEL_MAX) {
+ mp_raise_RuntimeError(translate("All timers in use"));
+ }
+ rmt_config_t config = RMT_DEFAULT_CONFIG_RX(pin->number, channel);
+ config.rx_config.filter_en = true;
+ config.rx_config.idle_threshold = 30000; // 30*3=90ms idle required to register a sequence
+ config.clk_div = 240; // All measurements are divided by 3 to accomodate 65ms pulses
+ rmt_config(&config);
+ rmt_driver_install(channel, 1000, 0); //TODO: pick a more specific buffer size?
+
+ // Store this object and the buffer handle for background updates
+ self->channel = channel;
+ handles[channel] = self;
+ rmt_get_ringbuf_handle(channel, &(self->buf_handle));
+
+ // start RMT RX, and enable ticks so the core doesn't turn off.
+ rmt_rx_start(channel, true);
+ supervisor_enable_tick();
+ refcount++;
}
bool common_hal_pulseio_pulsein_deinited(pulseio_pulsein_obj_t* self) {
- return false;
+ return handles[self->channel] ? false : true;
}
void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t* self) {
+ handles[self->channel] = NULL;
+ esp32s2_peripherals_free_rmt(self->channel);
+ reset_pin_number(self->pin->number);
+ refcount--;
+ if (refcount == 0) {
+ supervisor_disable_tick();
+ }
}
void common_hal_pulseio_pulsein_pause(pulseio_pulsein_obj_t* self) {
+ self->paused = true;
+ rmt_rx_stop(self->channel);
}
void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t* self, uint16_t trigger_duration) {
+ // Make sure we're paused.
+ if ( !self->paused ) {
+ common_hal_pulseio_pulsein_pause(self);
+ }
+
+ if (trigger_duration > 0) {
+ gpio_set_direction(self->pin->number, GPIO_MODE_DEF_OUTPUT);
+ gpio_set_level(self->pin->number, !self->idle_state);
+ common_hal_mcu_delay_us((uint32_t)trigger_duration);
+ gpio_set_level(self->pin->number, self->idle_state);
+ gpio_set_direction(self->pin->number, GPIO_MODE_INPUT); // should revert to pull direction
+ }
+
+ self->paused = false;
+ rmt_rx_start(self->channel, false);
}
void common_hal_pulseio_pulsein_clear(pulseio_pulsein_obj_t* self) {
+ // Buffer only updates in BG tasks or fetches, so no extra protection is needed
+ self->start = 0;
+ self->len = 0;
}
uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t* self, int16_t index) {
- return false;
+ update_internal_buffer(self);
+ if (index < 0) {
+ index += self->len;
+ }
+ if (index < 0 || index >= self->len) {
+ mp_raise_IndexError(translate("index out of range"));
+ }
+ uint16_t value = self->buffer[(self->start + index) % self->maxlen];
+ return value;
}
uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t* self) {
- return false;
+ update_internal_buffer(self);
+
+ if (self->len == 0) {
+ mp_raise_IndexError(translate("pop from an empty PulseIn"));
+ }
+
+ uint16_t value = self->buffer[self->start];
+ self->start = (self->start + 1) % self->maxlen;
+ self->len--;
+
+ return value;
}
uint16_t common_hal_pulseio_pulsein_get_maxlen(pulseio_pulsein_obj_t* self) {
- return false;
+ return self->maxlen;
}
bool common_hal_pulseio_pulsein_get_paused(pulseio_pulsein_obj_t* self) {
- return false;
+ return self->paused;
}
uint16_t common_hal_pulseio_pulsein_get_len(pulseio_pulsein_obj_t* self) {
- return false;
+ return self->len;
}
diff --git a/ports/esp32s2/common-hal/pulseio/PulseIn.h b/ports/esp32s2/common-hal/pulseio/PulseIn.h
index b317c516c..97d70d4b0 100644
--- a/ports/esp32s2/common-hal/pulseio/PulseIn.h
+++ b/ports/esp32s2/common-hal/pulseio/PulseIn.h
@@ -30,24 +30,27 @@
#include "common-hal/microcontroller/Pin.h"
#include "py/obj.h"
+#include "driver/rmt.h"
+#include "rmt.h"
typedef struct {
mp_obj_base_t base;
const mcu_pin_obj_t* pin;
+ rmt_channel_t channel;
bool idle_state;
bool paused;
- volatile bool first_edge;
+
+ RingbufHandle_t buf_handle;
uint16_t* buffer;
uint16_t maxlen;
volatile uint16_t start;
volatile uint16_t len;
- volatile uint32_t last_overflow;
- volatile uint16_t last_count;
} pulseio_pulsein_obj_t;
void pulsein_reset(void);
+void pulsein_background(void);
#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PULSEIN_H
diff --git a/ports/esp32s2/common-hal/pulseio/PulseOut.c b/ports/esp32s2/common-hal/pulseio/PulseOut.c
index 15eab83dd..cfe750732 100644
--- a/ports/esp32s2/common-hal/pulseio/PulseOut.c
+++ b/ports/esp32s2/common-hal/pulseio/PulseOut.c
@@ -29,32 +29,63 @@
#include "shared-bindings/pwmio/PWMOut.h"
#include "py/runtime.h"
-// STATIC void turn_on(pulseio_pulseout_obj_t *pulseout) {
-// }
+// Requires rmt.c void esp32s2_peripherals_reset_all(void) to reset
-// STATIC void turn_off(pulseio_pulseout_obj_t *pulseout) {
-// }
+void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
+ const pwmio_pwmout_obj_t* carrier,
+ const mcu_pin_obj_t* pin,
+ uint32_t frequency,
+ uint16_t duty_cycle) {
+ if (carrier || !pin || !frequency) {
+ mp_raise_NotImplementedError(translate("Port does not accept PWM carrier. \
+ Pass a pin, frequency and duty cycle instead"));
+ }
-// STATIC void start_timer(void) {
-// }
+ rmt_channel_t channel = esp32s2_peripherals_find_and_reserve_rmt();
+ if (channel == RMT_CHANNEL_MAX) {
+ mp_raise_RuntimeError(translate("All timers in use"));
+ }
-// STATIC void pulseout_event_handler(void) {
-// }
+ // Configure Channel
+ rmt_config_t config = RMT_DEFAULT_CONFIG_TX(pin->number, channel);
+ config.tx_config.carrier_en = true;
+ config.tx_config.carrier_duty_percent = (duty_cycle * 100) / (1<<16);
+ config.tx_config.carrier_freq_hz = frequency;
+ config.clk_div = 80;
-void pulseout_reset() {
-}
+ rmt_config(&config);
+ rmt_driver_install(channel, 0, 0);
-void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
- const pwmio_pwmout_obj_t* carrier) {
- mp_raise_NotImplementedError(translate("PulseOut not supported on this chip"));
+ self->channel = channel;
}
bool common_hal_pulseio_pulseout_deinited(pulseio_pulseout_obj_t* self) {
- return false;
+ return (self->channel == RMT_CHANNEL_MAX);
}
void common_hal_pulseio_pulseout_deinit(pulseio_pulseout_obj_t* self) {
+ esp32s2_peripherals_free_rmt(self->channel);
+ self->channel = RMT_CHANNEL_MAX;
+
}
void common_hal_pulseio_pulseout_send(pulseio_pulseout_obj_t* self, uint16_t* pulses, uint16_t length) {
+ rmt_item32_t items[length];
+
+ // Circuitpython allows 16 bit pulse values, while ESP32 only allows 15 bits
+ // Thus, we use entire items for one pulse, rather than switching inside each item
+ for (size_t i = 0; i < length; i++) {
+ // Setting the RMT duration to 0 has undefined behavior, so avoid that pre-emptively.
+ if (pulses[i] == 0) {
+ pulses[i] = 1;
+ }
+ uint32_t level = (i % 2) ? 0 : 1;
+ const rmt_item32_t item = {{{ (pulses[i] & 0x8000 ? 0x7FFF : 1), level, (pulses[i] & 0x7FFF), level}}};
+ items[i] = item;
+ }
+
+ rmt_write_items(self->channel, items, length, true);
+ while (rmt_wait_tx_done(self->channel, 0) != ESP_OK) {
+ RUN_BACKGROUND_TASKS;
+ }
}
diff --git a/ports/esp32s2/common-hal/pulseio/PulseOut.h b/ports/esp32s2/common-hal/pulseio/PulseOut.h
index e58bb0457..629591af6 100644
--- a/ports/esp32s2/common-hal/pulseio/PulseOut.h
+++ b/ports/esp32s2/common-hal/pulseio/PulseOut.h
@@ -28,15 +28,14 @@
#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PULSEOUT_H
#include "common-hal/microcontroller/Pin.h"
-#include "common-hal/pwmio/PWMOut.h"
+#include "driver/rmt.h"
+#include "rmt.h"
#include "py/obj.h"
typedef struct {
mp_obj_base_t base;
- pwmio_pwmout_obj_t *pwmout;
+ rmt_channel_t channel;
} pulseio_pulseout_obj_t;
-void pulseout_reset(void);
-
#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PULSEOUT_H
diff --git a/ports/esp32s2/mpconfigport.h b/ports/esp32s2/mpconfigport.h
index d340bb480..07f83434a 100644
--- a/ports/esp32s2/mpconfigport.h
+++ b/ports/esp32s2/mpconfigport.h
@@ -28,19 +28,18 @@
#ifndef ESP32S2_MPCONFIGPORT_H__
#define ESP32S2_MPCONFIGPORT_H__
-#define CIRCUITPY_INTERNAL_NVM_SIZE (0)
-#define MICROPY_NLR_THUMB (0)
+#define CIRCUITPY_INTERNAL_NVM_SIZE (0)
+#define MICROPY_NLR_THUMB (0)
-#define MICROPY_PY_UJSON (0)
-#define MICROPY_USE_INTERNAL_PRINTF (0)
+#define MICROPY_PY_UJSON (0)
+#define MICROPY_USE_INTERNAL_PRINTF (0)
#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 MICROPY_NLR_SETJMP (1)
+#define CIRCUITPY_DEFAULT_STACK_SIZE (0x6000)
#endif // __INCLUDED_ESP32S2_MPCONFIGPORT_H
diff --git a/ports/esp32s2/peripherals/rmt.c b/ports/esp32s2/peripherals/rmt.c
index f17957c1c..b7629dbd5 100644
--- a/ports/esp32s2/peripherals/rmt.c
+++ b/ports/esp32s2/peripherals/rmt.c
@@ -29,6 +29,14 @@
bool rmt_reserved_channels[RMT_CHANNEL_MAX];
+void esp32s2_peripherals_rmt_reset(void) {
+ for (size_t i = 0; i < RMT_CHANNEL_MAX; i++) {
+ if (rmt_reserved_channels[i]) {
+ esp32s2_peripherals_free_rmt(i);
+ }
+ }
+}
+
rmt_channel_t esp32s2_peripherals_find_and_reserve_rmt(void) {
for (size_t i = 0; i < RMT_CHANNEL_MAX; i++) {
if (!rmt_reserved_channels[i]) {
@@ -36,8 +44,8 @@ rmt_channel_t esp32s2_peripherals_find_and_reserve_rmt(void) {
return i;
}
}
- mp_raise_RuntimeError(translate("All timers in use"));
- return false;
+ // Returning the max indicates a reservation failure.
+ return RMT_CHANNEL_MAX;
}
void esp32s2_peripherals_free_rmt(rmt_channel_t chan) {
diff --git a/ports/esp32s2/peripherals/rmt.h b/ports/esp32s2/peripherals/rmt.h
index 4741a5bc5..01ed09907 100644
--- a/ports/esp32s2/peripherals/rmt.h
+++ b/ports/esp32s2/peripherals/rmt.h
@@ -31,6 +31,7 @@
#include "driver/rmt.h"
#include <stdint.h>
+void esp32s2_peripherals_rmt_reset(void);
rmt_channel_t esp32s2_peripherals_find_and_reserve_rmt(void);
void esp32s2_peripherals_free_rmt(rmt_channel_t chan);
diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c
index 2f430c7e3..03caed92e 100644
--- a/ports/esp32s2/supervisor/port.c
+++ b/ports/esp32s2/supervisor/port.c
@@ -38,10 +38,13 @@
#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 "supervisor/memory.h"
#include "supervisor/shared/tick.h"
+#include "rmt.h"
+
STATIC esp_timer_handle_t _tick_timer;
void tick_timer_cb(void* arg) {
@@ -65,9 +68,15 @@ void reset_port(void) {
// A larger delay so the idle task can run and do any IDF cleanup needed.
vTaskDelay(4);
+#if CIRCUITPY_PULSEIO
+ esp32s2_peripherals_rmt_reset();
+ pulsein_reset();
+#endif
+
#if CIRCUITPY_PWMIO
pwmout_reset();
#endif
+
#if CIRCUITPY_BUSIO
i2c_reset();
spi_reset();
diff --git a/ports/mimxrt10xx/common-hal/pulseio/PulseOut.c b/ports/mimxrt10xx/common-hal/pulseio/PulseOut.c
index 2c27847ed..d3a1a897f 100644
--- a/ports/mimxrt10xx/common-hal/pulseio/PulseOut.c
+++ b/ports/mimxrt10xx/common-hal/pulseio/PulseOut.c
@@ -94,7 +94,10 @@ void pulseout_reset() {
}
void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
- const pwmio_pwmout_obj_t* carrier) {
+ const pwmio_pwmout_obj_t* carrier,
+ const mcu_pin_obj_t* pin,
+ uint32_t frequency,
+ uint16_t duty_cycle) {
// if (refcount == 0) {
// // Find a spare timer.
// Tc *tc = NULL;
diff --git a/ports/nrf/boards/simmel/mpconfigboard.h b/ports/nrf/boards/simmel/mpconfigboard.h
index 2380a8055..a89f540b0 100644
--- a/ports/nrf/boards/simmel/mpconfigboard.h
+++ b/ports/nrf/boards/simmel/mpconfigboard.h
@@ -45,6 +45,9 @@
#define BOOTLOADER_SIZE (0x4000) // 12 kiB
#define CIRCUITPY_BLE_CONFIG_SIZE (12*1024)
+#define DEFAULT_I2C_BUS_SCL (&pin_P0_08)
+#define DEFAULT_I2C_BUS_SDA (&pin_P1_09)
+
// Reduce nRF SoftRadio memory usage
#define BLEIO_VS_UUID_COUNT 10
#define BLEIO_HVN_TX_QUEUE_SIZE 2
diff --git a/ports/nrf/boards/simmel/pins.c b/ports/nrf/boards/simmel/pins.c
index 6c572cae2..e9710967b 100644
--- a/ports/nrf/boards/simmel/pins.c
+++ b/ports/nrf/boards/simmel/pins.c
@@ -9,19 +9,15 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ 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_I2S_LRCK), MP_ROM_PTR(&pin_P0_08) },
- { MP_ROM_QSTR(MP_QSTR_I2S_SDIN), MP_ROM_PTR(&pin_P1_09) },
- { MP_ROM_QSTR(MP_QSTR_I2S_SCK), MP_ROM_PTR(&pin_P0_12) },
-
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_P0_06) },
- { MP_ROM_QSTR(MP_QSTR_CHG), MP_ROM_PTR(&pin_P0_04) },
- { MP_ROM_QSTR(MP_QSTR_PWM), MP_ROM_PTR(&pin_P0_02) },
- { MP_ROM_QSTR(MP_QSTR_PWM_N), MP_ROM_PTR(&pin_P0_19) },
+ { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_08) },
+ { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P1_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);
diff --git a/ports/nrf/common-hal/pulseio/PulseOut.c b/ports/nrf/common-hal/pulseio/PulseOut.c
index 16e383caf..9f301a730 100644
--- a/ports/nrf/common-hal/pulseio/PulseOut.c
+++ b/ports/nrf/common-hal/pulseio/PulseOut.c
@@ -100,7 +100,15 @@ void pulseout_reset() {
}
void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
- const pwmio_pwmout_obj_t* carrier) {
+ const pwmio_pwmout_obj_t* carrier,
+ const mcu_pin_obj_t* pin,
+ uint32_t frequency,
+ uint16_t duty_cycle) {
+ if (!carrier || pin || frequency) {
+ mp_raise_NotImplementedError(translate("Port does not accept pins or frequency. \
+ Construct and pass a PWMOut Carrier instead"));
+ }
+
if (refcount == 0) {
timer = nrf_peripherals_allocate_timer_or_throw();
}
diff --git a/ports/stm/common-hal/pulseio/PulseOut.c b/ports/stm/common-hal/pulseio/PulseOut.c
index fb48561d8..3bf23ad14 100644
--- a/ports/stm/common-hal/pulseio/PulseOut.c
+++ b/ports/stm/common-hal/pulseio/PulseOut.c
@@ -113,7 +113,15 @@ void pulseout_reset() {
}
void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
- const pwmio_pwmout_obj_t* carrier) {
+ const pwmio_pwmout_obj_t* carrier,
+ const mcu_pin_obj_t* pin,
+ uint32_t frequency,
+ uint16_t duty_cycle) {
+ if (!carrier || pin || frequency) {
+ mp_raise_NotImplementedError(translate("Port does not accept pins or frequency. \
+ Construct and pass a PWMOut Carrier instead"));
+ }
+
// Add to active PulseOuts
refcount++;
TIM_TypeDef * tim_instance = stm_peripherals_find_timer();
diff --git a/shared-bindings/pulseio/PulseOut.c b/shared-bindings/pulseio/PulseOut.c
index 024ee613c..2b787df4f 100644
--- a/shared-bindings/pulseio/PulseOut.c
+++ b/shared-bindings/pulseio/PulseOut.c
@@ -65,20 +65,28 @@
//| pulse.send(pulses)"""
//| ...
//|
-STATIC mp_obj_t pulseio_pulseout_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, 1, 1, false);
- mp_obj_t carrier_obj = args[0];
-
- if (!MP_OBJ_IS_TYPE(carrier_obj, &pwmio_pwmout_type)) {
- mp_raise_TypeError_varg(translate("Expected a %q"), pwmio_pwmout_type.name);
- }
-
- // create Pulse object from the given pin
+STATIC mp_obj_t pulseio_pulseout_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
pulseio_pulseout_obj_t *self = m_new_obj(pulseio_pulseout_obj_t);
self->base.type = &pulseio_pulseout_type;
- common_hal_pulseio_pulseout_construct(self, (pwmio_pwmout_obj_t *)MP_OBJ_TO_PTR(carrier_obj));
-
+ mp_obj_t carrier_obj = pos_args[0];
+ if (MP_OBJ_IS_TYPE(carrier_obj, &pwmio_pwmout_type)) {
+ // Use a PWMOut Carrier
+ mp_arg_check_num(n_args, kw_args, 1, 1, false);
+ common_hal_pulseio_pulseout_construct(self, (pwmio_pwmout_obj_t *)MP_OBJ_TO_PTR(carrier_obj), NULL, 0, 0);
+ } else {
+ // Use a Pin, frequency, and duty cycle
+ enum { ARG_pin, ARG_frequency};
+ static const mp_arg_t allowed_args[] = {
+ { MP_QSTR_pin, MP_ARG_REQUIRED | MP_ARG_OBJ },
+ { MP_QSTR_frequency, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 38000} },
+ { MP_QSTR_duty_cycle, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1<<15} },
+ };
+ 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_pulseio_pulseout_construct(self, NULL, pin, args[ARG_frequency].u_int, args[ARG_frequency].u_int);
+ }
return MP_OBJ_FROM_PTR(self);
}
diff --git a/shared-bindings/pulseio/PulseOut.h b/shared-bindings/pulseio/PulseOut.h
index 80dd0e92f..49dc555fe 100644
--- a/shared-bindings/pulseio/PulseOut.h
+++ b/shared-bindings/pulseio/PulseOut.h
@@ -34,7 +34,11 @@
extern const mp_obj_type_t pulseio_pulseout_type;
extern void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
- const pwmio_pwmout_obj_t* carrier);
+ const pwmio_pwmout_obj_t* carrier,
+ const mcu_pin_obj_t* pin,
+ uint32_t frequency,
+ uint16_t duty_cycle);
+
extern void common_hal_pulseio_pulseout_deinit(pulseio_pulseout_obj_t* self);
extern bool common_hal_pulseio_pulseout_deinited(pulseio_pulseout_obj_t* self);
extern void common_hal_pulseio_pulseout_send(pulseio_pulseout_obj_t* self,
diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk
index 25b240036..c876a11cc 100644
--- a/supervisor/supervisor.mk
+++ b/supervisor/supervisor.mk
@@ -171,6 +171,10 @@ ifndef USB_MIDI_EP_NUM_IN
USB_MIDI_EP_NUM_IN = 0
endif
+ifndef USB_NUM_EP
+USB_NUM_EP = 0
+endif
+
USB_DESCRIPTOR_ARGS = \
--manufacturer $(USB_MANUFACTURER)\
--product $(USB_PRODUCT)\
@@ -180,6 +184,7 @@ USB_DESCRIPTOR_ARGS = \
--interface_name $(USB_INTERFACE_NAME)\
--devices $(USB_DEVICES)\
--hid_devices $(USB_HID_DEVICES)\
+ --max_ep $(USB_NUM_EP) \
--cdc_ep_num_notification $(USB_CDC_EP_NUM_NOTIFICATION)\
--cdc_ep_num_data_out $(USB_CDC_EP_NUM_DATA_OUT)\
--cdc_ep_num_data_in $(USB_CDC_EP_NUM_DATA_IN)\
diff --git a/tools/gen_display_resources.py b/tools/gen_display_resources.py
index e4197aabf..6657b6a27 100644
--- a/tools/gen_display_resources.py
+++ b/tools/gen_display_resources.py
@@ -58,15 +58,20 @@ filtered_characters = all_characters
# Try to pre-load all of the glyphs. Misses will still be slow later.
f.load_glyphs(set(ord(c) for c in all_characters))
+missing = 0
# Get each glyph.
for c in set(all_characters):
if ord(c) not in f._glyphs:
+ missing += 1
filtered_characters = filtered_characters.replace(c, "")
continue
g = f.get_glyph(ord(c))
if g["shift"][1] != 0:
raise RuntimeError("y shift")
+if missing > 0:
+ print("Font missing", missing, "characters", file=sys.stderr)
+
x, y, dx, dy = f.get_bounding_box()
tile_x, tile_y = x - dx, y - dy
total_bits = tile_x * len(all_characters)
diff --git a/tools/gen_usb_descriptor.py b/tools/gen_usb_descriptor.py
index fb91fd334..baee8cad7 100644
--- a/tools/gen_usb_descriptor.py
+++ b/tools/gen_usb_descriptor.py
@@ -62,6 +62,8 @@ parser.add_argument('--midi_ep_num_out', type=int, default=0,
help='endpoint number of MIDI OUT')
parser.add_argument('--midi_ep_num_in', type=int, default=0,
help='endpoint number of MIDI IN')
+parser.add_argument('--max_ep', type=int, default=0,
+ help='total number of endpoints available')
parser.add_argument('--output_c_file', type=argparse.FileType('w', encoding='UTF-8'), required=True)
parser.add_argument('--output_h_file', type=argparse.FileType('w', encoding='UTF-8'), required=True)
@@ -376,6 +378,15 @@ if 'AUDIO' in args.devices:
# interface cross-references.
interfaces = util.join_interfaces(interfaces_to_join, renumber_endpoints=args.renumber_endpoints)
+if args.max_ep != 0:
+ for interface in interfaces:
+ for subdescriptor in interface.subdescriptors:
+ endpoint_address = getattr(subdescriptor, 'bEndpointAddress', 0) & 0x7f
+ if endpoint_address > args.max_ep:
+ raise ValueError("Endpoint address %d of %s may not exceed %d" % (endpoint_address & 0x7f, interface.description, args.max_ep))
+else:
+ print("Unable to check whether maximum number of endpoints is respected", file=sys.stderr)
+
# Now adjust the CDC interface cross-references.
cdc_union.bMasterInterface = cdc_comm_interface.bInterfaceNumber