diff options
| author | Dan Halbert <halbert@halwitz.org> | 2019-03-13 18:24:04 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-13 18:24:04 -0400 |
| commit | 494a9d382531762fe15ddfbef094944e2b7096c2 (patch) | |
| tree | 823012efc03268690308e9a16820f3494a28c115 | |
| parent | b4601a351cdd3ca6e061efbf80bfd0a74d2d23da (diff) | |
| parent | f72d2733df13cff8013a7265b3439d8f7ef22839 (diff) | |
Merge pull request #1640 from tannewt/final_displayio_changes
Final displayio changes before 4.0.0
26 files changed, 502 insertions, 180 deletions
diff --git a/.travis.yml b/.travis.yml index 3470ad9d8..0c8a2ea74 100755 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ env: - TRAVIS_TESTS="unix docs translations website" TRAVIS_BOARDS="circuitplayground_express mini_sam_m4 grandcentral_m4_express pca10056 pca10059 feather_nrf52840_express makerdiary_nrf52840_mdk makerdiary_nrf52840_mdk_usb_dongle particle_boron particle_argon particle_xenon sparkfun_nrf52840_mini" TRAVIS_SDK=arm:nrf - TRAVIS_BOARDS="metro_m0_express metro_m4_express pirkey_m0 trellis_m4_express trinket_m0 sparkfun_lumidrive sparkfun_redboard_turbo pybadge" TRAVIS_SDK=arm - TRAVIS_BOARDS="feather_radiofruit_zigbee gemma_m0 hallowing_m0_express itsybitsy_m0_express itsybitsy_m4_express meowmeow sam32" TRAVIS_SDK=arm - - TRAVIS_BOARDS="feather_m0_express_crickit feather_m0_rfm69 feather_m0_rfm9x feather_m4_express arduino_zero arduino_mkr1300 arduino_mkrzero" TRAVIS_SDK=arm + - TRAVIS_BOARDS="feather_m0_express_crickit feather_m0_rfm69 feather_m0_rfm9x feather_m4_express arduino_zero arduino_mkr1300 arduino_mkrzero pewpew10" TRAVIS_SDK=arm - TRAVIS_BOARDS="circuitplayground_express_crickit feather_m0_adalogger feather_m0_basic feather_m0_express catwan_usbstick pyportal sparkfun_samd21_mini sparkfun_samd21_dev" TRAVIS_SDK=arm addons: diff --git a/locale/ID.po b/locale/ID.po index 8961872a0..f975ad08b 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -3,7 +3,6 @@ # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # -#: shared-bindings/_pew/PewPew.c shared-module/_pew/PewPew.c #, fuzzy msgid "" msgstr "" @@ -262,6 +261,7 @@ msgstr "Semua timer untuk pin ini sedang digunakan" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c +#: shared-module/_pew/PewPew.c msgid "All timers in use" msgstr "Semua timer sedang digunakan" @@ -473,6 +473,10 @@ msgstr "" msgid "Clock unit in use" msgstr "Clock unit sedang digunakan" +#: shared-bindings/_pew/PewPew.c +msgid "Column entry must be digitalio.DigitalInOut" +msgstr "" + #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c msgid "Command must be an int between 0 and 255" msgstr "" @@ -771,6 +775,10 @@ msgid "" "mpy-update for more info." msgstr "" +#: shared-bindings/_pew/PewPew.c +msgid "Incorrect buffer size" +msgstr "" + #: py/moduerrno.c msgid "Input/output error" msgstr "" @@ -1137,6 +1145,10 @@ msgstr "sistem file (filesystem) bersifat Read-only" msgid "Right channel unsupported" msgstr "Channel Kanan tidak didukung" +#: shared-bindings/_pew/PewPew.c +msgid "Row entry must be digitalio.DigitalInOut" +msgstr "" + #: main.c msgid "Running in safe mode! Auto-reload is off.\n" msgstr "Berjalan di mode aman(safe mode)! Auto-reload tidak aktif.\n" @@ -1177,7 +1189,7 @@ msgid "Slice and value different lengths." msgstr "" #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "" @@ -1245,6 +1257,10 @@ msgid "Tile height must exactly divide bitmap height" msgstr "" #: shared-bindings/displayio/TileGrid.c +msgid "Tile indices must be 0 - 255" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "" @@ -1541,6 +1557,10 @@ msgstr "" msgid "buffers must be the same length" msgstr "buffers harus mempunyai panjang yang sama" +#: shared-bindings/_pew/PewPew.c +msgid "buttons must be digitalio.DigitalInOut" +msgstr "" + #: py/vm.c msgid "byte code not implemented" msgstr "" @@ -2461,10 +2481,6 @@ msgstr "" msgid "popitem(): dictionary is empty" msgstr "" -#: shared-bindings/displayio/TileGrid.c -msgid "position must be 2-tuple" -msgstr "" - #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "" @@ -2633,6 +2649,10 @@ msgstr "sintaksis error pada pendeskripsi uctypes" msgid "threshold must be in the range 0-65536" msgstr "" +#: shared-bindings/displayio/TileGrid.c +msgid "tile index out of bounds" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 36975f988..bbdb06287 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -3,13 +3,12 @@ # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # -#: shared-bindings/_pew/PewPew.c shared-module/_pew/PewPew.c #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-03-12 11:17-0700\n" +"POT-Creation-Date: 2019-03-12 17:20-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -260,6 +259,7 @@ msgstr "" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c +#: shared-module/_pew/PewPew.c msgid "All timers in use" msgstr "" @@ -463,6 +463,10 @@ msgstr "" msgid "Clock unit in use" msgstr "" +#: shared-bindings/_pew/PewPew.c +msgid "Column entry must be digitalio.DigitalInOut" +msgstr "" + #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c msgid "Command must be an int between 0 and 255" msgstr "" @@ -746,6 +750,10 @@ msgid "" "mpy-update for more info." msgstr "" +#: shared-bindings/_pew/PewPew.c +msgid "Incorrect buffer size" +msgstr "" + #: py/moduerrno.c msgid "Input/output error" msgstr "" @@ -1108,6 +1116,10 @@ msgstr "" msgid "Right channel unsupported" msgstr "" +#: shared-bindings/_pew/PewPew.c +msgid "Row entry must be digitalio.DigitalInOut" +msgstr "" + #: main.c msgid "Running in safe mode! Auto-reload is off.\n" msgstr "" @@ -1147,7 +1159,7 @@ msgid "Slice and value different lengths." msgstr "" #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "" @@ -1212,6 +1224,10 @@ msgid "Tile height must exactly divide bitmap height" msgstr "" #: shared-bindings/displayio/TileGrid.c +msgid "Tile indices must be 0 - 255" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "" @@ -1495,6 +1511,10 @@ msgstr "" msgid "buffers must be the same length" msgstr "" +#: shared-bindings/_pew/PewPew.c +msgid "buttons must be digitalio.DigitalInOut" +msgstr "" + #: py/vm.c msgid "byte code not implemented" msgstr "" @@ -2413,10 +2433,6 @@ msgstr "" msgid "popitem(): dictionary is empty" msgstr "" -#: shared-bindings/displayio/TileGrid.c -msgid "position must be 2-tuple" -msgstr "" - #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "" @@ -2585,6 +2601,10 @@ msgstr "" msgid "threshold must be in the range 0-65536" msgstr "" +#: shared-bindings/displayio/TileGrid.c +msgid "tile index out of bounds" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 1a73ec7a2..add0cc71e 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -3,7 +3,6 @@ # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # -#: shared-bindings/_pew/PewPew.c shared-module/_pew/PewPew.c msgid "" msgstr "" "Project-Id-Version: \n" @@ -262,6 +261,7 @@ msgstr "Alle timer für diesen Pin werden bereits benutzt" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c +#: shared-module/_pew/PewPew.c msgid "All timers in use" msgstr "Alle timer werden benutzt" @@ -467,6 +467,10 @@ msgstr "Clock stretch zu lang" msgid "Clock unit in use" msgstr "Clock unit wird benutzt" +#: shared-bindings/_pew/PewPew.c +msgid "Column entry must be digitalio.DigitalInOut" +msgstr "" + #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c msgid "Command must be an int between 0 and 255" msgstr "Der Befehl muss ein int zwischen 0 und 255 sein" @@ -753,6 +757,10 @@ msgstr "" "Inkompatible mpy-Datei. Bitte aktualisieren Sie alle mpy-Dateien. Siehe " "http://adafru.it/mpy-update für weitere Informationen." +#: shared-bindings/_pew/PewPew.c +msgid "Incorrect buffer size" +msgstr "" + #: py/moduerrno.c msgid "Input/output error" msgstr "Eingabe-/Ausgabefehler" @@ -1129,6 +1137,10 @@ msgstr "Schreibgeschützte Objekt" msgid "Right channel unsupported" msgstr "Rechter Kanal wird nicht unterstützt" +#: shared-bindings/_pew/PewPew.c +msgid "Row entry must be digitalio.DigitalInOut" +msgstr "" + #: main.c msgid "Running in safe mode! Auto-reload is off.\n" msgstr "Sicherheitsmodus aktiv! Automatisches Neuladen ist deaktiviert.\n" @@ -1168,7 +1180,7 @@ msgid "Slice and value different lengths." msgstr "Slice und Wert (value) haben unterschiedliche Längen." #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "Slices werden nicht unterstützt" @@ -1245,6 +1257,10 @@ msgid "Tile height must exactly divide bitmap height" msgstr "" #: shared-bindings/displayio/TileGrid.c +msgid "Tile indices must be 0 - 255" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "" @@ -1540,6 +1556,10 @@ msgstr "Der Puffer ist zu klein" msgid "buffers must be the same length" msgstr "Buffer müssen gleich lang sein" +#: shared-bindings/_pew/PewPew.c +msgid "buttons must be digitalio.DigitalInOut" +msgstr "" + #: py/vm.c msgid "byte code not implemented" msgstr "" @@ -2468,10 +2488,6 @@ msgstr "pop von einer leeren Liste" msgid "popitem(): dictionary is empty" msgstr "popitem(): dictionary ist leer" -#: shared-bindings/displayio/TileGrid.c -msgid "position must be 2-tuple" -msgstr "" - #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "pow() drittes Argument darf nicht 0 sein" @@ -2643,6 +2659,10 @@ msgstr "Syntaxfehler in uctypes Deskriptor" msgid "threshold must be in the range 0-65536" msgstr "threshold muss im Intervall 0-65536 liegen" +#: shared-bindings/displayio/TileGrid.c +msgid "tile index out of bounds" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" diff --git a/locale/en_US.po b/locale/en_US.po index 52d4b73e8..2e1dbd0f0 100644 --- a/locale/en_US.po +++ b/locale/en_US.po @@ -3,7 +3,6 @@ # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # -#: shared-bindings/_pew/PewPew.c shared-module/_pew/PewPew.c msgid "" msgstr "" "Project-Id-Version: \n" @@ -260,6 +259,7 @@ msgstr "" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c +#: shared-module/_pew/PewPew.c msgid "All timers in use" msgstr "" @@ -463,6 +463,10 @@ msgstr "" msgid "Clock unit in use" msgstr "" +#: shared-bindings/_pew/PewPew.c +msgid "Column entry must be digitalio.DigitalInOut" +msgstr "" + #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c msgid "Command must be an int between 0 and 255" msgstr "" @@ -746,6 +750,10 @@ msgid "" "mpy-update for more info." msgstr "" +#: shared-bindings/_pew/PewPew.c +msgid "Incorrect buffer size" +msgstr "" + #: py/moduerrno.c msgid "Input/output error" msgstr "" @@ -1108,6 +1116,10 @@ msgstr "" msgid "Right channel unsupported" msgstr "" +#: shared-bindings/_pew/PewPew.c +msgid "Row entry must be digitalio.DigitalInOut" +msgstr "" + #: main.c msgid "Running in safe mode! Auto-reload is off.\n" msgstr "" @@ -1147,7 +1159,7 @@ msgid "Slice and value different lengths." msgstr "" #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "" @@ -1212,6 +1224,10 @@ msgid "Tile height must exactly divide bitmap height" msgstr "" #: shared-bindings/displayio/TileGrid.c +msgid "Tile indices must be 0 - 255" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "" @@ -1495,6 +1511,10 @@ msgstr "" msgid "buffers must be the same length" msgstr "" +#: shared-bindings/_pew/PewPew.c +msgid "buttons must be digitalio.DigitalInOut" +msgstr "" + #: py/vm.c msgid "byte code not implemented" msgstr "" @@ -2413,10 +2433,6 @@ msgstr "" msgid "popitem(): dictionary is empty" msgstr "" -#: shared-bindings/displayio/TileGrid.c -msgid "position must be 2-tuple" -msgstr "" - #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "" @@ -2585,6 +2601,10 @@ msgstr "" msgid "threshold must be in the range 0-65536" msgstr "" +#: shared-bindings/displayio/TileGrid.c +msgid "tile index out of bounds" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" diff --git a/locale/en_x_pirate.po b/locale/en_x_pirate.po index 6597d98bd..97d819bcd 100644 --- a/locale/en_x_pirate.po +++ b/locale/en_x_pirate.po @@ -3,7 +3,6 @@ # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # -#: shared-bindings/_pew/PewPew.c shared-module/_pew/PewPew.c msgid "" msgstr "" "Project-Id-Version: \n" @@ -262,6 +261,7 @@ msgstr "" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c +#: shared-module/_pew/PewPew.c msgid "All timers in use" msgstr "" @@ -467,6 +467,10 @@ msgstr "" msgid "Clock unit in use" msgstr "" +#: shared-bindings/_pew/PewPew.c +msgid "Column entry must be digitalio.DigitalInOut" +msgstr "" + #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c msgid "Command must be an int between 0 and 255" msgstr "" @@ -750,6 +754,10 @@ msgid "" "mpy-update for more info." msgstr "" +#: shared-bindings/_pew/PewPew.c +msgid "Incorrect buffer size" +msgstr "" + #: py/moduerrno.c msgid "Input/output error" msgstr "" @@ -1112,6 +1120,10 @@ msgstr "" msgid "Right channel unsupported" msgstr "" +#: shared-bindings/_pew/PewPew.c +msgid "Row entry must be digitalio.DigitalInOut" +msgstr "" + #: main.c msgid "Running in safe mode! Auto-reload is off.\n" msgstr "Runnin' in safe mode! Auto-reload be off.\n" @@ -1151,7 +1163,7 @@ msgid "Slice and value different lengths." msgstr "" #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "" @@ -1216,6 +1228,10 @@ msgid "Tile height must exactly divide bitmap height" msgstr "" #: shared-bindings/displayio/TileGrid.c +msgid "Tile indices must be 0 - 255" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "" @@ -1499,6 +1515,10 @@ msgstr "" msgid "buffers must be the same length" msgstr "yer buffers must be of the same length" +#: shared-bindings/_pew/PewPew.c +msgid "buttons must be digitalio.DigitalInOut" +msgstr "" + #: py/vm.c msgid "byte code not implemented" msgstr "" @@ -2417,10 +2437,6 @@ msgstr "" msgid "popitem(): dictionary is empty" msgstr "" -#: shared-bindings/displayio/TileGrid.c -msgid "position must be 2-tuple" -msgstr "" - #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "" @@ -2589,6 +2605,10 @@ msgstr "" msgid "threshold must be in the range 0-65536" msgstr "" +#: shared-bindings/displayio/TileGrid.c +msgid "tile index out of bounds" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" diff --git a/locale/es.po b/locale/es.po index a6749413d..adf786085 100644 --- a/locale/es.po +++ b/locale/es.po @@ -4,7 +4,6 @@ # Carlos Diaz <carlos.santiago.diaz@gmail.com>, 2018. # Juan Biondi <juanernestobiondi@gmail.com>, 2018. # -#: shared-bindings/_pew/PewPew.c shared-module/_pew/PewPew.c msgid "" msgstr "" "Project-Id-Version: \n" @@ -267,6 +266,7 @@ msgstr "Todos los timers para este pin están siendo utilizados" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c +#: shared-module/_pew/PewPew.c msgid "All timers in use" msgstr "Todos los timers en uso" @@ -474,6 +474,10 @@ msgstr "" msgid "Clock unit in use" msgstr "Clock unit está siendo utilizado" +#: shared-bindings/_pew/PewPew.c +msgid "Column entry must be digitalio.DigitalInOut" +msgstr "" + #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c #, fuzzy msgid "Command must be an int between 0 and 255" @@ -778,6 +782,10 @@ msgstr "" "Archivo .mpy incompatible. Actualice todos los archivos .mpy. Consulte " "http://adafru.it/mpy-update para más información" +#: shared-bindings/_pew/PewPew.c +msgid "Incorrect buffer size" +msgstr "" + #: py/moduerrno.c msgid "Input/output error" msgstr "error Input/output" @@ -1153,6 +1161,10 @@ msgstr "Solo-lectura" msgid "Right channel unsupported" msgstr "Canal derecho no soportado" +#: shared-bindings/_pew/PewPew.c +msgid "Row entry must be digitalio.DigitalInOut" +msgstr "" + #: main.c msgid "Running in safe mode! Auto-reload is off.\n" msgstr "Ejecutando en modo seguro! La auto-recarga esta deshabilitada.\n" @@ -1192,7 +1204,7 @@ msgid "Slice and value different lengths." msgstr "" #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "" @@ -1264,6 +1276,10 @@ msgid "Tile height must exactly divide bitmap height" msgstr "" #: shared-bindings/displayio/TileGrid.c +msgid "Tile indices must be 0 - 255" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "" @@ -1558,6 +1574,10 @@ msgstr "buffer demasiado pequeño" msgid "buffers must be the same length" msgstr "los buffers deben de tener la misma longitud" +#: shared-bindings/_pew/PewPew.c +msgid "buttons must be digitalio.DigitalInOut" +msgstr "" + #: py/vm.c msgid "byte code not implemented" msgstr "codigo byte no implementado" @@ -2493,10 +2513,6 @@ msgstr "pop desde una lista vacía" msgid "popitem(): dictionary is empty" msgstr "popitem(): diccionario vacío" -#: shared-bindings/displayio/TileGrid.c -msgid "position must be 2-tuple" -msgstr "posición debe ser 2-tuple" - #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "el 3er argumento de pow() no puede ser 0" @@ -2669,6 +2685,10 @@ msgstr "error de sintaxis en el descriptor uctypes" msgid "threshold must be in the range 0-65536" msgstr "" +#: shared-bindings/displayio/TileGrid.c +msgid "tile index out of bounds" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" @@ -2877,3 +2897,6 @@ msgstr "paso cero" #~ msgid "Only true color (24 bpp or higher) BMP supported %x" #~ msgstr "Solo color verdadero (24 bpp o superior) BMP admitido %x" + +#~ msgid "position must be 2-tuple" +#~ msgstr "posición debe ser 2-tuple" diff --git a/locale/fil.po b/locale/fil.po index 2d9ce796b..c45f62b75 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -3,7 +3,6 @@ # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # -#: shared-bindings/_pew/PewPew.c shared-module/_pew/PewPew.c msgid "" msgstr "" "Project-Id-Version: \n" @@ -264,6 +263,7 @@ msgstr "Lahat ng timers para sa pin na ito ay ginagamit" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c +#: shared-module/_pew/PewPew.c msgid "All timers in use" msgstr "Lahat ng timer ginagamit" @@ -471,6 +471,10 @@ msgstr "Masyadong mahaba ang Clock stretch" msgid "Clock unit in use" msgstr "Clock unit ginagamit" +#: shared-bindings/_pew/PewPew.c +msgid "Column entry must be digitalio.DigitalInOut" +msgstr "" + #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c #, fuzzy msgid "Command must be an int between 0 and 255" @@ -776,6 +780,10 @@ msgstr "" ".mpy file hindi compatible. Maaring i-update lahat ng .mpy files. See http://" "adafru.it/mpy-update for more info." +#: shared-bindings/_pew/PewPew.c +msgid "Incorrect buffer size" +msgstr "" + #: py/moduerrno.c msgid "Input/output error" msgstr "May mali sa Input/Output" @@ -1152,6 +1160,10 @@ msgstr "Basahin-lamang" msgid "Right channel unsupported" msgstr "Hindi supportado ang kanang channel" +#: shared-bindings/_pew/PewPew.c +msgid "Row entry must be digitalio.DigitalInOut" +msgstr "" + #: main.c msgid "Running in safe mode! Auto-reload is off.\n" msgstr "Tumatakbo sa safe mode! Awtomatikong pag re-reload ay OFF.\n" @@ -1191,7 +1203,7 @@ msgid "Slice and value different lengths." msgstr "Slice at value iba't ibang haba." #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "Hindi suportado ang Slices" @@ -1266,6 +1278,10 @@ msgid "Tile height must exactly divide bitmap height" msgstr "" #: shared-bindings/displayio/TileGrid.c +msgid "Tile indices must be 0 - 255" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "" @@ -1561,6 +1577,10 @@ msgstr "masyadong maliit ang buffer" msgid "buffers must be the same length" msgstr "ang buffers ay dapat parehas sa haba" +#: shared-bindings/_pew/PewPew.c +msgid "buttons must be digitalio.DigitalInOut" +msgstr "" + #: py/vm.c msgid "byte code not implemented" msgstr "byte code hindi pa implemented" @@ -2499,10 +2519,6 @@ msgstr "pop galing sa walang laman na list" msgid "popitem(): dictionary is empty" msgstr "popitem(): dictionary ay walang laman" -#: shared-bindings/displayio/TileGrid.c -msgid "position must be 2-tuple" -msgstr "position ay dapat 2-tuple" - #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "pow() 3rd argument ay hindi maaring 0" @@ -2675,6 +2691,10 @@ msgstr "may pagkakamali sa sintaks sa uctypes descriptor" msgid "threshold must be in the range 0-65536" msgstr "ang threshold ay dapat sa range 0-65536" +#: shared-bindings/displayio/TileGrid.c +msgid "tile index out of bounds" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() kumukuha ng 9-sequence" @@ -2883,3 +2903,6 @@ msgstr "zero step" #~ 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" + +#~ msgid "position must be 2-tuple" +#~ msgstr "position ay dapat 2-tuple" diff --git a/locale/fr.po b/locale/fr.po index eeab87b65..7f8acb4cd 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -3,7 +3,6 @@ # This file is distributed under the same license as the PACKAGE package. # Pierrick Couturier <arofarn@arofarn.info>, 2018. # -#: shared-bindings/_pew/PewPew.c shared-module/_pew/PewPew.c msgid "" msgstr "" "Project-Id-Version: 0.1\n" @@ -264,6 +263,7 @@ msgstr "Tous les timers pour cette broche sont utilisés" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c +#: shared-module/_pew/PewPew.c msgid "All timers in use" msgstr "Tous les timers sont utilisés" @@ -473,6 +473,10 @@ msgstr "Période de l'horloge trop longue" msgid "Clock unit in use" msgstr "Horloge en cours d'utilisation" +#: shared-bindings/_pew/PewPew.c +msgid "Column entry must be digitalio.DigitalInOut" +msgstr "" + #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c #, fuzzy msgid "Command must be an int between 0 and 255" @@ -775,6 +779,10 @@ msgstr "" "Fichier .mpy incompatible. Merci de mettre à jour tous les .mpy. Voirhttp://" "adafru.it/mpy-update pour plus d'informations." +#: shared-bindings/_pew/PewPew.c +msgid "Incorrect buffer size" +msgstr "" + #: py/moduerrno.c msgid "Input/output error" msgstr "Erreur d'entrée/sortie" @@ -1159,6 +1167,10 @@ msgstr "Lecture seule" msgid "Right channel unsupported" msgstr "Canal droit non supporté" +#: shared-bindings/_pew/PewPew.c +msgid "Row entry must be digitalio.DigitalInOut" +msgstr "" + #: main.c msgid "Running in safe mode! Auto-reload is off.\n" msgstr "Mode sans-échec. Auto-rechargement désactivé.\n" @@ -1199,7 +1211,7 @@ msgid "Slice and value different lengths." msgstr "Slice et valeur de tailles différentes" #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "Slices non supportées" @@ -1277,6 +1289,10 @@ msgid "Tile height must exactly divide bitmap height" msgstr "" #: shared-bindings/displayio/TileGrid.c +msgid "Tile indices must be 0 - 255" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "" @@ -1573,6 +1589,10 @@ msgstr "tampon trop petit" msgid "buffers must be the same length" msgstr "les tampons doivent être de la même longueur" +#: shared-bindings/_pew/PewPew.c +msgid "buttons must be digitalio.DigitalInOut" +msgstr "" + #: py/vm.c msgid "byte code not implemented" msgstr "bytecode non implémenté" @@ -2519,11 +2539,6 @@ msgstr "pop d'une liste vide" msgid "popitem(): dictionary is empty" msgstr "popitem(): dictionnaire vide" -#: shared-bindings/displayio/TileGrid.c -#, fuzzy -msgid "position must be 2-tuple" -msgstr "position doit être un 2-tuple" - #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "le 3e argument de pow() ne peut être 0" @@ -2697,6 +2712,10 @@ msgstr "erreur de syntaxe dans le descripteur d'uctypes" msgid "threshold must be in the range 0-65536" msgstr "le seuil doit être dans la gamme 0-65536" +#: shared-bindings/displayio/TileGrid.c +msgid "tile index out of bounds" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() prend une séquence de longueur 9" @@ -2907,3 +2926,7 @@ msgstr "'step' nul" #~ msgid "Only true color (24 bpp or higher) BMP supported %x" #~ msgstr "Seul les BMP 24bits ou plus sont supportés %x" + +#, fuzzy +#~ msgid "position must be 2-tuple" +#~ msgstr "position doit être un 2-tuple" diff --git a/locale/it_IT.po b/locale/it_IT.po index 22bc8ed4b..fd00b9198 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -3,7 +3,6 @@ # This file is distributed under the same license as the PACKAGE package. # Enrico Paganin <enrico.paganin@mail.com>, 2018 # -#: shared-bindings/_pew/PewPew.c shared-module/_pew/PewPew.c #, fuzzy msgid "" msgstr "" @@ -263,6 +262,7 @@ msgstr "Tutti i timer per questo pin sono in uso" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c +#: shared-module/_pew/PewPew.c msgid "All timers in use" msgstr "Tutti i timer utilizzati" @@ -472,6 +472,10 @@ msgstr "" msgid "Clock unit in use" msgstr "Unità di clock in uso" +#: shared-bindings/_pew/PewPew.c +msgid "Column entry must be digitalio.DigitalInOut" +msgstr "" + #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c #, fuzzy msgid "Command must be an int between 0 and 255" @@ -775,6 +779,10 @@ msgstr "" "File .mpy incompatibile. Aggiorna tutti i file .mpy. Vedi http://adafru.it/" "mpy-update per più informazioni." +#: shared-bindings/_pew/PewPew.c +msgid "Incorrect buffer size" +msgstr "" + #: py/moduerrno.c msgid "Input/output error" msgstr "Errore input/output" @@ -1155,6 +1163,10 @@ msgstr "Sola lettura" msgid "Right channel unsupported" msgstr "Canale destro non supportato" +#: shared-bindings/_pew/PewPew.c +msgid "Row entry must be digitalio.DigitalInOut" +msgstr "" + #: main.c msgid "Running in safe mode! Auto-reload is off.\n" msgstr "Modalità sicura in esecuzione! Auto-reload disattivato.\n" @@ -1196,7 +1208,7 @@ msgid "Slice and value different lengths." msgstr "" #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "Slice non supportate" @@ -1264,6 +1276,10 @@ msgid "Tile height must exactly divide bitmap height" msgstr "" #: shared-bindings/displayio/TileGrid.c +msgid "Tile indices must be 0 - 255" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "" @@ -1555,6 +1571,10 @@ msgstr "buffer troppo piccolo" msgid "buffers must be the same length" msgstr "i buffer devono essere della stessa lunghezza" +#: shared-bindings/_pew/PewPew.c +msgid "buttons must be digitalio.DigitalInOut" +msgstr "" + #: py/vm.c msgid "byte code not implemented" msgstr "byte code non implementato" @@ -2495,10 +2515,6 @@ msgstr "pop da una lista vuota" msgid "popitem(): dictionary is empty" msgstr "popitem(): il dizionario è vuoto" -#: shared-bindings/displayio/TileGrid.c -msgid "position must be 2-tuple" -msgstr "position deve essere una 2-tuple" - #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "il terzo argomento di pow() non può essere 0" @@ -2671,6 +2687,10 @@ msgstr "errore di sintassi nel descrittore uctypes" msgid "threshold must be in the range 0-65536" msgstr "la soglia deve essere nell'intervallo 0-65536" +#: shared-bindings/displayio/TileGrid.c +msgid "tile index out of bounds" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" @@ -2879,3 +2899,6 @@ msgstr "zero step" #~ msgid "Only true color (24 bpp or higher) BMP supported %x" #~ msgstr "Solo BMP true color (24 bpp o superiore) sono supportati %x" + +#~ msgid "position must be 2-tuple" +#~ msgstr "position deve essere una 2-tuple" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 77e1beff6..aaf17f54b 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -3,7 +3,6 @@ # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # -#: shared-bindings/_pew/PewPew.c shared-module/_pew/PewPew.c #, fuzzy msgid "" msgstr "" @@ -263,6 +262,7 @@ msgstr "Todos os temporizadores para este pino estão em uso" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c +#: shared-module/_pew/PewPew.c msgid "All timers in use" msgstr "Todos os temporizadores em uso" @@ -468,6 +468,10 @@ msgstr "Clock se estendeu por tempo demais" msgid "Clock unit in use" msgstr "Unidade de Clock em uso" +#: shared-bindings/_pew/PewPew.c +msgid "Column entry must be digitalio.DigitalInOut" +msgstr "" + #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c #, fuzzy msgid "Command must be an int between 0 and 255" @@ -766,6 +770,10 @@ msgid "" "mpy-update for more info." msgstr "" +#: shared-bindings/_pew/PewPew.c +msgid "Incorrect buffer size" +msgstr "" + #: py/moduerrno.c msgid "Input/output error" msgstr "" @@ -1136,6 +1144,10 @@ msgstr "Somente leitura" msgid "Right channel unsupported" msgstr "Canal direito não suportado" +#: shared-bindings/_pew/PewPew.c +msgid "Row entry must be digitalio.DigitalInOut" +msgstr "" + #: main.c msgid "Running in safe mode! Auto-reload is off.\n" msgstr "Rodando em modo seguro! Atualização automática está desligada.\n" @@ -1175,7 +1187,7 @@ msgid "Slice and value different lengths." msgstr "" #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "" @@ -1240,6 +1252,10 @@ msgid "Tile height must exactly divide bitmap height" msgstr "" #: shared-bindings/displayio/TileGrid.c +msgid "Tile indices must be 0 - 255" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "" @@ -1527,6 +1543,10 @@ msgstr "" msgid "buffers must be the same length" msgstr "buffers devem ser o mesmo tamanho" +#: shared-bindings/_pew/PewPew.c +msgid "buttons must be digitalio.DigitalInOut" +msgstr "" + #: py/vm.c msgid "byte code not implemented" msgstr "" @@ -2447,10 +2467,6 @@ msgstr "" msgid "popitem(): dictionary is empty" msgstr "" -#: shared-bindings/displayio/TileGrid.c -msgid "position must be 2-tuple" -msgstr "" - #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "" @@ -2621,6 +2637,10 @@ msgstr "" msgid "threshold must be in the range 0-65536" msgstr "Limite deve estar no alcance de 0-65536" +#: shared-bindings/displayio/TileGrid.c +msgid "tile index out of bounds" +msgstr "" + #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" diff --git a/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk index b9643cb74..03a89f5f5 100644 --- a/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk @@ -12,9 +12,4 @@ LONGINT_IMPL = MPZ CHIP_VARIANT = SAMD21G18A CHIP_FAMILY = samd21 -CFLAGS_INLINE_LIMIT = 70 - -CIRCUITPY_NETWORK = 1 -MICROPY_PY_WIZNET5K = 5500 - CIRCUITPY_FREQUENCYIO = 0 diff --git a/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk index b23a8b76e..5104b601b 100644 --- a/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk @@ -13,9 +13,4 @@ LONGINT_IMPL = MPZ CHIP_VARIANT = SAMD21G18A CHIP_FAMILY = samd21 -CFLAGS_INLINE_LIMIT = 70 - -CIRCUITPY_NETWORK = 1 -MICROPY_PY_WIZNET5K = 5500 - CIRCUITPY_FREQUENCYIO = 0 diff --git a/shared-bindings/_pew/PewPew.c b/shared-bindings/_pew/PewPew.c index 50647488c..d7ae0116d 100644 --- a/shared-bindings/_pew/PewPew.c +++ b/shared-bindings/_pew/PewPew.c @@ -88,12 +88,12 @@ STATIC mp_obj_t pewpew_make_new(const mp_obj_type_t *type, size_t n_args, mp_obj_get_array(args[ARG_cols].u_obj, &cols_size, &cols); if (bufinfo.len != rows_size * cols_size) { - mp_raise_ValueError(translate("")); + mp_raise_ValueError(translate("Incorrect buffer size")); } for (size_t i = 0; i < rows_size; ++i) { if (!MP_OBJ_IS_TYPE(rows[i], &digitalio_digitalinout_type)) { - mp_raise_TypeError(translate("")); + mp_raise_TypeError(translate("Row entry must be digitalio.DigitalInOut")); } digitalio_digitalinout_obj_t *pin = MP_OBJ_TO_PTR(rows[i]); raise_error_if_deinited( @@ -102,7 +102,7 @@ STATIC mp_obj_t pewpew_make_new(const mp_obj_type_t *type, size_t n_args, for (size_t i = 0; i < cols_size; ++i) { if (!MP_OBJ_IS_TYPE(cols[i], &digitalio_digitalinout_type)) { - mp_raise_TypeError(translate("")); + mp_raise_TypeError(translate("Column entry must be digitalio.DigitalInOut")); } digitalio_digitalinout_obj_t *pin = MP_OBJ_TO_PTR(cols[i]); raise_error_if_deinited( @@ -111,7 +111,7 @@ STATIC mp_obj_t pewpew_make_new(const mp_obj_type_t *type, size_t n_args, if (!MP_OBJ_IS_TYPE(args[ARG_buttons].u_obj, &digitalio_digitalinout_type)) { - mp_raise_TypeError(translate("")); + mp_raise_TypeError(translate("buttons must be digitalio.DigitalInOut")); } digitalio_digitalinout_obj_t *buttons = MP_OBJ_TO_PTR( args[ARG_buttons].u_obj); @@ -148,4 +148,3 @@ const mp_obj_type_t pewpew_type = { .make_new = pewpew_make_new, .locals_dict = (mp_obj_dict_t*)&pewpew_locals_dict, }; - diff --git a/shared-bindings/displayio/FourWire.c b/shared-bindings/displayio/FourWire.c index 70cd42747..8ffe54be0 100644 --- a/shared-bindings/displayio/FourWire.c +++ b/shared-bindings/displayio/FourWire.c @@ -46,14 +46,19 @@ //| Manage updating a display over SPI four wire protocol in the background while Python code runs. //| It doesn't handle display initialization. //| -//| .. class:: FourWire(spi_bus, *, command, chip_select, reset) +//| .. class:: FourWire(spi_bus, *, command, chip_select, reset=None) //| //| Create a FourWire object associated with the given pins. //| +//| The SPI bus and pins are then in use by the display until `displayio.release_displays()` is +//| called even after a reload. (It does this so CircuitPython can use the display after your code +//| is done.) So, the first time you initialize a display bus in code.py you should call +//| :py:func`displayio.release_displays` first, otherwise it will error after the first code.py run. +//| //| :param busio.SPI spi_bus: The SPI bus that make up the clock and data lines //| :param microcontroller.Pin command: Data or command pin //| :param microcontroller.Pin chip_select: Chip select pin -//| :param microcontroller.Pin reset: Reset pin +//| :param microcontroller.Pin reset: Reset pin. When None only software reset can be used //| STATIC mp_obj_t displayio_fourwire_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_spi_bus, ARG_command, ARG_chip_select, ARG_reset }; diff --git a/shared-bindings/displayio/Group.c b/shared-bindings/displayio/Group.c index 7b79f3229..c7a72891a 100644 --- a/shared-bindings/displayio/Group.c +++ b/shared-bindings/displayio/Group.c @@ -41,19 +41,23 @@ //| //| Manage a group of sprites and groups and how they are inter-related. //| -//| .. class:: Group(*, max_size=4, scale=1) +//| .. class:: Group(*, max_size=4, scale=1, x=0, y=0) //| //| Create a Group of a given size and scale. Scale is in one dimension. For example, scale=2 //| leads to a layer's pixel being 2x2 pixels when in the group. //| //| :param int max_size: The maximum group size. //| :param int scale: Scale of layer pixels in one dimension. +//| :param int x: Initial x position within the parent. +//| :param int y: Initial y position within the parent. //| STATIC mp_obj_t displayio_group_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_max_size, ARG_scale }; + enum { ARG_max_size, ARG_scale, ARG_x, ARG_y }; static const mp_arg_t allowed_args[] = { { MP_QSTR_max_size, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 4} }, { MP_QSTR_scale, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 1} }, + { MP_QSTR_x, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, + { MP_QSTR_y, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); @@ -70,7 +74,7 @@ STATIC mp_obj_t displayio_group_make_new(const mp_obj_type_t *type, size_t n_arg displayio_group_t *self = m_new_obj(displayio_group_t); self->base.type = &displayio_group_type; - common_hal_displayio_group_construct(self, max_size, scale); + common_hal_displayio_group_construct(self, max_size, scale, args[ARG_x].u_int, args[ARG_y].u_int); return MP_OBJ_FROM_PTR(self); } @@ -168,7 +172,7 @@ const mp_obj_property_t displayio_group_y_obj = { //| Append a layer to the group. It will be drawn above other layers. //| STATIC mp_obj_t displayio_group_obj_append(mp_obj_t self_in, mp_obj_t layer) { - displayio_group_t *self = MP_OBJ_TO_PTR(self_in); + displayio_group_t *self = native_group(self_in); common_hal_displayio_group_insert(self, common_hal_displayio_group_get_len(self), layer); return mp_const_none; } @@ -179,7 +183,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_append_obj, displayio_group_obj_append //| Insert a layer into the group. //| STATIC mp_obj_t displayio_group_obj_insert(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t layer) { - displayio_group_t *self = MP_OBJ_TO_PTR(self_in); + displayio_group_t *self = native_group(self_in); size_t index = mp_get_index(&displayio_group_type, common_hal_displayio_group_get_len(self), index_obj, false); common_hal_displayio_group_insert(self, index, layer); return mp_const_none; @@ -198,7 +202,7 @@ STATIC mp_obj_t displayio_group_obj_pop(size_t n_args, const mp_obj_t *pos_args, mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - displayio_group_t *self = MP_OBJ_TO_PTR(pos_args[0]); + displayio_group_t *self = native_group(pos_args[0]); size_t index = mp_get_index(&displayio_group_type, common_hal_displayio_group_get_len(self), @@ -213,7 +217,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(displayio_group_pop_obj, 1, displayio_group_obj_pop); //| Returns the number of layers in a Group //| STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) { - displayio_group_t *self = MP_OBJ_TO_PTR(self_in); + displayio_group_t *self = native_group(self_in); uint16_t len = common_hal_displayio_group_get_len(self); switch (op) { case MP_UNARY_OP_BOOL: return mp_obj_new_bool(len != 0); @@ -247,7 +251,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) { //| del group[0] //| STATIC mp_obj_t group_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t value) { - displayio_group_t *self = MP_OBJ_TO_PTR(self_in); + displayio_group_t *self = native_group(self_in); if (MP_OBJ_IS_TYPE(index_obj, &mp_type_slice)) { mp_raise_NotImplementedError(translate("Slices not supported")); diff --git a/shared-bindings/displayio/Group.h b/shared-bindings/displayio/Group.h index d326dbf4d..fa3c32964 100644 --- a/shared-bindings/displayio/Group.h +++ b/shared-bindings/displayio/Group.h @@ -32,7 +32,7 @@ extern const mp_obj_type_t displayio_group_type; -void common_hal_displayio_group_construct(displayio_group_t* self, uint32_t max_size, uint32_t scale); +void common_hal_displayio_group_construct(displayio_group_t* self, uint32_t max_size, uint32_t scale, mp_int_t x, mp_int_t y); uint32_t common_hal_displayio_group_get_scale(displayio_group_t* self); void common_hal_displayio_group_set_scale(displayio_group_t* self, uint32_t scale); mp_int_t common_hal_displayio_group_get_x(displayio_group_t* self); diff --git a/shared-bindings/displayio/ParallelBus.c b/shared-bindings/displayio/ParallelBus.c index 6a499ed06..00a96d230 100644 --- a/shared-bindings/displayio/ParallelBus.c +++ b/shared-bindings/displayio/ParallelBus.c @@ -39,18 +39,24 @@ //| .. currentmodule:: displayio //| -//| :class:`ParallelBus` -- Manage updating a display over SPI four wire protocol +//| :class:`ParallelBus` -- Manage updating a display over 8-bit parallel bus //| ============================================================================== //| -//| Manage updating a display over SPI four wire protocol in the background while Python code runs. -//| It doesn't handle display initialization. +//| Manage updating a display over 8-bit parallel bus in the background while Python code runs. This +//| protocol may be refered to as 8080-I Series Parallel Interface in datasheets. It doesn't handle +//| display initialization. //| //| .. class:: ParallelBus(*, data0, command, chip_select, write, read, reset) //| //| Create a ParallelBus object associated with the given pins. The bus is inferred from data0 //| by implying the next 7 additional pins on a given GPIO port. //| -//| :param microcontroller.Pin: The first data pin. The rest are implied +//| The parallel bus and pins are then in use by the display until `displayio.release_displays()` +//| is called even after a reload. (It does this so CircuitPython can use the display after your +//| code is done.) So, the first time you initialize a display bus in code.py you should call +//| :py:func`displayio.release_displays` first, otherwise it will error after the first code.py run. +//| +//| :param microcontroller.Pin data0: The first data pin. The rest are implied //| :param microcontroller.Pin command: Data or command pin //| :param microcontroller.Pin chip_select: Chip select pin //| :param microcontroller.Pin write: Write pin diff --git a/shared-bindings/displayio/TileGrid.c b/shared-bindings/displayio/TileGrid.c index eeacd1918..a45feaec4 100644 --- a/shared-bindings/displayio/TileGrid.c +++ b/shared-bindings/displayio/TileGrid.c @@ -39,17 +39,6 @@ #include "shared-bindings/displayio/Shape.h" #include "supervisor/shared/translate.h" -static void unpack_position(mp_obj_t position_obj, int16_t* x, int16_t* y) { - // TODO(tannewt): Support any value sequence such as bytearray or bytes. - mp_obj_tuple_t *position = MP_OBJ_TO_PTR(position_obj); - if (MP_OBJ_IS_TYPE(position_obj, &mp_type_tuple) && position->len == 2) { - *x = mp_obj_get_int(position->items[0]); - *y = mp_obj_get_int(position->items[1]); - } else if (position != mp_const_none) { - mp_raise_TypeError(translate("position must be 2-tuple")); - } -} - //| .. currentmodule:: displayio //| //| :class:`TileGrid` -- A grid of tiles sourced out of one bitmap @@ -60,7 +49,7 @@ static void unpack_position(mp_obj_t position_obj, int16_t* x, int16_t* y) { //| //| A single tile grid is also known as a Sprite. //| -//| .. class:: TileGrid(bitmap, *, pixel_shader, position, width=1, height=1, tile_width=None, tile_height=None, default_tile=0) +//| .. class:: TileGrid(bitmap, *, pixel_shader, width=1, height=1, tile_width=None, tile_height=None, default_tile=0, x=0, y=0) //| //| Create a TileGrid object. The bitmap is source for 2d pixels. The pixel_shader is used to //| convert the value and its location to a display native pixel color. This may be a simple color @@ -70,24 +59,26 @@ static void unpack_position(mp_obj_t position_obj, int16_t* x, int16_t* y) { //| //| :param displayio.Bitmap bitmap: The bitmap storing one or more tiles. //| :param displayio.Palette pixel_shader: The pixel shader that produces colors from values -//| :param tuple position: Upper left corner of the grid //| :param int width: Width of the grid in tiles. //| :param int height: Height of the grid in tiles. //| :param int tile_width: Width of a single tile in pixels. Defaults to the full Bitmap and must evenly divide into the Bitmap's dimensions. //| :param int tile_height: Height of a single tile in pixels. Defaults to the full Bitmap and must evenly divide into the Bitmap's dimensions. //| :param in default_tile: Default tile index to show. +//| :param int x: Initial x position of the left edge within the parent. +//| :param int y: Initial y position of the top edge within the parent. //| STATIC mp_obj_t displayio_tilegrid_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_bitmap, ARG_pixel_shader, ARG_position, ARG_width, ARG_height, ARG_tile_width, ARG_tile_height, ARG_default_tile }; + enum { ARG_bitmap, ARG_pixel_shader, ARG_width, ARG_height, ARG_tile_width, ARG_tile_height, ARG_default_tile, ARG_x, ARG_y }; static const mp_arg_t allowed_args[] = { { MP_QSTR_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_pixel_shader, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, - { MP_QSTR_position, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, { MP_QSTR_width, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 1} }, { MP_QSTR_height, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 1} }, { MP_QSTR_tile_width, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, { MP_QSTR_tile_height, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, { MP_QSTR_default_tile, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, + { MP_QSTR_x, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, + { MP_QSTR_y, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); @@ -129,10 +120,8 @@ STATIC mp_obj_t displayio_tilegrid_make_new(const mp_obj_type_t *type, size_t n_ mp_raise_ValueError(translate("Tile height must exactly divide bitmap height")); } - int16_t x = 0; - int16_t y = 0; - mp_obj_t position_obj = args[ARG_position].u_obj; - unpack_position(position_obj, &x, &y); + int16_t x = args[ARG_x].u_int; + int16_t y = args[ARG_y].u_int; displayio_tilegrid_t *self = m_new_obj(displayio_tilegrid_t); self->base.type = &displayio_tilegrid_type; @@ -142,41 +131,61 @@ STATIC mp_obj_t displayio_tilegrid_make_new(const mp_obj_type_t *type, size_t n_ return MP_OBJ_FROM_PTR(self); } -//| .. attribute:: position +// Helper to ensure we have the native super class instead of a subclass. +static displayio_tilegrid_t* native_tilegrid(mp_obj_t tilegrid_obj) { + mp_obj_t native_tilegrid = mp_instance_cast_to_native_base(tilegrid_obj, &displayio_tilegrid_type); + return MP_OBJ_TO_PTR(native_tilegrid); +} + +//| .. attribute:: x //| -//| The position of the top-left corner of the tilegrid. +//| X position of the left edge in the parent. //| -STATIC mp_obj_t displayio_tilegrid_obj_get_position(mp_obj_t self_in) { - displayio_tilegrid_t *self = MP_OBJ_TO_PTR(self_in); - int16_t x; - int16_t y; - common_hal_displayio_tilegrid_get_position(self, &x, &y); +STATIC mp_obj_t displayio_tilegrid_obj_get_x(mp_obj_t self_in) { + displayio_tilegrid_t *self = native_tilegrid(self_in); + return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_tilegrid_get_x(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(displayio_tilegrid_get_x_obj, displayio_tilegrid_obj_get_x); - mp_obj_t coords[2]; - coords[0] = mp_obj_new_int(x); - coords[1] = mp_obj_new_int(y); +STATIC mp_obj_t displayio_tilegrid_obj_set_x(mp_obj_t self_in, mp_obj_t x_obj) { + displayio_tilegrid_t *self = native_tilegrid(self_in); - return mp_obj_new_tuple(2, coords); + mp_int_t x = mp_obj_get_int(x_obj); + common_hal_displayio_tilegrid_set_x(self, x); + return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_1(displayio_tilegrid_get_position_obj, displayio_tilegrid_obj_get_position); +MP_DEFINE_CONST_FUN_OBJ_2(displayio_tilegrid_set_x_obj, displayio_tilegrid_obj_set_x); -STATIC mp_obj_t displayio_tilegrid_obj_set_position(mp_obj_t self_in, mp_obj_t value) { - displayio_tilegrid_t *self = MP_OBJ_TO_PTR(self_in); +const mp_obj_property_t displayio_tilegrid_x_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&displayio_tilegrid_get_x_obj, + (mp_obj_t)&displayio_tilegrid_set_x_obj, + (mp_obj_t)&mp_const_none_obj}, +}; - int16_t x = 0; - int16_t y = 0; - unpack_position(value, &x, &y); +//| .. attribute:: y +//| +//| Y position of the top edge in the parent. +//| +STATIC mp_obj_t displayio_tilegrid_obj_get_y(mp_obj_t self_in) { + displayio_tilegrid_t *self = native_tilegrid(self_in); + return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_tilegrid_get_y(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(displayio_tilegrid_get_y_obj, displayio_tilegrid_obj_get_y); - common_hal_displayio_tilegrid_set_position(self, x, y); +STATIC mp_obj_t displayio_tilegrid_obj_set_y(mp_obj_t self_in, mp_obj_t y_obj) { + displayio_tilegrid_t *self = native_tilegrid(self_in); + mp_int_t y = mp_obj_get_int(y_obj); + common_hal_displayio_tilegrid_set_y(self, y); return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_2(displayio_tilegrid_set_position_obj, displayio_tilegrid_obj_set_position); +MP_DEFINE_CONST_FUN_OBJ_2(displayio_tilegrid_set_y_obj, displayio_tilegrid_obj_set_y); -const mp_obj_property_t displayio_tilegrid_position_obj = { +const mp_obj_property_t displayio_tilegrid_y_obj = { .base.type = &mp_type_property, - .proxy = {(mp_obj_t)&displayio_tilegrid_get_position_obj, - (mp_obj_t)&displayio_tilegrid_set_position_obj, + .proxy = {(mp_obj_t)&displayio_tilegrid_get_y_obj, + (mp_obj_t)&displayio_tilegrid_set_y_obj, (mp_obj_t)&mp_const_none_obj}, }; @@ -185,13 +194,13 @@ const mp_obj_property_t displayio_tilegrid_position_obj = { //| The pixel shader of the tilegrid. //| STATIC mp_obj_t displayio_tilegrid_obj_get_pixel_shader(mp_obj_t self_in) { - displayio_tilegrid_t *self = MP_OBJ_TO_PTR(self_in); + displayio_tilegrid_t *self = native_tilegrid(self_in); return common_hal_displayio_tilegrid_get_pixel_shader(self); } MP_DEFINE_CONST_FUN_OBJ_1(displayio_tilegrid_get_pixel_shader_obj, displayio_tilegrid_obj_get_pixel_shader); STATIC mp_obj_t displayio_tilegrid_obj_set_pixel_shader(mp_obj_t self_in, mp_obj_t pixel_shader) { - displayio_tilegrid_t *self = MP_OBJ_TO_PTR(self_in); + displayio_tilegrid_t *self = native_tilegrid(self_in); if (!MP_OBJ_IS_TYPE(pixel_shader, &displayio_palette_type) && !MP_OBJ_IS_TYPE(pixel_shader, &displayio_colorconverter_type)) { mp_raise_TypeError(translate("pixel_shader must be displayio.Palette or displayio.ColorConverter")); } @@ -209,9 +218,72 @@ const mp_obj_property_t displayio_tilegrid_pixel_shader_obj = { (mp_obj_t)&mp_const_none_obj}, }; +//| .. method:: __getitem__(index) +//| +//| Returns the tile index at the given index. The index can either be an x,y tuple or an int equal +//| to ``y * width + x``. +//| +//| This allows you to:: +//| +//| print(grid[0]) +//| +//| .. method:: __setitem__(index, tile_index) +//| +//| Sets the tile index at the given index. The index can either be an x,y tuple or an int equal +//| to ``y * width + x``. +//| +//| This allows you to:: +//| +//| grid[0] = 10 +//| +//| or:: +//| +//| grid[0,0] = 10 +//| +STATIC mp_obj_t tilegrid_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t value_obj) { + displayio_tilegrid_t *self = native_tilegrid(self_in); + + + if (MP_OBJ_IS_TYPE(index_obj, &mp_type_slice)) { + mp_raise_NotImplementedError(translate("Slices not supported")); + } else { + uint16_t x = 0; + uint16_t y = 0; + if (MP_OBJ_IS_SMALL_INT(index_obj)) { + mp_int_t i = MP_OBJ_SMALL_INT_VALUE(index_obj); + uint16_t width = common_hal_displayio_tilegrid_get_width(self); + x = i % width; + y = i / width; + } else { + mp_obj_t* items; + mp_obj_get_array_fixed_n(index_obj, 2, &items); + x = mp_obj_get_int(items[0]); + y = mp_obj_get_int(items[1]); + if (x >= common_hal_displayio_tilegrid_get_width(self) || y >= common_hal_displayio_tilegrid_get_height(self)) { + mp_raise_IndexError(translate("tile index out of bounds")); + } + } + + if (value_obj == MP_OBJ_SENTINEL) { + // load + return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_tilegrid_get_tile(self, x, y)); + } else if (value_obj == mp_const_none) { + return MP_OBJ_NULL; // op not supported + } else { + mp_int_t value = mp_obj_get_int(value_obj); + if (value < 0 || value > 255) { + mp_raise_ValueError(translate("Tile indices must be 0 - 255")); + } + common_hal_displayio_tilegrid_set_tile(self, x, y, value); + } + } + return mp_const_none; +} + STATIC const mp_rom_map_elem_t displayio_tilegrid_locals_dict_table[] = { // Properties - { MP_ROM_QSTR(MP_QSTR_position), MP_ROM_PTR(&displayio_tilegrid_position_obj) }, + { MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&displayio_tilegrid_x_obj) }, + { MP_ROM_QSTR(MP_QSTR_y), MP_ROM_PTR(&displayio_tilegrid_y_obj) }, { MP_ROM_QSTR(MP_QSTR_pixel_shader), MP_ROM_PTR(&displayio_tilegrid_pixel_shader_obj) }, }; STATIC MP_DEFINE_CONST_DICT(displayio_tilegrid_locals_dict, displayio_tilegrid_locals_dict_table); @@ -220,5 +292,6 @@ const mp_obj_type_t displayio_tilegrid_type = { { &mp_type_type }, .name = MP_QSTR_TileGrid, .make_new = displayio_tilegrid_make_new, + .subscr = tilegrid_subscr, .locals_dict = (mp_obj_dict_t*)&displayio_tilegrid_locals_dict, }; diff --git a/shared-bindings/displayio/TileGrid.h b/shared-bindings/displayio/TileGrid.h index 2260db413..15a71b53b 100644 --- a/shared-bindings/displayio/TileGrid.h +++ b/shared-bindings/displayio/TileGrid.h @@ -35,13 +35,20 @@ void common_hal_displayio_tilegrid_construct(displayio_tilegrid_t *self, mp_obj_ uint16_t bitmap_width_in_tiles, mp_obj_t pixel_shader, uint16_t width, uint16_t height, uint16_t tile_width, uint16_t tile_height, uint16_t x, uint16_t y, uint8_t default_tile); -void common_hal_displayio_tilegrid_get_position(displayio_tilegrid_t *self, int16_t* x, int16_t* y); -void common_hal_displayio_tilegrid_set_position(displayio_tilegrid_t *self, int16_t x, int16_t y); - +mp_int_t common_hal_displayio_tilegrid_get_x(displayio_tilegrid_t *self); +void common_hal_displayio_tilegrid_set_x(displayio_tilegrid_t *self, mp_int_t x); +mp_int_t common_hal_displayio_tilegrid_get_y(displayio_tilegrid_t *self); +void common_hal_displayio_tilegrid_set_y(displayio_tilegrid_t *self, mp_int_t y); mp_obj_t common_hal_displayio_tilegrid_get_pixel_shader(displayio_tilegrid_t *self); void common_hal_displayio_tilegrid_set_pixel_shader(displayio_tilegrid_t *self, mp_obj_t pixel_shader); -void common_hal_displayio_textgrid_set_tile(displayio_tilegrid_t *self, uint16_t x, uint16_t y, uint8_t tile_index); -void common_hal_displayio_textgrid_set_top_left(displayio_tilegrid_t *self, uint16_t x, uint16_t y); +uint16_t common_hal_displayio_tilegrid_get_width(displayio_tilegrid_t *self); +uint16_t common_hal_displayio_tilegrid_get_height(displayio_tilegrid_t *self); + +uint8_t common_hal_displayio_tilegrid_get_tile(displayio_tilegrid_t *self, uint16_t x, uint16_t y); +void common_hal_displayio_tilegrid_set_tile(displayio_tilegrid_t *self, uint16_t x, uint16_t y, uint8_t tile_index); + +// Private API for scrolling the TileGrid. +void common_hal_displayio_tilegrid_set_top_left(displayio_tilegrid_t *self, uint16_t x, uint16_t y); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_TILEGRID_H diff --git a/shared-bindings/displayio/__init__.c b/shared-bindings/displayio/__init__.c index 1ee755014..177bd5fff 100644 --- a/shared-bindings/displayio/__init__.c +++ b/shared-bindings/displayio/__init__.c @@ -71,8 +71,6 @@ //| Shape //| TileGrid //| -//| All libraries change hardware state but are never deinit -//| //| .. method:: release_displays() @@ -81,6 +79,9 @@ //| release the builtin display on boards that have one. You will need to reinitialize it yourself //| afterwards. //| +//| Use this once in your code.py if you initialize a display. Place it right before the +//| initialization so the display is active as long as possible. +//| STATIC mp_obj_t displayio_release_displays(void) { common_hal_displayio_release_displays(); return mp_const_none; diff --git a/shared-module/_pew/PewPew.c b/shared-module/_pew/PewPew.c index 7ff4e8c7a..568dc6425 100644 --- a/shared-module/_pew/PewPew.c +++ b/shared-module/_pew/PewPew.c @@ -76,7 +76,7 @@ void pew_init() { // Find a spare timer. uint8_t index = find_free_timer(); if (index == 0xff) { - mp_raise_RuntimeError(translate("")); + mp_raise_RuntimeError(translate("All timers in use")); } Tc *tc = tc_insts[index]; diff --git a/shared-module/displayio/Group.c b/shared-module/displayio/Group.c index f6bc92dc7..20182863e 100644 --- a/shared-module/displayio/Group.c +++ b/shared-module/displayio/Group.c @@ -29,9 +29,9 @@ #include "py/runtime.h" #include "shared-bindings/displayio/TileGrid.h" -void common_hal_displayio_group_construct(displayio_group_t* self, uint32_t max_size, uint32_t scale) { +void common_hal_displayio_group_construct(displayio_group_t* self, uint32_t max_size, uint32_t scale, mp_int_t x, mp_int_t y) { displayio_group_child_t* children = m_new(displayio_group_child_t, max_size); - displayio_group_construct(self, children, max_size, scale); + displayio_group_construct(self, children, max_size, scale, x, y); } uint32_t common_hal_displayio_group_get_scale(displayio_group_t* self) { @@ -116,9 +116,9 @@ void common_hal_displayio_group_set(displayio_group_t* self, size_t index, mp_ob self->needs_refresh = true; } -void displayio_group_construct(displayio_group_t* self, displayio_group_child_t* child_array, uint32_t max_size, uint32_t scale) { - self->x = 0; - self->y = 0; +void displayio_group_construct(displayio_group_t* self, displayio_group_child_t* child_array, uint32_t max_size, uint32_t scale, mp_int_t x, mp_int_t y) { + self->x = x; + self->y = y; self->children = child_array; self->max_size = max_size; self->needs_refresh = false; diff --git a/shared-module/displayio/Group.h b/shared-module/displayio/Group.h index 61409959d..7826b9e66 100644 --- a/shared-module/displayio/Group.h +++ b/shared-module/displayio/Group.h @@ -48,7 +48,7 @@ typedef struct { bool needs_refresh; } displayio_group_t; -void displayio_group_construct(displayio_group_t* self, displayio_group_child_t* child_array, uint32_t max_size, uint32_t scale); +void displayio_group_construct(displayio_group_t* self, displayio_group_child_t* child_array, uint32_t max_size, uint32_t scale, mp_int_t x, mp_int_t y); bool displayio_group_get_pixel(displayio_group_t *group, int16_t x, int16_t y, uint16_t *pixel); bool displayio_group_needs_refresh(displayio_group_t *self); void displayio_group_finish_refresh(displayio_group_t *self); diff --git a/shared-module/displayio/TileGrid.c b/shared-module/displayio/TileGrid.c index c2aa9b144..bbbb11924 100644 --- a/shared-module/displayio/TileGrid.c +++ b/shared-module/displayio/TileGrid.c @@ -66,14 +66,20 @@ void common_hal_displayio_tilegrid_construct(displayio_tilegrid_t *self, mp_obj_ self->y = y; } -void common_hal_displayio_tilegrid_get_position(displayio_tilegrid_t *self, int16_t* x, int16_t* y) { - *x = self->x; - *y = self->y; -} -void common_hal_displayio_tilegrid_set_position(displayio_tilegrid_t *self, int16_t x, int16_t y) { - self->needs_refresh = self->x != x || self->y != y; +mp_int_t common_hal_displayio_tilegrid_get_x(displayio_tilegrid_t *self) { + return self->x; +} +void common_hal_displayio_tilegrid_set_x(displayio_tilegrid_t *self, mp_int_t x) { + self->needs_refresh = self->x != x; self->x = x; +} +mp_int_t common_hal_displayio_tilegrid_get_y(displayio_tilegrid_t *self) { + return self->y; +} + +void common_hal_displayio_tilegrid_set_y(displayio_tilegrid_t *self, mp_int_t y) { + self->needs_refresh = self->y != y; self->y = y; } @@ -86,6 +92,43 @@ void common_hal_displayio_tilegrid_set_pixel_shader(displayio_tilegrid_t *self, self->needs_refresh = true; } + +uint16_t common_hal_displayio_tilegrid_get_width(displayio_tilegrid_t *self) { + return self->width_in_tiles; +} + +uint16_t common_hal_displayio_tilegrid_get_height(displayio_tilegrid_t *self) { + return self->height_in_tiles; +} + +uint8_t common_hal_displayio_tilegrid_get_tile(displayio_tilegrid_t *self, uint16_t x, uint16_t y) { + uint8_t* tiles = self->tiles; + if (self->inline_tiles) { + tiles = (uint8_t*) &self->tiles; + } + if (tiles == NULL) { + return 0; + } + return tiles[y * self->width_in_tiles + x]; +} + +void common_hal_displayio_tilegrid_set_tile(displayio_tilegrid_t *self, uint16_t x, uint16_t y, uint8_t tile_index) { + uint8_t* tiles = self->tiles; + if (self->inline_tiles) { + tiles = (uint8_t*) &self->tiles; + } + if (tiles == NULL) { + return; + } + tiles[y * self->width_in_tiles + x] = tile_index; + self->needs_refresh = true; +} + + +void common_hal_displayio_tilegrid_set_top_left(displayio_tilegrid_t *self, uint16_t x, uint16_t y) { + self->top_left_x = x; + self->top_left_y = y; +} bool displayio_tilegrid_get_pixel(displayio_tilegrid_t *self, int16_t x, int16_t y, uint16_t* pixel) { x -= self->x; y -= self->y; @@ -126,24 +169,6 @@ bool displayio_tilegrid_get_pixel(displayio_tilegrid_t *self, int16_t x, int16_t return false; } -void common_hal_displayio_textgrid_set_tile(displayio_tilegrid_t *self, uint16_t x, uint16_t y, uint8_t tile_index) { - uint8_t* tiles = self->tiles; - if (self->inline_tiles) { - tiles = (uint8_t*) &self->tiles; - } - if (tiles == NULL) { - return; - } - tiles[y * self->width_in_tiles + x] = tile_index; - self->needs_refresh = true; -} - - -void common_hal_displayio_textgrid_set_top_left(displayio_tilegrid_t *self, uint16_t x, uint16_t y) { - self->top_left_x = x; - self->top_left_y = y; -} - bool displayio_tilegrid_needs_refresh(displayio_tilegrid_t *self) { return self->needs_refresh || displayio_palette_needs_refresh(self->pixel_shader); } diff --git a/shared-module/terminalio/Terminal.c b/shared-module/terminalio/Terminal.c index 85bbee293..07c13d639 100644 --- a/shared-module/terminalio/Terminal.c +++ b/shared-module/terminalio/Terminal.c @@ -48,7 +48,7 @@ size_t common_hal_terminalio_terminal_write(terminalio_terminal_obj_t *self, con if (c < 128) { if (c >= 0x20 && c <= 0x7e) { uint8_t tile_index = displayio_builtinfont_get_glyph_index(self->font, c); - common_hal_displayio_textgrid_set_tile(self->tilegrid, self->cursor_x, self->cursor_y, tile_index); + common_hal_displayio_tilegrid_set_tile(self->tilegrid, self->cursor_x, self->cursor_y, tile_index); self->cursor_x++; } else if (c == '\r') { self->cursor_x = 0; @@ -64,7 +64,7 @@ size_t common_hal_terminalio_terminal_write(terminalio_terminal_obj_t *self, con if (i[1] == 'K') { // Clear the rest of the line. for (uint16_t j = self->cursor_x; j < self->tilegrid->width_in_tiles; j++) { - common_hal_displayio_textgrid_set_tile(self->tilegrid, j, self->cursor_y, 0); + common_hal_displayio_tilegrid_set_tile(self->tilegrid, j, self->cursor_y, 0); } i += 2; } else { @@ -94,7 +94,7 @@ size_t common_hal_terminalio_terminal_write(terminalio_terminal_obj_t *self, con } else { uint8_t tile_index = displayio_builtinfont_get_glyph_index(self->font, c); if (tile_index != 0xff) { - common_hal_displayio_textgrid_set_tile(self->tilegrid, self->cursor_x, self->cursor_y, tile_index); + common_hal_displayio_tilegrid_set_tile(self->tilegrid, self->cursor_x, self->cursor_y, tile_index); self->cursor_x++; } @@ -109,10 +109,10 @@ size_t common_hal_terminalio_terminal_write(terminalio_terminal_obj_t *self, con if (self->cursor_y != start_y) { // clear the new row for (uint16_t j = 0; j < self->tilegrid->width_in_tiles; j++) { - common_hal_displayio_textgrid_set_tile(self->tilegrid, j, self->cursor_y, 0); + common_hal_displayio_tilegrid_set_tile(self->tilegrid, j, self->cursor_y, 0); start_y = self->cursor_y; } - common_hal_displayio_textgrid_set_top_left(self->tilegrid, 0, (start_y + self->tilegrid->height_in_tiles + 1) % self->tilegrid->height_in_tiles); + common_hal_displayio_tilegrid_set_top_left(self->tilegrid, 0, (start_y + self->tilegrid->height_in_tiles + 1) % self->tilegrid->height_in_tiles); } } return i - data; |
