diff --git a/lib/protomatter b/lib/protomatter index 98a2da6da4bd..eadf2ee8144d 160000 --- a/lib/protomatter +++ b/lib/protomatter @@ -1 +1 @@ -Subproject commit 98a2da6da4bdbfee8f3ab2334871e8c360dccae3 +Subproject commit eadf2ee8144d2b526f6adef5c9270e2625aee835 diff --git a/locale/ID.po b/locale/ID.po index 2589ce9e228d..7e8622d58c7c 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -479,12 +479,6 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Semua perangkat I2C sedang digunakan" -#: ports/espressif/common-hal/countio/Counter.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c -msgid "All PCNT units in use" -msgstr "Semua unit PCNT sedang digunakan" - #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -532,10 +526,6 @@ 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/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/neopixel_write/__init__.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c @@ -740,7 +730,7 @@ msgstr "Tidak dapat mengatur CCCD pada Karakteristik lokal" #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c -#: shared-bindings/uvc/__init__.c +#: shared-bindings/usb_video/__init__.c msgid "Cannot change USB devices now" msgstr "" @@ -835,10 +825,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: ports/espressif/common-hal/neopixel_write/__init__.c -msgid "Could not retrieve clock" -msgstr "" - #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" msgstr "" @@ -1142,7 +1128,7 @@ msgstr "" msgid "Input taking too long" msgstr "" -#: ports/espressif/common-hal/neopixel_write/__init__.c py/moderrno.c +#: py/moderrno.c msgid "Input/output error" msgstr "Kesalahan input/output" @@ -4364,6 +4350,9 @@ msgstr "zi harus berjenis float" msgid "zi must be of shape (n_section, 2)" msgstr "Zi harus berbentuk (n_section, 2)" +#~ msgid "All PCNT units in use" +#~ msgstr "Semua unit PCNT sedang digunakan" + #~ msgid "Cannot vary frequency on a timer that is already in use" #~ msgstr "" #~ "Tidak dapat membuat variasi frekuensi pada penghitung waktu yang sudah " diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 17e7a3f29849..e7fdb6784cc6 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -476,12 +476,6 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "" -#: ports/espressif/common-hal/countio/Counter.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c -msgid "All PCNT units in use" -msgstr "" - #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -529,10 +523,6 @@ 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/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/neopixel_write/__init__.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c @@ -735,7 +725,7 @@ msgstr "" #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c -#: shared-bindings/uvc/__init__.c +#: shared-bindings/usb_video/__init__.c msgid "Cannot change USB devices now" msgstr "" @@ -827,10 +817,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: ports/espressif/common-hal/neopixel_write/__init__.c -msgid "Could not retrieve clock" -msgstr "" - #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" msgstr "" @@ -1134,7 +1120,7 @@ msgstr "" msgid "Input taking too long" msgstr "" -#: ports/espressif/common-hal/neopixel_write/__init__.c py/moderrno.c +#: py/moderrno.c msgid "Input/output error" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index eb6b83da4ccb..4b9860d797a5 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -487,12 +487,6 @@ msgstr "Všechny CAN periferie jsou používány" msgid "All I2C peripherals are in use" msgstr "Všechny I2C periferie jsou používány" -#: ports/espressif/common-hal/countio/Counter.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c -msgid "All PCNT units in use" -msgstr "Všechny PCNT jednotky jsou používány" - #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -540,10 +534,6 @@ msgstr "Všechny časovače pro tento pin jsou používány" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/neopixel_write/__init__.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c @@ -751,7 +741,7 @@ msgstr "Nelze nastavit CCCD na místní charakteristiku" #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c -#: shared-bindings/uvc/__init__.c +#: shared-bindings/usb_video/__init__.c msgid "Cannot change USB devices now" msgstr "Nelze změnit USB zařízení" @@ -844,10 +834,6 @@ msgstr "Pole souřadnic mají různé délky" msgid "Coordinate arrays types have different sizes" msgstr "" -#: ports/espressif/common-hal/neopixel_write/__init__.c -msgid "Could not retrieve clock" -msgstr "Nelze načíst hodiny" - #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" msgstr "Není možné nastavit adresu" @@ -1154,7 +1140,7 @@ msgstr "" msgid "Input taking too long" msgstr "Vstup trval příliš dlouho" -#: ports/espressif/common-hal/neopixel_write/__init__.c py/moderrno.c +#: py/moderrno.c msgid "Input/output error" msgstr "Chyba vstupu/výstupu" @@ -4373,6 +4359,12 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "All PCNT units in use" +#~ msgstr "Všechny PCNT jednotky jsou používány" + +#~ msgid "Could not retrieve clock" +#~ msgstr "Nelze načíst hodiny" + #~ msgid "Cannot reset into bootloader because no bootloader is present" #~ msgstr "" #~ "Reset do bootloaderu není možný, protože žádný bootloader není přítomen" diff --git a/locale/de_DE.po b/locale/de_DE.po index 4eab989dc7cf..d0681ad1ab75 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -487,12 +487,6 @@ msgstr "Alle CAN-Schnittstellen sind in Benutzung" msgid "All I2C peripherals are in use" msgstr "Alle I2C-Peripheriegeräte sind in Benutzung" -#: ports/espressif/common-hal/countio/Counter.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c -msgid "All PCNT units in use" -msgstr "Alle PCNT-Einheiten sind in Benutzung" - #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -540,10 +534,6 @@ 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/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/neopixel_write/__init__.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c @@ -750,7 +740,7 @@ msgstr "CCCD kann nicht auf lokales Merkmal eingestellt werden" #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c -#: shared-bindings/uvc/__init__.c +#: shared-bindings/usb_video/__init__.c msgid "Cannot change USB devices now" msgstr "Kann USB-Geräte jetzt nicht ändern" @@ -845,10 +835,6 @@ msgstr "Koordinaten-Arrays haben unterschiedliche Längen" msgid "Coordinate arrays types have different sizes" msgstr "Typen der Koordinaten-Arrays haben unterschiedliche Längen" -#: ports/espressif/common-hal/neopixel_write/__init__.c -msgid "Could not retrieve clock" -msgstr "Clock konnte nicht ermittelt werden" - #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" msgstr "Konnte Adresse nicht setzen" @@ -1161,7 +1147,7 @@ msgstr "Input buffer länge (%d) muss ein vielfaches vom Strand Count (%d) sein" msgid "Input taking too long" msgstr "Input benötigt zu lange" -#: ports/espressif/common-hal/neopixel_write/__init__.c py/moderrno.c +#: py/moderrno.c msgid "Input/output error" msgstr "Eingabe-/Ausgabefehler" @@ -4426,6 +4412,12 @@ msgstr "zi muss eine Gleitkommazahl sein" msgid "zi must be of shape (n_section, 2)" msgstr "zi muss die Form (n_section, 2) haben" +#~ msgid "All PCNT units in use" +#~ msgstr "Alle PCNT-Einheiten sind in Benutzung" + +#~ msgid "Could not retrieve clock" +#~ msgstr "Clock konnte nicht ermittelt werden" + #~ msgid "Cannot reset into bootloader because no bootloader is present" #~ msgstr "Kann nicht in den Bootloader resetten, weil keiner vorhanden ist" diff --git a/locale/el.po b/locale/el.po index f11544a630cd..fe64340330b9 100644 --- a/locale/el.po +++ b/locale/el.po @@ -491,12 +491,6 @@ msgstr "Όλα τα περιφεριακά CAN είναι σε χρήση" msgid "All I2C peripherals are in use" msgstr "Όλα τα I2C περιφεριακά ειναι σε χρήση" -#: ports/espressif/common-hal/countio/Counter.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c -msgid "All PCNT units in use" -msgstr "Όλες οι μονάδες PCNT είναι σε χρήση" - #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -544,10 +538,6 @@ msgstr "Όλοι οι χρονιστές για αυτό το pin χρησιμο #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/neopixel_write/__init__.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c @@ -753,7 +743,7 @@ msgstr "Δεν μπορεί να οριστεί CCCD σε τοπικό Character #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c -#: shared-bindings/uvc/__init__.c +#: shared-bindings/usb_video/__init__.c msgid "Cannot change USB devices now" msgstr "Δεν μπορούν να αλλάξουν οι USB συσκευές τώρα" @@ -850,10 +840,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: ports/espressif/common-hal/neopixel_write/__init__.c -msgid "Could not retrieve clock" -msgstr "Δεν μπόρεσε να ανακληθεί το ρολόι" - #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" msgstr "Δεν μπόρεσε να ρυθμιστεί η διεύθυνση" @@ -1160,7 +1146,7 @@ msgstr "" msgid "Input taking too long" msgstr "" -#: ports/espressif/common-hal/neopixel_write/__init__.c py/moderrno.c +#: py/moderrno.c msgid "Input/output error" msgstr "" @@ -4370,6 +4356,12 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "All PCNT units in use" +#~ msgstr "Όλες οι μονάδες PCNT είναι σε χρήση" + +#~ msgid "Could not retrieve clock" +#~ msgstr "Δεν μπόρεσε να ανακληθεί το ρολόι" + #~ msgid "Cannot reset into bootloader because no bootloader is present" #~ msgstr "" #~ "Δεν μπορεί να γίνει επανεκκίνηση στον bootloader διότι δεν υπάρχει " diff --git a/locale/en_GB.po b/locale/en_GB.po index 3a4e1c5ba671..406e098ce0d0 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -489,12 +489,6 @@ msgstr "All CAN peripherals are in use" msgid "All I2C peripherals are in use" msgstr "All I2C peripherals are in use" -#: ports/espressif/common-hal/countio/Counter.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c -msgid "All PCNT units in use" -msgstr "All PCNT units in use" - #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -542,10 +536,6 @@ msgstr "All timers for this pin are in use" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/neopixel_write/__init__.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c @@ -750,7 +740,7 @@ msgstr "Can't set CCCD on local Characteristic" #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c -#: shared-bindings/uvc/__init__.c +#: shared-bindings/usb_video/__init__.c msgid "Cannot change USB devices now" msgstr "Cannot change USB devices now" @@ -844,10 +834,6 @@ msgstr "Coordinate arrays have different lengths" msgid "Coordinate arrays types have different sizes" msgstr "Coordinate arrays types have different sizes" -#: ports/espressif/common-hal/neopixel_write/__init__.c -msgid "Could not retrieve clock" -msgstr "Could not retrieve clock" - #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" msgstr "Could not set address" @@ -1153,7 +1139,7 @@ msgstr "Input buffer length (%d) must be a multiple of the strand count (%d)" msgid "Input taking too long" msgstr "Input taking too long" -#: ports/espressif/common-hal/neopixel_write/__init__.c py/moderrno.c +#: py/moderrno.c msgid "Input/output error" msgstr "Input/output error" @@ -4382,6 +4368,12 @@ msgstr "zi must be of float type" msgid "zi must be of shape (n_section, 2)" msgstr "zi must be of shape (n_section, 2)" +#~ msgid "All PCNT units in use" +#~ msgstr "All PCNT units in use" + +#~ msgid "Could not retrieve clock" +#~ msgstr "Could not retrieve clock" + #~ msgid "Cannot reset into bootloader because no bootloader is present" #~ msgstr "Cannot reset into bootloader because no bootloader is present" diff --git a/locale/es.po b/locale/es.po index 55edd3ad0059..7d9913af0f20 100644 --- a/locale/es.po +++ b/locale/es.po @@ -491,12 +491,6 @@ 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 en uso" -#: ports/espressif/common-hal/countio/Counter.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c -msgid "All PCNT units in use" -msgstr "Todas las unidades PCNT en uso" - #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -546,10 +540,6 @@ msgstr "Todos los timers para este pin están en 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/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/neopixel_write/__init__.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c @@ -757,7 +747,7 @@ msgstr "No se puede configurar CCCD en la característica local" #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c -#: shared-bindings/uvc/__init__.c +#: shared-bindings/usb_video/__init__.c msgid "Cannot change USB devices now" msgstr "No se pueden cambiar dispositivos USB en este momento" @@ -853,10 +843,6 @@ msgstr "Las matrices de coordenadas tienen diferentes longitudes" msgid "Coordinate arrays types have different sizes" msgstr "Las matrices de coordenadas tienen diferentes tamaños" -#: ports/espressif/common-hal/neopixel_write/__init__.c -msgid "Could not retrieve clock" -msgstr "No puedo traer el reloj" - #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" msgstr "No se puede definir la dirección" @@ -1173,7 +1159,7 @@ msgstr "" msgid "Input taking too long" msgstr "La entrada está durando mucho tiempo" -#: ports/espressif/common-hal/neopixel_write/__init__.c py/moderrno.c +#: py/moderrno.c msgid "Input/output error" msgstr "error Input/output" @@ -4420,6 +4406,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 "All PCNT units in use" +#~ msgstr "Todas las unidades PCNT en uso" + +#~ msgid "Could not retrieve clock" +#~ msgstr "No puedo traer el reloj" + #~ msgid "Cannot reset into bootloader because no bootloader is present" #~ msgstr "" #~ "No puede se reinicilizado al bootloader porque el bootloader no se " diff --git a/locale/fil.po b/locale/fil.po index 207c315a741d..2794675eeae1 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -478,12 +478,6 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Lahat ng I2C peripherals ginagamit" -#: ports/espressif/common-hal/countio/Counter.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c -msgid "All PCNT units in use" -msgstr "" - #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -532,10 +526,6 @@ 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/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/neopixel_write/__init__.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c @@ -741,7 +731,7 @@ msgstr "" #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c -#: shared-bindings/uvc/__init__.c +#: shared-bindings/usb_video/__init__.c msgid "Cannot change USB devices now" msgstr "" @@ -834,10 +824,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: ports/espressif/common-hal/neopixel_write/__init__.c -msgid "Could not retrieve clock" -msgstr "" - #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" msgstr "" @@ -1144,7 +1130,7 @@ msgstr "" msgid "Input taking too long" msgstr "" -#: ports/espressif/common-hal/neopixel_write/__init__.c py/moderrno.c +#: py/moderrno.c msgid "Input/output error" msgstr "May mali sa Input/Output" diff --git a/locale/fr.po b/locale/fr.po index 6db25b19d83c..c35f821c4ff0 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -495,12 +495,6 @@ 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/espressif/common-hal/countio/Counter.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c -msgid "All PCNT units in use" -msgstr "Toutes les unités PCNT sont utilisées" - #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -548,10 +542,6 @@ msgstr "Tous les minuteurs 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/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/neopixel_write/__init__.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c @@ -760,7 +750,7 @@ msgstr "Impossible de définir CCCD sur une caractéristique locale" #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c -#: shared-bindings/uvc/__init__.c +#: shared-bindings/usb_video/__init__.c msgid "Cannot change USB devices now" msgstr "Impossible de changer de périphérique USB maintenant" @@ -861,10 +851,6 @@ msgstr "Les tableaux de coordonnées sont de longueur différentes" msgid "Coordinate arrays types have different sizes" msgstr "Les types des matrices de coordonnées sont de longueur différentes" -#: ports/espressif/common-hal/neopixel_write/__init__.c -msgid "Could not retrieve clock" -msgstr "Impossible d'obtenir l'horloge" - #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" msgstr "Impossible de définir l'adresse" @@ -1182,7 +1168,7 @@ msgstr "" msgid "Input taking too long" msgstr "L'entrée prend trop de temps" -#: ports/espressif/common-hal/neopixel_write/__init__.c py/moderrno.c +#: py/moderrno.c msgid "Input/output error" msgstr "Erreur d'entrée/sortie" @@ -4451,6 +4437,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 "All PCNT units in use" +#~ msgstr "Toutes les unités PCNT sont utilisées" + +#~ msgid "Could not retrieve clock" +#~ msgstr "Impossible d'obtenir l'horloge" + #~ msgid "Cannot reset into bootloader because no bootloader is present" #~ msgstr "" #~ "Impossible de redémarrer dans le bootloader puisque aucun n'est présent" diff --git a/locale/hi.po b/locale/hi.po index d4b943839dfc..f601dd3fa35b 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -478,12 +478,6 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "" -#: ports/espressif/common-hal/countio/Counter.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c -msgid "All PCNT units in use" -msgstr "" - #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -531,10 +525,6 @@ 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/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/neopixel_write/__init__.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c @@ -737,7 +727,7 @@ msgstr "" #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c -#: shared-bindings/uvc/__init__.c +#: shared-bindings/usb_video/__init__.c msgid "Cannot change USB devices now" msgstr "" @@ -829,10 +819,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: ports/espressif/common-hal/neopixel_write/__init__.c -msgid "Could not retrieve clock" -msgstr "" - #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" msgstr "" @@ -1136,7 +1122,7 @@ msgstr "" msgid "Input taking too long" msgstr "" -#: ports/espressif/common-hal/neopixel_write/__init__.c py/moderrno.c +#: py/moderrno.c msgid "Input/output error" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 821bfa98ddeb..541fca28d240 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -480,12 +480,6 @@ msgstr "Tutte le periferiche CAN sono in uso" msgid "All I2C peripherals are in use" msgstr "Tutte le periferiche I2C sono in uso" -#: ports/espressif/common-hal/countio/Counter.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c -msgid "All PCNT units in use" -msgstr "Tutte le unità PCNT sono in uso" - #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -534,10 +528,6 @@ 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/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/neopixel_write/__init__.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c @@ -742,7 +732,7 @@ msgstr "" #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c -#: shared-bindings/uvc/__init__.c +#: shared-bindings/usb_video/__init__.c msgid "Cannot change USB devices now" msgstr "" @@ -835,10 +825,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: ports/espressif/common-hal/neopixel_write/__init__.c -msgid "Could not retrieve clock" -msgstr "" - #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" msgstr "" @@ -1144,7 +1130,7 @@ msgstr "" msgid "Input taking too long" msgstr "" -#: ports/espressif/common-hal/neopixel_write/__init__.c py/moderrno.c +#: py/moderrno.c msgid "Input/output error" msgstr "Errore input/output" @@ -4376,6 +4362,9 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "All PCNT units in use" +#~ msgstr "Tutte le unità PCNT sono in uso" + #~ msgid "EXTINT channel already in use" #~ msgstr "Canale EXTINT già in uso" diff --git a/locale/ja.po b/locale/ja.po index dbe3b89933e2..e17e3809e8ae 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -491,12 +491,6 @@ msgstr "全てのCAN周辺機器が使用中" msgid "All I2C peripherals are in use" msgstr "全てのI2C周辺機器が使用中" -#: ports/espressif/common-hal/countio/Counter.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c -msgid "All PCNT units in use" -msgstr "" - #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -544,10 +538,6 @@ 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/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/neopixel_write/__init__.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c @@ -754,7 +744,7 @@ msgstr "ローカルのCharacteristicにはCCCDを設定できません" #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c -#: shared-bindings/uvc/__init__.c +#: shared-bindings/usb_video/__init__.c msgid "Cannot change USB devices now" msgstr "" @@ -846,10 +836,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: ports/espressif/common-hal/neopixel_write/__init__.c -msgid "Could not retrieve clock" -msgstr "" - #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" msgstr "アドレスをセットできません" @@ -1153,7 +1139,7 @@ msgstr "" msgid "Input taking too long" msgstr "" -#: ports/espressif/common-hal/neopixel_write/__init__.c py/moderrno.c +#: py/moderrno.c msgid "Input/output error" msgstr "入力/出力エラー" diff --git a/locale/ko.po b/locale/ko.po index f619d1171af3..c959aa32ce9c 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -509,13 +509,6 @@ msgstr "모든 CAN 주변 기기가 사용 중입니다" msgid "All I2C peripherals are in use" msgstr "사용 중인 모든 I2C주변 기기" -#: ports/espressif/common-hal/countio/Counter.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c -#, fuzzy -msgid "All PCNT units in use" -msgstr "모든 PCNT 장치가 사용 중입니다" - #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -567,10 +560,6 @@ 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/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/neopixel_write/__init__.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c @@ -781,7 +770,7 @@ msgstr "로컬 특성에 CCCD를 설정할 수 없습니다" #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c -#: shared-bindings/uvc/__init__.c +#: shared-bindings/usb_video/__init__.c msgid "Cannot change USB devices now" msgstr "현재 USB 디바이스를 변경할 수 없습니다" @@ -875,10 +864,6 @@ msgstr "좌표 배열의 길이가 다릅니다" msgid "Coordinate arrays types have different sizes" msgstr "좌표 배열 유형은 크기가 다릅니다" -#: ports/espressif/common-hal/neopixel_write/__init__.c -msgid "Could not retrieve clock" -msgstr "시계를 불러올 수 없습니다" - #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" msgstr "주소를 설정할 수 없습니다" @@ -1189,7 +1174,7 @@ msgstr "입력 버퍼 길이 (%d) 는 스트랜드 수 (%d)의 배수여야 한 msgid "Input taking too long" msgstr "입력이 너무 오래 걸린다" -#: ports/espressif/common-hal/neopixel_write/__init__.c py/moderrno.c +#: py/moderrno.c msgid "Input/output error" msgstr "입력/출력 오류" @@ -4423,6 +4408,13 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#, fuzzy +#~ msgid "All PCNT units in use" +#~ msgstr "모든 PCNT 장치가 사용 중입니다" + +#~ msgid "Could not retrieve clock" +#~ msgstr "시계를 불러올 수 없습니다" + #~ msgid "Cannot reset into bootloader because no bootloader is present" #~ msgstr "부트로더가 없기 때문에 부트로더로 재시작할 수 없습니다" diff --git a/locale/nl.po b/locale/nl.po index 15d1997e5e6c..4f9d06a188b0 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -476,12 +476,6 @@ msgstr "Alle CAN-peripherals zijn in gebruik" msgid "All I2C peripherals are in use" msgstr "Alle I2C peripherals zijn in gebruik" -#: ports/espressif/common-hal/countio/Counter.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c -msgid "All PCNT units in use" -msgstr "Alle PCNT-eenheden zijn in gebruik" - #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -529,10 +523,6 @@ 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/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/neopixel_write/__init__.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c @@ -737,7 +727,7 @@ msgstr "Kan CCCD niet toewijzen aan lokaal Characteristic" #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c -#: shared-bindings/uvc/__init__.c +#: shared-bindings/usb_video/__init__.c msgid "Cannot change USB devices now" msgstr "" @@ -832,10 +822,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: ports/espressif/common-hal/neopixel_write/__init__.c -msgid "Could not retrieve clock" -msgstr "Kon klok niet ophalen" - #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" msgstr "Kan adres niet zetten" @@ -1139,7 +1125,7 @@ msgstr "" msgid "Input taking too long" msgstr "Invoer duurt te lang" -#: ports/espressif/common-hal/neopixel_write/__init__.c py/moderrno.c +#: py/moderrno.c msgid "Input/output error" msgstr "Input/Output fout" @@ -4368,6 +4354,12 @@ 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 "All PCNT units in use" +#~ msgstr "Alle PCNT-eenheden zijn in gebruik" + +#~ msgid "Could not retrieve clock" +#~ msgstr "Kon klok niet ophalen" + #~ 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" diff --git a/locale/pl.po b/locale/pl.po index 5fabc3edf468..c26c60877985 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -484,12 +484,6 @@ msgstr "" msgid "All I2C peripherals are in use" msgstr "Wszystkie peryferia I2C w użyciu" -#: ports/espressif/common-hal/countio/Counter.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c -msgid "All PCNT units in use" -msgstr "" - #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -537,10 +531,6 @@ 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/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/neopixel_write/__init__.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c @@ -747,7 +737,7 @@ msgstr "Nie można ustawić CCCD na charakterystykę lokalną" #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c -#: shared-bindings/uvc/__init__.c +#: shared-bindings/usb_video/__init__.c msgid "Cannot change USB devices now" msgstr "Zmiana urządzenia USB nie jest w tym momencie możliwa" @@ -843,10 +833,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: ports/espressif/common-hal/neopixel_write/__init__.c -msgid "Could not retrieve clock" -msgstr "Odczytanie zegara nie powiodło się" - #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" msgstr "Nie można ustawić adresu" @@ -1158,7 +1144,7 @@ msgstr "" msgid "Input taking too long" msgstr "" -#: ports/espressif/common-hal/neopixel_write/__init__.c py/moderrno.c +#: py/moderrno.c msgid "Input/output error" msgstr "Błąd I/O" @@ -4376,6 +4362,9 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Could not retrieve clock" +#~ msgstr "Odczytanie zegara nie powiodło się" + #~ 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" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 743bb6be83d2..6d9f9bb493b0 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -491,12 +491,6 @@ 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/espressif/common-hal/countio/Counter.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c -msgid "All PCNT units in use" -msgstr "Todas as unidades PCNT estão em uso" - #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -544,10 +538,6 @@ 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/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/neopixel_write/__init__.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c @@ -755,7 +745,7 @@ msgstr "Não é possível definir o CCCD com a característica local" #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c -#: shared-bindings/uvc/__init__.c +#: shared-bindings/usb_video/__init__.c msgid "Cannot change USB devices now" msgstr "Agora não é possível alternar os dispositivos USB" @@ -850,10 +840,6 @@ msgstr "As coordenadas das matrizes possuem comprimentos diferentes" msgid "Coordinate arrays types have different sizes" msgstr "Os tipos das coordenadas das matrizes possuem tamanhos diferentes" -#: ports/espressif/common-hal/neopixel_write/__init__.c -msgid "Could not retrieve clock" -msgstr "Não foi possível recuperar o clock" - #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" msgstr "Não foi possível definir o endereço" @@ -1169,7 +1155,7 @@ msgstr "" msgid "Input taking too long" msgstr "A entrada está demorando demais" -#: ports/espressif/common-hal/neopixel_write/__init__.c py/moderrno.c +#: py/moderrno.c msgid "Input/output error" msgstr "Erro de entrada/saída" @@ -4355,8 +4341,8 @@ msgid "" "weights must be a sequence with an odd square number of elements (usually 9 " "or 25)" msgstr "" -"os pesos devem ser uma sequência com um número quadrado ímpar de elementos (" -"geralmente 9 ou 25)" +"os pesos devem ser uma sequência com um número quadrado ímpar de elementos " +"(geralmente 9 ou 25)" #: shared-bindings/bitmapfilter/__init__.c msgid "weights must be an object of type %q, %q, %q, or %q, not %q " @@ -4433,6 +4419,12 @@ 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 "All PCNT units in use" +#~ msgstr "Todas as unidades PCNT estão em uso" + +#~ msgid "Could not retrieve clock" +#~ msgstr "Não foi possível recuperar o clock" + #~ msgid "Cannot reset into bootloader because no bootloader is present" #~ msgstr "" #~ "Não é possível redefinir no bootloader pois nenhum bootloader está " diff --git a/locale/ru.po b/locale/ru.po index e8e1349d1bbf..02e760c98213 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -495,12 +495,6 @@ msgstr "Все периферийные устройства CAN уже испо msgid "All I2C peripherals are in use" msgstr "Все периферийные устройства I2C уже используются" -#: ports/espressif/common-hal/countio/Counter.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c -msgid "All PCNT units in use" -msgstr "Все блоки PCNT уже используются" - #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -548,10 +542,6 @@ 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/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/neopixel_write/__init__.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c @@ -760,7 +750,7 @@ msgstr "Невозможно установить CCCD для локальной #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c -#: shared-bindings/uvc/__init__.c +#: shared-bindings/usb_video/__init__.c msgid "Cannot change USB devices now" msgstr "Невозможно изменить USB устройство сейчас" @@ -857,10 +847,6 @@ msgstr "Координатные массивы имеют разные длин msgid "Coordinate arrays types have different sizes" msgstr "Типы массивов координат имеют разные размеры" -#: ports/espressif/common-hal/neopixel_write/__init__.c -msgid "Could not retrieve clock" -msgstr "Не удалось извлечь тактирование" - #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" msgstr "Не удалось задать адрес" @@ -1180,7 +1166,7 @@ msgstr "Длина входного буфера (%d) должна быть кр msgid "Input taking too long" msgstr "Ввод занимает слишком много времени" -#: ports/espressif/common-hal/neopixel_write/__init__.c py/moderrno.c +#: py/moderrno.c msgid "Input/output error" msgstr "Ошибка ввода/вывода" @@ -4463,6 +4449,12 @@ msgstr "zi должно быть типа float" msgid "zi must be of shape (n_section, 2)" msgstr "zi должен иметь форму (n_section, 2)" +#~ msgid "All PCNT units in use" +#~ msgstr "Все блоки PCNT уже используются" + +#~ msgid "Could not retrieve clock" +#~ msgstr "Не удалось извлечь тактирование" + #~ msgid "Cannot reset into bootloader because no bootloader is present" #~ msgstr "Не удалось перезагрузится в загрузчик так как загрузчик отсутствует" diff --git a/locale/sv.po b/locale/sv.po index b37bb86ba5e2..25b563a1d41a 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -490,12 +490,6 @@ msgstr "All CAN-kringutrustning används" msgid "All I2C peripherals are in use" msgstr "All I2C-kringutrustning används" -#: ports/espressif/common-hal/countio/Counter.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c -msgid "All PCNT units in use" -msgstr "Alla PCNT-enheter används" - #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -543,10 +537,6 @@ 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/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/neopixel_write/__init__.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c @@ -752,7 +742,7 @@ msgstr "Kan inte ställa in CCCD på lokal karaktäristik" #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c -#: shared-bindings/uvc/__init__.c +#: shared-bindings/usb_video/__init__.c msgid "Cannot change USB devices now" msgstr "Kan inte ändra USB-enheter nu" @@ -847,10 +837,6 @@ msgstr "Arrayer för koordinater har olika längd" msgid "Coordinate arrays types have different sizes" msgstr "Arrayer för koordinater har olika storlek" -#: ports/espressif/common-hal/neopixel_write/__init__.c -msgid "Could not retrieve clock" -msgstr "Kunde inte hämta klocka" - #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" msgstr "Kan inte ange adress" @@ -1161,7 +1147,7 @@ msgstr "indatabuffertlängd (%d) måste vara en multipel av antal strand (%d)" msgid "Input taking too long" msgstr "Indata tar för lång tid" -#: ports/espressif/common-hal/neopixel_write/__init__.c py/moderrno.c +#: py/moderrno.c msgid "Input/output error" msgstr "Indata-/utdatafel" @@ -4395,6 +4381,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 "All PCNT units in use" +#~ msgstr "Alla PCNT-enheter används" + +#~ msgid "Could not retrieve clock" +#~ msgstr "Kunde inte hämta klocka" + #~ msgid "Cannot reset into bootloader because no bootloader is present" #~ msgstr "Kan inte återställa till bootloader eftersom ingen bootloader finns" diff --git a/locale/tr.po b/locale/tr.po index adb070c28a21..18330ad76bba 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -484,12 +484,6 @@ msgstr "Tüm CAN çevre birimleri kullanımda" msgid "All I2C peripherals are in use" msgstr "Tüm I2C çevre birimleri kullanımda" -#: ports/espressif/common-hal/countio/Counter.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c -msgid "All PCNT units in use" -msgstr "Tüm PCNT birimleri kullanımda" - #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -537,10 +531,6 @@ msgstr "Bu pin için tüm zamanlayıcılar kullanımda" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/neopixel_write/__init__.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c @@ -745,7 +735,7 @@ msgstr "" #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c -#: shared-bindings/uvc/__init__.c +#: shared-bindings/usb_video/__init__.c msgid "Cannot change USB devices now" msgstr "USB aygıtları şu an değiştirilemez" @@ -838,10 +828,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: ports/espressif/common-hal/neopixel_write/__init__.c -msgid "Could not retrieve clock" -msgstr "" - #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" msgstr "Adres ayarlanamadı" @@ -1149,7 +1135,7 @@ msgstr "Giriş buffer uzunluğu (%d) strand sayımının (%d) katı olmalıdır" msgid "Input taking too long" msgstr "Giriş çok uzun sürüyor" -#: ports/espressif/common-hal/neopixel_write/__init__.c py/moderrno.c +#: py/moderrno.c msgid "Input/output error" msgstr "Giriş/çıkış hatası" @@ -4361,6 +4347,9 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "All PCNT units in use" +#~ msgstr "Tüm PCNT birimleri kullanımda" + #~ msgid "Cannot reset into bootloader because no bootloader is present" #~ msgstr "Hiçbir bootloader bulunmadığından bootloader sıfırlanamıyor" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index be3df4237707..246b146c8df2 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -491,12 +491,6 @@ msgstr "suǒyǒu CAN wàishè dōu zài shǐyòng zhōng" msgid "All I2C peripherals are in use" msgstr "suǒyǒu I2C wàishè dōu zài shǐyòng zhōng" -#: ports/espressif/common-hal/countio/Counter.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c -msgid "All PCNT units in use" -msgstr "suǒyǒu PCNT dānyuán dōu zài shǐyòng zhōng" - #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -544,10 +538,6 @@ msgstr "cǐ yǐnjiǎo de suǒyǒu jìshíqì dōu zài shǐyòng zhō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/espressif/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/neopixel_write/__init__.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c @@ -755,7 +745,7 @@ msgstr "Wúfǎ jiāng CCCD shèzhì wéi běndì tèzhēng" #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c -#: shared-bindings/uvc/__init__.c +#: shared-bindings/usb_video/__init__.c msgid "Cannot change USB devices now" msgstr "xiànzài wúfǎ gēnggǎi USB shèbèi" @@ -847,10 +837,6 @@ msgstr "zuòbiāo shùzǔ jùyǒu bùtóng de chángdù" msgid "Coordinate arrays types have different sizes" msgstr "zuòbiāo shùzǔ lèixíng jùyǒu bùtóng de dàxiǎo" -#: ports/espressif/common-hal/neopixel_write/__init__.c -msgid "Could not retrieve clock" -msgstr "wúfǎ jiǎnsuǒ shízhōng" - #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" msgstr "wúfǎ shèzhì dìzhǐ" @@ -1167,7 +1153,7 @@ msgstr "" msgid "Input taking too long" msgstr "Shūrù shíjiānguò zhǎng" -#: ports/espressif/common-hal/neopixel_write/__init__.c py/moderrno.c +#: py/moderrno.c msgid "Input/output error" msgstr "Shūrù/shūchū cuòwù" @@ -4404,6 +4390,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 "All PCNT units in use" +#~ msgstr "suǒyǒu PCNT dānyuán dōu zài shǐyòng zhōng" + +#~ msgid "Could not retrieve clock" +#~ msgstr "wúfǎ jiǎnsuǒ shízhōng" + #~ msgid "Cannot reset into bootloader because no bootloader is present" #~ msgstr "" #~ "wúfǎ chóngxīn qǐdòng dào yǐdǎo chéngxù, yīnwéi yǐdǎo chéngxù bù cúnzài" diff --git a/main.c b/main.c index 584a076d3d14..0305922cd1ea 100644 --- a/main.c +++ b/main.c @@ -92,6 +92,7 @@ #if CIRCUITPY_DISPLAYIO #include "shared-module/displayio/__init__.h" +#include "shared-bindings/displayio/__init__.h" #endif #if CIRCUITPY_EPAPERDISPLAY diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index f71128735a29..eaa8e0eec90a 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -79,10 +79,13 @@ INC += \ -isystem esp-idf/components/driver/deprecated \ -isystem esp-idf/components/driver/dac/include \ -isystem esp-idf/components/driver/gpio/include \ + -isystem esp-idf/components/driver/gptimer/include \ -isystem esp-idf/components/driver/i2c/include \ -isystem esp-idf/components/driver/i2s/include \ -isystem esp-idf/components/driver/$(IDF_TARGET)/include \ -isystem esp-idf/components/driver/ledc/include \ + -isystem esp-idf/components/driver/pcnt/include \ + -isystem esp-idf/components/driver/rmt/include \ -isystem esp-idf/components/driver/spi/include \ -isystem esp-idf/components/driver/temperature_sensor/include \ -isystem esp-idf/components/driver/touch_sensor/include \ @@ -280,8 +283,6 @@ SRC_C += \ boards/$(BOARD)/pins.c \ shared/netutils/netutils.c \ peripherals/i2c.c \ - peripherals/rmt.c \ - peripherals/timer.c \ peripherals/$(IDF_TARGET)/pins.c SRC_C += $(wildcard common-hal/espidf/*.c) @@ -290,10 +291,6 @@ ifneq ($(CIRCUITPY_ESP_USB_SERIAL_JTAG),0) SRC_C += supervisor/usb_serial_jtag.c endif -ifneq ($(CIRCUITPY_COUNTIO),0) -SRC_C += peripherals/pcnt.c -endif - ifneq ($(CIRCUITPY_TOUCHIO_USE_NATIVE),0) SRC_C += peripherals/touch.c endif diff --git a/ports/espressif/background.c b/ports/espressif/background.c index f9069e98a488..ad8708165cf1 100644 --- a/ports/espressif/background.c +++ b/ports/espressif/background.c @@ -32,20 +32,9 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" -#if CIRCUITPY_DISPLAYIO -#include "shared-module/displayio/__init__.h" -#endif - -#if CIRCUITPY_PULSEIO -#include "common-hal/pulseio/PulseIn.h" -#endif - void port_background_tick(void) { // Zero delay in case FreeRTOS wants to switch to something else. vTaskDelay(0); - #if CIRCUITPY_PULSEIO - pulsein_background(); - #endif } void port_background_task(void) { diff --git a/ports/espressif/bindings/espnow/ESPNow.c b/ports/espressif/bindings/espnow/ESPNow.c index 402eb57e7e94..833dd80ca87a 100644 --- a/ports/espressif/bindings/espnow/ESPNow.c +++ b/ports/espressif/bindings/espnow/ESPNow.c @@ -340,6 +340,7 @@ STATIC const mp_stream_p_t espnow_stream_p = { //| This is an easy way to check if the buffer is empty. //| """ //| ... +//| //| def __len__(self) -> int: //| """Return the number of `bytes` available to read. Used to implement ``len()``.""" //| ... diff --git a/ports/espressif/boards/deneyap_kart_1a_v2/mpconfigboard.mk b/ports/espressif/boards/deneyap_kart_1a_v2/mpconfigboard.mk index ab5766e56f0a..e63254971c79 100644 --- a/ports/espressif/boards/deneyap_kart_1a_v2/mpconfigboard.mk +++ b/ports/espressif/boards/deneyap_kart_1a_v2/mpconfigboard.mk @@ -16,6 +16,8 @@ CIRCUITPY_ESP_PSRAM_FREQ = 80m CIRCUITPY_ESPCAMERA = 0 CIRCUITPY_BITMAPFILTER = 0 +CIRCUITPY_BLEIO = 0 +CIRCUITPY_CODEOP=0 CIRCUITPY_PARALLELDISPLAYBUS = 0 OPTIMIZATION_FLAGS = -Os diff --git a/ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk b/ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk index 30a122d62c18..0d6eb014d5fa 100644 --- a/ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk +++ b/ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk @@ -16,6 +16,7 @@ CIRCUITPY_ESP_PSRAM_FREQ = 80m OPTIMIZATION_FLAGS = -Os CIRCUITPY_ESPCAMERA = 0 CIRCUITPY_BITMAPFILTER = 0 +CIRCUITPY_BLEIO = 0 CIRCUITPY_CODEOP=0 CIRCUITPY_PARALLELDISPLAYBUS = 0 diff --git a/ports/espressif/boards/waveshare_esp32_s3_zero/mpconfigboard.mk b/ports/espressif/boards/waveshare_esp32_s3_zero/mpconfigboard.mk index b661b9137812..87c62c68b1c0 100644 --- a/ports/espressif/boards/waveshare_esp32_s3_zero/mpconfigboard.mk +++ b/ports/espressif/boards/waveshare_esp32_s3_zero/mpconfigboard.mk @@ -16,6 +16,8 @@ CIRCUITPY_ESP_PSRAM_FREQ = 80m OPTIMIZATION_FLAGS = -Os CIRCUITPY_ESPCAMERA = 0 CIRCUITPY_BITMAPFILTER = 0 +CIRCUITPY_BLEIO = 0 +CIRCUITPY_CODEOP=0 CIRCUITPY_PARALLELDISPLAYBUS = 0 # Include these Python libraries in firmware. diff --git a/ports/espressif/cam.c b/ports/espressif/cam.c deleted file mode 100644 index ea50785cd95f..000000000000 --- a/ports/espressif/cam.c +++ /dev/null @@ -1,507 +0,0 @@ -// Copyright 2019 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include "freertos/FreeRTOS.h" -#include "freertos/task.h" -#include "driver/i2s.h" -#include "esp_system.h" -#include "esp_log.h" -#include "soc/i2s_struct.h" -#include "soc/apb_ctrl_reg.h" -#ifdef CONFIG_IDF_TARGET_ESP32S2 -#include "esp32s2/rom/lldesc.h" -#include "esp32s2/rom/cache.h" -#elif defined(CONFIG_IDF_TARGET_ESP32S3) -#include "esp32s3/rom/lldesc.h" -#include "esp32s3/rom/cache.h" -#endif -#include "soc/dport_access.h" -#include "soc/dport_reg.h" -#include "driver/ledc.h" -#include "cam.h" -#include "hal/gpio_ll.h" - -static const char *TAG = "cam"; - -#define CAM_DMA_MAX_SIZE (4095) - -typedef enum { - CAM_IN_SUC_EOF_EVENT = 0, - CAM_VSYNC_EVENT -} cam_event_t; - -typedef struct { - uint8_t *frame_buffer; - size_t len; -} frame_buffer_event_t; - -typedef struct { - uint32_t buffer_size; - uint32_t half_buffer_size; - uint32_t node_cnt; - uint32_t half_node_cnt; - uint32_t dma_size; - uint32_t cnt; - uint32_t total_cnt; - lldesc_t *dma; - uint8_t *buffer; - uint8_t *frame1_buffer; - uint8_t *frame2_buffer; - uint8_t frame1_buffer_en; - uint8_t frame2_buffer_en; - uint8_t jpeg_mode; - uint8_t vsync_pin; - uint8_t vsync_invert; - uint8_t hsync_invert; - QueueHandle_t event_queue; - QueueHandle_t frame_buffer_queue; - TaskHandle_t task_handle; - intr_handle_t intr_handle; -} cam_obj_t; - -static cam_obj_t *cam_obj = NULL; - -static void IRAM_ATTR cam_isr(void *arg) { - cam_event_t cam_event = {0}; - BaseType_t HPTaskAwoken = pdFALSE; - typeof(I2S0.int_st) int_st = I2S0.int_st; - I2S0.int_clr.val = int_st.val; - - if (int_st.in_suc_eof) { - cam_event = CAM_IN_SUC_EOF_EVENT; - xQueueSendFromISR(cam_obj->event_queue, (void *)&cam_event, &HPTaskAwoken); - } - - if (HPTaskAwoken == pdTRUE) { - portYIELD_FROM_ISR(); - } -} - -static void IRAM_ATTR cam_vsync_isr(void *arg) { - cam_event_t cam_event = {0}; - BaseType_t HPTaskAwoken = pdFALSE; - /*!< filter */ - ets_delay_us(1); - - if (gpio_ll_get_level(&GPIO, cam_obj->vsync_pin) == !cam_obj->vsync_invert) { - cam_event = CAM_VSYNC_EVENT; - xQueueSendFromISR(cam_obj->event_queue, (void *)&cam_event, &HPTaskAwoken); - } - - if (HPTaskAwoken == pdTRUE) { - portYIELD_FROM_ISR(); - } -} - -static void cam_config(const cam_config_t *config) { - /*!bit_width; - - /*!< Configuration data format */ - I2S0.conf.val = 0; - I2S0.conf.tx_right_first = 1; - I2S0.conf.tx_msb_right = 1; - I2S0.conf.tx_dma_equal = 1; - I2S0.conf.rx_right_first = 1; - I2S0.conf.rx_msb_right = 1; - I2S0.conf.rx_dma_equal = 1; - - I2S0.conf1.val = 0; - I2S0.conf1.tx_pcm_bypass = 1; - I2S0.conf1.tx_stop_en = 1; - I2S0.conf1.rx_pcm_bypass = 1; - - I2S0.conf2.val = 0; - I2S0.conf2.cam_sync_fifo_reset = 1; - I2S0.conf2.cam_sync_fifo_reset = 0; - I2S0.conf2.lcd_en = 1; - I2S0.conf2.camera_en = 1; - I2S0.conf2.i_v_sync_filter_en = 1; - I2S0.conf2.i_v_sync_filter_thres = 1; - - I2S0.conf_chan.val = 0; - I2S0.conf_chan.tx_chan_mod = 1; - I2S0.conf_chan.rx_chan_mod = 1; - - I2S0.fifo_conf.val = 0; - I2S0.fifo_conf.rx_fifo_mod_force_en = 1; - I2S0.fifo_conf.rx_data_num = 32; - I2S0.fifo_conf.rx_fifo_mod = 2; - I2S0.fifo_conf.tx_fifo_mod_force_en = 1; - I2S0.fifo_conf.tx_data_num = 32; - I2S0.fifo_conf.tx_fifo_mod = 2; - I2S0.fifo_conf.dscr_en = 1; - - I2S0.lc_conf.out_rst = 1; - I2S0.lc_conf.out_rst = 0; - I2S0.lc_conf.in_rst = 1; - I2S0.lc_conf.in_rst = 0; - - I2S0.timing.val = 0; - - I2S0.int_ena.val = 0; - I2S0.int_clr.val = ~0; - - I2S0.lc_conf.check_owner = 0; - I2S0.conf.rx_start = 1; -} - -static void cam_set_pin(const cam_config_t *config) { - gpio_config_t io_conf = {0}; - io_conf.intr_type = config->vsync_invert ? GPIO_PIN_INTR_NEGEDGE : GPIO_PIN_INTR_POSEDGE; - io_conf.pin_bit_mask = 1 << config->pin.vsync; - io_conf.mode = GPIO_MODE_INPUT; - io_conf.pull_up_en = 1; - io_conf.pull_down_en = 0; - gpio_config(&io_conf); - gpio_install_isr_service(0); - gpio_isr_handler_add(config->pin.vsync, cam_vsync_isr, NULL); - gpio_intr_disable(config->pin.vsync); - - PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[config->pin.pclk], PIN_FUNC_GPIO); - gpio_set_direction(config->pin.pclk, GPIO_MODE_INPUT); - gpio_set_pull_mode(config->pin.pclk, GPIO_FLOATING); - gpio_matrix_in(config->pin.pclk, I2S0I_WS_IN_IDX, false); - - PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[config->pin.vsync], PIN_FUNC_GPIO); - gpio_set_direction(config->pin.vsync, GPIO_MODE_INPUT); - gpio_set_pull_mode(config->pin.vsync, GPIO_FLOATING); - gpio_matrix_in(config->pin.vsync, I2S0I_V_SYNC_IDX, config->vsync_invert); - - PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[config->pin.hsync], PIN_FUNC_GPIO); - gpio_set_direction(config->pin.hsync, GPIO_MODE_INPUT); - gpio_set_pull_mode(config->pin.hsync, GPIO_FLOATING); - gpio_matrix_in(config->pin.hsync, I2S0I_H_SYNC_IDX, config->hsync_invert); - - for (int i = 0; i < config->bit_width; i++) { - PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[config->pin_data[i]], PIN_FUNC_GPIO); - gpio_set_direction(config->pin_data[i], GPIO_MODE_INPUT); - gpio_set_pull_mode(config->pin_data[i], GPIO_FLOATING); - /*!< High position alignment, IN16 is always the highest bit */ - /*!< Fifo accesses data by bit, and when rx_bits_mod is 8, the data needs to be aligned by 8 bits */ - gpio_matrix_in(config->pin_data[i], I2S0I_DATA_IN0_IDX + (16 - config->bit_width) + i, false); - } - - gpio_matrix_in(GPIO_FUNC_IN_HIGH, I2S0I_H_ENABLE_IDX, false); - ESP_LOGI(TAG, "cam_set_pin\n"); -} - -static void cam_vsync_intr_enable(uint8_t en) { - if (en) { - gpio_intr_enable(cam_obj->vsync_pin); - } else { - gpio_intr_disable(cam_obj->vsync_pin); - } -} - -static void cam_dma_stop(void) { - if (I2S0.int_ena.in_suc_eof == 1) { - I2S0.conf.rx_start = 0; - I2S0.int_ena.in_suc_eof = 0; - I2S0.int_clr.in_suc_eof = 1; - I2S0.in_link.stop = 1; - } -} - -static void cam_dma_start(void) { - if (I2S0.int_ena.in_suc_eof == 0) { - I2S0.int_clr.in_suc_eof = 1; - I2S0.int_ena.in_suc_eof = 1; - I2S0.conf.rx_reset = 1; - I2S0.conf.rx_reset = 0; - I2S0.conf.rx_fifo_reset = 1; - I2S0.conf.rx_fifo_reset = 0; - I2S0.lc_conf.in_rst = 1; - I2S0.lc_conf.in_rst = 0; - I2S0.lc_conf.ahbm_fifo_rst = 1; - I2S0.lc_conf.ahbm_fifo_rst = 0; - I2S0.lc_conf.ahbm_rst = 1; - I2S0.lc_conf.ahbm_rst = 0; - I2S0.in_link.start = 1; - I2S0.conf.rx_start = 1; - - if (cam_obj->jpeg_mode) { - /*!< Manually give the vsync data for the first frame */ - gpio_matrix_in(cam_obj->vsync_pin, I2S0I_V_SYNC_IDX, !cam_obj->vsync_invert); - gpio_matrix_in(cam_obj->vsync_pin, I2S0I_V_SYNC_IDX, cam_obj->vsync_invert); - } - } -} - -void cam_stop(void) { - cam_vsync_intr_enable(0); - cam_dma_stop(); -} - -void cam_start(void) { - cam_vsync_intr_enable(1); -} - -typedef enum { - CAM_STATE_IDLE = 0, - CAM_STATE_READ_BUF1 = 1, - CAM_STATE_READ_BUF2 = 2, -} cam_state_t; - -/*!event_queue); - - while (1) { - xQueueReceive(cam_obj->event_queue, (void *)&cam_event, portMAX_DELAY); - - switch (state) { - case CAM_STATE_IDLE: { - if (cam_event == CAM_VSYNC_EVENT) { - if (cam_obj->frame1_buffer_en) { - cam_dma_start(); - cam_vsync_intr_enable(0); - state = CAM_STATE_READ_BUF1; - } else if (cam_obj->frame2_buffer_en) { - cam_dma_start(); - cam_vsync_intr_enable(0); - state = CAM_STATE_READ_BUF2; - } - - cam_obj->cnt = 0; - } - } - break; - - case CAM_STATE_READ_BUF1: { - if (cam_event == CAM_IN_SUC_EOF_EVENT) { - if (cam_obj->cnt == 0) { - cam_vsync_intr_enable(1); /*!< CAM real start is required to receive the first buf data and then turn on the vsync interrupt */ - } - - memcpy(&cam_obj->frame1_buffer[cam_obj->cnt * cam_obj->half_buffer_size], &cam_obj->buffer[(cam_obj->cnt % 2) * cam_obj->half_buffer_size], cam_obj->half_buffer_size); - - if (cam_obj->jpeg_mode) { - if (cam_obj->frame1_buffer_en == 0) { - cam_dma_stop(); - } - } else { - if (cam_obj->cnt == cam_obj->total_cnt - 1) { - cam_obj->frame1_buffer_en = 0; - } - } - - if (cam_obj->frame1_buffer_en == 0) { - frame_buffer_event.frame_buffer = cam_obj->frame1_buffer; - frame_buffer_event.len = (cam_obj->cnt + 1) * cam_obj->half_buffer_size; - xQueueSend(cam_obj->frame_buffer_queue, (void *)&frame_buffer_event, portMAX_DELAY); - state = CAM_STATE_IDLE; - } else { - cam_obj->cnt++; - } - } else if (cam_event == CAM_VSYNC_EVENT) { - if (cam_obj->jpeg_mode) { - cam_obj->frame1_buffer_en = 0; - } - } - } - break; - - case CAM_STATE_READ_BUF2: { - if (cam_event == CAM_IN_SUC_EOF_EVENT) { - if (cam_obj->cnt == 0) { - cam_vsync_intr_enable(1); /*!< CAM real start is required to receive the first buf data and then turn on the vsync interrupt */ - } - - memcpy(&cam_obj->frame2_buffer[cam_obj->cnt * cam_obj->half_buffer_size], &cam_obj->buffer[(cam_obj->cnt % 2) * cam_obj->half_buffer_size], cam_obj->half_buffer_size); - - if (cam_obj->jpeg_mode) { - if (cam_obj->frame2_buffer_en == 0) { - cam_dma_stop(); - } - } else { - if (cam_obj->cnt == cam_obj->total_cnt - 1) { - cam_obj->frame2_buffer_en = 0; - } - } - - if (cam_obj->frame2_buffer_en == 0) { - frame_buffer_event.frame_buffer = cam_obj->frame2_buffer; - frame_buffer_event.len = (cam_obj->cnt + 1) * cam_obj->half_buffer_size; - xQueueSend(cam_obj->frame_buffer_queue, (void *)&frame_buffer_event, portMAX_DELAY); - state = CAM_STATE_IDLE; - } else { - cam_obj->cnt++; - } - } else if (cam_event == CAM_VSYNC_EVENT) { - if (cam_obj->jpeg_mode) { - cam_obj->frame2_buffer_en = 0; - } - } - } - break; - } - } -} - -size_t cam_take(uint8_t **buffer_p) { - frame_buffer_event_t frame_buffer_event; - xQueueReceive(cam_obj->frame_buffer_queue, (void *)&frame_buffer_event, portMAX_DELAY); - *buffer_p = frame_buffer_event.frame_buffer; - return frame_buffer_event.len; -} - -bool cam_ready(void) { - frame_buffer_event_t frame_buffer_event; - BaseType_t result = xQueuePeek(cam_obj->frame_buffer_queue, (void *)&frame_buffer_event, 0); - return result != pdFALSE; -} - - -void cam_give(uint8_t *buffer) { - if (buffer == cam_obj->frame1_buffer) { - cam_obj->frame1_buffer_en = 1; - } else if (buffer == cam_obj->frame2_buffer) { - cam_obj->frame2_buffer_en = 1; - } -} - -static void cam_dma_config(const cam_config_t *config) { - int cnt = 0; - - if (config->mode.jpeg) { - cam_obj->buffer_size = 2048; - cam_obj->half_buffer_size = cam_obj->buffer_size / 2; - cam_obj->dma_size = 1024; - } else { - for (cnt = 0;; cnt++) { /*!< Find the divisible buffer size */ - if ((config->size * 2) % (config->max_buffer_size - cnt) == 0) { - break; - } - } - - cam_obj->buffer_size = config->max_buffer_size - cnt; - - cam_obj->half_buffer_size = cam_obj->buffer_size / 2; - - for (cnt = 0;; cnt++) { /*!< Look for divisible dma sizes */ - if ((cam_obj->half_buffer_size) % (CAM_DMA_MAX_SIZE - cnt) == 0) { - break; - } - } - - cam_obj->dma_size = CAM_DMA_MAX_SIZE - cnt; - } - - cam_obj->node_cnt = (cam_obj->buffer_size) / cam_obj->dma_size; /*!< Number of DMA nodes */ - cam_obj->half_node_cnt = cam_obj->node_cnt / 2; - cam_obj->total_cnt = (config->size * 2) / cam_obj->half_buffer_size; /*!< Number of interrupt copies produced. Ping pong copies */ - - ESP_LOGI(TAG, "cam_buffer_size: %d, cam_dma_size: %d, cam_dma_node_cnt: %d, cam_total_cnt: %d\n", cam_obj->buffer_size, cam_obj->dma_size, cam_obj->node_cnt, cam_obj->total_cnt); - - cam_obj->dma = (lldesc_t *)heap_caps_realloc(cam_obj->dma, cam_obj->node_cnt * sizeof(lldesc_t), MALLOC_CAP_DMA); - cam_obj->buffer = (uint8_t *)heap_caps_realloc(cam_obj->buffer, cam_obj->buffer_size * sizeof(uint8_t), MALLOC_CAP_DMA); - - for (uint32_t x = 0; x < cam_obj->node_cnt; x++) { - cam_obj->dma[x].size = cam_obj->dma_size; - cam_obj->dma[x].length = cam_obj->dma_size; - cam_obj->dma[x].eof = 0; - cam_obj->dma[x].owner = 1; - cam_obj->dma[x].buf = (cam_obj->buffer + cam_obj->dma_size * x); - cam_obj->dma[x].empty = (intptr_t)&cam_obj->dma[(x + 1) % cam_obj->node_cnt]; - } - - I2S0.in_link.addr = ((uint32_t)&cam_obj->dma[0]) & 0xfffff; - I2S0.rx_eof_num = cam_obj->half_buffer_size; /*!< Ping-pong operation */ -} - -esp_err_t cam_deinit() { - if (!cam_obj) { - return ESP_FAIL; - } - - cam_stop(); - gpio_isr_handler_remove(cam_obj->vsync_pin); - esp_intr_free(cam_obj->intr_handle); - vTaskDelete(cam_obj->task_handle); - vQueueDelete(cam_obj->event_queue); - vQueueDelete(cam_obj->frame_buffer_queue); - free(cam_obj->dma); - free(cam_obj->buffer); - free(cam_obj); - - cam_obj = NULL; - - return ESP_OK; -} - -esp_err_t cam_init(const cam_config_t *config) { - cam_obj = (cam_obj_t *)heap_caps_calloc(1, sizeof(cam_obj_t), MALLOC_CAP_DMA); - - if (!cam_obj) { - ESP_LOGI(TAG, "camera object malloc error\n"); - return ESP_FAIL; - } - - cam_obj->frame1_buffer = config->frame1_buffer; - cam_obj->frame2_buffer = config->frame2_buffer; - cam_obj->jpeg_mode = config->mode.jpeg; - cam_obj->vsync_pin = config->pin.vsync; - cam_obj->vsync_invert = config->vsync_invert; - cam_obj->hsync_invert = config->hsync_invert; - cam_set_pin(config); - cam_config(config); - cam_dma_config(config); - - cam_obj->event_queue = xQueueCreate(2, sizeof(cam_event_t)); - cam_obj->frame_buffer_queue = xQueueCreate(2, sizeof(frame_buffer_event_t)); - - if (cam_obj->frame1_buffer != NULL) { - ESP_LOGI(TAG, "frame1_buffer_en\n"); - cam_obj->frame1_buffer_en = 1; - } else { - cam_obj->frame1_buffer_en = 0; - } - - if (cam_obj->frame2_buffer != NULL) { - ESP_LOGI(TAG, "frame2_buffer_en\n"); - cam_obj->frame2_buffer_en = 1; - } else { - cam_obj->frame2_buffer_en = 0; - } - - esp_intr_alloc(ETS_I2S0_INTR_SOURCE, 0, cam_isr, NULL, &cam_obj->intr_handle); - xTaskCreate(cam_task, "cam_task", config->task_stack, NULL, config->task_pri, &cam_obj->task_handle); - return ESP_OK; -} diff --git a/ports/espressif/cam.h b/ports/espressif/cam.h deleted file mode 100644 index 779e57575069..000000000000 --- a/ports/espressif/cam.h +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2019 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#pragma once - -#include "esp_err.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - uint8_t bit_width; - union { - struct { - uint32_t pclk : 8; - uint32_t vsync : 8; - uint32_t hsync : 8; - }; - uint32_t val; - } pin; /*!< Pin of camera */ - uint8_t pin_data[16]; /*!< Data pin of camera*/ - uint8_t vsync_invert; - uint8_t hsync_invert; - uint32_t size; /*!< size of camera frame (width times height) */ - uint32_t max_buffer_size; /*!< DMA used */ - uint32_t task_stack; /*!< The priority of the task at run time */ - uint8_t task_pri; - union { - struct { - uint32_t jpeg : 1; - }; - uint32_t val; - } mode; - uint8_t *frame1_buffer; /*!< PingPang buffers , cache the image*/ - uint8_t *frame2_buffer; /*!< PingPang buffers , cache the image*/ -} cam_config_t; - -/** - * @brief enable camera - */ -void cam_start(void); - -/** - * @brief disable camera - */ -void cam_stop(void); - -/** - * @brief Accepts frame data and returns a pointer to the frame data. - * - * @param buffer_p The address of the frame buffer pointer - * - * @return - len of buffer - */ -size_t cam_take(uint8_t **buffer_p); - -/** - * @brief Check whether a frame is available - * - * @return - true if cam_take() will complete immediately, false if it will block - */ -bool cam_ready(void); - -/** - * @brief enable frame buffer to get the next frame data. - * - * @param buffer The address of the frame buffer pointer - * - */ -void cam_give(uint8_t *buffer); - -/** - * @brief Initialize camera - * - * @param config Parameter configuration, including pin, buffer, output image size, and so on. - * - * @return - ESP_OK :Initialize success - * ESP_FAIL: Initialize fails - */ -esp_err_t cam_init(const cam_config_t *config); - -/** - * @brief delete the camera - * - * @return - ESP_OK :Delete success - * ESP_FAIL: Delete fails - */ -esp_err_t cam_deinit(void); - -#ifdef __cplusplus -} -#endif diff --git a/ports/espressif/common-hal/audiobusio/__init__.c b/ports/espressif/common-hal/audiobusio/__init__.c index 1c46358aaf57..9ebf325b9798 100644 --- a/ports/espressif/common-hal/audiobusio/__init__.c +++ b/ports/espressif/common-hal/audiobusio/__init__.c @@ -140,6 +140,9 @@ void port_i2s_allocate_init(i2s_t *self, bool left_justified) { if (err == ESP_ERR_NOT_FOUND) { mp_raise_RuntimeError(MP_ERROR_TEXT("Peripheral in use")); } + self->playing = false; + self->paused = false; + self->stopping = false; i2s_event_callbacks_t callbacks = { .on_recv = NULL, @@ -157,6 +160,8 @@ void port_i2s_deinit(i2s_t *self) { } void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop) { + // Pause to disable the I2S channel so we can adjust the clock. + port_i2s_pause(self); self->sample = sample; self->loop = loop; self->bytes_per_sample = audiosample_bits_per_sample(sample) / 8; @@ -204,6 +209,9 @@ void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop) { } bool port_i2s_playing(i2s_t *self) { + // TODO: Reason about stopping. This check leads to cases where the DMA is + // "playing" but the common-hal thinks it isn't and skips pausing. Probably + // best to move this functionality into I2SOut directly. return self->playing && !self->stopping; } @@ -219,14 +227,14 @@ void port_i2s_stop(i2s_t *self) { } void port_i2s_pause(i2s_t *self) { - if (!self->paused) { + if (self->playing && !self->paused) { self->paused = true; CHECK_ESP_RESULT(i2s_channel_disable(self->handle)); } } void port_i2s_resume(i2s_t *self) { - if (self->paused) { + if (self->playing && self->paused) { self->paused = false; CHECK_ESP_RESULT(i2s_channel_enable(self->handle)); } diff --git a/ports/espressif/common-hal/audiobusio/__init__.h b/ports/espressif/common-hal/audiobusio/__init__.h index a2e397828a92..7e6277ed35e7 100644 --- a/ports/espressif/common-hal/audiobusio/__init__.h +++ b/ports/espressif/common-hal/audiobusio/__init__.h @@ -36,8 +36,8 @@ typedef struct { mp_obj_t *sample; bool left_justified; bool loop; - bool paused; - bool playing; + bool paused; // True when the I2S channel is configured but disabled. + bool playing; // True when the I2S channel is configured. bool stopping; bool samples_signed; int8_t bytes_per_sample; diff --git a/ports/espressif/common-hal/countio/Counter.c b/ports/espressif/common-hal/countio/Counter.c index 7ab7349bb68b..f325a0edc7c8 100644 --- a/ports/espressif/common-hal/countio/Counter.c +++ b/ports/espressif/common-hal/countio/Counter.c @@ -28,6 +28,8 @@ #include "shared-bindings/countio/Counter.h" #include "common-hal/microcontroller/Pin.h" +#include "bindings/espidf/__init__.h" + #include "py/runtime.h" #include "driver/gpio.h" @@ -36,25 +38,26 @@ void common_hal_countio_counter_construct(countio_counter_obj_t *self, const mcu_pin_obj_t *pin, countio_edge_t edge, digitalio_pull_t pull) { claim_pin(pin); - // Prepare configuration for the PCNT unit - 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 rising / falling edge of pulse input? - // If EDGE_RISE_AND_FALL, both modeswill do PCNT_COUNT_INC. - .pos_mode = (edge == EDGE_FALL) ? PCNT_COUNT_DIS : PCNT_COUNT_INC, // Count up unless only fall - .neg_mode = (edge == EDGE_RISE) ? PCNT_COUNT_DIS : PCNT_COUNT_INC, // Count up unless only rise + pcnt_unit_config_t unit_config = { + // Set counter limit + .low_limit = -1, + .high_limit = INT16_MAX }; + // The pulse count driver automatically counts roll overs. + unit_config.flags.accum_count = true; - // Initialize PCNT unit - const int8_t unit = peripherals_pcnt_init(&pcnt_config); - if (unit == -1) { - mp_raise_RuntimeError(MP_ERROR_TEXT("All PCNT units in use")); - } + // initialize PCNT + CHECK_ESP_RESULT(pcnt_new_unit(&unit_config, &self->unit)); self->pin = pin->number; + pcnt_chan_config_t channel_config = { + .edge_gpio_num = self->pin, + .level_gpio_num = -1 + }; + CHECK_ESP_RESULT(pcnt_new_channel(self->unit, &channel_config, &self->channel)); + pcnt_channel_edge_action_t pos = (edge == EDGE_RISE || edge == EDGE_RISE_AND_FALL) ? PCNT_CHANNEL_EDGE_ACTION_INCREASE : PCNT_CHANNEL_EDGE_ACTION_HOLD; + pcnt_channel_edge_action_t neg = (edge == EDGE_FALL || edge == EDGE_RISE_AND_FALL) ? PCNT_CHANNEL_EDGE_ACTION_INCREASE : PCNT_CHANNEL_EDGE_ACTION_HOLD; + pcnt_channel_set_edge_action(self->channel, pos, neg); gpio_pullup_dis(pin->number); gpio_pulldown_dis(pin->number); @@ -64,29 +67,34 @@ void common_hal_countio_counter_construct(countio_counter_obj_t *self, gpio_pulldown_en(pin->number); } - self->unit = (pcnt_unit_t)unit; + + pcnt_unit_enable(self->unit); + pcnt_unit_start(self->unit); } bool common_hal_countio_counter_deinited(countio_counter_obj_t *self) { - return self->unit == PCNT_UNIT_MAX; + return self->unit == NULL; } void common_hal_countio_counter_deinit(countio_counter_obj_t *self) { if (common_hal_countio_counter_deinited(self)) { return; } + pcnt_unit_disable(self->unit); + pcnt_del_channel(self->channel); reset_pin_number(self->pin); - peripherals_pcnt_deinit(&self->unit); + pcnt_del_unit(self->unit); + self->unit = NULL; } mp_int_t common_hal_countio_counter_get_count(countio_counter_obj_t *self) { - int16_t count; - pcnt_get_counter_value(self->unit, &count); + int count; + pcnt_unit_get_count(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(self->unit); + pcnt_unit_clear_count(self->unit); } diff --git a/ports/espressif/common-hal/countio/Counter.h b/ports/espressif/common-hal/countio/Counter.h index d7e048ddf06f..492330e11d1b 100644 --- a/ports/espressif/common-hal/countio/Counter.h +++ b/ports/espressif/common-hal/countio/Counter.h @@ -24,17 +24,15 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_COUNTIO_COUNTER_H -#define MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_COUNTIO_COUNTER_H +#pragma once #include "py/obj.h" -#include "peripherals/pcnt.h" +#include "driver/pulse_cnt.h" typedef struct { mp_obj_base_t base; - uint8_t pin; + pcnt_unit_handle_t unit; + pcnt_channel_handle_t channel; mp_int_t count; - pcnt_unit_t unit; + uint8_t pin; } countio_counter_obj_t; - -#endif // MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_COUNTIO_COUNT_H diff --git a/ports/espressif/common-hal/frequencyio/FrequencyIn.c b/ports/espressif/common-hal/frequencyio/FrequencyIn.c index 362a18610432..2658cfb7eb9e 100644 --- a/ports/espressif/common-hal/frequencyio/FrequencyIn.c +++ b/ports/espressif/common-hal/frequencyio/FrequencyIn.c @@ -26,179 +26,195 @@ #include "shared-bindings/frequencyio/FrequencyIn.h" +#include "bindings/espidf/__init__.h" #include "py/runtime.h" +#include "driver/pulse_cnt.h" #include "driver/gpio.h" -#include "driver/timer.h" +#include "driver/gptimer.h" #include "soc/timer_group_struct.h" +#include "esp_heap_caps.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); - - // increase multiplier - self->multiplier++; - - // reset interrupt - PCNT.int_clr.val = BIT(self->unit); -} - -static void IRAM_ATTR timer_interrupt_handler(void *self_in) { - frequencyio_frequencyin_obj_t *self = self_in; +// All gptimer handlers are in RAM so that protomatter can run during flash writes. +static IRAM_ATTR bool timer_interrupt_handler(gptimer_handle_t timer, + const gptimer_alarm_event_data_t *edata, void *internal_data_ptr) { + _internal_data_t *internal_data = (_internal_data_t *)internal_data_ptr; // get counter value - int16_t count; - pcnt_get_counter_value(self->unit, &count); - self->frequency = ((count / 2.0) + (self->multiplier * INT16_MAX / 4.0)) / (self->capture_period); - - // reset multiplier - self->multiplier = 0; + pcnt_unit_get_count(internal_data->unit, &internal_data->pulse_count); // reset counter - pcnt_counter_clear(self->unit); - - // reset interrupt - timg_dev_t *device = self->timer.group ? &(TIMERG1) : &(TIMERG0); - - #if SOC_TIMER_GROUP_TIMERS_PER_GROUP > 1 - if (self->timer.idx) { - device->int_clr_timers.t1_int_clr = 1; - } else { - #endif - device->int_clr_timers.t0_int_clr = 1; - #if SOC_TIMER_GROUP_TIMERS_PER_GROUP > 1 -} - #endif - - #if defined(CONFIG_IDF_TARGET_ESP32S3) - device->hw_timer[self->timer.idx].config.tn_alarm_en = 1; - #else - device->hw_timer[self->timer.idx].config.tx_alarm_en = 1; - #endif + pcnt_unit_clear_count(internal_data->unit); + return false; } -static void init_pcnt(frequencyio_frequencyin_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, - .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, +static esp_err_t init_pcnt(frequencyio_frequencyin_obj_t *self) { + pcnt_unit_config_t unit_config = { // Set counter limit - .counter_h_lim = INT16_MAX, - .counter_l_lim = 0, + .low_limit = -INT16_MAX + 1, + .high_limit = INT16_MAX }; + // The pulse count driver automatically counts roll overs. + unit_config.flags.accum_count = true; // initialize PCNT - const int8_t unit = peripherals_pcnt_init(&pcnt_config); - if (unit == -1) { - mp_raise_RuntimeError(MP_ERROR_TEXT("All PCNT units in use")); + esp_err_t result = pcnt_new_unit(&unit_config, &self->internal_data->unit); + if (result != ESP_OK) { + return result; } - // set the GPIO back to high-impedance, as pcnt_unit_config sets it as pull-up - gpio_set_pull_mode(self->pin, GPIO_FLOATING); + pcnt_chan_config_t channel_config = { + .edge_gpio_num = self->pin, + .level_gpio_num = -1 + }; + result = pcnt_new_channel(self->internal_data->unit, &channel_config, &self->channel); + if (result != ESP_OK) { + pcnt_del_unit(self->internal_data->unit); + return result; + } + // Count both edges of the signal. + pcnt_channel_set_edge_action(self->channel, PCNT_CHANNEL_EDGE_ACTION_INCREASE, PCNT_CHANNEL_EDGE_ACTION_INCREASE); - self->unit = (pcnt_unit_t)unit; + pcnt_unit_enable(self->internal_data->unit); + pcnt_unit_start(self->internal_data->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); + // set the GPIO back to high-impedance, as pcnt_unit_config sets it as pull-up + gpio_set_pull_mode(self->pin, GPIO_FLOATING); + return ESP_OK; } -static void init_timer(frequencyio_frequencyin_obj_t *self) { - // Prepare configuration for the timer module - const 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 +static esp_err_t init_timer(frequencyio_frequencyin_obj_t *self) { + gptimer_config_t config = { + .clk_src = GPTIMER_CLK_SRC_DEFAULT, + .direction = GPTIMER_COUNT_UP, + .resolution_hz = 1000 * 1000, // 1,000 counts per millisecond. + .flags = { + .intr_shared = true + } }; // initialize Timer - peripherals_timer_init(&config, &self->timer); - if (self->timer.idx == TIMER_MAX || self->timer.group == TIMER_GROUP_MAX) { - mp_raise_RuntimeError(MP_ERROR_TEXT("All timers in use")); - } - - timer_idx_t idx = self->timer.idx; - timer_group_t group = self->timer.group; + CHECK_ESP_RESULT(gptimer_new_timer(&config, &self->timer)); - // 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); + gptimer_alarm_config_t alarm_config = { + .reload_count = 0, // counter will reload with 0 on alarm event + .alarm_count = self->capture_period_ms * 1000, // period in ms + .flags.auto_reload_on_alarm = true, // enable auto-reload + }; + esp_err_t result = gptimer_set_alarm_action(self->timer, &alarm_config); + if (result != ESP_OK) { + gptimer_del_timer(self->timer); + return result; + } - // start timer - timer_start(self->timer.group, self->timer.idx); + gptimer_event_callbacks_t cbs = { + .on_alarm = timer_interrupt_handler, // register user callback + }; + result = gptimer_register_event_callbacks(self->timer, &cbs, self->internal_data); + if (result != ESP_OK) { + gptimer_del_timer(self->timer); + return result; + } + result = gptimer_enable(self->timer); + if (result != ESP_OK) { + gptimer_del_timer(self->timer); + return result; + } + result = gptimer_start(self->timer); + if (result != ESP_OK) { + gptimer_del_timer(self->timer); + return result; + } + return ESP_OK; } void common_hal_frequencyio_frequencyin_construct(frequencyio_frequencyin_obj_t *self, - const mcu_pin_obj_t *pin, const uint16_t capture_period) { - mp_arg_validate_int_range(capture_period, 1, 500, MP_QSTR_capture_period); + const mcu_pin_obj_t *pin, const uint16_t capture_period_ms) { + mp_arg_validate_int_range(capture_period_ms, 1, 500, MP_QSTR_capture_period); self->pin = pin->number; - self->handle = NULL; - self->multiplier = 0; - self->capture_period = capture_period; + self->capture_period_ms = capture_period_ms; + self->internal_data = heap_caps_malloc(MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL, sizeof(_internal_data_t)); + if (self->internal_data == NULL) { + raise_esp_error(ESP_ERR_NO_MEM); + } + self->internal_data->pulse_count = 0; // initialize pcnt and timer - init_pcnt(self); - init_timer(self); + esp_err_t result = init_pcnt(self); + if (result != ESP_OK) { + heap_caps_free(self->internal_data); + self->internal_data = NULL; + raise_esp_error(result); + } + result = init_timer(self); + if (result != ESP_OK) { + pcnt_del_channel(self->channel); + pcnt_del_unit(self->internal_data->unit); + heap_caps_free(self->internal_data); + self->internal_data = NULL; + raise_esp_error(result); + } claim_pin(pin); } bool common_hal_frequencyio_frequencyin_deinited(frequencyio_frequencyin_obj_t *self) { - return self->unit == PCNT_UNIT_MAX; + return self->internal_data == NULL; } void common_hal_frequencyio_frequencyin_deinit(frequencyio_frequencyin_obj_t *self) { if (common_hal_frequencyio_frequencyin_deinited(self)) { return; } + gptimer_stop(self->timer); + gptimer_disable(self->timer); + gptimer_del_timer(self->timer); + pcnt_unit_disable(self->internal_data->unit); + pcnt_del_channel(self->channel); reset_pin_number(self->pin); - peripherals_pcnt_deinit(&self->unit); - peripherals_timer_deinit(&self->timer); - if (self->handle) { - esp_intr_free(self->handle); - self->handle = NULL; - } + pcnt_del_unit(self->internal_data->unit); + self->internal_data->unit = NULL; + heap_caps_free(self->internal_data); + self->internal_data = NULL; } uint32_t common_hal_frequencyio_frequencyin_get_item(frequencyio_frequencyin_obj_t *self) { - return self->frequency; + // pulse_count / capture_period_ms is pulses per ms. * 1000 is pulses per second. + // We have two pulse counts (one for each edge) per cycle so / 2. Combine to do + // * 500 instead of * 1000 / 2. + return self->internal_data->pulse_count * 500 / self->capture_period_ms; } void common_hal_frequencyio_frequencyin_pause(frequencyio_frequencyin_obj_t *self) { - pcnt_counter_pause(self->unit); - timer_pause(self->timer.group, self->timer.idx); + pcnt_unit_stop(self->internal_data->unit); + gptimer_stop(self->timer); } void common_hal_frequencyio_frequencyin_resume(frequencyio_frequencyin_obj_t *self) { - pcnt_counter_resume(self->unit); - timer_start(self->timer.group, self->timer.idx); + pcnt_unit_start(self->internal_data->unit); + gptimer_start(self->timer); } void common_hal_frequencyio_frequencyin_clear(frequencyio_frequencyin_obj_t *self) { - self->frequency = 0; - pcnt_counter_clear(self->unit); - timer_set_counter_value(self->timer.group, self->timer.idx, 0); + self->internal_data->pulse_count = 0; + pcnt_unit_clear_count(self->internal_data->unit); + gptimer_set_raw_count(self->timer, 0); } uint16_t common_hal_frequencyio_frequencyin_get_capture_period(frequencyio_frequencyin_obj_t *self) { - return self->capture_period; + return self->capture_period_ms; } -void common_hal_frequencyio_frequencyin_set_capture_period(frequencyio_frequencyin_obj_t *self, uint16_t capture_period) { - mp_arg_validate_int_range(capture_period, 1, 500, MP_QSTR_capture_period); +void common_hal_frequencyio_frequencyin_set_capture_period(frequencyio_frequencyin_obj_t *self, uint16_t capture_period_ms) { + mp_arg_validate_int_range(capture_period_ms, 1, 500, MP_QSTR_capture_period); - self->capture_period = capture_period; common_hal_frequencyio_frequencyin_clear(self); - timer_set_alarm_value(self->timer.group, self->timer.idx, capture_period * 1000000); + + self->capture_period_ms = capture_period_ms; + gptimer_alarm_config_t alarm_config = { + .alarm_count = capture_period_ms * 1000, + .reload_count = 0, // counter will reload with 0 on alarm event + .flags.auto_reload_on_alarm = true, // enable auto-reload + }; + gptimer_set_alarm_action(self->timer, &alarm_config); } diff --git a/ports/espressif/common-hal/frequencyio/FrequencyIn.h b/ports/espressif/common-hal/frequencyio/FrequencyIn.h index d41fa8f44dcd..c1433ec4ae1d 100644 --- a/ports/espressif/common-hal/frequencyio/FrequencyIn.h +++ b/ports/espressif/common-hal/frequencyio/FrequencyIn.h @@ -24,22 +24,23 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_FREQUENCYIO_FREQUENCYIN_H -#define MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_FREQUENCYIO_FREQUENCYIN_H +#pragma once #include "py/obj.h" -#include "peripherals/pcnt.h" -#include "peripherals/timer.h" +#include "driver/pulse_cnt.h" +#include "driver/gptimer.h" + +// This data is used in the interrupt and needs to be in internal RAM. +typedef struct { + pcnt_unit_handle_t unit; + int pulse_count; +} _internal_data_t; typedef struct { mp_obj_base_t base; - pcnt_unit_t unit; - timer_index_t timer; - intr_handle_t handle; + pcnt_channel_handle_t channel; + gptimer_handle_t timer; + _internal_data_t *internal_data; uint8_t pin; - uint8_t multiplier; - uint32_t frequency; - uint16_t capture_period; + uint16_t capture_period_ms; } frequencyio_frequencyin_obj_t; - -#endif // MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_FREQUENCYIO_FREQUENCYIN_H diff --git a/ports/espressif/common-hal/neopixel_write/__init__.c b/ports/espressif/common-hal/neopixel_write/__init__.c index 7361524cc60d..c4c487496837 100644 --- a/ports/espressif/common-hal/neopixel_write/__init__.c +++ b/ports/espressif/common-hal/neopixel_write/__init__.c @@ -40,11 +40,16 @@ * limitations under the License. */ +#include "shared-bindings/neopixel_write/__init__.h" + #include "py/mphal.h" #include "py/runtime.h" -#include "shared-bindings/neopixel_write/__init__.h" + +#include "bindings/espidf/__init__.h" #include "supervisor/port.h" -#include "peripherals/rmt.h" + +#include "driver/gpio.h" +#include "driver/rmt_tx.h" // Use closer to WS2812-style timings instead of WS2812B, to accommodate more varieties. #define WS2812_T0H_NS (316) @@ -52,88 +57,81 @@ #define WS2812_T1H_NS (700) #define WS2812_T1L_NS (564) -static uint32_t ws2812_t0h_ticks = 0; -static uint32_t ws2812_t1h_ticks = 0; -static uint32_t ws2812_t0l_ticks = 0; -static uint32_t ws2812_t1l_ticks = 0; - static uint64_t next_start_raw_ticks = 0; -static void IRAM_ATTR ws2812_rmt_adapter(const void *src, rmt_item32_t *dest, size_t src_size, - size_t wanted_num, size_t *translated_size, size_t *item_num) { - if (src == NULL || dest == NULL) { - *translated_size = 0; - *item_num = 0; - return; - } - const rmt_item32_t bit0 = {{{ ws2812_t0h_ticks, 1, ws2812_t0l_ticks, 0 }}}; // Logical 0 - const rmt_item32_t bit1 = {{{ ws2812_t1h_ticks, 1, ws2812_t1l_ticks, 0 }}}; // Logical 1 - size_t size = 0; - size_t num = 0; - uint8_t *psrc = (uint8_t *)src; - rmt_item32_t *pdest = dest; - while (size < src_size && num < wanted_num) { - for (int i = 0; i < 8; i++) { - // MSB first - if (*psrc & (1 << (7 - i))) { - pdest->val = bit1.val; - } else { - pdest->val = bit0.val; - } - num++; - pdest++; - } - size++; - psrc++; - } - *translated_size = size; - *item_num = num; -} - void common_hal_neopixel_write(const digitalio_digitalinout_obj_t *digitalinout, uint8_t *pixels, uint32_t numBytes) { // Reserve channel - uint8_t number = digitalinout->pin->number; - rmt_channel_t channel = peripherals_find_and_reserve_rmt(TRANSMIT_MODE); - if (channel == RMT_CHANNEL_MAX) { - mp_raise_RuntimeError(MP_ERROR_TEXT("All timers in use")); - } - - // Configure Channel - rmt_config_t config = RMT_DEFAULT_CONFIG_TX(number, channel); - config.clk_div = 2; // set counter clock to 40MHz - rmt_config(&config); - rmt_driver_install(config.channel, 0, 0); + rmt_tx_channel_config_t config = { + .gpio_num = digitalinout->pin->number, + .clk_src = RMT_CLK_SRC_DEFAULT, + .resolution_hz = 40000000, + .trans_queue_depth = 1, + .mem_block_symbols = SOC_RMT_MEM_WORDS_PER_CHANNEL, + }; + rmt_channel_handle_t channel; + CHECK_ESP_RESULT(rmt_new_tx_channel(&config, &channel)); - // Convert NS timings to ticks - uint32_t counter_clk_hz = 0; - if (rmt_get_counter_clock(config.channel, &counter_clk_hz) != ESP_OK) { - mp_raise_RuntimeError(MP_ERROR_TEXT("Could not retrieve clock")); - } - size_t ns_per_tick = 1e9 / counter_clk_hz; - ws2812_t0h_ticks = WS2812_T0H_NS / ns_per_tick; - ws2812_t0l_ticks = WS2812_T0L_NS / ns_per_tick; - ws2812_t1h_ticks = WS2812_T1H_NS / ns_per_tick; - ws2812_t1l_ticks = WS2812_T1L_NS / ns_per_tick; + size_t ns_per_tick = 1e9 / 40000000; + uint16_t ws2812_t0h_ticks = WS2812_T0H_NS / ns_per_tick; + uint16_t ws2812_t0l_ticks = WS2812_T0L_NS / ns_per_tick; + uint16_t ws2812_t1h_ticks = WS2812_T1H_NS / ns_per_tick; + uint16_t ws2812_t1l_ticks = WS2812_T1L_NS / ns_per_tick; - // Initialize automatic timing translator - rmt_translator_init(config.channel, ws2812_rmt_adapter); + rmt_symbol_word_t bit0 = { + .duration0 = ws2812_t0h_ticks, + .level0 = 1, + .duration1 = ws2812_t0l_ticks, + .level1 = 0 + }; + rmt_symbol_word_t bit1 = { + .duration0 = ws2812_t1h_ticks, + .level0 = 1, + .duration1 = ws2812_t1l_ticks, + .level1 = 0 + }; + rmt_bytes_encoder_config_t encoder_config = { + .bit0 = bit0, + .bit1 = bit1, + .flags = { + .msb_first = true + } + }; + rmt_encoder_handle_t encoder; + CHECK_ESP_RESULT(rmt_new_bytes_encoder(&encoder_config, &encoder)); // 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) { } + rmt_enable(channel); + // Write and wait to finish - if (rmt_write_sample(config.channel, pixels, (size_t)numBytes, true) != ESP_OK) { - mp_raise_RuntimeError(MP_ERROR_TEXT("Input/output error")); + rmt_transmit_config_t transmit_config = { + .loop_count = 0, + .flags.eot_level = 0 + }; + esp_err_t result = rmt_transmit(channel, encoder, pixels, (size_t)numBytes, &transmit_config); + if (result != ESP_OK) { + rmt_del_encoder(encoder); + rmt_disable(channel); + rmt_del_channel(channel); + raise_esp_error(result); + } + result = ESP_ERR_TIMEOUT; + while (result == ESP_ERR_TIMEOUT) { + RUN_BACKGROUND_TASKS; + result = rmt_tx_wait_all_done(channel, 0); } - rmt_wait_tx_done(config.channel, pdMS_TO_TICKS(100)); // Update the next start to +2 ticks. It ensures that we've gone 300+ us. next_start_raw_ticks = port_get_raw_ticks(NULL) + 2; // Free channel again - peripherals_free_rmt(config.channel); + rmt_del_encoder(encoder); + rmt_disable(channel); + rmt_del_channel(channel); + CHECK_ESP_RESULT(result); // Swap pin back to GPIO mode gpio_set_direction(digitalinout->pin->number, GPIO_MODE_OUTPUT); } diff --git a/ports/espressif/common-hal/pulseio/PulseIn.c b/ports/espressif/common-hal/pulseio/PulseIn.c index cecefa64194e..d8f048e9128f 100644 --- a/ports/espressif/common-hal/pulseio/PulseIn.c +++ b/ports/espressif/common-hal/pulseio/PulseIn.c @@ -25,72 +25,71 @@ */ #include "common-hal/pulseio/PulseIn.h" +#include "bindings/espidf/__init__.h" #include "shared-bindings/pulseio/PulseIn.h" #include "shared-bindings/microcontroller/__init__.h" #include "py/runtime.h" -STATIC uint8_t refcount = 0; -STATIC pulseio_pulsein_obj_t *handles[RMT_CHANNEL_MAX]; - -// Requires rmt.c void peripherals_reset_all(void) to reset - -STATIC void update_internal_buffer(pulseio_pulsein_obj_t *self) { - size_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; - uint32_t val = items[i].duration0 * 3; - // make sure the value returned does not exceed the max uint16 value. - if (val > 65535) { - val = 65535; - } +#include "driver/gpio.h" +#include "driver/rmt_rx.h" + +// Save IRAM by not working during flash writes or erases. +#ifdef CONFIG_RMT_ISR_IRAM_SAFE +#error "CircuitPython RMT callback is not IRAM safe" +#endif + +static const rmt_receive_config_t rx_config = { + .signal_range_min_ns = 1250, // 1.25 microseconds + .signal_range_max_ns = 0xffff * 1000, // ~65 milliseconds +}; + +static bool _done_callback(rmt_channel_handle_t rx_chan, + const rmt_rx_done_event_data_t *edata, void *user_ctx) { + pulseio_pulsein_obj_t *self = (pulseio_pulsein_obj_t *)user_ctx; + if (self->paused) { + return false; + } + + for (size_t i = 0; i < edata->num_symbols; i++) { + uint16_t pos = (self->start + self->len) % self->maxlen; + rmt_symbol_word_t symbol = edata->received_symbols[i]; + uint32_t val = symbol.duration0 * 2; + + bool done = val == 0; + // Duration of zero indicates the end of transmission which is longer + // than we can capture. So, set the max value. + if (val == 0) { + val = 65535; + } + if (!self->find_first || symbol.level0 == !self->idle_state) { + self->find_first = false; self->buffer[pos] = (uint16_t)val; - if (self->len < self->maxlen) { - self->len++; - } else { - self->start = (self->start + 1) % self->maxlen; - } - // Check if second item exists - if (items[i].duration1) { - pos = (self->start + self->len) % self->maxlen; - val = items[i].duration1 * 3; - if (val > 65535) { - val = 65535; - } - self->buffer[pos] = (uint16_t)val; - if (self->len < self->maxlen) { - self->len++; - } else { - self->start = (self->start + 1) % self->maxlen; - } + self->len++; + if (done) { + break; } } - 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); + pos = (self->start + self->len) % self->maxlen; + val = symbol.duration1 * 2; + done = val == 0; + // Duration of zero indicates the end of transmission which is longer + // than we can capture. So, set the max value. + if (val == 0) { + val = 65535; + } + self->buffer[pos] = (uint16_t)val; + self->len++; + self->find_first = false; + if (done) { + break; } } -} -void pulsein_reset(void) { - for (size_t i = 0; i < RMT_CHANNEL_MAX; i++) { - handles[i] = NULL; - } - if (refcount != 0) { - supervisor_disable_tick(); + if (!self->paused) { + rmt_receive(self->channel, self->raw_symbols, self->raw_symbols_size, &rx_config); } - refcount = 0; + return false; } void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, const mcu_pin_obj_t *pin, @@ -99,12 +98,21 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, const mcu if (self->buffer == NULL) { m_malloc_fail(maxlen * sizeof(uint16_t)); } + // We add one to the maxlen version to ensure that two symbols at lease are + // captured because we may skip the first portion of a symbol. + self->raw_symbols_size = MIN(64, maxlen / 2 + 1) * sizeof(rmt_symbol_word_t); + self->raw_symbols = (rmt_symbol_word_t *)m_malloc(self->raw_symbols_size); + if (self->raw_symbols == NULL) { + m_free(self->buffer); + m_malloc_fail(self->raw_symbols_size); + } self->pin = pin; self->maxlen = maxlen; self->idle_state = idle_state; self->start = 0; self->len = 0; self->paused = false; + self->find_first = true; // Set pull settings gpio_pullup_dis(pin->number); @@ -116,47 +124,38 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, const mcu } // Find a free RMT Channel and configure it - rmt_channel_t channel = peripherals_find_and_reserve_rmt(RECEIVE_MODE); - if (channel == RMT_CHANNEL_MAX) { - mp_raise_RuntimeError(MP_ERROR_TEXT("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 accommodate 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); - refcount++; - if (refcount == 1) { - supervisor_enable_tick(); - } + rmt_rx_channel_config_t config = { + .gpio_num = pin->number, + .clk_src = RMT_CLK_SRC_DEFAULT, + // 2 us resolution so we can capture 65ms pulses. The RMT period is only 15 bits. + .resolution_hz = 1000000 / 2, + .mem_block_symbols = SOC_RMT_MEM_WORDS_PER_CHANNEL, + }; + // If we fail here, the buffers allocated above will be garbage collected. + CHECK_ESP_RESULT(rmt_new_rx_channel(&config, &self->channel)); + + rmt_rx_event_callbacks_t rx_callback = { + .on_recv_done = _done_callback + }; + rmt_rx_register_event_callbacks(self->channel, &rx_callback, self); + rmt_enable(self->channel); + rmt_receive(self->channel, self->raw_symbols, self->raw_symbols_size, &rx_config); } bool common_hal_pulseio_pulsein_deinited(pulseio_pulsein_obj_t *self) { - return handles[self->channel] ? false : true; + return self->channel == NULL; } void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t *self) { - handles[self->channel] = NULL; - peripherals_free_rmt(self->channel); + rmt_disable(self->channel); reset_pin_number(self->pin->number); - refcount--; - if (refcount == 0) { - supervisor_disable_tick(); - } + rmt_del_channel(self->channel); + self->channel = NULL; } void common_hal_pulseio_pulsein_pause(pulseio_pulsein_obj_t *self) { self->paused = true; - rmt_rx_stop(self->channel); + rmt_disable(self->channel); } void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t *self, uint16_t trigger_duration) { @@ -173,8 +172,10 @@ void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t *self, uint16_t tri gpio_set_direction(self->pin->number, GPIO_MODE_INPUT); // should revert to pull direction } + self->find_first = true; self->paused = false; - rmt_rx_start(self->channel, false); + rmt_enable(self->channel); + rmt_receive(self->channel, self->raw_symbols, self->raw_symbols_size, &rx_config); } void common_hal_pulseio_pulsein_clear(pulseio_pulsein_obj_t *self) { @@ -184,7 +185,6 @@ void common_hal_pulseio_pulsein_clear(pulseio_pulsein_obj_t *self) { } uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t *self, int16_t index) { - update_internal_buffer(self); if (index < 0) { index += self->len; } @@ -196,8 +196,6 @@ uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t *self, int16_ } uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t *self) { - update_internal_buffer(self); - if (self->len == 0) { mp_raise_IndexError(MP_ERROR_TEXT("pop from an empty PulseIn")); } diff --git a/ports/espressif/common-hal/pulseio/PulseIn.h b/ports/espressif/common-hal/pulseio/PulseIn.h index 92db65f772d0..846886aded69 100644 --- a/ports/espressif/common-hal/pulseio/PulseIn.h +++ b/ports/espressif/common-hal/pulseio/PulseIn.h @@ -24,32 +24,29 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_PULSEIO_PULSEIN_H -#define MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_PULSEIO_PULSEIN_H +#pragma once #include "common-hal/microcontroller/Pin.h" #include "py/obj.h" -#include "peripherals/rmt.h" +#include "driver/rmt_types.h" typedef struct { mp_obj_base_t base; const mcu_pin_obj_t *pin; - rmt_channel_t channel; - bool idle_state; - bool paused; - - RingbufHandle_t buf_handle; + rmt_channel_handle_t channel; uint16_t *buffer; - uint16_t maxlen; + size_t maxlen; + + rmt_symbol_word_t *raw_symbols; + size_t raw_symbols_size; volatile uint16_t start; volatile uint16_t len; -} pulseio_pulsein_obj_t; -void pulsein_reset(void); -void pulsein_background(void); - -#endif // MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_PULSEIO_PULSEIN_H + bool idle_state; + bool paused; + bool find_first; +} pulseio_pulsein_obj_t; diff --git a/ports/espressif/common-hal/pulseio/PulseOut.c b/ports/espressif/common-hal/pulseio/PulseOut.c index 2c37816bdc62..7f5dbfc38c7e 100644 --- a/ports/espressif/common-hal/pulseio/PulseOut.c +++ b/ports/espressif/common-hal/pulseio/PulseOut.c @@ -27,61 +27,90 @@ #include "common-hal/pulseio/PulseOut.h" #include "shared-bindings/pulseio/PulseOut.h" +#include "bindings/espidf/__init__.h" #include "shared-bindings/pwmio/PWMOut.h" #include "py/runtime.h" -// Requires rmt.c void peripherals_reset_all(void) to reset +#include "driver/rmt_tx.h" void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t *self, const mcu_pin_obj_t *pin, uint32_t frequency, uint16_t duty_cycle) { - rmt_channel_t channel = peripherals_find_and_reserve_rmt(TRANSMIT_MODE); - if (channel == RMT_CHANNEL_MAX) { - mp_raise_RuntimeError(MP_ERROR_TEXT("All timers in use")); - } + // Reserve channel + rmt_tx_channel_config_t config = { + .gpio_num = pin->number, + .clk_src = RMT_CLK_SRC_DEFAULT, + .resolution_hz = 1000000, + .trans_queue_depth = 1, + .mem_block_symbols = SOC_RMT_MEM_WORDS_PER_CHANNEL, + }; + CHECK_ESP_RESULT(rmt_new_tx_channel(&config, &self->channel)); - // 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; + rmt_copy_encoder_config_t encoder_config = {}; + esp_err_t result = rmt_new_copy_encoder(&encoder_config, &self->encoder); + if (result != ESP_OK) { + rmt_del_channel(self->channel); + self->channel = NULL; + raise_esp_error(result); + } - rmt_config(&config); - rmt_driver_install(channel, 0, 0); + if (duty_cycle != 0xffff) { + rmt_carrier_config_t tx_carrier_cfg = { + .duty_cycle = (duty_cycle * 1.0) / (1 << 16), // duty cycle as a float 0-1 + .frequency_hz = frequency, + .flags.polarity_active_low = false, // carrier should be modulated to high level + }; + // modulate carrier to TX channel + ESP_ERROR_CHECK(rmt_apply_carrier(self->channel, &tx_carrier_cfg)); + } - self->channel = channel; + rmt_enable(self->channel); } bool common_hal_pulseio_pulseout_deinited(pulseio_pulseout_obj_t *self) { - return self->channel == RMT_CHANNEL_MAX; + return self->channel == NULL; } void common_hal_pulseio_pulseout_deinit(pulseio_pulseout_obj_t *self) { - peripherals_free_rmt(self->channel); - self->channel = RMT_CHANNEL_MAX; - + rmt_disable(self->channel); + rmt_del_encoder(self->encoder); + rmt_del_channel(self->channel); + self->channel = NULL; } void common_hal_pulseio_pulseout_send(pulseio_pulseout_obj_t *self, uint16_t *pulses, uint16_t length) { - rmt_item32_t items[length]; + rmt_symbol_word_t symbols[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; + continue; } 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_symbol_word_t symbol = { + .duration0 = (pulses[i] & 0x8000 ? 0x7FFF : 1), + .level0 = level, + .duration1 = (pulses[i] & 0x7FFF), + .level1 = level + }; + symbols[i] = symbol; } - rmt_write_items(self->channel, items, length, true); - while (rmt_wait_tx_done(self->channel, 0) != ESP_OK) { + // Write and wait to finish + rmt_transmit_config_t transmit_config = { + .loop_count = 0, + .flags.eot_level = 0 + }; + CHECK_ESP_RESULT(rmt_transmit(self->channel, self->encoder, symbols, length * sizeof(rmt_symbol_word_t), &transmit_config)); + + esp_err_t result = ESP_ERR_TIMEOUT; + while (result == ESP_ERR_TIMEOUT) { RUN_BACKGROUND_TASKS; + result = rmt_tx_wait_all_done(self->channel, 0); } + CHECK_ESP_RESULT(result); } diff --git a/ports/espressif/common-hal/pulseio/PulseOut.h b/ports/espressif/common-hal/pulseio/PulseOut.h index 66b01df3188a..f4b39da5b492 100644 --- a/ports/espressif/common-hal/pulseio/PulseOut.h +++ b/ports/espressif/common-hal/pulseio/PulseOut.h @@ -24,17 +24,15 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_PULSEIO_PULSEOUT_H -#define MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_PULSEIO_PULSEOUT_H +#pragma once #include "common-hal/microcontroller/Pin.h" -#include "peripherals/rmt.h" +#include "driver/rmt_types.h" #include "py/obj.h" typedef struct { mp_obj_base_t base; - rmt_channel_t channel; + rmt_channel_handle_t channel; + rmt_encoder_handle_t encoder; } pulseio_pulseout_obj_t; - -#endif // MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_PULSEIO_PULSEOUT_H diff --git a/ports/espressif/common-hal/rgbmatrix/RGBMatrix.c b/ports/espressif/common-hal/rgbmatrix/RGBMatrix.c index 4e3b8d844dbb..4021ee961ab7 100644 --- a/ports/espressif/common-hal/rgbmatrix/RGBMatrix.c +++ b/ports/espressif/common-hal/rgbmatrix/RGBMatrix.c @@ -28,57 +28,42 @@ #include "common-hal/rgbmatrix/RGBMatrix.h" -#include "peripherals/timer.h" +#include "bindings/espidf/__init__.h" + +#include "driver/gptimer.h" void *common_hal_rgbmatrix_timer_allocate(rgbmatrix_rgbmatrix_obj_t *self) { - static const timer_config_t config = { - .alarm_en = false, - .counter_en = false, - .intr_type = TIMER_INTR_LEVEL, - .counter_dir = TIMER_COUNT_UP, - .auto_reload = true, - .divider = 2 // 40MHz + gptimer_config_t config = { + .clk_src = GPTIMER_CLK_SRC_DEFAULT, + .direction = GPTIMER_COUNT_UP, + .resolution_hz = 40000000, + .flags = { + .intr_shared = true + } }; + gptimer_handle_t timer; - timer_index_t *timer = malloc(sizeof(timer_index_t)); - bool res = peripherals_timer_init(&config, timer); - if (!res) { - free(timer); - return NULL; - } - peripherals_timer_never_reset(timer); + CHECK_ESP_RESULT(gptimer_new_timer(&config, &timer)); return timer; } -extern bool _PM_esp32timerCallback(void *arg); - void common_hal_rgbmatrix_timer_enable(void *ptr) { - timer_index_t *timer = (timer_index_t *)ptr; - if (timer->idx == TIMER_MAX) { - return; - } - timer_start(timer->group, timer->idx); + // protomatter does this. } void common_hal_rgbmatrix_timer_disable(void *ptr) { if (ptr == NULL) { return; } - timer_index_t *timer = (timer_index_t *)ptr; - if (timer->idx == TIMER_MAX) { - return; - } - timer_pause(timer->group, timer->idx); + gptimer_handle_t timer = (gptimer_handle_t)ptr; + gptimer_stop(timer); } void common_hal_rgbmatrix_timer_free(void *ptr) { - timer_index_t *timer = (timer_index_t *)ptr; - if (timer->idx == TIMER_MAX) { + if (ptr == NULL) { return; } - common_hal_rgbmatrix_timer_disable(ptr); - timer_disable_intr(timer->group, timer->idx); - timer_isr_callback_remove(timer->group, timer->idx); - peripherals_timer_deinit(timer); - free(timer); + gptimer_handle_t timer = (gptimer_handle_t)ptr; + gptimer_disable(timer); + gptimer_del_timer(timer); } diff --git a/ports/espressif/common-hal/rotaryio/IncrementalEncoder.c b/ports/espressif/common-hal/rotaryio/IncrementalEncoder.c index 88eae061cdd8..15286c5c4aa2 100644 --- a/ports/espressif/common-hal/rotaryio/IncrementalEncoder.c +++ b/ports/espressif/common-hal/rotaryio/IncrementalEncoder.c @@ -24,17 +24,15 @@ * THE SOFTWARE. */ -#include "common-hal/rotaryio/IncrementalEncoder.h" #include "shared-bindings/rotaryio/IncrementalEncoder.h" + +#include "bindings/espidf/__init__.h" #include "common-hal/microcontroller/Pin.h" #include "py/runtime.h" 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); - // This configuration counts on all edges of the quadrature signal: Channel 0 // counts on rising and falling edges of channel A, with the direction set by the // polarity of channel B. Channel 1 does likewise, counting edges of channel B according @@ -43,66 +41,74 @@ void common_hal_rotaryio_incrementalencoder_construct(rotaryio_incrementalencode // // These routines also implicitly configure the weak internal pull-ups, as expected // in CircuitPython. - - // Prepare configuration for the PCNT unit - pcnt_config_t pcnt_config_channel_0 = { - // Set PCNT input signal and control GPIOs - .pulse_gpio_num = pin_a->number, - .ctrl_gpio_num = pin_b->number, - .channel = PCNT_CHANNEL_0, - // What to do on the positive / negative edge of pulse input? - .pos_mode = PCNT_COUNT_DEC, // Count down on the positive edge - .neg_mode = PCNT_COUNT_INC, // Count up on 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 + pcnt_unit_config_t unit_config = { + // Set counter limit + .low_limit = -INT16_MAX, + .high_limit = INT16_MAX }; + // The pulse count driver automatically counts roll overs. + unit_config.flags.accum_count = true; - // Allocate and initialize PCNT unit, CHANNEL_0. - const int8_t unit = peripherals_pcnt_init(&pcnt_config_channel_0); - if (unit == -1) { - mp_raise_RuntimeError(MP_ERROR_TEXT("All PCNT units in use")); - } + // initialize PCNT + CHECK_ESP_RESULT(pcnt_new_unit(&unit_config, &self->unit)); - pcnt_config_t pcnt_config_channel_1 = { - // Set PCNT input signal and control GPIOs - .pulse_gpio_num = pin_b->number, // Pins are reversed from above - .ctrl_gpio_num = pin_a->number, - .channel = PCNT_CHANNEL_1, - // What to do on the positive / negative edge of pulse input? - .pos_mode = PCNT_COUNT_DEC, // Count down on the positive edge - .neg_mode = PCNT_COUNT_INC, // Count up on negative edge - // What to do when control input is low or high? - .lctrl_mode = PCNT_MODE_KEEP, // Keep the primary counter mode if low - .hctrl_mode = PCNT_MODE_REVERSE, // Reverse counting direction if high - .unit = unit, + pcnt_chan_config_t channel_a_config = { + .edge_gpio_num = pin_a->number, + .level_gpio_num = pin_b->number }; + esp_err_t result = pcnt_new_channel(self->unit, &channel_a_config, &self->channel_a); + if (result != ESP_OK) { + pcnt_del_unit(self->unit); + self->unit = NULL; + raise_esp_error(result); + } + pcnt_channel_set_edge_action(self->channel_a, PCNT_CHANNEL_EDGE_ACTION_DECREASE /* pos */, PCNT_CHANNEL_EDGE_ACTION_INCREASE /* neg */); + pcnt_channel_set_level_action(self->channel_a, PCNT_CHANNEL_LEVEL_ACTION_KEEP /* high */, /* low */ PCNT_CHANNEL_LEVEL_ACTION_INVERSE); - // Reinitialize same unit, CHANNEL_1 with different parameters. - peripherals_pcnt_reinit(&pcnt_config_channel_1); + pcnt_chan_config_t channel_b_config = { + .edge_gpio_num = pin_b->number, + .level_gpio_num = pin_a->number + }; + result = pcnt_new_channel(self->unit, &channel_b_config, &self->channel_b); + if (result != ESP_OK) { + pcnt_del_channel(self->channel_a); + pcnt_del_unit(self->unit); + self->unit = NULL; + raise_esp_error(result); + } + pcnt_channel_set_edge_action(self->channel_b, PCNT_CHANNEL_EDGE_ACTION_DECREASE /* pos */, PCNT_CHANNEL_EDGE_ACTION_INCREASE /* neg */); + pcnt_channel_set_level_action(self->channel_b, PCNT_CHANNEL_LEVEL_ACTION_INVERSE /* high */, /* low */ PCNT_CHANNEL_LEVEL_ACTION_KEEP); self->pin_a = pin_a->number; self->pin_b = pin_b->number; - self->unit = (pcnt_unit_t)unit; + + claim_pin(pin_a); + claim_pin(pin_b); + + pcnt_unit_enable(self->unit); + pcnt_unit_start(self->unit); } bool common_hal_rotaryio_incrementalencoder_deinited(rotaryio_incrementalencoder_obj_t *self) { - return self->unit == PCNT_UNIT_MAX; + return self->unit == NULL; } void common_hal_rotaryio_incrementalencoder_deinit(rotaryio_incrementalencoder_obj_t *self) { if (common_hal_rotaryio_incrementalencoder_deinited(self)) { return; } + pcnt_unit_disable(self->unit); reset_pin_number(self->pin_a); reset_pin_number(self->pin_b); - peripherals_pcnt_deinit(&self->unit); - self->unit = PCNT_UNIT_MAX; + pcnt_del_channel(self->channel_a); + pcnt_del_channel(self->channel_b); + pcnt_del_unit(self->unit); + self->unit = NULL; } mp_int_t common_hal_rotaryio_incrementalencoder_get_position(rotaryio_incrementalencoder_obj_t *self) { - int16_t count; - pcnt_get_counter_value(self->unit, &count); + int count; + pcnt_unit_get_count(self->unit, &count); return (count + self->position) / self->divisor; } @@ -110,7 +116,7 @@ mp_int_t common_hal_rotaryio_incrementalencoder_get_position(rotaryio_incrementa void common_hal_rotaryio_incrementalencoder_set_position(rotaryio_incrementalencoder_obj_t *self, mp_int_t new_position) { self->position = new_position * self->divisor; - pcnt_counter_clear(self->unit); + pcnt_unit_clear_count(self->unit); } mp_int_t common_hal_rotaryio_incrementalencoder_get_divisor(rotaryio_incrementalencoder_obj_t *self) { diff --git a/ports/espressif/common-hal/rotaryio/IncrementalEncoder.h b/ports/espressif/common-hal/rotaryio/IncrementalEncoder.h index c43cd62bf674..c02b48d677e8 100644 --- a/ports/espressif/common-hal/rotaryio/IncrementalEncoder.h +++ b/ports/espressif/common-hal/rotaryio/IncrementalEncoder.h @@ -24,18 +24,17 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_ROTARYIO_INCREMENTALENCODER_H -#define MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_ROTARYIO_INCREMENTALENCODER_H +#pragma once #include "py/obj.h" -#include "peripherals/pcnt.h" +#include "driver/pulse_cnt.h" typedef struct { mp_obj_base_t base; uint8_t pin_a, pin_b; mp_int_t position; - pcnt_unit_t unit; + pcnt_unit_handle_t unit; + pcnt_channel_handle_t channel_a; + pcnt_channel_handle_t channel_b; int8_t divisor; // Number of quadrature edges required per count } rotaryio_incrementalencoder_obj_t; - -#endif // MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_ROTARYIO_INCREMENTALENCODER_H diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults index de30ada5414f..c4e7cee59331 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults @@ -19,15 +19,9 @@ # # PCNT Configuration # -CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN=y +CONFIG_PCNT_CTRL_FUNC_IN_IRAM=y # end of PCNT Configuration -# -# RMT Configuration -# -CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y -# end of RMT Configuration - # end of Driver Configurations # diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults index 76a7924f67a0..bf9e57494c73 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults @@ -32,17 +32,6 @@ CONFIG_BT_NIMBLE_EXT_ADV=y # end of Bluetooth -# -# Driver Configurations -# -# -# RMT Configuration -# -CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y -# end of RMT Configuration - -# end of Driver Configurations - # # Wi-Fi # diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32c6.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32c6.defaults index c1776fc47cf8..85dde905f3ca 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32c6.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32c6.defaults @@ -32,15 +32,9 @@ CONFIG_BT_NIMBLE_EXT_ADV=y # # PCNT Configuration # -CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN=y +CONFIG_PCNT_CTRL_FUNC_IN_IRAM=y # end of PCNT Configuration -# -# RMT Configuration -# -CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y -# end of RMT Configuration - # end of Driver Configurations # diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32h2.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32h2.defaults index c1776fc47cf8..85dde905f3ca 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32h2.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32h2.defaults @@ -32,15 +32,9 @@ CONFIG_BT_NIMBLE_EXT_ADV=y # # PCNT Configuration # -CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN=y +CONFIG_PCNT_CTRL_FUNC_IN_IRAM=y # end of PCNT Configuration -# -# RMT Configuration -# -CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y -# end of RMT Configuration - # end of Driver Configurations # diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults index 20eba6263c7e..8efa47508e8c 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults @@ -10,15 +10,9 @@ # # PCNT Configuration # -CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN=y +CONFIG_PCNT_CTRL_FUNC_IN_IRAM=y # end of PCNT Configuration -# -# RMT Configuration -# -CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y -# end of RMT Configuration - # end of Driver Configurations # diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults index 59966474a54e..2bd949fadd29 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults @@ -40,15 +40,9 @@ CONFIG_BT_NIMBLE_EXT_ADV=y # # PCNT Configuration # -CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN=y +CONFIG_PCNT_CTRL_FUNC_IN_IRAM=y # end of PCNT Configuration -# -# RMT Configuration -# -CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y -# end of RMT Configuration - # end of Driver Configurations # diff --git a/ports/espressif/esp-idf-config/sdkconfig.defaults b/ports/espressif/esp-idf-config/sdkconfig.defaults index 758d0efcc314..7f665c7575a9 100644 --- a/ports/espressif/esp-idf-config/sdkconfig.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig.defaults @@ -16,7 +16,8 @@ CONFIG_PARTITION_TABLE_CUSTOM=y # # GPTimer Configuration # -CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN=y +CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM=y +CONFIG_GPTIMER_ISR_IRAM_SAFE=y # end of GPTimer Configuration # end of Driver Configurations diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index 8ca0b2911071..3708cfce7a1c 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -77,6 +77,7 @@ CIRCUITPY_ESPCAMERA = 0 CIRCUITPY_ESPULP = 0 CIRCUITPY_MEMORYMAP = 0 CIRCUITPY_PARALLELDISPLAYBUS = 0 +CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_TOUCHIO ?= 1 CIRCUITPY_TOUCHIO_USE_NATIVE = 0 # Features diff --git a/ports/espressif/peripherals/pcnt.c b/ports/espressif/peripherals/pcnt.c deleted file mode 100644 index fa8a3e05d116..000000000000 --- a/ports/espressif/peripherals/pcnt.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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/pcnt.h" - -#define PCNT_UNIT_ACTIVE 1 -#define PCNT_UNIT_INACTIVE 0 - -static uint8_t pcnt_unit_state[PCNT_UNIT_MAX]; - -void peripherals_pcnt_reset(void) { - for (uint8_t i = 0; i < PCNT_UNIT_MAX; i++) { - pcnt_unit_state[i] = PCNT_UNIT_INACTIVE; - } -} - -static int peripherals_pcnt_get_unit(pcnt_config_t *pcnt_config) { - // Look for available pcnt unit - for (uint8_t i = 0; i < PCNT_UNIT_MAX; i++) { - if (pcnt_unit_state[i] == PCNT_UNIT_INACTIVE) { - pcnt_config->unit = (pcnt_unit_t)i; - pcnt_unit_state[i] = PCNT_UNIT_ACTIVE; - return i; - } - } - - return -1; -} - -void peripherals_pcnt_reinit(pcnt_config_t *pcnt_config) { - // Reinitialize a pcnt unit that has already been allocated. - - // Initialize PCNT unit - pcnt_unit_config(pcnt_config); - - // 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); -} - -int peripherals_pcnt_init(pcnt_config_t *pcnt_config) { - const int8_t unit = peripherals_pcnt_get_unit(pcnt_config); - if (unit == -1) { - return -1; - } - - peripherals_pcnt_reinit(pcnt_config); - - return pcnt_config->unit; -} - -void peripherals_pcnt_deinit(pcnt_unit_t *unit) { - pcnt_unit_state[*unit] = PCNT_UNIT_INACTIVE; - *unit = PCNT_UNIT_MAX; -} diff --git a/ports/espressif/peripherals/pcnt.h b/ports/espressif/peripherals/pcnt.h deleted file mode 100644 index d34d971601a3..000000000000 --- a/ports/espressif/peripherals/pcnt.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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_ESPRESSIF_PERIPHERALS_PCNT_HANDLER_H -#define MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_PCNT_HANDLER_H - -#include "driver/pcnt.h" -#include "soc/pcnt_struct.h" - -extern int peripherals_pcnt_init(pcnt_config_t *pcnt_config); -extern void peripherals_pcnt_reinit(pcnt_config_t *pcnt_config); -extern void peripherals_pcnt_deinit(pcnt_unit_t *unit); -extern void peripherals_pcnt_reset(void); - -#endif // MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_PCNT_HANDLER_H diff --git a/ports/espressif/peripherals/rmt.c b/ports/espressif/peripherals/rmt.c deleted file mode 100644 index 8dea2c0ab1bc..000000000000 --- a/ports/espressif/peripherals/rmt.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * This file is part of the Micro Python project, http://micropython.org/ - * - * The MIT License (MIT) - * - * 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 - * 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/rmt.h" -#include "py/runtime.h" - -bool rmt_reserved_channels[RMT_CHANNEL_MAX]; - -void peripherals_rmt_reset(void) { - for (size_t i = 0; i < RMT_CHANNEL_MAX; i++) { - if (rmt_reserved_channels[i]) { - peripherals_free_rmt(i); - } - } -} - -rmt_channel_t peripherals_find_and_reserve_rmt(bool mode) { - size_t start_channel = 0; - size_t end_channel = RMT_CHANNEL_MAX; - // ESP32C3 can only send on channels 0-1 and receive on channels 2-3 - #if defined(CONFIG_IDF_TARGET_ESP32C3) - if (mode == RECEIVE_MODE) { - start_channel = 2; - } else { - end_channel = 2; - } - #endif // ESP32C3 - #if SOC_RMT_CHANNELS_PER_GROUP > 4 - if (mode == RECEIVE_MODE) { - start_channel = 4; - } else { - end_channel = 4; - } - #endif - for (size_t i = start_channel; i < end_channel; i++) { - if (!rmt_reserved_channels[i]) { - rmt_reserved_channels[i] = true; - return i; - } - } - // Returning the max indicates a reservation failure. - return RMT_CHANNEL_MAX; -} - -void peripherals_free_rmt(rmt_channel_t chan) { - rmt_reserved_channels[chan] = false; - rmt_driver_uninstall(chan); -} diff --git a/ports/espressif/peripherals/rmt.h b/ports/espressif/peripherals/rmt.h deleted file mode 100644 index 08a446636efc..000000000000 --- a/ports/espressif/peripherals/rmt.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * This file is part of the Micro Python project, http://micropython.org/ - * - * The MIT License (MIT) - * - * 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 - * 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_ESPRESSIF_PERIPHERALS_RMT_H -#define MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_RMT_H - -#include - -#include "py/mphal.h" -#include "driver/rmt.h" - -#define TRANSMIT_MODE true -#define RECEIVE_MODE false - -void peripherals_rmt_reset(void); -rmt_channel_t peripherals_find_and_reserve_rmt(bool mode); -void peripherals_free_rmt(rmt_channel_t chan); - -#endif // MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_RMT_H diff --git a/ports/espressif/peripherals/timer.c b/ports/espressif/peripherals/timer.c deleted file mode 100644 index 8e516756b6a8..000000000000 --- a/ports/espressif/peripherals/timer.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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_NEVER_RESET 2 -#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); - } - } - } -} - -bool 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++) { - 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; - break_loop = true; - break; - } else if (i == 1 && j == 1) { - timer->idx = TIMER_MAX; - timer->group = TIMER_GROUP_MAX; - return false; - } - } - if (break_loop) { - break; - } - } - - timer->hw = (timer->group == 0) ? &TIMERG0 : &TIMERG1; - - // initialize timer module - timer_init(timer->group, timer->idx, config); - timer_set_counter_value(timer->group, timer->idx, 0); - - return true; -} - -void peripherals_timer_deinit(timer_index_t *timer) { - if (timer->group == TIMER_GROUP_MAX || timer->idx == TIMER_MAX) { - return; - } - timer_deinit(timer->group, timer->idx); - int i = timer->group; - int j = timer->idx; - timer->group = TIMER_GROUP_MAX; - timer->idx = TIMER_MAX; - timer_state[i][j] = TIMER_FREE; -} - -void peripherals_timer_never_reset(timer_index_t *timer) { - timer_deinit(timer->group, timer->idx); - int i = timer->group; - int j = timer->idx; - timer_state[i][j] = TIMER_NEVER_RESET; -} diff --git a/ports/espressif/peripherals/timer.h b/ports/espressif/peripherals/timer.h deleted file mode 100644 index 82dcc7838aa4..000000000000 --- a/ports/espressif/peripherals/timer.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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_ESPRESSIF_PERIPHERALS_TIMER_HANDLER_H -#define MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_TIMER_HANDLER_H - -#include "driver/timer.h" -#include "soc/timer_group_struct.h" - -typedef struct { - timg_dev_t *hw; - timer_idx_t idx; - timer_group_t group; -} timer_index_t; - -extern bool 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); -extern void peripherals_timer_never_reset(timer_index_t *timer); - -#endif // MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_TIMER_HANDLER_H diff --git a/ports/espressif/supervisor/port.c b/ports/espressif/supervisor/port.c index 2991a2786fe0..14cc1b590238 100644 --- a/ports/espressif/supervisor/port.c +++ b/ports/espressif/supervisor/port.c @@ -62,13 +62,6 @@ #include "shared-bindings/socketpool/__init__.h" #include "shared-module/os/__init__.h" -#include "peripherals/rmt.h" -#include "peripherals/timer.h" - -#if CIRCUITPY_COUNTIO || CIRCUITPY_ROTARYIO || CIRCUITPY_FREQUENCYIO -#include "peripherals/pcnt.h" -#endif - #if CIRCUITPY_TOUCHIO_USE_NATIVE #include "peripherals/touch.h" #endif @@ -366,10 +359,6 @@ void reset_port(void) { uart_reset(); #endif - #if CIRCUITPY_COUNTIO || CIRCUITPY_ROTARYIO || CIRCUITPY_FREQUENCYIO - peripherals_pcnt_reset(); - #endif - #if CIRCUITPY_DUALBANK dualbank_reset(); #endif @@ -382,19 +371,10 @@ void reset_port(void) { espulp_reset(); #endif - #if CIRCUITPY_FREQUENCYIO - peripherals_timer_reset(); - #endif - #if CIRCUITPY_PS2IO ps2_reset(); #endif - #if CIRCUITPY_PULSEIO - peripherals_rmt_reset(); - pulsein_reset(); - #endif - #if CIRCUITPY_PWMIO pwmout_reset(); #endif diff --git a/ports/espressif/tools/update_sdkconfig.py b/ports/espressif/tools/update_sdkconfig.py index efae6a4dc14e..1fb354c6c9ee 100644 --- a/ports/espressif/tools/update_sdkconfig.py +++ b/ports/espressif/tools/update_sdkconfig.py @@ -198,9 +198,9 @@ def update(debug, board, update_all): ble_enabled = not (value == "0") os.environ["IDF_TARGET"] = target - os.environ[ - "COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE" - ] = f"build-{board}/esp-idf/kconfigs_projbuild.in" + os.environ["COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE"] = ( + f"build-{board}/esp-idf/kconfigs_projbuild.in" + ) os.environ["COMPONENT_KCONFIGS_SOURCE_FILE"] = f"build-{board}/esp-idf/kconfigs.in" kconfig_path = pathlib.Path(f"build-{board}/esp-idf/kconfigs.in") diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base/pins.c b/ports/raspberrypi/boards/pimoroni_pico_dv_base/pins.c index d5fe927474ba..15820028ec83 100644 --- a/ports/raspberrypi/boards/pimoroni_pico_dv_base/pins.c +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base/pins.c @@ -53,7 +53,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { 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_I2S_WORD_SELECT), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_I2S_DATA), MP_ROM_PTR(&pin_GPIO26) }, { 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) }, @@ -63,7 +63,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { 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_I2S_DATA), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_I2S_WORD_SELECT), MP_ROM_PTR(&pin_GPIO28) }, { 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) }, diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c index 8e0545b68999..c15484427455 100644 --- a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c @@ -50,7 +50,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_CYW2) }, - { MP_ROM_QSTR(MP_QSTR_I2S_WORD_SELECT), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_I2S_DATA), MP_ROM_PTR(&pin_GPIO26) }, { 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) }, @@ -60,7 +60,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { 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_I2S_DATA), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_I2S_WORD_SELECT), MP_ROM_PTR(&pin_GPIO28) }, { 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) }, diff --git a/py/formatfloat.c b/py/formatfloat.c index 7cd471018da9..a2855b8afc3c 100644 --- a/py/formatfloat.c +++ b/py/formatfloat.c @@ -80,6 +80,7 @@ static inline int fp_isless1(float x) { #elif MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_DOUBLE +#pragma GCC diagnostic ignored "-Wfloat-equal" #define FPTYPE double #define FPCONST(x) x #define FPROUND_TO_ONE 0.999999999995 diff --git a/shared-bindings/_bleio/CharacteristicBuffer.c b/shared-bindings/_bleio/CharacteristicBuffer.c index fbdc94af0e22..d8f94b79e18f 100644 --- a/shared-bindings/_bleio/CharacteristicBuffer.c +++ b/shared-bindings/_bleio/CharacteristicBuffer.c @@ -99,12 +99,14 @@ STATIC void check_for_deinit(bleio_characteristic_buffer_obj_t *self) { //| :return: Data read //| :rtype: bytes or None""" //| ... +//| //| def readinto(self, buf: WriteableBuffer) -> Optional[int]: //| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes. //| //| :return: number of bytes read and stored into ``buf`` //| :rtype: int or None (on a non-blocking error)""" //| ... +//| //| def readline(self) -> bytes: //| """Read a line, ending in a newline character. //| diff --git a/shared-bindings/_bleio/Connection.c b/shared-bindings/_bleio/Connection.c index 4330b2344a74..8185ed041dc9 100644 --- a/shared-bindings/_bleio/Connection.c +++ b/shared-bindings/_bleio/Connection.c @@ -72,6 +72,7 @@ void bleio_connection_ensure_connected(bleio_connection_obj_t *self) { //| Connections may also be made when another device initiates a connection. To use a Connection //| created by a peer, read the `Adapter.connections` property.""" //| ... +//| //| def disconnect(self) -> None: //| """Disconnects from the remote peripheral. Does nothing if already disconnected.""" //| ... diff --git a/shared-bindings/_bleio/Descriptor.c b/shared-bindings/_bleio/Descriptor.c index f91e7cb6e6b3..a0bec461a39f 100644 --- a/shared-bindings/_bleio/Descriptor.c +++ b/shared-bindings/_bleio/Descriptor.c @@ -44,6 +44,7 @@ //| and attached to a Characteristic by calling `add_to_characteristic()`. //| Remote Descriptor objects are created by `Connection.discover_remote_services()` //| as part of remote Characteristics in the remote Services that are discovered.""" +//| //| @classmethod //| def add_to_characteristic( //| cls, diff --git a/shared-bindings/_bleio/ScanEntry.c b/shared-bindings/_bleio/ScanEntry.c index f03048e7c433..cabf43493bd5 100644 --- a/shared-bindings/_bleio/ScanEntry.c +++ b/shared-bindings/_bleio/ScanEntry.c @@ -44,6 +44,7 @@ //| def __init__(self) -> None: //| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`.""" //| ... +//| //| def matches(self, prefixes: ScanEntry, *, match_all: bool = True) -> bool: //| """Returns True if the ScanEntry matches all prefixes when ``match_all`` is True. This is stricter //| than the scan filtering which accepts any advertisements that match any of the prefixes diff --git a/shared-bindings/_bleio/ScanResults.c b/shared-bindings/_bleio/ScanResults.c index 81d4e66bced5..41f582c7e061 100644 --- a/shared-bindings/_bleio/ScanResults.c +++ b/shared-bindings/_bleio/ScanResults.c @@ -49,9 +49,11 @@ STATIC mp_obj_t scanresults_iternext(mp_obj_t self_in) { //| def __init__(self) -> None: //| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`.""" //| ... +//| //| def __iter__(self) -> Iterator[ScanEntry]: //| """Returns itself since it is the iterator.""" //| ... +//| //| def __next__(self) -> ScanEntry: //| """Returns the next `_bleio.ScanEntry`. Blocks if none have been received and scanning is still //| active. Raises `StopIteration` if scanning is finished and no other results are available. diff --git a/shared-bindings/_pixelmap/PixelMap.c b/shared-bindings/_pixelmap/PixelMap.c index d61bd7bf4379..a4a16860d502 100644 --- a/shared-bindings/_pixelmap/PixelMap.c +++ b/shared-bindings/_pixelmap/PixelMap.c @@ -160,10 +160,12 @@ MP_DEFINE_CONST_FUN_OBJ_2(pixelmap_pixelmap_indices_obj, pixelmap_pixelmap_indic //| def __getitem__(self, index: slice) -> PixelReturnSequence: //| """Retrieve the value of the underlying pixels.""" //| ... +//| //| @overload //| def __getitem__(self, index: int) -> PixelReturnType: //| """Retrieve the value of one of the underlying pixels at 'index'.""" //| ... +//| //| @overload //| def __setitem__(self, index: slice, value: PixelSequence) -> None: ... //| @overload diff --git a/shared-bindings/adafruit_pixelbuf/PixelBuf.c b/shared-bindings/adafruit_pixelbuf/PixelBuf.c index 44eebb5c2207..9f2c59ed4050 100644 --- a/shared-bindings/adafruit_pixelbuf/PixelBuf.c +++ b/shared-bindings/adafruit_pixelbuf/PixelBuf.c @@ -268,12 +268,14 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_fill_obj, pixelbuf_pixelbuf_f //| between 0 and 255. When in PWM (DotStar) mode, the 4th tuple value is a float of the pixel //| intensity from 0-1.0.""" //| ... +//| //| @overload //| def __getitem__(self, index: int) -> PixelReturnType: //| """Returns the pixel value at the given index as a tuple of (Red, Green, Blue[, White]) values //| between 0 and 255. When in PWM (DotStar) mode, the 4th tuple value is a float of the pixel //| intensity from 0-1.0.""" //| ... +//| //| @overload //| def __setitem__(self, index: slice, value: PixelSequence) -> None: ... //| @overload diff --git a/shared-bindings/alarm/SleepMemory.c b/shared-bindings/alarm/SleepMemory.c index 1ba94fae3805..acef77e6b7cd 100644 --- a/shared-bindings/alarm/SleepMemory.c +++ b/shared-bindings/alarm/SleepMemory.c @@ -53,11 +53,13 @@ //| def __init__(self) -> None: //| """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`)""" //| ... @@ -85,6 +87,7 @@ STATIC MP_DEFINE_CONST_DICT(alarm_sleep_memory_locals_dict, alarm_sleep_memory_l //| def __getitem__(self, index: int) -> int: //| """Returns the value at the given index.""" //| ... +//| //| @overload //| def __setitem__(self, index: slice, value: ReadableBuffer) -> None: ... //| @overload diff --git a/shared-bindings/canio/Listener.c b/shared-bindings/canio/Listener.c index 8e3de9c7e53d..1a806d083c0e 100644 --- a/shared-bindings/canio/Listener.c +++ b/shared-bindings/canio/Listener.c @@ -80,6 +80,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(canio_listener_in_waiting_obj, canio_listener_i //| This method exists so that `Listener` can be used as an //| iterable""" //| ... +//| //| def __next__(self) -> Union[RemoteTransmissionRequest, Message]: //| """Reads a message, after waiting up to self.timeout seconds //| diff --git a/shared-bindings/displayio/Bitmap.c b/shared-bindings/displayio/Bitmap.c index 116d82c4981c..36afff36d603 100644 --- a/shared-bindings/displayio/Bitmap.c +++ b/shared-bindings/displayio/Bitmap.c @@ -139,6 +139,7 @@ MP_PROPERTY_GETTER(displayio_bitmap_bits_per_value_obj, //| //| print(bitmap[0,1])""" //| ... +//| //| def __setitem__(self, index: Union[Tuple[int, int], int], value: int) -> None: //| """Sets the value at the given index. The index can either be an x,y tuple or an int equal //| to ``y * width + x``. diff --git a/shared-bindings/displayio/Group.c b/shared-bindings/displayio/Group.c index 7bde6095934d..063f2c98a28d 100644 --- a/shared-bindings/displayio/Group.c +++ b/shared-bindings/displayio/Group.c @@ -281,6 +281,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) { //| //| print(group[0])""" //| ... +//| //| def __setitem__( //| self, //| index: int, @@ -292,6 +293,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) { //| //| group[0] = sprite""" //| ... +//| //| def __delitem__(self, index: int) -> None: //| """Deletes the value at the given index. //| diff --git a/shared-bindings/displayio/Palette.c b/shared-bindings/displayio/Palette.c index 2b2fa237f00b..8dbde1568f45 100644 --- a/shared-bindings/displayio/Palette.c +++ b/shared-bindings/displayio/Palette.c @@ -104,6 +104,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) { //| def __getitem__(self, index: int) -> Optional[int]: //| r"""Return the pixel color at the given index as an integer.""" //| ... +//| //| def __setitem__( //| self, index: int, value: Union[int, ReadableBuffer, Tuple[int, int, int]] //| ) -> None: diff --git a/shared-bindings/displayio/TileGrid.c b/shared-bindings/displayio/TileGrid.c index 7675319593d0..fb9e69b03210 100644 --- a/shared-bindings/displayio/TileGrid.c +++ b/shared-bindings/displayio/TileGrid.c @@ -409,6 +409,7 @@ MP_PROPERTY_GETSET(displayio_tilegrid_bitmap_obj, //| //| print(grid[0])""" //| ... +//| //| def __setitem__(self, index: Union[Tuple[int, int], int], value: int) -> None: //| """Sets the tile index at the given index. The index can either be an x,y tuple or an int equal //| to ``y * width + x``. diff --git a/shared-bindings/fontio/BuiltinFont.c b/shared-bindings/fontio/BuiltinFont.c index d68e0ccc096e..7b6571890313 100644 --- a/shared-bindings/fontio/BuiltinFont.c +++ b/shared-bindings/fontio/BuiltinFont.c @@ -47,6 +47,7 @@ //| The two element version is ``(width, height)``, in which //| ``x_offset`` and ``y_offset`` are assumed to be zero.""" //| pass +//| //| def get_glyph(self, codepoint: int) -> Optional[Glyph]: //| """Retrieve the Glyph for a given code point //| diff --git a/shared-bindings/frequencyio/FrequencyIn.c b/shared-bindings/frequencyio/FrequencyIn.c index 1cb46887a041..250a31ce5bad 100644 --- a/shared-bindings/frequencyio/FrequencyIn.c +++ b/shared-bindings/frequencyio/FrequencyIn.c @@ -72,8 +72,6 @@ STATIC mp_obj_t frequencyio_frequencyin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { mp_arg_check_num(n_args, n_kw, 1, 1, true); - frequencyio_frequencyin_obj_t *self = - mp_obj_malloc(frequencyio_frequencyin_obj_t, &frequencyio_frequencyin_type); enum { ARG_pin, ARG_capture_period }; static const mp_arg_t allowed_args[] = { { MP_QSTR_pin, MP_ARG_REQUIRED | MP_ARG_OBJ }, @@ -86,6 +84,8 @@ STATIC mp_obj_t frequencyio_frequencyin_make_new(const mp_obj_type_t *type, size const uint16_t capture_period = args[ARG_capture_period].u_int; + frequencyio_frequencyin_obj_t *self = m_new_obj_with_finaliser(frequencyio_frequencyin_obj_t); + self->base.type = &frequencyio_frequencyin_type; common_hal_frequencyio_frequencyin_construct(self, pin, capture_period); return MP_OBJ_FROM_PTR(self); @@ -207,6 +207,7 @@ MP_PROPERTY_GETTER(frequencyio_frequencyin_value_obj, STATIC const mp_rom_map_elem_t frequencyio_frequencyin_locals_dict_table[] = { // Methods { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&frequencyio_frequencyin_deinit_obj) }, + { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&frequencyio_frequencyin_deinit_obj) }, { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) }, { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&frequencyio_frequencyin___exit___obj) }, { MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&frequencyio_frequencyin_value_obj) }, diff --git a/shared-bindings/keypad/EventQueue.c b/shared-bindings/keypad/EventQueue.c index 1c10d23d67d3..ee34b4009441 100644 --- a/shared-bindings/keypad/EventQueue.c +++ b/shared-bindings/keypad/EventQueue.c @@ -100,6 +100,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(keypad_eventqueue_clear_obj, keypad_eventqueue_clear); //| This is an easy way to check if the queue is empty. //| """ //| ... +//| //| def __len__(self) -> int: //| """Return the number of events currently in the queue. Used to implement ``len()``.""" //| ... diff --git a/shared-bindings/memorymap/AddressRange.c b/shared-bindings/memorymap/AddressRange.c index 51724d3b77d4..0a37468dea70 100644 --- a/shared-bindings/memorymap/AddressRange.c +++ b/shared-bindings/memorymap/AddressRange.c @@ -72,6 +72,7 @@ //| # print GPIO16 pad drive strength //| print(rp2040_get_pad_drive(16)) //| """ +//| //| def __init__(self, *, start, length) -> None: //| """Constructs an address range starting at ``start`` and ending at @@ -144,6 +145,7 @@ STATIC MP_DEFINE_CONST_DICT(memorymap_addressrange_locals_dict, memorymap_addres //| when possible. //| All others may use multiple transactions.""" //| ... +//| //| @overload //| def __setitem__(self, index: slice, value: ReadableBuffer) -> None: ... //| @overload diff --git a/shared-bindings/nvm/ByteArray.c b/shared-bindings/nvm/ByteArray.c index 87ccf24fa506..2d4e073ece0b 100644 --- a/shared-bindings/nvm/ByteArray.c +++ b/shared-bindings/nvm/ByteArray.c @@ -41,6 +41,7 @@ //| import microcontroller //| microcontroller.nvm[0:3] = b"\xcc\x10\x00" //| """ +//| //| def __init__(self) -> None: //| """Not currently dynamically supported. Access the sole instance through `microcontroller.nvm`.""" @@ -74,6 +75,7 @@ STATIC MP_DEFINE_CONST_DICT(nvm_bytearray_locals_dict, nvm_bytearray_locals_dict //| def __getitem__(self, index: int) -> int: //| """Returns the value at the given index.""" //| ... +//| //| @overload //| def __setitem__(self, index: slice, value: ReadableBuffer) -> None: ... //| @overload diff --git a/shared-bindings/pulseio/PulseIn.c b/shared-bindings/pulseio/PulseIn.c index 8a94da1dfd02..fe2357039dcf 100644 --- a/shared-bindings/pulseio/PulseIn.c +++ b/shared-bindings/pulseio/PulseIn.c @@ -179,7 +179,7 @@ STATIC mp_obj_t pulseio_pulsein_obj_clear(mp_obj_t self_in) { MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulsein_clear_obj, pulseio_pulsein_obj_clear); //| def popleft(self) -> int: -//| """Removes and returns the oldest read pulse.""" +//| """Removes and returns the oldest read pulse duration in microseconds.""" //| ... STATIC mp_obj_t pulseio_pulsein_obj_popleft(mp_obj_t self_in) { pulseio_pulsein_obj_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/pulseio/PulseOut.c b/shared-bindings/pulseio/PulseOut.c index 3a7151768c6b..0f615b7e1efe 100644 --- a/shared-bindings/pulseio/PulseOut.c +++ b/shared-bindings/pulseio/PulseOut.c @@ -80,7 +80,8 @@ STATIC mp_obj_t pulseio_pulseout_make_new(const mp_obj_type_t *type, size_t n_ar mp_int_t frequency = args[ARG_frequency].u_int; mp_int_t duty_cycle = args[ARG_duty_cycle].u_int; - pulseio_pulseout_obj_t *self = mp_obj_malloc(pulseio_pulseout_obj_t, &pulseio_pulseout_type); + pulseio_pulseout_obj_t *self = m_new_obj_with_finaliser(pulseio_pulseout_obj_t); + self->base.type = &pulseio_pulseout_type; common_hal_pulseio_pulseout_construct(self, pin, frequency, duty_cycle); return MP_OBJ_FROM_PTR(self); } @@ -141,6 +142,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(pulseio_pulseout_send_obj, pulseio_pulseout_obj_send); STATIC const mp_rom_map_elem_t pulseio_pulseout_locals_dict_table[] = { // Methods { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&pulseio_pulseout_deinit_obj) }, + { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&pulseio_pulseout_deinit_obj) }, { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) }, { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&pulseio_pulseout___exit___obj) }, { MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&pulseio_pulseout_send_obj) }, diff --git a/shared-bindings/random/__init__.c b/shared-bindings/random/__init__.c index 92cd775fb740..8076ddfeecc8 100644 --- a/shared-bindings/random/__init__.c +++ b/shared-bindings/random/__init__.c @@ -65,8 +65,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(random_seed_obj, random_seed); //| ... //| STATIC mp_obj_t random_getrandbits(mp_obj_t num_in) { - int n = mp_obj_get_int(num_in); - if (n > 32 || n == 0) { + mp_int_t n = mp_obj_get_int(num_in); + if (n > 32 || n < 0) { mp_raise_ValueError(NULL); } return mp_obj_new_int_from_uint(shared_modules_random_getrandbits((uint8_t)n)); diff --git a/shared-bindings/storage/__init__.c b/shared-bindings/storage/__init__.c index 71bd421e3b4d..608f0d4d3ce6 100644 --- a/shared-bindings/storage/__init__.c +++ b/shared-bindings/storage/__init__.c @@ -275,30 +275,38 @@ STATIC const mp_rom_map_elem_t storage_module_globals_table[] = { //| larger filesystems, but you will need to format the filesystem on another device. //| """ //| ... +//| //| def open(self, path: str, mode: str) -> None: //| """Like builtin ``open()``""" //| ... +//| //| def ilistdir( //| self, path: str //| ) -> Iterator[Union[Tuple[AnyStr, int, int, int], Tuple[AnyStr, int, int]]]: //| """Return an iterator whose values describe files and folders within //| ``path``""" //| ... +//| //| def mkdir(self, path: str) -> None: //| """Like `os.mkdir`""" //| ... +//| //| def rmdir(self, path: str) -> None: //| """Like `os.rmdir`""" //| ... +//| //| def stat(self, path: str) -> Tuple[int, int, int, int, int, int, int, int, int, int]: //| """Like `os.stat`""" //| ... +//| //| def statvfs(self, path: int) -> Tuple[int, int, int, int, int, int, int, int, int, int]: //| """Like `os.statvfs`""" //| ... +//| //| def mount(self, readonly: bool, mkfs: VfsFat) -> None: //| """Don't call this directly, call `storage.mount`.""" //| ... +//| //| def umount(self) -> None: //| """Don't call this directly, call `storage.umount`.""" //| ... diff --git a/shared-bindings/time/__init__.c b/shared-bindings/time/__init__.c index 0c78d55d6ed6..15b58e8010fe 100644 --- a/shared-bindings/time/__init__.c +++ b/shared-bindings/time/__init__.c @@ -65,7 +65,7 @@ //| STATIC mp_obj_t time_monotonic(void) { uint64_t ticks_ms = common_hal_time_monotonic_ms(); - return mp_obj_new_float(uint64_to_float(ticks_ms) / 1000.0f); + return mp_obj_new_float(uint64_to_float(ticks_ms) / MICROPY_FLOAT_CONST(1000.0)); } MP_DEFINE_CONST_FUN_OBJ_0(time_monotonic_obj, time_monotonic); @@ -78,7 +78,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(time_monotonic_obj, time_monotonic); STATIC mp_obj_t time_sleep(mp_obj_t seconds_o) { #if MICROPY_PY_BUILTINS_FLOAT mp_float_t seconds = mp_obj_get_float(seconds_o); - mp_float_t msecs = 1000.0f * seconds + 0.5f; + mp_float_t msecs = MICROPY_FLOAT_CONST(1000.0) * seconds + MICROPY_FLOAT_CONST(0.5); #else mp_int_t seconds = mp_obj_get_int(seconds_o); mp_int_t msecs = 1000 * seconds; diff --git a/shared-bindings/usb_cdc/Serial.c b/shared-bindings/usb_cdc/Serial.c index 4ef61685b75f..696e401f6203 100644 --- a/shared-bindings/usb_cdc/Serial.c +++ b/shared-bindings/usb_cdc/Serial.c @@ -41,6 +41,7 @@ //| """You cannot create an instance of `usb_cdc.Serial`. //| The available instances are in the ``usb_cdc.serials`` tuple.""" //| ... +//| //| def read(self, size: int = 1) -> bytes: //| """Read at most ``size`` bytes. If ``size`` exceeds the internal buffer size //| only the bytes in the buffer will be read. If `timeout` is > 0 or ``None``, @@ -50,6 +51,7 @@ //| :return: Data read //| :rtype: bytes""" //| ... +//| //| def readinto(self, buf: WriteableBuffer) -> int: //| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes. If `timeout` //| is > 0 or ``None``, keep waiting until the timeout expires or ``len(buf)`` @@ -58,6 +60,7 @@ //| :return: number of bytes read and stored into ``buf`` //| :rtype: int""" //| ... +//| //| def readline(self, size: int = -1) -> Optional[bytes]: //| r"""Read a line ending in a newline character ("\\n"), including the newline. //| Return everything readable if no newline is found and ``timeout`` is 0. @@ -70,6 +73,7 @@ //| :return: the line read //| :rtype: bytes or None""" //| ... +//| //| def readlines(self) -> List[Optional[bytes]]: //| """Read multiple lines as a list, using `readline()`. //| @@ -79,12 +83,14 @@ //| :return: a list of the line read //| :rtype: list""" //| ... +//| //| def write(self, buf: ReadableBuffer) -> int: //| """Write as many bytes as possible from the buffer of bytes. //| //| :return: the number of bytes written //| :rtype: int""" //| ... +//| //| def flush(self) -> None: //| """Force out any unwritten bytes, waiting until they are written.""" //| ... diff --git a/shared-bindings/usb_midi/PortIn.c b/shared-bindings/usb_midi/PortIn.c index c8e5c6b31422..cd6b03c1a4d6 100644 --- a/shared-bindings/usb_midi/PortIn.c +++ b/shared-bindings/usb_midi/PortIn.c @@ -55,6 +55,7 @@ //| :return: Data read //| :rtype: bytes or None""" //| ... +//| //| def readinto(self, buf: WriteableBuffer, nbytes: Optional[int] = None) -> Optional[bytes]: //| """Read bytes into the ``buf``. If ``nbytes`` is specified then read at most //| that many bytes. Otherwise, read at most ``len(buf)`` bytes. diff --git a/shared-bindings/wifi/ScannedNetworks.c b/shared-bindings/wifi/ScannedNetworks.c index 82e8a53b22c8..cb91829a9e1f 100644 --- a/shared-bindings/wifi/ScannedNetworks.c +++ b/shared-bindings/wifi/ScannedNetworks.c @@ -50,9 +50,11 @@ STATIC mp_obj_t scannednetworks_iternext(mp_obj_t self_in) { //| def __init__(self) -> None: //| """Cannot be instantiated directly. Use `wifi.Radio.start_scanning_networks`.""" //| ... +//| //| def __iter__(self) -> Iterator[Network]: //| """Returns itself since it is the iterator.""" //| ... +//| //| def __next__(self) -> Network: //| """Returns the next `wifi.Network`. //| Raises `StopIteration` if scanning is finished and no other results are available.""" diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index 0ef7b0b71c99..9fe4d5e94e5d 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -27,6 +27,7 @@ #include #include "shared-module/displayio/__init__.h" +#include "shared-bindings/displayio/__init__.h" #include "shared/runtime/interrupt_char.h" #include "py/runtime.h" @@ -38,7 +39,6 @@ #include "supervisor/shared/display.h" #include "supervisor/shared/reload.h" -#include "supervisor/spi_flash_api.h" #include "py/mpconfig.h" #if CIRCUITPY_BUSDISPLAY @@ -54,6 +54,10 @@ #include "shared-module/sharpdisplay/SharpMemoryFramebuffer.h" #endif +#ifdef BOARD_USE_INTERNAL_SPI +#include "supervisor/spi_flash_api.h" +#endif + primary_display_bus_t display_buses[CIRCUITPY_DISPLAY_LIMIT]; primary_display_t displays[CIRCUITPY_DISPLAY_LIMIT]; diff --git a/shared-module/epaperdisplay/EPaperDisplay.h b/shared-module/epaperdisplay/EPaperDisplay.h index 7cd0be915f0a..b3ea040123a2 100644 --- a/shared-module/epaperdisplay/EPaperDisplay.h +++ b/shared-module/epaperdisplay/EPaperDisplay.h @@ -26,12 +26,12 @@ #pragma once -#include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/displayio/Group.h" #include "shared-module/displayio/area.h" #include "shared-module/displayio/bus_core.h" #include "shared-module/displayio/display_core.h" +#include "common-hal/digitalio/DigitalInOut.h" typedef struct { mp_obj_base_t base; diff --git a/shared-module/framebufferio/FramebufferDisplay.h b/shared-module/framebufferio/FramebufferDisplay.h index 47f31d794f79..9f6b04e2f9f7 100644 --- a/shared-module/framebufferio/FramebufferDisplay.h +++ b/shared-module/framebufferio/FramebufferDisplay.h @@ -31,7 +31,6 @@ #include "py/obj.h" #include "py/proto.h" -#include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/displayio/Group.h" #include "shared-module/displayio/area.h" diff --git a/shared-module/random/__init__.c b/shared-module/random/__init__.c index 438eb24696e5..8796dc91079e 100644 --- a/shared-module/random/__init__.c +++ b/shared-module/random/__init__.c @@ -80,6 +80,9 @@ void shared_modules_random_seed(mp_uint_t seed) { } mp_uint_t shared_modules_random_getrandbits(uint8_t n) { + if (n == 0) { + return 0; + } uint32_t mask = ~0; // Beware of C undefined behavior when shifting by >= than bit size mask >>= (32 - n); diff --git a/shared-module/supervisor/StatusBar.c b/shared-module/supervisor/StatusBar.c index 9b6fe9b849c7..13c99c72e2f4 100644 --- a/shared-module/supervisor/StatusBar.c +++ b/shared-module/supervisor/StatusBar.c @@ -60,7 +60,7 @@ bool shared_module_supervisor_status_bar_get_display(supervisor_status_bar_obj_t return self->display; } -#if CIRCUITPY_TERMINALIO +#if CIRCUITPY_STATUS_BAR && CIRCUITPY_TERMINALIO void shared_module_supervisor_status_bar_set_display(supervisor_status_bar_obj_t *self, bool enabled) { if (self->display == enabled) { // Do nothing if not changing the state. diff --git a/tools/analyze_heap_dump.py b/tools/analyze_heap_dump.py index 18da11c456ff..a5e5e1d48eab 100755 --- a/tools/analyze_heap_dump.py +++ b/tools/analyze_heap_dump.py @@ -270,9 +270,9 @@ def load_pointer(address): manual_symbol_map["0x200015e0"] = "mp_state_ctx.vm.dict_main" for i in range(READLINE_HIST_SIZE): - manual_symbol_map[ - "mp_state_ctx+{}".format(148 + i * 4) - ] = "mp_state_ctx.vm.readline_hist[{}]".format(i) + manual_symbol_map["mp_state_ctx+{}".format(148 + i * 4)] = ( + "mp_state_ctx.vm.readline_hist[{}]".format(i) + ) tuple_type = symbols["mp_type_tuple"][0] type_type = symbols["mp_type_type"][0] @@ -534,10 +534,10 @@ def format(obj): ) node.attr["shape"] = "plaintext" node.attr["style"] = "invisible" - node.attr[ - "label" - ] = '<{}
0x{:08x}
>'.format( - block, rows + node.attr["label"] = ( + '<{}
0x{:08x}
>'.format( + block, rows + ) ) for node, degree in ownership_graph.in_degree_iter(): @@ -616,10 +616,10 @@ def format(obj): remaining_bytecode -= 16 for i in range(remaining_bytecode // 16): rows += '' - node.attr[ - "label" - ] = '<{}
0x{:08x}
>'.format( - block, rows + node.attr["label"] = ( + '<{}
0x{:08x}
>'.format( + block, rows + ) ) for block in qstr_chunks: @@ -653,10 +653,10 @@ def format(obj): for i in range(0, len(printable_qstrs), 16): wrapped.append(html.escape(printable_qstrs[i : i + 16])) node = ownership_graph.get_node(block) - node.attr[ - "label" - ] = '<
0x{:08x}
{}
>'.format( - block, 18 * (len(wrapped) - 1), "
".join(wrapped) + node.attr["label"] = ( + '<
0x{:08x}
{}
>'.format( + block, 18 * (len(wrapped) - 1), "
".join(wrapped) + ) ) node.attr["fontname"] = "FiraCode-Bold" node.attr["fontcolor"] = "black" @@ -734,10 +734,10 @@ def format(obj): rows += '{}{}'.format( cells[2 * i][0], cells[2 * i][1], cells[2 * i + 1][0], cells[2 * i + 1][1] ) - node.attr[ - "label" - ] = '<{}
>'.format( - rows + node.attr["label"] = ( + '<{}
>'.format( + rows + ) ) ownership_graph.add_node( diff --git a/tools/ci_changes_per_commit.py b/tools/ci_changes_per_commit.py index 58e86148edab..6cbd475fa95b 100644 --- a/tools/ci_changes_per_commit.py +++ b/tools/ci_changes_per_commit.py @@ -158,9 +158,11 @@ def get_commit_depth_and_check_suite(query_commits): if check_suite["workflowRun"]["workflow"]["name"] == "Build CI": return [ {"sha": commit_sha, "depth": commit_depth}, - check_suite["id"] - if check_suite["conclusion"] != "SUCCESS" - else None, + ( + check_suite["id"] + if check_suite["conclusion"] != "SUCCESS" + else None + ), ] if not query_commits.paginate(commits["pageInfo"], "beforeCommit"): return [None, None] diff --git a/tools/ci_fetch_deps.py b/tools/ci_fetch_deps.py index 1add6b3dac09..d60f4e54c055 100644 --- a/tools/ci_fetch_deps.py +++ b/tools/ci_fetch_deps.py @@ -96,7 +96,7 @@ def matching_submodules(s): "lib/tinyusb/", "lib/tlsf", "data/nvm.toml/", - ] + ], # omit unix which is part of the "test" target below } diff --git a/tools/codeformat.py b/tools/codeformat.py index f76e5f06810f..fa831448d5da 100644 --- a/tools/codeformat.py +++ b/tools/codeformat.py @@ -55,7 +55,7 @@ "ports/**/*.py", "py/**/*.py", "tools/**/*.py", - "tests/**/*.py", + "tests/circuitpython-*/**/*.py", ] EXCLUSIONS = [ @@ -65,8 +65,6 @@ "ports/unix/*.py", # not real python files "tests/**/repl_*.py", - # needs careful attention before applying automatic formatting - "tests/basics/*.py", # don't reindent this third-party code we vendored in "ports/raspberrypi/lwip_src", ]