diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 33c271d6e6..9e7664e7f7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -84,6 +84,7 @@ jobs: - "circuitplayground_express" - "circuitplayground_express_crickit" - "circuitplayground_express_displayio" + - "clue_nrf52840_express" - "cp32-m4" - "datalore_ip_m4" - "datum_distance" diff --git a/extmod/modbtree.c b/extmod/modbtree.c index 8b76885809..7cfa9c6afb 100644 --- a/extmod/modbtree.c +++ b/extmod/modbtree.c @@ -247,7 +247,7 @@ STATIC mp_obj_t btree_iternext(mp_obj_t self_in) { } STATIC mp_obj_t btree_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) { - mp_obj_btree_t *self = MP_OBJ_TO_PTR(self_in); + mp_obj_btree_t *self = mp_instance_cast_to_native_base(self_in, &btree_type); if (value == MP_OBJ_NULL) { // delete DBT key; diff --git a/extmod/moductypes.c b/extmod/moductypes.c index 9eea30bf3e..451dc29ed9 100644 --- a/extmod/moductypes.c +++ b/extmod/moductypes.c @@ -518,8 +518,8 @@ STATIC void uctypes_struct_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { } } -STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value) { - mp_obj_uctypes_struct_t *self = MP_OBJ_TO_PTR(self_in); +STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t base_in, mp_obj_t index_in, mp_obj_t value) { + mp_obj_uctypes_struct_t *self = mp_instance_cast_to_native_base(base_in, &uctypes_struct_type); if (value == MP_OBJ_NULL) { // delete diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage index c1d8e1d645..8d5cc38405 160000 --- a/frozen/circuitpython-stage +++ b/frozen/circuitpython-stage @@ -1 +1 @@ -Subproject commit c1d8e1d645cbc83d857e12cf4ba67549b988a4e7 +Subproject commit 8d5cc384058b1cb296aaeab86fb8405042d547ed diff --git a/lib/tinyusb b/lib/tinyusb index 7a05b177a4..dda4c9a94b 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit 7a05b177a43b368fea1d60ca344fe4ae9902a432 +Subproject commit dda4c9a94b509238faa7b5ab5b9464c1d2e63ff0 diff --git a/locale/ID.po b/locale/ID.po index 18773a2027..20662ae9db 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-12-12 15:33-0800\n" +"POT-Creation-Date: 2020-01-01 17:29-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -396,11 +396,6 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "Can not use dotstar with %s" -msgstr "" - #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -605,6 +600,10 @@ msgstr "" msgid "Expected a Characteristic" msgstr "" +#: shared-bindings/_pixelbuf/__init__.c +msgid "Expected a PixelBuf instance" +msgstr "" + #: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "" @@ -745,6 +744,10 @@ msgstr "" msgid "Invalid buffer size" msgstr "Ukuran buffer tidak valid" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Invalid byteorder string" +msgstr "" + #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "" @@ -872,6 +875,10 @@ msgstr "" msgid "Must be a %q subclass." msgstr "" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Negative step not supported" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -971,10 +978,6 @@ msgid "" "%d bpp given" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -msgid "Only slices with step=1 (aka None) are supported" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "" @@ -1079,7 +1082,6 @@ msgid "Sample rate must be positive" msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Sample rate too high. It must be less than %d" msgstr "Nilai sampel terlalu tinggi. Nilai harus kurang dari %d" @@ -1462,8 +1464,7 @@ msgid "byte code not implemented" msgstr "" #: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "byteorder is not an instance of ByteOrder (got a %s)" +msgid "byteorder is not a string" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c @@ -2143,7 +2144,7 @@ msgstr "tidak ada modul yang bernama '%q'" msgid "no reset pin available" msgstr "" -#: py/runtime.c shared-bindings/_pixelbuf/__init__.c +#: py/runtime.c msgid "no such attribute" msgstr "" @@ -2325,10 +2326,6 @@ msgstr "antrian meluap (overflow)" msgid "rawbuf is not the same size as buf" msgstr "" -#: shared-bindings/_pixelbuf/__init__.c -msgid "readonly attribute" -msgstr "" - #: py/builtinimport.c msgid "relative import" msgstr "relative import" @@ -2631,10 +2628,6 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -msgid "write_args must be a list, tuple, or None" -msgstr "" - #: py/objstr.c msgid "wrong number of arguments" msgstr "" diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index f4b67521ce..5cf44cc356 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-12-12 15:33-0800\n" +"POT-Creation-Date: 2020-01-01 17:29-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -391,11 +391,6 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "Can not use dotstar with %s" -msgstr "" - #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -594,6 +589,10 @@ msgstr "" msgid "Expected a Characteristic" msgstr "" +#: shared-bindings/_pixelbuf/__init__.c +msgid "Expected a PixelBuf instance" +msgstr "" + #: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "" @@ -734,6 +733,10 @@ msgstr "" msgid "Invalid buffer size" msgstr "" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Invalid byteorder string" +msgstr "" + #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "" @@ -861,6 +864,10 @@ msgstr "" msgid "Must be a %q subclass." msgstr "" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Negative step not supported" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -959,10 +966,6 @@ msgid "" "%d bpp given" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -msgid "Only slices with step=1 (aka None) are supported" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "" @@ -1063,7 +1066,6 @@ msgid "Sample rate must be positive" msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Sample rate too high. It must be less than %d" msgstr "" @@ -1438,8 +1440,7 @@ msgid "byte code not implemented" msgstr "" #: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "byteorder is not an instance of ByteOrder (got a %s)" +msgid "byteorder is not a string" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c @@ -2119,7 +2120,7 @@ msgstr "" msgid "no reset pin available" msgstr "" -#: py/runtime.c shared-bindings/_pixelbuf/__init__.c +#: py/runtime.c msgid "no such attribute" msgstr "" @@ -2300,10 +2301,6 @@ msgstr "" msgid "rawbuf is not the same size as buf" msgstr "" -#: shared-bindings/_pixelbuf/__init__.c -msgid "readonly attribute" -msgstr "" - #: py/builtinimport.c msgid "relative import" msgstr "" @@ -2605,10 +2602,6 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -msgid "write_args must be a list, tuple, or None" -msgstr "" - #: py/objstr.c msgid "wrong number of arguments" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 36d2f266d7..17f2e38280 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-12-12 15:33-0800\n" +"POT-Creation-Date: 2020-01-01 17:29-0500\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: Pascal Deneaux\n" "Language-Team: Sebastian Plamauer, Pascal Deneaux\n" @@ -395,11 +395,6 @@ msgstr "Ein Bytes kann nur Werte zwischen 0 und 255 annehmen." msgid "Call super().__init__() before accessing native object." msgstr "Rufe super().__init__() vor dem Zugriff auf ein natives Objekt auf." -#: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "Can not use dotstar with %s" -msgstr "Kann dotstar nicht mit %s verwenden" - #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -598,6 +593,10 @@ msgstr "Erwartet ein(e) %q" msgid "Expected a Characteristic" msgstr "Characteristic wird erwartet" +#: shared-bindings/_pixelbuf/__init__.c +msgid "Expected a PixelBuf instance" +msgstr "" + #: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "Ein Service wird erwartet" @@ -742,6 +741,10 @@ msgstr "Ungültige Bits pro Wert" msgid "Invalid buffer size" msgstr "Ungültige Puffergröße" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Invalid byteorder string" +msgstr "" + #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "Ungültiger Aufnahmezeitraum. Gültiger Bereich: 1 - 500" @@ -870,6 +873,10 @@ msgstr "" msgid "Must be a %q subclass." msgstr "Muss eine %q Unterklasse sein." +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Negative step not supported" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "Kein CCCD für diese Charakteristik" @@ -974,10 +981,6 @@ msgstr "" "Nur monochrome, indizierte 4bpp oder 8bpp, und 16bpp oder größere BMPs " "unterstützt: %d bpp wurden gegeben" -#: shared-bindings/_pixelbuf/PixelBuf.c -msgid "Only slices with step=1 (aka None) are supported" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "Oversample muss ein Vielfaches von 8 sein." @@ -1080,7 +1083,6 @@ msgid "Sample rate must be positive" msgstr "Abtastrate muss positiv sein" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Sample rate too high. It must be less than %d" msgstr "Abtastrate zu hoch. Wert muss unter %d liegen" @@ -1466,9 +1468,8 @@ msgid "byte code not implemented" msgstr "" #: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "byteorder is not an instance of ByteOrder (got a %s)" -msgstr "byteorder ist keine Instanz von ByteOrder (%s erhalten)" +msgid "byteorder is not a string" +msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c msgid "bytes > 8 bits not supported" @@ -2155,7 +2156,7 @@ msgstr "Kein Modul mit dem Namen '%q'" msgid "no reset pin available" msgstr "kein Reset Pin verfügbar" -#: py/runtime.c shared-bindings/_pixelbuf/__init__.c +#: py/runtime.c msgid "no such attribute" msgstr "kein solches Attribut" @@ -2338,10 +2339,6 @@ msgstr "Warteschlangenüberlauf" msgid "rawbuf is not the same size as buf" msgstr "rawbuf hat nicht die gleiche Größe wie buf" -#: shared-bindings/_pixelbuf/__init__.c -msgid "readonly attribute" -msgstr "Readonly-Attribut" - #: py/builtinimport.c msgid "relative import" msgstr "relativer Import" @@ -2650,10 +2647,6 @@ msgstr "value_count muss größer als 0 sein" msgid "window must be <= interval" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -msgid "write_args must be a list, tuple, or None" -msgstr "write_args muss eine Liste, ein Tupel oder None sein" - #: py/objstr.c msgid "wrong number of arguments" msgstr "falsche Anzahl an Argumenten" @@ -2687,6 +2680,10 @@ msgstr "" #~ msgid "C-level assert" #~ msgstr "C-Level Assert" +#, c-format +#~ msgid "Can not use dotstar with %s" +#~ msgstr "Kann dotstar nicht mit %s verwenden" + #~ msgid "Can't add services in Central mode" #~ msgstr "Im Central mode können Dienste nicht hinzugefügt werden" @@ -2991,6 +2988,10 @@ msgstr "" #~ msgid "buffer too long" #~ msgstr "Buffer zu lang" +#, c-format +#~ msgid "byteorder is not an instance of ByteOrder (got a %s)" +#~ msgstr "byteorder ist keine Instanz von ByteOrder (%s erhalten)" + #~ msgid "expected a DigitalInOut" #~ msgstr "erwarte DigitalInOut" @@ -3043,6 +3044,9 @@ msgstr "" #~ msgid "pin does not have IRQ capabilities" #~ msgstr "Pin hat keine IRQ Fähigkeiten" +#~ msgid "readonly attribute" +#~ msgstr "Readonly-Attribut" + #~ msgid "scan failed" #~ msgstr "Scan fehlgeschlagen" @@ -3054,3 +3058,6 @@ msgstr "" #~ msgid "wifi_set_ip_info() failed" #~ msgstr "wifi_set_ip_info() fehlgeschlagen" + +#~ msgid "write_args must be a list, tuple, or None" +#~ msgstr "write_args muss eine Liste, ein Tupel oder None sein" diff --git a/locale/en_US.po b/locale/en_US.po index 7da32614f4..e6fbfc471b 100644 --- a/locale/en_US.po +++ b/locale/en_US.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-12-12 15:33-0800\n" +"POT-Creation-Date: 2020-01-01 17:29-0500\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: \n" "Language-Team: \n" @@ -391,11 +391,6 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "Can not use dotstar with %s" -msgstr "" - #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -594,6 +589,10 @@ msgstr "" msgid "Expected a Characteristic" msgstr "" +#: shared-bindings/_pixelbuf/__init__.c +msgid "Expected a PixelBuf instance" +msgstr "" + #: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "" @@ -734,6 +733,10 @@ msgstr "" msgid "Invalid buffer size" msgstr "" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Invalid byteorder string" +msgstr "" + #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "" @@ -861,6 +864,10 @@ msgstr "" msgid "Must be a %q subclass." msgstr "" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Negative step not supported" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -959,10 +966,6 @@ msgid "" "%d bpp given" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -msgid "Only slices with step=1 (aka None) are supported" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "" @@ -1063,7 +1066,6 @@ msgid "Sample rate must be positive" msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Sample rate too high. It must be less than %d" msgstr "" @@ -1438,8 +1440,7 @@ msgid "byte code not implemented" msgstr "" #: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "byteorder is not an instance of ByteOrder (got a %s)" +msgid "byteorder is not a string" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c @@ -2119,7 +2120,7 @@ msgstr "" msgid "no reset pin available" msgstr "" -#: py/runtime.c shared-bindings/_pixelbuf/__init__.c +#: py/runtime.c msgid "no such attribute" msgstr "" @@ -2300,10 +2301,6 @@ msgstr "" msgid "rawbuf is not the same size as buf" msgstr "" -#: shared-bindings/_pixelbuf/__init__.c -msgid "readonly attribute" -msgstr "" - #: py/builtinimport.c msgid "relative import" msgstr "" @@ -2605,10 +2602,6 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -msgid "write_args must be a list, tuple, or None" -msgstr "" - #: py/objstr.c msgid "wrong number of arguments" msgstr "" diff --git a/locale/en_x_pirate.po b/locale/en_x_pirate.po index 867618bd98..5635102301 100644 --- a/locale/en_x_pirate.po +++ b/locale/en_x_pirate.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-12-12 15:33-0800\n" +"POT-Creation-Date: 2020-01-01 17:29-0500\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: \n" "Language-Team: @sommersoft, @MrCertainly\n" @@ -395,11 +395,6 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "Can not use dotstar with %s" -msgstr "" - #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -598,6 +593,10 @@ msgstr "" msgid "Expected a Characteristic" msgstr "" +#: shared-bindings/_pixelbuf/__init__.c +msgid "Expected a PixelBuf instance" +msgstr "" + #: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "" @@ -738,6 +737,10 @@ msgstr "" msgid "Invalid buffer size" msgstr "" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Invalid byteorder string" +msgstr "" + #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "" @@ -865,6 +868,10 @@ msgstr "" msgid "Must be a %q subclass." msgstr "" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Negative step not supported" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -963,10 +970,6 @@ msgid "" "%d bpp given" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -msgid "Only slices with step=1 (aka None) are supported" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "" @@ -1067,7 +1070,6 @@ msgid "Sample rate must be positive" msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Sample rate too high. It must be less than %d" msgstr "" @@ -1442,8 +1444,7 @@ msgid "byte code not implemented" msgstr "" #: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "byteorder is not an instance of ByteOrder (got a %s)" +msgid "byteorder is not a string" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c @@ -2123,7 +2124,7 @@ msgstr "" msgid "no reset pin available" msgstr "" -#: py/runtime.c shared-bindings/_pixelbuf/__init__.c +#: py/runtime.c msgid "no such attribute" msgstr "" @@ -2304,10 +2305,6 @@ msgstr "" msgid "rawbuf is not the same size as buf" msgstr "" -#: shared-bindings/_pixelbuf/__init__.c -msgid "readonly attribute" -msgstr "" - #: py/builtinimport.c msgid "relative import" msgstr "" @@ -2609,10 +2606,6 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -msgid "write_args must be a list, tuple, or None" -msgstr "" - #: py/objstr.c msgid "wrong number of arguments" msgstr "" diff --git a/locale/es.po b/locale/es.po index 285d1d8515..c9688a41b1 100644 --- a/locale/es.po +++ b/locale/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-12-12 15:33-0800\n" +"POT-Creation-Date: 2020-01-01 17:29-0500\n" "PO-Revision-Date: 2018-08-24 22:56-0500\n" "Last-Translator: \n" "Language-Team: \n" @@ -397,11 +397,6 @@ msgstr "Bytes debe estar entre 0 y 255." msgid "Call super().__init__() before accessing native object." msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "Can not use dotstar with %s" -msgstr "No se puede usar dotstar con %s" - #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -600,6 +595,10 @@ msgstr "Se espera un %q" msgid "Expected a Characteristic" msgstr "Se esperaba una Característica." +#: shared-bindings/_pixelbuf/__init__.c +msgid "Expected a PixelBuf instance" +msgstr "" + #: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "" @@ -742,6 +741,10 @@ msgstr "Inválido bits por valor" msgid "Invalid buffer size" msgstr "Tamaño de buffer inválido" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Invalid byteorder string" +msgstr "" + #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "Inválido periodo de captura. Rango válido: 1 - 500" @@ -869,6 +872,10 @@ msgstr "Micrófono demora de inicio debe estar en el rango 0.0 a 1.0" msgid "Must be a %q subclass." msgstr "Debe de ser una subclase de %q" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Negative step not supported" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -971,11 +978,6 @@ msgid "" "%d bpp given" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -#, fuzzy -msgid "Only slices with step=1 (aka None) are supported" -msgstr "solo se admiten segmentos con step=1 (alias None)" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "El sobremuestreo debe ser un múltiplo de 8" @@ -1082,7 +1084,6 @@ msgid "Sample rate must be positive" msgstr "Sample rate debe ser positivo" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Sample rate too high. It must be less than %d" msgstr "Frecuencia de muestreo demasiado alta. Debe ser menor a %d" @@ -1464,9 +1465,8 @@ msgid "byte code not implemented" msgstr "codigo byte no implementado" #: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "byteorder is not an instance of ByteOrder (got a %s)" -msgstr "byteorder no es instancia de ByteOrder (encontarmos un %s)" +msgid "byteorder is not a string" +msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c msgid "bytes > 8 bits not supported" @@ -2155,7 +2155,7 @@ msgstr "ningún módulo se llama '%q'" msgid "no reset pin available" msgstr "" -#: py/runtime.c shared-bindings/_pixelbuf/__init__.c +#: py/runtime.c msgid "no such attribute" msgstr "no hay tal atributo" @@ -2340,11 +2340,6 @@ msgstr "desbordamiento de cola(queue)" msgid "rawbuf is not the same size as buf" msgstr "rawbuf no es el mismo tamaño que buf" -#: shared-bindings/_pixelbuf/__init__.c -#, fuzzy -msgid "readonly attribute" -msgstr "atributo no legible" - #: py/builtinimport.c msgid "relative import" msgstr "import relativo" @@ -2649,10 +2644,6 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -msgid "write_args must be a list, tuple, or None" -msgstr "" - #: py/objstr.c msgid "wrong number of arguments" msgstr "numero erroneo de argumentos" @@ -2690,6 +2681,10 @@ msgstr "paso cero" #~ "Intento de allocation de heap cuando la VM de MicroPython no estaba " #~ "corriendo.\n" +#, c-format +#~ msgid "Can not use dotstar with %s" +#~ msgstr "No se puede usar dotstar con %s" + #~ msgid "Can't add services in Central mode" #~ msgstr "No se pueden agregar servicio en modo Central" @@ -2916,6 +2911,10 @@ msgstr "paso cero" #~ "Solo se admiten BMP monocromos, indexados de 8bpp y 16bpp o superiores:% " #~ "d bppdado" +#, fuzzy +#~ msgid "Only slices with step=1 (aka None) are supported" +#~ msgstr "solo se admiten segmentos con step=1 (alias None)" + #~ msgid "Only true color (24 bpp or higher) BMP supported %x" #~ msgstr "Solo color verdadero (24 bpp o superior) BMP admitido %x" @@ -3016,6 +3015,10 @@ msgstr "paso cero" #~ msgid "buffer too long" #~ msgstr "buffer demasiado largo" +#, c-format +#~ msgid "byteorder is not an instance of ByteOrder (got a %s)" +#~ msgstr "byteorder no es instancia de ByteOrder (encontarmos un %s)" + #~ msgid "can query only one param" #~ msgstr "puede consultar solo un param" @@ -3092,6 +3095,10 @@ msgstr "paso cero" #~ msgid "position must be 2-tuple" #~ msgstr "posición debe ser 2-tuple" +#, fuzzy +#~ msgid "readonly attribute" +#~ msgstr "atributo no legible" + #~ msgid "row must be packed and word aligned" #~ msgstr "la fila debe estar empacada y la palabra alineada" diff --git a/locale/fil.po b/locale/fil.po index 6600ffb9a6..94f39f4064 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-12-12 15:33-0800\n" +"POT-Creation-Date: 2020-01-01 17:29-0500\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -398,11 +398,6 @@ msgstr "Sa gitna ng 0 o 255 dapat ang bytes." msgid "Call super().__init__() before accessing native object." msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "Can not use dotstar with %s" -msgstr "" - #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -607,6 +602,10 @@ msgstr "Umasa ng %q" msgid "Expected a Characteristic" msgstr "Hindi mabasa and Characteristic." +#: shared-bindings/_pixelbuf/__init__.c +msgid "Expected a PixelBuf instance" +msgstr "" + #: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "" @@ -750,6 +749,10 @@ msgstr "" msgid "Invalid buffer size" msgstr "Mali ang buffer size" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Invalid byteorder string" +msgstr "" + #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "" @@ -877,6 +880,10 @@ msgstr "Ang delay ng startup ng mikropono ay dapat na nasa 0.0 hanggang 1.0" msgid "Must be a %q subclass." msgstr "" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Negative step not supported" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -978,11 +985,6 @@ msgid "" "%d bpp given" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -#, fuzzy -msgid "Only slices with step=1 (aka None) are supported" -msgstr "ang mga slices lamang na may hakbang = 1 (aka None) ang sinusuportahan" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "Oversample ay dapat multiple ng 8." @@ -1088,7 +1090,6 @@ msgid "Sample rate must be positive" msgstr "Sample rate ay dapat positibo" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Sample rate too high. It must be less than %d" msgstr "Sample rate ay masyadong mataas. Ito ay dapat hindi hiigit sa %d" @@ -1474,8 +1475,7 @@ msgid "byte code not implemented" msgstr "byte code hindi pa implemented" #: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "byteorder is not an instance of ByteOrder (got a %s)" +msgid "byteorder is not a string" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c @@ -2171,7 +2171,7 @@ msgstr "walang module na '%q'" msgid "no reset pin available" msgstr "" -#: py/runtime.c shared-bindings/_pixelbuf/__init__.c +#: py/runtime.c msgid "no such attribute" msgstr "walang ganoon na attribute" @@ -2354,11 +2354,6 @@ msgstr "puno na ang pila (overflow)" msgid "rawbuf is not the same size as buf" msgstr "" -#: shared-bindings/_pixelbuf/__init__.c -#, fuzzy -msgid "readonly attribute" -msgstr "hindi mabasa ang attribute" - #: py/builtinimport.c msgid "relative import" msgstr "relative import" @@ -2664,10 +2659,6 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -msgid "write_args must be a list, tuple, or None" -msgstr "" - #: py/objstr.c msgid "wrong number of arguments" msgstr "mali ang bilang ng argumento" @@ -2902,6 +2893,11 @@ msgstr "zero step" #~ msgid "Only bit maps of 8 bit color or less are supported" #~ msgstr "Tanging bit maps na may 8 bit color o mas mababa ang supportado" +#, fuzzy +#~ msgid "Only slices with step=1 (aka None) are supported" +#~ msgstr "" +#~ "ang mga slices lamang na may hakbang = 1 (aka None) ang sinusuportahan" + #~ msgid "Only true color (24 bpp or higher) BMP supported %x" #~ msgstr "Dapat true color (24 bpp o mas mataas) BMP lamang ang supportado %x" @@ -3060,6 +3056,10 @@ msgstr "zero step" #~ msgid "position must be 2-tuple" #~ msgstr "position ay dapat 2-tuple" +#, fuzzy +#~ msgid "readonly attribute" +#~ msgstr "hindi mabasa ang attribute" + #~ msgid "row must be packed and word aligned" #~ msgstr "row ay dapat packed at ang word nakahanay" diff --git a/locale/fr.po b/locale/fr.po index 6437b8ba86..42209a045e 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-12-12 15:33-0800\n" +"POT-Creation-Date: 2020-01-01 17:29-0500\n" "PO-Revision-Date: 2019-04-14 20:05+0100\n" "Last-Translator: Pierrick Couturier \n" "Language-Team: fr\n" @@ -402,11 +402,6 @@ msgstr "Les octets 'bytes' doivent être entre 0 et 255" msgid "Call super().__init__() before accessing native object." msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "Can not use dotstar with %s" -msgstr "Impossible d'utiliser 'dotstar' avec %s" - #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -610,6 +605,10 @@ msgstr "Attendu un %q" msgid "Expected a Characteristic" msgstr "Une 'Characteristic' est attendue" +#: shared-bindings/_pixelbuf/__init__.c +msgid "Expected a PixelBuf instance" +msgstr "" + #: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "" @@ -755,6 +754,10 @@ msgstr "Bits par valeur invalides" msgid "Invalid buffer size" msgstr "Longueur de tampon invalide" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Invalid byteorder string" +msgstr "" + #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "Période de capture invalide. Gamme valide: 1 à 500" @@ -884,6 +887,10 @@ msgstr "Le délais au démarrage du micro doit être entre 0.0 et 1.0" msgid "Must be a %q subclass." msgstr "" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Negative step not supported" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -988,11 +995,6 @@ msgid "" "%d bpp given" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -#, fuzzy -msgid "Only slices with step=1 (aka None) are supported" -msgstr "seuls les slices avec 'step=1' (cad 'None') sont supportées" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "Le sur-échantillonage doit être un multiple de 8." @@ -1102,7 +1104,6 @@ msgid "Sample rate must be positive" msgstr "Le taux d'échantillonage doit être positif" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Sample rate too high. It must be less than %d" msgstr "Taux d'échantillonage trop élevé. Doit être inf. à %d" @@ -1493,9 +1494,8 @@ msgid "byte code not implemented" msgstr "bytecode non implémenté" #: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "byteorder is not an instance of ByteOrder (got a %s)" -msgstr "'byteorder' n'est pas une instance de ByteOrder (reçu un %s)" +msgid "byteorder is not a string" +msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c msgid "bytes > 8 bits not supported" @@ -2197,7 +2197,7 @@ msgstr "pas de module '%q'" msgid "no reset pin available" msgstr "" -#: py/runtime.c shared-bindings/_pixelbuf/__init__.c +#: py/runtime.c msgid "no such attribute" msgstr "pas de tel attribut" @@ -2387,11 +2387,6 @@ msgstr "dépassement de file" msgid "rawbuf is not the same size as buf" msgstr "'rawbuf' n'est pas de la même taille que 'buf'" -#: shared-bindings/_pixelbuf/__init__.c -#, fuzzy -msgid "readonly attribute" -msgstr "attribut en lecture seule" - #: py/builtinimport.c msgid "relative import" msgstr "import relatif" @@ -2699,10 +2694,6 @@ msgstr "'value_count' doit être > 0" msgid "window must be <= interval" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -msgid "write_args must be a list, tuple, or None" -msgstr "'write_args' doit être une liste, un tuple ou 'None'" - #: py/objstr.c msgid "wrong number of arguments" msgstr "mauvais nombres d'arguments" @@ -2740,6 +2731,10 @@ msgstr "'step' nul" #~ msgstr "" #~ "Tentative d'allocation de tas alors que la VM MicroPython ne tourne pas.\n" +#, c-format +#~ msgid "Can not use dotstar with %s" +#~ msgstr "Impossible d'utiliser 'dotstar' avec %s" + #~ msgid "Can't add services in Central mode" #~ msgstr "Impossible d'ajouter des services en mode Central" @@ -2974,6 +2969,10 @@ msgstr "'step' nul" #~ "Seul les BMP monochromes, 8bit indexé et 16bit sont supportés: %d bpp " #~ "fourni" +#, fuzzy +#~ msgid "Only slices with step=1 (aka None) are supported" +#~ msgstr "seuls les slices avec 'step=1' (cad 'None') sont supportées" + #~ msgid "Only true color (24 bpp or higher) BMP supported %x" #~ msgstr "Seul les BMP 24bits ou plus sont supportés %x" @@ -3075,6 +3074,10 @@ msgstr "'step' nul" #~ msgid "buffer too long" #~ msgstr "tampon trop long" +#, c-format +#~ msgid "byteorder is not an instance of ByteOrder (got a %s)" +#~ msgstr "'byteorder' n'est pas une instance de ByteOrder (reçu un %s)" + #~ msgid "can query only one param" #~ msgstr "ne peut demander qu'un seul paramètre" @@ -3151,6 +3154,10 @@ msgstr "'step' nul" #~ msgid "position must be 2-tuple" #~ msgstr "position doit être un 2-tuple" +#, fuzzy +#~ msgid "readonly attribute" +#~ msgstr "attribut en lecture seule" + #~ msgid "scan failed" #~ msgstr "échec du scan" @@ -3177,3 +3184,6 @@ msgstr "'step' nul" #~ msgid "wifi_set_ip_info() failed" #~ msgstr "wifi_set_ip_info() a échoué" + +#~ msgid "write_args must be a list, tuple, or None" +#~ msgstr "'write_args' doit être une liste, un tuple ou 'None'" diff --git a/locale/it_IT.po b/locale/it_IT.po index a659664a00..684e2a90b9 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-12-12 15:33-0800\n" +"POT-Creation-Date: 2020-01-01 17:29-0500\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -398,11 +398,6 @@ msgstr "I byte devono essere compresi tra 0 e 255" msgid "Call super().__init__() before accessing native object." msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "Can not use dotstar with %s" -msgstr "dotstar non può essere usato con %s" - #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -607,6 +602,10 @@ msgstr "Atteso un %q" msgid "Expected a Characteristic" msgstr "Non è possibile aggiungere Characteristic." +#: shared-bindings/_pixelbuf/__init__.c +msgid "Expected a PixelBuf instance" +msgstr "" + #: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "" @@ -751,6 +750,10 @@ msgstr "bits per valore invalido" msgid "Invalid buffer size" msgstr "lunghezza del buffer non valida" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Invalid byteorder string" +msgstr "" + #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "periodo di cattura invalido. Zona valida: 1 - 500" @@ -881,6 +884,10 @@ msgstr "" msgid "Must be a %q subclass." msgstr "" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Negative step not supported" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -983,11 +990,6 @@ msgid "" "%d bpp given" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -#, fuzzy -msgid "Only slices with step=1 (aka None) are supported" -msgstr "solo slice con step=1 (aka None) sono supportate" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "L'oversampling deve essere multiplo di 8." @@ -1098,7 +1100,6 @@ msgid "Sample rate must be positive" msgstr "STA deve essere attiva" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Sample rate too high. It must be less than %d" msgstr "" @@ -1479,8 +1480,7 @@ msgid "byte code not implemented" msgstr "byte code non implementato" #: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "byteorder is not an instance of ByteOrder (got a %s)" +msgid "byteorder is not a string" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c @@ -2174,7 +2174,7 @@ msgstr "nessun modulo chiamato '%q'" msgid "no reset pin available" msgstr "" -#: py/runtime.c shared-bindings/_pixelbuf/__init__.c +#: py/runtime.c msgid "no such attribute" msgstr "attributo inesistente" @@ -2361,11 +2361,6 @@ msgstr "overflow della coda" msgid "rawbuf is not the same size as buf" msgstr "" -#: shared-bindings/_pixelbuf/__init__.c -#, fuzzy -msgid "readonly attribute" -msgstr "attributo non leggibile" - #: py/builtinimport.c msgid "relative import" msgstr "importazione relativa" @@ -2671,10 +2666,6 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -msgid "write_args must be a list, tuple, or None" -msgstr "" - #: py/objstr.c msgid "wrong number of arguments" msgstr "numero di argomenti errato" @@ -2707,6 +2698,10 @@ msgstr "zero step" #~ msgid "C-level assert" #~ msgstr "assert a livello C" +#, c-format +#~ msgid "Can not use dotstar with %s" +#~ msgstr "dotstar non può essere usato con %s" + #~ msgid "Can't add services in Central mode" #~ msgstr "non si può aggiungere servizi in Central mode" @@ -2907,6 +2902,10 @@ msgstr "zero step" #~ msgid "Only bit maps of 8 bit color or less are supported" #~ msgstr "Sono supportate solo bitmap con colori a 8 bit o meno" +#, fuzzy +#~ msgid "Only slices with step=1 (aka None) are supported" +#~ msgstr "solo slice con step=1 (aka None) sono supportate" + #~ msgid "Only true color (24 bpp or higher) BMP supported %x" #~ msgstr "Solo BMP true color (24 bpp o superiore) sono supportati %x" @@ -3044,6 +3043,10 @@ msgstr "zero step" #~ msgid "position must be 2-tuple" #~ msgstr "position deve essere una 2-tuple" +#, fuzzy +#~ msgid "readonly attribute" +#~ msgstr "attributo non leggibile" + #~ msgid "row must be packed and word aligned" #~ msgstr "la riga deve essere compattata e allineata alla parola" diff --git a/locale/ko.po b/locale/ko.po index c47c10a94d..7b4240800b 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-12-12 15:33-0800\n" +"POT-Creation-Date: 2020-01-01 17:29-0500\n" "PO-Revision-Date: 2019-05-06 14:22-0700\n" "Last-Translator: \n" "Language-Team: LANGUAGE \n" @@ -395,11 +395,6 @@ msgstr "바이트는 0에서 255 사이 여야합니다." msgid "Call super().__init__() before accessing native object." msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "Can not use dotstar with %s" -msgstr "" - #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -598,6 +593,10 @@ msgstr "%q 이 예상되었습니다." msgid "Expected a Characteristic" msgstr "특성(Characteristic)이 예상되었습니다." +#: shared-bindings/_pixelbuf/__init__.c +msgid "Expected a PixelBuf instance" +msgstr "" + #: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "" @@ -738,6 +737,10 @@ msgstr "" msgid "Invalid buffer size" msgstr "" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Invalid byteorder string" +msgstr "" + #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "" @@ -865,6 +868,10 @@ msgstr "" msgid "Must be a %q subclass." msgstr "" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Negative step not supported" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -963,10 +970,6 @@ msgid "" "%d bpp given" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -msgid "Only slices with step=1 (aka None) are supported" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "" @@ -1067,7 +1070,6 @@ msgid "Sample rate must be positive" msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Sample rate too high. It must be less than %d" msgstr "" @@ -1443,8 +1445,7 @@ msgid "byte code not implemented" msgstr "" #: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "byteorder is not an instance of ByteOrder (got a %s)" +msgid "byteorder is not a string" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c @@ -2124,7 +2125,7 @@ msgstr "" msgid "no reset pin available" msgstr "" -#: py/runtime.c shared-bindings/_pixelbuf/__init__.c +#: py/runtime.c msgid "no such attribute" msgstr "" @@ -2305,10 +2306,6 @@ msgstr "" msgid "rawbuf is not the same size as buf" msgstr "" -#: shared-bindings/_pixelbuf/__init__.c -msgid "readonly attribute" -msgstr "" - #: py/builtinimport.c msgid "relative import" msgstr "" @@ -2610,10 +2607,6 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -msgid "write_args must be a list, tuple, or None" -msgstr "" - #: py/objstr.c msgid "wrong number of arguments" msgstr "" diff --git a/locale/pl.po b/locale/pl.po index 8d564c2431..1ef686e451 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-12-12 15:33-0800\n" +"POT-Creation-Date: 2020-01-01 17:29-0500\n" "PO-Revision-Date: 2019-03-19 18:37-0700\n" "Last-Translator: Radomir Dopieralski \n" "Language-Team: pl\n" @@ -394,11 +394,6 @@ msgstr "Bytes musi być między 0 a 255." msgid "Call super().__init__() before accessing native object." msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "Can not use dotstar with %s" -msgstr "Nie można używać dotstar z %s" - #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -597,6 +592,10 @@ msgstr "Oczekiwano %q" msgid "Expected a Characteristic" msgstr "Oczekiwano charakterystyki" +#: shared-bindings/_pixelbuf/__init__.c +msgid "Expected a PixelBuf instance" +msgstr "" + #: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "" @@ -739,6 +738,10 @@ msgstr "Zła liczba bitów wartości" msgid "Invalid buffer size" msgstr "Zła wielkość bufora" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Invalid byteorder string" +msgstr "" + #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "Zły okres. Poprawny zakres to: 1 - 500" @@ -866,6 +869,10 @@ msgstr "Opóźnienie włączenia mikrofonu musi być w zakresie od 0.0 do 1.0" msgid "Must be a %q subclass." msgstr "" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Negative step not supported" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -964,10 +971,6 @@ msgid "" "%d bpp given" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -msgid "Only slices with step=1 (aka None) are supported" -msgstr "Wspierane są tylko fragmenty z step=1 (albo None)" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "Nadpróbkowanie musi być wielokrotnością 8." @@ -1068,7 +1071,6 @@ msgid "Sample rate must be positive" msgstr "Częstotliwość próbkowania musi być dodatnia" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Sample rate too high. It must be less than %d" msgstr "Zbyt wysoka częstotliwość próbkowania. Musi być mniejsza niż %d" @@ -1446,9 +1448,8 @@ msgid "byte code not implemented" msgstr "bajtkod niezaimplemntowany" #: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "byteorder is not an instance of ByteOrder (got a %s)" -msgstr "byteorder musi być typu ByteOrder (jest %s)" +msgid "byteorder is not a string" +msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c msgid "bytes > 8 bits not supported" @@ -2128,7 +2129,7 @@ msgstr "brak modułu o nazwie '%q'" msgid "no reset pin available" msgstr "" -#: py/runtime.c shared-bindings/_pixelbuf/__init__.c +#: py/runtime.c msgid "no such attribute" msgstr "nie ma takiego atrybutu" @@ -2310,10 +2311,6 @@ msgstr "przepełnienie kolejki" msgid "rawbuf is not the same size as buf" msgstr "rawbuf nie jest tej samej wielkości co buf" -#: shared-bindings/_pixelbuf/__init__.c -msgid "readonly attribute" -msgstr "atrybut tylko do odczytu" - #: py/builtinimport.c msgid "relative import" msgstr "relatywny import" @@ -2616,10 +2613,6 @@ msgstr "value_count musi być > 0" msgid "window must be <= interval" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -msgid "write_args must be a list, tuple, or None" -msgstr "write_args musi być listą, krotką lub None" - #: py/objstr.c msgid "wrong number of arguments" msgstr "zła liczba argumentów" @@ -2650,6 +2643,10 @@ msgstr "zerowy krok" #~ msgid "Attempted heap allocation when MicroPython VM not running.\n" #~ msgstr "Próba alokacji pamięci na stercie gdy VM nie działa.\n" +#, c-format +#~ msgid "Can not use dotstar with %s" +#~ msgstr "Nie można używać dotstar z %s" + #~ msgid "Can't add services in Central mode" #~ msgstr "Nie można dodać serwisów w trybie Central" @@ -2799,6 +2796,9 @@ msgstr "zerowy krok" #~ "bpp given" #~ msgstr "Wspierane są tylko pliki BMP czarno-białe, 8bpp i 16bpp: %d bpp " +#~ msgid "Only slices with step=1 (aka None) are supported" +#~ msgstr "Wspierane są tylko fragmenty z step=1 (albo None)" + #~ msgid "Soft device assert, id: 0x%08lX, pc: 0x%08lX" #~ msgstr "Soft device assert, id: 0x%08lX, pc: 0x%08lX" @@ -2853,6 +2853,10 @@ msgstr "zerowy krok" #~ msgid "bad GATT role" #~ msgstr "zła rola GATT" +#, c-format +#~ msgid "byteorder is not an instance of ByteOrder (got a %s)" +#~ msgstr "byteorder musi być typu ByteOrder (jest %s)" + #~ msgid "characteristics includes an object that is not a Characteristic" #~ msgstr "" #~ "charakterystyki zawierają obiekt, który nie jest typu Characteristic" @@ -2874,3 +2878,6 @@ msgstr "zerowy krok" #~ msgid "timeout >100 (units are now seconds, not msecs)" #~ msgstr "timeout > 100 (jednostkami są sekundy)" + +#~ msgid "write_args must be a list, tuple, or None" +#~ msgstr "write_args musi być listą, krotką lub None" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 48cf9e77ef..9d36696ce7 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-12-12 15:33-0800\n" +"POT-Creation-Date: 2020-01-01 17:29-0500\n" "PO-Revision-Date: 2018-10-02 21:14-0000\n" "Last-Translator: \n" "Language-Team: \n" @@ -395,11 +395,6 @@ msgstr "Os bytes devem estar entre 0 e 255." msgid "Call super().__init__() before accessing native object." msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "Can not use dotstar with %s" -msgstr "" - #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -602,6 +597,10 @@ msgstr "Esperado um" msgid "Expected a Characteristic" msgstr "Não é possível adicionar Característica." +#: shared-bindings/_pixelbuf/__init__.c +msgid "Expected a PixelBuf instance" +msgstr "" + #: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "" @@ -744,6 +743,10 @@ msgstr "" msgid "Invalid buffer size" msgstr "Arquivo inválido" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Invalid byteorder string" +msgstr "" + #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "" @@ -873,6 +876,10 @@ msgstr "" msgid "Must be a %q subclass." msgstr "" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Negative step not supported" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -974,10 +981,6 @@ msgid "" "%d bpp given" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -msgid "Only slices with step=1 (aka None) are supported" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "" @@ -1080,7 +1083,6 @@ msgid "Sample rate must be positive" msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Sample rate too high. It must be less than %d" msgstr "Taxa de amostragem muito alta. Deve ser menor que %d" @@ -1459,8 +1461,7 @@ msgid "byte code not implemented" msgstr "" #: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "byteorder is not an instance of ByteOrder (got a %s)" +msgid "byteorder is not a string" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c @@ -2141,7 +2142,7 @@ msgstr "" msgid "no reset pin available" msgstr "" -#: py/runtime.c shared-bindings/_pixelbuf/__init__.c +#: py/runtime.c msgid "no such attribute" msgstr "" @@ -2322,11 +2323,6 @@ msgstr "estouro de fila" msgid "rawbuf is not the same size as buf" msgstr "" -#: shared-bindings/_pixelbuf/__init__.c -#, fuzzy -msgid "readonly attribute" -msgstr "atributo ilegível" - #: py/builtinimport.c msgid "relative import" msgstr "" @@ -2630,10 +2626,6 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -msgid "write_args must be a list, tuple, or None" -msgstr "" - #: py/objstr.c msgid "wrong number of arguments" msgstr "" @@ -2925,6 +2917,10 @@ msgstr "passo zero" #~ msgid "pin does not have IRQ capabilities" #~ msgstr "Pino não tem recursos de IRQ" +#, fuzzy +#~ msgid "readonly attribute" +#~ msgstr "atributo ilegível" + #~ msgid "row must be packed and word aligned" #~ msgstr "Linha deve ser comprimida e com as palavras alinhadas" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 63889a52d6..cb907e0a1f 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-12-12 15:33-0800\n" +"POT-Creation-Date: 2020-01-01 17:29-0500\n" "PO-Revision-Date: 2019-04-13 10:10-0700\n" "Last-Translator: hexthat\n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -395,11 +395,6 @@ msgstr "Zì jié bìxū jiè yú 0 dào 255 zhī jiān." msgid "Call super().__init__() before accessing native object." msgstr "Zài fǎngwèn běn jī wùjiàn zhīqián diàoyòng super().__init__()" -#: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "Can not use dotstar with %s" -msgstr "Wúfǎ yǔ dotstar yīqǐ shǐyòng %s" - #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -598,6 +593,10 @@ msgstr "Yùqí %q" msgid "Expected a Characteristic" msgstr "Yùqí de tèdiǎn" +#: shared-bindings/_pixelbuf/__init__.c +msgid "Expected a PixelBuf instance" +msgstr "" + #: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "Yùqí fúwù" @@ -740,6 +739,10 @@ msgstr "Měi gè zhí de wèi wúxiào" msgid "Invalid buffer size" msgstr "Wúxiào de huǎnchōng qū dàxiǎo" +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Invalid byteorder string" +msgstr "" + #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" msgstr "Wúxiào de bǔhuò zhōuqí. Yǒuxiào fànwéi: 1-500" @@ -867,6 +870,10 @@ msgstr "Màikèfēng qǐdòng yánchí bìxū zài 0.0 Dào 1.0 De fànwéi nèi msgid "Must be a %q subclass." msgstr "Bìxū shì %q zi lèi." +#: shared-bindings/_pixelbuf/PixelBuf.c +msgid "Negative step not supported" +msgstr "" + #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "Zhège tèzhēng méiyǒu CCCD" @@ -968,10 +975,6 @@ msgid "" "%d bpp given" msgstr "" -#: shared-bindings/_pixelbuf/PixelBuf.c -msgid "Only slices with step=1 (aka None) are supported" -msgstr "Jǐn zhīchí 1 bù qiēpiàn" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "Guò cǎiyàng bìxū shì 8 de bèishù." @@ -1073,7 +1076,6 @@ msgid "Sample rate must be positive" msgstr "Cǎiyàng lǜ bìxū wèi zhèng shù" #: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Sample rate too high. It must be less than %d" msgstr "Cǎiyàng lǜ tài gāo. Tā bìxū xiǎoyú %d" @@ -1455,9 +1457,8 @@ msgid "byte code not implemented" msgstr "zì jié dàimǎ wèi zhíxíng" #: shared-bindings/_pixelbuf/PixelBuf.c -#, c-format -msgid "byteorder is not an instance of ByteOrder (got a %s)" -msgstr "zì jié bùshì zì jié xù shílì (yǒu %s)" +msgid "byteorder is not a string" +msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c msgid "bytes > 8 bits not supported" @@ -2141,7 +2142,7 @@ msgstr "méiyǒu mókuài '%q'" msgid "no reset pin available" msgstr "Méiyǒu kěyòng de fùwèi yǐn jiǎo" -#: py/runtime.c shared-bindings/_pixelbuf/__init__.c +#: py/runtime.c msgid "no such attribute" msgstr "méiyǒu cǐ shǔxìng" @@ -2322,10 +2323,6 @@ msgstr "duìliè yìchū" msgid "rawbuf is not the same size as buf" msgstr "yuánshǐ huǎnchōng qū hé huǎnchōng qū de dàxiǎo bùtóng" -#: shared-bindings/_pixelbuf/__init__.c -msgid "readonly attribute" -msgstr "zhǐ dú shǔxìng" - #: py/builtinimport.c msgid "relative import" msgstr "xiāngduì dǎorù" @@ -2629,10 +2626,6 @@ msgstr "zhí jìshù bìxū wèi > 0" msgid "window must be <= interval" msgstr "Chuāngkǒu bìxū shì <= jiàngé" -#: shared-bindings/_pixelbuf/PixelBuf.c -msgid "write_args must be a list, tuple, or None" -msgstr "xiě cānshù bìxū shì yuán zǔ, lièbiǎo huò None" - #: py/objstr.c msgid "wrong number of arguments" msgstr "cānshù shù cuòwù" @@ -2663,6 +2656,10 @@ msgstr "líng bù" #~ msgid "Attempted heap allocation when MicroPython VM not running.\n" #~ msgstr "MicroPython VM wèi yùnxíng shí chángshì duī fēnpèi.\n" +#, c-format +#~ msgid "Can not use dotstar with %s" +#~ msgstr "Wúfǎ yǔ dotstar yīqǐ shǐyòng %s" + #~ msgid "Can't add services in Central mode" #~ msgstr "Wúfǎ zài zhōngyāng móshì xià tiānjiā fúwù" @@ -2850,6 +2847,9 @@ msgstr "líng bù" #~ msgstr "" #~ "Jǐn zhīchí dān sè, suǒyǐn 8bpp hé 16bpp huò gèng dà de BMP: %d bpp tígōng" +#~ msgid "Only slices with step=1 (aka None) are supported" +#~ msgstr "Jǐn zhīchí 1 bù qiēpiàn" + #~ msgid "Soft device assert, id: 0x%08lX, pc: 0x%08lX" #~ msgstr "Ruǎn shèbèi wéihù, id: 0X%08lX, pc: 0X%08lX" @@ -2906,6 +2906,10 @@ msgstr "líng bù" #~ msgid "bad GATT role" #~ msgstr "zǒng xiédìng de bùliáng juésè" +#, c-format +#~ msgid "byteorder is not an instance of ByteOrder (got a %s)" +#~ msgstr "zì jié bùshì zì jié xù shílì (yǒu %s)" + #~ msgid "characteristics includes an object that is not a Characteristic" #~ msgstr "tèxìng bāokuò bùshì zìfú de wùtǐ" @@ -2938,3 +2942,6 @@ msgstr "líng bù" #~ msgid "unsupported bitmap type" #~ msgstr "bù zhīchí de bitmap lèixíng" + +#~ msgid "write_args must be a list, tuple, or None" +#~ msgstr "xiě cānshù bìxū shì yuán zǔ, lièbiǎo huò None" diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index 83fd879aad..f4886f96ef 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -233,7 +233,7 @@ SRC_C = \ lib/oofatfs/ff.c \ lib/oofatfs/option/ccsbcs.c \ lib/timeutils/timeutils.c \ - lib/tinyusb/src/portable/microchip/$(CHIP_FAMILY)/dcd_$(CHIP_FAMILY).c \ + lib/tinyusb/src/portable/microchip/samd/dcd_samd.c \ lib/utils/buffer_helper.c \ lib/utils/context_manager_helpers.c \ lib/utils/interrupt_char.c \ diff --git a/ports/atmel-samd/boards/hallowing_m4_express/mpconfigboard.h b/ports/atmel-samd/boards/hallowing_m4_express/mpconfigboard.h index a0c726e726..38f78da4d3 100644 --- a/ports/atmel-samd/boards/hallowing_m4_express/mpconfigboard.h +++ b/ports/atmel-samd/boards/hallowing_m4_express/mpconfigboard.h @@ -23,8 +23,8 @@ #define DEFAULT_SPI_BUS_MOSI (&pin_PB23) #define DEFAULT_SPI_BUS_MISO (&pin_PB22) -#define DEFAULT_UART_BUS_RX (&pin_PB12) -#define DEFAULT_UART_BUS_TX (&pin_PB13) +#define DEFAULT_UART_BUS_RX (&pin_PB13) +#define DEFAULT_UART_BUS_TX (&pin_PB12) // USB is always used internally so skip the pin objects for it. #define IGNORE_PIN_PA24 1 diff --git a/ports/atmel-samd/boards/hallowing_m4_express/pins.c b/ports/atmel-samd/boards/hallowing_m4_express/pins.c index 89fe3fbcf4..9365ea3caf 100644 --- a/ports/atmel-samd/boards/hallowing_m4_express/pins.c +++ b/ports/atmel-samd/boards/hallowing_m4_express/pins.c @@ -24,10 +24,10 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA22) }, { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB23) }, { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB22) }, - { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PB12) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB12) }, - { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PB13) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB13) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PB13) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB13) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PB12) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB12) }, { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA12) }, { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA13) }, { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA14) }, diff --git a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk index 990b26ff3e..1d1891e8e8 100644 --- a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk @@ -10,7 +10,6 @@ INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_SMALL_BUILD = 1 -CIRCUITPY_PS2IO = 0 CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_BITBANGIO = 0 CIRCUITPY_FREQUENCYIO = 0 @@ -23,7 +22,17 @@ CIRCUITPY_RTC = 0 CIRCUITPY_TOUCHIO = 0 CIRCUITPY_USB_HID = 0 CIRCUITPY_USB_MIDI = 0 +CIRCUITPY_AUDIOPWMIO = 0 +CIRCUITPY_AUDIOMP3 = 0 +CIRCUITPY_BITBANG_APA102 = 0 +CIRCUITPY_BLEIO = 0 +CIRCUITPY_GAMEPADSHIFT = 0 +CIRCUITPY_NETWORK = 0 +CIRCUITPY_ROTARYIO = 0 +CIRCUITPY_SAMD = 0 +CIRCUITPY_TOUCHIO = 0 +CIRCUITPY_AUDIOMIXER = 1 CIRCUITPY_AUDIOIO = 1 CIRCUITPY_DISPLAYIO = 1 CIRCUITPY_GAMEPAD = 1 @@ -33,6 +42,8 @@ CIRCUITPY_MATH = 1 FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pewpew_m4 CIRCUITPY_DISPLAY_FONT = $(TOP)/ports/atmel-samd/boards/ugame10/brutalist-6.bdf +USB_DEVICES = "CDC,MSC" + # Tweak inlining depending on language. ifeq ($(TRANSLATION), zh_Latn_pinyin) CFLAGS_INLINE_LIMIT = 45 diff --git a/ports/nrf/boards/clue_nrf52840_express/board.c b/ports/nrf/boards/clue_nrf52840_express/board.c new file mode 100644 index 0000000000..c118fe92f1 --- /dev/null +++ b/ports/nrf/boards/clue_nrf52840_express/board.c @@ -0,0 +1,99 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "boards/board.h" +#include "mpconfigboard.h" + +#include "shared-bindings/busio/SPI.h" +#include "shared-bindings/displayio/FourWire.h" +#include "shared-module/displayio/__init__.h" +#include "shared-module/displayio/mipi_constants.h" +#include "tick.h" + +displayio_fourwire_obj_t board_display_obj; + +#define DELAY 0x80 + +uint8_t display_init_sequence[] = { + 0x01, 0 | DELAY, 150, // SWRESET + 0x11, 0 | DELAY, 255, // SLPOUT + 0x36, 1, 0x00, // _MADCTL bottom to top refresh in vsync aligned order. + 0x3a, 1, 0x55, // COLMOD - 16bit color + 0x21, 0 | DELAY, 10, // _INVON + 0x13, 0 | DELAY, 10, // _NORON + 0x29, 0 | DELAY, 255, // _DISPON +}; + +void board_init(void) { + busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; + common_hal_busio_spi_construct(spi, &pin_P0_14, &pin_P0_15, NULL); + common_hal_busio_spi_never_reset(spi); + + displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; + bus->base.type = &displayio_fourwire_type; + common_hal_displayio_fourwire_construct(bus, + spi, + &pin_P0_13, // TFT_DC Command or data + &pin_P0_12, // TFT_CS Chip select + &pin_P1_03, // TFT_RST Reset + 60000000); + + displayio_display_obj_t* display = &displays[0].display; + display->base.type = &displayio_display_type; + common_hal_displayio_display_construct(display, + bus, + 240, // Width (after rotation) + 240, // Height (after rotation) + 0, // column start + 0, // row start + 270, // rotation + 16, // Color depth + false, // Grayscale + false, // Pixels in a byte share a row. Only used for depth < 8 + 1, // bytes per cell. Only valid for depths < 8 + false, // reverse_pixels_in_byte. Only valid for depths < 8 + MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command + MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command + MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command + 0x37, // set vertical scroll command + display_init_sequence, + sizeof(display_init_sequence), + &pin_P1_05, // backlight pin + NO_BRIGHTNESS_COMMAND, + 1.0f, // brightness (ignored) + true, // auto_brightness + false, // single_byte_bounds + false, // data_as_commands + true, // auto_refresh + 60); // native_frames_per_second +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} diff --git a/ports/nrf/boards/clue_nrf52840_express/mpconfigboard.h b/ports/nrf/boards/clue_nrf52840_express/mpconfigboard.h new file mode 100644 index 0000000000..a239ca7ce3 --- /dev/null +++ b/ports/nrf/boards/clue_nrf52840_express/mpconfigboard.h @@ -0,0 +1,63 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Glenn Ruben Bakke + * Copyright (c) 2018 Dan Halbert for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "nrfx/hal/nrf_gpio.h" + +#define MICROPY_HW_BOARD_NAME "Adafruit CLUE nRF52840 Express" +#define MICROPY_HW_MCU_NAME "nRF52840" + +#define MICROPY_HW_NEOPIXEL (&pin_P0_16) + +#define MICROPY_HW_LED_STATUS (&pin_P1_01) + +#if QSPI_FLASH_FILESYSTEM +#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 17) +#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 22) +#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 23) +#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 21) +#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 19) +#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 20) +#endif + +#if SPI_FLASH_FILESYSTEM +#define SPI_FLASH_MOSI_PIN &pin_P0_17 +#define SPI_FLASH_MISO_PIN &pin_P0_22 +#define SPI_FLASH_SCK_PIN &pin_P0_19 +#define SPI_FLASH_CS_PIN &pin_P0_20 +#endif + +#define BOARD_HAS_CRYSTAL 1 + +#define DEFAULT_I2C_BUS_SCL (&pin_P0_25) +#define DEFAULT_I2C_BUS_SDA (&pin_P0_24) + +#define DEFAULT_SPI_BUS_SCK (&pin_P0_08) +#define DEFAULT_SPI_BUS_MOSI (&pin_P0_26) +#define DEFAULT_SPI_BUS_MISO (&pin_P0_06) + +#define DEFAULT_UART_BUS_RX (&pin_P0_04) +#define DEFAULT_UART_BUS_TX (&pin_P0_05) diff --git a/ports/nrf/boards/clue_nrf52840_express/mpconfigboard.mk b/ports/nrf/boards/clue_nrf52840_express/mpconfigboard.mk new file mode 100644 index 0000000000..16cb208247 --- /dev/null +++ b/ports/nrf/boards/clue_nrf52840_express/mpconfigboard.mk @@ -0,0 +1,10 @@ +USB_VID = 0x239A +USB_PID = 0x8072 +USB_PRODUCT = "CLUE nRF52840 Express" +USB_MANUFACTURER = "Adafruit Industries LLC" + +MCU_CHIP = nrf52840 + +QSPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICE_COUNT = 1 +EXTERNAL_FLASH_DEVICES = "GD25Q16C" diff --git a/ports/nrf/boards/clue_nrf52840_express/pins.c b/ports/nrf/boards/clue_nrf52840_express/pins.c new file mode 100644 index 0000000000..b13d1977fb --- /dev/null +++ b/ports/nrf/boards/clue_nrf52840_express/pins.c @@ -0,0 +1,101 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR_P0), MP_ROM_PTR(&pin_P0_04) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_P0_04) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P0_04) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_04) }, + + { MP_ROM_QSTR(MP_QSTR_P1), MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_05) }, + + { MP_ROM_QSTR(MP_QSTR_P2), MP_ROM_PTR(&pin_P0_03) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_P0_03) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_P0_03) }, + + { MP_ROM_QSTR(MP_QSTR_P3), MP_ROM_PTR(&pin_P0_28) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_P0_28) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_P0_28) }, + + { MP_ROM_QSTR(MP_QSTR_P4), MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_P0_02) }, + + { MP_ROM_QSTR(MP_QSTR_P5), MP_ROM_PTR(&pin_P1_02) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P1_02) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_A), MP_ROM_PTR(&pin_P1_02) }, + + { MP_ROM_QSTR(MP_QSTR_P6), MP_ROM_PTR(&pin_P1_09) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_P1_09) }, + + { MP_ROM_QSTR(MP_QSTR_P7), MP_ROM_PTR(&pin_P0_07) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_P0_07) }, + + { MP_ROM_QSTR(MP_QSTR_P8), MP_ROM_PTR(&pin_P1_07) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_P1_07) }, + + { MP_ROM_QSTR(MP_QSTR_P9), MP_ROM_PTR(&pin_P0_27) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_P0_27) }, + + { MP_ROM_QSTR(MP_QSTR_P10), MP_ROM_PTR(&pin_P0_30) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_P0_30) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_P0_30) }, + + { MP_ROM_QSTR(MP_QSTR_P11), MP_ROM_PTR(&pin_P1_10) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_P1_10) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_B), MP_ROM_PTR(&pin_P1_10) }, + + { MP_ROM_QSTR(MP_QSTR_P12), MP_ROM_PTR(&pin_P0_31) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_P0_31) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_31) }, + + { MP_ROM_QSTR(MP_QSTR_P13), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_08) }, + + { MP_ROM_QSTR(MP_QSTR_P14), MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_06) }, + + { MP_ROM_QSTR(MP_QSTR_P15), MP_ROM_PTR(&pin_P0_26) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_P0_26) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_26) }, + + { MP_ROM_QSTR(MP_QSTR_P16), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_29) }, + + { MP_ROM_QSTR(MP_QSTR_P17), MP_ROM_PTR(&pin_P1_01) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_P1_01) }, + { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_P1_01) }, + + { MP_ROM_QSTR(MP_QSTR_P18), MP_ROM_PTR(&pin_P0_16) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_P0_16) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_P0_16) }, + + { MP_ROM_QSTR(MP_QSTR_P19), MP_ROM_PTR(&pin_P0_25) }, + { MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_P0_25) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_25) }, + + { MP_ROM_QSTR(MP_QSTR_P20), MP_ROM_PTR(&pin_P0_24) }, + { MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_P0_24) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_24) }, + + { MP_ROM_QSTR(MP_QSTR_MICROPHONE_CLOCK), MP_ROM_PTR(&pin_P0_11) }, + { MP_ROM_QSTR(MP_QSTR_MICROPHONE_DATA), MP_ROM_PTR(&pin_P1_08) }, + + { MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_P1_03) }, + { MP_ROM_QSTR(MP_QSTR_TFT_BACKLIGHT), MP_ROM_PTR(&pin_P1_05) }, + { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_P0_12) }, + { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_P0_13) }, + { MP_ROM_QSTR(MP_QSTR_TFT_SCK), MP_ROM_PTR(&pin_P0_14) }, + { MP_ROM_QSTR(MP_QSTR_TFT_MOSI), MP_ROM_PTR(&pin_P0_15) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; + +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/nrf/common-hal/busio/I2C.c b/ports/nrf/common-hal/busio/I2C.c index 7a079ff7f4..f6f686cdfe 100644 --- a/ports/nrf/common-hal/busio/I2C.c +++ b/ports/nrf/common-hal/busio/I2C.c @@ -63,7 +63,7 @@ void i2c_reset(void) { if (never_reset[i]) { continue; } - nrf_twim_disable(twim_peripherals[i].twim.p_twim); + nrfx_twim_uninit(&twim_peripherals[i].twim); twim_peripherals[i].in_use = false; } } @@ -150,13 +150,6 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, const mcu_pin_obj_t * // About to init. If we fail after this point, common_hal_busio_i2c_deinit() will set in_use to false. self->twim_peripheral->in_use = true; nrfx_err_t err = nrfx_twim_init(&self->twim_peripheral->twim, &config, NULL, NULL); - - // A soft reset doesn't uninit the driver so we might end up with a invalid state - if (err == NRFX_ERROR_INVALID_STATE) { - nrfx_twim_uninit(&self->twim_peripheral->twim); - err = nrfx_twim_init(&self->twim_peripheral->twim, &config, NULL, NULL); - } - if (err != NRFX_SUCCESS) { common_hal_busio_i2c_deinit(self); mp_raise_OSError(MP_EIO); diff --git a/ports/nrf/common-hal/busio/SPI.c b/ports/nrf/common-hal/busio/SPI.c index d2977909e1..639bbcdd05 100644 --- a/ports/nrf/common-hal/busio/SPI.c +++ b/ports/nrf/common-hal/busio/SPI.c @@ -68,7 +68,7 @@ void spi_reset(void) { if (never_reset[i]) { continue; } - nrf_spim_disable(spim_peripherals[i].spim.p_reg); + nrfx_spim_uninit(&spim_peripherals[i].spim); } } @@ -160,13 +160,6 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, const mcu_pin_obj_t * } nrfx_err_t err = nrfx_spim_init(&self->spim_peripheral->spim, &config, NULL, NULL); - - // A soft reset doesn't uninit the driver so we might end up with a invalid state - if (err == NRFX_ERROR_INVALID_STATE) { - nrfx_spim_uninit(&self->spim_peripheral->spim); - err = nrfx_spim_init(&self->spim_peripheral->spim, &config, NULL, NULL); - } - if (err != NRFX_SUCCESS) { common_hal_busio_spi_deinit(self); mp_raise_OSError(MP_EIO); diff --git a/ports/nrf/common-hal/busio/UART.c b/ports/nrf/common-hal/busio/UART.c index 0579db4142..d79b65ff81 100644 --- a/ports/nrf/common-hal/busio/UART.c +++ b/ports/nrf/common-hal/busio/UART.c @@ -124,7 +124,7 @@ static void uart_callback_irq (const nrfx_uarte_event_t * event, void * context) void uart_reset(void) { for (size_t i = 0 ; i < MP_ARRAY_SIZE(nrfx_uartes); i++) { - nrf_uarte_disable(nrfx_uartes[i].p_reg); + nrfx_uarte_uninit(&nrfx_uartes[i]); } } @@ -171,7 +171,6 @@ void common_hal_busio_uart_construct (busio_uart_obj_t *self, } }; - nrfx_uarte_uninit(self->uarte); _VERIFY_ERR(nrfx_uarte_init(self->uarte, &config, uart_callback_irq)); // Init buffer for rx diff --git a/ports/nrf/common-hal/neopixel_write/__init__.c b/ports/nrf/common-hal/neopixel_write/__init__.c index 3b67778a62..3052e908dd 100644 --- a/ports/nrf/common-hal/neopixel_write/__init__.c +++ b/ports/nrf/common-hal/neopixel_write/__init__.c @@ -130,7 +130,17 @@ void common_hal_neopixel_write (const digitalio_digitalinout_obj_t* digitalinout if (pattern_size <= sizeof(one_pixel)) { pixels_pattern = (uint16_t *) one_pixel; } else { - pixels_pattern = (uint16_t *) m_malloc_maybe(pattern_size, false); + uint8_t sd_en = 0; + (void) sd_softdevice_is_enabled(&sd_en); + if (sd_en) { + // If the soft device is enabled then we must use PWM to + // transmit. This takes a bunch of memory to do so raise an + // exception if we can't. + pixels_pattern = (uint16_t *) m_malloc(pattern_size, false); + } else { + pixels_pattern = (uint16_t *) m_malloc_maybe(pattern_size, false); + } + pattern_on_heap = true; } } diff --git a/ports/stm32f4/mpconfigport.mk b/ports/stm32f4/mpconfigport.mk index 88636a9d89..42f3905723 100644 --- a/ports/stm32f4/mpconfigport.mk +++ b/ports/stm32f4/mpconfigport.mk @@ -65,9 +65,13 @@ ifndef CIRCUITPY_NEOPIXEL_WRITE CIRCUITPY_NEOPIXEL_WRITE = 1 endif -ifndef +ifndef CIRCUITPY_DISPLAYIO CIRCUITPY_DISPLAYIO = 1 endif +ifndef MICROPY_CPYTHON_COMPAT +MICROPY_CPYTHON_COMPAT = 1 +endif + #ifeq ($(MCU_SUB_VARIANT), stm32f412zx) #endif diff --git a/py/obj.c b/py/obj.c index bd2aaf9d26..09e71be4d6 100644 --- a/py/obj.c +++ b/py/obj.c @@ -489,6 +489,7 @@ mp_obj_t mp_obj_len_maybe(mp_obj_t o_in) { mp_obj_t mp_obj_subscr(mp_obj_t base, mp_obj_t index, mp_obj_t value) { mp_obj_type_t *type = mp_obj_get_type(base); + if (type->subscr != NULL) { mp_obj_t ret = type->subscr(base, index, value); // May have called port specific C code. Make sure it didn't mess up the heap. @@ -496,7 +497,6 @@ mp_obj_t mp_obj_subscr(mp_obj_t base, mp_obj_t index, mp_obj_t value) { if (ret != MP_OBJ_NULL) { return ret; } - // TODO: call base classes here? } if (value == MP_OBJ_NULL) { if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { diff --git a/py/objlist.c b/py/objlist.c index ea38e64e55..b32f82085e 100644 --- a/py/objlist.c +++ b/py/objlist.c @@ -159,11 +159,11 @@ STATIC mp_obj_t list_binary_op(mp_binary_op_t op, mp_obj_t lhs, mp_obj_t rhs) { } STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) { + mp_obj_list_t *self = mp_instance_cast_to_native_base(self_in, &mp_type_list); if (value == MP_OBJ_NULL) { // delete #if MICROPY_PY_BUILTINS_SLICE if (MP_OBJ_IS_TYPE(index, &mp_type_slice)) { - mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in); mp_bound_slice_t slice; if (!mp_seq_get_fast_slice_indexes(self->len, index, &slice)) { mp_raise_NotImplementedError(NULL); @@ -179,12 +179,11 @@ STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) { return mp_const_none; } #endif - mp_obj_t args[2] = {self_in, index}; + mp_obj_t args[2] = {self, index}; list_pop(2, args); return mp_const_none; } else if (value == MP_OBJ_SENTINEL) { // load - mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in); #if MICROPY_PY_BUILTINS_SLICE if (MP_OBJ_IS_TYPE(index, &mp_type_slice)) { mp_bound_slice_t slice; @@ -201,7 +200,6 @@ STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) { } else { #if MICROPY_PY_BUILTINS_SLICE if (MP_OBJ_IS_TYPE(index, &mp_type_slice)) { - mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in); size_t value_len; mp_obj_t *value_items; mp_obj_get_array(value, &value_len, &value_items); mp_bound_slice_t slice_out; @@ -230,7 +228,7 @@ STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) { return mp_const_none; } #endif - mp_obj_list_store(self_in, index, value); + mp_obj_list_store(self, index, value); return mp_const_none; } } diff --git a/py/objnamedtuple.c b/py/objnamedtuple.c index a044fe3ff8..a0a64f9b25 100644 --- a/py/objnamedtuple.c +++ b/py/objnamedtuple.c @@ -31,6 +31,7 @@ #include "py/runtime.h" #include "py/objstr.h" #include "py/objnamedtuple.h" +#include "py/objtype.h" #include "supervisor/shared/translate.h" @@ -70,6 +71,15 @@ void namedtuple_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t ki mp_obj_attrtuple_print_helper(print, fields, &o->tuple); } +mp_obj_t namedtuple_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) { + mp_obj_type_t *type = mp_obj_get_type(self_in); + // Check for subclasses of namedtuple and unpack if needed. + if (type->parent != &mp_type_tuple) { + self_in = ((mp_obj_instance_t*) self_in)->subobj[0]; + } + return mp_obj_tuple_subscr(self_in, index, value); +} + void namedtuple_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { if (dest[0] == MP_OBJ_NULL) { // load attribute @@ -167,7 +177,7 @@ STATIC mp_obj_t mp_obj_new_namedtuple_type(qstr name, size_t n_fields, mp_obj_t o->base.unary_op = mp_obj_tuple_unary_op; o->base.binary_op = mp_obj_tuple_binary_op; o->base.attr = namedtuple_attr; - o->base.subscr = mp_obj_tuple_subscr; + o->base.subscr = namedtuple_subscr; o->base.getiter = mp_obj_tuple_getiter; o->base.parent = &mp_type_tuple; return MP_OBJ_FROM_PTR(o); diff --git a/py/objnamedtuple.h b/py/objnamedtuple.h index 0ea0d28622..5a7512e3a6 100644 --- a/py/objnamedtuple.h +++ b/py/objnamedtuple.h @@ -49,6 +49,7 @@ typedef struct _mp_obj_namedtuple_t { void namedtuple_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind); size_t mp_obj_namedtuple_find_field(const mp_obj_namedtuple_type_t *type, qstr name); +mp_obj_t namedtuple_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value); void namedtuple_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest); mp_obj_namedtuple_type_t *mp_obj_new_namedtuple_base(size_t n_fields, mp_obj_t *fields); mp_obj_t namedtuple_make_new(const mp_obj_type_t *type_in, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args); diff --git a/py/objtuple.c b/py/objtuple.c index ed13cdcef2..2b483f8b83 100644 --- a/py/objtuple.c +++ b/py/objtuple.c @@ -178,6 +178,7 @@ mp_obj_t mp_obj_tuple_binary_op(mp_binary_op_t op, mp_obj_t lhs, mp_obj_t rhs) { } mp_obj_t mp_obj_tuple_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) { + if (value == MP_OBJ_SENTINEL) { // load mp_obj_tuple_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/py/objtype.c b/py/objtype.c index 0212a78daa..a5e733208c 100644 --- a/py/objtype.c +++ b/py/objtype.c @@ -34,6 +34,7 @@ #include "py/objtype.h" #include "py/runtime.h" +#include "supervisor/shared/stack.h" #include "supervisor/shared/translate.h" #if MICROPY_DEBUG_VERBOSE // print debugging info @@ -851,8 +852,13 @@ STATIC mp_obj_t instance_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value mp_obj_class_lookup(&lookup, self->base.type); meth_args = 3; } - if (member[0] == MP_OBJ_SENTINEL) { - return mp_obj_subscr(self->subobj[0], index, value); + if (member[0] == MP_OBJ_SENTINEL) { // native base subscr exists + mp_obj_type_t *subobj_type = mp_obj_get_type(self->subobj[0]); + // return mp_obj_subscr(self->subobj[0], index, value, instance); + mp_obj_t ret = subobj_type->subscr(self_in, index, value); + // May have called port specific C code. Make sure it didn't mess up the heap. + assert_heap_ok(); + return ret; } else if (member[0] != MP_OBJ_NULL) { mp_obj_t args[3] = {self_in, index, value}; // TODO probably need to call mp_convert_member_lookup, and use mp_call_method_n_kw diff --git a/shared-bindings/_pixelbuf/PixelBuf.c b/shared-bindings/_pixelbuf/PixelBuf.c index 420720e622..3e93190470 100644 --- a/shared-bindings/_pixelbuf/PixelBuf.c +++ b/shared-bindings/_pixelbuf/PixelBuf.c @@ -26,6 +26,7 @@ #include "py/obj.h" #include "py/objarray.h" +#include "py/objtype.h" #include "py/mphal.h" #include "py/runtime.h" #include "py/binary.h" @@ -40,8 +41,6 @@ #include "../../shared-module/_pixelbuf/PixelBuf.h" #include "shared-bindings/digitalio/DigitalInOut.h" -extern const pixelbuf_byteorder_obj_t byteorder_BGR; -extern const mp_obj_type_t pixelbuf_byteorder_type; extern const int32_t colorwheel(float pos); //| .. currentmodule:: pixelbuf @@ -51,7 +50,7 @@ extern const int32_t colorwheel(float pos); //| //| :class:`~_pixelbuf.PixelBuf` implements an RGB[W] bytearray abstraction. //| -//| .. class:: PixelBuf(size, buf, byteorder=BGR, brightness=0, rawbuf=None, offset=0, dotstar=False, auto_write=False, write_function=None, write_args=None) +//| .. class:: PixelBuf(size, buf, byteorder="BGR", brightness=0, rawbuf=None, offset=0, auto_write=False) //| //| Create a PixelBuf object of the specified size, byteorder, and bits per pixel. //| @@ -60,50 +59,69 @@ extern const int32_t colorwheel(float pos); //| //| When only given ``buf``, ``brightness`` applies to the next pixel assignment. //| -//| When ``dotstar`` is True, and ``bpp`` is 4, the 4th value in a tuple/list -//| is the individual pixel brightness (0-1). Not compatible with RGBW Byteorders. -//| Compatible `ByteOrder` classes are bpp=3, or bpp=4 and has_luminosity=True (g LBGR). +//| When ``P`` (pwm duration) is present as the 4th character of the byteorder +//| string, the 4th value in the tuple/list for a pixel is the individual pixel +//| brightness (0.0-1.0) and will enable a Dotstar compatible 1st byte in the +//| output buffer (``buf``). //| //| :param ~int size: Number of pixelsx -//| :param ~bytearray buf: Bytearray to store pixel data in -//| :param ~_pixelbuf.ByteOrder byteorder: Byte order constant from `_pixelbuf` +//| :param ~bytearray buf: Bytearray in which to store pixel data +//| :param ~str byteorder: Byte order string (such as "BGR" or "PBGR") //| :param ~float brightness: Brightness (0 to 1.0, default 1.0) -//| :param ~bytearray rawbuf: Bytearray to store raw pixel colors in +//| :param ~bytearray rawbuf: Bytearray in which to store raw pixel data (before brightness adjustment) //| :param ~int offset: Offset from start of buffer (default 0) -//| :param ~bool dotstar: Dotstar mode (default False) //| :param ~bool auto_write: Whether to automatically write pixels (Default False) -//| :param ~callable write_function: (optional) Callable to use to send pixels -//| :param ~list write_args: (optional) Tuple or list of args to pass to ``write_function``. The -//| PixelBuf instance is appended after these args. //| STATIC mp_obj_t pixelbuf_pixelbuf_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { mp_arg_check_num(n_args, kw_args, 2, MP_OBJ_FUN_ARGS_MAX, true); - enum { ARG_size, ARG_buf, ARG_byteorder, ARG_brightness, ARG_rawbuf, ARG_offset, ARG_dotstar, - ARG_auto_write, ARG_write_function, ARG_write_args }; + enum { ARG_size, ARG_buf, ARG_byteorder, ARG_brightness, ARG_rawbuf, ARG_offset, + ARG_auto_write }; static const mp_arg_t allowed_args[] = { { MP_QSTR_size, MP_ARG_REQUIRED | MP_ARG_INT }, { MP_QSTR_buf, MP_ARG_REQUIRED | MP_ARG_OBJ }, - { MP_QSTR_byteorder, MP_ARG_OBJ, { .u_obj = mp_const_none } }, + { MP_QSTR_byteorder, MP_ARG_OBJ, { .u_obj = MP_OBJ_NEW_QSTR(MP_QSTR_BGR) } }, { MP_QSTR_brightness, MP_ARG_OBJ, { .u_obj = mp_const_none } }, { MP_QSTR_rawbuf, MP_ARG_OBJ, { .u_obj = mp_const_none } }, { MP_QSTR_offset, MP_ARG_INT, { .u_int = 0 } }, - { MP_QSTR_dotstar, MP_ARG_BOOL, { .u_bool = false } }, { MP_QSTR_auto_write, MP_ARG_BOOL, {.u_bool = false} }, - { MP_QSTR_write_function, MP_ARG_OBJ, {.u_obj = mp_const_none} }, - { MP_QSTR_write_args, MP_ARG_OBJ, {.u_obj = mp_const_none} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + const char *byteorder = NULL; + pixelbuf_byteorder_details_t byteorder_details; + size_t bo_len; - if (mp_obj_is_subclass_fast(args[ARG_byteorder].u_obj, &pixelbuf_byteorder_type)) - mp_raise_TypeError_varg(translate("byteorder is not an instance of ByteOrder (got a %s)"), mp_obj_get_type_str(args[ARG_byteorder].u_obj)); + if (!MP_OBJ_IS_STR(args[ARG_byteorder].u_obj)) + mp_raise_TypeError(translate("byteorder is not a string")); - pixelbuf_byteorder_obj_t *byteorder = (args[ARG_byteorder].u_obj == mp_const_none) ? MP_OBJ_FROM_PTR(&byteorder_BGR) : args[ARG_byteorder].u_obj; + byteorder = mp_obj_str_get_data(args[ARG_byteorder].u_obj, &bo_len); + if (bo_len < 3 || bo_len > 4) + mp_raise_ValueError(translate("Invalid byteorder string")); + byteorder_details.order = args[ARG_byteorder].u_obj; - if (byteorder->has_white && args[ARG_dotstar].u_bool) - mp_raise_ValueError_varg(translate("Can not use dotstar with %s"), mp_obj_get_type_str(byteorder)); + byteorder_details.bpp = bo_len; + char *dotstar = strchr(byteorder, 'P'); + char *r = strchr(byteorder, 'R'); + char *g = strchr(byteorder, 'G'); + char *b = strchr(byteorder, 'B'); + char *w = strchr(byteorder, 'W'); + int num_chars = (dotstar ? 1 : 0) + (w ? 1 : 0) + (r ? 1 : 0) + (g ? 1 : 0) + (b ? 1 : 0); + if ((num_chars < byteorder_details.bpp) || !(r && b && g)) + mp_raise_ValueError(translate("Invalid byteorder string")); + byteorder_details.is_dotstar = dotstar ? true : false; + byteorder_details.has_white = w ? true : false; + byteorder_details.byteorder.r = r - byteorder; + byteorder_details.byteorder.g = g - byteorder; + byteorder_details.byteorder.b = b - byteorder; + byteorder_details.byteorder.w = w ? w - byteorder : 0; + // The dotstar brightness byte is always first (as it goes with the pixel start bits) + if (dotstar && byteorder[0] != 'P') { + mp_raise_ValueError(translate("Invalid byteorder string")); + } + if (byteorder_details.has_white && byteorder_details.is_dotstar) + mp_raise_ValueError(translate("Invalid byteorder string")); - size_t effective_bpp = args[ARG_dotstar].u_bool ? 4 : byteorder->bpp; // Always 4 for DotStar + size_t effective_bpp = byteorder_details.is_dotstar ? 4 : byteorder_details.bpp; // Always 4 for DotStar size_t bytes = args[ARG_size].u_int * effective_bpp; size_t offset = args[ARG_offset].u_int; mp_buffer_info_t bufinfo, rawbufinfo; @@ -120,63 +138,22 @@ STATIC mp_obj_t pixelbuf_pixelbuf_make_new(const mp_obj_type_t *type, size_t n_a if (bytes + offset > bufinfo.len) mp_raise_ValueError_varg(translate("buf is too small. need %d bytes"), bytes + offset); - if (!MP_OBJ_IS_TYPE(args[ARG_write_args].u_obj, &mp_type_list) && - !MP_OBJ_IS_TYPE(args[ARG_write_args].u_obj, &mp_type_tuple) && - args[ARG_write_args].u_obj != mp_const_none) - { - mp_raise_ValueError(translate("write_args must be a list, tuple, or None")); - } - // Validation complete, allocate and populate object. pixelbuf_pixelbuf_obj_t *self = m_new_obj(pixelbuf_pixelbuf_obj_t); self->base.type = &pixelbuf_pixelbuf_type; self->pixels = args[ARG_size].u_int; self->bytes = bytes; - self->byteorder = *byteorder; // Copied because we modify for dotstar + self->byteorder = byteorder_details; // Copied because we modify for dotstar self->bytearray = args[ARG_buf].u_obj; self->two_buffers = two_buffers; self->rawbytearray = two_buffers ? args[ARG_rawbuf].u_obj : NULL; self->offset = offset; - self->dotstar_mode = args[ARG_dotstar].u_bool; self->buf = (uint8_t *)bufinfo.buf + offset; self->rawbuf = two_buffers ? (uint8_t *)rawbufinfo.buf + offset : NULL; self->pixel_step = effective_bpp; self->auto_write = args[ARG_auto_write].u_bool; - if (self->dotstar_mode) { - // Ensure sane configuration - if (!self->byteorder.has_luminosity) { - self->byteorder.has_luminosity = true; - self->byteorder.byteorder.b += 1; - self->byteorder.byteorder.g += 1; - self->byteorder.byteorder.r += 1; - } - self->byteorder.byteorder.w = 0; - } - - // Show/auto-write callbacks - self->write_function = args[ARG_write_function].u_obj; - mp_obj_t function_args = args[ARG_write_args].u_obj; - mp_obj_t *src_objs = (mp_obj_t *)&mp_const_none_obj; - size_t num_items = 0; - if (function_args != mp_const_none) { - if (MP_OBJ_IS_TYPE(function_args, &mp_type_list)) { - mp_obj_list_t *t = MP_OBJ_TO_PTR(function_args); - num_items = t->len; - src_objs = t->items; - } else { - mp_obj_tuple_t *l = MP_OBJ_TO_PTR(function_args); - num_items = l->len; - src_objs = l->items; - } - } - self->write_function_args = mp_obj_new_tuple(num_items + 1, NULL); - for (size_t i = 0; i < num_items; i++) { - self->write_function_args->items[i] = src_objs[i]; - } - self->write_function_args->items[num_items] = self; - if (args[ARG_brightness].u_obj == mp_const_none) { self->brightness = 1.0; } else { @@ -187,9 +164,9 @@ STATIC mp_obj_t pixelbuf_pixelbuf_make_new(const mp_obj_type_t *type, size_t n_a self->brightness = 1; } - if (self->dotstar_mode) { + if (self->byteorder.is_dotstar) { // Initialize the buffer with the dotstar start bytes. - // Header and end must be setup by caller + // Note: Header and end must be setup by caller for (uint i = 0; i < self->pixels * 4; i += 4) { self->buf[i] = DOTSTAR_LED_START_FULL_BRIGHT; if (two_buffers) { @@ -201,13 +178,20 @@ STATIC mp_obj_t pixelbuf_pixelbuf_make_new(const mp_obj_type_t *type, size_t n_a return MP_OBJ_FROM_PTR(self); } + +// Helper to ensure we have the native super class instead of a subclass. +static pixelbuf_pixelbuf_obj_t* native_pixelbuf(mp_obj_t pixelbuf_obj) { + mp_obj_t native_pixelbuf = mp_instance_cast_to_native_base(pixelbuf_obj, &pixelbuf_pixelbuf_type); + mp_obj_assert_native_inited(native_pixelbuf); + return MP_OBJ_TO_PTR(native_pixelbuf); +} + //| .. attribute:: bpp //| //| The number of bytes per pixel in the buffer (read-only) //| STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_bpp(mp_obj_t self_in) { - mp_check_self(MP_OBJ_IS_TYPE(self_in, &pixelbuf_pixelbuf_type)); - pixelbuf_pixelbuf_obj_t *self = MP_OBJ_TO_PTR(self_in); + pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in); return mp_obj_new_int_from_uint(self->byteorder.bpp); } MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_get_bpp_obj, pixelbuf_pixelbuf_obj_get_bpp); @@ -230,16 +214,14 @@ const mp_obj_property_t pixelbuf_pixelbuf_bpp_obj = { //| In DotStar mode //| STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_brightness(mp_obj_t self_in) { - mp_check_self(MP_OBJ_IS_TYPE(self_in, &pixelbuf_pixelbuf_type)); - pixelbuf_pixelbuf_obj_t *self = MP_OBJ_TO_PTR(self_in); + pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in); return mp_obj_new_float(self->brightness); } MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_get_brightness_obj, pixelbuf_pixelbuf_obj_get_brightness); STATIC mp_obj_t pixelbuf_pixelbuf_obj_set_brightness(mp_obj_t self_in, mp_obj_t value) { - mp_check_self(MP_OBJ_IS_TYPE(self_in, &pixelbuf_pixelbuf_type)); - pixelbuf_pixelbuf_obj_t *self = MP_OBJ_TO_PTR(self_in); + pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in); self->brightness = mp_obj_float_get(value); if (self->brightness > 1) self->brightness = 1; @@ -248,7 +230,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_obj_set_brightness(mp_obj_t self_in, mp_obj_t if (self->two_buffers) pixelbuf_recalculate_brightness(self); if (self->auto_write) - call_write_function(self); + pixelbuf_call_show(self_in); return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_set_brightness_obj, pixelbuf_pixelbuf_obj_set_brightness); @@ -266,26 +248,30 @@ void pixelbuf_recalculate_brightness(pixelbuf_pixelbuf_obj_t *self) { // Compensate for shifted buffer (bpp=3 dotstar) for (uint i = 0; i < self->bytes; i++) { // Don't adjust per-pixel luminance bytes in dotstar mode - if (!self->dotstar_mode || (i % 4 != 0)) + if (!self->byteorder.is_dotstar || (i % 4 != 0)) buf[i] = rawbuf[i] * self->brightness; } } +mp_obj_t pixelbuf_call_show(mp_obj_t self_in) { + mp_obj_t dest[2]; + mp_load_method(self_in, MP_QSTR_show, dest); + return mp_call_method_n_kw(0, 0, dest); +} + //| .. attribute:: auto_write //| //| Whether to automatically write the pixels after each update. //| STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_auto_write(mp_obj_t self_in) { - mp_check_self(MP_OBJ_IS_TYPE(self_in, &pixelbuf_pixelbuf_type)); - pixelbuf_pixelbuf_obj_t *self = MP_OBJ_TO_PTR(self_in); + pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in); return mp_obj_new_bool(self->auto_write); } MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_get_auto_write_obj, pixelbuf_pixelbuf_obj_get_auto_write); STATIC mp_obj_t pixelbuf_pixelbuf_obj_set_auto_write(mp_obj_t self_in, mp_obj_t value) { - mp_check_self(MP_OBJ_IS_TYPE(self_in, &pixelbuf_pixelbuf_type)); - pixelbuf_pixelbuf_obj_t *self = MP_OBJ_TO_PTR(self_in); + pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in); self->auto_write = mp_obj_is_true(value); return mp_const_none; } @@ -306,8 +292,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_auto_write_obj = { //| actual pixels. //| STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_buf(mp_obj_t self_in) { - mp_check_self(MP_OBJ_IS_TYPE(self_in, &pixelbuf_pixelbuf_type)); - pixelbuf_pixelbuf_obj_t *self = MP_OBJ_TO_PTR(self_in); + pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in); return mp_obj_new_bytearray_by_ref(self->bytes, self->buf); } MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_get_buf_obj, pixelbuf_pixelbuf_obj_get_buf); @@ -321,25 +306,23 @@ const mp_obj_property_t pixelbuf_pixelbuf_buf_obj = { //| .. attribute:: byteorder //| -//| `ByteOrder` class for the buffer (read-only) +//| byteorder string for the buffer (read-only) //| STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_byteorder(mp_obj_t self_in) { - mp_check_self(MP_OBJ_IS_TYPE(self_in, &pixelbuf_pixelbuf_type)); - pixelbuf_pixelbuf_obj_t *self = MP_OBJ_TO_PTR(self_in); - return &self->byteorder; + pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in); + return self->byteorder.order; } -MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_get_byteorder_obj, pixelbuf_pixelbuf_obj_get_byteorder); +MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_get_byteorder_str, pixelbuf_pixelbuf_obj_get_byteorder); -const mp_obj_property_t pixelbuf_pixelbuf_byteorder_obj = { +const mp_obj_property_t pixelbuf_pixelbuf_byteorder_str = { .base.type = &mp_type_property, - .proxy = {(mp_obj_t)&pixelbuf_pixelbuf_get_byteorder_obj, + .proxy = {(mp_obj_t)&pixelbuf_pixelbuf_get_byteorder_str, (mp_obj_t)&mp_const_none_obj, (mp_obj_t)&mp_const_none_obj}, }; STATIC mp_obj_t pixelbuf_pixelbuf_unary_op(mp_unary_op_t op, mp_obj_t self_in) { - mp_check_self(MP_OBJ_IS_TYPE(self_in, &pixelbuf_pixelbuf_type)); - pixelbuf_pixelbuf_obj_t *self = MP_OBJ_TO_PTR(self_in); + pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in); switch (op) { case MP_UNARY_OP_BOOL: return mp_const_true; case MP_UNARY_OP_LEN: return MP_OBJ_NEW_SMALL_INT(self->pixels); @@ -349,23 +332,14 @@ STATIC mp_obj_t pixelbuf_pixelbuf_unary_op(mp_unary_op_t op, mp_obj_t self_in) { //| .. method:: show() //| -//| Call the associated write function to display the pixels. +//| Must be implemented in subclasses. //| STATIC mp_obj_t pixelbuf_pixelbuf_show(mp_obj_t self_in) { - mp_check_self(MP_OBJ_IS_TYPE(self_in, &pixelbuf_pixelbuf_type)); - pixelbuf_pixelbuf_obj_t *self = MP_OBJ_TO_PTR(self_in); - call_write_function(self); - return mp_const_none; + mp_raise_NotImplementedError(NULL); } STATIC MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_show_obj, pixelbuf_pixelbuf_show); -void call_write_function(pixelbuf_pixelbuf_obj_t *self) { - // execute function if it's set - if (self->write_function != mp_const_none) { - mp_call_function_n_kw(self->write_function, self->write_function_args->len, 0, self->write_function_args->items); - } -} //| .. method:: __getitem__(index) //| @@ -376,36 +350,43 @@ void call_write_function(pixelbuf_pixelbuf_obj_t *self) { //| Sets the pixel value at the given index. //| STATIC mp_obj_t pixelbuf_pixelbuf_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value) { - mp_check_self(MP_OBJ_IS_TYPE(self_in, &pixelbuf_pixelbuf_type)); - if (value == MP_OBJ_NULL) { // delete item // slice deletion return MP_OBJ_NULL; // op not supported } - pixelbuf_pixelbuf_obj_t *self = MP_OBJ_TO_PTR(self_in); + pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in); + if (0) { #if MICROPY_PY_BUILTINS_SLICE } else if (MP_OBJ_IS_TYPE(index_in, &mp_type_slice)) { mp_bound_slice_t slice; - if (!mp_seq_get_fast_slice_indexes(self->bytes, index_in, &slice)) - mp_raise_NotImplementedError(translate("Only slices with step=1 (aka None) are supported")); + mp_seq_get_fast_slice_indexes(self->pixels, index_in, &slice); + if ((slice.stop * self->pixel_step) > self->bytes) mp_raise_IndexError(translate("Range out of bounds")); + if (slice.step < 0) + mp_raise_IndexError(translate("Negative step not supported")); if (value == MP_OBJ_SENTINEL) { // Get size_t len = slice.stop - slice.start; - return pixelbuf_get_pixel_array((uint8_t *) self->buf + slice.start, len, &self->byteorder, self->pixel_step, self->dotstar_mode); + if (slice.step > 1) { + len = (len / slice.step) + (len % slice.step ? 1 : 0); + } + uint8_t *readbuf = self->two_buffers ? self->rawbuf : self->buf; + return pixelbuf_get_pixel_array(readbuf + slice.start, len, &self->byteorder, self->pixel_step, slice.step, self->byteorder.is_dotstar); } else { // Set #if MICROPY_PY_ARRAY_SLICE_ASSIGN if (!(MP_OBJ_IS_TYPE(value, &mp_type_list) || MP_OBJ_IS_TYPE(value, &mp_type_tuple))) mp_raise_ValueError(translate("tuple/list required on RHS")); - size_t dst_len = slice.stop - slice.start; - + size_t dst_len = (slice.stop - slice.start); + if (slice.step > 1) { + dst_len = (dst_len / slice.step) + (dst_len % slice.step ? 1 : 0); + } mp_obj_t *src_objs; size_t num_items; if (MP_OBJ_IS_TYPE(value, &mp_type_list)) { @@ -421,16 +402,17 @@ STATIC mp_obj_t pixelbuf_pixelbuf_subscr(mp_obj_t self_in, mp_obj_t index_in, mp mp_raise_ValueError_varg(translate("Unmatched number of items on RHS (expected %d, got %d)."), dst_len, num_items); - for (size_t i = slice.start; i < slice.stop; i++) { + size_t target_i = slice.start; + for (size_t i = slice.start; target_i < slice.stop; i++, target_i += slice.step) { mp_obj_t *item = src_objs[i-slice.start]; if (MP_OBJ_IS_TYPE(value, &mp_type_list) || MP_OBJ_IS_TYPE(value, &mp_type_tuple) || MP_OBJ_IS_INT(value)) { - pixelbuf_set_pixel(self->buf + (i * self->pixel_step), + pixelbuf_set_pixel(self->buf + (target_i * self->pixel_step), self->two_buffers ? self->rawbuf + (i * self->pixel_step) : NULL, - self->brightness, item, &self->byteorder, self->dotstar_mode); + self->brightness, item, &self->byteorder, self->byteorder.is_dotstar); } } if (self->auto_write) - call_write_function(self); + pixelbuf_call_show(self_in); return mp_const_none; #else return MP_OBJ_NULL; // op not supported @@ -445,12 +427,12 @@ STATIC mp_obj_t pixelbuf_pixelbuf_subscr(mp_obj_t self_in, mp_obj_t index_in, mp if (value == MP_OBJ_SENTINEL) { // Get uint8_t *pixelstart = (uint8_t *)(self->two_buffers ? self->rawbuf : self->buf) + offset; - return pixelbuf_get_pixel(pixelstart, &self->byteorder, self->dotstar_mode); + return pixelbuf_get_pixel(pixelstart, &self->byteorder, self->byteorder.is_dotstar); } else { // Store pixelbuf_set_pixel(self->buf + offset, self->two_buffers ? self->rawbuf + offset : NULL, - self->brightness, value, &self->byteorder, self->dotstar_mode); + self->brightness, value, &self->byteorder, self->byteorder.is_dotstar); if (self->auto_write) - call_write_function(self); + pixelbuf_call_show(self_in); return mp_const_none; } } @@ -461,7 +443,7 @@ STATIC const mp_rom_map_elem_t pixelbuf_pixelbuf_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_bpp), MP_ROM_PTR(&pixelbuf_pixelbuf_bpp_obj)}, { MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&pixelbuf_pixelbuf_brightness_obj)}, { MP_ROM_QSTR(MP_QSTR_buf), MP_ROM_PTR(&pixelbuf_pixelbuf_buf_obj)}, - { MP_ROM_QSTR(MP_QSTR_byteorder), MP_ROM_PTR(&pixelbuf_pixelbuf_byteorder_obj)}, + { MP_ROM_QSTR(MP_QSTR_byteorder), MP_ROM_PTR(&pixelbuf_pixelbuf_byteorder_str)}, { MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&pixelbuf_pixelbuf_show_obj)}, }; @@ -474,6 +456,7 @@ const mp_obj_type_t pixelbuf_pixelbuf_type = { .subscr = pixelbuf_pixelbuf_subscr, .make_new = pixelbuf_pixelbuf_make_new, .unary_op = pixelbuf_pixelbuf_unary_op, + .getiter = mp_obj_new_generic_iterator, .print = NULL, .locals_dict = (mp_obj_t)&pixelbuf_pixelbuf_locals_dict, }; diff --git a/shared-bindings/_pixelbuf/PixelBuf.h b/shared-bindings/_pixelbuf/PixelBuf.h index 0b1e362783..691da3cd33 100644 --- a/shared-bindings/_pixelbuf/PixelBuf.h +++ b/shared-bindings/_pixelbuf/PixelBuf.h @@ -36,21 +36,18 @@ typedef struct { size_t pixels; size_t bytes; size_t pixel_step; - pixelbuf_byteorder_obj_t byteorder; + pixelbuf_byteorder_details_t byteorder; mp_obj_t bytearray; mp_obj_t rawbytearray; mp_float_t brightness; bool two_buffers; size_t offset; - bool dotstar_mode; uint8_t *rawbuf; uint8_t *buf; - mp_obj_t write_function; - mp_obj_tuple_t *write_function_args; bool auto_write; } pixelbuf_pixelbuf_obj_t; void pixelbuf_recalculate_brightness(pixelbuf_pixelbuf_obj_t *self); -void call_write_function(pixelbuf_pixelbuf_obj_t *self); +mp_obj_t pixelbuf_call_show(mp_obj_t self_in); #endif // CP_SHARED_BINDINGS_PIXELBUF_PIXELBUF_H diff --git a/shared-bindings/_pixelbuf/__init__.c b/shared-bindings/_pixelbuf/__init__.c index eb0cb29842..ed264f3bb4 100644 --- a/shared-bindings/_pixelbuf/__init__.c +++ b/shared-bindings/_pixelbuf/__init__.c @@ -42,9 +42,11 @@ //| .. module:: _pixelbuf //| :synopsis: A fast RGB(W) pixel buffer library for like NeoPixel and DotStar. //| -//| The `_pixelbuf` module provides :py:class:`PixelBuf` and :py:class:`ByteOrder` classes to accelerate +//| The `_pixelbuf` module provides the :py:class:`PixelBuf` class to accelerate //| RGB(W) strip/matrix manipulation, such as DotStar and Neopixel. //| +//| Byteorders are configured with strings, such as "RGB" or "RGBD". +//| TODO: Pull in docs from pypixelbuf. //| Libraries //| @@ -53,93 +55,6 @@ //| //| PixelBuf -//| .. class:: ByteOrder() -//| -//| Classes representing byteorders for CircuitPython - - -//| .. attribute:: bpp -//| -//| The number of bytes per pixel (read-only) -//| - -//| .. attribute:: has_white -//| -//| Whether the pixel has white (in addition to RGB) -//| - -//| .. attribute:: has_luminosity -//| -//| Whether the pixel has luminosity (in addition to RGB) -//| - -//| .. attribute:: byteorder -//| -//| Tuple of byte order (r, g, b) or (r, g, b, w) or (r, g, b, l) -//| - - -STATIC void pixelbuf_byteorder_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { - mp_check_self(MP_OBJ_IS_TYPE(self_in, &pixelbuf_byteorder_type)); - pixelbuf_byteorder_obj_t *self = MP_OBJ_TO_PTR(self_in); - if (dest[0] == MP_OBJ_NULL) { - // load attribute - mp_obj_t val; - if (attr == MP_QSTR_bpp) { - val = MP_OBJ_NEW_SMALL_INT(self->bpp); - } else if (attr == MP_QSTR_has_white) { - val = mp_obj_new_bool(self->has_white); - } else if (attr == MP_QSTR_has_luminosity) { - val = mp_obj_new_bool(self->has_luminosity); - } else if (attr == MP_QSTR_byteorder) { - mp_obj_t items[4]; - uint8_t n = self->bpp; - if (self->has_luminosity || self->has_white) { - n = 4; - } - uint8_t *values = (uint8_t *)&(self->byteorder); - for (uint8_t i=0; ibpp); - default: return MP_OBJ_NULL; // op not supported - } -} - -const mp_obj_type_t pixelbuf_byteorder_type = { - { &mp_type_type }, - .name = MP_QSTR_ByteOrder, - .print = pixelbuf_byteorder_print, - .unary_op = pixelbuf_byteorder_unary_op, - .attr = pixelbuf_byteorder_attr, -}; - - -// This macro is used to simplify RGB subclass definition -#define PIXELBUF_BYTEORDER(p_name, p_bpp, p_r, p_g, p_b, p_w, p_has_white, p_has_luminosity) \ -const pixelbuf_byteorder_obj_t byteorder_## p_name = { \ - { &pixelbuf_byteorder_type }, \ - .name = MP_QSTR_## p_name, \ - .bpp = p_bpp, \ - .byteorder = { p_r, p_g, p_b, p_w }, \ - .has_white = p_has_white, \ - .has_luminosity = p_has_luminosity, \ -}; //| .. function:: wheel(n) //| @@ -168,158 +83,37 @@ const int32_t colorwheel(float pos) { } -/// RGB -//| .. data:: RGB +//| .. function:: fill(pixelbuf, color) //| -//| * **order** Red, Green, Blue -//| * **bpp** 3 -PIXELBUF_BYTEORDER(RGB, 3, 0, 1, 2, 3, false, false) -//| .. data:: RBG +//| Fills the given pixelbuf with the given color. //| -//| * **order** Red, Blue, Green -//| * **bpp** 3 -PIXELBUF_BYTEORDER(RBG, 3, 0, 2, 1, 3, false, false) -//| .. data:: GRB -//| -//| * **order** Green, Red, Blue -//| * **bpp** 3 -//| -//| Commonly used by NeoPixel. -PIXELBUF_BYTEORDER(GRB, 3, 1, 0, 2, 3, false, false) -//| .. data:: GBR -//| -//| * **order** Green, Blue, Red -//| * **bpp** 3 -PIXELBUF_BYTEORDER(GBR, 3, 1, 2, 0, 3, false, false) -//| .. data:: BRG -//| -//| * **order** Blue, Red, Green -//| * **bpp** 3 -PIXELBUF_BYTEORDER(BRG, 3, 2, 0, 1, 3, false, false) -//| .. data:: BGR -//| -//| * **order** Blue, Green, Red -//| * **bpp** 3 -//| -//| Commonly used by Dotstar. -PIXELBUF_BYTEORDER(BGR, 3, 2, 1, 0, 3, false, false) -// RGBW -//| .. data:: RGBW -//| -//| * **order** Red, Green, Blue, White -//| * **bpp** 4 -//| * **has_white** True -PIXELBUF_BYTEORDER(RGBW, 4, 0, 1, 2, 3, true, false) -//| .. data:: RBGW -//| -//| * **order** Red, Blue, Green, White -//| * **bpp** 4 -//| * **has_white** True -PIXELBUF_BYTEORDER(RBGW, 4, 0, 2, 1, 3, true, false) -//| .. data:: GRBW -//| -//| * **order** Green, Red, Blue, White -//| * **bpp** 4 -//| * **has_white** True -//| -//| Commonly used by RGBW NeoPixels. -PIXELBUF_BYTEORDER(GRBW, 4, 1, 0, 2, 3, true, false) -//| .. data:: GBRW -//| -//| * **order** Green, Blue, Red, White -//| * **bpp** 4 -//| * **has_white** True -PIXELBUF_BYTEORDER(GBRW, 4, 1, 2, 0, 3, true, false) -//| .. data:: BRGW -//| -//| * **order** Blue, Red, Green, White -//| * **bpp** 4 -//| * **has_white** True -PIXELBUF_BYTEORDER(BRGW, 4, 2, 0, 1, 3, true, false) -//| .. data:: BGRW -//| -//| * **order** Blue, Green, Red, White -//| * **bpp** 4 -//| * **has_white** True -PIXELBUF_BYTEORDER(BGRW, 4, 2, 1, 0, 3, true, false) +STATIC mp_obj_t pixelbuf_fill(mp_obj_t pixelbuf_in, mp_obj_t value) { + mp_obj_t obj = mp_instance_cast_to_native_base(pixelbuf_in, &pixelbuf_pixelbuf_type); + if (obj == MP_OBJ_NULL) + mp_raise_TypeError(translate("Expected a PixelBuf instance")); + pixelbuf_pixelbuf_obj_t *pixelbuf = MP_OBJ_TO_PTR(obj); + + for (size_t offset = 0; offset < pixelbuf->bytes; offset+= pixelbuf->pixel_step) { + pixelbuf_set_pixel(pixelbuf->buf + offset, pixelbuf->two_buffers ? (pixelbuf->rawbuf + offset) : NULL, + pixelbuf->brightness, value, &pixelbuf->byteorder, pixelbuf->byteorder.is_dotstar); + } + if (pixelbuf->auto_write) + pixelbuf_call_show(pixelbuf_in); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_fill_obj, pixelbuf_fill); -// Luminosity + RGB (eg for Dotstar) -// Luminosity chosen because the luminosity of a Dotstar at full bright -// burns the eyes like looking at the Sun. -// https://www.thesaurus.com/browse/luminosity?s=t -//| .. data:: LRGB -//| -//| * **order** *Luminosity*, Red, Green, Blue -//| * **bpp** 4 -//| * **has_luminosity** True -PIXELBUF_BYTEORDER(LRGB, 4, 1, 2, 3, 0, false, true) -//| .. data:: LRBG -//| -//| * **order** *Luminosity*, Red, Blue, Green -//| * **bpp** 4 -//| * **has_luminosity** True -PIXELBUF_BYTEORDER(LRBG, 4, 1, 3, 2, 0, false, true) -//| .. data:: LGRB -//| -//| * **order** *Luminosity*, Green, Red, Blue -//| * **bpp** 4 -//| * **has_luminosity** True -PIXELBUF_BYTEORDER(LGRB, 4, 2, 1, 3, 0, false, true) -//| .. data:: LGBR -//| -//| * **order** *Luminosity*, Green, Blue, Red -//| * **bpp** 4 -//| * **has_luminosity** True -PIXELBUF_BYTEORDER(LGBR, 4, 2, 3, 1, 0, false, true) -//| .. data:: LBRG -//| -//| * **order** *Luminosity*, Blue, Red, Green -//| * **bpp** 4 -//| * **has_luminosity** True -PIXELBUF_BYTEORDER(LBRG, 4, 3, 1, 2, 0, false, true) -//| .. data:: LBGR -//| -//| * **order** *Luminosity*, Blue, Green, Red -//| * **bpp** 4 -//| * **has_luminosity** True -//| -//| Actual format commonly used by DotStar (5 bit luminance value) -PIXELBUF_BYTEORDER(LBGR, 4, 3, 2, 1, 0, false, true) STATIC const mp_rom_map_elem_t pixelbuf_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__pixelbuf) }, { MP_ROM_QSTR(MP_QSTR_PixelBuf), MP_ROM_PTR(&pixelbuf_pixelbuf_type) }, - { MP_ROM_QSTR(MP_QSTR_ByteOrder), MP_ROM_PTR(&pixelbuf_byteorder_type) }, - { MP_ROM_QSTR(MP_QSTR_RGB), MP_ROM_PTR(&byteorder_RGB) }, - { MP_ROM_QSTR(MP_QSTR_RBG), MP_ROM_PTR(&byteorder_RBG) }, - { MP_ROM_QSTR(MP_QSTR_GRB), MP_ROM_PTR(&byteorder_GRB) }, - { MP_ROM_QSTR(MP_QSTR_GBR), MP_ROM_PTR(&byteorder_GBR) }, - { MP_ROM_QSTR(MP_QSTR_BRG), MP_ROM_PTR(&byteorder_BRG) }, - { MP_ROM_QSTR(MP_QSTR_BGR), MP_ROM_PTR(&byteorder_BGR) }, - { MP_ROM_QSTR(MP_QSTR_RGBW), MP_ROM_PTR(&byteorder_RGBW) }, - { MP_ROM_QSTR(MP_QSTR_RBGW), MP_ROM_PTR(&byteorder_RBGW) }, - { MP_ROM_QSTR(MP_QSTR_GRBW), MP_ROM_PTR(&byteorder_GRBW) }, - { MP_ROM_QSTR(MP_QSTR_GBRW), MP_ROM_PTR(&byteorder_GBRW) }, - { MP_ROM_QSTR(MP_QSTR_BRGW), MP_ROM_PTR(&byteorder_BRGW) }, - { MP_ROM_QSTR(MP_QSTR_BGRW), MP_ROM_PTR(&byteorder_BGRW) }, - { MP_ROM_QSTR(MP_QSTR_LRGB), MP_ROM_PTR(&byteorder_LRGB) }, - { MP_ROM_QSTR(MP_QSTR_LRBG), MP_ROM_PTR(&byteorder_LRBG) }, - { MP_ROM_QSTR(MP_QSTR_LGRB), MP_ROM_PTR(&byteorder_LGRB) }, - { MP_ROM_QSTR(MP_QSTR_LGBR), MP_ROM_PTR(&byteorder_LGBR) }, - { MP_ROM_QSTR(MP_QSTR_LBRG), MP_ROM_PTR(&byteorder_LBRG) }, - { MP_ROM_QSTR(MP_QSTR_LBGR), MP_ROM_PTR(&byteorder_LBGR) }, { MP_ROM_QSTR(MP_QSTR_wheel), MP_ROM_PTR(&pixelbuf_wheel_obj) }, + { MP_ROM_QSTR(MP_QSTR_fill), MP_ROM_PTR(&pixelbuf_fill_obj) }, }; STATIC MP_DEFINE_CONST_DICT(pixelbuf_module_globals, pixelbuf_module_globals_table); -STATIC void pixelbuf_byteorder_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { - pixelbuf_byteorder_obj_t *self = MP_OBJ_TO_PTR(self_in); - mp_printf(print, "%q.%q", MP_QSTR__pixelbuf, self->name); - return; -} - const mp_obj_module_t pixelbuf_module = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t*)&pixelbuf_module_globals, diff --git a/shared-bindings/_pixelbuf/__init__.h b/shared-bindings/_pixelbuf/__init__.h index a62d67c4a4..f70ffe5083 100644 --- a/shared-bindings/_pixelbuf/__init__.h +++ b/shared-bindings/_pixelbuf/__init__.h @@ -29,9 +29,7 @@ #include "common-hal/digitalio/DigitalInOut.h" -STATIC void pixelbuf_byteorder_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind); const int32_t colorwheel(float pos); -const mp_obj_type_t pixelbuf_byteorder_type; extern void common_hal_neopixel_write(const digitalio_digitalinout_obj_t* gpio, uint8_t *pixels, uint32_t numBytes); #endif //CP_SHARED_BINDINGS_PIXELBUF_INIT_H diff --git a/shared-bindings/_pixelbuf/types.h b/shared-bindings/_pixelbuf/types.h index f7d757791b..f7dc1a1092 100644 --- a/shared-bindings/_pixelbuf/types.h +++ b/shared-bindings/_pixelbuf/types.h @@ -37,12 +37,11 @@ typedef struct { } pixelbuf_rgbw_t; typedef struct { - mp_obj_base_t base; - qstr name; uint8_t bpp; pixelbuf_rgbw_t byteorder; bool has_white; - bool has_luminosity; -} pixelbuf_byteorder_obj_t; + bool is_dotstar; + mp_obj_t *order; +} pixelbuf_byteorder_details_t; #endif // CIRCUITPYTHON_PIXELBUF_TYPES_H diff --git a/shared-bindings/displayio/Shape.c b/shared-bindings/displayio/Shape.c index faa9472fa6..7c7b105015 100644 --- a/shared-bindings/displayio/Shape.c +++ b/shared-bindings/displayio/Shape.c @@ -41,8 +41,6 @@ //| //| Represents any shape made by defining boundaries that may be mirrored. //| -//| .. warning:: This will likely be changed before 4.0.0. Consider it very experimental. -//| //| .. class:: Shape(width, height, *, mirror_x=False, mirror_y=False) //| //| Create a Shape object with the given fixed size. Each pixel is one bit and is stored by the diff --git a/shared-module/_pixelbuf/PixelBuf.c b/shared-module/_pixelbuf/PixelBuf.c index d326972391..020151bc31 100644 --- a/shared-module/_pixelbuf/PixelBuf.c +++ b/shared-module/_pixelbuf/PixelBuf.c @@ -31,7 +31,7 @@ #include "PixelBuf.h" #include -void pixelbuf_set_pixel_int(uint8_t *buf, mp_int_t value, pixelbuf_byteorder_obj_t *byteorder) { +void pixelbuf_set_pixel_int(uint8_t *buf, mp_int_t value, pixelbuf_byteorder_details_t *byteorder) { buf[byteorder->byteorder.r] = value >> 16 & 0xff; buf[byteorder->byteorder.g] = (value >> 8) & 0xff; buf[byteorder->byteorder.b] = value & 0xff; @@ -43,15 +43,15 @@ void pixelbuf_set_pixel_int(uint8_t *buf, mp_int_t value, pixelbuf_byteorder_obj } } -void pixelbuf_set_pixel(uint8_t *buf, uint8_t *rawbuf, float brightness, mp_obj_t *item, pixelbuf_byteorder_obj_t *byteorder, bool dotstar) { +void pixelbuf_set_pixel(uint8_t *buf, uint8_t *rawbuf, float brightness, mp_obj_t *item, pixelbuf_byteorder_details_t *byteorder, bool dotstar) { if (MP_OBJ_IS_INT(item)) { uint8_t *target = rawbuf ? rawbuf : buf; pixelbuf_set_pixel_int(target, mp_obj_get_int_truncated(item), byteorder); - if (dotstar) { + if (dotstar) { buf[0] = DOTSTAR_LED_START_FULL_BRIGHT; if (rawbuf) rawbuf[0] = DOTSTAR_LED_START_FULL_BRIGHT; - } + } if (rawbuf) { buf[byteorder->byteorder.r] = rawbuf[byteorder->byteorder.r] * brightness; buf[byteorder->byteorder.g] = rawbuf[byteorder->byteorder.g] * brightness; @@ -94,15 +94,15 @@ void pixelbuf_set_pixel(uint8_t *buf, uint8_t *rawbuf, float brightness, mp_obj_ } } -mp_obj_t *pixelbuf_get_pixel_array(uint8_t *buf, uint len, pixelbuf_byteorder_obj_t *byteorder, uint8_t step, bool dotstar) { +mp_obj_t *pixelbuf_get_pixel_array(uint8_t *buf, uint len, pixelbuf_byteorder_details_t *byteorder, uint8_t step, mp_int_t slice_step, bool dotstar) { mp_obj_t elems[len]; for (uint i = 0; i < len; i++) { - elems[i] = pixelbuf_get_pixel(buf + (i * step), byteorder, dotstar); + elems[i] = pixelbuf_get_pixel(buf + ((i * slice_step) * step), byteorder, dotstar); } return mp_obj_new_tuple(len, elems); } -mp_obj_t *pixelbuf_get_pixel(uint8_t *buf, pixelbuf_byteorder_obj_t *byteorder, bool dotstar) { +mp_obj_t *pixelbuf_get_pixel(uint8_t *buf, pixelbuf_byteorder_details_t *byteorder, bool dotstar) { mp_obj_t elems[byteorder->bpp]; elems[0] = mp_obj_new_int(buf[byteorder->byteorder.r]); diff --git a/shared-module/_pixelbuf/PixelBuf.h b/shared-module/_pixelbuf/PixelBuf.h index 9e115fe0cf..173ce61a83 100644 --- a/shared-module/_pixelbuf/PixelBuf.h +++ b/shared-module/_pixelbuf/PixelBuf.h @@ -42,9 +42,9 @@ #define DOTSTAR_GET_BRIGHTNESS(value) ((value & 0b00011111) / 31.0) #define DOTSTAR_LED_START_FULL_BRIGHT 0xFF -void pixelbuf_set_pixel(uint8_t *buf, uint8_t *rawbuf, float brightness, mp_obj_t *item, pixelbuf_byteorder_obj_t *byteorder, bool dotstar); -mp_obj_t *pixelbuf_get_pixel(uint8_t *buf, pixelbuf_byteorder_obj_t *byteorder, bool dotstar); -mp_obj_t *pixelbuf_get_pixel_array(uint8_t *buf, uint len, pixelbuf_byteorder_obj_t *byteorder, uint8_t step, bool dotstar); -void pixelbuf_set_pixel_int(uint8_t *buf, mp_int_t value, pixelbuf_byteorder_obj_t *byteorder); +void pixelbuf_set_pixel(uint8_t *buf, uint8_t *rawbuf, float brightness, mp_obj_t *item, pixelbuf_byteorder_details_t *byteorder, bool dotstar); +mp_obj_t *pixelbuf_get_pixel(uint8_t *buf, pixelbuf_byteorder_details_t *byteorder, bool dotstar); +mp_obj_t *pixelbuf_get_pixel_array(uint8_t *buf, uint len, pixelbuf_byteorder_details_t *byteorder, uint8_t step, mp_int_t slice_step, bool dotstar); +void pixelbuf_set_pixel_int(uint8_t *buf, mp_int_t value, pixelbuf_byteorder_details_t *byteorder); #endif