diff --git a/.gitmodules b/.gitmodules index 365d9ff72f..ebff8ecb2a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -119,3 +119,6 @@ [submodule "ports/stm/st_driver"] path = ports/stm/st_driver url = https://github.com/hathach/st_driver.git +[submodule "lib/protomatter"] + path = lib/protomatter + url = https://github.com/adafruit/Adafruit_Protomatter diff --git a/lib/protomatter b/lib/protomatter new file mode 160000 index 0000000000..c411714cbd --- /dev/null +++ b/lib/protomatter @@ -0,0 +1 @@ +Subproject commit c411714cbdc05725e80398acb18c3c1fb6fa68a4 diff --git a/locale/ID.po b/locale/ID.po index ab8aa844c8..5715f446f5 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: 2020-04-13 19:22-0500\n" +"POT-Creation-Date: 2020-04-14 18:26-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -53,6 +53,11 @@ msgstr "output:\n" msgid "%%c requires int or char" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "" @@ -283,7 +288,7 @@ msgstr "Semua timer untuk pin ini sedang digunakan" #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c -#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c +#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c #: shared-module/_pew/PewPew.c msgid "All timers in use" msgstr "Semua timer sedang digunakan" @@ -323,6 +328,10 @@ msgstr "" msgid "Array values should be single bytes." msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +msgid "At most %d %q may be specified (not %d)" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" @@ -340,6 +349,7 @@ msgstr "" "menjalankannya atau masuk ke REPL untukmenonaktifkan.\n" #: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" msgstr "" @@ -355,7 +365,9 @@ msgstr "" msgid "Both pins must support hardware interrupts" msgstr "Kedua pin harus mendukung hardware interrut" +#: shared-bindings/_protomatter/Protomatter.c #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness must be 0-1.0" msgstr "" @@ -364,6 +376,7 @@ msgid "Brightness must be between 0 and 255" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" msgstr "" @@ -378,10 +391,12 @@ msgid "Buffer incorrect size. Should be %d bytes." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is too small" msgstr "" @@ -641,11 +656,13 @@ msgid "DigitalInOut not supported on given pin" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "" @@ -763,6 +780,7 @@ msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "" @@ -851,7 +869,7 @@ msgstr "" msgid "Invalid UART pin selection" msgstr "" -#: py/moduerrno.c +#: py/moduerrno.c shared-module/_protomatter/Protomatter.c msgid "Invalid argument" msgstr "" @@ -906,7 +924,7 @@ msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: shared-bindings/pulseio/PWMOut.c +#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c msgid "Invalid pin" msgstr "Pin tidak valid" @@ -1021,6 +1039,11 @@ msgstr "" msgid "Must provide MISO or MOSI pin" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "Must use a multiple of 6 rgb pins, not %d" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "" @@ -1104,6 +1127,10 @@ msgstr "" msgid "No such file/directory" msgstr "" +#: shared-module/_protomatter/Protomatter.c +msgid "No timer available" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Nordic Soft Device failure assertion." msgstr "" @@ -1180,6 +1207,14 @@ msgstr "Pin tidak mempunya kemampuan untuk ADC (Analog Digital Converter)" msgid "Pin number already reserved by EXTI" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "" +"Pinout uses %d bytes per element, which consumes more than the ideal %d " +"bytes. If this cannot be avoided, pass allow_inefficient=True to the " +"constructor" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "Tambahkan module apapun pada filesystem\n" @@ -1198,6 +1233,11 @@ msgstr "" "Tekan tombol apa saja untuk masuk ke dalam REPL. Gunakan CTRL+D untuk reset " "(Reload)" +#: shared-module/_protomatter/Protomatter.c +#, c-format +msgid "Protomatter internal error #%d" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" @@ -1392,13 +1432,11 @@ msgstr "" msgid "Too many channels in sample." msgstr "Terlalu banyak channel dalam sampel" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/displayio/ParallelBus.c +#: shared-module/displayio/__init__.c msgid "Too many display busses" msgstr "" -#: shared-bindings/displayio/Display.c -#: shared-bindings/displayio/EPaperDisplay.c +#: shared-module/displayio/__init__.c msgid "Too many displays" msgstr "" @@ -2779,6 +2817,16 @@ msgstr "anotasi return harus sebuah identifier" msgid "return expected '%q' but got '%q'" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] duplicates another pin assignment" +msgstr "" + +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] is not on the same port as clock" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "right hand side must be an ndarray, or a scalar" msgstr "" diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index a421b4ef18..a679a0b6e2 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-04-13 19:22-0500\n" +"POT-Creation-Date: 2020-04-14 18:26-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -53,6 +53,11 @@ msgstr "" msgid "%%c requires int or char" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "" @@ -281,7 +286,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c -#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c +#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c #: shared-module/_pew/PewPew.c msgid "All timers in use" msgstr "" @@ -321,6 +326,10 @@ msgstr "" msgid "Array values should be single bytes." msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +msgid "At most %d %q may be specified (not %d)" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" @@ -336,6 +345,7 @@ msgid "" msgstr "" #: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" msgstr "" @@ -351,7 +361,9 @@ msgstr "" msgid "Both pins must support hardware interrupts" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness must be 0-1.0" msgstr "" @@ -360,6 +372,7 @@ msgid "Brightness must be between 0 and 255" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" msgstr "" @@ -374,10 +387,12 @@ msgid "Buffer incorrect size. Should be %d bytes." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is too small" msgstr "" @@ -630,11 +645,13 @@ msgid "DigitalInOut not supported on given pin" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "" @@ -752,6 +769,7 @@ msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "" @@ -840,7 +858,7 @@ msgstr "" msgid "Invalid UART pin selection" msgstr "" -#: py/moduerrno.c +#: py/moduerrno.c shared-module/_protomatter/Protomatter.c msgid "Invalid argument" msgstr "" @@ -895,7 +913,7 @@ msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: shared-bindings/pulseio/PWMOut.c +#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c msgid "Invalid pin" msgstr "" @@ -1010,6 +1028,11 @@ msgstr "" msgid "Must provide MISO or MOSI pin" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "Must use a multiple of 6 rgb pins, not %d" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "" @@ -1093,6 +1116,10 @@ msgstr "" msgid "No such file/directory" msgstr "" +#: shared-module/_protomatter/Protomatter.c +msgid "No timer available" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Nordic Soft Device failure assertion." msgstr "" @@ -1168,6 +1195,14 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "" +"Pinout uses %d bytes per element, which consumes more than the ideal %d " +"bytes. If this cannot be avoided, pass allow_inefficient=True to the " +"constructor" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "" @@ -1184,6 +1219,11 @@ msgstr "" msgid "Press any key to enter the REPL. Use CTRL-D to reload." msgstr "" +#: shared-module/_protomatter/Protomatter.c +#, c-format +msgid "Protomatter internal error #%d" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" @@ -1376,13 +1416,11 @@ msgstr "" msgid "Too many channels in sample." msgstr "" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/displayio/ParallelBus.c +#: shared-module/displayio/__init__.c msgid "Too many display busses" msgstr "" -#: shared-bindings/displayio/Display.c -#: shared-bindings/displayio/EPaperDisplay.c +#: shared-module/displayio/__init__.c msgid "Too many displays" msgstr "" @@ -2754,6 +2792,16 @@ msgstr "" msgid "return expected '%q' but got '%q'" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] duplicates another pin assignment" +msgstr "" + +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] is not on the same port as clock" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "right hand side must be an ndarray, or a scalar" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index ec343d7f20..9c65306058 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: 2020-04-13 19:22-0500\n" +"POT-Creation-Date: 2020-04-14 18:26-0500\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: Pascal Deneaux\n" "Language-Team: Sebastian Plamauer, Pascal Deneaux\n" @@ -55,6 +55,11 @@ msgstr " Ausgabe:\n" msgid "%%c requires int or char" msgstr "%%c erwartet int oder char" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q in Benutzung" @@ -283,7 +288,7 @@ msgstr "Alle timer für diesen Pin werden bereits benutzt" #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c -#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c +#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c #: shared-module/_pew/PewPew.c msgid "All timers in use" msgstr "Alle timer werden benutzt" @@ -323,6 +328,10 @@ msgstr "Array muss Halbwörter enthalten (type 'H')" msgid "Array values should be single bytes." msgstr "Array-Werte sollten aus Einzelbytes bestehen." +#: shared-bindings/_protomatter/Protomatter.c +msgid "At most %d %q may be specified (not %d)" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" @@ -340,6 +349,7 @@ msgstr "" "auszuführen oder verbinde dich mit der REPL zum Deaktivieren.\n" #: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" msgstr "Unterhalb der minimalen Frame Rate" @@ -355,7 +365,9 @@ msgstr "Bit depth muss ein Vielfaches von 8 sein." msgid "Both pins must support hardware interrupts" msgstr "Beide pins müssen Hardware Interrupts unterstützen" +#: shared-bindings/_protomatter/Protomatter.c #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness must be 0-1.0" msgstr "Die Helligkeit muss zwischen 0 und 1.0 liegen" @@ -364,6 +376,7 @@ msgid "Brightness must be between 0 and 255" msgstr "Die Helligkeit muss zwischen 0 und 255 liegen" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" msgstr "Die Helligkeit ist nicht einstellbar" @@ -378,10 +391,12 @@ msgid "Buffer incorrect size. Should be %d bytes." msgstr "Der Puffergröße ist inkorrekt. Sie sollte %d bytes haben." #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "Der Puffer ist kein Byte-Array" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is too small" msgstr "Der Puffer ist zu klein" @@ -634,11 +649,13 @@ msgid "DigitalInOut not supported on given pin" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." msgstr "Display muss einen 16 Bit Farbraum haben." #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "Die Rotation der Anzeige muss in 90-Grad-Schritten erfolgen" @@ -758,6 +775,7 @@ msgstr "Die Funktion erwartet, dass der 'lock'-Befehl zuvor ausgeführt wurde" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "Gruppe schon benutzt" @@ -848,7 +866,7 @@ msgstr "" msgid "Invalid UART pin selection" msgstr "" -#: py/moduerrno.c +#: py/moduerrno.c shared-module/_protomatter/Protomatter.c msgid "Invalid argument" msgstr "Ungültiges Argument" @@ -903,7 +921,7 @@ msgstr "Ungültige Phase" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: shared-bindings/pulseio/PWMOut.c +#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c msgid "Invalid pin" msgstr "Ungültiger Pin" @@ -1019,6 +1037,11 @@ msgstr "Muss eine %q Unterklasse sein." msgid "Must provide MISO or MOSI pin" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "Must use a multiple of 6 rgb pins, not %d" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "" @@ -1102,6 +1125,10 @@ msgstr "Kein Speicherplatz mehr verfügbar auf dem Gerät" msgid "No such file/directory" msgstr "Keine solche Datei/Verzeichnis" +#: shared-module/_protomatter/Protomatter.c +msgid "No timer available" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Nordic Soft Device failure assertion." msgstr "" @@ -1183,6 +1210,14 @@ msgstr "Pin hat keine ADC Funktionalität" msgid "Pin number already reserved by EXTI" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "" +"Pinout uses %d bytes per element, which consumes more than the ideal %d " +"bytes. If this cannot be avoided, pass allow_inefficient=True to the " +"constructor" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "und alle Module im Dateisystem \n" @@ -1201,6 +1236,11 @@ msgstr "" "Drücke eine Taste um dich mit der REPL zu verbinden. Drücke Strg-D zum neu " "laden" +#: shared-module/_protomatter/Protomatter.c +#, c-format +msgid "Protomatter internal error #%d" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Pull wird nicht verwendet, wenn die Richtung output ist." @@ -1395,13 +1435,11 @@ msgstr "" msgid "Too many channels in sample." msgstr "Zu viele Kanäle im sample" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/displayio/ParallelBus.c +#: shared-module/displayio/__init__.c msgid "Too many display busses" msgstr "" -#: shared-bindings/displayio/Display.c -#: shared-bindings/displayio/EPaperDisplay.c +#: shared-module/displayio/__init__.c msgid "Too many displays" msgstr "Zu viele displays" @@ -2792,6 +2830,16 @@ msgstr "return annotation muss ein identifier sein" msgid "return expected '%q' but got '%q'" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] duplicates another pin assignment" +msgstr "" + +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] is not on the same port as clock" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "right hand side must be an ndarray, or a scalar" msgstr "" diff --git a/locale/en_US.po b/locale/en_US.po index a28fc10302..b753d40a7d 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: 2020-04-13 19:22-0500\n" +"POT-Creation-Date: 2020-04-14 18:26-0500\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: \n" "Language-Team: \n" @@ -53,6 +53,11 @@ msgstr "" msgid "%%c requires int or char" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "" @@ -281,7 +286,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c -#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c +#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c #: shared-module/_pew/PewPew.c msgid "All timers in use" msgstr "" @@ -321,6 +326,10 @@ msgstr "" msgid "Array values should be single bytes." msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +msgid "At most %d %q may be specified (not %d)" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" @@ -336,6 +345,7 @@ msgid "" msgstr "" #: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" msgstr "" @@ -351,7 +361,9 @@ msgstr "" msgid "Both pins must support hardware interrupts" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness must be 0-1.0" msgstr "" @@ -360,6 +372,7 @@ msgid "Brightness must be between 0 and 255" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" msgstr "" @@ -374,10 +387,12 @@ msgid "Buffer incorrect size. Should be %d bytes." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is too small" msgstr "" @@ -630,11 +645,13 @@ msgid "DigitalInOut not supported on given pin" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "" @@ -752,6 +769,7 @@ msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "" @@ -840,7 +858,7 @@ msgstr "" msgid "Invalid UART pin selection" msgstr "" -#: py/moduerrno.c +#: py/moduerrno.c shared-module/_protomatter/Protomatter.c msgid "Invalid argument" msgstr "" @@ -895,7 +913,7 @@ msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: shared-bindings/pulseio/PWMOut.c +#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c msgid "Invalid pin" msgstr "" @@ -1010,6 +1028,11 @@ msgstr "" msgid "Must provide MISO or MOSI pin" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "Must use a multiple of 6 rgb pins, not %d" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "" @@ -1093,6 +1116,10 @@ msgstr "" msgid "No such file/directory" msgstr "" +#: shared-module/_protomatter/Protomatter.c +msgid "No timer available" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Nordic Soft Device failure assertion." msgstr "" @@ -1168,6 +1195,14 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "" +"Pinout uses %d bytes per element, which consumes more than the ideal %d " +"bytes. If this cannot be avoided, pass allow_inefficient=True to the " +"constructor" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "" @@ -1184,6 +1219,11 @@ msgstr "" msgid "Press any key to enter the REPL. Use CTRL-D to reload." msgstr "" +#: shared-module/_protomatter/Protomatter.c +#, c-format +msgid "Protomatter internal error #%d" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" @@ -1376,13 +1416,11 @@ msgstr "" msgid "Too many channels in sample." msgstr "" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/displayio/ParallelBus.c +#: shared-module/displayio/__init__.c msgid "Too many display busses" msgstr "" -#: shared-bindings/displayio/Display.c -#: shared-bindings/displayio/EPaperDisplay.c +#: shared-module/displayio/__init__.c msgid "Too many displays" msgstr "" @@ -2754,6 +2792,16 @@ msgstr "" msgid "return expected '%q' but got '%q'" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] duplicates another pin assignment" +msgstr "" + +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] is not on the same port as clock" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "right hand side must be an ndarray, or a scalar" msgstr "" diff --git a/locale/en_x_pirate.po b/locale/en_x_pirate.po index 946c3af24f..57c6500a20 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: 2020-04-13 19:22-0500\n" +"POT-Creation-Date: 2020-04-14 18:26-0500\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: \n" "Language-Team: @sommersoft, @MrCertainly\n" @@ -55,6 +55,11 @@ msgstr "" msgid "%%c requires int or char" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "" @@ -283,7 +288,7 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c -#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c +#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c #: shared-module/_pew/PewPew.c msgid "All timers in use" msgstr "" @@ -323,6 +328,10 @@ msgstr "" msgid "Array values should be single bytes." msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +msgid "At most %d %q may be specified (not %d)" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" @@ -340,6 +349,7 @@ msgstr "" "t' the REPL t' scuttle.\n" #: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" msgstr "" @@ -355,7 +365,9 @@ msgstr "" msgid "Both pins must support hardware interrupts" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness must be 0-1.0" msgstr "" @@ -364,6 +376,7 @@ msgid "Brightness must be between 0 and 255" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" msgstr "" @@ -378,10 +391,12 @@ msgid "Buffer incorrect size. Should be %d bytes." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is too small" msgstr "" @@ -634,11 +649,13 @@ msgid "DigitalInOut not supported on given pin" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "" @@ -756,6 +773,7 @@ msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "" @@ -844,7 +862,7 @@ msgstr "" msgid "Invalid UART pin selection" msgstr "" -#: py/moduerrno.c +#: py/moduerrno.c shared-module/_protomatter/Protomatter.c msgid "Invalid argument" msgstr "" @@ -899,7 +917,7 @@ msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: shared-bindings/pulseio/PWMOut.c +#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c msgid "Invalid pin" msgstr "" @@ -1014,6 +1032,11 @@ msgstr "" msgid "Must provide MISO or MOSI pin" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "Must use a multiple of 6 rgb pins, not %d" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "" @@ -1097,6 +1120,10 @@ msgstr "" msgid "No such file/directory" msgstr "" +#: shared-module/_protomatter/Protomatter.c +msgid "No timer available" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Nordic Soft Device failure assertion." msgstr "" @@ -1172,6 +1199,14 @@ msgstr "Belay that! Th' Pin be not ADC capable" msgid "Pin number already reserved by EXTI" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "" +"Pinout uses %d bytes per element, which consumes more than the ideal %d " +"bytes. If this cannot be avoided, pass allow_inefficient=True to the " +"constructor" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "" @@ -1188,6 +1223,11 @@ msgstr "" msgid "Press any key to enter the REPL. Use CTRL-D to reload." msgstr "" +#: shared-module/_protomatter/Protomatter.c +#, c-format +msgid "Protomatter internal error #%d" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" @@ -1380,13 +1420,11 @@ msgstr "" msgid "Too many channels in sample." msgstr "" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/displayio/ParallelBus.c +#: shared-module/displayio/__init__.c msgid "Too many display busses" msgstr "" -#: shared-bindings/displayio/Display.c -#: shared-bindings/displayio/EPaperDisplay.c +#: shared-module/displayio/__init__.c msgid "Too many displays" msgstr "" @@ -2758,6 +2796,16 @@ msgstr "" msgid "return expected '%q' but got '%q'" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] duplicates another pin assignment" +msgstr "" + +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] is not on the same port as clock" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "right hand side must be an ndarray, or a scalar" msgstr "" diff --git a/locale/es.po b/locale/es.po index f3f6c45914..b1cfbad702 100644 --- a/locale/es.po +++ b/locale/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-04-13 19:22-0500\n" +"POT-Creation-Date: 2020-04-14 18:26-0500\n" "PO-Revision-Date: 2018-08-24 22:56-0500\n" "Last-Translator: \n" "Language-Team: \n" @@ -55,6 +55,11 @@ msgstr " salida:\n" msgid "%%c requires int or char" msgstr "%%c requiere int o char" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q está siendo utilizado" @@ -285,7 +290,7 @@ msgstr "Todos los timers para este pin están siendo utilizados" #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c -#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c +#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c #: shared-module/_pew/PewPew.c msgid "All timers in use" msgstr "Todos los timers en uso" @@ -325,6 +330,10 @@ msgstr "Array debe contener media palabra (type 'H')" msgid "Array values should be single bytes." msgstr "Valores del array deben ser bytes individuales." +#: shared-bindings/_protomatter/Protomatter.c +msgid "At most %d %q may be specified (not %d)" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" @@ -342,6 +351,7 @@ msgstr "" "ejecutarlos o entra al REPL para desabilitarlos.\n" #: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" msgstr "" @@ -357,7 +367,9 @@ msgstr "Bits depth debe ser múltiplo de 8." msgid "Both pins must support hardware interrupts" msgstr "Ambos pines deben soportar interrupciones por hardware" +#: shared-bindings/_protomatter/Protomatter.c #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness must be 0-1.0" msgstr "" @@ -366,6 +378,7 @@ msgid "Brightness must be between 0 and 255" msgstr "El brillo debe estar entro 0 y 255" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" msgstr "El brillo no se puede ajustar" @@ -380,10 +393,12 @@ msgid "Buffer incorrect size. Should be %d bytes." msgstr "Tamaño de buffer incorrecto. Debe ser de %d bytes." #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is too small" msgstr "" @@ -636,11 +651,13 @@ msgid "DigitalInOut not supported on given pin" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "Rotación de display debe ser en incrementos de 90 grados" @@ -758,6 +775,7 @@ msgstr "La función requiere lock" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "" @@ -848,7 +866,7 @@ msgstr "" msgid "Invalid UART pin selection" msgstr "" -#: py/moduerrno.c +#: py/moduerrno.c shared-module/_protomatter/Protomatter.c msgid "Invalid argument" msgstr "Argumento inválido" @@ -903,7 +921,7 @@ msgstr "Fase inválida" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: shared-bindings/pulseio/PWMOut.c +#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c msgid "Invalid pin" msgstr "Pin inválido" @@ -1018,6 +1036,11 @@ msgstr "Debe de ser una subclase de %q" msgid "Must provide MISO or MOSI pin" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "Must use a multiple of 6 rgb pins, not %d" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "" @@ -1101,6 +1124,10 @@ msgstr "No queda espacio en el dispositivo" msgid "No such file/directory" msgstr "No existe el archivo/directorio" +#: shared-module/_protomatter/Protomatter.c +msgid "No timer available" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Nordic Soft Device failure assertion." msgstr "" @@ -1182,6 +1209,14 @@ msgstr "Pin no tiene capacidad ADC" msgid "Pin number already reserved by EXTI" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "" +"Pinout uses %d bytes per element, which consumes more than the ideal %d " +"bytes. If this cannot be avoided, pass allow_inefficient=True to the " +"constructor" +msgstr "" + #: py/builtinhelp.c #, fuzzy msgid "Plus any modules on the filesystem\n" @@ -1200,6 +1235,11 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload." msgstr "" "Presiona cualquier tecla para entrar al REPL. Usa CTRL-D para recargar." +#: shared-module/_protomatter/Protomatter.c +#, c-format +msgid "Protomatter internal error #%d" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Pull no se usa cuando la dirección es output." @@ -1393,13 +1433,11 @@ msgstr "Ancho del Tile debe dividir exactamente el ancho de mapa de bits" msgid "Too many channels in sample." msgstr "Demasiados canales en sample." -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/displayio/ParallelBus.c +#: shared-module/displayio/__init__.c msgid "Too many display busses" msgstr "Demasiados buses de pantalla" -#: shared-bindings/displayio/Display.c -#: shared-bindings/displayio/EPaperDisplay.c +#: shared-module/displayio/__init__.c msgid "Too many displays" msgstr "Muchos displays" @@ -2792,6 +2830,16 @@ msgstr "la anotación de retorno debe ser un identificador" msgid "return expected '%q' but got '%q'" msgstr "retorno esperado '%q' pero se obtuvo '%q'" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] duplicates another pin assignment" +msgstr "" + +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] is not on the same port as clock" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "right hand side must be an ndarray, or a scalar" msgstr "" diff --git a/locale/fil.po b/locale/fil.po index 44da9b7557..4049cce7d3 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: 2020-04-13 19:22-0500\n" +"POT-Creation-Date: 2020-04-14 18:26-0500\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -53,6 +53,11 @@ msgstr " output:\n" msgid "%%c requires int or char" msgstr "%%c nangangailangan ng int o char" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q ay ginagamit" @@ -285,7 +290,7 @@ msgstr "Lahat ng timers para sa pin na ito ay ginagamit" #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c -#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c +#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c #: shared-module/_pew/PewPew.c msgid "All timers in use" msgstr "Lahat ng timer ginagamit" @@ -325,6 +330,10 @@ msgstr "May halfwords (type 'H') dapat ang array" msgid "Array values should be single bytes." msgstr "Array values ay dapat single bytes." +#: shared-bindings/_protomatter/Protomatter.c +msgid "At most %d %q may be specified (not %d)" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" @@ -342,6 +351,7 @@ msgstr "" "para patakbuhin sila o pasukin ang REPL para i-disable ito.\n" #: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" msgstr "" @@ -357,7 +367,9 @@ msgstr "Bit depth ay dapat multiple ng 8." msgid "Both pins must support hardware interrupts" msgstr "Ang parehong mga pin ay dapat na sumusuporta sa hardware interrupts" +#: shared-bindings/_protomatter/Protomatter.c #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness must be 0-1.0" msgstr "" @@ -366,6 +378,7 @@ msgid "Brightness must be between 0 and 255" msgstr "Ang liwanag ay dapat sa gitna ng 0 o 255" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" msgstr "" @@ -380,10 +393,12 @@ msgid "Buffer incorrect size. Should be %d bytes." msgstr "Mali ang size ng buffer. Dapat %d bytes." #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is too small" msgstr "" @@ -642,11 +657,13 @@ msgid "DigitalInOut not supported on given pin" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "" @@ -766,6 +783,7 @@ msgstr "Function nangangailangan ng lock" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "" @@ -856,7 +874,7 @@ msgstr "" msgid "Invalid UART pin selection" msgstr "" -#: py/moduerrno.c +#: py/moduerrno.c shared-module/_protomatter/Protomatter.c msgid "Invalid argument" msgstr "Maling argumento" @@ -911,7 +929,7 @@ msgstr "Mali ang phase" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: shared-bindings/pulseio/PWMOut.c +#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c msgid "Invalid pin" msgstr "Mali ang pin" @@ -1026,6 +1044,11 @@ msgstr "" msgid "Must provide MISO or MOSI pin" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "Must use a multiple of 6 rgb pins, not %d" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "" @@ -1109,6 +1132,10 @@ msgstr "" msgid "No such file/directory" msgstr "Walang file/directory" +#: shared-module/_protomatter/Protomatter.c +msgid "No timer available" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Nordic Soft Device failure assertion." msgstr "" @@ -1188,6 +1215,14 @@ msgstr "Ang pin ay walang kakayahan sa ADC" msgid "Pin number already reserved by EXTI" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "" +"Pinout uses %d bytes per element, which consumes more than the ideal %d " +"bytes. If this cannot be avoided, pass allow_inefficient=True to the " +"constructor" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "Kasama ang kung ano pang modules na sa filesystem\n" @@ -1206,6 +1241,11 @@ msgstr "" "Pindutin ang anumang key upang pumasok sa REPL. Gamitin ang CTRL-D upang i-" "reload." +#: shared-module/_protomatter/Protomatter.c +#, c-format +msgid "Protomatter internal error #%d" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Pull hindi ginagamit kapag ang direksyon ay output." @@ -1399,13 +1439,11 @@ msgstr "" msgid "Too many channels in sample." msgstr "Sobra ang channels sa sample." -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/displayio/ParallelBus.c +#: shared-module/displayio/__init__.c msgid "Too many display busses" msgstr "" -#: shared-bindings/displayio/Display.c -#: shared-bindings/displayio/EPaperDisplay.c +#: shared-module/displayio/__init__.c msgid "Too many displays" msgstr "" @@ -2806,6 +2844,16 @@ msgstr "return annotation ay dapat na identifier" msgid "return expected '%q' but got '%q'" msgstr "return umasa ng '%q' pero ang nakuha ay ‘%q’" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] duplicates another pin assignment" +msgstr "" + +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] is not on the same port as clock" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "right hand side must be an ndarray, or a scalar" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index 17746f41fd..54f4d06450 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: 2020-04-13 19:22-0500\n" +"POT-Creation-Date: 2020-04-14 18:26-0500\n" "PO-Revision-Date: 2019-04-14 20:05+0100\n" "Last-Translator: Pierrick Couturier \n" "Language-Team: fr\n" @@ -55,6 +55,11 @@ msgstr " sortie:\n" msgid "%%c requires int or char" msgstr "%%c nécessite un entier 'int' ou un caractère 'char'" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q utilisé" @@ -288,7 +293,7 @@ msgstr "Tous les timers pour cette broche sont utilisés" #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c -#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c +#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c #: shared-module/_pew/PewPew.c msgid "All timers in use" msgstr "Tous les timers sont utilisés" @@ -329,6 +334,10 @@ msgstr "Le tableau doit contenir des demi-mots (type 'H')" msgid "Array values should be single bytes." msgstr "Les valeurs du tableau doivent être des octets simples 'bytes'." +#: shared-bindings/_protomatter/Protomatter.c +msgid "At most %d %q may be specified (not %d)" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" @@ -346,6 +355,7 @@ msgstr "" "lancer ou entrez sur REPL pour le désactiver.\n" #: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" msgstr "" @@ -361,7 +371,9 @@ msgstr "La profondeur de bit doit être un multiple de 8." msgid "Both pins must support hardware interrupts" msgstr "Les deux entrées doivent supporter les interruptions matérielles" +#: shared-bindings/_protomatter/Protomatter.c #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness must be 0-1.0" msgstr "" @@ -370,6 +382,7 @@ msgid "Brightness must be between 0 and 255" msgstr "La luminosité doit être entre 0 et 255" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" msgstr "Luminosité non-ajustable" @@ -384,10 +397,12 @@ msgid "Buffer incorrect size. Should be %d bytes." msgstr "Tampon de taille incorrect. Devrait être de %d octets." #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is too small" msgstr "" @@ -645,11 +660,13 @@ msgid "DigitalInOut not supported on given pin" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "La rotation d'affichage doit se faire par incréments de 90 degrés" @@ -769,6 +786,7 @@ msgstr "La fonction nécessite un verrou" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "" @@ -860,7 +878,7 @@ msgstr "" msgid "Invalid UART pin selection" msgstr "" -#: py/moduerrno.c +#: py/moduerrno.c shared-module/_protomatter/Protomatter.c msgid "Invalid argument" msgstr "Argument invalide" @@ -917,7 +935,7 @@ msgstr "Phase invalide" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: shared-bindings/pulseio/PWMOut.c +#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c msgid "Invalid pin" msgstr "Broche invalide" @@ -1033,6 +1051,11 @@ msgstr "" msgid "Must provide MISO or MOSI pin" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "Must use a multiple of 6 rgb pins, not %d" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "" @@ -1116,6 +1139,10 @@ msgstr "Il n'y a plus d'espace libre sur le périphérique" msgid "No such file/directory" msgstr "Fichier/dossier introuvable" +#: shared-module/_protomatter/Protomatter.c +msgid "No timer available" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Nordic Soft Device failure assertion." msgstr "" @@ -1202,6 +1229,14 @@ msgstr "La broche ne peut être utilisée pour l'ADC" msgid "Pin number already reserved by EXTI" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "" +"Pinout uses %d bytes per element, which consumes more than the ideal %d " +"bytes. If this cannot be avoided, pass allow_inefficient=True to the " +"constructor" +msgstr "" + #: py/builtinhelp.c #, fuzzy msgid "Plus any modules on the filesystem\n" @@ -1219,6 +1254,11 @@ msgstr "" msgid "Press any key to enter the REPL. Use CTRL-D to reload." msgstr "Appuyez sur une touche pour entrer sur REPL ou CTRL-D pour recharger." +#: shared-module/_protomatter/Protomatter.c +#, c-format +msgid "Protomatter internal error #%d" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Le tirage 'pull' n'est pas utilisé quand la direction est 'output'." @@ -1414,13 +1454,11 @@ msgstr "La largeur de la tuile doit diviser exactement la largeur de l'image" msgid "Too many channels in sample." msgstr "Trop de canaux dans l'échantillon." -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/displayio/ParallelBus.c +#: shared-module/displayio/__init__.c msgid "Too many display busses" msgstr "Trop de bus d'affichage" -#: shared-bindings/displayio/Display.c -#: shared-bindings/displayio/EPaperDisplay.c +#: shared-module/displayio/__init__.c msgid "Too many displays" msgstr "Trop d'affichages" @@ -2838,6 +2876,16 @@ msgstr "l'annotation de return doit être un identifiant" msgid "return expected '%q' but got '%q'" msgstr "return attendait '%q' mais a reçu '%q'" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] duplicates another pin assignment" +msgstr "" + +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] is not on the same port as clock" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "right hand side must be an ndarray, or a scalar" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 1717f20f95..5111c3eef6 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: 2020-04-13 19:22-0500\n" +"POT-Creation-Date: 2020-04-14 18:26-0500\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -53,6 +53,11 @@ msgstr " output:\n" msgid "%%c requires int or char" msgstr "%%c necessita di int o char" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q in uso" @@ -284,7 +289,7 @@ msgstr "Tutti i timer per questo pin sono in uso" #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c -#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c +#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c #: shared-module/_pew/PewPew.c msgid "All timers in use" msgstr "Tutti i timer utilizzati" @@ -324,6 +329,10 @@ msgstr "Array deve avere mezzoparole (typo 'H')" msgid "Array values should be single bytes." msgstr "Valori di Array dovrebbero essere bytes singulari" +#: shared-bindings/_protomatter/Protomatter.c +msgid "At most %d %q may be specified (not %d)" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" @@ -341,6 +350,7 @@ msgstr "" "per disabilitarlo.\n" #: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" msgstr "" @@ -357,7 +367,9 @@ msgstr "La profondità di bit deve essere multipla di 8." msgid "Both pins must support hardware interrupts" msgstr "Entrambi i pin devono supportare gli interrupt hardware" +#: shared-bindings/_protomatter/Protomatter.c #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness must be 0-1.0" msgstr "" @@ -366,6 +378,7 @@ msgid "Brightness must be between 0 and 255" msgstr "La luminosità deve essere compreso tra 0 e 255" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" msgstr "Illiminazione non è regolabile" @@ -380,10 +393,12 @@ msgid "Buffer incorrect size. Should be %d bytes." msgstr "Buffer di lunghezza non valida. Dovrebbe essere di %d bytes." #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is too small" msgstr "" @@ -642,11 +657,13 @@ msgid "DigitalInOut not supported on given pin" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "" @@ -766,6 +783,7 @@ msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "" @@ -856,7 +874,7 @@ msgstr "" msgid "Invalid UART pin selection" msgstr "" -#: py/moduerrno.c +#: py/moduerrno.c shared-module/_protomatter/Protomatter.c msgid "Invalid argument" msgstr "Argomento non valido" @@ -913,7 +931,7 @@ msgstr "Fase non valida" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: shared-bindings/pulseio/PWMOut.c +#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c msgid "Invalid pin" msgstr "Pin non valido" @@ -1030,6 +1048,11 @@ msgstr "" msgid "Must provide MISO or MOSI pin" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "Must use a multiple of 6 rgb pins, not %d" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "" @@ -1113,6 +1136,10 @@ msgstr "Non che spazio sul dispositivo" msgid "No such file/directory" msgstr "Nessun file/directory esistente" +#: shared-module/_protomatter/Protomatter.c +msgid "No timer available" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Nordic Soft Device failure assertion." msgstr "" @@ -1197,6 +1224,14 @@ msgstr "Il pin non ha capacità di ADC" msgid "Pin number already reserved by EXTI" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "" +"Pinout uses %d bytes per element, which consumes more than the ideal %d " +"bytes. If this cannot be avoided, pass allow_inefficient=True to the " +"constructor" +msgstr "" + #: py/builtinhelp.c #, fuzzy msgid "Plus any modules on the filesystem\n" @@ -1215,6 +1250,11 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload." msgstr "" "Premi un qualunque tasto per entrare nel REPL. Usa CTRL-D per ricaricare." +#: shared-module/_protomatter/Protomatter.c +#, c-format +msgid "Protomatter internal error #%d" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" @@ -1410,13 +1450,11 @@ msgstr "" msgid "Too many channels in sample." msgstr "" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/displayio/ParallelBus.c +#: shared-module/displayio/__init__.c msgid "Too many display busses" msgstr "" -#: shared-bindings/displayio/Display.c -#: shared-bindings/displayio/EPaperDisplay.c +#: shared-module/displayio/__init__.c msgid "Too many displays" msgstr "Troppi schermi" @@ -2813,6 +2851,16 @@ msgstr "" msgid "return expected '%q' but got '%q'" msgstr "return aspettava '%q' ma ha ottenuto '%q'" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] duplicates another pin assignment" +msgstr "" + +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] is not on the same port as clock" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "right hand side must be an ndarray, or a scalar" msgstr "" diff --git a/locale/ko.po b/locale/ko.po index 9a1770f33b..6fb1789551 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: 2020-04-13 19:22-0500\n" +"POT-Creation-Date: 2020-04-14 18:26-0500\n" "PO-Revision-Date: 2019-05-06 14:22-0700\n" "Last-Translator: \n" "Language-Team: LANGUAGE \n" @@ -55,6 +55,11 @@ msgstr " 산출:\n" msgid "%%c requires int or char" msgstr "%%c 전수(int)또는 캐릭터(char)필요합니다" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q 사용 중입니다" @@ -283,7 +288,7 @@ msgstr "핀의 모든 타이머가 사용 중입니다" #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c -#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c +#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c #: shared-module/_pew/PewPew.c msgid "All timers in use" msgstr "모든 타이머가 사용 중입니다" @@ -323,6 +328,10 @@ msgstr "" msgid "Array values should be single bytes." msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +msgid "At most %d %q may be specified (not %d)" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" @@ -340,6 +349,7 @@ msgstr "" "성화하려면 REPL을 입력하십시오.\n" #: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" msgstr "" @@ -355,7 +365,9 @@ msgstr "" msgid "Both pins must support hardware interrupts" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness must be 0-1.0" msgstr "" @@ -364,6 +376,7 @@ msgid "Brightness must be between 0 and 255" msgstr "밝기는 0에서 255 사이 여야합니다" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" msgstr "밝기를 조절할 수 없습니다" @@ -378,10 +391,12 @@ msgid "Buffer incorrect size. Should be %d bytes." msgstr "잘못된 크기의 버퍼. %d 바이트 여야합니다." #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is too small" msgstr "" @@ -634,11 +649,13 @@ msgid "DigitalInOut not supported on given pin" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "" @@ -756,6 +773,7 @@ msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "" @@ -844,7 +862,7 @@ msgstr "" msgid "Invalid UART pin selection" msgstr "" -#: py/moduerrno.c +#: py/moduerrno.c shared-module/_protomatter/Protomatter.c msgid "Invalid argument" msgstr "" @@ -899,7 +917,7 @@ msgstr "단계가 잘못되었습니다" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: shared-bindings/pulseio/PWMOut.c +#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c msgid "Invalid pin" msgstr "핀이 잘못되었습니다" @@ -1014,6 +1032,11 @@ msgstr "" msgid "Must provide MISO or MOSI pin" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "Must use a multiple of 6 rgb pins, not %d" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "" @@ -1097,6 +1120,10 @@ msgstr "" msgid "No such file/directory" msgstr "" +#: shared-module/_protomatter/Protomatter.c +msgid "No timer available" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Nordic Soft Device failure assertion." msgstr "" @@ -1172,6 +1199,14 @@ msgstr "" msgid "Pin number already reserved by EXTI" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "" +"Pinout uses %d bytes per element, which consumes more than the ideal %d " +"bytes. If this cannot be avoided, pass allow_inefficient=True to the " +"constructor" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "" @@ -1188,6 +1223,11 @@ msgstr "" msgid "Press any key to enter the REPL. Use CTRL-D to reload." msgstr "" +#: shared-module/_protomatter/Protomatter.c +#, c-format +msgid "Protomatter internal error #%d" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" @@ -1380,13 +1420,11 @@ msgstr "" msgid "Too many channels in sample." msgstr "" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/displayio/ParallelBus.c +#: shared-module/displayio/__init__.c msgid "Too many display busses" msgstr "" -#: shared-bindings/displayio/Display.c -#: shared-bindings/displayio/EPaperDisplay.c +#: shared-module/displayio/__init__.c msgid "Too many displays" msgstr "" @@ -2759,6 +2797,16 @@ msgstr "" msgid "return expected '%q' but got '%q'" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] duplicates another pin assignment" +msgstr "" + +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] is not on the same port as clock" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "right hand side must be an ndarray, or a scalar" msgstr "" diff --git a/locale/pl.po b/locale/pl.po index d26dff9416..49442ceb1c 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: 2020-04-13 19:22-0500\n" +"POT-Creation-Date: 2020-04-14 18:26-0500\n" "PO-Revision-Date: 2019-03-19 18:37-0700\n" "Last-Translator: Radomir Dopieralski \n" "Language-Team: pl\n" @@ -54,6 +54,11 @@ msgstr " wyjście:\n" msgid "%%c requires int or char" msgstr "%%c wymaga int lub char" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q w użyciu" @@ -282,7 +287,7 @@ msgstr "Wszystkie timery tej nóżki w użyciu" #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c -#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c +#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c #: shared-module/_pew/PewPew.c msgid "All timers in use" msgstr "Wszystkie timery w użyciu" @@ -322,6 +327,10 @@ msgstr "Tablica musi zawierać pół-słowa (typ 'H')" msgid "Array values should be single bytes." msgstr "Wartości powinny być bajtami." +#: shared-bindings/_protomatter/Protomatter.c +msgid "At most %d %q may be specified (not %d)" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" @@ -339,6 +348,7 @@ msgstr "" "uruchomić, albo wejdź w konsolę aby wyłączyć.\n" #: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" msgstr "" @@ -354,7 +364,9 @@ msgstr "Głębia musi być wielokrotnością 8." msgid "Both pins must support hardware interrupts" msgstr "Obie nóżki muszą wspierać przerwania sprzętowe" +#: shared-bindings/_protomatter/Protomatter.c #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness must be 0-1.0" msgstr "" @@ -363,6 +375,7 @@ msgid "Brightness must be between 0 and 255" msgstr "Jasność musi być pomiędzy 0 a 255" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" msgstr "Jasność nie jest regulowana" @@ -377,10 +390,12 @@ msgid "Buffer incorrect size. Should be %d bytes." msgstr "Zła wielkość bufora. Powinno być %d bajtów." #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is too small" msgstr "" @@ -633,11 +648,13 @@ msgid "DigitalInOut not supported on given pin" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "Wyświetlacz można obracać co 90 stopni" @@ -755,6 +772,7 @@ msgstr "Funkcja wymaga blokady" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "" @@ -845,7 +863,7 @@ msgstr "" msgid "Invalid UART pin selection" msgstr "" -#: py/moduerrno.c +#: py/moduerrno.c shared-module/_protomatter/Protomatter.c msgid "Invalid argument" msgstr "Zły argument" @@ -900,7 +918,7 @@ msgstr "Zła faza" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: shared-bindings/pulseio/PWMOut.c +#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c msgid "Invalid pin" msgstr "Zła nóżka" @@ -1015,6 +1033,11 @@ msgstr "" msgid "Must provide MISO or MOSI pin" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "Must use a multiple of 6 rgb pins, not %d" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "" @@ -1098,6 +1121,10 @@ msgstr "Brak miejsca" msgid "No such file/directory" msgstr "Brak pliku/katalogu" +#: shared-module/_protomatter/Protomatter.c +msgid "No timer available" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Nordic Soft Device failure assertion." msgstr "" @@ -1173,6 +1200,14 @@ msgstr "Nóżka nie obsługuje ADC" msgid "Pin number already reserved by EXTI" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "" +"Pinout uses %d bytes per element, which consumes more than the ideal %d " +"bytes. If this cannot be avoided, pass allow_inefficient=True to the " +"constructor" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "Oraz moduły w systemie plików\n" @@ -1189,6 +1224,11 @@ msgstr "" msgid "Press any key to enter the REPL. Use CTRL-D to reload." msgstr "Dowolny klawisz aby uruchomić konsolę. CTRL-D aby przeładować." +#: shared-module/_protomatter/Protomatter.c +#, c-format +msgid "Protomatter internal error #%d" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Podciągnięcie nieużywane w trybie wyjścia." @@ -1381,13 +1421,11 @@ msgstr "Szerokość bitmapy musi być wielokrotnością szerokości kafelka" msgid "Too many channels in sample." msgstr "Zbyt wiele kanałów." -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/displayio/ParallelBus.c +#: shared-module/displayio/__init__.c msgid "Too many display busses" msgstr "Zbyt wiele magistrali" -#: shared-bindings/displayio/Display.c -#: shared-bindings/displayio/EPaperDisplay.c +#: shared-module/displayio/__init__.c msgid "Too many displays" msgstr "Zbyt wiele wyświetlaczy" @@ -2764,6 +2802,16 @@ msgstr "anotacja wartości musi być identyfikatorem" msgid "return expected '%q' but got '%q'" msgstr "return oczekiwał '%q', a jest '%q'" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] duplicates another pin assignment" +msgstr "" + +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] is not on the same port as clock" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "right hand side must be an ndarray, or a scalar" msgstr "" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 153dadd910..197d57d02b 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: 2020-04-13 19:22-0500\n" +"POT-Creation-Date: 2020-04-14 18:26-0500\n" "PO-Revision-Date: 2018-10-02 21:14-0000\n" "Last-Translator: \n" "Language-Team: \n" @@ -53,6 +53,11 @@ msgstr " saída:\n" msgid "%%c requires int or char" msgstr "%%c requer int ou char" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q em uso" @@ -284,7 +289,7 @@ msgstr "Todos os temporizadores para este pino estão em uso" #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c -#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c +#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c #: shared-module/_pew/PewPew.c msgid "All timers in use" msgstr "Todos os temporizadores em uso" @@ -324,6 +329,10 @@ msgstr "Array deve conter meias palavras (tipo 'H')" msgid "Array values should be single bytes." msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +msgid "At most %d %q may be specified (not %d)" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" @@ -339,6 +348,7 @@ msgid "" msgstr "" #: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" msgstr "" @@ -354,7 +364,9 @@ msgstr "" msgid "Both pins must support hardware interrupts" msgstr "Ambos os pinos devem suportar interrupções de hardware" +#: shared-bindings/_protomatter/Protomatter.c #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness must be 0-1.0" msgstr "" @@ -363,6 +375,7 @@ msgid "Brightness must be between 0 and 255" msgstr "O brilho deve estar entre 0 e 255" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" msgstr "" @@ -377,10 +390,12 @@ msgid "Buffer incorrect size. Should be %d bytes." msgstr "Buffer de tamanho incorreto. Deve ser %d bytes." #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is too small" msgstr "" @@ -637,11 +652,13 @@ msgid "DigitalInOut not supported on given pin" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "" @@ -761,6 +778,7 @@ msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "" @@ -849,7 +867,7 @@ msgstr "" msgid "Invalid UART pin selection" msgstr "" -#: py/moduerrno.c +#: py/moduerrno.c shared-module/_protomatter/Protomatter.c msgid "Invalid argument" msgstr "Argumento inválido" @@ -906,7 +924,7 @@ msgstr "Fase Inválida" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: shared-bindings/pulseio/PWMOut.c +#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c msgid "Invalid pin" msgstr "Pino inválido" @@ -1022,6 +1040,11 @@ msgstr "" msgid "Must provide MISO or MOSI pin" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "Must use a multiple of 6 rgb pins, not %d" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "" @@ -1105,6 +1128,10 @@ msgstr "" msgid "No such file/directory" msgstr "" +#: shared-module/_protomatter/Protomatter.c +msgid "No timer available" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Nordic Soft Device failure assertion." msgstr "" @@ -1183,6 +1210,14 @@ msgstr "O pino não tem recursos de ADC" msgid "Pin number already reserved by EXTI" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "" +"Pinout uses %d bytes per element, which consumes more than the ideal %d " +"bytes. If this cannot be avoided, pass allow_inefficient=True to the " +"constructor" +msgstr "" + #: py/builtinhelp.c #, fuzzy msgid "Plus any modules on the filesystem\n" @@ -1200,6 +1235,11 @@ msgstr "" msgid "Press any key to enter the REPL. Use CTRL-D to reload." msgstr "" +#: shared-module/_protomatter/Protomatter.c +#, c-format +msgid "Protomatter internal error #%d" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" @@ -1393,13 +1433,11 @@ msgstr "" msgid "Too many channels in sample." msgstr "Muitos canais na amostra." -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/displayio/ParallelBus.c +#: shared-module/displayio/__init__.c msgid "Too many display busses" msgstr "" -#: shared-bindings/displayio/Display.c -#: shared-bindings/displayio/EPaperDisplay.c +#: shared-module/displayio/__init__.c msgid "Too many displays" msgstr "" @@ -2776,6 +2814,16 @@ msgstr "" msgid "return expected '%q' but got '%q'" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] duplicates another pin assignment" +msgstr "" + +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] is not on the same port as clock" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "right hand side must be an ndarray, or a scalar" msgstr "" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index d1c0d5b79c..457e35b625 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: 2020-04-13 19:22-0500\n" +"POT-Creation-Date: 2020-04-14 18:26-0500\n" "PO-Revision-Date: 2019-04-13 10:10-0700\n" "Last-Translator: hexthat\n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -60,6 +60,11 @@ msgstr " shūchū:\n" msgid "%%c requires int or char" msgstr "%%c xūyào zhěngshù huò char" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q zhèngzài shǐyòng" @@ -288,7 +293,7 @@ msgstr "Cǐ yǐn jiǎo de suǒyǒu jìshí qì zhèngzài shǐyòng" #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c -#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c +#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c #: shared-module/_pew/PewPew.c msgid "All timers in use" msgstr "Suǒyǒu jìshí qì shǐyòng" @@ -328,6 +333,10 @@ msgstr "Shùzǔ bìxū bāohán bàn zìshù (type 'H')" msgid "Array values should be single bytes." msgstr "Shùzǔ zhí yīnggāi shì dāngè zì jié." +#: shared-bindings/_protomatter/Protomatter.c +msgid "At most %d %q may be specified (not %d)" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "MicroPython VM zài wèi yùnxíng shí chángshì fēnpèi duī." @@ -345,6 +354,7 @@ msgstr "" "huò shūrù REPL jìnyòng.\n" #: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" msgstr "Dī yú zuìdī zhèng sùlǜ" @@ -360,7 +370,9 @@ msgstr "Bǐtè shēndù bìxū shì 8 bèi yǐshàng." msgid "Both pins must support hardware interrupts" msgstr "Liǎng gè yǐn jiǎo dōu bìxū zhīchí yìngjiàn zhōngduàn" +#: shared-bindings/_protomatter/Protomatter.c #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness must be 0-1.0" msgstr "Liàngdù bìxū wèi 0-1.0" @@ -369,6 +381,7 @@ msgid "Brightness must be between 0 and 255" msgstr "Liàngdù bìxū jiè yú 0 dào 255 zhī jiān" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" msgstr "Liàngdù wúfǎ tiáozhěng" @@ -383,10 +396,12 @@ msgid "Buffer incorrect size. Should be %d bytes." msgstr "Huǎnchōng qū dàxiǎo bù zhèngquè. Yīnggāi shì %d zì jié." #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "Huǎnchōng qū bùshì bytearray" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is too small" msgstr "Huǎnchōng qū tài xiǎo" @@ -641,11 +656,13 @@ msgid "DigitalInOut not supported on given pin" msgstr "Gěi dìng de yǐn jiǎo bù zhīchí DigitalInOut" #: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." msgstr "Xiǎnshì bìxū jùyǒu 16 wèi yánsè kōngjiān." #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "Xiǎnshì xuánzhuǎn bìxū 90 dù jiā xīn" @@ -763,6 +780,7 @@ msgstr "Hánshù xūyào suǒdìng" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c +#: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "Jítuán yǐjīng shǐyòngguò" @@ -853,7 +871,7 @@ msgstr "Wúxiào de SPI yǐn jiǎo xuǎnzé" msgid "Invalid UART pin selection" msgstr "Wúxiào de UART yǐn jiǎo xuǎnzé" -#: py/moduerrno.c +#: py/moduerrno.c shared-module/_protomatter/Protomatter.c msgid "Invalid argument" msgstr "Wúxiào de cānshù" @@ -908,7 +926,7 @@ msgstr "Jiēduàn wúxiào" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: shared-bindings/pulseio/PWMOut.c +#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c msgid "Invalid pin" msgstr "Wúxiào de yǐn jiǎo" @@ -1023,6 +1041,11 @@ msgstr "Bìxū shì %q zi lèi." msgid "Must provide MISO or MOSI pin" msgstr "Bìxū tígōng MISO huò MOSI yǐn jiǎo" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "Must use a multiple of 6 rgb pins, not %d" +msgstr "" + #: py/parse.c msgid "Name too long" msgstr "" @@ -1106,6 +1129,10 @@ msgstr "Shèbèi shàng méiyǒu kònggé" msgid "No such file/directory" msgstr "Méiyǒu cǐ lèi wénjiàn/mùlù" +#: shared-module/_protomatter/Protomatter.c +msgid "No timer available" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Nordic Soft Device failure assertion." msgstr "Nordic ruǎn shèbèi gùzhàng shēngmíng." @@ -1187,6 +1214,14 @@ msgstr "Pin méiyǒu ADC nénglì" msgid "Pin number already reserved by EXTI" msgstr "" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "" +"Pinout uses %d bytes per element, which consumes more than the ideal %d " +"bytes. If this cannot be avoided, pass allow_inefficient=True to the " +"constructor" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "Zài wénjiàn xìtǒng shàng tiānjiā rènhé mókuài\n" @@ -1203,6 +1238,11 @@ msgstr "Qiánzhuì huǎnchōng qū bìxū zài duī shàng" msgid "Press any key to enter the REPL. Use CTRL-D to reload." msgstr "Àn xià rènhé jiàn jìnrù REPL. Shǐyòng CTRL-D chóngxīn jiāzài." +#: shared-module/_protomatter/Protomatter.c +#, c-format +msgid "Protomatter internal error #%d" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Fāngxiàng shūchū shí Pull méiyǒu shǐyòng." @@ -1402,13 +1442,11 @@ msgstr "Píng pū kuāndù bìxū huàfēn wèi tú kuāndù" msgid "Too many channels in sample." msgstr "Chōuyàng zhōng de píndào tài duō." -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/displayio/ParallelBus.c +#: shared-module/displayio/__init__.c msgid "Too many display busses" msgstr "Xiǎnshì zǒngxiàn tài duōle" -#: shared-bindings/displayio/Display.c -#: shared-bindings/displayio/EPaperDisplay.c +#: shared-module/displayio/__init__.c msgid "Too many displays" msgstr "Xiǎnshì tài duō" @@ -2793,6 +2831,16 @@ msgstr "fǎnhuí zhùshì bìxū shì biāozhì fú" msgid "return expected '%q' but got '%q'" msgstr "fǎnhuí yùqí de '%q' dàn huòdéle '%q'" +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] duplicates another pin assignment" +msgstr "" + +#: shared-bindings/_protomatter/Protomatter.c +#, c-format +msgid "rgb_pins[%d] is not on the same port as clock" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "right hand side must be an ndarray, or a scalar" msgstr "" diff --git a/ports/atmel-samd/boards/hallowing_m0_express/board.c b/ports/atmel-samd/boards/hallowing_m0_express/board.c index 0b44bd4bb1..9a1db9ca97 100644 --- a/ports/atmel-samd/boards/hallowing_m0_express/board.c +++ b/ports/atmel-samd/boards/hallowing_m0_express/board.c @@ -97,6 +97,7 @@ void board_init(void) { false, // Pixels in a byte share a row. Only used for depth < 8 1, // bytes per cell. Only valid for depths < 8 false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command diff --git a/ports/atmel-samd/boards/hallowing_m4_express/board.c b/ports/atmel-samd/boards/hallowing_m4_express/board.c index 5dbdd499af..3e4a04ae22 100644 --- a/ports/atmel-samd/boards/hallowing_m4_express/board.c +++ b/ports/atmel-samd/boards/hallowing_m4_express/board.c @@ -77,6 +77,7 @@ void board_init(void) { false, // Pixels in a byte share a row. Only used for depth < 8 1, // bytes per cell. Only valid for depths < 8 false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command diff --git a/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk b/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk index 5429bcf86e..f7223790ac 100644 --- a/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk +++ b/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk @@ -11,8 +11,10 @@ LONGINT_IMPL = MPZ # Not needed. CIRCUITPY_AUDIOBUSIO = 0 +CIRCUITPY_FRAMEBUFFERIO = 0 CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_NETWORK = 0 +CIRCUITPY_PROTOMATTER = 0 CIRCUITPY_PS2IO = 0 CIRCUITPY_AUDIOMP3 = 0 diff --git a/ports/atmel-samd/boards/monster_m4sk/board.c b/ports/atmel-samd/boards/monster_m4sk/board.c index 684639c309..55d6f80c91 100644 --- a/ports/atmel-samd/boards/monster_m4sk/board.c +++ b/ports/atmel-samd/boards/monster_m4sk/board.c @@ -78,6 +78,7 @@ void board_init(void) { false, // pixels in a byte share a row. Only valid for depths < 8 1, // bytes per cell. Only valid for depths < 8 false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command diff --git a/ports/atmel-samd/boards/pewpew_m4/board.c b/ports/atmel-samd/boards/pewpew_m4/board.c index 0f8936696f..cf8439cf0e 100644 --- a/ports/atmel-samd/boards/pewpew_m4/board.c +++ b/ports/atmel-samd/boards/pewpew_m4/board.c @@ -128,6 +128,7 @@ void board_init(void) { false, // pixels in byte share row. only used for depth < 8 1, // bytes per cell. Only valid for depths < 8 false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command diff --git a/ports/atmel-samd/boards/pybadge/board.c b/ports/atmel-samd/boards/pybadge/board.c index 257d72e30d..ffddf03977 100644 --- a/ports/atmel-samd/boards/pybadge/board.c +++ b/ports/atmel-samd/boards/pybadge/board.c @@ -100,6 +100,7 @@ void board_init(void) { false, // pixels in byte share row. only used for depth < 8 1, // bytes per cell. Only valid for depths < 8 false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command diff --git a/ports/atmel-samd/boards/pybadge_airlift/board.c b/ports/atmel-samd/boards/pybadge_airlift/board.c index 7df245a724..8274d0ebeb 100644 --- a/ports/atmel-samd/boards/pybadge_airlift/board.c +++ b/ports/atmel-samd/boards/pybadge_airlift/board.c @@ -78,6 +78,7 @@ void board_init(void) { false, // pixels in byte share row. Only used for depth < 8 1, // bytes per cell. Only valid for depths < 8 false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command diff --git a/ports/atmel-samd/boards/pycubed/mpconfigboard.mk b/ports/atmel-samd/boards/pycubed/mpconfigboard.mk index adbb4aedb9..c14a296159 100644 --- a/ports/atmel-samd/boards/pycubed/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pycubed/mpconfigboard.mk @@ -15,10 +15,12 @@ LONGINT_IMPL = MPZ # Not needed. CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_DISPLAYIO = 0 +CIRCUITPY_FRAMEBUFFERIO = 0 CIRCUITPY_GAMEPAD = 0 +CIRCUITPY_PROTOMATTER = 0 CIRCUITPY_PS2IO = 0 FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD \ No newline at end of file +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD diff --git a/ports/atmel-samd/boards/pygamer/board.c b/ports/atmel-samd/boards/pygamer/board.c index 7c3ca6e335..c7f2f6e1d8 100644 --- a/ports/atmel-samd/boards/pygamer/board.c +++ b/ports/atmel-samd/boards/pygamer/board.c @@ -100,6 +100,7 @@ void board_init(void) { false, // pixels in a byte share a row. Only valid for depths < 8 1, // bytes per cell. Only valid for depths < 8 false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command diff --git a/ports/atmel-samd/boards/pygamer_advance/board.c b/ports/atmel-samd/boards/pygamer_advance/board.c index 7fd3ebc5e1..6053fedb09 100644 --- a/ports/atmel-samd/boards/pygamer_advance/board.c +++ b/ports/atmel-samd/boards/pygamer_advance/board.c @@ -78,6 +78,7 @@ void board_init(void) { false, // pixels in a byte share a row. Only valid for depths < 8 1, // bytes per cell. Only valid for depths < 8 false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command diff --git a/ports/atmel-samd/boards/pyportal/board.c b/ports/atmel-samd/boards/pyportal/board.c index a86f0ee48a..ed3006e3cc 100644 --- a/ports/atmel-samd/boards/pyportal/board.c +++ b/ports/atmel-samd/boards/pyportal/board.c @@ -87,6 +87,7 @@ void board_init(void) { false, // pixels_in_byte_share_row (unused for depths > 8) 1, // bytes per cell. Only valid for depths < 8 false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command diff --git a/ports/atmel-samd/boards/pyportal_titano/board.c b/ports/atmel-samd/boards/pyportal_titano/board.c index a9ded1760d..e7763b6e5c 100644 --- a/ports/atmel-samd/boards/pyportal_titano/board.c +++ b/ports/atmel-samd/boards/pyportal_titano/board.c @@ -104,6 +104,7 @@ void board_init(void) { false, // pixels_in_byte_share_row (unused for depths > 8) 1, // bytes per cell. Only valid for depths < 8 false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command diff --git a/ports/atmel-samd/boards/robohatmm1_m4/mpconfigboard.mk b/ports/atmel-samd/boards/robohatmm1_m4/mpconfigboard.mk index fd4f222306..57eb7f1b9c 100644 --- a/ports/atmel-samd/boards/robohatmm1_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/robohatmm1_m4/mpconfigboard.mk @@ -17,7 +17,9 @@ LONGINT_IMPL = MPZ CIRCUITPY_AUDIOBUSIO = 0 # Make room for more stuff CIRCUITPY_DISPLAYIO = 0 +CIRCUITPY_FRAMEBUFFERIO = 0 CIRCUITPY_FREQUENCYIO = 0 +CIRCUITPY_PROTOMATTER = 0 # Include these Python libraries in firmware. #FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice diff --git a/ports/atmel-samd/boards/ugame10/board.c b/ports/atmel-samd/boards/ugame10/board.c index 07814d558b..38661950f4 100644 --- a/ports/atmel-samd/boards/ugame10/board.c +++ b/ports/atmel-samd/boards/ugame10/board.c @@ -97,6 +97,7 @@ void board_init(void) { false, // pixels in byte share row. Only used with depth < 8 1, // bytes per cell. Only valid for depths < 8 false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command diff --git a/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk b/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk index d91369f75e..691c1c1365 100644 --- a/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk +++ b/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk @@ -18,6 +18,7 @@ CIRCUITPY_AUDIOIO = 1 # Disable modules that are unusable on this special-purpose board. CIRCUITPY_BITBANGIO = 0 +CIRCUITPY_FRAMEBUFFERIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CSLAVE = 0 CIRCUITPY_AUDIOBUSIO = 0 @@ -27,6 +28,7 @@ CIRCUITPY_GAMEPAD = 0 CIRCUITPY_I2CSLAVE = 0 CIRCUITPY_NETWORK = 0 CIRCUITPY_TOUCHIO = 0 +CIRCUITPY_PROTOMATTER = 0 CIRCUITPY_PS2IO = 0 CIRCUITPY_USB_HID = 0 CIRCUITPY_RTC = 0 diff --git a/ports/atmel-samd/boards/winterbloom_sol/mpconfigboard.mk b/ports/atmel-samd/boards/winterbloom_sol/mpconfigboard.mk index 166eaad3f7..ed97aef4c0 100644 --- a/ports/atmel-samd/boards/winterbloom_sol/mpconfigboard.mk +++ b/ports/atmel-samd/boards/winterbloom_sol/mpconfigboard.mk @@ -21,10 +21,12 @@ CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_AUDIOIO = 0 CIRCUITPY_BLEIO = 0 CIRCUITPY_DISPLAYIO = 0 +CIRCUITPY_FRAMEBUFFERIO = 0 CIRCUITPY_GAMEPAD = 0 CIRCUITPY_I2CSLAVE = 0 CIRCUITPY_NETWORK = 0 CIRCUITPY_TOUCHIO = 0 +CIRCUITPY_PROTOMATTER = 0 CIRCUITPY_PS2IO = 0 CIRCUITPY_USB_HID = 0 diff --git a/ports/atmel-samd/common-hal/_protomatter/Protomatter.c b/ports/atmel-samd/common-hal/_protomatter/Protomatter.c new file mode 100644 index 0000000000..bf9cafb6b9 --- /dev/null +++ b/ports/atmel-samd/common-hal/_protomatter/Protomatter.c @@ -0,0 +1,78 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include + +#include "common-hal/_protomatter/Protomatter.h" + +#include "samd/timers.h" +#include "timer_handler.h" + +void *common_hal_protomatter_timer_allocate() { + uint8_t timer_index = find_free_timer(); + if (timer_index == 0xff) { + return NULL; + } + timer_never_reset(timer_index, true); + return tc_insts[timer_index]; +} + +static uint8_t tc_index_from_ptr(void* ptr) { + for (uint8_t i = TC_INST_NUM; i > 0; i--) { + if (tc_insts[i] == ptr) { + return i; + } + } + return 0xff; +} + +void common_hal_protomatter_timer_enable(void* ptr) { + uint8_t timer_index = tc_index_from_ptr(ptr); + if (timer_index == 0xff) { + return; + } + set_timer_handler(true, timer_index, TC_HANDLER_PROTOMATTER); + turn_on_clocks(true, timer_index, 1); +} + +void common_hal_protomatter_timer_disable(void* ptr) { + uint8_t timer_index = tc_index_from_ptr(ptr); + if (timer_index == 0xff) { + return; + } + set_timer_handler(true, timer_index, TC_HANDLER_NO_INTERRUPT); + tc_set_enable(ptr, false); +} + +void common_hal_protomatter_timer_free(void* ptr) { + uint8_t timer_index = tc_index_from_ptr(ptr); + if (timer_index == 0xff) { + return; + } + tc_set_enable(ptr, false); + tc_reset(ptr); + timer_reset_ok(timer_index, true); +} diff --git a/ports/atmel-samd/common-hal/_protomatter/Protomatter.h b/ports/atmel-samd/common-hal/_protomatter/Protomatter.h new file mode 100644 index 0000000000..8185bed0e5 --- /dev/null +++ b/ports/atmel-samd/common-hal/_protomatter/Protomatter.h @@ -0,0 +1,35 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PROTOMATTER_PROTOMATTER_H +#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PROTOMATTER_PROTOMATTER_H + +void *common_hal_protomatter_timer_allocate(void); +void common_hal_protomatter_timer_enable(void*); +void common_hal_protomatter_timer_disable(void*); +void common_hal_protomatter_timer_free(void*); + +#endif diff --git a/ports/atmel-samd/common-hal/_protomatter/__init__.c b/ports/atmel-samd/common-hal/_protomatter/__init__.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ports/atmel-samd/common-hal/microcontroller/Pin.c b/ports/atmel-samd/common-hal/microcontroller/Pin.c index 9719ea5b11..cf78673b20 100644 --- a/ports/atmel-samd/common-hal/microcontroller/Pin.c +++ b/ports/atmel-samd/common-hal/microcontroller/Pin.c @@ -240,3 +240,15 @@ bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t* pin) { return pin_number_is_free(pin->number); } + +uint8_t common_hal_mcu_pin_number(const mcu_pin_obj_t* pin) { + return pin->number; +} + +void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin) { + return claim_pin(pin); +} + +void common_hal_mcu_pin_reset_number(uint8_t pin_no) { + reset_pin_number(pin_no); +} diff --git a/ports/atmel-samd/common-hal/pulseio/PWMOut.c b/ports/atmel-samd/common-hal/pulseio/PWMOut.c index fef581584f..1da0da8444 100644 --- a/ports/atmel-samd/common-hal/pulseio/PWMOut.c +++ b/ports/atmel-samd/common-hal/pulseio/PWMOut.c @@ -61,22 +61,31 @@ uint8_t tcc_channels[5]; // Set by pwmout_reset() to {0xc0, 0xf0, 0xf8, 0xfc, static uint8_t never_reset_tc_or_tcc[TC_INST_NUM + TCC_INST_NUM]; -void common_hal_pulseio_pwmout_never_reset(pulseio_pwmout_obj_t *self) { - if (self->timer->is_tc) { - never_reset_tc_or_tcc[self->timer->index] += 1; +STATIC void timer_refcount(int index, bool is_tc, int increment) { + if (is_tc) { + never_reset_tc_or_tcc[index] += increment; } else { - never_reset_tc_or_tcc[TC_INST_NUM + self->timer->index] += 1; + never_reset_tc_or_tcc[TC_INST_NUM + index] += increment; } +} + +void timer_never_reset(int index, bool is_tc) { + timer_refcount(index, is_tc, 1); +} + +void timer_reset_ok(int index, bool is_tc) { + timer_refcount(index, is_tc, -1); +} + + +void common_hal_pulseio_pwmout_never_reset(pulseio_pwmout_obj_t *self) { + timer_never_reset(self->timer->index, self->timer->is_tc); never_reset_pin_number(self->pin->number); } void common_hal_pulseio_pwmout_reset_ok(pulseio_pwmout_obj_t *self) { - if (self->timer->is_tc) { - never_reset_tc_or_tcc[self->timer->index] -= 1; - } else { - never_reset_tc_or_tcc[TC_INST_NUM + self->timer->index] -= 1; - } + timer_reset_ok(self->timer->index, self->timer->is_tc); } void pwmout_reset(void) { diff --git a/ports/atmel-samd/mpconfigport.mk b/ports/atmel-samd/mpconfigport.mk index c2408feae3..61f7c206ab 100644 --- a/ports/atmel-samd/mpconfigport.mk +++ b/ports/atmel-samd/mpconfigport.mk @@ -70,6 +70,18 @@ CIRCUITPY_ULAB = 1 endif endif +ifndef CIRCUITPY_PROTOMATTER +ifneq ($(CIRCUITPY_SMALL_BUILD),1) +CIRCUITPY_PROTOMATTER = 1 +endif +endif + +ifndef CIRCUITPY_FRAMEBUFFERIO +ifneq ($(CIRCUITPY_SMALL_BUILD),1) +CIRCUITPY_FRAMEBUFFERIO = 1 +endif +endif + endif # samd51 INTERNAL_LIBM = 1 diff --git a/ports/atmel-samd/peripherals b/ports/atmel-samd/peripherals index b89811f22a..f528240c2a 160000 --- a/ports/atmel-samd/peripherals +++ b/ports/atmel-samd/peripherals @@ -1 +1 @@ -Subproject commit b89811f22a24ac350079ceaf0cdf0e62aa03f4f4 +Subproject commit f528240c2a4c2d7a39de786f1aa56895c12227b4 diff --git a/ports/atmel-samd/timer_handler.c b/ports/atmel-samd/timer_handler.c index 5d6de3093f..598fad564a 100644 --- a/ports/atmel-samd/timer_handler.c +++ b/ports/atmel-samd/timer_handler.c @@ -33,6 +33,8 @@ #include "shared-module/_pew/PewPew.h" #include "common-hal/frequencyio/FrequencyIn.h" +extern void _PM_IRQ_HANDLER(void); + static uint8_t tc_handler[TC_INST_NUM]; void set_timer_handler(bool is_tc, uint8_t index, uint8_t timer_handler) { @@ -62,6 +64,11 @@ void shared_timer_handler(bool is_tc, uint8_t index) { frequencyin_interrupt_handler(index); #endif break; + case TC_HANDLER_PROTOMATTER: + #if CIRCUITPY_PROTOMATTER + _PM_IRQ_HANDLER(); + #endif + break; default: break; } diff --git a/ports/atmel-samd/timer_handler.h b/ports/atmel-samd/timer_handler.h index 4a7adb58c3..646cd54ec8 100644 --- a/ports/atmel-samd/timer_handler.h +++ b/ports/atmel-samd/timer_handler.h @@ -30,8 +30,13 @@ #define TC_HANDLER_PULSEOUT 0x1 #define TC_HANDLER_PEW 0x2 #define TC_HANDLER_FREQUENCYIN 0x3 +#define TC_HANDLER_PROTOMATTER 0x4 void set_timer_handler(bool is_tc, uint8_t index, uint8_t timer_handler); void shared_timer_handler(bool is_tc, uint8_t index); +// implementation of these functions is in PWMOut.c +void timer_never_reset(int index, bool is_tc); +void timer_reset_ok(int index, bool is_tc); + #endif // MICROPY_INCLUDED_ATMEL_SAMD_TIMER_HANDLER_H diff --git a/ports/nrf/boards/clue_nrf52840_express/board.c b/ports/nrf/boards/clue_nrf52840_express/board.c index e9f8d244e4..2370a0aa1b 100644 --- a/ports/nrf/boards/clue_nrf52840_express/board.c +++ b/ports/nrf/boards/clue_nrf52840_express/board.c @@ -77,6 +77,7 @@ void board_init(void) { false, // Pixels in a byte share a row. Only used for depth < 8 1, // bytes per cell. Only valid for depths < 8 false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command diff --git a/ports/nrf/boards/ohs2020_badge/board.c b/ports/nrf/boards/ohs2020_badge/board.c index 88c68bcb84..bbb20cc6e5 100644 --- a/ports/nrf/boards/ohs2020_badge/board.c +++ b/ports/nrf/boards/ohs2020_badge/board.c @@ -77,6 +77,7 @@ void board_init(void) { false, // Pixels in a byte share a row. Only used for depth < 8 1, // bytes per cell. Only valid for depths < 8 false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command diff --git a/ports/nrf/common-hal/_protomatter/Protomatter.c b/ports/nrf/common-hal/_protomatter/Protomatter.c new file mode 100644 index 0000000000..b6e55bbd4c --- /dev/null +++ b/ports/nrf/common-hal/_protomatter/Protomatter.c @@ -0,0 +1,66 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include + +#include "common-hal/_protomatter/Protomatter.h" + +#include "peripherals/nrf/timers.h" + +extern void _PM_IRQ_HANDLER(void); + +void *common_hal_protomatter_timer_allocate() { + nrfx_timer_t *timer = nrf_peripherals_allocate_timer_or_throw(); + nrf_peripherals_timer_never_reset(timer); + return timer->p_reg; +} + + +static void protomatter_event_handler(nrf_timer_event_t event_type, void *p_context) { + _PM_IRQ_HANDLER(); +} + +void common_hal_protomatter_timer_enable(void* ptr) { + nrfx_timer_t *timer = nrf_peripherals_timer_from_reg(ptr); + static const nrfx_timer_config_t timer_config = { + .frequency = NRF_TIMER_FREQ_16MHz, + .mode = NRF_TIMER_MODE_TIMER, + .bit_width = NRF_TIMER_BIT_WIDTH_16, + .interrupt_priority = NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY, + .p_context = NULL, + }; + nrfx_timer_init(timer, &timer_config, &protomatter_event_handler); +} + +void common_hal_protomatter_timer_disable(void* ptr) { + nrfx_timer_t *timer = nrf_peripherals_timer_from_reg(ptr); + nrfx_timer_uninit(timer); +} + +void common_hal_protomatter_timer_free(void* ptr) { + nrfx_timer_t *timer = nrf_peripherals_timer_from_reg(ptr); + nrf_peripherals_free_timer(timer); +} diff --git a/ports/nrf/common-hal/_protomatter/Protomatter.h b/ports/nrf/common-hal/_protomatter/Protomatter.h new file mode 100644 index 0000000000..8185bed0e5 --- /dev/null +++ b/ports/nrf/common-hal/_protomatter/Protomatter.h @@ -0,0 +1,35 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PROTOMATTER_PROTOMATTER_H +#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PROTOMATTER_PROTOMATTER_H + +void *common_hal_protomatter_timer_allocate(void); +void common_hal_protomatter_timer_enable(void*); +void common_hal_protomatter_timer_disable(void*); +void common_hal_protomatter_timer_free(void*); + +#endif diff --git a/ports/nrf/common-hal/_protomatter/__init__.c b/ports/nrf/common-hal/_protomatter/__init__.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ports/nrf/common-hal/microcontroller/Pin.c b/ports/nrf/common-hal/microcontroller/Pin.c index b7931a2e16..3132c76318 100644 --- a/ports/nrf/common-hal/microcontroller/Pin.c +++ b/ports/nrf/common-hal/microcontroller/Pin.c @@ -196,3 +196,15 @@ bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) { return pin_number_is_free(pin->number); } + +uint8_t common_hal_mcu_pin_number(const mcu_pin_obj_t* pin) { + return pin->number; +} + +void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin) { + claim_pin(pin); +} + +void common_hal_mcu_pin_reset_number(uint8_t pin_no) { + reset_pin_number(pin_no); +} diff --git a/ports/nrf/common-hal/pulseio/PulseOut.c b/ports/nrf/common-hal/pulseio/PulseOut.c index d0433247ac..270cb45d6d 100644 --- a/ports/nrf/common-hal/pulseio/PulseOut.c +++ b/ports/nrf/common-hal/pulseio/PulseOut.c @@ -102,10 +102,7 @@ void pulseout_reset() { void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self, const pulseio_pwmout_obj_t* carrier) { if (refcount == 0) { - timer = nrf_peripherals_allocate_timer(); - if (timer == NULL) { - mp_raise_RuntimeError(translate("All timers in use")); - } + timer = nrf_peripherals_allocate_timer_or_throw(); } refcount++; diff --git a/ports/nrf/mpconfigport.mk b/ports/nrf/mpconfigport.mk index fcc59c484a..5ca1f0f35b 100644 --- a/ports/nrf/mpconfigport.mk +++ b/ports/nrf/mpconfigport.mk @@ -51,6 +51,9 @@ endif # frequencyio not yet implemented CIRCUITPY_FREQUENCYIO = 0 +CIRCUITPY_PROTOMATTER = 1 +CIRCUITPY_FRAMEBUFFERIO = 1 + # nRF52840-specific ifeq ($(MCU_CHIP),nrf52840) diff --git a/ports/nrf/peripherals/nrf/timers.c b/ports/nrf/peripherals/nrf/timers.c index 88f3dd4681..fd814968dc 100644 --- a/ports/nrf/peripherals/nrf/timers.c +++ b/ports/nrf/peripherals/nrf/timers.c @@ -25,6 +25,7 @@ */ #include "common-hal/pulseio/PulseOut.h" +#include "peripherals/nrf/timers.h" #include @@ -54,14 +55,47 @@ STATIC nrfx_timer_t nrfx_timers[] = { }; static bool nrfx_timer_allocated[ARRAY_SIZE(nrfx_timers)]; +static bool nrfx_timer_never_reset[ARRAY_SIZE(nrfx_timers)]; void timers_reset(void) { for (size_t i = 0; i < ARRAY_SIZE(nrfx_timers); i ++) { + if (nrfx_timer_never_reset[i]) { + continue; + } nrfx_timer_uninit(&nrfx_timers[i]); nrfx_timer_allocated[i] = false; } } +void nrf_peripherals_timer_never_reset(nrfx_timer_t* timer) { + int idx = nrf_peripherals_timer_idx_from_timer(timer); + nrfx_timer_never_reset[idx] = true; +} + +void nrf_peripherals_timer_reset_ok(nrfx_timer_t* timer) { + int idx = nrf_peripherals_timer_idx_from_timer(timer); + nrfx_timer_never_reset[idx] = false; +} + +nrfx_timer_t* nrf_peripherals_timer_from_reg(NRF_TIMER_Type* ptr) { + for (size_t i = 0; i < ARRAY_SIZE(nrfx_timers); i ++) { + if (nrfx_timers[i].p_reg == ptr) { + return &nrfx_timers[i]; + } + } + return NULL; +} + +size_t nrf_peripherals_timer_idx_from_timer(nrfx_timer_t* ptr) { + for (size_t i = 0; i < ARRAY_SIZE(nrfx_timers); i ++) { + if (&nrfx_timers[i] == ptr) { + return i; + } + } + return ~(size_t)0; +} + + // Returns a free nrfx_timer instance, and marks it as allocated. // The caller should init as with the desired config. // Returns NULL if no timer is available. @@ -75,14 +109,21 @@ nrfx_timer_t* nrf_peripherals_allocate_timer(void) { return NULL; } +nrfx_timer_t* nrf_peripherals_allocate_timer_or_throw(void) { + nrfx_timer_t* result = nrf_peripherals_allocate_timer(); + if (!result) { + mp_raise_RuntimeError(translate("All timers in use")); + } + return result; +} + // Free a timer, which may or may not have been initialized. void nrf_peripherals_free_timer(nrfx_timer_t* timer) { - for (size_t i = 0; i < ARRAY_SIZE(nrfx_timers); i ++) { - if (timer == &nrfx_timers[i]) { - nrfx_timer_allocated[i] = false; - // Safe to call even if not initialized. - nrfx_timer_uninit(timer); - return; - } + size_t idx = nrf_peripherals_timer_idx_from_timer(timer); + if (idx != ~(size_t)0) { + nrfx_timer_allocated[idx] = false; + nrfx_timer_never_reset[idx] = false; + // Safe to call even if not initialized. + nrfx_timer_uninit(timer); } } diff --git a/ports/nrf/peripherals/nrf/timers.h b/ports/nrf/peripherals/nrf/timers.h index 7d3815579a..cf96c6273b 100644 --- a/ports/nrf/peripherals/nrf/timers.h +++ b/ports/nrf/peripherals/nrf/timers.h @@ -29,4 +29,9 @@ void timers_reset(void); nrfx_timer_t* nrf_peripherals_allocate_timer(void); +nrfx_timer_t* nrf_peripherals_allocate_timer_or_throw(void); void nrf_peripherals_free_timer(nrfx_timer_t* timer); +void nrf_peripherals_timer_never_reset(nrfx_timer_t* timer); +void nrf_peripherals_timer_reset_ok(nrfx_timer_t* timer); +nrfx_timer_t* nrf_peripherals_timer_from_reg(NRF_TIMER_Type* ptr); +size_t nrf_peripherals_timer_idx_from_timer(nrfx_timer_t* ptr); diff --git a/ports/stm/boards/meowbit_v121/board.c b/ports/stm/boards/meowbit_v121/board.c index 9e2d99bce0..68eed29269 100644 --- a/ports/stm/boards/meowbit_v121/board.c +++ b/ports/stm/boards/meowbit_v121/board.c @@ -98,6 +98,7 @@ void board_init(void) { false, // Pixels in a byte share a row. Only used for depth < 8 1, // bytes per cell. Only valid for depths < 8 false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index f84d0b5b1d..b6b0cacaf8 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -142,6 +142,9 @@ endif ifeq ($(CIRCUITPY_DISPLAYIO),1) SRC_PATTERNS += displayio/% terminalio/% fontio/% endif +ifeq ($(CIRCUITPY_FRAMEBUFFERIO),1) +SRC_PATTERNS += framebufferio/% +endif ifeq ($(CIRCUITPY_FREQUENCYIO),1) SRC_PATTERNS += frequencyio/% endif @@ -178,6 +181,9 @@ endif ifeq ($(CIRCUITPY_PIXELBUF),1) SRC_PATTERNS += _pixelbuf/% endif +ifeq ($(CIRCUITPY_PROTOMATTER),1) +SRC_PATTERNS += _protomatter/% +endif ifeq ($(CIRCUITPY_PULSEIO),1) SRC_PATTERNS += pulseio/% endif @@ -242,6 +248,8 @@ SRC_COMMON_HAL_ALL = \ _bleio/PacketBuffer.c \ _bleio/Service.c \ _bleio/UUID.c \ + _protomatter/Protomatter.c \ + _protomatter/__init__.c \ analogio/AnalogIn.c \ analogio/AnalogOut.c \ analogio/__init__.c \ @@ -315,6 +323,8 @@ SRC_SHARED_MODULE_ALL = \ _bleio/ScanResults.c \ _pixelbuf/PixelBuf.c \ _pixelbuf/__init__.c \ + _protomatter/Protomatter.c \ + _protomatter/__init__.c \ _stage/Layer.c \ _stage/Text.c \ _stage/__init__.c \ @@ -348,6 +358,8 @@ SRC_SHARED_MODULE_ALL = \ displayio/__init__.c \ fontio/BuiltinFont.c \ fontio/__init__.c \ + framebufferio/FramebufferDisplay.c \ + framebufferio/__init__.c \ gamepad/GamePad.c \ gamepad/__init__.c \ gamepadshift/GamePadShift.c \ @@ -401,6 +413,12 @@ SRC_MOD += $(addprefix lib/mp3/src/, \ ) $(BUILD)/lib/mp3/src/buffers.o: CFLAGS += -include "py/misc.h" -D'MPDEC_ALLOCATOR(x)=m_malloc(x,0)' -D'MPDEC_FREE(x)=m_free(x)' endif +ifeq ($(CIRCUITPY_PROTOMATTER),1) +SRC_MOD += $(addprefix lib/protomatter/, \ + core.c \ +) +$(BUILD)/lib/protomatter/core.o: CFLAGS += -include "shared-module/_protomatter/allocator.h" -DCIRCUITPY -Wno-missing-braces +endif # All possible sources are listed here, and are filtered by SRC_PATTERNS. SRC_SHARED_MODULE_INTERNAL = \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 04e1912643..06289258d1 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -345,6 +345,13 @@ extern const struct _mp_obj_module_t terminalio_module; #define CIRCUITPY_DISPLAY_LIMIT (0) #endif +#if CIRCUITPY_FRAMEBUFFERIO +extern const struct _mp_obj_module_t framebufferio_module; +#define FRAMEBUFFERIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_framebufferio), (mp_obj_t)&framebufferio_module }, +#else +#define FRAMEBUFFERIO_MODULE +#endif + #if CIRCUITPY_FREQUENCYIO extern const struct _mp_obj_module_t frequencyio_module; #define FREQUENCYIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_frequencyio), (mp_obj_t)&frequencyio_module }, @@ -454,6 +461,13 @@ extern const struct _mp_obj_module_t pixelbuf_module; #define PIXELBUF_MODULE #endif +#if CIRCUITPY_PROTOMATTER +extern const struct _mp_obj_module_t protomatter_module; +#define PROTOMATTER_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR__protomatter),(mp_obj_t)&protomatter_module }, +#else +#define PROTOMATTER_MODULE +#endif + #if CIRCUITPY_PULSEIO extern const struct _mp_obj_module_t pulseio_module; #define PULSEIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_pulseio), (mp_obj_t)&pulseio_module }, @@ -628,6 +642,7 @@ extern const struct _mp_obj_module_t ustack_module; FONTIO_MODULE \ TERMINALIO_MODULE \ ERRNO_MODULE \ + FRAMEBUFFERIO_MODULE \ FREQUENCYIO_MODULE \ GAMEPAD_MODULE \ GAMEPADSHIFT_MODULE \ @@ -643,6 +658,7 @@ extern const struct _mp_obj_module_t ustack_module; PEW_MODULE \ PIXELBUF_MODULE \ PS2IO_MODULE \ + PROTOMATTER_MODULE \ PULSEIO_MODULE \ RANDOM_MODULE \ RE_MODULE \ diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 1a375efc65..ba94f9784f 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -149,6 +149,11 @@ CIRCUITPY_DISPLAYIO = $(CIRCUITPY_FULL_BUILD) endif CFLAGS += -DCIRCUITPY_DISPLAYIO=$(CIRCUITPY_DISPLAYIO) +ifndef CIRCUITPY_FRAMEBUFFERIO +CIRCUITPY_FRAMEBUFFERIO = 0 +endif +CFLAGS += -DCIRCUITPY_FRAMEBUFFERIO=$(CIRCUITPY_FRAMEBUFFERIO) + ifndef CIRCUITPY_FREQUENCYIO CIRCUITPY_FREQUENCYIO = $(CIRCUITPY_FULL_BUILD) endif @@ -210,6 +215,12 @@ CIRCUITPY_PIXELBUF = $(CIRCUITPY_FULL_BUILD) endif CFLAGS += -DCIRCUITPY_PIXELBUF=$(CIRCUITPY_PIXELBUF) +# Only for SAMD boards for the moment +ifndef CIRCUITPY_PROTOMATTER +CIRCUITPY_PROTOMATTER = 0 +endif +CFLAGS += -DCIRCUITPY_PROTOMATTER=$(CIRCUITPY_PROTOMATTER) + ifndef CIRCUITPY_PULSEIO CIRCUITPY_PULSEIO = $(CIRCUITPY_DEFAULT_BUILD) endif diff --git a/py/mkrules.mk b/py/mkrules.mk index 292d257465..13a73b90e6 100644 --- a/py/mkrules.mk +++ b/py/mkrules.mk @@ -145,7 +145,7 @@ $(PROG): $(OBJ) # Do not pass COPT here - it's *C* compiler optimizations. For example, # we may want to compile using Thumb, but link with non-Thumb libc. $(Q)$(CC) -o $@ $^ $(LIB) $(LDFLAGS) -ifndef DEBUG +ifdef STRIP_CIRCUITPYTHON $(Q)$(STRIP) $(STRIPFLAGS_EXTRA) $(PROG) endif $(Q)$(SIZE) $$(find $(BUILD) -path "$(BUILD)/build/frozen*.o") $(PROG) diff --git a/shared-bindings/_protomatter/Protomatter.c b/shared-bindings/_protomatter/Protomatter.c new file mode 100644 index 0000000000..bb43390796 --- /dev/null +++ b/shared-bindings/_protomatter/Protomatter.c @@ -0,0 +1,376 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "py/obj.h" +#include "py/objproperty.h" +#include "py/runtime.h" +#include "py/objarray.h" + +#include "common-hal/_protomatter/Protomatter.h" +#include "shared-bindings/_protomatter/Protomatter.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/util.h" +#include "shared-module/displayio/__init__.h" +#include "shared-module/framebufferio/__init__.h" +#include "shared-module/framebufferio/FramebufferDisplay.h" + +//| .. currentmodule:: _protomatter +//| +//| :class:`protomatter` -- Driver for HUB75-style RGB LED matrices +//| ================================================================ +//| + +extern Protomatter_core *_PM_protoPtr; + +STATIC uint8_t validate_pin(mp_obj_t obj) { + mcu_pin_obj_t *result = validate_obj_is_free_pin(obj); + return common_hal_mcu_pin_number(result); +} + +STATIC void validate_pins(qstr what, uint8_t* pin_nos, mp_int_t max_pins, mp_obj_t seq, uint8_t *count_out) { + mp_int_t len = MP_OBJ_SMALL_INT_VALUE(mp_obj_len(seq)); + if (len > max_pins) { + mp_raise_ValueError_varg(translate("At most %d %q may be specified (not %d)"), max_pins, what, len); + } + *count_out = len; + for (mp_int_t i=0; iprotomatter; + self->base.type = &protomatter_Protomatter_type; + + uint8_t rgb_count, addr_count; + uint8_t rgb_pins[MP_ARRAY_SIZE(self->rgb_pins)]; + uint8_t addr_pins[MP_ARRAY_SIZE(self->addr_pins)]; + uint8_t clock_pin = validate_pin(args[ARG_clock_pin].u_obj); + uint8_t latch_pin = validate_pin(args[ARG_latch_pin].u_obj); + uint8_t output_enable_pin = validate_pin(args[ARG_output_enable_pin].u_obj); + + validate_pins(MP_QSTR_rgb_pins, rgb_pins, MP_ARRAY_SIZE(self->rgb_pins), args[ARG_rgb_list].u_obj, &rgb_count); + validate_pins(MP_QSTR_addr_pins, addr_pins, MP_ARRAY_SIZE(self->addr_pins), args[ARG_addr_list].u_obj, &addr_count); + + if (rgb_count % 6) { + mp_raise_ValueError_varg(translate("Must use a multiple of 6 rgb pins, not %d"), rgb_count); + } + + // TODO(@jepler) Use fewer than all rows of pixels if height < computed_height + if (args[ARG_height].u_int != 0) { + int computed_height = (rgb_count / 3) << (addr_count); + if (computed_height != args[ARG_height].u_int) { + mp_raise_ValueError_varg( + translate("%d address pins and %d rgb pins indicate a height of %d, not %d"), addr_count, rgb_count, computed_height, args[ARG_height].u_int); + } + } + + preflight_pins_or_throw(clock_pin, rgb_pins, rgb_count, true); + + mp_obj_t framebuffer = args[ARG_framebuffer].u_obj; + if (framebuffer == mp_const_none) { + int width = args[ARG_width].u_int; + int bufsize = 2 * width * rgb_count / 3 * (1 << addr_count); + framebuffer = mp_obj_new_bytearray_of_zeros(bufsize); + } + + common_hal_protomatter_protomatter_construct(self, + args[ARG_width].u_int, + args[ARG_bit_depth].u_int, + rgb_count, rgb_pins, + addr_count, addr_pins, + clock_pin, latch_pin, output_enable_pin, + args[ARG_doublebuffer].u_bool, + framebuffer, NULL); + + claim_and_never_reset_pins(args[ARG_rgb_list].u_obj); + claim_and_never_reset_pins(args[ARG_addr_list].u_obj); + claim_and_never_reset_pin(args[ARG_clock_pin].u_obj); + claim_and_never_reset_pin(args[ARG_output_enable_pin].u_obj); + claim_and_never_reset_pin(args[ARG_latch_pin].u_obj); + + return MP_OBJ_FROM_PTR(self); +} + +//| .. method:: deinit +//| +//| Free the resources (pins, timers, etc.) associated with this +//| protomatter instance. After deinitialization, no further operations +//| may be performed. +//| +STATIC mp_obj_t protomatter_protomatter_deinit(mp_obj_t self_in) { + protomatter_protomatter_obj_t *self = (protomatter_protomatter_obj_t*)self_in; + common_hal_protomatter_protomatter_deinit(self); + return mp_const_none; +} + +STATIC MP_DEFINE_CONST_FUN_OBJ_1(protomatter_protomatter_deinit_obj, protomatter_protomatter_deinit); + +static void check_for_deinit(protomatter_protomatter_obj_t *self) { + if (!self->core.rgbPins) { + raise_deinited_error(); + } +} + +//| .. attribute:: brightness +//| +//| In the current implementation, 0.0 turns the display off entirely +//| and any other value up to 1.0 turns the display on fully. +//| +STATIC mp_obj_t protomatter_protomatter_get_brightness(mp_obj_t self_in) { + protomatter_protomatter_obj_t *self = (protomatter_protomatter_obj_t*)self_in; + check_for_deinit(self); + return mp_obj_new_float(common_hal_protomatter_protomatter_get_paused(self)? 0.0f : 1.0f); +} +MP_DEFINE_CONST_FUN_OBJ_1(protomatter_protomatter_get_brightness_obj, protomatter_protomatter_get_brightness); + +STATIC mp_obj_t protomatter_protomatter_set_brightness(mp_obj_t self_in, mp_obj_t value_in) { + protomatter_protomatter_obj_t *self = (protomatter_protomatter_obj_t*)self_in; + check_for_deinit(self); + mp_float_t brightness = mp_obj_get_float(value_in); + if (brightness < 0.0f || brightness > 1.0f) { + mp_raise_ValueError(translate("Brightness must be 0-1.0")); + } + common_hal_protomatter_protomatter_set_paused(self_in, brightness <= 0); + + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(protomatter_protomatter_set_brightness_obj, protomatter_protomatter_set_brightness); + +const mp_obj_property_t protomatter_protomatter_brightness_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&protomatter_protomatter_get_brightness_obj, + (mp_obj_t)&protomatter_protomatter_set_brightness_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +//| .. method:: refresh() +//| +//| Transmits the color data in the buffer to the pixels so that +//| they are shown. +//| +STATIC mp_obj_t protomatter_protomatter_refresh(mp_obj_t self_in) { + protomatter_protomatter_obj_t *self = (protomatter_protomatter_obj_t*)self_in; + check_for_deinit(self); + common_hal_protomatter_protomatter_refresh(self); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(protomatter_protomatter_refresh_obj, protomatter_protomatter_refresh); + +STATIC const mp_rom_map_elem_t protomatter_protomatter_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&protomatter_protomatter_deinit_obj) }, + { MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&protomatter_protomatter_brightness_obj) }, + { MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&protomatter_protomatter_refresh_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(protomatter_protomatter_locals_dict, protomatter_protomatter_locals_dict_table); + +STATIC void protomatter_protomatter_get_bufinfo(mp_obj_t self_in, mp_buffer_info_t *bufinfo) { + protomatter_protomatter_obj_t *self = (protomatter_protomatter_obj_t*)self_in; + check_for_deinit(self); + + *bufinfo = self->bufinfo; +} + +// These version exists so that the prototype matches the protocol, +// avoiding a type cast that can hide errors +STATIC void protomatter_protomatter_swapbuffers(mp_obj_t self_in) { + common_hal_protomatter_protomatter_refresh(self_in); +} + +STATIC void protomatter_protomatter_deinit_proto(mp_obj_t self_in) { + common_hal_protomatter_protomatter_deinit(self_in); +} + +STATIC float protomatter_protomatter_get_brightness_proto(mp_obj_t self_in) { + return common_hal_protomatter_protomatter_get_paused(self_in) ? 0.0f : 1.0f; +} + +STATIC bool protomatter_protomatter_set_brightness_proto(mp_obj_t self_in, mp_float_t value) { + common_hal_protomatter_protomatter_set_paused(self_in, value <= 0); + return true; +} + +STATIC const framebuffer_p_t protomatter_protomatter_proto = { + MP_PROTO_IMPLEMENT(MP_QSTR_protocol_framebuffer) + .get_bufinfo = protomatter_protomatter_get_bufinfo, + .set_brightness = protomatter_protomatter_set_brightness_proto, + .get_brightness = protomatter_protomatter_get_brightness_proto, + .swapbuffers = protomatter_protomatter_swapbuffers, + .deinit = protomatter_protomatter_deinit_proto, +}; + +STATIC mp_int_t protomatter_protomatter_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) { + protomatter_protomatter_obj_t *self = (protomatter_protomatter_obj_t*)self_in; + // a readonly framebuffer would be unusual but not impossible + if ((flags & MP_BUFFER_WRITE) && !(self->bufinfo.typecode & MP_OBJ_ARRAY_TYPECODE_FLAG_RW)) { + return 1; + } + *bufinfo = self->bufinfo; + return 0; +} + +const mp_obj_type_t protomatter_Protomatter_type = { + { &mp_type_type }, + .name = MP_QSTR_Protomatter, + .buffer_p = { .get_buffer = protomatter_protomatter_get_buffer, }, + .make_new = protomatter_protomatter_make_new, + .protocol = &protomatter_protomatter_proto, + .locals_dict = (mp_obj_dict_t*)&protomatter_protomatter_locals_dict, +}; diff --git a/shared-bindings/_protomatter/Protomatter.h b/shared-bindings/_protomatter/Protomatter.h new file mode 100644 index 0000000000..9499da22c0 --- /dev/null +++ b/shared-bindings/_protomatter/Protomatter.h @@ -0,0 +1,59 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_PROTOMATTER_PROTOMATTER_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_PROTOMATTER_PROTOMATTER_H + +#include "shared-module/_protomatter/Protomatter.h" +#include "lib/protomatter/core.h" + +extern const mp_obj_type_t protomatter_Protomatter_type; +typedef struct { + mp_obj_base_t base; + mp_obj_t framebuffer; + mp_buffer_info_t bufinfo; + Protomatter_core core; + void *timer; + uint16_t bufsize, width; + uint8_t rgb_pins[30]; + uint8_t addr_pins[10]; + uint8_t clock_pin, latch_pin, oe_pin; + uint8_t rgb_count, addr_count; + uint8_t bit_depth; + bool core_is_initialized; + bool paused; + bool doublebuffer; +} protomatter_protomatter_obj_t; + +void common_hal_protomatter_protomatter_construct(protomatter_protomatter_obj_t* self, int width, int bit_depth, uint8_t rgb_count, uint8_t* rgb_pins, uint8_t addr_count, uint8_t* addr_pins, uint8_t clock_pin, uint8_t latch_pin, uint8_t oe_pin, bool doublebuffer, mp_obj_t framebuffer, void* timer); +void common_hal_protomatter_protomatter_deinit(protomatter_protomatter_obj_t*); +void protomatter_protomatter_collect_ptrs(protomatter_protomatter_obj_t*); +void common_hal_protomatter_protomatter_reconstruct(protomatter_protomatter_obj_t* self, mp_obj_t framebuffer); +void common_hal_protomatter_protomatter_set_paused(protomatter_protomatter_obj_t* self, bool paused); +bool common_hal_protomatter_protomatter_get_paused(protomatter_protomatter_obj_t* self); +void common_hal_protomatter_protomatter_refresh(protomatter_protomatter_obj_t* self); + +#endif diff --git a/shared-bindings/_protomatter/__init__.c b/shared-bindings/_protomatter/__init__.c new file mode 100644 index 0000000000..2281b15f10 --- /dev/null +++ b/shared-bindings/_protomatter/__init__.c @@ -0,0 +1,55 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include + +#include "py/obj.h" +#include "py/runtime.h" + +#include "shared-bindings/_protomatter/Protomatter.h" + +//| :mod:`_protomatter` --- Low-level routines for bitbanged LED matrices +//| ===================================================================== +//| +//| .. module:: _protomatter +//| :synopsis: Low-level routines for bitbanged LED matrices +//| +//| .. toctree:: +//| :maxdepth: 3 +//| +//| Protomatter + +STATIC const mp_rom_map_elem_t protomatter_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__protomatter) }, + { MP_ROM_QSTR(MP_QSTR_Protomatter), MP_ROM_PTR(&protomatter_Protomatter_type) }, +}; + +STATIC MP_DEFINE_CONST_DICT(protomatter_module_globals, protomatter_module_globals_table); + +const mp_obj_module_t protomatter_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&protomatter_module_globals, +}; diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index 3ef7e74e9e..a22b2add22 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -92,6 +92,7 @@ //| :param bool pixels_in_byte_share_row: True when pixels are less than a byte and a byte includes pixels from the same row of the display. When False, pixels share a column. //| :param int bytes_per_cell: Number of bytes per addressable memory location when color_depth < 8. When greater than one, bytes share a row or column according to pixels_in_byte_share_row. //| :param bool reverse_pixels_in_byte: Reverses the pixel order within each byte when color_depth < 8. Does not apply across multiple bytes even if there is more than one byte per cell (bytes_per_cell.) +//| :param bool reverse_bytes_in_word: Reverses the order of bytes within a word when color_depth == 16 //| :param int set_column_command: Command used to set the start and end columns to update //| :param int set_row_command: Command used so set the start and end rows to update //| :param int write_ram_command: Command used to write pixels values into the update region. Ignored if data_as_commands is set. @@ -107,7 +108,7 @@ //| :param bool backlight_on_high: If True, pulling the backlight pin high turns the backlight on. //| STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_display_bus, ARG_init_sequence, ARG_width, ARG_height, ARG_colstart, ARG_rowstart, ARG_rotation, ARG_color_depth, ARG_grayscale, ARG_pixels_in_byte_share_row, ARG_bytes_per_cell, ARG_reverse_pixels_in_byte, ARG_set_column_command, ARG_set_row_command, ARG_write_ram_command, ARG_set_vertical_scroll, ARG_backlight_pin, ARG_brightness_command, ARG_brightness, ARG_auto_brightness, ARG_single_byte_bounds, ARG_data_as_commands, ARG_auto_refresh, ARG_native_frames_per_second, ARG_backlight_on_high }; + enum { ARG_display_bus, ARG_init_sequence, ARG_width, ARG_height, ARG_colstart, ARG_rowstart, ARG_rotation, ARG_color_depth, ARG_grayscale, ARG_pixels_in_byte_share_row, ARG_bytes_per_cell, ARG_reverse_pixels_in_byte, ARG_reverse_bytes_in_word, ARG_set_column_command, ARG_set_row_command, ARG_write_ram_command, ARG_set_vertical_scroll, ARG_backlight_pin, ARG_brightness_command, ARG_brightness, ARG_auto_brightness, ARG_single_byte_bounds, ARG_data_as_commands, ARG_auto_refresh, ARG_native_frames_per_second, ARG_backlight_on_high }; static const mp_arg_t allowed_args[] = { { MP_QSTR_display_bus, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_init_sequence, MP_ARG_REQUIRED | MP_ARG_OBJ }, @@ -121,6 +122,7 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a { MP_QSTR_pixels_in_byte_share_row, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} }, { MP_QSTR_bytes_per_cell, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 1} }, { MP_QSTR_reverse_pixels_in_byte, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, + { MP_QSTR_reverse_bytes_in_word, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} }, { MP_QSTR_set_column_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x2a} }, { MP_QSTR_set_row_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x2b} }, { MP_QSTR_write_ram_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x2c} }, @@ -152,23 +154,17 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a mp_raise_ValueError(translate("Display rotation must be in 90 degree increments")); } - displayio_display_obj_t *self = NULL; - for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { - if (displays[i].display.base.type == NULL || - displays[i].display.base.type == &mp_type_NoneType) { - self = &displays[i].display; - break; - } - } - if (self == NULL) { - mp_raise_RuntimeError(translate("Too many displays")); - } + primary_display_t *disp = allocate_display_or_raise(); + displayio_display_obj_t *self = &disp->display;; self->base.type = &displayio_display_type; common_hal_displayio_display_construct( self, display_bus, args[ARG_width].u_int, args[ARG_height].u_int, args[ARG_colstart].u_int, args[ARG_rowstart].u_int, rotation, args[ARG_color_depth].u_int, args[ARG_grayscale].u_bool, - args[ARG_pixels_in_byte_share_row].u_bool, args[ARG_bytes_per_cell].u_bool, args[ARG_reverse_pixels_in_byte].u_bool, + args[ARG_pixels_in_byte_share_row].u_bool, + args[ARG_bytes_per_cell].u_bool, + args[ARG_reverse_pixels_in_byte].u_bool, + args[ARG_reverse_bytes_in_word].u_bool, args[ARG_set_column_command].u_int, args[ARG_set_row_command].u_int, args[ARG_write_ram_command].u_int, args[ARG_set_vertical_scroll].u_int, diff --git a/shared-bindings/displayio/Display.h b/shared-bindings/displayio/Display.h index 8c2e20262b..e69c5b6b52 100644 --- a/shared-bindings/displayio/Display.h +++ b/shared-bindings/displayio/Display.h @@ -41,7 +41,7 @@ extern const mp_obj_type_t displayio_display_type; void common_hal_displayio_display_construct(displayio_display_obj_t* self, mp_obj_t bus, uint16_t width, uint16_t height, int16_t colstart, int16_t rowstart, uint16_t rotation, uint16_t color_depth, bool grayscale, - bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte, + bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte, bool reverse_bytes_in_word, uint8_t set_column_command, uint8_t set_row_command, uint8_t write_ram_command, uint8_t set_vertical_scroll, uint8_t* init_sequence, uint16_t init_sequence_len, const mcu_pin_obj_t* backlight_pin, uint16_t brightness_command, mp_float_t brightness, bool auto_brightness, diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index 25a4a41e92..1459c16809 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -136,17 +136,8 @@ STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size mp_raise_ValueError(translate("Display rotation must be in 90 degree increments")); } - displayio_epaperdisplay_obj_t *self = NULL; - for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { - if (displays[i].display.base.type == NULL || - displays[i].display.base.type == &mp_type_NoneType) { - self = &displays[i].epaper_display; - break; - } - } - if (self == NULL) { - mp_raise_RuntimeError(translate("Too many displays")); - } + primary_display_t *disp = allocate_display_or_raise(); + displayio_epaperdisplay_obj_t *self = &disp->epaper_display;; mp_float_t refresh_time = mp_obj_get_float(args[ARG_refresh_time].u_obj); mp_float_t seconds_per_frame = mp_obj_get_float(args[ARG_seconds_per_frame].u_obj); diff --git a/shared-bindings/displayio/FourWire.c b/shared-bindings/displayio/FourWire.c index 77329578a4..1cd51b2e2d 100644 --- a/shared-bindings/displayio/FourWire.c +++ b/shared-bindings/displayio/FourWire.c @@ -82,19 +82,8 @@ STATIC mp_obj_t displayio_fourwire_make_new(const mp_obj_type_t *type, size_t n_ mcu_pin_obj_t *chip_select = validate_obj_is_free_pin(args[ARG_chip_select].u_obj); mcu_pin_obj_t *reset = validate_obj_is_free_pin_or_none(args[ARG_reset].u_obj); - displayio_fourwire_obj_t* self = NULL; mp_obj_t spi = args[ARG_spi_bus].u_obj; - for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { - if (displays[i].fourwire_bus.base.type == NULL || - displays[i].fourwire_bus.base.type == &mp_type_NoneType) { - self = &displays[i].fourwire_bus; - self->base.type = &displayio_fourwire_type; - break; - } - } - if (self == NULL) { - mp_raise_RuntimeError(translate("Too many display busses")); - } + displayio_fourwire_obj_t* self = &allocate_display_bus_or_raise()->fourwire_bus; uint8_t polarity = args[ARG_polarity].u_int; if (polarity != 0 && polarity != 1) { diff --git a/shared-bindings/displayio/I2CDisplay.c b/shared-bindings/displayio/I2CDisplay.c index 2e312aa14e..dd3333f6de 100644 --- a/shared-bindings/displayio/I2CDisplay.c +++ b/shared-bindings/displayio/I2CDisplay.c @@ -71,19 +71,8 @@ STATIC mp_obj_t displayio_i2cdisplay_make_new(const mp_obj_type_t *type, size_t mcu_pin_obj_t *reset = validate_obj_is_free_pin_or_none(args[ARG_reset].u_obj); - displayio_i2cdisplay_obj_t* self = NULL; mp_obj_t i2c = args[ARG_i2c_bus].u_obj; - for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { - if (displays[i].i2cdisplay_bus.base.type == NULL || - displays[i].i2cdisplay_bus.base.type == &mp_type_NoneType) { - self = &displays[i].i2cdisplay_bus; - self->base.type = &displayio_i2cdisplay_type; - break; - } - } - if (self == NULL) { - mp_raise_RuntimeError(translate("Too many display busses")); - } + displayio_i2cdisplay_obj_t* self = &allocate_display_bus_or_raise()->i2cdisplay_bus; common_hal_displayio_i2cdisplay_construct(self, MP_OBJ_TO_PTR(i2c), args[ARG_device_address].u_int, reset); diff --git a/shared-bindings/displayio/ParallelBus.c b/shared-bindings/displayio/ParallelBus.c index b3a876f903..4d9ffb0a1e 100644 --- a/shared-bindings/displayio/ParallelBus.c +++ b/shared-bindings/displayio/ParallelBus.c @@ -83,18 +83,7 @@ STATIC mp_obj_t displayio_parallelbus_make_new(const mp_obj_type_t *type, size_t mcu_pin_obj_t *read = validate_obj_is_free_pin(args[ARG_read].u_obj); mcu_pin_obj_t *reset = validate_obj_is_free_pin(args[ARG_reset].u_obj); - displayio_parallelbus_obj_t* self = NULL; - for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { - if (displays[i].parallel_bus.base.type== NULL || - displays[i].parallel_bus.base.type == &mp_type_NoneType) { - self = &displays[i].parallel_bus; - self->base.type = &displayio_parallelbus_type; - break; - } - } - if (self == NULL) { - mp_raise_RuntimeError(translate("Too many display busses")); - } + displayio_parallelbus_obj_t* self = &allocate_display_bus_or_raise()->parallel_bus; common_hal_displayio_parallelbus_construct(self, data0, command, chip_select, write, read, reset); return self; diff --git a/shared-bindings/framebufferio/FramebufferDisplay.c b/shared-bindings/framebufferio/FramebufferDisplay.c new file mode 100644 index 0000000000..aa8fc1a630 --- /dev/null +++ b/shared-bindings/framebufferio/FramebufferDisplay.c @@ -0,0 +1,428 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2018 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/framebufferio/FramebufferDisplay.h" + +#include + +#include "lib/utils/context_manager_helpers.h" +#include "py/binary.h" +#include "py/objproperty.h" +#include "py/objtype.h" +#include "py/runtime.h" +#include "shared-bindings/displayio/Group.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/util.h" +#include "shared-module/displayio/__init__.h" +#include "supervisor/shared/translate.h" + +//| .. currentmodule:: framebufferio +//| +//| :class:`FramebufferDisplay` -- Manage updating a display with framebuffer in RAM +//| ================================================================================ +//| +//| This initializes a display and connects it into CircuitPython. Unlike other +//| objects in CircuitPython, Display objects live until `displayio.release_displays()` +//| is called. This is done so that CircuitPython can use the display itself. +//| +//| .. class:: FramebufferDisplay(framebuffer, *, width, height, colstart=0, rowstart=0, rotation=0, color_depth=16, grayscale=False, pixels_in_byte_share_row=True, bytes_per_cell=1, reverse_pixels_in_byte=False, backlight_pin=None, brightness=1.0, auto_brightness=False, auto_refresh=True, native_frames_per_second=60) +//| +//| Create a Display object with the given framebuffer (a buffer, array, ulab.array, etc) +//| +//| :param framebuffer: The framebuffer that the display is connected to +//| :type framebuffer: any core object implementing the framebuffer protocol +//| :param int width: Width in pixels +//| :param int height: Height in pixels +//| :param int rotation: The rotation of the display in degrees clockwise. Must be in 90 degree increments (0, 90, 180, 270) +//| :param int color_depth: The number of bits of color per pixel transmitted. (Some displays +//| support 18 bit but 16 is easier to transmit. The last bit is extrapolated.) +//| :param int bytes_per_cell: Number of bytes per addressable memory location when color_depth < 8. When greater than one, bytes share a row or column according to pixels_in_byte_share_row. +//| :param microcontroller.Pin backlight_pin: Pin connected to the display's backlight +//| :param bool brightness: Initial display brightness. This value is ignored if auto_brightness is True. +//| :param bool auto_brightness: If True, brightness is controlled via an ambient light sensor or other mechanism. +//| :param bool auto_refresh: Automatically refresh the screen +//| :param int native_frames_per_second: Number of display refreshes per second +//| +STATIC mp_obj_t framebufferio_framebufferdisplay_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_framebuffer, ARG_width, ARG_height, ARG_rotation, ARG_color_depth, ARG_bytes_per_cell, ARG_auto_refresh, ARG_native_frames_per_second, NUM_ARGS }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_framebuffer, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_width, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, }, + { MP_QSTR_height, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, }, + { MP_QSTR_rotation, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, + { MP_QSTR_color_depth, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 16} }, + { MP_QSTR_bytes_per_cell, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 1} }, + { MP_QSTR_auto_refresh, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} }, + { MP_QSTR_native_frames_per_second, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 60} }, + }; + MP_STATIC_ASSERT( MP_ARRAY_SIZE(allowed_args) == NUM_ARGS ); + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + mp_obj_t framebuffer = args[ARG_framebuffer].u_obj; + + mp_int_t rotation = args[ARG_rotation].u_int; + if (rotation % 90 != 0) { + mp_raise_ValueError(translate("Display rotation must be in 90 degree increments")); + } + + primary_display_t *disp = allocate_display_or_raise(); + framebufferio_framebufferdisplay_obj_t *self = &disp->framebuffer_display; + self->base.type = &framebufferio_framebufferdisplay_type; + common_hal_framebufferio_framebufferdisplay_construct( + self, + framebuffer, + args[ARG_width].u_int, args[ARG_height].u_int, + rotation, + args[ARG_color_depth].u_int, + args[ARG_bytes_per_cell].u_int, + args[ARG_auto_refresh].u_bool, + args[ARG_native_frames_per_second].u_int + ); + + return self; +} + +// Helper to ensure we have the native super class instead of a subclass. +static framebufferio_framebufferdisplay_obj_t* native_display(mp_obj_t display_obj) { + mp_obj_t native_display = mp_instance_cast_to_native_base(display_obj, &framebufferio_framebufferdisplay_type); + mp_obj_assert_native_inited(native_display); + return MP_OBJ_TO_PTR(native_display); +} + +//| .. method:: show(group) +//| +//| Switches to displaying the given group of layers. When group is None, the default +//| CircuitPython terminal will be shown. +//| +//| :param Group group: The group to show. +//| +STATIC mp_obj_t framebufferio_framebufferdisplay_obj_show(mp_obj_t self_in, mp_obj_t group_in) { + framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); + displayio_group_t* group = NULL; + if (group_in != mp_const_none) { + group = MP_OBJ_TO_PTR(native_group(group_in)); + } + + bool ok = common_hal_framebufferio_framebufferdisplay_show(self, group); + if (!ok) { + mp_raise_ValueError(translate("Group already used")); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_show_obj, framebufferio_framebufferdisplay_obj_show); + +//| .. method:: refresh(*, target_frames_per_second=60, minimum_frames_per_second=1) +//| +//| When auto refresh is off, waits for the target frame rate and then refreshes the display, +//| returning True. If the call has taken too long since the last refresh call for the given +//| target frame rate, then the refresh returns False immediately without updating the screen to +//| hopefully help getting caught up. +//| +//| If the time since the last successful refresh is below the minimum frame rate, then an +//| exception will be raised. Set minimum_frames_per_second to 0 to disable. +//| +//| When auto refresh is on, updates the display immediately. (The display will also update +//| without calls to this.) +//| +//| :param int target_frames_per_second: How many times a second `refresh` should be called and the screen updated. +//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second. +//| +STATIC mp_obj_t framebufferio_framebufferdisplay_obj_refresh(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_target_frames_per_second, ARG_minimum_frames_per_second }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_target_frames_per_second, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 60} }, + { MP_QSTR_minimum_frames_per_second, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + framebufferio_framebufferdisplay_obj_t *self = native_display(pos_args[0]); + uint32_t maximum_ms_per_real_frame = 0xffffffff; + mp_int_t minimum_frames_per_second = args[ARG_minimum_frames_per_second].u_int; + if (minimum_frames_per_second > 0) { + maximum_ms_per_real_frame = 1000 / minimum_frames_per_second; + } + return mp_obj_new_bool(common_hal_framebufferio_framebufferdisplay_refresh(self, 1000 / args[ARG_target_frames_per_second].u_int, maximum_ms_per_real_frame)); +} +MP_DEFINE_CONST_FUN_OBJ_KW(framebufferio_framebufferdisplay_refresh_obj, 1, framebufferio_framebufferdisplay_obj_refresh); + +//| .. attribute:: auto_refresh +//| +//| True when the display is refreshed automatically. +//| +STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_auto_refresh(mp_obj_t self_in) { + framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); + return mp_obj_new_bool(common_hal_framebufferio_framebufferdisplay_get_auto_refresh(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(framebufferio_framebufferdisplay_get_auto_refresh_obj, framebufferio_framebufferdisplay_obj_get_auto_refresh); + +STATIC mp_obj_t framebufferio_framebufferdisplay_obj_set_auto_refresh(mp_obj_t self_in, mp_obj_t auto_refresh) { + framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); + + common_hal_framebufferio_framebufferdisplay_set_auto_refresh(self, mp_obj_is_true(auto_refresh)); + + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_set_auto_refresh_obj, framebufferio_framebufferdisplay_obj_set_auto_refresh); + +const mp_obj_property_t framebufferio_framebufferdisplay_auto_refresh_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&framebufferio_framebufferdisplay_get_auto_refresh_obj, + (mp_obj_t)&framebufferio_framebufferdisplay_set_auto_refresh_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +//| .. attribute:: brightness +//| +//| The brightness of the display as a float. 0.0 is off and 1.0 is full brightness. When +//| `auto_brightness` is True, the value of `brightness` will change automatically. +//| If `brightness` is set, `auto_brightness` will be disabled and will be set to False. +//| +STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_brightness(mp_obj_t self_in) { + framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); + mp_float_t brightness = common_hal_framebufferio_framebufferdisplay_get_brightness(self); + if (brightness < 0) { + mp_raise_RuntimeError(translate("Brightness not adjustable")); + } + return mp_obj_new_float(brightness); +} +MP_DEFINE_CONST_FUN_OBJ_1(framebufferio_framebufferdisplay_get_brightness_obj, framebufferio_framebufferdisplay_obj_get_brightness); + +STATIC mp_obj_t framebufferio_framebufferdisplay_obj_set_brightness(mp_obj_t self_in, mp_obj_t brightness_obj) { + framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); + common_hal_framebufferio_framebufferdisplay_set_auto_brightness(self, false); + mp_float_t brightness = mp_obj_get_float(brightness_obj); + if (brightness < 0.0f || brightness > 1.0f) { + mp_raise_ValueError(translate("Brightness must be 0-1.0")); + } + bool ok = common_hal_framebufferio_framebufferdisplay_set_brightness(self, brightness); + if (!ok) { + mp_raise_RuntimeError(translate("Brightness not adjustable")); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_set_brightness_obj, framebufferio_framebufferdisplay_obj_set_brightness); + +const mp_obj_property_t framebufferio_framebufferdisplay_brightness_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&framebufferio_framebufferdisplay_get_brightness_obj, + (mp_obj_t)&framebufferio_framebufferdisplay_set_brightness_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +//| .. attribute:: auto_brightness +//| +//| True when the display brightness is adjusted automatically, based on an ambient +//| light sensor or other method. Note that some displays may have this set to True by default, +//| but not actually implement automatic brightness adjustment. `auto_brightness` is set to False +//| if `brightness` is set manually. +//| +STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_auto_brightness(mp_obj_t self_in) { + framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); + return mp_obj_new_bool(common_hal_framebufferio_framebufferdisplay_get_auto_brightness(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(framebufferio_framebufferdisplay_get_auto_brightness_obj, framebufferio_framebufferdisplay_obj_get_auto_brightness); + +STATIC mp_obj_t framebufferio_framebufferdisplay_obj_set_auto_brightness(mp_obj_t self_in, mp_obj_t auto_brightness) { + framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); + + bool ok = common_hal_framebufferio_framebufferdisplay_set_auto_brightness(self, mp_obj_is_true(auto_brightness)); + if (!ok) { + mp_raise_RuntimeError(translate("Brightness not adjustable")); + } + + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_set_auto_brightness_obj, framebufferio_framebufferdisplay_obj_set_auto_brightness); + +const mp_obj_property_t framebufferio_framebufferdisplay_auto_brightness_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&framebufferio_framebufferdisplay_get_auto_brightness_obj, + (mp_obj_t)&framebufferio_framebufferdisplay_set_auto_brightness_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +//| .. attribute:: width +//| +//| Gets the width of the framebuffer +//| +STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_width(mp_obj_t self_in) { + framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); + return MP_OBJ_NEW_SMALL_INT(common_hal_framebufferio_framebufferdisplay_get_width(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(framebufferio_framebufferdisplay_get_width_obj, framebufferio_framebufferdisplay_obj_get_width); + +const mp_obj_property_t framebufferio_framebufferdisplay_width_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&framebufferio_framebufferdisplay_get_width_obj, + (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +//| .. attribute:: height +//| +//| Gets the height of the framebuffer +//| +STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_height(mp_obj_t self_in) { + framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); + return MP_OBJ_NEW_SMALL_INT(common_hal_framebufferio_framebufferdisplay_get_height(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(framebufferio_framebufferdisplay_get_height_obj, framebufferio_framebufferdisplay_obj_get_height); + +const mp_obj_property_t framebufferio_framebufferdisplay_height_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&framebufferio_framebufferdisplay_get_height_obj, + (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +//| .. attribute:: rotation +//| +//| The rotation of the display as an int in degrees. +//| +STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_rotation(mp_obj_t self_in) { + framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); + return MP_OBJ_NEW_SMALL_INT(common_hal_framebufferio_framebufferdisplay_get_rotation(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(framebufferio_framebufferdisplay_get_rotation_obj, framebufferio_framebufferdisplay_obj_get_rotation); +STATIC mp_obj_t framebufferio_framebufferdisplay_obj_set_rotation(mp_obj_t self_in, mp_obj_t value) { + framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); + common_hal_framebufferio_framebufferdisplay_set_rotation(self, mp_obj_get_int(value)); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_set_rotation_obj, framebufferio_framebufferdisplay_obj_set_rotation); + + +const mp_obj_property_t framebufferio_framebufferdisplay_rotation_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&framebufferio_framebufferdisplay_get_rotation_obj, + (mp_obj_t)&framebufferio_framebufferdisplay_set_rotation_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +//| .. attribute:: framebuffer +//| +//| The framebuffer being used by the display +//| +//| +STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_framebuffer(mp_obj_t self_in) { + framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); + return common_hal_framebufferio_framebufferdisplay_get_framebuffer(self); +} +MP_DEFINE_CONST_FUN_OBJ_1(framebufferio_framebufferdisplay_get_framebuffer_obj, framebufferio_framebufferdisplay_obj_get_framebuffer); + +const mp_obj_property_t framebufferio_framebufferframebuffer_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&framebufferio_framebufferdisplay_get_framebuffer_obj, + (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + + +//| .. method:: fill_row(y, buffer) +//| +//| Extract the pixels from a single row +//| +//| :param int y: The top edge of the area +//| :param bytearray buffer: The buffer in which to place the pixel data +STATIC mp_obj_t framebufferio_framebufferdisplay_obj_fill_row(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_y, ARG_buffer }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_y, MP_ARG_INT | MP_ARG_REQUIRED, {.u_int = -1} }, + { MP_QSTR_buffer, MP_ARG_OBJ | MP_ARG_REQUIRED, {} }, + }; + 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); + framebufferio_framebufferdisplay_obj_t *self = native_display(pos_args[0]); + mp_int_t y = args[ARG_y].u_int; + mp_obj_t *result = args[ARG_buffer].u_obj; + + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(result, &bufinfo, MP_BUFFER_WRITE); + + if (bufinfo.typecode != BYTEARRAY_TYPECODE) { + mp_raise_ValueError(translate("Buffer is not a bytearray.")); + } + if (self->core.colorspace.depth != 16) { + mp_raise_ValueError(translate("Display must have a 16 bit colorspace.")); + } + + displayio_area_t area = { + .x1 = 0, + .y1 = y, + .x2 = self->core.width, + .y2 = y + 1 + }; + uint8_t pixels_per_word = (sizeof(uint32_t) * 8) / self->core.colorspace.depth; + uint16_t buffer_size = self->core.width / pixels_per_word; + uint16_t pixels_per_buffer = displayio_area_size(&area); + if (pixels_per_buffer % pixels_per_word) { + buffer_size += 1; + } + + uint32_t *result_buffer = bufinfo.buf; + size_t result_buffer_size = bufinfo.len; + + if (result_buffer_size >= (buffer_size * 4)) { + volatile uint32_t mask_length = (pixels_per_buffer / 32) + 1; + uint32_t mask[mask_length]; + + for (uint16_t k = 0; k < mask_length; k++) { + mask[k] = 0x00000000; + } + + displayio_display_core_fill_area(&self->core, &area, mask, result_buffer); + return result; + } else { + mp_raise_ValueError(translate("Buffer is too small")); + } +} +MP_DEFINE_CONST_FUN_OBJ_KW(framebufferio_framebufferdisplay_fill_row_obj, 1, framebufferio_framebufferdisplay_obj_fill_row); + +STATIC const mp_rom_map_elem_t framebufferio_framebufferdisplay_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&framebufferio_framebufferdisplay_show_obj) }, + { MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&framebufferio_framebufferdisplay_refresh_obj) }, + { MP_ROM_QSTR(MP_QSTR_fill_row), MP_ROM_PTR(&framebufferio_framebufferdisplay_fill_row_obj) }, + + { MP_ROM_QSTR(MP_QSTR_auto_refresh), MP_ROM_PTR(&framebufferio_framebufferdisplay_auto_refresh_obj) }, + + { MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&framebufferio_framebufferdisplay_brightness_obj) }, + { MP_ROM_QSTR(MP_QSTR_auto_brightness), MP_ROM_PTR(&framebufferio_framebufferdisplay_auto_brightness_obj) }, + + { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&framebufferio_framebufferdisplay_width_obj) }, + { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&framebufferio_framebufferdisplay_height_obj) }, + { MP_ROM_QSTR(MP_QSTR_rotation), MP_ROM_PTR(&framebufferio_framebufferdisplay_rotation_obj) }, + { MP_ROM_QSTR(MP_QSTR_framebuffer), MP_ROM_PTR(&framebufferio_framebufferframebuffer_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(framebufferio_framebufferdisplay_locals_dict, framebufferio_framebufferdisplay_locals_dict_table); + +const mp_obj_type_t framebufferio_framebufferdisplay_type = { + { &mp_type_type }, + .name = MP_QSTR_FramebufferDisplay, + .make_new = framebufferio_framebufferdisplay_make_new, + .locals_dict = (mp_obj_dict_t*)&framebufferio_framebufferdisplay_locals_dict, +}; diff --git a/shared-bindings/framebufferio/FramebufferDisplay.h b/shared-bindings/framebufferio/FramebufferDisplay.h new file mode 100644 index 0000000000..b472088d20 --- /dev/null +++ b/shared-bindings/framebufferio/FramebufferDisplay.h @@ -0,0 +1,69 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017, 2018 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_FRAMEBUFFERDISPLAY_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_FRAMEBUFFERDISPLAY_H + +#include "common-hal/microcontroller/Pin.h" + +#include "shared-module/framebufferio/FramebufferDisplay.h" +#include "shared-module/displayio/Group.h" + +extern const mp_obj_type_t framebufferio_framebufferdisplay_type; + +#define DELAY 0x80 + +#define NO_BRIGHTNESS_COMMAND 0x100 + +void common_hal_framebufferio_framebufferdisplay_construct(framebufferio_framebufferdisplay_obj_t* self, + mp_obj_t framebuffer, uint16_t width, uint16_t height, + uint16_t rotation, uint16_t color_depth, + uint8_t bytes_per_cell, + bool auto_refresh, uint16_t native_frames_per_second); + +bool common_hal_framebufferio_framebufferdisplay_show(framebufferio_framebufferdisplay_obj_t* self, + displayio_group_t* root_group); + +bool common_hal_framebufferio_framebufferdisplay_refresh(framebufferio_framebufferdisplay_obj_t* self, uint32_t target_ms_per_frame, uint32_t maximum_ms_per_real_frame); + +bool common_hal_framebufferio_framebufferdisplay_get_auto_refresh(framebufferio_framebufferdisplay_obj_t* self); +void common_hal_framebufferio_framebufferdisplay_set_auto_refresh(framebufferio_framebufferdisplay_obj_t* self, bool auto_refresh); + +uint16_t common_hal_framebufferio_framebufferdisplay_get_width(framebufferio_framebufferdisplay_obj_t* self); +uint16_t common_hal_framebufferio_framebufferdisplay_get_height(framebufferio_framebufferdisplay_obj_t* self); +uint16_t common_hal_framebufferio_framebufferdisplay_get_rotation(framebufferio_framebufferdisplay_obj_t* self); +void common_hal_framebufferio_framebufferdisplay_set_rotation(framebufferio_framebufferdisplay_obj_t* self, int rotation); + +bool common_hal_framebufferio_framebufferdisplay_get_auto_brightness(framebufferio_framebufferdisplay_obj_t* self); +bool common_hal_framebufferio_framebufferdisplay_set_auto_brightness(framebufferio_framebufferdisplay_obj_t* self, bool auto_brightness); + +mp_float_t common_hal_framebufferio_framebufferdisplay_get_brightness(framebufferio_framebufferdisplay_obj_t* self); +bool common_hal_framebufferio_framebufferdisplay_set_brightness(framebufferio_framebufferdisplay_obj_t* self, mp_float_t brightness); + +mp_obj_t common_hal_framebufferio_framebufferdisplay_framebuffer(framebufferio_framebufferdisplay_obj_t* self); + + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_FRAMEBUFFERDISPLAY_H diff --git a/shared-bindings/framebufferio/__init__.c b/shared-bindings/framebufferio/__init__.c new file mode 100644 index 0000000000..0f0823a25f --- /dev/null +++ b/shared-bindings/framebufferio/__init__.c @@ -0,0 +1,63 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "py/obj.h" +#include "shared-bindings/framebufferio/__init__.h" +#include "shared-bindings/framebufferio/FramebufferDisplay.h" + +//| :mod:`framebufferio` --- Native framebuffer display driving +//| ========================================================================= +//| +//| .. module:: framebufferio +//| :synopsis: Native helpers for driving displays +//| :platform: SAMD51, nRF52 +//| +//| The `framebufferio` module contains classes to manage display output +//| including synchronizing with refresh rates and partial updating. +//| It is used in conjunction with classes from `displayio` to actually +//| place items on the display; and classes like `Protomatter` to actually +//| drive the display. +//| +//| Libraries +//| +//| .. toctree:: +//| :maxdepth: 3 +//| +//| FramebufferDisplay +//| + +#if CIRCUITPY_FRAMEBUFFERIO +static const mp_rom_map_elem_t framebufferio_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_framebufferio) }, + { MP_ROM_QSTR(MP_QSTR_FramebufferDisplay), MP_ROM_PTR(&framebufferio_framebufferdisplay_type) }, +}; +STATIC MP_DEFINE_CONST_DICT(framebufferio_module_globals, framebufferio_module_globals_table); +const mp_obj_module_t framebufferio_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&framebufferio_module_globals, +}; +#endif + diff --git a/shared-bindings/framebufferio/__init__.h b/shared-bindings/framebufferio/__init__.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/shared-bindings/microcontroller/Pin.h b/shared-bindings/microcontroller/Pin.h index 4f29322a06..bb5256b558 100644 --- a/shared-bindings/microcontroller/Pin.h +++ b/shared-bindings/microcontroller/Pin.h @@ -43,5 +43,11 @@ void assert_pin_free(const mcu_pin_obj_t* pin); bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t* pin); void common_hal_never_reset_pin(const mcu_pin_obj_t* pin); void common_hal_reset_pin(const mcu_pin_obj_t* pin); +uint8_t common_hal_mcu_pin_number(const mcu_pin_obj_t* pin); +void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin); +void common_hal_mcu_pin_claim_number(uint8_t pin_no); +void common_hal_mcu_pin_reset_number(uint8_t pin_no); + +#define COMMON_HAL_MCU_NO_PIN ((uint8_t)0xff) #endif // MICROPY_INCLUDED_SHARED_BINDINGS_MICROCONTROLLER_PIN_H diff --git a/shared-module/_protomatter/Protomatter.c b/shared-module/_protomatter/Protomatter.c new file mode 100644 index 0000000000..77ca634763 --- /dev/null +++ b/shared-module/_protomatter/Protomatter.c @@ -0,0 +1,200 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include + +#include "py/gc.h" +#include "py/obj.h" +#include "py/objarray.h" +#include "py/objproperty.h" +#include "py/runtime.h" + +#include "common-hal/_protomatter/Protomatter.h" +#include "shared-module/_protomatter/allocator.h" +#include "shared-bindings/_protomatter/Protomatter.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/util.h" +#include "shared-module/framebufferio/FramebufferDisplay.h" + +extern Protomatter_core *_PM_protoPtr; + +void common_hal_protomatter_protomatter_construct(protomatter_protomatter_obj_t *self, int width, int bit_depth, uint8_t rgb_count, uint8_t *rgb_pins, uint8_t addr_count, uint8_t *addr_pins, uint8_t clock_pin, uint8_t latch_pin, uint8_t oe_pin, bool doublebuffer, mp_obj_t framebuffer, void *timer) { + self->width = width; + self->bit_depth = bit_depth; + self->rgb_count = rgb_count; + memcpy(self->rgb_pins, rgb_pins, rgb_count); + self->addr_count = addr_count; + memcpy(self->addr_pins, addr_pins, addr_count); + self->clock_pin = clock_pin; + self->oe_pin = oe_pin; + self->latch_pin = latch_pin; + self->doublebuffer = doublebuffer; + + self->timer = timer ? timer : common_hal_protomatter_timer_allocate(); + if (self->timer == NULL) { + mp_raise_ValueError(translate("No timer available")); + } + + self->width = width; + self->bufsize = 2 * width * rgb_count / 3 * (1 << addr_count); + + common_hal_protomatter_protomatter_reconstruct(self, framebuffer); +} + +void common_hal_protomatter_protomatter_reconstruct(protomatter_protomatter_obj_t* self, mp_obj_t framebuffer) { + if (framebuffer) { + self->framebuffer = framebuffer; + framebuffer = mp_obj_new_bytearray_of_zeros(self->bufsize); + mp_get_buffer_raise(self->framebuffer, &self->bufinfo, MP_BUFFER_READ); + if (mp_get_buffer(self->framebuffer, &self->bufinfo, MP_BUFFER_RW)) { + self->bufinfo.typecode = 'H' | MP_OBJ_ARRAY_TYPECODE_FLAG_RW; + } else { + self->bufinfo.typecode = 'H'; + } + // verify that the matrix is big enough + mp_get_index(mp_obj_get_type(self->framebuffer), self->bufinfo.len, MP_OBJ_NEW_SMALL_INT(self->bufsize-1), false); + } else { + _PM_FREE(self->bufinfo.buf); + _PM_FREE(self->core.rgbPins); + _PM_FREE(self->core.addr); + _PM_FREE(self->core.screenData); + + self->framebuffer = NULL; + self->bufinfo.buf = _PM_allocator_impl(self->bufsize); + self->bufinfo.len = self->bufsize; + self->bufinfo.typecode = 'H' | MP_OBJ_ARRAY_TYPECODE_FLAG_RW; + } + + ProtomatterStatus stat = _PM_init(&self->core, + self->width, self->bit_depth, + self->rgb_count/6, self->rgb_pins, + self->addr_count, self->addr_pins, + self->clock_pin, self->latch_pin, self->oe_pin, + self->doublebuffer, self->timer); + + if (stat == PROTOMATTER_OK) { + _PM_protoPtr = &self->core; + common_hal_mcu_disable_interrupts(); + common_hal_protomatter_timer_enable(self->timer); + stat = _PM_begin(&self->core); + _PM_convert_565(&self->core, self->bufinfo.buf, self->width); + common_hal_mcu_enable_interrupts(); + _PM_swapbuffer_maybe(&self->core); + } + + if (stat != PROTOMATTER_OK) { + // XXX this deinit() actually makes crashy-crashy + // can trigger it by sending inappropriate pins + common_hal_protomatter_protomatter_deinit(self); + switch (stat) { + case PROTOMATTER_ERR_PINS: + mp_raise_ValueError(translate("Invalid pin")); + break; + case PROTOMATTER_ERR_ARG: + mp_raise_ValueError(translate("Invalid argument")); + break; + case PROTOMATTER_ERR_MALLOC: /// should have already been signaled as NLR + default: + mp_raise_msg_varg(&mp_type_RuntimeError, + translate("Protomatter internal error #%d"), (int)stat); + break; + } + } + + self->paused = 0; + +} + +STATIC void free_pin(uint8_t *pin) { + if (*pin != COMMON_HAL_MCU_NO_PIN) { + common_hal_mcu_pin_reset_number(*pin); + } + *pin = COMMON_HAL_MCU_NO_PIN; +} + +STATIC void free_pin_seq(uint8_t *seq, int count) { + for (int i=0; itimer) { + common_hal_protomatter_timer_free(self->timer); + self->timer = 0; + } + + if (_PM_protoPtr == &self->core) { + _PM_protoPtr = NULL; + } + + free_pin_seq(self->rgb_pins, self->rgb_count); + free_pin_seq(self->addr_pins, self->addr_count); + free_pin(&self->clock_pin); + free_pin(&self->latch_pin); + free_pin(&self->oe_pin); + + if (self->core.rgbPins) { + _PM_free(&self->core); + } + memset(&self->core, 0, sizeof(self->core)); + + // If it was supervisor-allocated, it is supervisor-freed and the pointer + // is zeroed, otherwise the pointer is just zeroed + _PM_FREE(self->bufinfo.buf); + self->base.type = NULL; + + // If a framebuffer was passed in to the constructor, NULL the reference + // here so that it will become GC'able + self->framebuffer = NULL; +} + +void protomatter_protomatter_collect_ptrs(protomatter_protomatter_obj_t* self) { + gc_collect_ptr(self->framebuffer); + gc_collect_ptr(self->core.rgbPins); + gc_collect_ptr(self->core.addr); + gc_collect_ptr(self->core.screenData); +} + +void common_hal_protomatter_protomatter_set_paused(protomatter_protomatter_obj_t* self, bool paused) { + if (paused && !self->paused) { + _PM_stop(&self->core); + } else if (!paused && self->paused) { + _PM_resume(&self->core); + } + self->paused = paused; +} + +bool common_hal_protomatter_protomatter_get_paused(protomatter_protomatter_obj_t* self) { + return self->paused; +} + +void common_hal_protomatter_protomatter_refresh(protomatter_protomatter_obj_t* self) { + _PM_convert_565(&self->core, self->bufinfo.buf, self->width); + _PM_swapbuffer_maybe(&self->core); +} + diff --git a/shared-module/_protomatter/Protomatter.h b/shared-module/_protomatter/Protomatter.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/shared-module/_protomatter/__init__.c b/shared-module/_protomatter/__init__.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/shared-module/_protomatter/__init__.h b/shared-module/_protomatter/__init__.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/shared-module/_protomatter/allocator.h b/shared-module/_protomatter/allocator.h new file mode 100644 index 0000000000..b7f517ce5b --- /dev/null +++ b/shared-module/_protomatter/allocator.h @@ -0,0 +1,29 @@ +#ifndef MICROPY_INCLUDED_SHARED_MODULE_PROTOMATTER_ALLOCATOR_H +#define MICROPY_INCLUDED_SHARED_MODULE_PROTOMATTER_ALLOCATOR_H + +#include +#include "py/gc.h" +#include "py/misc.h" +#include "supervisor/memory.h" + +#define _PM_ALLOCATOR _PM_allocator_impl +#define _PM_FREE(x) (_PM_free_impl((x)), (x)=NULL, (void)0) + +static inline void *_PM_allocator_impl(size_t sz) { + if (gc_alloc_possible()) { + return m_malloc(sz + sizeof(void*), true); + } else { + supervisor_allocation *allocation = allocate_memory(align32_size(sz), false); + return allocation ? allocation->ptr : NULL; + } +} + +static inline void _PM_free_impl(void *ptr_in) { + supervisor_allocation *allocation = allocation_from_ptr(ptr_in); + + if (allocation) { + free_memory(allocation); + } +} + +#endif diff --git a/shared-module/displayio/ColorConverter.c b/shared-module/displayio/ColorConverter.c index a5d7f0b051..2c9fb6d789 100644 --- a/shared-module/displayio/ColorConverter.c +++ b/shared-module/displayio/ColorConverter.c @@ -47,9 +47,7 @@ uint16_t displayio_colorconverter_compute_rgb565(uint32_t color_rgb888) { uint32_t r5 = (color_rgb888 >> 19); uint32_t g6 = (color_rgb888 >> 10) & 0x3f; uint32_t b5 = (color_rgb888 >> 3) & 0x1f; - uint32_t packed = r5 << 11 | g6 << 5 | b5; - // swap bytes - return __builtin_bswap16(packed); + return r5 << 11 | g6 << 5 | b5; } uint8_t displayio_colorconverter_compute_luma(uint32_t color_rgb888) { @@ -156,7 +154,12 @@ void displayio_colorconverter_convert(displayio_colorconverter_t *self, const _d } if (colorspace->depth == 16) { - output_color->pixel = displayio_colorconverter_compute_rgb565(pixel); + uint16_t packed = displayio_colorconverter_compute_rgb565(pixel); + if (colorspace->reverse_bytes_in_word) { + // swap bytes + packed = __builtin_bswap16(packed); + } + output_color->pixel = packed; output_color->opaque = true; return; } else if (colorspace->tricolor) { diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c index 2edded9278..aaddbb4714 100644 --- a/shared-module/displayio/Display.c +++ b/shared-module/displayio/Display.c @@ -46,7 +46,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self, mp_obj_t bus, uint16_t width, uint16_t height, int16_t colstart, int16_t rowstart, uint16_t rotation, uint16_t color_depth, bool grayscale, bool pixels_in_byte_share_row, - uint8_t bytes_per_cell, bool reverse_pixels_in_byte, uint8_t set_column_command, + uint8_t bytes_per_cell, bool reverse_pixels_in_byte, bool reverse_bytes_in_word, uint8_t set_column_command, uint8_t set_row_command, uint8_t write_ram_command, uint8_t set_vertical_scroll, uint8_t* init_sequence, uint16_t init_sequence_len, const mcu_pin_obj_t* backlight_pin, uint16_t brightness_command, mp_float_t brightness, bool auto_brightness, @@ -60,7 +60,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self, ram_height = 0xff; } displayio_display_core_construct(&self->core, bus, width, height, ram_width, ram_height, colstart, rowstart, rotation, - color_depth, grayscale, pixels_in_byte_share_row, bytes_per_cell, reverse_pixels_in_byte); + color_depth, grayscale, pixels_in_byte_share_row, bytes_per_cell, reverse_pixels_in_byte, reverse_bytes_in_word); self->set_column_command = set_column_command; self->set_row_command = set_row_command; diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index 91d4bb7f9f..5b4a8f916b 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -58,7 +58,7 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* self->core.colorspace.tricolor_luma = displayio_colorconverter_compute_luma(highlight_color); } - displayio_display_core_construct(&self->core, bus, width, height, ram_width, ram_height, colstart, rowstart, rotation, 1, true, true, 1, true); + displayio_display_core_construct(&self->core, bus, width, height, ram_width, ram_height, colstart, rowstart, rotation, 1, true, true, 1, true, true); self->set_column_window_command = set_column_window_command; self->set_row_window_command = set_row_window_command; diff --git a/shared-module/displayio/Palette.c b/shared-module/displayio/Palette.c index 3bce86f484..1ef03aab44 100644 --- a/shared-module/displayio/Palette.c +++ b/shared-module/displayio/Palette.c @@ -83,7 +83,12 @@ bool displayio_palette_get_color(displayio_palette_t *self, const _displayio_col } else if (colorspace->grayscale) { *color = self->colors[palette_index].luma >> (8 - colorspace->depth); } else { - *color = self->colors[palette_index].rgb565; + uint16_t packed = self->colors[palette_index].rgb565; + if (colorspace->reverse_bytes_in_word) { + // swap bytes + packed = __builtin_bswap16(packed); + } + *color = packed; } return true; diff --git a/shared-module/displayio/Palette.h b/shared-module/displayio/Palette.h index 758fd43fc1..da72f250f9 100644 --- a/shared-module/displayio/Palette.h +++ b/shared-module/displayio/Palette.h @@ -41,6 +41,7 @@ typedef struct { bool tricolor; bool pixels_in_byte_share_row; bool reverse_pixels_in_byte; + bool reverse_bytes_in_word; bool dither; } _displayio_colorspace_t; diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index efa61265e6..cf1bc45d9d 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -21,6 +21,20 @@ primary_display_t displays[CIRCUITPY_DISPLAY_LIMIT]; +#if CIRCUITPY_PROTOMATTER +STATIC bool any_display_uses_this_protomatter(protomatter_protomatter_obj_t* pm) { + for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { + if (displays[i].framebuffer_display.base.type == &framebufferio_framebufferdisplay_type) { + framebufferio_framebufferdisplay_obj_t* display = &displays[i].framebuffer_display; + if (display->framebuffer == pm) { + return true; + } + } + } + return false; +} +#endif + // Check for recursive calls to displayio_background. bool displayio_background_in_progress = false; @@ -47,6 +61,10 @@ void displayio_background(void) { } if (displays[i].display.base.type == &displayio_display_type) { displayio_display_background(&displays[i].display); +#if CIRCUITPY_FRAMEBUFFERIO + } else if (displays[i].framebuffer_display.base.type == &framebufferio_framebufferdisplay_type) { + framebufferio_framebufferdisplay_background(&displays[i].framebuffer_display); +#endif } else if (displays[i].epaper_display.base.type == &displayio_epaperdisplay_type) { displayio_epaperdisplay_background(&displays[i].epaper_display); } @@ -67,6 +85,10 @@ void common_hal_displayio_release_displays(void) { release_display(&displays[i].display); } else if (display_type == &displayio_epaperdisplay_type) { release_epaperdisplay(&displays[i].epaper_display); +#if CIRCUITPY_FRAMEBUFFERIO + } else if (display_type == &framebufferio_framebufferdisplay_type) { + release_framebufferdisplay(&displays[i].framebuffer_display); +#endif } displays[i].display.base.type = &mp_type_NoneType; } @@ -80,6 +102,10 @@ void common_hal_displayio_release_displays(void) { common_hal_displayio_i2cdisplay_deinit(&displays[i].i2cdisplay_bus); } else if (bus_type == &displayio_parallelbus_type) { common_hal_displayio_parallelbus_deinit(&displays[i].parallel_bus); +#if CIRCUITPY_FRAMEBUFFERIO + } else if (bus_type == &protomatter_Protomatter_type) { + common_hal_protomatter_protomatter_deinit(&displays[i].protomatter); +#endif } displays[i].fourwire_bus.base.type = &mp_type_NoneType; } @@ -141,6 +167,13 @@ void reset_displays(void) { } } } +#if CIRCUITPY_PROTOMATTER + } else if (displays[i].protomatter.base.type == &protomatter_Protomatter_type) { + protomatter_protomatter_obj_t * pm = &displays[i].protomatter; + if(!any_display_uses_this_protomatter(pm)) { + common_hal_protomatter_protomatter_deinit(pm); + } +#endif } else { // Not an active display bus. continue; @@ -155,12 +188,24 @@ void reset_displays(void) { } else if (displays[i].epaper_display.base.type == &displayio_epaperdisplay_type) { displayio_epaperdisplay_obj_t* display = &displays[i].epaper_display; common_hal_displayio_epaperdisplay_show(display, NULL); +#if CIRCUITPY_FRAMEBUFFERIO + } else if (displays[i].framebuffer_display.base.type == &framebufferio_framebufferdisplay_type) { + framebufferio_framebufferdisplay_obj_t* display = &displays[i].framebuffer_display; + display->auto_refresh = true; + common_hal_framebufferio_framebufferdisplay_show(display, NULL); +#endif } } } void displayio_gc_collect(void) { for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { +#if CIRCUITPY_PROTOMATTER + if (displays[i].protomatter.base.type == &protomatter_Protomatter_type) { + protomatter_protomatter_collect_ptrs(&displays[i].protomatter); + } +#endif + if (displays[i].display.base.type == NULL) { continue; } @@ -169,6 +214,10 @@ void displayio_gc_collect(void) { // but this is more precise, and is the only field that needs marking. if (displays[i].display.base.type == &displayio_display_type) { displayio_display_collect_ptrs(&displays[i].display); +#if CIRCUITPY_FRAMEBUFFERIO + } else if (displays[i].framebuffer_display.base.type == &framebufferio_framebufferdisplay_type) { + framebufferio_framebufferdisplay_collect_ptrs(&displays[i].framebuffer_display); +#endif } else if (displays[i].epaper_display.base.type == &displayio_epaperdisplay_type) { displayio_epaperdisplay_collect_ptrs(&displays[i].epaper_display); } @@ -308,3 +357,38 @@ void displayio_area_transform_within(bool mirror_x, bool mirror_y, bool transpos transformed->x1 = whole->x1 + (y1 - whole->y1); } } + +primary_display_t *allocate_display(void) { + for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { + mp_const_obj_t display_type = displays[i].display.base.type; + if (display_type == NULL || display_type == &mp_type_NoneType) { + return &displays[i]; + } + } + return NULL; +} + +primary_display_t *allocate_display_or_raise(void) { + primary_display_t *result = allocate_display(); + if (result) { + return result; + } + mp_raise_RuntimeError(translate("Too many displays")); +} +primary_display_t *allocate_display_bus(void) { + for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { + mp_const_obj_t display_type = displays[i].display.base.type; + if (display_type == NULL || display_type == &mp_type_NoneType) { + return &displays[i]; + } + } + return NULL; +} + +primary_display_t *allocate_display_bus_or_raise(void) { + primary_display_t *result = allocate_display_bus(); + if (result) { + return result; + } + mp_raise_RuntimeError(translate("Too many display busses")); +} diff --git a/shared-module/displayio/__init__.h b/shared-module/displayio/__init__.h index e78bc61ce4..278a5e78f3 100644 --- a/shared-module/displayio/__init__.h +++ b/shared-module/displayio/__init__.h @@ -29,20 +29,30 @@ #include "shared-bindings/displayio/Display.h" #include "shared-bindings/displayio/EPaperDisplay.h" +#if CIRCUITPY_FRAMEBUFFERIO +#include "shared-bindings/framebufferio/FramebufferDisplay.h" +#endif #include "shared-bindings/displayio/FourWire.h" #include "shared-bindings/displayio/Group.h" #include "shared-bindings/displayio/I2CDisplay.h" #include "shared-bindings/displayio/ParallelBus.h" +#include "shared-bindings/_protomatter/Protomatter.h" typedef struct { union { displayio_fourwire_obj_t fourwire_bus; displayio_i2cdisplay_obj_t i2cdisplay_bus; displayio_parallelbus_obj_t parallel_bus; +#if CIRCUITPY_PROTOMATTER + protomatter_protomatter_obj_t protomatter; +#endif }; union { displayio_display_obj_t display; displayio_epaperdisplay_obj_t epaper_display; +#if CIRCUITPY_FRAMEBUFFERIO + framebufferio_framebufferdisplay_obj_t framebuffer_display; +#endif }; } primary_display_t; @@ -54,4 +64,9 @@ void displayio_background(void); void reset_displays(void); void displayio_gc_collect(void); +primary_display_t *allocate_display(void); +primary_display_t *allocate_display_or_raise(void); +primary_display_t *allocate_display_bus(void); +primary_display_t *allocate_display_bus_or_raise(void); + #endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO___INIT___H diff --git a/shared-module/displayio/display_core.c b/shared-module/displayio/display_core.c index 120b70f76a..4cc7564d09 100644 --- a/shared-module/displayio/display_core.c +++ b/shared-module/displayio/display_core.c @@ -44,38 +44,42 @@ void displayio_display_core_construct(displayio_display_core_t* self, mp_obj_t bus, uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height, int16_t colstart, int16_t rowstart, uint16_t rotation, - uint16_t color_depth, bool grayscale, bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte) { + uint16_t color_depth, bool grayscale, bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte, bool reverse_bytes_in_word) { self->colorspace.depth = color_depth; self->colorspace.grayscale = grayscale; self->colorspace.pixels_in_byte_share_row = pixels_in_byte_share_row; self->colorspace.bytes_per_cell = bytes_per_cell; self->colorspace.reverse_pixels_in_byte = reverse_pixels_in_byte; + self->colorspace.reverse_bytes_in_word = reverse_bytes_in_word; self->colorspace.dither = false; self->current_group = NULL; self->colstart = colstart; self->rowstart = rowstart; self->last_refresh = 0; - if (MP_OBJ_IS_TYPE(bus, &displayio_parallelbus_type)) { - self->bus_reset = common_hal_displayio_parallelbus_reset; - self->bus_free = common_hal_displayio_parallelbus_bus_free; - self->begin_transaction = common_hal_displayio_parallelbus_begin_transaction; - self->send = common_hal_displayio_parallelbus_send; - self->end_transaction = common_hal_displayio_parallelbus_end_transaction; - } else if (MP_OBJ_IS_TYPE(bus, &displayio_fourwire_type)) { - self->bus_reset = common_hal_displayio_fourwire_reset; - self->bus_free = common_hal_displayio_fourwire_bus_free; - self->begin_transaction = common_hal_displayio_fourwire_begin_transaction; - self->send = common_hal_displayio_fourwire_send; - self->end_transaction = common_hal_displayio_fourwire_end_transaction; - } else if (MP_OBJ_IS_TYPE(bus, &displayio_i2cdisplay_type)) { - self->bus_reset = common_hal_displayio_i2cdisplay_reset; - self->bus_free = common_hal_displayio_i2cdisplay_bus_free; - self->begin_transaction = common_hal_displayio_i2cdisplay_begin_transaction; - self->send = common_hal_displayio_i2cdisplay_send; - self->end_transaction = common_hal_displayio_i2cdisplay_end_transaction; - } else { - mp_raise_ValueError(translate("Unsupported display bus type")); + // (framebufferdisplay already validated its 'bus' is a buffer-protocol object) + if (bus) { + if (MP_OBJ_IS_TYPE(bus, &displayio_parallelbus_type)) { + self->bus_reset = common_hal_displayio_parallelbus_reset; + self->bus_free = common_hal_displayio_parallelbus_bus_free; + self->begin_transaction = common_hal_displayio_parallelbus_begin_transaction; + self->send = common_hal_displayio_parallelbus_send; + self->end_transaction = common_hal_displayio_parallelbus_end_transaction; + } else if (MP_OBJ_IS_TYPE(bus, &displayio_fourwire_type)) { + self->bus_reset = common_hal_displayio_fourwire_reset; + self->bus_free = common_hal_displayio_fourwire_bus_free; + self->begin_transaction = common_hal_displayio_fourwire_begin_transaction; + self->send = common_hal_displayio_fourwire_send; + self->end_transaction = common_hal_displayio_fourwire_end_transaction; + } else if (MP_OBJ_IS_TYPE(bus, &displayio_i2cdisplay_type)) { + self->bus_reset = common_hal_displayio_i2cdisplay_reset; + self->bus_free = common_hal_displayio_i2cdisplay_bus_free; + self->begin_transaction = common_hal_displayio_i2cdisplay_begin_transaction; + self->send = common_hal_displayio_i2cdisplay_send; + self->end_transaction = common_hal_displayio_i2cdisplay_end_transaction; + } else { + mp_raise_ValueError(translate("Unsupported display bus type")); + } } self->bus = bus; diff --git a/shared-module/displayio/display_core.h b/shared-module/displayio/display_core.h index 1c3d0f09c6..e4fd62d4a5 100644 --- a/shared-module/displayio/display_core.h +++ b/shared-module/displayio/display_core.h @@ -58,7 +58,7 @@ typedef struct { void displayio_display_core_construct(displayio_display_core_t* self, mp_obj_t bus, uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height, int16_t colstart, int16_t rowstart, uint16_t rotation, - uint16_t color_depth, bool grayscale, bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte); + uint16_t color_depth, bool grayscale, bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte, bool reverse_bytes_in_word); bool displayio_display_core_show(displayio_display_core_t* self, displayio_group_t* root_group); diff --git a/shared-module/framebufferio/FramebufferDisplay.c b/shared-module/framebufferio/FramebufferDisplay.c new file mode 100644 index 0000000000..bd0764e8e4 --- /dev/null +++ b/shared-module/framebufferio/FramebufferDisplay.c @@ -0,0 +1,300 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2018 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/framebufferio/FramebufferDisplay.h" + +#include "py/gc.h" +#include "py/runtime.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/time/__init__.h" +#include "shared-module/displayio/__init__.h" +#include "shared-module/displayio/display_core.h" +#include "supervisor/shared/display.h" +#include "supervisor/shared/tick.h" +#include "supervisor/usb.h" + +#include +#include + +#include "tick.h" + +void common_hal_framebufferio_framebufferdisplay_construct(framebufferio_framebufferdisplay_obj_t* self, + mp_obj_t framebuffer, uint16_t width, uint16_t height, + uint16_t rotation, uint16_t color_depth, + uint8_t bytes_per_cell, + bool auto_refresh, uint16_t native_frames_per_second) { + // Turn off auto-refresh as we init. + self->auto_refresh = false; + self->framebuffer = framebuffer; + self->framebuffer_protocol = mp_proto_get_or_throw(MP_QSTR_protocol_framebuffer, framebuffer); + + uint16_t ram_width = 0x100; + uint16_t ram_height = 0x100; + + displayio_display_core_construct(&self->core, NULL, width, height, ram_width, ram_height, 0, 0, rotation, + color_depth, false, false, bytes_per_cell, false, false); + + self->first_manual_refresh = !auto_refresh; + + self->native_frames_per_second = native_frames_per_second; + self->native_ms_per_frame = 1000 / native_frames_per_second; + + supervisor_start_terminal(width, height); + + // Set the group after initialization otherwise we may send pixels while we delay in + // initialization. + common_hal_framebufferio_framebufferdisplay_show(self, &circuitpython_splash); + self->auto_refresh = auto_refresh; +} + +bool common_hal_framebufferio_framebufferdisplay_show(framebufferio_framebufferdisplay_obj_t* self, displayio_group_t* root_group) { + return displayio_display_core_show(&self->core, root_group); +} + +uint16_t common_hal_framebufferio_framebufferdisplay_get_width(framebufferio_framebufferdisplay_obj_t* self){ + return displayio_display_core_get_width(&self->core); +} + +uint16_t common_hal_framebufferio_framebufferdisplay_get_height(framebufferio_framebufferdisplay_obj_t* self){ + return displayio_display_core_get_height(&self->core); +} + +bool common_hal_framebufferio_framebufferdisplay_get_auto_brightness(framebufferio_framebufferdisplay_obj_t* self) { + if (self->framebuffer_protocol->get_auto_brightness) { + return self->framebuffer_protocol->get_auto_brightness(self->framebuffer); + } + return true; +} + +bool common_hal_framebufferio_framebufferdisplay_set_auto_brightness(framebufferio_framebufferdisplay_obj_t* self, bool auto_brightness) { + if (self->framebuffer_protocol->set_auto_brightness) { + return self->framebuffer_protocol->set_auto_brightness(self->framebuffer, auto_brightness); + } + return false; +} + +mp_float_t common_hal_framebufferio_framebufferdisplay_get_brightness(framebufferio_framebufferdisplay_obj_t* self) { + if (self->framebuffer_protocol->set_brightness) { + return self->framebuffer_protocol->get_brightness(self->framebuffer); + } + return -1; +} + +bool common_hal_framebufferio_framebufferdisplay_set_brightness(framebufferio_framebufferdisplay_obj_t* self, mp_float_t brightness) { + bool ok = false; + if (self->framebuffer_protocol->set_brightness) { + self->framebuffer_protocol->set_brightness(self->framebuffer, brightness); + ok = true; + } + return ok; +} + +mp_obj_t common_hal_framebufferio_framebufferdisplay_get_framebuffer(framebufferio_framebufferdisplay_obj_t* self) { + return self->framebuffer; +} + +STATIC const displayio_area_t* _get_refresh_areas(framebufferio_framebufferdisplay_obj_t *self) { + if (self->core.full_refresh) { + self->core.area.next = NULL; + return &self->core.area; + } else if (self->core.current_group != NULL) { + return displayio_group_get_refresh_areas(self->core.current_group, NULL); + } + return NULL; +} + +STATIC bool _refresh_area(framebufferio_framebufferdisplay_obj_t* self, const displayio_area_t* area) { + uint16_t buffer_size = 128; // In uint32_ts + + displayio_area_t clipped; + // Clip the area to the display by overlapping the areas. If there is no overlap then we're done. + if (!displayio_display_core_clip_area(&self->core, area, &clipped)) { + return true; + } + uint16_t subrectangles = 1; + uint16_t rows_per_buffer = displayio_area_height(&clipped); + uint8_t pixels_per_word = (sizeof(uint32_t) * 8) / self->core.colorspace.depth; + uint16_t pixels_per_buffer = displayio_area_size(&clipped); + if (displayio_area_size(&clipped) > buffer_size * pixels_per_word) { + rows_per_buffer = buffer_size * pixels_per_word / displayio_area_width(&clipped); + if (rows_per_buffer == 0) { + rows_per_buffer = 1; + } + // If pixels are packed by column then ensure rows_per_buffer is on a byte boundary. + if (self->core.colorspace.depth < 8 && !self->core.colorspace.pixels_in_byte_share_row) { + uint8_t pixels_per_byte = 8 / self->core.colorspace.depth; + if (rows_per_buffer % pixels_per_byte != 0) { + rows_per_buffer -= rows_per_buffer % pixels_per_byte; + } + } + subrectangles = displayio_area_height(&clipped) / rows_per_buffer; + if (displayio_area_height(&clipped) % rows_per_buffer != 0) { + subrectangles++; + } + pixels_per_buffer = rows_per_buffer * displayio_area_width(&clipped); + buffer_size = pixels_per_buffer / pixels_per_word; + if (pixels_per_buffer % pixels_per_word) { + buffer_size += 1; + } + } + + // Allocated and shared as a uint32_t array so the compiler knows the + // alignment everywhere. + uint32_t buffer[buffer_size]; + uint32_t mask_length = (pixels_per_buffer / 32) + 1; + uint32_t mask[mask_length]; + uint16_t remaining_rows = displayio_area_height(&clipped); + + for (uint16_t j = 0; j < subrectangles; j++) { + displayio_area_t subrectangle = { + .x1 = clipped.x1, + .y1 = clipped.y1 + rows_per_buffer * j, + .x2 = clipped.x2, + .y2 = clipped.y1 + rows_per_buffer * (j + 1) + }; + if (remaining_rows < rows_per_buffer) { + subrectangle.y2 = subrectangle.y1 + remaining_rows; + } + remaining_rows -= rows_per_buffer; + + memset(mask, 0, mask_length * sizeof(mask[0])); + memset(buffer, 0, buffer_size * sizeof(buffer[0])); + + displayio_display_core_fill_area(&self->core, &subrectangle, mask, buffer); + + // COULDDO: this arithmetic only supports multiple-of-8 bpp + uint8_t *dest = self->bufinfo.buf + (subrectangle.y1 * self->core.width + subrectangle.x1) * (self->core.colorspace.depth / 8); + uint8_t *src = (uint8_t*)buffer; + size_t rowsize = (subrectangle.x2 - subrectangle.x1) * (self->core.colorspace.depth / 8); + size_t rowstride = self->core.width * (self->core.colorspace.depth/8); + for (uint16_t i = subrectangle.y1; i < subrectangle.y2; i++) { + memcpy(dest, src, rowsize); + dest += rowstride; + src += rowsize; + } + + // TODO(tannewt): Make refresh displays faster so we don't starve other + // background tasks. + usb_background(); + } + return true; +} + +STATIC void _refresh_display(framebufferio_framebufferdisplay_obj_t* self) { + displayio_display_core_start_refresh(&self->core); + self->framebuffer_protocol->get_bufinfo(self->framebuffer, &self->bufinfo); + const displayio_area_t* current_area = _get_refresh_areas(self); + while (current_area != NULL) { + _refresh_area(self, current_area); + current_area = current_area->next; + } + displayio_display_core_finish_refresh(&self->core); + self->framebuffer_protocol->swapbuffers(self->framebuffer); +} + +void common_hal_framebufferio_framebufferdisplay_set_rotation(framebufferio_framebufferdisplay_obj_t* self, int rotation){ + bool transposed = (self->core.rotation == 90 || self->core.rotation == 270); + bool will_transposed = (rotation == 90 || rotation == 270); + if(transposed != will_transposed) { + int tmp = self->core.width; + self->core.width = self->core.height; + self->core.height = tmp; + } + displayio_display_core_set_rotation(&self->core, rotation); + supervisor_stop_terminal(); + supervisor_start_terminal(self->core.width, self->core.height); + if (self->core.current_group != NULL) { + displayio_group_update_transform(self->core.current_group, &self->core.transform); + } +} + +uint16_t common_hal_framebufferio_framebufferdisplay_get_rotation(framebufferio_framebufferdisplay_obj_t* self){ + return self->core.rotation; +} + + +bool common_hal_framebufferio_framebufferdisplay_refresh(framebufferio_framebufferdisplay_obj_t* self, uint32_t target_ms_per_frame, uint32_t maximum_ms_per_real_frame) { + if (!self->auto_refresh && !self->first_manual_refresh) { + uint64_t current_time = supervisor_ticks_ms64(); + uint32_t current_ms_since_real_refresh = current_time - self->core.last_refresh; + // Test to see if the real frame time is below our minimum. + if (current_ms_since_real_refresh > maximum_ms_per_real_frame) { + mp_raise_RuntimeError(translate("Below minimum frame rate")); + } + uint32_t current_ms_since_last_call = current_time - self->last_refresh_call; + self->last_refresh_call = current_time; + // Skip the actual refresh to help catch up. + if (current_ms_since_last_call > target_ms_per_frame) { + return false; + } + uint32_t remaining_time = target_ms_per_frame - (current_ms_since_real_refresh % target_ms_per_frame); + // We're ahead of the game so wait until we align with the frame rate. + while (supervisor_ticks_ms64() - self->last_refresh_call < remaining_time) { + RUN_BACKGROUND_TASKS; + } + } + self->first_manual_refresh = false; + _refresh_display(self); + return true; +} + +bool common_hal_framebufferio_framebufferdisplay_get_auto_refresh(framebufferio_framebufferdisplay_obj_t* self) { + return self->auto_refresh; +} + +void common_hal_framebufferio_framebufferdisplay_set_auto_refresh(framebufferio_framebufferdisplay_obj_t* self, + bool auto_refresh) { + self->first_manual_refresh = !auto_refresh; + self->auto_refresh = auto_refresh; +} + +STATIC void _update_backlight(framebufferio_framebufferdisplay_obj_t* self) { + // TODO(tannewt): Fade the backlight based on it's existing value and a target value. The target + // should account for ambient light when possible. +} + +void framebufferio_framebufferdisplay_background(framebufferio_framebufferdisplay_obj_t* self) { + _update_backlight(self); + + if (self->auto_refresh && (supervisor_ticks_ms64() - self->core.last_refresh) > self->native_ms_per_frame) { + _refresh_display(self); + } +} + +void release_framebufferdisplay(framebufferio_framebufferdisplay_obj_t* self) { + release_display_core(&self->core); + self->framebuffer_protocol->deinit(self->framebuffer); +} + +void reset_framebufferdisplay(framebufferio_framebufferdisplay_obj_t* self) { + self->auto_refresh = true; + common_hal_framebufferio_framebufferdisplay_show(self, NULL); +} + +void framebufferio_framebufferdisplay_collect_ptrs(framebufferio_framebufferdisplay_obj_t* self) { + gc_collect_ptr(self->framebuffer); + displayio_display_core_collect_ptrs(&self->core); +} diff --git a/shared-module/framebufferio/FramebufferDisplay.h b/shared-module/framebufferio/FramebufferDisplay.h new file mode 100644 index 0000000000..a7b91a522e --- /dev/null +++ b/shared-module/framebufferio/FramebufferDisplay.h @@ -0,0 +1,81 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_FRAMEBUFFERDISPLAY_H +#define MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_FRAMEBUFFERDISPLAY_H + +#include "py/obj.h" +#include "py/proto.h" + +#include "shared-bindings/digitalio/DigitalInOut.h" +#include "shared-bindings/displayio/Group.h" +#include "shared-bindings/pulseio/PWMOut.h" + +#include "shared-module/displayio/area.h" +#include "shared-module/displayio/display_core.h" + +typedef struct { + mp_obj_base_t base; + displayio_display_core_t core; + mp_obj_t framebuffer; + const struct _framebuffer_p_t *framebuffer_protocol; + mp_buffer_info_t bufinfo; + uint64_t last_backlight_refresh; + uint64_t last_refresh_call; + uint16_t native_frames_per_second; + uint16_t native_ms_per_frame; + bool auto_refresh; + bool first_manual_refresh; +} framebufferio_framebufferdisplay_obj_t; + +void framebufferio_framebufferdisplay_background(framebufferio_framebufferdisplay_obj_t* self); +void release_framebufferdisplay(framebufferio_framebufferdisplay_obj_t* self); +void reset_framebufferdisplay(framebufferio_framebufferdisplay_obj_t* self); + +void framebufferio_framebufferdisplay_collect_ptrs(framebufferio_framebufferdisplay_obj_t* self); + +mp_obj_t common_hal_framebufferio_framebufferdisplay_get_framebuffer(framebufferio_framebufferdisplay_obj_t* self); + +typedef void (*framebuffer_get_bufinfo_fun)(mp_obj_t, mp_buffer_info_t *bufinfo); +typedef void (*framebuffer_swapbuffers_fun)(mp_obj_t); +typedef void (*framebuffer_deinit_fun)(mp_obj_t); +typedef bool (*framebuffer_set_brightness_fun)(mp_obj_t, mp_float_t); +typedef mp_float_t (*framebuffer_get_brightness_fun)(mp_obj_t); +typedef bool (*framebuffer_set_auto_brightness_fun)(mp_obj_t, bool); +typedef bool (*framebuffer_get_auto_brightness_fun)(mp_obj_t); + +typedef struct _framebuffer_p_t { + MP_PROTOCOL_HEAD // MP_QSTR_protocol_framebuffer + framebuffer_get_bufinfo_fun get_bufinfo; + framebuffer_swapbuffers_fun swapbuffers; + framebuffer_deinit_fun deinit; + framebuffer_get_brightness_fun get_brightness; + framebuffer_set_brightness_fun set_brightness; + framebuffer_get_auto_brightness_fun get_auto_brightness; + framebuffer_set_auto_brightness_fun set_auto_brightness; +} framebuffer_p_t; + +#endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_FRAMEBUFFERDISPLAY_H diff --git a/shared-module/framebufferio/__init__.c b/shared-module/framebufferio/__init__.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/shared-module/framebufferio/__init__.h b/shared-module/framebufferio/__init__.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/supervisor/memory.h b/supervisor/memory.h index f557744ae5..f4359ca46e 100755 --- a/supervisor/memory.h +++ b/supervisor/memory.h @@ -43,6 +43,7 @@ typedef struct { void memory_init(void); void free_memory(supervisor_allocation* allocation); +supervisor_allocation* allocation_from_ptr(void *ptr); supervisor_allocation* allocate_remaining_memory(void); // Allocate a piece of a given length in bytes. If high_address is true then it should be allocated diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c index 855432d645..95926bc9c0 100644 --- a/supervisor/shared/display.c +++ b/supervisor/shared/display.c @@ -34,6 +34,10 @@ #include "shared-bindings/displayio/TileGrid.h" #include "supervisor/memory.h" +#if CIRCUITPY_PROTOMATTER +#include "shared-module/displayio/__init__.h" +#endif + extern size_t blinka_bitmap_data[]; extern displayio_bitmap_t blinka_bitmap; extern displayio_group_t circuitpython_splash; @@ -112,6 +116,14 @@ void supervisor_display_move_memory(void) { grid->inline_tiles = false; } MP_STATE_VM(terminal_tilegrid_tiles) = NULL; + #if CIRCUITPY_PROTOMATTER + for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { + if (displays[i].protomatter.base.type == &protomatter_Protomatter_type) { + protomatter_protomatter_obj_t * pm = &displays[i].protomatter; + common_hal_protomatter_protomatter_reconstruct(pm, NULL); + } + } + #endif #endif } @@ -157,28 +169,28 @@ _displayio_color_t blinka_colors[7] = { }, { .rgb888 = 0x8428bc, - .rgb565 = 0x7889, + .rgb565 = 0x8978, .luma = 0xff, // We cheat the luma here. It is actually 0x60 .hue = 184, .chroma = 148 }, { .rgb888 = 0xff89bc, - .rgb565 = 0xB8FC, + .rgb565 = 0xFCB8, .luma = 0xb5, .hue = 222, .chroma = 118 }, { .rgb888 = 0x7beffe, - .rgb565 = 0x9F86, + .rgb565 = 0x869F, .luma = 0xe0, .hue = 124, .chroma = 131 }, { .rgb888 = 0x51395f, - .rgb565 = 0x0D5A, + .rgb565 = 0x5A0D, .luma = 0x47, .hue = 185, .chroma = 38 @@ -191,7 +203,7 @@ _displayio_color_t blinka_colors[7] = { }, { .rgb888 = 0x0736a0, - .rgb565 = 0xf501, + .rgb565 = 0x01f5, .luma = 0x44, .hue = 147, .chroma = 153 diff --git a/supervisor/shared/memory.c b/supervisor/shared/memory.c index 14c3b4979b..d52334eb49 100755 --- a/supervisor/shared/memory.c +++ b/supervisor/shared/memory.c @@ -31,7 +31,7 @@ #include "supervisor/shared/display.h" -#define CIRCUITPY_SUPERVISOR_ALLOC_COUNT 8 +#define CIRCUITPY_SUPERVISOR_ALLOC_COUNT (12) static supervisor_allocation allocations[CIRCUITPY_SUPERVISOR_ALLOC_COUNT]; // We use uint32_t* to ensure word (4 byte) alignment. @@ -82,6 +82,15 @@ void free_memory(supervisor_allocation* allocation) { allocation->ptr = NULL; } +supervisor_allocation* allocation_from_ptr(void *ptr) { + for (size_t index = 0; index < CIRCUITPY_SUPERVISOR_ALLOC_COUNT; index++) { + if (allocations[index].ptr == ptr) { + return &allocations[index]; + } + } + return NULL; +} + supervisor_allocation* allocate_remaining_memory(void) { if (low_address == high_address) { return NULL; diff --git a/tools/convert_release_notes.py b/tools/convert_release_notes.py index 87b7e444b7..6491841029 100644 --- a/tools/convert_release_notes.py +++ b/tools/convert_release_notes.py @@ -52,6 +52,9 @@ class AdafruitBBCodeRenderer: def double_emphasis(self, text): return "[b]{}[/b]".format(text) + def emphasis(self, text): + return "[b]{}[/b]".format(text) + bbcode = mistune.Markdown(renderer=AdafruitBBCodeRenderer()) print()