diff options
| author | Dan Halbert <halbert@halwitz.org> | 2019-01-31 16:03:51 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-31 16:03:51 -0500 |
| commit | 7c443fbef2b92bfdd382db9aeaddcdcecbc02cd0 (patch) | |
| tree | 93c06f6ba863e234148555f41042b354286cb52e | |
| parent | 63d456127b783efb376bd2b25598cc9e7f9dceb6 (diff) | |
| parent | d72cd5b2d6cbc95665c41a43d6d914e71ac58017 (diff) | |
Merge pull request #1510 from tannewt/terminalio
Add a terminal that shows by default on displays.
54 files changed, 2344 insertions, 952 deletions
diff --git a/.gitmodules b/.gitmodules index 3a746ccae..b36ad6203 100644 --- a/.gitmodules +++ b/.gitmodules @@ -86,3 +86,9 @@ [submodule "tools/adabot"] path = tools/adabot url = https://github.com/adafruit/adabot.git +[submodule "tools/bitmap_font"] + path = tools/bitmap_font + url = https://github.com/adafruit/Adafruit_CircuitPython_BitmapFont.git +[submodule "tools/Tecate-bitmap-fonts"] + path = tools/Tecate-bitmap-fonts + url = https://github.com/Tecate/bitmap-fonts.git diff --git a/locale/ID.po b/locale/ID.po index f25399844..98539a867 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-01-22 14:00-0800\n" +"POT-Creation-Date: 2019-01-31 09:38-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -151,11 +151,11 @@ msgstr "argumen-argumen tidak valid" msgid "script compilation not supported" msgstr "kompilasi script tidak didukung" -#: main.c:155 +#: main.c:152 msgid " output:\n" msgstr "output:\n" -#: main.c:169 main.c:247 +#: main.c:166 main.c:247 msgid "" "Auto-reload is on. Simply save files over USB to run them or enter REPL to " "disable.\n" @@ -163,30 +163,36 @@ msgstr "" "Auto-reload aktif. Silahkan simpan data-data (files) melalui USB untuk " "menjalankannya atau masuk ke REPL untukmenonaktifkan.\n" -#: main.c:171 +#: main.c:168 msgid "Running in safe mode! Auto-reload is off.\n" msgstr "Berjalan di mode aman(safe mode)! Auto-reload tidak aktif.\n" -#: main.c:173 main.c:249 +#: main.c:170 main.c:249 msgid "Auto-reload is off.\n" msgstr "Auto-reload tidak aktif.\n" -#: main.c:187 +#: main.c:184 msgid "Running in safe mode! Not running saved code.\n" msgstr "" "Berjalan di mode aman(safe mode)! tidak menjalankan kode yang tersimpan.\n" -#: main.c:203 +#: main.c:200 msgid "WARNING: Your code filename has two extensions\n" msgstr "PERINGATAN: Nama file kode anda mempunyai dua ekstensi\n" +#: main.c:221 +msgid "" +"\n" +"Code done running. Waiting for reload.\n" +msgstr "" + #: main.c:254 msgid "Press any key to enter the REPL. Use CTRL-D to reload." msgstr "" "Tekan tombol apa saja untuk masuk ke dalam REPL. Gunakan CTRL+D untuk reset " "(Reload)" -#: main.c:417 +#: main.c:419 msgid "soft reboot\n" msgstr "memulai ulang software(soft reboot)\n" @@ -281,8 +287,8 @@ msgid "Right channel unsupported" msgstr "Channel Kanan tidak didukung" #: ports/atmel-samd/common-hal/audioio/AudioOut.c:139 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:116 #: ports/atmel-samd/common-hal/touchio/TouchIn.c:65 +#: shared-bindings/pulseio/PWMOut.c:113 msgid "Invalid pin" msgstr "Pin tidak valid" @@ -301,9 +307,9 @@ msgstr "" "sama" #: ports/atmel-samd/common-hal/audioio/AudioOut.c:243 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189 #: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110 #: ports/nrf/common-hal/pulseio/PulseOut.c:107 +#: shared-bindings/pulseio/PWMOut.c:119 msgid "All timers in use" msgstr "Semua timer sedang digunakan" @@ -387,17 +393,12 @@ msgstr "" "Tidak dapat melakukan reset ke bootloader karena tidak ada bootloader yang " "terisi" -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:120 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:369 -#: ports/nrf/common-hal/pulseio/PWMOut.c:119 -#: ports/nrf/common-hal/pulseio/PWMOut.c:233 +#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:394 +#: ports/nrf/common-hal/pulseio/PWMOut.c:259 +#: shared-bindings/pulseio/PWMOut.c:115 msgid "Invalid PWM frequency" msgstr "Frekuensi PWM tidak valid" -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:187 -msgid "All timers for this pin are in use" -msgstr "Semua timer untuk pin ini sedang digunakan" - #: ports/atmel-samd/common-hal/pulseio/PulseIn.c:110 msgid "No hardware support on pin" msgstr "Tidak ada dukungan hardware untuk pin" @@ -687,13 +688,13 @@ msgid "Data too large for advertisement packet" msgstr "Tidak bisa menyesuaikan data ke dalam paket advertisment" #: ports/nrf/common-hal/bleio/Broadcaster.c:83 -#: ports/nrf/common-hal/bleio/Peripheral.c:324 +#: ports/nrf/common-hal/bleio/Peripheral.c:332 #, fuzzy, c-format msgid "Failed to start advertising, err 0x%04x" msgstr "Gagal untuk memulai advertisement, status: 0x%08lX" #: ports/nrf/common-hal/bleio/Broadcaster.c:96 -#: ports/nrf/common-hal/bleio/Peripheral.c:336 +#: ports/nrf/common-hal/bleio/Peripheral.c:344 #, fuzzy, c-format msgid "Failed to stop advertising, err 0x%04x" msgstr "Gagal untuk memberhentikan advertisement, status: 0x%08lX" @@ -803,7 +804,7 @@ msgstr "Gagal untuk melakukan scanning, status: 0x%08lX" msgid "Failed to create mutex" msgstr "Gagal untuk membuat mutex, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/Peripheral.c:304 +#: ports/nrf/common-hal/bleio/Peripheral.c:312 #, fuzzy, c-format msgid "Failed to add service, err 0x%04x" msgstr "Gagal untuk menambahkan layanan, status: 0x%08lX" @@ -875,10 +876,6 @@ msgstr "busio.UART tidak tersedia" msgid "Cannot get temperature" msgstr "Tidak bisa mendapatkan temperatur. status: 0x%02x" -#: ports/nrf/common-hal/pulseio/PWMOut.c:161 -msgid "All PWM peripherals are in use" -msgstr "Semua perangkat PWM sedang digunakan" - #: ports/unix/modffi.c:138 msgid "Unknown type" msgstr "Tipe tidak diketahui" @@ -2250,19 +2247,19 @@ msgstr "" msgid "Not connected." msgstr "" -#: shared-bindings/bleio/Device.c:210 +#: shared-bindings/bleio/Device.c:213 msgid "Can't add services in Central mode" msgstr "" -#: shared-bindings/bleio/Device.c:226 +#: shared-bindings/bleio/Device.c:229 msgid "Can't connect in Peripheral mode" msgstr "" -#: shared-bindings/bleio/Device.c:256 +#: shared-bindings/bleio/Device.c:259 msgid "Can't change the name in Central mode" msgstr "" -#: shared-bindings/bleio/Device.c:277 shared-bindings/bleio/Device.c:313 +#: shared-bindings/bleio/Device.c:280 shared-bindings/bleio/Device.c:316 msgid "Can't advertise in Central mode" msgstr "" @@ -2358,24 +2355,24 @@ msgstr "" msgid "color should be an int" msgstr "" -#: shared-bindings/displayio/Display.c:119 +#: shared-bindings/displayio/Display.c:124 msgid "Too many displays" msgstr "" -#: shared-bindings/displayio/Display.c:138 +#: shared-bindings/displayio/Display.c:145 msgid "Must be a Group subclass." msgstr "" +#: shared-bindings/displayio/Display.c:187 +#: shared-bindings/displayio/Display.c:197 +msgid "Brightness not adjustable" +msgstr "" + #: shared-bindings/displayio/FourWire.c:93 #: shared-bindings/displayio/ParallelBus.c:98 msgid "Too many display busses" msgstr "" -#: shared-bindings/displayio/FourWire.c:106 -#: shared-bindings/displayio/ParallelBus.c:110 -msgid "displayio is a work in progress" -msgstr "" - #: shared-bindings/displayio/Group.c:62 msgid "Group must have size at least 1" msgstr "" @@ -2409,15 +2406,23 @@ msgstr "" msgid "end_x should be an int" msgstr "" -#: shared-bindings/displayio/Sprite.c:49 +#: shared-bindings/displayio/TileGrid.c:49 msgid "position must be 2-tuple" msgstr "" -#: shared-bindings/displayio/Sprite.c:102 +#: shared-bindings/displayio/TileGrid.c:117 msgid "unsupported bitmap type" msgstr "" -#: shared-bindings/displayio/Sprite.c:167 +#: shared-bindings/displayio/TileGrid.c:128 +msgid "Tile width must exactly divide bitmap width" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c:131 +msgid "Tile height must exactly divide bitmap height" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c:198 msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" msgstr "" @@ -2444,6 +2449,7 @@ msgstr "" #: shared-bindings/microcontroller/Pin.c:89 #: shared-bindings/neopixel_write/__init__.c:67 #: shared-bindings/pulseio/PulseOut.c:76 +#: shared-bindings/terminalio/Terminal.c:63 msgid "Expected a %q" msgstr "" @@ -2479,12 +2485,16 @@ msgstr "" msgid "No hardware random available" msgstr "" -#: shared-bindings/pulseio/PWMOut.c:162 +#: shared-bindings/pulseio/PWMOut.c:117 +msgid "All timers for this pin are in use" +msgstr "Semua timer untuk pin ini sedang digunakan" + +#: shared-bindings/pulseio/PWMOut.c:171 msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" msgstr "" -#: shared-bindings/pulseio/PWMOut.c:193 +#: shared-bindings/pulseio/PWMOut.c:202 msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "" @@ -2550,6 +2560,11 @@ msgstr "" msgid "Stack size must be at least 256" msgstr "" +#: shared-bindings/terminalio/Terminal.c:68 +#, fuzzy +msgid "unicode_characters must be a string" +msgstr "keyword harus berupa string" + #: shared-bindings/time/__init__.c:78 msgid "sleep length must be non-negative" msgstr "" @@ -2672,7 +2687,7 @@ msgstr "" msgid "row must be packed and word aligned" msgstr "" -#: shared-module/displayio/Display.c:62 +#: shared-module/displayio/Display.c:69 #, fuzzy msgid "Unsupported display bus type" msgstr "Baudrate tidak didukung" @@ -2682,7 +2697,7 @@ msgid "Group full" msgstr "" #: shared-module/displayio/Group.c:46 -msgid "Layer must be a Group or Sprite subclass." +msgid "Layer must be a Group or TileGrid subclass." msgstr "" #: shared-module/displayio/Group.c:55 @@ -2819,13 +2834,27 @@ msgid "" "exit safe mode.\n" msgstr "" +#, fuzzy +#~ msgid "unpack requires a buffer of %d bytes" +#~ msgstr "Gagal untuk megalokasikan buffer RX dari %d byte" + +#~ msgid "All PWM peripherals are in use" +#~ msgstr "Semua perangkat PWM sedang digunakan" + +#~ msgid "Invalid UUID parameter" +#~ msgstr "Parameter UUID tidak valid" + +#~ msgid "Invalid UUID string length" +#~ msgstr "Panjang string UUID tidak valid" + #~ msgid "" #~ "Please file an issue here with the contents of your CIRCUITPY drive:\n" #~ msgstr "" #~ "Silahkan taruh masalah disini dengan isi dari CIRCUITPY drive: anda \n" -#~ msgid "Invalid UUID string length" -#~ msgstr "Panjang string UUID tidak valid" +#~ msgid "Looks like our core CircuitPython code crashed hard. Whoops!\n" +#~ msgstr "" +#~ "Sepertinya inti kode CircuitPython kita crash dengan sangat keras. Ups!\n" #~ msgid "" #~ "enough power for the whole circuit and press reset (after ejecting " @@ -2833,14 +2862,3 @@ msgstr "" #~ msgstr "" #~ "tegangan cukup untuk semua sirkuit dan tekan reset (setelah mencabut " #~ "CIRCUITPY).\n" - -#~ msgid "Looks like our core CircuitPython code crashed hard. Whoops!\n" -#~ msgstr "" -#~ "Sepertinya inti kode CircuitPython kita crash dengan sangat keras. Ups!\n" - -#~ msgid "Invalid UUID parameter" -#~ msgstr "Parameter UUID tidak valid" - -#, fuzzy -#~ msgid "unpack requires a buffer of %d bytes" -#~ msgstr "Gagal untuk megalokasikan buffer RX dari %d byte" diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 977cbca27..5cc476bb6 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-01-22 14:00-0800\n" +"POT-Creation-Date: 2019-01-31 09:38-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -151,37 +151,43 @@ msgstr "" msgid "script compilation not supported" msgstr "" -#: main.c:155 +#: main.c:152 msgid " output:\n" msgstr "" -#: main.c:169 main.c:247 +#: main.c:166 main.c:247 msgid "" "Auto-reload is on. Simply save files over USB to run them or enter REPL to " "disable.\n" msgstr "" -#: main.c:171 +#: main.c:168 msgid "Running in safe mode! Auto-reload is off.\n" msgstr "" -#: main.c:173 main.c:249 +#: main.c:170 main.c:249 msgid "Auto-reload is off.\n" msgstr "" -#: main.c:187 +#: main.c:184 msgid "Running in safe mode! Not running saved code.\n" msgstr "" -#: main.c:203 +#: main.c:200 msgid "WARNING: Your code filename has two extensions\n" msgstr "" +#: main.c:221 +msgid "" +"\n" +"Code done running. Waiting for reload.\n" +msgstr "" + #: main.c:254 msgid "Press any key to enter the REPL. Use CTRL-D to reload." msgstr "" -#: main.c:417 +#: main.c:419 msgid "soft reboot\n" msgstr "" @@ -276,8 +282,8 @@ msgid "Right channel unsupported" msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c:139 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:116 #: ports/atmel-samd/common-hal/touchio/TouchIn.c:65 +#: shared-bindings/pulseio/PWMOut.c:113 msgid "Invalid pin" msgstr "" @@ -294,9 +300,9 @@ msgid "Cannot output both channels on the same pin" msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c:243 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189 #: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110 #: ports/nrf/common-hal/pulseio/PulseOut.c:107 +#: shared-bindings/pulseio/PWMOut.c:119 msgid "All timers in use" msgstr "" @@ -378,17 +384,12 @@ msgstr "" msgid "Cannot reset into bootloader because no bootloader is present." msgstr "" -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:120 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:369 -#: ports/nrf/common-hal/pulseio/PWMOut.c:119 -#: ports/nrf/common-hal/pulseio/PWMOut.c:233 +#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:394 +#: ports/nrf/common-hal/pulseio/PWMOut.c:259 +#: shared-bindings/pulseio/PWMOut.c:115 msgid "Invalid PWM frequency" msgstr "" -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:187 -msgid "All timers for this pin are in use" -msgstr "" - #: ports/atmel-samd/common-hal/pulseio/PulseIn.c:110 msgid "No hardware support on pin" msgstr "" @@ -672,13 +673,13 @@ msgid "Data too large for advertisement packet" msgstr "" #: ports/nrf/common-hal/bleio/Broadcaster.c:83 -#: ports/nrf/common-hal/bleio/Peripheral.c:324 +#: ports/nrf/common-hal/bleio/Peripheral.c:332 #, c-format msgid "Failed to start advertising, err 0x%04x" msgstr "" #: ports/nrf/common-hal/bleio/Broadcaster.c:96 -#: ports/nrf/common-hal/bleio/Peripheral.c:336 +#: ports/nrf/common-hal/bleio/Peripheral.c:344 #, c-format msgid "Failed to stop advertising, err 0x%04x" msgstr "" @@ -777,7 +778,7 @@ msgstr "" msgid "Failed to create mutex" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c:304 +#: ports/nrf/common-hal/bleio/Peripheral.c:312 #, c-format msgid "Failed to add service, err 0x%04x" msgstr "" @@ -848,10 +849,6 @@ msgstr "" msgid "Cannot get temperature" msgstr "" -#: ports/nrf/common-hal/pulseio/PWMOut.c:161 -msgid "All PWM peripherals are in use" -msgstr "" - #: ports/unix/modffi.c:138 msgid "Unknown type" msgstr "" @@ -2214,19 +2211,19 @@ msgstr "" msgid "Not connected." msgstr "" -#: shared-bindings/bleio/Device.c:210 +#: shared-bindings/bleio/Device.c:213 msgid "Can't add services in Central mode" msgstr "" -#: shared-bindings/bleio/Device.c:226 +#: shared-bindings/bleio/Device.c:229 msgid "Can't connect in Peripheral mode" msgstr "" -#: shared-bindings/bleio/Device.c:256 +#: shared-bindings/bleio/Device.c:259 msgid "Can't change the name in Central mode" msgstr "" -#: shared-bindings/bleio/Device.c:277 shared-bindings/bleio/Device.c:313 +#: shared-bindings/bleio/Device.c:280 shared-bindings/bleio/Device.c:316 msgid "Can't advertise in Central mode" msgstr "" @@ -2320,24 +2317,24 @@ msgstr "" msgid "color should be an int" msgstr "" -#: shared-bindings/displayio/Display.c:119 +#: shared-bindings/displayio/Display.c:124 msgid "Too many displays" msgstr "" -#: shared-bindings/displayio/Display.c:138 +#: shared-bindings/displayio/Display.c:145 msgid "Must be a Group subclass." msgstr "" +#: shared-bindings/displayio/Display.c:187 +#: shared-bindings/displayio/Display.c:197 +msgid "Brightness not adjustable" +msgstr "" + #: shared-bindings/displayio/FourWire.c:93 #: shared-bindings/displayio/ParallelBus.c:98 msgid "Too many display busses" msgstr "" -#: shared-bindings/displayio/FourWire.c:106 -#: shared-bindings/displayio/ParallelBus.c:110 -msgid "displayio is a work in progress" -msgstr "" - #: shared-bindings/displayio/Group.c:62 msgid "Group must have size at least 1" msgstr "" @@ -2371,15 +2368,23 @@ msgstr "" msgid "end_x should be an int" msgstr "" -#: shared-bindings/displayio/Sprite.c:49 +#: shared-bindings/displayio/TileGrid.c:49 msgid "position must be 2-tuple" msgstr "" -#: shared-bindings/displayio/Sprite.c:102 +#: shared-bindings/displayio/TileGrid.c:117 msgid "unsupported bitmap type" msgstr "" -#: shared-bindings/displayio/Sprite.c:167 +#: shared-bindings/displayio/TileGrid.c:128 +msgid "Tile width must exactly divide bitmap width" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c:131 +msgid "Tile height must exactly divide bitmap height" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c:198 msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" msgstr "" @@ -2406,6 +2411,7 @@ msgstr "" #: shared-bindings/microcontroller/Pin.c:89 #: shared-bindings/neopixel_write/__init__.c:67 #: shared-bindings/pulseio/PulseOut.c:76 +#: shared-bindings/terminalio/Terminal.c:63 msgid "Expected a %q" msgstr "" @@ -2441,12 +2447,16 @@ msgstr "" msgid "No hardware random available" msgstr "" -#: shared-bindings/pulseio/PWMOut.c:162 +#: shared-bindings/pulseio/PWMOut.c:117 +msgid "All timers for this pin are in use" +msgstr "" + +#: shared-bindings/pulseio/PWMOut.c:171 msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" msgstr "" -#: shared-bindings/pulseio/PWMOut.c:193 +#: shared-bindings/pulseio/PWMOut.c:202 msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "" @@ -2512,6 +2522,10 @@ msgstr "" msgid "Stack size must be at least 256" msgstr "" +#: shared-bindings/terminalio/Terminal.c:68 +msgid "unicode_characters must be a string" +msgstr "" + #: shared-bindings/time/__init__.c:78 msgid "sleep length must be non-negative" msgstr "" @@ -2634,7 +2648,7 @@ msgstr "" msgid "row must be packed and word aligned" msgstr "" -#: shared-module/displayio/Display.c:62 +#: shared-module/displayio/Display.c:69 msgid "Unsupported display bus type" msgstr "" @@ -2643,7 +2657,7 @@ msgid "Group full" msgstr "" #: shared-module/displayio/Group.c:46 -msgid "Layer must be a Group or Sprite subclass." +msgid "Layer must be a Group or TileGrid subclass." msgstr "" #: shared-module/displayio/Group.c:55 diff --git a/locale/de_DE.po b/locale/de_DE.po index 7eeb6e3eb..dc3dd18aa 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-01-22 15:57-0800\n" +"POT-Creation-Date: 2019-01-31 09:38-0800\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: Sebastian Plamauer\n" "Language-Team: \n" @@ -151,11 +151,11 @@ msgstr "ungültige argumente" msgid "script compilation not supported" msgstr "kompilieren von Skripten ist nicht unterstützt" -#: main.c:155 +#: main.c:152 msgid " output:\n" msgstr " Ausgabe:\n" -#: main.c:169 main.c:247 +#: main.c:166 main.c:247 msgid "" "Auto-reload is on. Simply save files over USB to run them or enter REPL to " "disable.\n" @@ -163,28 +163,36 @@ msgstr "" "Automatisches Neuladen ist aktiv. Speichere Dateien über USB um sie " "auszuführen oder verbinde dich mit der REPL zum deaktivieren.\n" -#: main.c:171 +#: main.c:168 msgid "Running in safe mode! Auto-reload is off.\n" msgstr "Sicherheitsmodus aktiv! Automatisches Neuladen ist deaktiviert.\n" -#: main.c:173 main.c:249 +#: main.c:170 main.c:249 msgid "Auto-reload is off.\n" msgstr "Automatisches Neuladen ist deaktiviert.\n" -#: main.c:187 +#: main.c:184 msgid "Running in safe mode! Not running saved code.\n" msgstr "Sicherheitsmodus aktiv! Gespeicherter Code wird nicht ausgeführt\n" -#: main.c:203 +#: main.c:200 msgid "WARNING: Your code filename has two extensions\n" -msgstr "WARNUNG: Der Dateiname deines Programms hat zwei Dateityperweiterungen\n" +msgstr "" +"WARNUNG: Der Dateiname deines Programms hat zwei Dateityperweiterungen\n" + +#: main.c:221 +msgid "" +"\n" +"Code done running. Waiting for reload.\n" +msgstr "" #: main.c:254 msgid "Press any key to enter the REPL. Use CTRL-D to reload." msgstr "" -"Drücke eine Taste um dich mit der REPL zu verbinden. Drücke Strg-D zum neu laden" +"Drücke eine Taste um dich mit der REPL zu verbinden. Drücke Strg-D zum neu " +"laden" -#: main.c:417 +#: main.c:419 msgid "soft reboot\n" msgstr "soft reboot\n" @@ -279,8 +287,8 @@ msgid "Right channel unsupported" msgstr "Rechter Kanal wird nicht unterstützt" #: ports/atmel-samd/common-hal/audioio/AudioOut.c:139 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:116 #: ports/atmel-samd/common-hal/touchio/TouchIn.c:65 +#: shared-bindings/pulseio/PWMOut.c:113 msgid "Invalid pin" msgstr "Ungültiger Pin" @@ -297,9 +305,9 @@ msgid "Cannot output both channels on the same pin" msgstr "Kann nicht beite Kanäle auf dem gleichen Pin ausgeben" #: ports/atmel-samd/common-hal/audioio/AudioOut.c:243 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189 #: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110 #: ports/nrf/common-hal/pulseio/PulseOut.c:107 +#: shared-bindings/pulseio/PWMOut.c:119 msgid "All timers in use" msgstr "Alle timer werden benutzt" @@ -381,17 +389,12 @@ msgstr "Bus pin %d wird schon benutzt" msgid "Cannot reset into bootloader because no bootloader is present." msgstr "Reset zum bootloader nicht möglich da bootloader nicht vorhanden" -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:120 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:369 -#: ports/nrf/common-hal/pulseio/PWMOut.c:119 -#: ports/nrf/common-hal/pulseio/PWMOut.c:233 +#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:394 +#: ports/nrf/common-hal/pulseio/PWMOut.c:259 +#: shared-bindings/pulseio/PWMOut.c:115 msgid "Invalid PWM frequency" msgstr "Ungültige PWM Frequenz" -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:187 -msgid "All timers for this pin are in use" -msgstr "Alle timer für diesen Pin werden benutzt" - #: ports/atmel-samd/common-hal/pulseio/PulseIn.c:110 msgid "No hardware support on pin" msgstr "Keine Hardwareunterstützung an diesem Pin" @@ -679,13 +682,13 @@ msgid "Data too large for advertisement packet" msgstr "Zu vielen Daten für das advertisement packet" #: ports/nrf/common-hal/bleio/Broadcaster.c:83 -#: ports/nrf/common-hal/bleio/Peripheral.c:324 +#: ports/nrf/common-hal/bleio/Peripheral.c:332 #, c-format msgid "Failed to start advertising, err 0x%04x" msgstr "Kann advertisement nicht starten. Status: 0x%04x" #: ports/nrf/common-hal/bleio/Broadcaster.c:96 -#: ports/nrf/common-hal/bleio/Peripheral.c:336 +#: ports/nrf/common-hal/bleio/Peripheral.c:344 #, c-format msgid "Failed to stop advertising, err 0x%04x" msgstr "Kann advertisement nicht stoppen. Status: 0x%04x" @@ -784,7 +787,7 @@ msgstr "Der Scanvorgang kann nicht gestartet werden" msgid "Failed to create mutex" msgstr "Erstellen des Mutex ist fehlgeschlagen" -#: ports/nrf/common-hal/bleio/Peripheral.c:304 +#: ports/nrf/common-hal/bleio/Peripheral.c:312 #, c-format msgid "Failed to add service, err 0x%04x" msgstr "Dienst konnte nicht hinzugefügt werden. Status: 0x%04x" @@ -855,10 +858,6 @@ msgstr "busio.UART nicht verfügbar" msgid "Cannot get temperature" msgstr "Kann Temperatur nicht holen" -#: ports/nrf/common-hal/pulseio/PWMOut.c:161 -msgid "All PWM peripherals are in use" -msgstr "Alle PWM-Peripheriegeräte werden verwendet" - #: ports/unix/modffi.c:138 msgid "Unknown type" msgstr "Unbekannter Typ" @@ -887,7 +886,8 @@ msgstr "Funktion akzeptiert keine Keyword-Argumente" #: py/argcheck.c:63 py/bc.c:85 py/objnamedtuple.c:108 #, c-format msgid "function takes %d positional arguments but %d were given" -msgstr "Funktion nimmt %d Argumente ohne Keyword an, aber es wurden %d angegeben" +msgstr "" +"Funktion nimmt %d Argumente ohne Keyword an, aber es wurden %d angegeben" #: py/argcheck.c:73 #, c-format @@ -917,7 +917,9 @@ msgstr "Anzahl/Type der Argumente passen nicht" #: py/argcheck.c:156 msgid "keyword argument(s) not yet implemented - use normal args instead" -msgstr "Keyword-Argument(e) noch nicht implementiert - verwenden Sie stattdessen normale Argumente" +msgstr "" +"Keyword-Argument(e) noch nicht implementiert - verwenden Sie stattdessen " +"normale Argumente" #: py/bc.c:88 py/objnamedtuple.c:112 msgid "%q() takes %d positional arguments but %d were given" @@ -1864,13 +1866,15 @@ msgstr "" #: py/parse.c:1170 msgid "unexpected indent" -msgstr "unerwarteter Einzug (Einrückung) " -"Bitte Leerzeichen am Zeilenanfang kontrollieren!" +msgstr "" +"unerwarteter Einzug (Einrückung) Bitte Leerzeichen am Zeilenanfang " +"kontrollieren!" #: py/parse.c:1173 msgid "unindent does not match any outer indentation level" -msgstr "Einrückung entspricht keiner äußeren Einrückungsebene. " -"Bitte Leerzeichen am Zeilenanfang kontrollieren!" +msgstr "" +"Einrückung entspricht keiner äußeren Einrückungsebene. Bitte Leerzeichen am " +"Zeilenanfang kontrollieren!" #: py/parsenum.c:60 msgid "int() arg 2 must be >= 2 and <= 36" @@ -1898,8 +1902,8 @@ msgid "" "Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" "mpy-update for more info." msgstr "" -"Inkompatible mpy-Datei. Bitte aktualisieren Sie alle mpy-Dateien. Siehe http://adafru.it/" -"mpy-update für weitere Informationen." +"Inkompatible mpy-Datei. Bitte aktualisieren Sie alle mpy-Dateien. Siehe " +"http://adafru.it/mpy-update für weitere Informationen." #: py/persistentcode.c:326 msgid "can only save bytecode" @@ -2231,19 +2235,19 @@ msgstr "Schreiben von CharacteristicBuffer ist nicht vorgesehen" msgid "Not connected." msgstr "" -#: shared-bindings/bleio/Device.c:210 +#: shared-bindings/bleio/Device.c:213 msgid "Can't add services in Central mode" msgstr "" -#: shared-bindings/bleio/Device.c:226 +#: shared-bindings/bleio/Device.c:229 msgid "Can't connect in Peripheral mode" msgstr "" -#: shared-bindings/bleio/Device.c:256 +#: shared-bindings/bleio/Device.c:259 msgid "Can't change the name in Central mode" msgstr "" -#: shared-bindings/bleio/Device.c:277 shared-bindings/bleio/Device.c:313 +#: shared-bindings/bleio/Device.c:280 shared-bindings/bleio/Device.c:316 msgid "Can't advertise in Central mode" msgstr "" @@ -2337,24 +2341,24 @@ msgstr "" msgid "color should be an int" msgstr "" -#: shared-bindings/displayio/Display.c:119 +#: shared-bindings/displayio/Display.c:124 msgid "Too many displays" msgstr "" -#: shared-bindings/displayio/Display.c:138 +#: shared-bindings/displayio/Display.c:145 msgid "Must be a Group subclass." msgstr "" +#: shared-bindings/displayio/Display.c:187 +#: shared-bindings/displayio/Display.c:197 +msgid "Brightness not adjustable" +msgstr "" + #: shared-bindings/displayio/FourWire.c:93 #: shared-bindings/displayio/ParallelBus.c:98 msgid "Too many display busses" msgstr "" -#: shared-bindings/displayio/FourWire.c:106 -#: shared-bindings/displayio/ParallelBus.c:110 -msgid "displayio is a work in progress" -msgstr "" - #: shared-bindings/displayio/Group.c:62 msgid "Group must have size at least 1" msgstr "" @@ -2388,15 +2392,23 @@ msgstr "" msgid "end_x should be an int" msgstr "" -#: shared-bindings/displayio/Sprite.c:49 +#: shared-bindings/displayio/TileGrid.c:49 msgid "position must be 2-tuple" msgstr "" -#: shared-bindings/displayio/Sprite.c:102 +#: shared-bindings/displayio/TileGrid.c:117 msgid "unsupported bitmap type" msgstr "Nicht unterstützter Bitmap-Typ" -#: shared-bindings/displayio/Sprite.c:167 +#: shared-bindings/displayio/TileGrid.c:128 +msgid "Tile width must exactly divide bitmap width" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c:131 +msgid "Tile height must exactly divide bitmap height" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c:198 msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" msgstr "" @@ -2423,6 +2435,7 @@ msgstr "" #: shared-bindings/microcontroller/Pin.c:89 #: shared-bindings/neopixel_write/__init__.c:67 #: shared-bindings/pulseio/PulseOut.c:76 +#: shared-bindings/terminalio/Terminal.c:63 msgid "Expected a %q" msgstr "" @@ -2458,12 +2471,16 @@ msgstr "" msgid "No hardware random available" msgstr "" -#: shared-bindings/pulseio/PWMOut.c:162 +#: shared-bindings/pulseio/PWMOut.c:117 +msgid "All timers for this pin are in use" +msgstr "Alle timer für diesen Pin werden benutzt" + +#: shared-bindings/pulseio/PWMOut.c:171 msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" msgstr "" -#: shared-bindings/pulseio/PWMOut.c:193 +#: shared-bindings/pulseio/PWMOut.c:202 msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "" @@ -2529,6 +2546,11 @@ msgstr "" msgid "Stack size must be at least 256" msgstr "" +#: shared-bindings/terminalio/Terminal.c:68 +#, fuzzy +msgid "unicode_characters must be a string" +msgstr "name muss ein String sein" + #: shared-bindings/time/__init__.c:78 msgid "sleep length must be non-negative" msgstr "" @@ -2651,7 +2673,7 @@ msgstr "" msgid "row must be packed and word aligned" msgstr "" -#: shared-module/displayio/Display.c:62 +#: shared-module/displayio/Display.c:69 msgid "Unsupported display bus type" msgstr "Nicht unterstützter display bus type" @@ -2660,7 +2682,7 @@ msgid "Group full" msgstr "" #: shared-module/displayio/Group.c:46 -msgid "Layer must be a Group or Sprite subclass." +msgid "Layer must be a Group or TileGrid subclass." msgstr "" #: shared-module/displayio/Group.c:55 @@ -2782,8 +2804,8 @@ msgid "" msgstr "" "Die Stromversorgung des Mikrocontrollers ist eingebrochen. Stelle sicher, " "dass deine Stromversorgung genug Leistung für die gesamte Schaltung zur " -"Verfügung stellt und drücke die Reset-Taste (nach Auswurf " -"des CIRCUITPY-Laufwerks)\n" +"Verfügung stellt und drücke die Reset-Taste (nach Auswurf des CIRCUITPY-" +"Laufwerks)\n" #: supervisor/shared/safe_mode.c:120 msgid "" @@ -2796,15 +2818,17 @@ msgstr "" "Der CircuitPython-Heap war beschädigt, weil der Stack zu klein war.\n" "Bitte erhöhe die stack size limits und drücke die Reset-Taste (nach Auswurf " "des CIRCUITPY-Laufwerks)\n" -"Wenn du den Stack nicht geändert hast, melde bitte das Problem unter " -"https://github.com/adafruit/circuitpython/issues\n" +"Wenn du den Stack nicht geändert hast, melde bitte das Problem unter https://" +"github.com/adafruit/circuitpython/issues\n" "mit dem Inhalt deines CIRCUITPY-Laufwerks.\n" - #: supervisor/shared/safe_mode.c:123 msgid "" "The reset button was pressed while booting CircuitPython. Press again to " "exit safe mode.\n" msgstr "" -"Die Reset-Taste wurde beim Booten von CircuitPython gedrückt. Drücke sie erneut " -"um den abgesicherten Modus zu verlassen. \n" +"Die Reset-Taste wurde beim Booten von CircuitPython gedrückt. Drücke sie " +"erneut um den abgesicherten Modus zu verlassen. \n" + +#~ msgid "All PWM peripherals are in use" +#~ msgstr "Alle PWM-Peripheriegeräte werden verwendet" diff --git a/locale/en_US.po b/locale/en_US.po index 30fcbafac..a9c63f507 100644 --- a/locale/en_US.po +++ b/locale/en_US.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-01-22 14:00-0800\n" +"POT-Creation-Date: 2019-01-31 09:38-0800\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: \n" "Language-Team: \n" @@ -151,37 +151,43 @@ msgstr "" msgid "script compilation not supported" msgstr "" -#: main.c:155 +#: main.c:152 msgid " output:\n" msgstr "" -#: main.c:169 main.c:247 +#: main.c:166 main.c:247 msgid "" "Auto-reload is on. Simply save files over USB to run them or enter REPL to " "disable.\n" msgstr "" -#: main.c:171 +#: main.c:168 msgid "Running in safe mode! Auto-reload is off.\n" msgstr "" -#: main.c:173 main.c:249 +#: main.c:170 main.c:249 msgid "Auto-reload is off.\n" msgstr "" -#: main.c:187 +#: main.c:184 msgid "Running in safe mode! Not running saved code.\n" msgstr "" -#: main.c:203 +#: main.c:200 msgid "WARNING: Your code filename has two extensions\n" msgstr "" +#: main.c:221 +msgid "" +"\n" +"Code done running. Waiting for reload.\n" +msgstr "" + #: main.c:254 msgid "Press any key to enter the REPL. Use CTRL-D to reload." msgstr "" -#: main.c:417 +#: main.c:419 msgid "soft reboot\n" msgstr "" @@ -276,8 +282,8 @@ msgid "Right channel unsupported" msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c:139 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:116 #: ports/atmel-samd/common-hal/touchio/TouchIn.c:65 +#: shared-bindings/pulseio/PWMOut.c:113 msgid "Invalid pin" msgstr "" @@ -294,9 +300,9 @@ msgid "Cannot output both channels on the same pin" msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c:243 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189 #: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110 #: ports/nrf/common-hal/pulseio/PulseOut.c:107 +#: shared-bindings/pulseio/PWMOut.c:119 msgid "All timers in use" msgstr "" @@ -378,17 +384,12 @@ msgstr "" msgid "Cannot reset into bootloader because no bootloader is present." msgstr "" -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:120 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:369 -#: ports/nrf/common-hal/pulseio/PWMOut.c:119 -#: ports/nrf/common-hal/pulseio/PWMOut.c:233 +#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:394 +#: ports/nrf/common-hal/pulseio/PWMOut.c:259 +#: shared-bindings/pulseio/PWMOut.c:115 msgid "Invalid PWM frequency" msgstr "" -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:187 -msgid "All timers for this pin are in use" -msgstr "" - #: ports/atmel-samd/common-hal/pulseio/PulseIn.c:110 msgid "No hardware support on pin" msgstr "" @@ -672,13 +673,13 @@ msgid "Data too large for advertisement packet" msgstr "" #: ports/nrf/common-hal/bleio/Broadcaster.c:83 -#: ports/nrf/common-hal/bleio/Peripheral.c:324 +#: ports/nrf/common-hal/bleio/Peripheral.c:332 #, c-format msgid "Failed to start advertising, err 0x%04x" msgstr "" #: ports/nrf/common-hal/bleio/Broadcaster.c:96 -#: ports/nrf/common-hal/bleio/Peripheral.c:336 +#: ports/nrf/common-hal/bleio/Peripheral.c:344 #, c-format msgid "Failed to stop advertising, err 0x%04x" msgstr "" @@ -777,7 +778,7 @@ msgstr "" msgid "Failed to create mutex" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c:304 +#: ports/nrf/common-hal/bleio/Peripheral.c:312 #, c-format msgid "Failed to add service, err 0x%04x" msgstr "" @@ -848,10 +849,6 @@ msgstr "" msgid "Cannot get temperature" msgstr "" -#: ports/nrf/common-hal/pulseio/PWMOut.c:161 -msgid "All PWM peripherals are in use" -msgstr "" - #: ports/unix/modffi.c:138 msgid "Unknown type" msgstr "" @@ -2214,19 +2211,19 @@ msgstr "" msgid "Not connected." msgstr "" -#: shared-bindings/bleio/Device.c:210 +#: shared-bindings/bleio/Device.c:213 msgid "Can't add services in Central mode" msgstr "" -#: shared-bindings/bleio/Device.c:226 +#: shared-bindings/bleio/Device.c:229 msgid "Can't connect in Peripheral mode" msgstr "" -#: shared-bindings/bleio/Device.c:256 +#: shared-bindings/bleio/Device.c:259 msgid "Can't change the name in Central mode" msgstr "" -#: shared-bindings/bleio/Device.c:277 shared-bindings/bleio/Device.c:313 +#: shared-bindings/bleio/Device.c:280 shared-bindings/bleio/Device.c:316 msgid "Can't advertise in Central mode" msgstr "" @@ -2320,24 +2317,24 @@ msgstr "" msgid "color should be an int" msgstr "" -#: shared-bindings/displayio/Display.c:119 +#: shared-bindings/displayio/Display.c:124 msgid "Too many displays" msgstr "" -#: shared-bindings/displayio/Display.c:138 +#: shared-bindings/displayio/Display.c:145 msgid "Must be a Group subclass." msgstr "" +#: shared-bindings/displayio/Display.c:187 +#: shared-bindings/displayio/Display.c:197 +msgid "Brightness not adjustable" +msgstr "" + #: shared-bindings/displayio/FourWire.c:93 #: shared-bindings/displayio/ParallelBus.c:98 msgid "Too many display busses" msgstr "" -#: shared-bindings/displayio/FourWire.c:106 -#: shared-bindings/displayio/ParallelBus.c:110 -msgid "displayio is a work in progress" -msgstr "" - #: shared-bindings/displayio/Group.c:62 msgid "Group must have size at least 1" msgstr "" @@ -2371,15 +2368,23 @@ msgstr "" msgid "end_x should be an int" msgstr "" -#: shared-bindings/displayio/Sprite.c:49 +#: shared-bindings/displayio/TileGrid.c:49 msgid "position must be 2-tuple" msgstr "" -#: shared-bindings/displayio/Sprite.c:102 +#: shared-bindings/displayio/TileGrid.c:117 msgid "unsupported bitmap type" msgstr "" -#: shared-bindings/displayio/Sprite.c:167 +#: shared-bindings/displayio/TileGrid.c:128 +msgid "Tile width must exactly divide bitmap width" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c:131 +msgid "Tile height must exactly divide bitmap height" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c:198 msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" msgstr "" @@ -2406,6 +2411,7 @@ msgstr "" #: shared-bindings/microcontroller/Pin.c:89 #: shared-bindings/neopixel_write/__init__.c:67 #: shared-bindings/pulseio/PulseOut.c:76 +#: shared-bindings/terminalio/Terminal.c:63 msgid "Expected a %q" msgstr "" @@ -2441,12 +2447,16 @@ msgstr "" msgid "No hardware random available" msgstr "" -#: shared-bindings/pulseio/PWMOut.c:162 +#: shared-bindings/pulseio/PWMOut.c:117 +msgid "All timers for this pin are in use" +msgstr "" + +#: shared-bindings/pulseio/PWMOut.c:171 msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" msgstr "" -#: shared-bindings/pulseio/PWMOut.c:193 +#: shared-bindings/pulseio/PWMOut.c:202 msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "" @@ -2512,6 +2522,10 @@ msgstr "" msgid "Stack size must be at least 256" msgstr "" +#: shared-bindings/terminalio/Terminal.c:68 +msgid "unicode_characters must be a string" +msgstr "" + #: shared-bindings/time/__init__.c:78 msgid "sleep length must be non-negative" msgstr "" @@ -2634,7 +2648,7 @@ msgstr "" msgid "row must be packed and word aligned" msgstr "" -#: shared-module/displayio/Display.c:62 +#: shared-module/displayio/Display.c:69 msgid "Unsupported display bus type" msgstr "" @@ -2643,7 +2657,7 @@ msgid "Group full" msgstr "" #: shared-module/displayio/Group.c:46 -msgid "Layer must be a Group or Sprite subclass." +msgid "Layer must be a Group or TileGrid subclass." msgstr "" #: shared-module/displayio/Group.c:55 diff --git a/locale/es.po b/locale/es.po index f025a49fd..ce16e770f 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-01-22 14:00-0800\n" +"POT-Creation-Date: 2019-01-31 09:38-0800\n" "PO-Revision-Date: 2018-08-24 22:56-0500\n" "Last-Translator: \n" "Language-Team: \n" @@ -152,11 +152,11 @@ msgstr "argumentos inválidos" msgid "script compilation not supported" msgstr "script de compilación no soportado" -#: main.c:155 +#: main.c:152 msgid " output:\n" msgstr " salida:\n" -#: main.c:169 main.c:247 +#: main.c:166 main.c:247 msgid "" "Auto-reload is on. Simply save files over USB to run them or enter REPL to " "disable.\n" @@ -164,28 +164,34 @@ msgstr "" "Auto-reload habilitado. Simplemente guarda los archivos via USB para " "ejecutarlos o entra al REPL para desabilitarlos.\n" -#: main.c:171 +#: main.c:168 msgid "Running in safe mode! Auto-reload is off.\n" msgstr "Ejecutando en modo seguro! La auto-recarga esta deshabilitada.\n" -#: main.c:173 main.c:249 +#: main.c:170 main.c:249 msgid "Auto-reload is off.\n" msgstr "Auto-recarga deshabilitada.\n" -#: main.c:187 +#: main.c:184 msgid "Running in safe mode! Not running saved code.\n" msgstr "Ejecutando en modo seguro! No se esta ejecutando el código guardado.\n" -#: main.c:203 +#: main.c:200 msgid "WARNING: Your code filename has two extensions\n" msgstr "ADVERTENCIA: El nombre de archivo de tu código tiene dos extensiones\n" +#: main.c:221 +msgid "" +"\n" +"Code done running. Waiting for reload.\n" +msgstr "" + #: main.c:254 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." -#: main.c:417 +#: main.c:419 msgid "soft reboot\n" msgstr "reinicio suave\n" @@ -282,8 +288,8 @@ msgid "Right channel unsupported" msgstr "Canal derecho no soportado" #: ports/atmel-samd/common-hal/audioio/AudioOut.c:139 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:116 #: ports/atmel-samd/common-hal/touchio/TouchIn.c:65 +#: shared-bindings/pulseio/PWMOut.c:113 msgid "Invalid pin" msgstr "Pin inválido" @@ -300,9 +306,9 @@ msgid "Cannot output both channels on the same pin" msgstr "No se puede tener ambos canales en el mismo pin" #: ports/atmel-samd/common-hal/audioio/AudioOut.c:243 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189 #: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110 #: ports/nrf/common-hal/pulseio/PulseOut.c:107 +#: shared-bindings/pulseio/PWMOut.c:119 msgid "All timers in use" msgstr "Todos los timers en uso" @@ -385,17 +391,12 @@ msgstr "DAC ya está siendo utilizado" msgid "Cannot reset into bootloader because no bootloader is present." msgstr "No se puede reiniciar a bootloader porque no hay bootloader presente." -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:120 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:369 -#: ports/nrf/common-hal/pulseio/PWMOut.c:119 -#: ports/nrf/common-hal/pulseio/PWMOut.c:233 +#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:394 +#: ports/nrf/common-hal/pulseio/PWMOut.c:259 +#: shared-bindings/pulseio/PWMOut.c:115 msgid "Invalid PWM frequency" msgstr "Frecuencia PWM inválida" -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:187 -msgid "All timers for this pin are in use" -msgstr "Todos los timers para este pin están siendo utilizados" - #: ports/atmel-samd/common-hal/pulseio/PulseIn.c:110 msgid "No hardware support on pin" msgstr "Sin soporte de hardware en pin" @@ -684,13 +685,13 @@ msgid "Data too large for advertisement packet" msgstr "Los datos no caben en el paquete de anuncio." #: ports/nrf/common-hal/bleio/Broadcaster.c:83 -#: ports/nrf/common-hal/bleio/Peripheral.c:324 +#: ports/nrf/common-hal/bleio/Peripheral.c:332 #, fuzzy, c-format msgid "Failed to start advertising, err 0x%04x" msgstr "No se puede inicar el anuncio. status: 0x%02x" #: ports/nrf/common-hal/bleio/Broadcaster.c:96 -#: ports/nrf/common-hal/bleio/Peripheral.c:336 +#: ports/nrf/common-hal/bleio/Peripheral.c:344 #, fuzzy, c-format msgid "Failed to stop advertising, err 0x%04x" msgstr "No se puede detener el anuncio. status: 0x%02x" @@ -800,7 +801,7 @@ msgstr "No se puede iniciar el escaneo. status: 0x%02x" msgid "Failed to create mutex" msgstr "No se puede leer el valor del atributo. status 0x%02x" -#: ports/nrf/common-hal/bleio/Peripheral.c:304 +#: ports/nrf/common-hal/bleio/Peripheral.c:312 #, fuzzy, c-format msgid "Failed to add service, err 0x%04x" msgstr "No se puede detener el anuncio. status: 0x%02x" @@ -872,10 +873,6 @@ msgstr "busio.UART no disponible" msgid "Cannot get temperature" msgstr "No se puede obtener la temperatura. status: 0x%02x" -#: ports/nrf/common-hal/pulseio/PWMOut.c:161 -msgid "All PWM peripherals are in use" -msgstr "Todos los periféricos PWM en uso" - #: ports/unix/modffi.c:138 msgid "Unknown type" msgstr "Tipo desconocido" @@ -2271,19 +2268,19 @@ msgstr "" msgid "Not connected." msgstr "" -#: shared-bindings/bleio/Device.c:210 +#: shared-bindings/bleio/Device.c:213 msgid "Can't add services in Central mode" msgstr "No se pueden agregar servicio en modo Central" -#: shared-bindings/bleio/Device.c:226 +#: shared-bindings/bleio/Device.c:229 msgid "Can't connect in Peripheral mode" msgstr "No se puede conectar en modo Peripheral" -#: shared-bindings/bleio/Device.c:256 +#: shared-bindings/bleio/Device.c:259 msgid "Can't change the name in Central mode" msgstr "No se puede cambiar el nombre en modo Central" -#: shared-bindings/bleio/Device.c:277 shared-bindings/bleio/Device.c:313 +#: shared-bindings/bleio/Device.c:280 shared-bindings/bleio/Device.c:316 msgid "Can't advertise in Central mode" msgstr "" @@ -2379,24 +2376,24 @@ msgstr "row data debe ser un buffer" msgid "color should be an int" msgstr "color deberia ser un int" -#: shared-bindings/displayio/Display.c:119 +#: shared-bindings/displayio/Display.c:124 msgid "Too many displays" msgstr "" -#: shared-bindings/displayio/Display.c:138 +#: shared-bindings/displayio/Display.c:145 msgid "Must be a Group subclass." msgstr "" +#: shared-bindings/displayio/Display.c:187 +#: shared-bindings/displayio/Display.c:197 +msgid "Brightness not adjustable" +msgstr "" + #: shared-bindings/displayio/FourWire.c:93 #: shared-bindings/displayio/ParallelBus.c:98 msgid "Too many display busses" msgstr "" -#: shared-bindings/displayio/FourWire.c:106 -#: shared-bindings/displayio/ParallelBus.c:110 -msgid "displayio is a work in progress" -msgstr "displayio todavia esta en desarrollo" - #: shared-bindings/displayio/Group.c:62 msgid "Group must have size at least 1" msgstr "Group debe tener size de minimo 1" @@ -2432,15 +2429,23 @@ msgstr "y deberia ser un int" msgid "end_x should be an int" msgstr "y deberia ser un int" -#: shared-bindings/displayio/Sprite.c:49 +#: shared-bindings/displayio/TileGrid.c:49 msgid "position must be 2-tuple" msgstr "posición debe ser 2-tuple" -#: shared-bindings/displayio/Sprite.c:102 +#: shared-bindings/displayio/TileGrid.c:117 msgid "unsupported bitmap type" msgstr "tipo de bitmap no soportado" -#: shared-bindings/displayio/Sprite.c:167 +#: shared-bindings/displayio/TileGrid.c:128 +msgid "Tile width must exactly divide bitmap width" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c:131 +msgid "Tile height must exactly divide bitmap height" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c:198 msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" msgstr "pixel_shader debe ser displayio.Palette o displayio.ColorConverter" @@ -2467,6 +2472,7 @@ msgstr "addresses esta vacÃo" #: shared-bindings/microcontroller/Pin.c:89 #: shared-bindings/neopixel_write/__init__.c:67 #: shared-bindings/pulseio/PulseOut.c:76 +#: shared-bindings/terminalio/Terminal.c:63 msgid "Expected a %q" msgstr "Se espera un %q" @@ -2502,12 +2508,16 @@ msgstr "Bytes debe estar entre 0 y 255." msgid "No hardware random available" msgstr "No hay hardware random disponible" -#: shared-bindings/pulseio/PWMOut.c:162 +#: shared-bindings/pulseio/PWMOut.c:117 +msgid "All timers for this pin are in use" +msgstr "Todos los timers para este pin están siendo utilizados" + +#: shared-bindings/pulseio/PWMOut.c:171 msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" msgstr "" -#: shared-bindings/pulseio/PWMOut.c:193 +#: shared-bindings/pulseio/PWMOut.c:202 msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "" @@ -2573,6 +2583,11 @@ msgstr "Brightness debe estar entro 0 y 255" msgid "Stack size must be at least 256" msgstr "" +#: shared-bindings/terminalio/Terminal.c:68 +#, fuzzy +msgid "unicode_characters must be a string" +msgstr "palabras clave deben ser strings" + #: shared-bindings/time/__init__.c:78 msgid "sleep length must be non-negative" msgstr "la longitud de sleep no puede ser negativa" @@ -2697,7 +2712,7 @@ msgstr "Solo se admiten bit maps de color de 8 bits o menos" msgid "row must be packed and word aligned" msgstr "la fila debe estar empacada y la palabra alineada" -#: shared-module/displayio/Display.c:62 +#: shared-module/displayio/Display.c:69 #, fuzzy msgid "Unsupported display bus type" msgstr "tipo de bitmap no soportado" @@ -2707,7 +2722,7 @@ msgid "Group full" msgstr "Group lleno" #: shared-module/displayio/Group.c:46 -msgid "Layer must be a Group or Sprite subclass." +msgid "Layer must be a Group or TileGrid subclass." msgstr "" #: shared-module/displayio/Group.c:55 @@ -2857,63 +2872,69 @@ msgstr "" #~ msgid "Can not query for the device address." #~ msgstr "No se puede consultar la dirección del dispositivo." -#~ msgid "Invalid UUID string length" -#~ msgstr "Longitud de string UUID inválida" +#~ msgid "All PWM peripherals are in use" +#~ msgstr "Todos los periféricos PWM en uso" + +#~ msgid "displayio is a work in progress" +#~ msgstr "displayio todavia esta en desarrollo" #~ msgid "Invalid UUID parameter" #~ msgstr "Parámetro UUID inválido" +#~ msgid "Invalid UUID string length" +#~ msgstr "Longitud de string UUID inválida" + #~ msgid "Cannot set PPCP parameters." #~ msgstr "No se pueden establecer los parámetros PPCP." #~ msgid "Baud rate too high for this SPI peripheral" #~ msgstr "Baud rate demasiado alto para este periférico SPI" -#~ msgid "Can not encode UUID, to check length." -#~ msgstr "No se puede codificar el UUID, para revisar la longitud." +#~ msgid "Can encode UUID into the advertisement packet." +#~ msgstr "Se puede codificar el UUID en el paquete de anuncio." +#, fuzzy #~ msgid "" -#~ "enough power for the whole circuit and press reset (after ejecting " -#~ "CIRCUITPY).\n" +#~ "Please file an issue here with the contents of your CIRCUITPY drive:\n" #~ msgstr "" -#~ "suficiente poder para todo el circuito y presiona reset (después de " -#~ "expulsar CIRCUITPY).\n" +#~ "Por favor registra un issue en la siguiente URL con el contenidos de tu " +#~ "unidad de almacenamiento CIRCUITPY:\n" -#~ msgid "Cannot apply GAP parameters." -#~ msgstr "No se pueden aplicar los parámetros GAP." +#~ msgid "Can not encode UUID, to check length." +#~ msgstr "No se puede codificar el UUID, para revisar la longitud." + +#~ msgid "Can not apply device name in the stack." +#~ msgstr "No se puede aplicar el nombre del dispositivo en el stack." #~ msgid "Invalid Service type" #~ msgstr "Tipo de Servicio inválido" -#~ msgid "Can not add Service." -#~ msgstr "No se puede agregar el Servicio." - #, fuzzy #~ msgid "unpack requires a buffer of %d bytes" #~ msgstr "Falló la asignación del buffer RX de %d bytes" -#~ msgid "Can not apply device name in the stack." -#~ msgstr "No se puede aplicar el nombre del dispositivo en el stack." +#~ msgid "Wrong number of bytes provided" +#~ msgstr "Numero erroneo de bytes dados" -#, fuzzy #~ msgid "" -#~ "Please file an issue here with the contents of your CIRCUITPY drive:\n" +#~ "enough power for the whole circuit and press reset (after ejecting " +#~ "CIRCUITPY).\n" #~ msgstr "" -#~ "Por favor registra un issue en la siguiente URL con el contenidos de tu " -#~ "unidad de almacenamiento CIRCUITPY:\n" +#~ "suficiente poder para todo el circuito y presiona reset (después de " +#~ "expulsar CIRCUITPY).\n" + +#~ msgid "Can not apply advertisement data. status: 0x%02x" +#~ msgstr "No se puede aplicar los datos de anuncio. status: 0x%02x" + +#~ msgid "Can not add Service." +#~ msgstr "No se puede agregar el Servicio." #~ msgid "Wrong address length" #~ msgstr "Longitud de address erronea" +#~ msgid "Cannot apply GAP parameters." +#~ msgstr "No se pueden aplicar los parámetros GAP." + #~ msgid "Looks like our core CircuitPython code crashed hard. Whoops!\n" #~ msgstr "" #~ "Parece que nuestro código CircuitPython dejó de funcionar. Whoops!\n" - -#~ msgid "Wrong number of bytes provided" -#~ msgstr "Numero erroneo de bytes dados" - -#~ msgid "Can encode UUID into the advertisement packet." -#~ msgstr "Se puede codificar el UUID en el paquete de anuncio." - -#~ msgid "Can not apply advertisement data. status: 0x%02x" -#~ msgstr "No se puede aplicar los datos de anuncio. status: 0x%02x" diff --git a/locale/fil.po b/locale/fil.po index fb392075d..2ef179e17 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-01-22 14:00-0800\n" +"POT-Creation-Date: 2019-01-31 09:38-0800\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy <me@timothygarcia.ca>\n" "Language-Team: fil\n" @@ -151,11 +151,11 @@ msgstr "mali ang mga argumento" msgid "script compilation not supported" msgstr "script kompilasyon hindi supportado" -#: main.c:155 +#: main.c:152 msgid " output:\n" msgstr " output:\n" -#: main.c:169 main.c:247 +#: main.c:166 main.c:247 msgid "" "Auto-reload is on. Simply save files over USB to run them or enter REPL to " "disable.\n" @@ -163,29 +163,35 @@ msgstr "" "Ang awtomatikong pag re-reload ay ON. i-save lamang ang mga files sa USB " "para patakbuhin sila o pasukin ang REPL para i-disable ito.\n" -#: main.c:171 +#: main.c:168 msgid "Running in safe mode! Auto-reload is off.\n" msgstr "Tumatakbo sa safe mode! Awtomatikong pag re-reload ay OFF.\n" -#: main.c:173 main.c:249 +#: main.c:170 main.c:249 msgid "Auto-reload is off.\n" msgstr "Awtomatikong pag re-reload ay OFF.\n" -#: main.c:187 +#: main.c:184 msgid "Running in safe mode! Not running saved code.\n" msgstr "Tumatakbo sa safe mode! Hindi tumatakbo ang nai-save na code.\n" -#: main.c:203 +#: main.c:200 msgid "WARNING: Your code filename has two extensions\n" msgstr "BABALA: Ang pangalan ng file ay may dalawang extension\n" +#: main.c:221 +msgid "" +"\n" +"Code done running. Waiting for reload.\n" +msgstr "" + #: main.c:254 msgid "Press any key to enter the REPL. Use CTRL-D to reload." msgstr "" "Pindutin ang anumang key upang pumasok sa REPL. Gamitin ang CTRL-D upang i-" "reload." -#: main.c:417 +#: main.c:419 msgid "soft reboot\n" msgstr "malambot na reboot\n" @@ -280,8 +286,8 @@ msgid "Right channel unsupported" msgstr "Hindi supportado ang kanang channel" #: ports/atmel-samd/common-hal/audioio/AudioOut.c:139 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:116 #: ports/atmel-samd/common-hal/touchio/TouchIn.c:65 +#: shared-bindings/pulseio/PWMOut.c:113 msgid "Invalid pin" msgstr "Mali ang pin" @@ -298,9 +304,9 @@ msgid "Cannot output both channels on the same pin" msgstr "Hindi maaaring output ang mga parehong channel sa parehong pin" #: ports/atmel-samd/common-hal/audioio/AudioOut.c:243 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189 #: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110 #: ports/nrf/common-hal/pulseio/PulseOut.c:107 +#: shared-bindings/pulseio/PWMOut.c:119 msgid "All timers in use" msgstr "Lahat ng timer ginagamit" @@ -383,17 +389,12 @@ msgstr "Ginagamit na ang DAC" msgid "Cannot reset into bootloader because no bootloader is present." msgstr "Hindi ma-reset sa bootloader dahil walang bootloader." -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:120 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:369 -#: ports/nrf/common-hal/pulseio/PWMOut.c:119 -#: ports/nrf/common-hal/pulseio/PWMOut.c:233 +#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:394 +#: ports/nrf/common-hal/pulseio/PWMOut.c:259 +#: shared-bindings/pulseio/PWMOut.c:115 msgid "Invalid PWM frequency" msgstr "Mali ang PWM frequency" -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:187 -msgid "All timers for this pin are in use" -msgstr "Lahat ng timers para sa pin na ito ay ginagamit" - #: ports/atmel-samd/common-hal/pulseio/PulseIn.c:110 msgid "No hardware support on pin" msgstr "Walang support sa hardware ang pin" @@ -684,13 +685,13 @@ msgid "Data too large for advertisement packet" msgstr "Hindi makasya ang data sa loob ng advertisement packet" #: ports/nrf/common-hal/bleio/Broadcaster.c:83 -#: ports/nrf/common-hal/bleio/Peripheral.c:324 +#: ports/nrf/common-hal/bleio/Peripheral.c:332 #, fuzzy, c-format msgid "Failed to start advertising, err 0x%04x" msgstr "Hindi masimulaan ang advertisement, status: 0x%08lX" #: ports/nrf/common-hal/bleio/Broadcaster.c:96 -#: ports/nrf/common-hal/bleio/Peripheral.c:336 +#: ports/nrf/common-hal/bleio/Peripheral.c:344 #, fuzzy, c-format msgid "Failed to stop advertising, err 0x%04x" msgstr "Hindi mahinto ang advertisement, status: 0x%08lX" @@ -800,7 +801,7 @@ msgstr "Hindi masimulaan mag i-scan, status: 0x%0xlX" msgid "Failed to create mutex" msgstr "Hindi matagumpay ang pagbuo ng mutex, status: 0x%0xlX" -#: ports/nrf/common-hal/bleio/Peripheral.c:304 +#: ports/nrf/common-hal/bleio/Peripheral.c:312 #, fuzzy, c-format msgid "Failed to add service, err 0x%04x" msgstr "Hindi matagumpay ang paglagay ng service, status: 0x%08lX" @@ -873,10 +874,6 @@ msgstr "busio.UART hindi available" msgid "Cannot get temperature" msgstr "Hindi makuha ang temperatura. status 0x%02x" -#: ports/nrf/common-hal/pulseio/PWMOut.c:161 -msgid "All PWM peripherals are in use" -msgstr "Lahat ng PWM peripherals ay ginagamit" - #: ports/unix/modffi.c:138 msgid "Unknown type" msgstr "Hindi alam ang type" @@ -2276,19 +2273,19 @@ msgstr "" msgid "Not connected." msgstr "" -#: shared-bindings/bleio/Device.c:210 +#: shared-bindings/bleio/Device.c:213 msgid "Can't add services in Central mode" msgstr "Hindi maarang maglagay ng service sa Central mode" -#: shared-bindings/bleio/Device.c:226 +#: shared-bindings/bleio/Device.c:229 msgid "Can't connect in Peripheral mode" msgstr "Hindi maconnect sa Peripheral mode" -#: shared-bindings/bleio/Device.c:256 +#: shared-bindings/bleio/Device.c:259 msgid "Can't change the name in Central mode" msgstr "Hindi mapalitan ang pangalan sa Central mode" -#: shared-bindings/bleio/Device.c:277 shared-bindings/bleio/Device.c:313 +#: shared-bindings/bleio/Device.c:280 shared-bindings/bleio/Device.c:316 msgid "Can't advertise in Central mode" msgstr "Hindi ma advertise habang nasa Central mode" @@ -2384,24 +2381,24 @@ msgstr "row data ay dapat na buffer" msgid "color should be an int" msgstr "color ay dapat na int" -#: shared-bindings/displayio/Display.c:119 +#: shared-bindings/displayio/Display.c:124 msgid "Too many displays" msgstr "" -#: shared-bindings/displayio/Display.c:138 +#: shared-bindings/displayio/Display.c:145 msgid "Must be a Group subclass." msgstr "" +#: shared-bindings/displayio/Display.c:187 +#: shared-bindings/displayio/Display.c:197 +msgid "Brightness not adjustable" +msgstr "" + #: shared-bindings/displayio/FourWire.c:93 #: shared-bindings/displayio/ParallelBus.c:98 msgid "Too many display busses" msgstr "" -#: shared-bindings/displayio/FourWire.c:106 -#: shared-bindings/displayio/ParallelBus.c:110 -msgid "displayio is a work in progress" -msgstr "displayio ay nasa gitna ng konstruksiyon" - #: shared-bindings/displayio/Group.c:62 msgid "Group must have size at least 1" msgstr "Group dapat ay hindi baba sa 1 na haba" @@ -2437,15 +2434,23 @@ msgstr "y ay dapat int" msgid "end_x should be an int" msgstr "y ay dapat int" -#: shared-bindings/displayio/Sprite.c:49 +#: shared-bindings/displayio/TileGrid.c:49 msgid "position must be 2-tuple" msgstr "position ay dapat 2-tuple" -#: shared-bindings/displayio/Sprite.c:102 +#: shared-bindings/displayio/TileGrid.c:117 msgid "unsupported bitmap type" msgstr "Hindi supportadong tipo ng bitmap" -#: shared-bindings/displayio/Sprite.c:167 +#: shared-bindings/displayio/TileGrid.c:128 +msgid "Tile width must exactly divide bitmap width" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c:131 +msgid "Tile height must exactly divide bitmap height" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c:198 msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" msgstr "pixel_shader ay dapat displayio.Palette o displayio.ColorConverter" @@ -2472,6 +2477,7 @@ msgstr "walang laman ang address" #: shared-bindings/microcontroller/Pin.c:89 #: shared-bindings/neopixel_write/__init__.c:67 #: shared-bindings/pulseio/PulseOut.c:76 +#: shared-bindings/terminalio/Terminal.c:63 msgid "Expected a %q" msgstr "Umasa ng %q" @@ -2507,12 +2513,16 @@ msgstr "Sa gitna ng 0 o 255 dapat ang bytes." msgid "No hardware random available" msgstr "Walang magagamit na hardware random" -#: shared-bindings/pulseio/PWMOut.c:162 +#: shared-bindings/pulseio/PWMOut.c:117 +msgid "All timers for this pin are in use" +msgstr "Lahat ng timers para sa pin na ito ay ginagamit" + +#: shared-bindings/pulseio/PWMOut.c:171 msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" msgstr "PWM duty_cycle ay dapat sa loob ng 0 at 65535 (16 bit resolution)" -#: shared-bindings/pulseio/PWMOut.c:193 +#: shared-bindings/pulseio/PWMOut.c:202 msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "" @@ -2579,6 +2589,11 @@ msgstr "Ang liwanag ay dapat sa gitna ng 0 o 255" msgid "Stack size must be at least 256" msgstr "Ang laki ng stack ay dapat na hindi bababa sa 256" +#: shared-bindings/terminalio/Terminal.c:68 +#, fuzzy +msgid "unicode_characters must be a string" +msgstr "ang keywords dapat strings" + #: shared-bindings/time/__init__.c:78 msgid "sleep length must be non-negative" msgstr "sleep length ay dapat hindi negatibo" @@ -2703,7 +2718,7 @@ msgstr "Tanging bit maps na may 8 bit color o mas mababa ang supportado" msgid "row must be packed and word aligned" msgstr "row ay dapat packed at ang word nakahanay" -#: shared-module/displayio/Display.c:62 +#: shared-module/displayio/Display.c:69 #, fuzzy msgid "Unsupported display bus type" msgstr "Hindi supportadong tipo ng bitmap" @@ -2713,7 +2728,7 @@ msgid "Group full" msgstr "Puno ang group" #: shared-module/displayio/Group.c:46 -msgid "Layer must be a Group or Sprite subclass." +msgid "Layer must be a Group or TileGrid subclass." msgstr "" #: shared-module/displayio/Group.c:55 @@ -2863,12 +2878,18 @@ msgstr "" #~ msgid "Can not query for the device address." #~ msgstr "Hindi maaaring mag-query para sa address ng device." -#~ msgid "Invalid UUID string length" -#~ msgstr "Mali ang UUID string length" +#~ msgid "All PWM peripherals are in use" +#~ msgstr "Lahat ng PWM peripherals ay ginagamit" + +#~ msgid "displayio is a work in progress" +#~ msgstr "displayio ay nasa gitna ng konstruksiyon" #~ msgid "Invalid UUID parameter" #~ msgstr "Mali ang UUID parameter" +#~ msgid "Invalid UUID string length" +#~ msgstr "Mali ang UUID string length" + #~ msgid "Cannot set PPCP parameters." #~ msgstr "Hindi ma-set ang PPCP parameters." @@ -2876,50 +2897,50 @@ msgstr "" #~ msgid "palette must be displayio.Palette" #~ msgstr "ang palette ay dapat 32 bytes ang haba" -#~ msgid "Can not encode UUID, to check length." -#~ msgstr "Hindi ma-encode UUID, para suriin ang haba." +#~ msgid "Can encode UUID into the advertisement packet." +#~ msgstr "Maaring i-encode ang UUID sa advertisement packet." #~ msgid "" -#~ "enough power for the whole circuit and press reset (after ejecting " -#~ "CIRCUITPY).\n" +#~ "Please file an issue here with the contents of your CIRCUITPY drive:\n" #~ msgstr "" -#~ "ay nagbibigay ng sapat na power para sa buong circuit at i-press ang " -#~ "reset (pagkatapos i-eject ang CIRCUITPY).\n" +#~ "Mag-file ng isang isyu dito gamit ang mga nilalaman ng iyong CIRCUITPY " +#~ "drive:\n" -#~ msgid "Cannot apply GAP parameters." -#~ msgstr "Hindi ma-apply ang GAP parameters." +#~ msgid "Can not encode UUID, to check length." +#~ msgstr "Hindi ma-encode UUID, para suriin ang haba." + +#~ msgid "Can not apply device name in the stack." +#~ msgstr "Hindi maaaring ma-aplay ang device name sa stack." #~ msgid "Invalid Service type" #~ msgstr "Mali ang tipo ng serbisyo" -#~ msgid "Can not add Service." -#~ msgstr "Hindi maidaragdag ang serbisyo." - #, fuzzy #~ msgid "unpack requires a buffer of %d bytes" #~ msgstr "Nabigong ilaan ang RX buffer ng %d bytes" -#~ msgid "Can not apply device name in the stack." -#~ msgstr "Hindi maaaring ma-aplay ang device name sa stack." +#~ msgid "Wrong number of bytes provided" +#~ msgstr "Mali ang bilang ng bytes" #~ msgid "" -#~ "Please file an issue here with the contents of your CIRCUITPY drive:\n" +#~ "enough power for the whole circuit and press reset (after ejecting " +#~ "CIRCUITPY).\n" #~ msgstr "" -#~ "Mag-file ng isang isyu dito gamit ang mga nilalaman ng iyong CIRCUITPY " -#~ "drive:\n" +#~ "ay nagbibigay ng sapat na power para sa buong circuit at i-press ang " +#~ "reset (pagkatapos i-eject ang CIRCUITPY).\n" + +#~ msgid "Can not apply advertisement data. status: 0x%02x" +#~ msgstr "Hindi ma i-apply ang advertisement data. status: 0x%02x" + +#~ msgid "Can not add Service." +#~ msgstr "Hindi maidaragdag ang serbisyo." #~ msgid "Wrong address length" #~ msgstr "Mali ang address length" +#~ msgid "Cannot apply GAP parameters." +#~ msgstr "Hindi ma-apply ang GAP parameters." + #~ msgid "Looks like our core CircuitPython code crashed hard. Whoops!\n" #~ msgstr "" #~ "Mukhang ang core CircuitPython code ay nag-crash ng malakas. Aray!\n" - -#~ msgid "Wrong number of bytes provided" -#~ msgstr "Mali ang bilang ng bytes" - -#~ msgid "Can encode UUID into the advertisement packet." -#~ msgstr "Maaring i-encode ang UUID sa advertisement packet." - -#~ msgid "Can not apply advertisement data. status: 0x%02x" -#~ msgstr "Hindi ma i-apply ang advertisement data. status: 0x%02x" diff --git a/locale/fr.po b/locale/fr.po index 6a7c235e6..baab1c169 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-01-22 14:00-0800\n" +"POT-Creation-Date: 2019-01-31 09:38-0800\n" "PO-Revision-Date: 2018-12-23 20:05+0100\n" "Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n" "Language-Team: fr\n" @@ -150,11 +150,11 @@ msgstr "arguments invalides" msgid "script compilation not supported" msgstr "compilation de script non supporté" -#: main.c:155 +#: main.c:152 msgid " output:\n" msgstr " sortie:\n" -#: main.c:169 main.c:247 +#: main.c:166 main.c:247 msgid "" "Auto-reload is on. Simply save files over USB to run them or enter REPL to " "disable.\n" @@ -162,27 +162,33 @@ msgstr "" "Auto-chargement activé. Copiez simplement les fichiers en USB pour les " "lancer ou entrez sur REPL pour le désactiver.\n" -#: main.c:171 +#: main.c:168 msgid "Running in safe mode! Auto-reload is off.\n" msgstr "Mode sans-échec. Auto-rechargement désactivé.\n" -#: main.c:173 main.c:249 +#: main.c:170 main.c:249 msgid "Auto-reload is off.\n" msgstr "Auto-rechargement désactivé.\n" -#: main.c:187 +#: main.c:184 msgid "Running in safe mode! Not running saved code.\n" msgstr "Mode sans-échec! Le code sauvegardé ne s'éxecute pas.\n" -#: main.c:203 +#: main.c:200 msgid "WARNING: Your code filename has two extensions\n" msgstr "ATTENTION: le nom de fichier de votre code a deux extensions\n" +#: main.c:221 +msgid "" +"\n" +"Code done running. Waiting for reload.\n" +msgstr "" + #: main.c:254 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." -#: main.c:417 +#: main.c:419 msgid "soft reboot\n" msgstr "redémarrage logiciel\n" @@ -277,8 +283,8 @@ msgid "Right channel unsupported" msgstr "Canal droit non supporté" #: ports/atmel-samd/common-hal/audioio/AudioOut.c:139 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:116 #: ports/atmel-samd/common-hal/touchio/TouchIn.c:65 +#: shared-bindings/pulseio/PWMOut.c:113 msgid "Invalid pin" msgstr "Broche invalide" @@ -295,9 +301,9 @@ msgid "Cannot output both channels on the same pin" msgstr "Les 2 canaux de sortie ne peuvent être sur la même broche" #: ports/atmel-samd/common-hal/audioio/AudioOut.c:243 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189 #: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110 #: ports/nrf/common-hal/pulseio/PulseOut.c:107 +#: shared-bindings/pulseio/PWMOut.c:119 msgid "All timers in use" msgstr "Tous les timers sont utilisés" @@ -381,17 +387,12 @@ msgid "Cannot reset into bootloader because no bootloader is present." msgstr "" "Ne peut être redémarré vers le bootloader car il n'y a pas de bootloader." -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:120 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:369 -#: ports/nrf/common-hal/pulseio/PWMOut.c:119 -#: ports/nrf/common-hal/pulseio/PWMOut.c:233 +#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:394 +#: ports/nrf/common-hal/pulseio/PWMOut.c:259 +#: shared-bindings/pulseio/PWMOut.c:115 msgid "Invalid PWM frequency" msgstr "Fréquence de PWM invalide" -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:187 -msgid "All timers for this pin are in use" -msgstr "Tous les timers pour cette broche sont utilisés" - #: ports/atmel-samd/common-hal/pulseio/PulseIn.c:110 msgid "No hardware support on pin" msgstr "Pas de support matériel pour cette broche" @@ -681,13 +682,13 @@ msgid "Data too large for advertisement packet" msgstr "" #: ports/nrf/common-hal/bleio/Broadcaster.c:83 -#: ports/nrf/common-hal/bleio/Peripheral.c:324 +#: ports/nrf/common-hal/bleio/Peripheral.c:332 #, fuzzy, c-format msgid "Failed to start advertising, err 0x%04x" msgstr "Impossible de commencer à scanner, statut: 0x%0xlX" #: ports/nrf/common-hal/bleio/Broadcaster.c:96 -#: ports/nrf/common-hal/bleio/Peripheral.c:336 +#: ports/nrf/common-hal/bleio/Peripheral.c:344 #, fuzzy, c-format msgid "Failed to stop advertising, err 0x%04x" msgstr "Echec de l'ajout de service, statut: 0x%08lX" @@ -796,7 +797,7 @@ msgstr "Impossible de commencer à scanner, statut: 0x%0xlX" msgid "Failed to create mutex" msgstr "Echec de la création de mutex, statut: 0x%0xlX" -#: ports/nrf/common-hal/bleio/Peripheral.c:304 +#: ports/nrf/common-hal/bleio/Peripheral.c:312 #, fuzzy, c-format msgid "Failed to add service, err 0x%04x" msgstr "Echec de l'ajout de service, statut: 0x%08lX" @@ -874,11 +875,6 @@ msgstr "busio.UART n'est pas disponible" msgid "Cannot get temperature" msgstr "Impossible de lire la température. status: 0x%02x" -#: ports/nrf/common-hal/pulseio/PWMOut.c:161 -#, fuzzy -msgid "All PWM peripherals are in use" -msgstr "Tous les périphériques PWM sont utilisés" - #: ports/unix/modffi.c:138 msgid "Unknown type" msgstr "Type inconnu" @@ -2278,19 +2274,19 @@ msgstr "" msgid "Not connected." msgstr "" -#: shared-bindings/bleio/Device.c:210 +#: shared-bindings/bleio/Device.c:213 msgid "Can't add services in Central mode" msgstr "Impossible d'ajouter des service en mode Central" -#: shared-bindings/bleio/Device.c:226 +#: shared-bindings/bleio/Device.c:229 msgid "Can't connect in Peripheral mode" msgstr "Impossible de se connecter en mode Peripheral" -#: shared-bindings/bleio/Device.c:256 +#: shared-bindings/bleio/Device.c:259 msgid "Can't change the name in Central mode" msgstr "Modification du nom impossible en mode Central" -#: shared-bindings/bleio/Device.c:277 shared-bindings/bleio/Device.c:313 +#: shared-bindings/bleio/Device.c:280 shared-bindings/bleio/Device.c:316 msgid "Can't advertise in Central mode" msgstr "" @@ -2391,24 +2387,24 @@ msgstr "les données de ligne doivent être un tampon" msgid "color should be an int" msgstr "la couleur doit être un entier (int)" -#: shared-bindings/displayio/Display.c:119 +#: shared-bindings/displayio/Display.c:124 msgid "Too many displays" msgstr "" -#: shared-bindings/displayio/Display.c:138 +#: shared-bindings/displayio/Display.c:145 msgid "Must be a Group subclass." msgstr "" +#: shared-bindings/displayio/Display.c:187 +#: shared-bindings/displayio/Display.c:197 +msgid "Brightness not adjustable" +msgstr "" + #: shared-bindings/displayio/FourWire.c:93 #: shared-bindings/displayio/ParallelBus.c:98 msgid "Too many display busses" msgstr "" -#: shared-bindings/displayio/FourWire.c:106 -#: shared-bindings/displayio/ParallelBus.c:110 -msgid "displayio is a work in progress" -msgstr "displayio est en cours de développement" - #: shared-bindings/displayio/Group.c:62 #, fuzzy msgid "Group must have size at least 1" @@ -2450,17 +2446,25 @@ msgstr "y doit être un entier (int)" msgid "end_x should be an int" msgstr "y doit être un entier (int)" -#: shared-bindings/displayio/Sprite.c:49 +#: shared-bindings/displayio/TileGrid.c:49 #, fuzzy msgid "position must be 2-tuple" msgstr "position doit être un 2-tuple" -#: shared-bindings/displayio/Sprite.c:102 +#: shared-bindings/displayio/TileGrid.c:117 #, fuzzy msgid "unsupported bitmap type" msgstr "type de bitmap non supporté" -#: shared-bindings/displayio/Sprite.c:167 +#: shared-bindings/displayio/TileGrid.c:128 +msgid "Tile width must exactly divide bitmap width" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c:131 +msgid "Tile height must exactly divide bitmap height" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c:198 msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" msgstr "" "pixel_shader doit être un objet displayio.Palette ou displayio.ColorConverter" @@ -2489,6 +2493,7 @@ msgstr "adresses vides" #: shared-bindings/microcontroller/Pin.c:89 #: shared-bindings/neopixel_write/__init__.c:67 #: shared-bindings/pulseio/PulseOut.c:76 +#: shared-bindings/terminalio/Terminal.c:63 msgid "Expected a %q" msgstr "Attendu : %q" @@ -2524,14 +2529,18 @@ msgstr "Les octets 'bytes' doivent être entre 0 et 255" msgid "No hardware random available" msgstr "Pas de source matérielle d'aléa disponible" -#: shared-bindings/pulseio/PWMOut.c:162 +#: shared-bindings/pulseio/PWMOut.c:117 +msgid "All timers for this pin are in use" +msgstr "Tous les timers pour cette broche sont utilisés" + +#: shared-bindings/pulseio/PWMOut.c:171 msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" msgstr "" "La valeur de cycle PWM doit être entre 0 et 65535 inclus (résolution de 16 " "bits)" -#: shared-bindings/pulseio/PWMOut.c:193 +#: shared-bindings/pulseio/PWMOut.c:202 #, fuzzy msgid "" "PWM frequency not writable when variable_frequency is False on construction." @@ -2601,6 +2610,11 @@ msgstr "La luminosité doit être entre 0 et 255" msgid "Stack size must be at least 256" msgstr "La pile doit être au moins de 256" +#: shared-bindings/terminalio/Terminal.c:68 +#, fuzzy +msgid "unicode_characters must be a string" +msgstr "les noms doivent être des chaînes de caractère" + #: shared-bindings/time/__init__.c:78 msgid "sleep length must be non-negative" msgstr "la longueur de sleep ne doit pas être négative" @@ -2725,7 +2739,7 @@ msgstr "Seules les bitmaps de 8bits par couleur ou moins sont supportées" msgid "row must be packed and word aligned" msgstr "" -#: shared-module/displayio/Display.c:62 +#: shared-module/displayio/Display.c:69 #, fuzzy msgid "Unsupported display bus type" msgstr "type de bitmap non supporté" @@ -2735,7 +2749,7 @@ msgid "Group full" msgstr "Groupe plein" #: shared-module/displayio/Group.c:46 -msgid "Layer must be a Group or Sprite subclass." +msgid "Layer must be a Group or TileGrid subclass." msgstr "" #: shared-module/displayio/Group.c:55 @@ -2893,18 +2907,31 @@ msgstr "" #~ msgid "palette must be displayio.Palette" #~ msgstr "la palette doit être une displayio.Palette" -#~ msgid "Invalid UUID string length" -#~ msgstr "Longeur de chaîne UUID invalide" +#, fuzzy +#~ msgid "All PWM peripherals are in use" +#~ msgstr "Tous les périphériques PWM sont utilisés" + +#~ msgid "displayio is a work in progress" +#~ msgstr "displayio est en cours de développement" #~ msgid "Invalid UUID parameter" #~ msgstr "Paramètre UUID invalide" +#~ msgid "Invalid UUID string length" +#~ msgstr "Longeur de chaîne UUID invalide" + #~ msgid "Cannot apply GAP parameters." #~ msgstr "Impossible d'appliquer les paramètres GAP" #~ msgid "Cannot set PPCP parameters." #~ msgstr "Impossible d'appliquer les paramètres PPCP" +#~ msgid "Can not add Service." +#~ msgstr "Impossible d'ajouter le Service" + +#~ msgid "Can not encode UUID, to check length." +#~ msgstr "Impossible d'encoder l'UUID pour vérifier la longueur." + #~ msgid "" #~ "enough power for the whole circuit and press reset (after ejecting " #~ "CIRCUITPY).\n" @@ -2912,44 +2939,38 @@ msgstr "" #~ "assez de puissance pour l'ensemble du circuit et appuyez sur " #~ "'reset' (après avoir éjecter CIRCUITPY).\n" -#~ msgid "Invalid Service type" -#~ msgstr "Type de service invalide" - -#~ msgid "Looks like our core CircuitPython code crashed hard. Whoops!\n" +#~ msgid "" +#~ "Please file an issue here with the contents of your CIRCUITPY drive:\n" #~ msgstr "" -#~ "Il semblerait que votre code CircuitPython a durement planté. Oups!\n" +#~ "SVP, remontez le problème là avec le contenu du lecteur CIRCUITPY:\n" #~ msgid "Can not add Characteristic." #~ msgstr "Impossible d'ajouter la Characteristic." -#~ msgid "Can not apply device name in the stack." -#~ msgstr "Impossible d'appliquer le nom de périphérique dans la pile" - #, fuzzy #~ msgid "unpack requires a buffer of %d bytes" #~ msgstr "Echec de l'allocation de %d octets du tampon RX" -#~ msgid "" -#~ "Please file an issue here with the contents of your CIRCUITPY drive:\n" -#~ msgstr "" -#~ "SVP, remontez le problème là avec le contenu du lecteur CIRCUITPY:\n" +#, fuzzy +#~ msgid "Wrong number of bytes provided" +#~ msgstr "mauvais nombre d'octets fourni'" -#~ msgid "Can not encode UUID, to check length." -#~ msgstr "Impossible d'encoder l'UUID pour vérifier la longueur." +#~ msgid "Invalid Service type" +#~ msgstr "Type de service invalide" + +#~ msgid "Can not query for the device address." +#~ msgstr "Impossible d'obtenir l'adresse du périphérique" + +#~ msgid "Can not apply device name in the stack." +#~ msgstr "Impossible d'appliquer le nom de périphérique dans la pile" #~ msgid "Wrong address length" #~ msgstr "Mauvaise longueur d'adresse" +#~ msgid "Looks like our core CircuitPython code crashed hard. Whoops!\n" +#~ msgstr "" +#~ "Il semblerait que votre code CircuitPython a durement planté. Oups!\n" + #, fuzzy #~ msgid "value_size must be power of two" #~ msgstr "value_size doit être une puissance de 2" - -#, fuzzy -#~ msgid "Wrong number of bytes provided" -#~ msgstr "mauvais nombre d'octets fourni'" - -#~ msgid "Can not add Service." -#~ msgstr "Impossible d'ajouter le Service" - -#~ msgid "Can not query for the device address." -#~ msgstr "Impossible d'obtenir l'adresse du périphérique" diff --git a/locale/it_IT.po b/locale/it_IT.po index 8147f357f..7228e2463 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-01-22 14:00-0800\n" +"POT-Creation-Date: 2019-01-31 09:38-0800\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n" "Language-Team: \n" @@ -151,11 +151,11 @@ msgstr "argomenti non validi" msgid "script compilation not supported" msgstr "compilazione dello scrip non suportata" -#: main.c:155 +#: main.c:152 msgid " output:\n" msgstr " output:\n" -#: main.c:169 main.c:247 +#: main.c:166 main.c:247 msgid "" "Auto-reload is on. Simply save files over USB to run them or enter REPL to " "disable.\n" @@ -163,28 +163,34 @@ msgstr "" "L'auto-reload è attivo. Salva i file su USB per eseguirli o entra nel REPL " "per disabilitarlo.\n" -#: main.c:171 +#: main.c:168 msgid "Running in safe mode! Auto-reload is off.\n" msgstr "Modalità sicura in esecuzione! Auto-reload disattivato.\n" -#: main.c:173 main.c:249 +#: main.c:170 main.c:249 msgid "Auto-reload is off.\n" msgstr "Auto-reload disattivato.\n" -#: main.c:187 +#: main.c:184 msgid "Running in safe mode! Not running saved code.\n" msgstr "Modalità sicura in esecuzione! Codice salvato non in esecuzione.\n" -#: main.c:203 +#: main.c:200 msgid "WARNING: Your code filename has two extensions\n" msgstr "ATTENZIONE: Il nome del sorgente ha due estensioni\n" +#: main.c:221 +msgid "" +"\n" +"Code done running. Waiting for reload.\n" +msgstr "" + #: main.c:254 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." -#: main.c:417 +#: main.c:419 msgid "soft reboot\n" msgstr "soft reboot\n" @@ -280,8 +286,8 @@ msgid "Right channel unsupported" msgstr "Canale destro non supportato" #: ports/atmel-samd/common-hal/audioio/AudioOut.c:139 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:116 #: ports/atmel-samd/common-hal/touchio/TouchIn.c:65 +#: shared-bindings/pulseio/PWMOut.c:113 msgid "Invalid pin" msgstr "Pin non valido" @@ -298,9 +304,9 @@ msgid "Cannot output both channels on the same pin" msgstr "Impossibile dare in output entrambi i canal sullo stesso pin" #: ports/atmel-samd/common-hal/audioio/AudioOut.c:243 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189 #: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110 #: ports/nrf/common-hal/pulseio/PulseOut.c:107 +#: shared-bindings/pulseio/PWMOut.c:119 msgid "All timers in use" msgstr "Tutti i timer utilizzati" @@ -385,17 +391,12 @@ msgid "Cannot reset into bootloader because no bootloader is present." msgstr "" "Impossibile resettare nel bootloader poiché nessun bootloader è presente." -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:120 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:369 -#: ports/nrf/common-hal/pulseio/PWMOut.c:119 -#: ports/nrf/common-hal/pulseio/PWMOut.c:233 +#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:394 +#: ports/nrf/common-hal/pulseio/PWMOut.c:259 +#: shared-bindings/pulseio/PWMOut.c:115 msgid "Invalid PWM frequency" msgstr "Frequenza PWM non valida" -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:187 -msgid "All timers for this pin are in use" -msgstr "Tutti i timer per questo pin sono in uso" - #: ports/atmel-samd/common-hal/pulseio/PulseIn.c:110 msgid "No hardware support on pin" msgstr "Nessun supporto hardware sul pin" @@ -683,13 +684,13 @@ msgid "Data too large for advertisement packet" msgstr "Impossibile inserire dati nel pacchetto di advertisement." #: ports/nrf/common-hal/bleio/Broadcaster.c:83 -#: ports/nrf/common-hal/bleio/Peripheral.c:324 +#: ports/nrf/common-hal/bleio/Peripheral.c:332 #, fuzzy, c-format msgid "Failed to start advertising, err 0x%04x" msgstr "Impossibile avviare advertisement. status: 0x%02x" #: ports/nrf/common-hal/bleio/Broadcaster.c:96 -#: ports/nrf/common-hal/bleio/Peripheral.c:336 +#: ports/nrf/common-hal/bleio/Peripheral.c:344 #, fuzzy, c-format msgid "Failed to stop advertising, err 0x%04x" msgstr "Impossibile fermare advertisement. status: 0x%02x" @@ -799,7 +800,7 @@ msgstr "Impossible iniziare la scansione. status: 0x%02x" msgid "Failed to create mutex" msgstr "Impossibile leggere valore dell'attributo. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Peripheral.c:304 +#: ports/nrf/common-hal/bleio/Peripheral.c:312 #, fuzzy, c-format msgid "Failed to add service, err 0x%04x" msgstr "Impossibile fermare advertisement. status: 0x%02x" @@ -875,11 +876,6 @@ msgstr "busio.UART non ancora implementato" msgid "Cannot get temperature" msgstr "Impossibile leggere la temperatura. status: 0x%02x" -#: ports/nrf/common-hal/pulseio/PWMOut.c:161 -#, fuzzy -msgid "All PWM peripherals are in use" -msgstr "Tutte le periferiche SPI sono in uso" - #: ports/unix/modffi.c:138 msgid "Unknown type" msgstr "Tipo sconosciuto" @@ -2275,19 +2271,19 @@ msgstr "" msgid "Not connected." msgstr "" -#: shared-bindings/bleio/Device.c:210 +#: shared-bindings/bleio/Device.c:213 msgid "Can't add services in Central mode" msgstr "" -#: shared-bindings/bleio/Device.c:226 +#: shared-bindings/bleio/Device.c:229 msgid "Can't connect in Peripheral mode" msgstr "" -#: shared-bindings/bleio/Device.c:256 +#: shared-bindings/bleio/Device.c:259 msgid "Can't change the name in Central mode" msgstr "" -#: shared-bindings/bleio/Device.c:277 shared-bindings/bleio/Device.c:313 +#: shared-bindings/bleio/Device.c:280 shared-bindings/bleio/Device.c:316 msgid "Can't advertise in Central mode" msgstr "" @@ -2383,24 +2379,24 @@ msgstr "valori della riga devono essere un buffer" msgid "color should be an int" msgstr "il colore deve essere un int" -#: shared-bindings/displayio/Display.c:119 +#: shared-bindings/displayio/Display.c:124 msgid "Too many displays" msgstr "" -#: shared-bindings/displayio/Display.c:138 +#: shared-bindings/displayio/Display.c:145 msgid "Must be a Group subclass." msgstr "" +#: shared-bindings/displayio/Display.c:187 +#: shared-bindings/displayio/Display.c:197 +msgid "Brightness not adjustable" +msgstr "" + #: shared-bindings/displayio/FourWire.c:93 #: shared-bindings/displayio/ParallelBus.c:98 msgid "Too many display busses" msgstr "" -#: shared-bindings/displayio/FourWire.c:106 -#: shared-bindings/displayio/ParallelBus.c:110 -msgid "displayio is a work in progress" -msgstr "" - #: shared-bindings/displayio/Group.c:62 msgid "Group must have size at least 1" msgstr "Il gruppo deve avere dimensione almeno 1" @@ -2438,15 +2434,23 @@ msgstr "y dovrebbe essere un int" msgid "end_x should be an int" msgstr "y dovrebbe essere un int" -#: shared-bindings/displayio/Sprite.c:49 +#: shared-bindings/displayio/TileGrid.c:49 msgid "position must be 2-tuple" msgstr "position deve essere una 2-tuple" -#: shared-bindings/displayio/Sprite.c:102 +#: shared-bindings/displayio/TileGrid.c:117 msgid "unsupported bitmap type" msgstr "tipo di bitmap non supportato" -#: shared-bindings/displayio/Sprite.c:167 +#: shared-bindings/displayio/TileGrid.c:128 +msgid "Tile width must exactly divide bitmap width" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c:131 +msgid "Tile height must exactly divide bitmap height" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c:198 msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" msgstr "pixel_shader deve essere displayio.Palette o displayio.ColorConverter" @@ -2473,6 +2477,7 @@ msgstr "gli indirizzi sono vuoti" #: shared-bindings/microcontroller/Pin.c:89 #: shared-bindings/neopixel_write/__init__.c:67 #: shared-bindings/pulseio/PulseOut.c:76 +#: shared-bindings/terminalio/Terminal.c:63 msgid "Expected a %q" msgstr "Atteso un %q" @@ -2508,14 +2513,18 @@ msgstr "I byte devono essere compresi tra 0 e 255" msgid "No hardware random available" msgstr "Nessun generatore hardware di numeri casuali disponibile" -#: shared-bindings/pulseio/PWMOut.c:162 +#: shared-bindings/pulseio/PWMOut.c:117 +msgid "All timers for this pin are in use" +msgstr "Tutti i timer per questo pin sono in uso" + +#: shared-bindings/pulseio/PWMOut.c:171 msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" msgstr "" "duty_cycle del PWM deve essere compresa tra 0 e 65535 inclusiva (risoluzione " "a 16 bit)" -#: shared-bindings/pulseio/PWMOut.c:193 +#: shared-bindings/pulseio/PWMOut.c:202 #, fuzzy msgid "" "PWM frequency not writable when variable_frequency is False on construction." @@ -2585,6 +2594,11 @@ msgstr "La luminosità deve essere compreso tra 0 e 255" msgid "Stack size must be at least 256" msgstr "La dimensione dello stack deve essere almeno 256" +#: shared-bindings/terminalio/Terminal.c:68 +#, fuzzy +msgid "unicode_characters must be a string" +msgstr "argomenti nominati devono essere stringhe" + #: shared-bindings/time/__init__.c:78 msgid "sleep length must be non-negative" msgstr "la lunghezza di sleed deve essere non negativa" @@ -2709,7 +2723,7 @@ msgstr "Sono supportate solo bitmap con colori a 8 bit o meno" msgid "row must be packed and word aligned" msgstr "la riga deve essere compattata e allineata alla parola" -#: shared-module/displayio/Display.c:62 +#: shared-module/displayio/Display.c:69 #, fuzzy msgid "Unsupported display bus type" msgstr "tipo di bitmap non supportato" @@ -2719,7 +2733,7 @@ msgid "Group full" msgstr "Gruppo pieno" #: shared-module/displayio/Group.c:46 -msgid "Layer must be a Group or Sprite subclass." +msgid "Layer must be a Group or TileGrid subclass." msgstr "" #: shared-module/displayio/Group.c:55 @@ -2861,35 +2875,38 @@ msgstr "" #~ msgid "Invalid UUID parameter" #~ msgstr "Parametro UUID non valido" -#~ msgid "Invalid UUID string length" -#~ msgstr "Lunghezza della stringa UUID non valida" +#, fuzzy +#~ msgid "All PWM peripherals are in use" +#~ msgstr "Tutte le periferiche SPI sono in uso" #, fuzzy #~ msgid "Wrong number of bytes provided" #~ msgstr "numero di argomenti errato" +#~ msgid "Invalid UUID string length" +#~ msgstr "Lunghezza della stringa UUID non valida" + #~ msgid "Invalid Service type" #~ msgstr "Tipo di servizio non valido" #~ msgid "Cannot set PPCP parameters." #~ msgstr "Impossibile impostare i parametri PPCP." +#~ msgid "Can not apply device name in the stack." +#~ msgstr "Non è possibile inserire il nome del dipositivo nella lista." + +#~ msgid "Can not add Characteristic." +#~ msgstr "Non è possibile aggiungere Characteristic." + +#~ msgid "Can not encode UUID, to check length." +#~ msgstr "Non è possibile codificare l'UUID, lunghezza da controllare." + #~ msgid "Cannot apply GAP parameters." #~ msgstr "Impossibile applicare i parametri GAP." -#~ msgid "Can not apply advertisement data. status: 0x%02x" -#~ msgstr "Impossible inserire dati advertisement. status: 0x%02x" - #~ msgid "Can not add Service." #~ msgstr "Non è possibile aggiungere Service." -#~ msgid "" -#~ "enough power for the whole circuit and press reset (after ejecting " -#~ "CIRCUITPY).\n" -#~ msgstr "" -#~ "abbastanza potenza per l'intero circuito e premere reset (dopo aver " -#~ "espulso CIRCUITPY).\n" - #, fuzzy #~ msgid "unpack requires a buffer of %d bytes" #~ msgstr "Fallita allocazione del buffer RX di %d byte" @@ -2897,8 +2914,8 @@ msgstr "" #~ msgid "Can not query for the device address." #~ msgstr "Non è possibile trovare l'indirizzo del dispositivo." -#~ msgid "Can not encode UUID, to check length." -#~ msgstr "Non è possibile codificare l'UUID, lunghezza da controllare." +#~ msgid "Can encode UUID into the advertisement packet." +#~ msgstr "È possibile codificare l'UUID nel pacchetto di advertisement." #~ msgid "" #~ "Please file an issue here with the contents of your CIRCUITPY drive:\n" @@ -2906,16 +2923,17 @@ msgstr "" #~ "Ti preghiamo di compilare una issue con il contenuto del tuo drie " #~ "CIRCUITPY:\n" -#~ msgid "Can encode UUID into the advertisement packet." -#~ msgstr "È possibile codificare l'UUID nel pacchetto di advertisement." - -#~ msgid "Can not add Characteristic." -#~ msgstr "Non è possibile aggiungere Characteristic." - -#~ msgid "Can not apply device name in the stack." -#~ msgstr "Non è possibile inserire il nome del dipositivo nella lista." +#~ msgid "" +#~ "enough power for the whole circuit and press reset (after ejecting " +#~ "CIRCUITPY).\n" +#~ msgstr "" +#~ "abbastanza potenza per l'intero circuito e premere reset (dopo aver " +#~ "espulso CIRCUITPY).\n" #~ msgid "Looks like our core CircuitPython code crashed hard. Whoops!\n" #~ msgstr "" #~ "Sembra che il codice del core di CircuitPython sia crashato malamente. " #~ "Whoops!\n" + +#~ msgid "Can not apply advertisement data. status: 0x%02x" +#~ msgstr "Impossible inserire dati advertisement. status: 0x%02x" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index ab604de4a..a83dad4f1 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-01-22 14:00-0800\n" +"POT-Creation-Date: 2019-01-31 09:38-0800\n" "PO-Revision-Date: 2018-10-02 21:14-0000\n" "Last-Translator: \n" "Language-Team: \n" @@ -151,37 +151,43 @@ msgstr "argumentos inválidos" msgid "script compilation not supported" msgstr "compilação de script não suportada" -#: main.c:155 +#: main.c:152 msgid " output:\n" msgstr " saÃda:\n" -#: main.c:169 main.c:247 +#: main.c:166 main.c:247 msgid "" "Auto-reload is on. Simply save files over USB to run them or enter REPL to " "disable.\n" msgstr "" -#: main.c:171 +#: main.c:168 msgid "Running in safe mode! Auto-reload is off.\n" msgstr "Rodando em modo seguro! Atualização automática está desligada.\n" -#: main.c:173 main.c:249 +#: main.c:170 main.c:249 msgid "Auto-reload is off.\n" msgstr "A atualização automática está desligada.\n" -#: main.c:187 +#: main.c:184 msgid "Running in safe mode! Not running saved code.\n" msgstr "Rodando em modo seguro! Não está executando o código salvo.\n" -#: main.c:203 +#: main.c:200 msgid "WARNING: Your code filename has two extensions\n" msgstr "AVISO: Seu arquivo de código tem duas extensões\n" +#: main.c:221 +msgid "" +"\n" +"Code done running. Waiting for reload.\n" +msgstr "" + #: main.c:254 msgid "Press any key to enter the REPL. Use CTRL-D to reload." msgstr "" -#: main.c:417 +#: main.c:419 msgid "soft reboot\n" msgstr "" @@ -276,8 +282,8 @@ msgid "Right channel unsupported" msgstr "Canal direito não suportado" #: ports/atmel-samd/common-hal/audioio/AudioOut.c:139 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:116 #: ports/atmel-samd/common-hal/touchio/TouchIn.c:65 +#: shared-bindings/pulseio/PWMOut.c:113 msgid "Invalid pin" msgstr "Pino inválido" @@ -294,9 +300,9 @@ msgid "Cannot output both channels on the same pin" msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c:243 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189 #: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110 #: ports/nrf/common-hal/pulseio/PulseOut.c:107 +#: shared-bindings/pulseio/PWMOut.c:119 msgid "All timers in use" msgstr "Todos os temporizadores em uso" @@ -378,17 +384,12 @@ msgstr "DAC em uso" msgid "Cannot reset into bootloader because no bootloader is present." msgstr "" -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:120 -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:369 -#: ports/nrf/common-hal/pulseio/PWMOut.c:119 -#: ports/nrf/common-hal/pulseio/PWMOut.c:233 +#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:394 +#: ports/nrf/common-hal/pulseio/PWMOut.c:259 +#: shared-bindings/pulseio/PWMOut.c:115 msgid "Invalid PWM frequency" msgstr "Frequência PWM inválida" -#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:187 -msgid "All timers for this pin are in use" -msgstr "Todos os temporizadores para este pino estão em uso" - #: ports/atmel-samd/common-hal/pulseio/PulseIn.c:110 msgid "No hardware support on pin" msgstr "Nenhum suporte de hardware no pino" @@ -675,13 +676,13 @@ msgid "Data too large for advertisement packet" msgstr "Não é possÃvel ajustar dados no pacote de anúncios." #: ports/nrf/common-hal/bleio/Broadcaster.c:83 -#: ports/nrf/common-hal/bleio/Peripheral.c:324 +#: ports/nrf/common-hal/bleio/Peripheral.c:332 #, fuzzy, c-format msgid "Failed to start advertising, err 0x%04x" msgstr "Não é possÃvel iniciar o anúncio. status: 0x%02x" #: ports/nrf/common-hal/bleio/Broadcaster.c:96 -#: ports/nrf/common-hal/bleio/Peripheral.c:336 +#: ports/nrf/common-hal/bleio/Peripheral.c:344 #, fuzzy, c-format msgid "Failed to stop advertising, err 0x%04x" msgstr "Não pode parar propaganda. status: 0x%02x" @@ -789,7 +790,7 @@ msgstr "Não é possÃvel iniciar o anúncio. status: 0x%02x" msgid "Failed to create mutex" msgstr "Não é possÃvel ler o valor do atributo. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Peripheral.c:304 +#: ports/nrf/common-hal/bleio/Peripheral.c:312 #, fuzzy, c-format msgid "Failed to add service, err 0x%04x" msgstr "Não pode parar propaganda. status: 0x%02x" @@ -863,11 +864,6 @@ msgstr "busio.UART não disponÃvel" msgid "Cannot get temperature" msgstr "Não pode obter a temperatura. status: 0x%02x" -#: ports/nrf/common-hal/pulseio/PWMOut.c:161 -#, fuzzy -msgid "All PWM peripherals are in use" -msgstr "Todos os temporizadores em uso" - #: ports/unix/modffi.c:138 msgid "Unknown type" msgstr "Tipo desconhecido" @@ -2241,19 +2237,19 @@ msgstr "" msgid "Not connected." msgstr "" -#: shared-bindings/bleio/Device.c:210 +#: shared-bindings/bleio/Device.c:213 msgid "Can't add services in Central mode" msgstr "" -#: shared-bindings/bleio/Device.c:226 +#: shared-bindings/bleio/Device.c:229 msgid "Can't connect in Peripheral mode" msgstr "" -#: shared-bindings/bleio/Device.c:256 +#: shared-bindings/bleio/Device.c:259 msgid "Can't change the name in Central mode" msgstr "" -#: shared-bindings/bleio/Device.c:277 shared-bindings/bleio/Device.c:313 +#: shared-bindings/bleio/Device.c:280 shared-bindings/bleio/Device.c:316 msgid "Can't advertise in Central mode" msgstr "" @@ -2349,24 +2345,24 @@ msgstr "" msgid "color should be an int" msgstr "cor deve ser um int" -#: shared-bindings/displayio/Display.c:119 +#: shared-bindings/displayio/Display.c:124 msgid "Too many displays" msgstr "" -#: shared-bindings/displayio/Display.c:138 +#: shared-bindings/displayio/Display.c:145 msgid "Must be a Group subclass." msgstr "" +#: shared-bindings/displayio/Display.c:187 +#: shared-bindings/displayio/Display.c:197 +msgid "Brightness not adjustable" +msgstr "" + #: shared-bindings/displayio/FourWire.c:93 #: shared-bindings/displayio/ParallelBus.c:98 msgid "Too many display busses" msgstr "" -#: shared-bindings/displayio/FourWire.c:106 -#: shared-bindings/displayio/ParallelBus.c:110 -msgid "displayio is a work in progress" -msgstr "" - #: shared-bindings/displayio/Group.c:62 msgid "Group must have size at least 1" msgstr "Grupo deve ter tamanho pelo menos 1" @@ -2402,15 +2398,23 @@ msgstr "y deve ser um int" msgid "end_x should be an int" msgstr "y deve ser um int" -#: shared-bindings/displayio/Sprite.c:49 +#: shared-bindings/displayio/TileGrid.c:49 msgid "position must be 2-tuple" msgstr "" -#: shared-bindings/displayio/Sprite.c:102 +#: shared-bindings/displayio/TileGrid.c:117 msgid "unsupported bitmap type" msgstr "" -#: shared-bindings/displayio/Sprite.c:167 +#: shared-bindings/displayio/TileGrid.c:128 +msgid "Tile width must exactly divide bitmap width" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c:131 +msgid "Tile height must exactly divide bitmap height" +msgstr "" + +#: shared-bindings/displayio/TileGrid.c:198 msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" msgstr "" @@ -2437,6 +2441,7 @@ msgstr "" #: shared-bindings/microcontroller/Pin.c:89 #: shared-bindings/neopixel_write/__init__.c:67 #: shared-bindings/pulseio/PulseOut.c:76 +#: shared-bindings/terminalio/Terminal.c:63 msgid "Expected a %q" msgstr "Esperado um" @@ -2472,12 +2477,16 @@ msgstr "Os bytes devem estar entre 0 e 255." msgid "No hardware random available" msgstr "" -#: shared-bindings/pulseio/PWMOut.c:162 +#: shared-bindings/pulseio/PWMOut.c:117 +msgid "All timers for this pin are in use" +msgstr "Todos os temporizadores para este pino estão em uso" + +#: shared-bindings/pulseio/PWMOut.c:171 msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" msgstr "" -#: shared-bindings/pulseio/PWMOut.c:193 +#: shared-bindings/pulseio/PWMOut.c:202 msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "" @@ -2543,6 +2552,11 @@ msgstr "O brilho deve estar entre 0 e 255" msgid "Stack size must be at least 256" msgstr "O tamanho da pilha deve ser pelo menos 256" +#: shared-bindings/terminalio/Terminal.c:68 +#, fuzzy +msgid "unicode_characters must be a string" +msgstr "heap deve ser uma lista" + #: shared-bindings/time/__init__.c:78 msgid "sleep length must be non-negative" msgstr "" @@ -2666,7 +2680,7 @@ msgstr "Apenas bit maps de cores de 8 bit ou menos são suportados" msgid "row must be packed and word aligned" msgstr "Linha deve ser comprimida e com as palavras alinhadas" -#: shared-module/displayio/Display.c:62 +#: shared-module/displayio/Display.c:69 #, fuzzy msgid "Unsupported display bus type" msgstr "Taxa de transmissão não suportada" @@ -2676,7 +2690,7 @@ msgid "Group full" msgstr "Grupo cheio" #: shared-module/displayio/Group.c:46 -msgid "Layer must be a Group or Sprite subclass." +msgid "Layer must be a Group or TileGrid subclass." msgstr "" #: shared-module/displayio/Group.c:55 @@ -2807,36 +2821,40 @@ msgid "" "exit safe mode.\n" msgstr "" +#, fuzzy +#~ msgid "All PWM peripherals are in use" +#~ msgstr "Todos os temporizadores em uso" + +#~ msgid "Invalid Service type" +#~ msgstr "Tipo de serviço inválido" + +#~ msgid "Can not add Characteristic." +#~ msgstr "Não é possÃvel adicionar CaracterÃstica." + #~ msgid "Cannot set PPCP parameters." #~ msgstr "Não é possÃvel definir parâmetros PPCP." +#~ msgid "Can not apply advertisement data. status: 0x%02x" +#~ msgstr "Não é possÃvel aplicar dados de anúncio. status: 0x%02x" + +#~ msgid "Cannot apply GAP parameters." +#~ msgstr "Não é possÃvel aplicar parâmetros GAP." + #~ msgid "Can not query for the device address." #~ msgstr "Não é possÃvel consultar o endereço do dispositivo." #~ msgid "Can encode UUID into the advertisement packet." #~ msgstr "Pode codificar o UUID no pacote de anúncios." +#~ msgid "Baud rate too high for this SPI peripheral" +#~ msgstr "Taxa de transmissão muito alta para esse periférico SPI" + #, fuzzy #~ msgid "unpack requires a buffer of %d bytes" #~ msgstr "Falha ao alocar buffer RX de %d bytes" -#~ msgid "Can not apply advertisement data. status: 0x%02x" -#~ msgstr "Não é possÃvel aplicar dados de anúncio. status: 0x%02x" - -#~ msgid "Can not add Characteristic." -#~ msgstr "Não é possÃvel adicionar CaracterÃstica." - -#~ msgid "Baud rate too high for this SPI peripheral" -#~ msgstr "Taxa de transmissão muito alta para esse periférico SPI" - #~ msgid "Can not apply device name in the stack." #~ msgstr "Não é possÃvel aplicar o nome do dispositivo na pilha." #~ msgid "Invalid UUID parameter" #~ msgstr "Parâmetro UUID inválido" - -#~ msgid "Invalid Service type" -#~ msgstr "Tipo de serviço inválido" - -#~ msgid "Cannot apply GAP parameters." -#~ msgstr "Não é possÃvel aplicar parâmetros GAP." @@ -44,6 +44,7 @@ #include "lib/utils/pyexec.h" #include "mpconfigboard.h" +#include "shared-module/displayio/__init__.h" #include "supervisor/cpu.h" #include "supervisor/memory.h" #include "supervisor/port.h" @@ -61,10 +62,6 @@ #include "shared-module/network/__init__.h" #endif -#ifdef CIRCUITPY_DISPLAYIO -#include "shared-module/displayio/__init__.h" -#endif - void do_str(const char *src, mp_parse_input_kind_t input_kind) { mp_lexer_t *lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, src, strlen(src), 0); if (lex == NULL) { @@ -203,12 +200,11 @@ bool run_code_py(safe_mode_t safe_mode) { serial_write_compressed(translate("WARNING: Your code filename has two extensions\n")); } } - #ifdef CIRCUITPY_DISPLAYIO // Turn off the display before the heap disappears. reset_displays(); - #endif stop_mp(); free_memory(heap); + supervisor_move_memory(); reset_port(); reset_board_busses(); @@ -221,6 +217,10 @@ bool run_code_py(safe_mode_t safe_mode) { } // Wait for connection or character. + if (!serial_connected_at_start) { + serial_write_compressed(translate("\nCode done running. Waiting for reload.\n")); + } + bool serial_connected_before_animation = false; rgb_status_animation_t animation; prep_rgb_status_animation(&result, found_main, safe_mode, &animation); @@ -342,6 +342,7 @@ void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) { reset_board(); stop_mp(); free_memory(heap); + supervisor_move_memory(); } } @@ -362,6 +363,7 @@ int run_repl(void) { reset_board(); stop_mp(); free_memory(heap); + supervisor_move_memory(); autoreload_resume(); return exit_code; } diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index 797369bd6..56c31e5d8 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -388,7 +388,7 @@ SRC_SHARED_MODULE = \ displayio/OnDiskBitmap.c \ displayio/Palette.c \ displayio/Shape.c \ - displayio/Sprite.c \ + displayio/TileGrid.c \ gamepad/__init__.c \ gamepad/GamePad.c \ _stage/__init__.c \ @@ -398,6 +398,8 @@ SRC_SHARED_MODULE = \ os/__init__.c \ random/__init__.c \ struct/__init__.c \ + terminalio/__init__.c \ + terminalio/Terminal.c \ uheap/__init__.c \ ustack/__init__.c \ usb_hid/__init__.c \ diff --git a/ports/atmel-samd/boards/hallowing_m0_express/board.c b/ports/atmel-samd/boards/hallowing_m0_express/board.c index 2b12ae464..72306e14a 100644 --- a/ports/atmel-samd/boards/hallowing_m0_express/board.c +++ b/ports/atmel-samd/boards/hallowing_m0_express/board.c @@ -84,13 +84,14 @@ void board_init(void) { 128, // Width 128, // Height 2, // column start - 0, // row start + 1, // row start 16, // Color depth MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command display_init_sequence, - sizeof(display_init_sequence)); + sizeof(display_init_sequence), + &pin_PA00); } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk index fea4bc222..00e2dfa0d 100644 --- a/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk @@ -17,6 +17,5 @@ CHIP_FAMILY = samd21 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/atmel-samd/boards/pyportal/board.c b/ports/atmel-samd/boards/pyportal/board.c index 6e5b37dd2..980a28e9b 100644 --- a/ports/atmel-samd/boards/pyportal/board.c +++ b/ports/atmel-samd/boards/pyportal/board.c @@ -87,7 +87,8 @@ void board_init(void) { MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command display_init_sequence, - sizeof(display_init_sequence)); + sizeof(display_init_sequence), + &pin_PB31); } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/common-hal/pulseio/PWMOut.c b/ports/atmel-samd/common-hal/pulseio/PWMOut.c index 825bdd181..2740a9e55 100644 --- a/ports/atmel-samd/common-hal/pulseio/PWMOut.c +++ b/ports/atmel-samd/common-hal/pulseio/PWMOut.c @@ -58,6 +58,26 @@ uint8_t tcc_channels[3]; // Set by pwmout_reset() to {0xf0, 0xfc, 0xfc} initia uint8_t tcc_channels[5]; // Set by pwmout_reset() to {0xc0, 0xf0, 0xf8, 0xfc, 0xfc} initially. #endif +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; + } else { + never_reset_tc_or_tcc[TC_INST_NUM + self->timer->index] += 1; + } + + 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; + } +} + void pwmout_reset(void) { // Reset all timers for (int i = 0; i < TCC_INST_NUM; i++) { @@ -66,6 +86,9 @@ void pwmout_reset(void) { } Tcc *tccs[TCC_INST_NUM] = TCC_INSTS; for (int i = 0; i < TCC_INST_NUM; i++) { + if (never_reset_tc_or_tcc[TC_INST_NUM + i] > 0) { + continue; + } // Disable the module before resetting it. if (tccs[i]->CTRLA.bit.ENABLE == 1) { tccs[i]->CTRLA.bit.ENABLE = 0; @@ -81,6 +104,9 @@ void pwmout_reset(void) { } Tc *tcs[TC_INST_NUM] = TC_INSTS; for (int i = 0; i < TC_INST_NUM; i++) { + if (never_reset_tc_or_tcc[i] > 0) { + continue; + } tcs[i]->COUNT16.CTRLA.bit.SWRST = 1; while (tcs[i]->COUNT16.CTRLA.bit.SWRST == 1) { } @@ -99,11 +125,11 @@ bool channel_ok(const pin_timer_t* t) { t->is_tc; } -void common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, - const mcu_pin_obj_t* pin, - uint16_t duty, - uint32_t frequency, - bool variable_frequency) { +pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, + const mcu_pin_obj_t* pin, + uint16_t duty, + uint32_t frequency, + bool variable_frequency) { self->pin = pin; self->variable_frequency = variable_frequency; @@ -113,11 +139,11 @@ void common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, && pin->timer[2].index >= TCC_INST_NUM #endif ) { - mp_raise_ValueError(translate("Invalid pin")); + return PWMOUT_INVALID_PIN; } if (frequency == 0 || frequency > 6000000) { - mp_raise_ValueError(translate("Invalid PWM frequency")); + return PWMOUT_INVALID_FREQUENCY; } // Figure out which timer we are using. @@ -184,11 +210,9 @@ void common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, if (timer == NULL) { if (found) { - mp_raise_ValueError(translate("All timers for this pin are in use")); - } else { - mp_raise_RuntimeError(translate("All timers in use")); + return PWMOUT_ALL_TIMERS_ON_PIN_IN_USE; } - return; + return PWMOUT_ALL_TIMERS_IN_USE; } uint8_t resolution = 0; @@ -259,6 +283,7 @@ void common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, gpio_set_pin_function(pin->number, GPIO_PIN_FUNCTION_E + mux_position); common_hal_pulseio_pwmout_set_duty_cycle(self, duty); + return PWMOUT_OK; } bool common_hal_pulseio_pwmout_deinited(pulseio_pwmout_obj_t* self) { diff --git a/ports/atmel-samd/mpconfigport.h b/ports/atmel-samd/mpconfigport.h index da3383f8e..137091b6d 100644 --- a/ports/atmel-samd/mpconfigport.h +++ b/ports/atmel-samd/mpconfigport.h @@ -235,6 +235,7 @@ extern const struct _mp_obj_module_t ustack_module; extern const struct _mp_obj_module_t supervisor_module; extern const struct _mp_obj_module_t gamepad_module; extern const struct _mp_obj_module_t stage_module; +extern const struct _mp_obj_module_t terminalio_module; extern const struct _mp_obj_module_t touchio_module; extern const struct _mp_obj_module_t usb_hid_module; extern const struct _mp_obj_module_t usb_midi_module; @@ -286,7 +287,8 @@ extern const struct _mp_obj_module_t pixelbuf_module; #if !defined(CIRCUITPY_DISPLAYIO) || CIRCUITPY_DISPLAYIO #define CIRCUITPY_DISPLAYIO (1) #define CIRCUITPY_DISPLAY_LIMIT (3) - #define DISPLAYIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_displayio), (mp_obj_t)&displayio_module }, + #define DISPLAYIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_displayio), (mp_obj_t)&displayio_module }, \ + { MP_OBJ_NEW_QSTR(MP_QSTR_terminalio), (mp_obj_t)&terminalio_module }, #else #define CIRCUITPY_DISPLAYIO (0) #define CIRCUITPY_DISPLAY_LIMIT (0) @@ -349,6 +351,7 @@ extern const struct _mp_obj_module_t pixelbuf_module; #define MICROPY_PY_BUILTINS_COMPLEX (0) #define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (0) + #define CIRCUITPY_DISPLAYIO (0) #define CIRCUITPY_DISPLAY_LIMIT (0) #endif @@ -465,6 +468,7 @@ extern const struct _mp_obj_module_t pixelbuf_module; mp_obj_t rtc_time_source; \ FLASH_ROOT_POINTERS \ mp_obj_t gamepad_singleton; \ + mp_obj_t terminal_tilegrid_tiles; \ NETWORK_ROOT_POINTERS \ void run_background_tasks(void); diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index 2f762e2a3..a75d45f1f 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -226,8 +226,10 @@ SRC_SHARED_MODULE = \ displayio/OnDiskBitmap.c \ displayio/Palette.c \ displayio/Shape.c \ - displayio/Sprite.c \ - storage/__init__.c + displayio/TileGrid.c \ + storage/__init__.c \ + terminalio/__init__.c \ + terminalio/Terminal.c ifndef EXCLUDE_PIXELBUF diff --git a/ports/nrf/common-hal/pulseio/PWMOut.c b/ports/nrf/common-hal/pulseio/PWMOut.c index f321f848d..cf2330934 100644 --- a/ports/nrf/common-hal/pulseio/PWMOut.c +++ b/ports/nrf/common-hal/pulseio/PWMOut.c @@ -55,8 +55,33 @@ STATIC NRF_PWM_Type* pwms[] = { STATIC uint16_t pwm_seq[MP_ARRAY_SIZE(pwms)][CHANNELS_PER_PWM]; +static uint8_t never_reset_pwm[MP_ARRAY_SIZE(pwms)]; + +void common_hal_pulseio_pwmout_never_reset(pulseio_pwmout_obj_t *self) { + for(int i=0; i < MP_ARRAY_SIZE(pwms); i++) { + NRF_PWM_Type* pwm = pwms[i]; + if (pwm == self->pwm) { + never_reset_pwm[i] += 1; + } + } + + never_reset_pin_number(self->pin_number); +} + +void common_hal_pulseio_pwmout_reset_ok(pulseio_pwmout_obj_t *self) { + for(int i=0; i < MP_ARRAY_SIZE(pwms); i++) { + NRF_PWM_Type* pwm = pwms[i]; + if (pwm == self->pwm) { + never_reset_pwm[i] -= 1; + } + } +} + void pwmout_reset(void) { for(int i=0; i < MP_ARRAY_SIZE(pwms); i++) { + if (never_reset_pwm[i] > 0) { + continue; + } NRF_PWM_Type* pwm = pwms[i]; pwm->ENABLE = 0; @@ -104,11 +129,11 @@ bool convert_frequency(uint32_t frequency, uint16_t *countertop, nrf_pwm_clk_t * return false; } -void common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, - const mcu_pin_obj_t* pin, - uint16_t duty, - uint32_t frequency, - bool variable_frequency) { +pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, + const mcu_pin_obj_t* pin, + uint16_t duty, + uint32_t frequency, + bool variable_frequency) { // We don't use the nrfx driver here because we want to dynamically allocate channels // as needed in an already-enabled PWM. @@ -116,7 +141,7 @@ void common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, uint16_t countertop; nrf_pwm_clk_t base_clock; if (frequency == 0 || !convert_frequency(frequency, &countertop, &base_clock)) { - mp_raise_ValueError(translate("Invalid PWM frequency")); + return PWMOUT_INVALID_FREQUENCY; } self->pwm = NULL; @@ -158,7 +183,7 @@ void common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, } if (self->pwm == NULL) { - mp_raise_ValueError(translate("All PWM peripherals are in use")); + return PWMOUT_ALL_TIMERS_IN_USE; } self->pin_number = pin->number; @@ -183,6 +208,7 @@ void common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, nrf_pwm_enable(pwm); common_hal_pulseio_pwmout_set_duty_cycle(self, duty); + return PWMOUT_OK; } bool common_hal_pulseio_pwmout_deinited(pulseio_pwmout_obj_t* self) { diff --git a/ports/nrf/mpconfigport.h b/ports/nrf/mpconfigport.h index f63265129..e97c13d81 100644 --- a/ports/nrf/mpconfigport.h +++ b/ports/nrf/mpconfigport.h @@ -229,6 +229,7 @@ extern const struct _mp_obj_module_t touchio_module; #define MICROPY_PORT_ROOT_POINTERS \ const char *readline_hist[8]; \ mp_obj_t gamepad_singleton; \ + mp_obj_t terminal_tilegrid_tiles; \ FLASH_ROOT_POINTERS \ // We need to provide a declaration/definition of alloca() diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index d61732f6f..109df8af4 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -84,9 +84,10 @@ //| :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 +//| :param microcontroller.Pin backlight_pin: Pin connected to the display's backlight //| 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_color_depth, ARG_set_column_command, ARG_set_row_command, ARG_write_ram_command }; + enum { ARG_display_bus, ARG_init_sequence, ARG_width, ARG_height, ARG_colstart, ARG_rowstart, ARG_color_depth, ARG_set_column_command, ARG_set_row_command, ARG_write_ram_command, ARG_backlight_pin }; 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 }, @@ -98,6 +99,7 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a { 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} }, + { MP_QSTR_backlight_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); @@ -107,6 +109,14 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[ARG_init_sequence].u_obj, &bufinfo, MP_BUFFER_READ); + mp_obj_t backlight_pin_obj = args[ARG_backlight_pin].u_obj; + assert_pin(backlight_pin_obj, true); + const mcu_pin_obj_t* backlight_pin = NULL; + if (backlight_pin_obj != NULL && backlight_pin_obj != mp_const_none) { + backlight_pin = MP_OBJ_TO_PTR(backlight_pin_obj); + assert_pin_free(backlight_pin); + } + displayio_display_obj_t *self = NULL; for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { if (displays[i].display.base.type == NULL || @@ -122,22 +132,27 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a 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, args[ARG_color_depth].u_int, args[ARG_set_column_command].u_int, args[ARG_set_row_command].u_int, - args[ARG_write_ram_command].u_int, bufinfo.buf, bufinfo.len); + args[ARG_write_ram_command].u_int, bufinfo.buf, bufinfo.len, MP_OBJ_TO_PTR(backlight_pin)); return self; } //| .. method:: show(group) //| -//| Switches to displaying the given group of layers. +//| Switches to displaying the given group of layers. When group is None, the default +//| CircuitPython terminal will be shown. //| STATIC mp_obj_t displayio_display_obj_show(mp_obj_t self_in, mp_obj_t group_in) { displayio_display_obj_t *self = MP_OBJ_TO_PTR(self_in); - mp_obj_t native_layer = mp_instance_cast_to_native_base(group_in, &displayio_group_type); - if (native_layer == MP_OBJ_NULL) { - mp_raise_ValueError(translate("Must be a Group subclass.")); + displayio_group_t* group = NULL; + if (group_in != mp_const_none) { + mp_obj_t native_layer = mp_instance_cast_to_native_base(group_in, &displayio_group_type); + if (native_layer == MP_OBJ_NULL) { + mp_raise_ValueError(translate("Must be a Group subclass.")); + } + group = MP_OBJ_TO_PTR(native_layer); } - displayio_group_t* group = MP_OBJ_TO_PTR(native_layer); + common_hal_displayio_display_show(self, group); return mp_const_none; } @@ -165,11 +180,72 @@ STATIC mp_obj_t displayio_display_obj_wait_for_frame(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_wait_for_frame_obj, displayio_display_obj_wait_for_frame); +//| .. 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 this value will change automatically and setting it will have no +//| effect. To control the brightness, auto_brightness must be false. +//| +STATIC mp_obj_t displayio_display_obj_get_brightness(mp_obj_t self_in) { + displayio_display_obj_t *self = MP_OBJ_TO_PTR(self_in); + mp_float_t brightness = common_hal_displayio_display_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(displayio_display_get_brightness_obj, displayio_display_obj_get_brightness); + +STATIC mp_obj_t displayio_display_obj_set_brightness(mp_obj_t self_in, mp_obj_t brightness) { + displayio_display_obj_t *self = MP_OBJ_TO_PTR(self_in); + bool ok = common_hal_displayio_display_set_brightness(self, mp_obj_get_float(brightness)); + if (!ok) { + mp_raise_RuntimeError(translate("Brightness not adjustable")); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_set_brightness_obj, displayio_display_obj_set_brightness); + +const mp_obj_property_t displayio_display_brightness_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&displayio_display_get_brightness_obj, + (mp_obj_t)&displayio_display_set_brightness_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +//| .. attribute:: auto_brightness +//| +//| True when the display brightness is auto adjusted. +//| +STATIC mp_obj_t displayio_display_obj_get_auto_brightness(mp_obj_t self_in) { + displayio_display_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_bool(common_hal_displayio_display_get_auto_brightness(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_auto_brightness_obj, displayio_display_obj_get_auto_brightness); + +STATIC mp_obj_t displayio_display_obj_set_auto_brightness(mp_obj_t self_in, mp_obj_t auto_brightness) { + displayio_display_obj_t *self = MP_OBJ_TO_PTR(self_in); + + common_hal_displayio_display_set_auto_brightness(self, mp_obj_is_true(auto_brightness)); + + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_set_auto_brightness_obj, displayio_display_obj_set_auto_brightness); + +const mp_obj_property_t displayio_display_auto_brightness_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&displayio_display_get_auto_brightness_obj, + (mp_obj_t)&displayio_display_set_auto_brightness_obj, + (mp_obj_t)&mp_const_none_obj}, +}; STATIC const mp_rom_map_elem_t displayio_display_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&displayio_display_show_obj) }, { MP_ROM_QSTR(MP_QSTR_refresh_soon), MP_ROM_PTR(&displayio_display_refresh_soon_obj) }, { MP_ROM_QSTR(MP_QSTR_wait_for_frame), MP_ROM_PTR(&displayio_display_wait_for_frame_obj) }, + + { MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&displayio_display_brightness_obj) }, + { MP_ROM_QSTR(MP_QSTR_auto_brightness), MP_ROM_PTR(&displayio_display_auto_brightness_obj) }, }; STATIC MP_DEFINE_CONST_DICT(displayio_display_locals_dict, displayio_display_locals_dict_table); diff --git a/shared-bindings/displayio/Display.h b/shared-bindings/displayio/Display.h index 4cec66058..906c3620d 100644 --- a/shared-bindings/displayio/Display.h +++ b/shared-bindings/displayio/Display.h @@ -40,7 +40,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 color_depth, uint8_t set_column_command, uint8_t set_row_command, uint8_t write_ram_command, - uint8_t* init_sequence, uint16_t init_sequence_len); + uint8_t* init_sequence, uint16_t init_sequence_len, const mcu_pin_obj_t* backlight_pin); int32_t common_hal_displayio_display_wait_for_frame(displayio_display_obj_t* self); @@ -56,4 +56,10 @@ bool displayio_display_refresh_queued(displayio_display_obj_t* self); void displayio_display_finish_refresh(displayio_display_obj_t* self); bool displayio_display_send_pixels(displayio_display_obj_t* self, uint32_t* pixels, uint32_t length); +bool common_hal_displayio_display_get_auto_brightness(displayio_display_obj_t* self); +void common_hal_displayio_display_set_auto_brightness(displayio_display_obj_t* self, bool auto_brightness); + +mp_float_t common_hal_displayio_display_get_brightness(displayio_display_obj_t* self); +bool common_hal_displayio_display_set_brightness(displayio_display_obj_t* self, mp_float_t brightness); + #endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_DISPLAY_H diff --git a/shared-bindings/displayio/FourWire.c b/shared-bindings/displayio/FourWire.c index dceb4fe69..eab3bd57a 100644 --- a/shared-bindings/displayio/FourWire.c +++ b/shared-bindings/displayio/FourWire.c @@ -98,19 +98,7 @@ STATIC mp_obj_t displayio_fourwire_make_new(const mp_obj_type_t *type, size_t n_ return self; } - -//| .. method:: send(command, data) -//| -//| -STATIC mp_obj_t displayio_fourwire_obj_send(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - mp_raise_NotImplementedError(translate("displayio is a work in progress")); - - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_KW(displayio_fourwire_send_obj, 1, displayio_fourwire_obj_send); - STATIC const mp_rom_map_elem_t displayio_fourwire_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&displayio_fourwire_send_obj) }, }; STATIC MP_DEFINE_CONST_DICT(displayio_fourwire_locals_dict, displayio_fourwire_locals_dict_table); diff --git a/shared-bindings/displayio/ParallelBus.c b/shared-bindings/displayio/ParallelBus.c index 916c5f852..1ce1e2aff 100644 --- a/shared-bindings/displayio/ParallelBus.c +++ b/shared-bindings/displayio/ParallelBus.c @@ -102,19 +102,7 @@ STATIC mp_obj_t displayio_parallelbus_make_new(const mp_obj_type_t *type, size_t return self; } - -//| .. method:: send(command, data) -//| -//| -STATIC mp_obj_t displayio_parallelbus_obj_send(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - mp_raise_NotImplementedError(translate("displayio is a work in progress")); - - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_KW(displayio_parallelbus_send_obj, 1, displayio_parallelbus_obj_send); - STATIC const mp_rom_map_elem_t displayio_parallelbus_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&displayio_parallelbus_send_obj) }, }; STATIC MP_DEFINE_CONST_DICT(displayio_parallelbus_locals_dict, displayio_parallelbus_locals_dict_table); diff --git a/shared-bindings/displayio/Sprite.c b/shared-bindings/displayio/Sprite.c deleted file mode 100644 index 6f4704e45..000000000 --- a/shared-bindings/displayio/Sprite.c +++ /dev/null @@ -1,195 +0,0 @@ -/* - * 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/displayio/Sprite.h" - -#include <stdint.h> - -#include "lib/utils/context_manager_helpers.h" -#include "py/binary.h" -#include "py/objproperty.h" -#include "py/runtime.h" -#include "shared-bindings/displayio/Bitmap.h" -#include "shared-bindings/displayio/ColorConverter.h" -#include "shared-bindings/displayio/OnDiskBitmap.h" -#include "shared-bindings/displayio/Palette.h" -#include "shared-bindings/displayio/Shape.h" -#include "supervisor/shared/translate.h" - -void unpack_position(mp_obj_t position_obj, int16_t* x, int16_t* y) { - // TODO(tannewt): Support any value sequence such as bytearray or bytes. - mp_obj_tuple_t *position = MP_OBJ_TO_PTR(position_obj); - if (MP_OBJ_IS_TYPE(position_obj, &mp_type_tuple) && position->len == 2) { - *x = mp_obj_get_int(position->items[0]); - *y = mp_obj_get_int(position->items[1]); - } else if (position != mp_const_none) { - mp_raise_TypeError(translate("position must be 2-tuple")); - } -} - -//| .. currentmodule:: displayio -//| -//| :class:`Sprite` -- A particular copy of an image to display -//| ========================================================================== -//| -//| Position a particular image and pixel_shader combination. Multiple sprites can share bitmaps -//| pixel shaders. -//| -//| .. warning:: This will be changed before 4.0.0. Consider it very experimental. -//| -//| .. class:: Sprite(bitmap, *, pixel_shader, position, width, height) -//| -//| Create a Sprite object. The bitmap is source for 2d pixels. The pixel_shader is used to -//| convert the value and its location to a display native pixel color. This may be a simple color -//| palette lookup, a gradient, a pattern or a color transformer. -//| -//| -STATIC mp_obj_t displayio_sprite_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_bitmap, ARG_pixel_shader, ARG_position, ARG_width, ARG_height }; - static const mp_arg_t allowed_args[] = { - { MP_QSTR_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ }, - { MP_QSTR_pixel_shader, MP_ARG_OBJ | MP_ARG_KW_ONLY }, - { MP_QSTR_position, MP_ARG_OBJ | MP_ARG_KW_ONLY }, - { MP_QSTR_width, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = -1} }, - { MP_QSTR_height, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = -1} }, - }; - mp_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 bitmap = args[ARG_bitmap].u_obj; - - uint16_t width; - uint16_t height; - mp_obj_t native = mp_instance_cast_to_native_base(bitmap, &displayio_shape_type); - if (native != MP_OBJ_NULL) { - displayio_shape_t* bmp = MP_OBJ_TO_PTR(native); - width = bmp->width; - height = bmp->height; - } else if (MP_OBJ_IS_TYPE(bitmap, &displayio_bitmap_type)) { - displayio_bitmap_t* bmp = MP_OBJ_TO_PTR(bitmap); - native = bitmap; - width = bmp->width; - height = bmp->height; - } else if (MP_OBJ_IS_TYPE(bitmap, &displayio_ondiskbitmap_type)) { - displayio_ondiskbitmap_t* bmp = MP_OBJ_TO_PTR(bitmap); - native = bitmap; - width = bmp->width; - height = bmp->height; - } else { - mp_raise_TypeError(translate("unsupported bitmap type")); - } - int16_t x = 0; - int16_t y = 0; - mp_obj_t position_obj = args[ARG_position].u_obj; - unpack_position(position_obj, &x, &y); - - displayio_sprite_t *self = m_new_obj(displayio_sprite_t); - self->base.type = &displayio_sprite_type; - common_hal_displayio_sprite_construct(self, native, args[ARG_pixel_shader].u_obj, - width, height, x, y); - return MP_OBJ_FROM_PTR(self); -} - -//| .. attribute:: position -//| -//| The position of the top-left corner of the sprite. -//| -STATIC mp_obj_t displayio_sprite_obj_get_position(mp_obj_t self_in) { - displayio_sprite_t *self = MP_OBJ_TO_PTR(self_in); - int16_t x; - int16_t y; - common_hal_displayio_sprite_get_position(self, &x, &y); - - mp_obj_t coords[2]; - coords[0] = mp_obj_new_int(x); - coords[1] = mp_obj_new_int(y); - - return mp_obj_new_tuple(2, coords); -} -MP_DEFINE_CONST_FUN_OBJ_1(displayio_sprite_get_position_obj, displayio_sprite_obj_get_position); - -STATIC mp_obj_t displayio_sprite_obj_set_position(mp_obj_t self_in, mp_obj_t value) { - displayio_sprite_t *self = MP_OBJ_TO_PTR(self_in); - - int16_t x = 0; - int16_t y = 0; - unpack_position(value, &x, &y); - - common_hal_displayio_sprite_set_position(self, x, y); - - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_2(displayio_sprite_set_position_obj, displayio_sprite_obj_set_position); - -const mp_obj_property_t displayio_sprite_position_obj = { - .base.type = &mp_type_property, - .proxy = {(mp_obj_t)&displayio_sprite_get_position_obj, - (mp_obj_t)&displayio_sprite_set_position_obj, - (mp_obj_t)&mp_const_none_obj}, -}; - -//| .. attribute:: pixel_shader -//| -//| The pixel shader of the sprite. -//| -STATIC mp_obj_t displayio_sprite_obj_get_pixel_shader(mp_obj_t self_in) { - displayio_sprite_t *self = MP_OBJ_TO_PTR(self_in); - return common_hal_displayio_sprite_get_pixel_shader(self); -} -MP_DEFINE_CONST_FUN_OBJ_1(displayio_sprite_get_pixel_shader_obj, displayio_sprite_obj_get_pixel_shader); - -STATIC mp_obj_t displayio_sprite_obj_set_pixel_shader(mp_obj_t self_in, mp_obj_t pixel_shader) { - displayio_sprite_t *self = MP_OBJ_TO_PTR(self_in); - if (!MP_OBJ_IS_TYPE(pixel_shader, &displayio_palette_type) && !MP_OBJ_IS_TYPE(pixel_shader, &displayio_colorconverter_type)) { - mp_raise_TypeError(translate("pixel_shader must be displayio.Palette or displayio.ColorConverter")); - } - - common_hal_displayio_sprite_set_pixel_shader(self, pixel_shader); - - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_2(displayio_sprite_set_pixel_shader_obj, displayio_sprite_obj_set_pixel_shader); - -const mp_obj_property_t displayio_sprite_pixel_shader_obj = { - .base.type = &mp_type_property, - .proxy = {(mp_obj_t)&displayio_sprite_get_pixel_shader_obj, - (mp_obj_t)&displayio_sprite_set_pixel_shader_obj, - (mp_obj_t)&mp_const_none_obj}, -}; - -STATIC const mp_rom_map_elem_t displayio_sprite_locals_dict_table[] = { - // Properties - { MP_ROM_QSTR(MP_QSTR_position), MP_ROM_PTR(&displayio_sprite_position_obj) }, - { MP_ROM_QSTR(MP_QSTR_pixel_shader), MP_ROM_PTR(&displayio_sprite_pixel_shader_obj) }, -}; -STATIC MP_DEFINE_CONST_DICT(displayio_sprite_locals_dict, displayio_sprite_locals_dict_table); - -const mp_obj_type_t displayio_sprite_type = { - { &mp_type_type }, - .name = MP_QSTR_Sprite, - .make_new = displayio_sprite_make_new, - .locals_dict = (mp_obj_dict_t*)&displayio_sprite_locals_dict, -}; diff --git a/shared-bindings/displayio/TileGrid.c b/shared-bindings/displayio/TileGrid.c new file mode 100644 index 000000000..d0be43fbf --- /dev/null +++ b/shared-bindings/displayio/TileGrid.c @@ -0,0 +1,226 @@ +/* + * 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/displayio/TileGrid.h" + +#include <stdint.h> + +#include "lib/utils/context_manager_helpers.h" +#include "py/binary.h" +#include "py/objproperty.h" +#include "py/runtime.h" +#include "shared-bindings/displayio/Bitmap.h" +#include "shared-bindings/displayio/ColorConverter.h" +#include "shared-bindings/displayio/OnDiskBitmap.h" +#include "shared-bindings/displayio/Palette.h" +#include "shared-bindings/displayio/Shape.h" +#include "supervisor/shared/translate.h" + +static void unpack_position(mp_obj_t position_obj, int16_t* x, int16_t* y) { + // TODO(tannewt): Support any value sequence such as bytearray or bytes. + mp_obj_tuple_t *position = MP_OBJ_TO_PTR(position_obj); + if (MP_OBJ_IS_TYPE(position_obj, &mp_type_tuple) && position->len == 2) { + *x = mp_obj_get_int(position->items[0]); + *y = mp_obj_get_int(position->items[1]); + } else if (position != mp_const_none) { + mp_raise_TypeError(translate("position must be 2-tuple")); + } +} + +//| .. currentmodule:: displayio +//| +//| :class:`TileGrid` -- A grid of tiles sourced out of one bitmap +//| ========================================================================== +//| +//| Position a grid of tiles sourced from a bitmap and pixel_shader combination. Multiple grids +//| can share bitmaps and pixel shaders. +//| +//| A single tile grid is also known as a Sprite. +//| +//| .. warning:: This will be changed before 4.0.0. Consider it very experimental. +//| +//| .. class:: TileGrid(bitmap, *, pixel_shader, position, width=1, height=1, tile_width=None, tile_height=None, default_tile=0) +//| +//| Create a TileGrid object. The bitmap is source for 2d pixels. The pixel_shader is used to +//| convert the value and its location to a display native pixel color. This may be a simple color +//| palette lookup, a gradient, a pattern or a color transformer. +//| +//| tile_width and tile_height match the height of the bitmap by default. +//| +//| :param displayio.Bitmap bitmap: The bitmap storing one or more tiles. +//| :param displayio.Palette pixel_shader: The pixel shader that produces colors from values +//| :param tuple position: Upper left corner of the grid +//| :param int width: Width of the grid in tiles. +//| :param int height: Height of the grid in tiles. +//| :param int tile_width: Width of a single tile in pixels. Defaults to the full Bitmap and must evenly divide into the Bitmap's dimensions. +//| :param int tile_height: Height of a single tile in pixels. Defaults to the full Bitmap and must evenly divide into the Bitmap's dimensions. +//| :param in default_tile: Default tile index to show. +//| +STATIC mp_obj_t displayio_tilegrid_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_bitmap, ARG_pixel_shader, ARG_position, ARG_width, ARG_height, ARG_tile_width, ARG_tile_height, ARG_default_tile }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_pixel_shader, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_position, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_width, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 1} }, + { MP_QSTR_height, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 1} }, + { MP_QSTR_tile_width, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, + { MP_QSTR_tile_height, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, + { MP_QSTR_default_tile, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, + }; + mp_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 bitmap = args[ARG_bitmap].u_obj; + + uint16_t bitmap_width; + uint16_t bitmap_height; + mp_obj_t native = mp_instance_cast_to_native_base(bitmap, &displayio_shape_type); + if (native != MP_OBJ_NULL) { + displayio_shape_t* bmp = MP_OBJ_TO_PTR(native); + bitmap_width = bmp->width; + bitmap_height = bmp->height; + } else if (MP_OBJ_IS_TYPE(bitmap, &displayio_bitmap_type)) { + displayio_bitmap_t* bmp = MP_OBJ_TO_PTR(bitmap); + native = bitmap; + bitmap_width = bmp->width; + bitmap_height = bmp->height; + } else if (MP_OBJ_IS_TYPE(bitmap, &displayio_ondiskbitmap_type)) { + displayio_ondiskbitmap_t* bmp = MP_OBJ_TO_PTR(bitmap); + native = bitmap; + bitmap_width = bmp->width; + bitmap_height = bmp->height; + } else { + mp_raise_TypeError(translate("unsupported bitmap type")); + } + uint16_t tile_width = args[ARG_tile_width].u_int; + if (tile_width == 0) { + tile_width = bitmap_width; + } + uint16_t tile_height = args[ARG_tile_height].u_int; + if (tile_height == 0) { + tile_height = bitmap_height; + } + if (bitmap_width % tile_width != 0) { + mp_raise_ValueError(translate("Tile width must exactly divide bitmap width")); + } + if (bitmap_height % tile_height != 0) { + mp_raise_ValueError(translate("Tile height must exactly divide bitmap height")); + } + + int16_t x = 0; + int16_t y = 0; + mp_obj_t position_obj = args[ARG_position].u_obj; + unpack_position(position_obj, &x, &y); + + displayio_tilegrid_t *self = m_new_obj(displayio_tilegrid_t); + self->base.type = &displayio_tilegrid_type; + common_hal_displayio_tilegrid_construct(self, native, bitmap_width / tile_width, + args[ARG_pixel_shader].u_obj, args[ARG_width].u_int, args[ARG_height].u_int, + tile_width, tile_height, x, y, args[ARG_default_tile].u_int); + return MP_OBJ_FROM_PTR(self); +} + +//| .. attribute:: position +//| +//| The position of the top-left corner of the tilegrid. +//| +STATIC mp_obj_t displayio_tilegrid_obj_get_position(mp_obj_t self_in) { + displayio_tilegrid_t *self = MP_OBJ_TO_PTR(self_in); + int16_t x; + int16_t y; + common_hal_displayio_tilegrid_get_position(self, &x, &y); + + mp_obj_t coords[2]; + coords[0] = mp_obj_new_int(x); + coords[1] = mp_obj_new_int(y); + + return mp_obj_new_tuple(2, coords); +} +MP_DEFINE_CONST_FUN_OBJ_1(displayio_tilegrid_get_position_obj, displayio_tilegrid_obj_get_position); + +STATIC mp_obj_t displayio_tilegrid_obj_set_position(mp_obj_t self_in, mp_obj_t value) { + displayio_tilegrid_t *self = MP_OBJ_TO_PTR(self_in); + + int16_t x = 0; + int16_t y = 0; + unpack_position(value, &x, &y); + + common_hal_displayio_tilegrid_set_position(self, x, y); + + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(displayio_tilegrid_set_position_obj, displayio_tilegrid_obj_set_position); + +const mp_obj_property_t displayio_tilegrid_position_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&displayio_tilegrid_get_position_obj, + (mp_obj_t)&displayio_tilegrid_set_position_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +//| .. attribute:: pixel_shader +//| +//| The pixel shader of the tilegrid. +//| +STATIC mp_obj_t displayio_tilegrid_obj_get_pixel_shader(mp_obj_t self_in) { + displayio_tilegrid_t *self = MP_OBJ_TO_PTR(self_in); + return common_hal_displayio_tilegrid_get_pixel_shader(self); +} +MP_DEFINE_CONST_FUN_OBJ_1(displayio_tilegrid_get_pixel_shader_obj, displayio_tilegrid_obj_get_pixel_shader); + +STATIC mp_obj_t displayio_tilegrid_obj_set_pixel_shader(mp_obj_t self_in, mp_obj_t pixel_shader) { + displayio_tilegrid_t *self = MP_OBJ_TO_PTR(self_in); + if (!MP_OBJ_IS_TYPE(pixel_shader, &displayio_palette_type) && !MP_OBJ_IS_TYPE(pixel_shader, &displayio_colorconverter_type)) { + mp_raise_TypeError(translate("pixel_shader must be displayio.Palette or displayio.ColorConverter")); + } + + common_hal_displayio_tilegrid_set_pixel_shader(self, pixel_shader); + + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(displayio_tilegrid_set_pixel_shader_obj, displayio_tilegrid_obj_set_pixel_shader); + +const mp_obj_property_t displayio_tilegrid_pixel_shader_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&displayio_tilegrid_get_pixel_shader_obj, + (mp_obj_t)&displayio_tilegrid_set_pixel_shader_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +STATIC const mp_rom_map_elem_t displayio_tilegrid_locals_dict_table[] = { + // Properties + { MP_ROM_QSTR(MP_QSTR_position), MP_ROM_PTR(&displayio_tilegrid_position_obj) }, + { MP_ROM_QSTR(MP_QSTR_pixel_shader), MP_ROM_PTR(&displayio_tilegrid_pixel_shader_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(displayio_tilegrid_locals_dict, displayio_tilegrid_locals_dict_table); + +const mp_obj_type_t displayio_tilegrid_type = { + { &mp_type_type }, + .name = MP_QSTR_TileGrid, + .make_new = displayio_tilegrid_make_new, + .locals_dict = (mp_obj_dict_t*)&displayio_tilegrid_locals_dict, +}; diff --git a/shared-bindings/displayio/TileGrid.h b/shared-bindings/displayio/TileGrid.h new file mode 100644 index 000000000..2260db413 --- /dev/null +++ b/shared-bindings/displayio/TileGrid.h @@ -0,0 +1,47 @@ +/* + * This file is part of the Micro Python 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_BINDINGS_DISPLAYIO_TILEGRID_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_TILEGRID_H + +#include "shared-module/displayio/TileGrid.h" + +extern const mp_obj_type_t displayio_tilegrid_type; + +void common_hal_displayio_tilegrid_construct(displayio_tilegrid_t *self, mp_obj_t bitmap, + uint16_t bitmap_width_in_tiles, mp_obj_t pixel_shader, uint16_t width, uint16_t height, + uint16_t tile_width, uint16_t tile_height, uint16_t x, uint16_t y, uint8_t default_tile); + +void common_hal_displayio_tilegrid_get_position(displayio_tilegrid_t *self, int16_t* x, int16_t* y); +void common_hal_displayio_tilegrid_set_position(displayio_tilegrid_t *self, int16_t x, int16_t y); + +mp_obj_t common_hal_displayio_tilegrid_get_pixel_shader(displayio_tilegrid_t *self); +void common_hal_displayio_tilegrid_set_pixel_shader(displayio_tilegrid_t *self, mp_obj_t pixel_shader); + +void common_hal_displayio_textgrid_set_tile(displayio_tilegrid_t *self, uint16_t x, uint16_t y, uint8_t tile_index); +void common_hal_displayio_textgrid_set_top_left(displayio_tilegrid_t *self, uint16_t x, uint16_t y); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_TILEGRID_H diff --git a/shared-bindings/displayio/__init__.c b/shared-bindings/displayio/__init__.c index 6ed1218b2..df7162cf1 100644 --- a/shared-bindings/displayio/__init__.c +++ b/shared-bindings/displayio/__init__.c @@ -39,7 +39,7 @@ #include "shared-bindings/displayio/Palette.h" #include "shared-bindings/displayio/ParallelBus.h" #include "shared-bindings/displayio/Shape.h" -#include "shared-bindings/displayio/Sprite.h" +#include "shared-bindings/displayio/TileGrid.h" //| :mod:`displayio` --- Native display driving //| ========================================================================= @@ -67,7 +67,7 @@ //| Palette //| ParallelBus //| Shape -//| Sprite +//| TileGrid //| //| All libraries change hardware state but are never deinit //| @@ -94,7 +94,7 @@ STATIC const mp_rom_map_elem_t displayio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_OnDiskBitmap), MP_ROM_PTR(&displayio_ondiskbitmap_type) }, { MP_ROM_QSTR(MP_QSTR_Palette), MP_ROM_PTR(&displayio_palette_type) }, { MP_ROM_QSTR(MP_QSTR_Shape), MP_ROM_PTR(&displayio_shape_type) }, - { MP_ROM_QSTR(MP_QSTR_Sprite), MP_ROM_PTR(&displayio_sprite_type) }, + { MP_ROM_QSTR(MP_QSTR_TileGrid), MP_ROM_PTR(&displayio_tilegrid_type) }, { MP_ROM_QSTR(MP_QSTR_FourWire), MP_ROM_PTR(&displayio_fourwire_type) }, { MP_ROM_QSTR(MP_QSTR_ParallelBus), MP_ROM_PTR(&displayio_parallelbus_type) }, diff --git a/shared-bindings/pulseio/PWMOut.c b/shared-bindings/pulseio/PWMOut.c index ed3acd804..bba5fe883 100644 --- a/shared-bindings/pulseio/PWMOut.c +++ b/shared-bindings/pulseio/PWMOut.c @@ -108,7 +108,16 @@ STATIC mp_obj_t pulseio_pwmout_make_new(const mp_obj_type_t *type, size_t n_args // create PWM object from the given pin pulseio_pwmout_obj_t *self = m_new_obj(pulseio_pwmout_obj_t); self->base.type = &pulseio_pwmout_type; - common_hal_pulseio_pwmout_construct(self, pin, duty_cycle, frequency, variable_frequency); + pwmout_result_t result = common_hal_pulseio_pwmout_construct(self, pin, duty_cycle, frequency, variable_frequency); + if (result == PWMOUT_INVALID_PIN) { + mp_raise_ValueError(translate("Invalid pin")); + } else if (result == PWMOUT_INVALID_FREQUENCY) { + mp_raise_ValueError(translate("Invalid PWM frequency")); + } else if (result == PWMOUT_ALL_TIMERS_ON_PIN_IN_USE) { + mp_raise_ValueError(translate("All timers for this pin are in use")); + } else if (result == PWMOUT_ALL_TIMERS_IN_USE) { + mp_raise_RuntimeError(translate("All timers in use")); + } return MP_OBJ_FROM_PTR(self); } diff --git a/shared-bindings/pulseio/PWMOut.h b/shared-bindings/pulseio/PWMOut.h index 0b630816b..c01e0c926 100644 --- a/shared-bindings/pulseio/PWMOut.h +++ b/shared-bindings/pulseio/PWMOut.h @@ -32,7 +32,15 @@ extern const mp_obj_type_t pulseio_pwmout_type; -extern void common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, +typedef enum { + PWMOUT_OK, + PWMOUT_INVALID_PIN, + PWMOUT_INVALID_FREQUENCY, + PWMOUT_ALL_TIMERS_ON_PIN_IN_USE, + PWMOUT_ALL_TIMERS_IN_USE +} pwmout_result_t; + +extern pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, const mcu_pin_obj_t* pin, uint16_t duty, uint32_t frequency, bool variable_frequency); extern void common_hal_pulseio_pwmout_deinit(pulseio_pwmout_obj_t* self); @@ -43,4 +51,8 @@ extern void common_hal_pulseio_pwmout_set_frequency(pulseio_pwmout_obj_t* self, extern uint32_t common_hal_pulseio_pwmout_get_frequency(pulseio_pwmout_obj_t* self); extern bool common_hal_pulseio_pwmout_get_variable_frequency(pulseio_pwmout_obj_t* self); +// This is used by the supervisor to claim PWMOut devices indefinitely. +extern void common_hal_pulseio_pwmout_never_reset(pulseio_pwmout_obj_t *self); +extern void common_hal_pulseio_pwmout_reset_ok(pulseio_pwmout_obj_t *self); + #endif // MICROPY_INCLUDED_SHARED_BINDINGS_PULSEIO_PWMOUT_H diff --git a/shared-bindings/terminalio/Terminal.c b/shared-bindings/terminalio/Terminal.c new file mode 100644 index 000000000..67c7ead57 --- /dev/null +++ b/shared-bindings/terminalio/Terminal.c @@ -0,0 +1,131 @@ +/* + * 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 <stdint.h> + +#include "shared-bindings/terminalio/Terminal.h" +#include "shared-bindings/util.h" + +#include "py/ioctl.h" +#include "py/objproperty.h" +#include "py/objstr.h" +#include "py/runtime.h" +#include "py/stream.h" +#include "supervisor/shared/translate.h" + + +//| .. currentmodule:: terminalio +//| +//| :class:`Terminal` -- display a character stream with a TileGrid +//| ================================================================ +//| +//| .. class:: Terminal(tilegrid, *, unicode_characters="") +//| +//| Terminal manages tile indices and cursor position based on VT100 commands. Visible ASCII +//| characters are mapped to the first 94 tile indices by substracting 0x20 from characters value. +//| Unicode characters are mapped based on unicode_characters starting at index 94. +//| + +STATIC mp_obj_t terminalio_terminal_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_tilegrid, ARG_unicode_characters }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_tilegrid, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_unicode_characters, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + mp_obj_t tilegrid = args[ARG_tilegrid].u_obj; + if (!MP_OBJ_IS_TYPE(tilegrid, &displayio_tilegrid_type)) { + mp_raise_TypeError_varg(translate("Expected a %q"), displayio_tilegrid_type.name); + } + + mp_obj_t unicode_characters_obj = args[ARG_unicode_characters].u_obj; + if (MP_OBJ_IS_STR(unicode_characters_obj)) { + mp_raise_TypeError(translate("unicode_characters must be a string")); + } + + GET_STR_DATA_LEN(unicode_characters_obj, unicode_characters, unicode_characters_len); + terminalio_terminal_obj_t *self = m_new_obj(terminalio_terminal_obj_t); + self->base.type = &terminalio_terminal_type; + common_hal_terminalio_terminal_construct(self, MP_OBJ_TO_PTR(tilegrid), unicode_characters, unicode_characters_len); + return MP_OBJ_FROM_PTR(self); +} + +// These are standard stream methods. Code is in py/stream.c. +// +//| .. method:: write(buf) +//| +//| Write the buffer of bytes to the bus. +//| +//| :return: the number of bytes written +//| :rtype: int or None +//| +STATIC mp_uint_t terminalio_terminal_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) { + terminalio_terminal_obj_t *self = MP_OBJ_TO_PTR(self_in); + const byte *buf = buf_in; + + return common_hal_terminalio_terminal_write(self, buf, size, errcode); +} + +STATIC mp_uint_t terminalio_terminal_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t arg, int *errcode) { + terminalio_terminal_obj_t *self = MP_OBJ_TO_PTR(self_in); + mp_uint_t ret; + if (request == MP_IOCTL_POLL) { + mp_uint_t flags = arg; + ret = 0; + if ((flags & MP_IOCTL_POLL_WR) && common_hal_terminalio_terminal_ready_to_tx(self)) { + ret |= MP_IOCTL_POLL_WR; + } + } else { + *errcode = MP_EINVAL; + ret = MP_STREAM_ERROR; + } + return ret; +} + +STATIC const mp_rom_map_elem_t terminalio_terminal_locals_dict_table[] = { + // Standard stream methods. + { MP_OBJ_NEW_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(terminalio_terminal_locals_dict, terminalio_terminal_locals_dict_table); + +STATIC const mp_stream_p_t terminalio_terminal_stream_p = { + .read = NULL, + .write = terminalio_terminal_write, + .ioctl = terminalio_terminal_ioctl, + .is_text = true, +}; + +const mp_obj_type_t terminalio_terminal_type = { + { &mp_type_type }, + .name = MP_QSTR_Terminal, + .make_new = terminalio_terminal_make_new, + .getiter = mp_identity_getiter, + .iternext = mp_stream_unbuffered_iter, + .protocol = &terminalio_terminal_stream_p, + .locals_dict = (mp_obj_dict_t*)&terminalio_terminal_locals_dict, +}; diff --git a/shared-bindings/displayio/Sprite.h b/shared-bindings/terminalio/Terminal.h index 1944e1d74..43912243a 100644 --- a/shared-bindings/displayio/Sprite.h +++ b/shared-bindings/terminalio/Terminal.h @@ -24,20 +24,22 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_SPRITE_H -#define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_SPRITE_H +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_TERMINALIO_TERMINAL_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_TERMINALIO_TERMINAL_H -#include "shared-module/displayio/Sprite.h" +#include "shared-module/terminalio/Terminal.h" -extern const mp_obj_type_t displayio_sprite_type; +#include "shared-bindings/displayio/TileGrid.h" -void common_hal_displayio_sprite_construct(displayio_sprite_t *self, mp_obj_t bitmap, - mp_obj_t pixel_shader, uint16_t width, uint16_t height, uint16_t x, uint16_t y); +extern const mp_obj_type_t terminalio_terminal_type; -void common_hal_displayio_sprite_get_position(displayio_sprite_t *self, int16_t* x, int16_t* y); -void common_hal_displayio_sprite_set_position(displayio_sprite_t *self, int16_t x, int16_t y); +extern void common_hal_terminalio_terminal_construct(terminalio_terminal_obj_t *self, + displayio_tilegrid_t* tilegrid, const byte* unicode_characters, size_t unicode_characters_len); -mp_obj_t common_hal_displayio_sprite_get_pixel_shader(displayio_sprite_t *self); -void common_hal_displayio_sprite_set_pixel_shader(displayio_sprite_t *self, mp_obj_t pixel_shader); +// Write characters. len is in characters NOT bytes! +extern size_t common_hal_terminalio_terminal_write(terminalio_terminal_obj_t *self, + const uint8_t *data, size_t len, int *errcode); -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_SPRITE_H +extern bool common_hal_terminalio_terminal_ready_to_tx(terminalio_terminal_obj_t *self); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_TERMINALIO_TERMINAL_H diff --git a/shared-bindings/terminalio/__init__.c b/shared-bindings/terminalio/__init__.c new file mode 100644 index 000000000..482cb78e6 --- /dev/null +++ b/shared-bindings/terminalio/__init__.c @@ -0,0 +1,64 @@ +/* + * 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. + */ + +#include <stdint.h> + +#include "py/obj.h" +#include "py/runtime.h" + +#include "shared-bindings/terminalio/__init__.h" +#include "shared-bindings/terminalio/Terminal.h" + +#include "py/runtime.h" + +//| :mod:`terminalio` --- Displays text in a TileGrid +//| ================================================= +//| +//| .. module:: terminalio +//| :synopsis: Displays text in a TileGrid +//| +//| The `terminalio` module contains classes to display a character stream on a display +//| +//| Libraries +//| +//| .. toctree:: +//| :maxdepth: 3 +//| +//| Terminal +//| +//| +STATIC const mp_rom_map_elem_t terminalio_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_terminalio) }, + { MP_ROM_QSTR(MP_QSTR_Terminal), MP_OBJ_FROM_PTR(&terminalio_terminal_type) }, +}; + + +STATIC MP_DEFINE_CONST_DICT(terminalio_module_globals, terminalio_module_globals_table); + +const mp_obj_module_t terminalio_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&terminalio_module_globals, +}; diff --git a/shared-bindings/terminalio/__init__.h b/shared-bindings/terminalio/__init__.h new file mode 100644 index 000000000..4be14dfc6 --- /dev/null +++ b/shared-bindings/terminalio/__init__.h @@ -0,0 +1,32 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft + * + * 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_TERMINALIO___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_TERMINALIO___INIT___H + +// Nothing now. + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_TERMINALIO___INIT___H diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c index 7946111b7..ef0334d10 100644 --- a/shared-module/displayio/Display.c +++ b/shared-module/displayio/Display.c @@ -29,7 +29,10 @@ #include "py/runtime.h" #include "shared-bindings/displayio/FourWire.h" #include "shared-bindings/displayio/ParallelBus.h" +#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/time/__init__.h" +#include "shared-module/displayio/__init__.h" +#include "supervisor/shared/display.h" #include <stdint.h> @@ -40,16 +43,19 @@ 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 color_depth, uint8_t set_column_command, uint8_t set_row_command, - uint8_t write_ram_command, uint8_t* init_sequence, uint16_t init_sequence_len) { + uint8_t write_ram_command, uint8_t* init_sequence, uint16_t init_sequence_len, + const mcu_pin_obj_t* backlight_pin) { self->width = width; self->height = height; self->color_depth = color_depth; self->set_column_command = set_column_command; self->set_row_command = set_row_command; self->write_ram_command = write_ram_command; + self->refresh = false; self->current_group = NULL; self->colstart = colstart; self->rowstart = rowstart; + self->auto_brightness = false; if (MP_OBJ_IS_TYPE(bus, &displayio_parallelbus_type)) { self->begin_transaction = common_hal_displayio_parallelbus_begin_transaction; @@ -86,9 +92,33 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self, i += 2 + data_size; } self->end_transaction(self->bus); + + supervisor_start_terminal(width, height); + + // Set the group after initialization otherwise we may send pixels while we delay in + // initialization. + self->refresh = true; + self->current_group = &circuitpython_splash; + + // Always set the backlight type in case we're reusing memory. + self->backlight_inout.base.type = &mp_type_NoneType; + if (backlight_pin != NULL && common_hal_mcu_pin_is_free(backlight_pin)) { + pwmout_result_t result = common_hal_pulseio_pwmout_construct(&self->backlight_pwm, backlight_pin, 0, 5000, false); + if (result != PWMOUT_OK) { + self->backlight_inout.base.type = &digitalio_digitalinout_type; + common_hal_digitalio_digitalinout_construct(&self->backlight_inout, backlight_pin); + never_reset_pin_number(backlight_pin->number); + } else { + self->backlight_pwm.base.type = &pulseio_pwmout_type; + common_hal_pulseio_pwmout_never_reset(&self->backlight_pwm); + } + } } void common_hal_displayio_display_show(displayio_display_obj_t* self, displayio_group_t* root_group) { + if (root_group == NULL) { + root_group = &circuitpython_splash; + } self->current_group = root_group; common_hal_displayio_display_refresh_soon(self); } @@ -105,6 +135,42 @@ int32_t common_hal_displayio_display_wait_for_frame(displayio_display_obj_t* sel return 0; } +bool common_hal_displayio_display_get_auto_brightness(displayio_display_obj_t* self) { + return self->auto_brightness; +} + +void common_hal_displayio_display_set_auto_brightness(displayio_display_obj_t* self, bool auto_brightness) { + self->auto_brightness = auto_brightness; +} + +mp_float_t common_hal_displayio_display_get_brightness(displayio_display_obj_t* self) { + if (self->backlight_pwm.base.type == &pulseio_pwmout_type) { + uint16_t duty_cycle = common_hal_pulseio_pwmout_get_duty_cycle(&self->backlight_pwm); + return duty_cycle / ((mp_float_t) 0xffff); + } else if (self->backlight_inout.base.type == &digitalio_digitalinout_type) { + if (common_hal_digitalio_digitalinout_get_value(&self->backlight_inout)) { + return 1.0; + } else { + return 0.0; + } + } + return -1.0; +} + +bool common_hal_displayio_display_set_brightness(displayio_display_obj_t* self, mp_float_t brightness) { + self->updating_backlight = true; + bool ok = false; + if (self->backlight_pwm.base.type == &pulseio_pwmout_type) { + common_hal_pulseio_pwmout_set_duty_cycle(&self->backlight_pwm, (uint16_t) (0xffff * brightness)); + ok = true; + } else if (self->backlight_inout.base.type == &digitalio_digitalinout_type) { + common_hal_digitalio_digitalinout_set_value(&self->backlight_inout, brightness > 0.99); + ok = true; + } + self->updating_backlight = false; + return ok; +} + void displayio_display_start_region_update(displayio_display_obj_t* self, uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) { // TODO(tannewt): Handle displays with single byte bounds. self->begin_transaction(self->bus); @@ -114,8 +180,8 @@ void displayio_display_start_region_update(displayio_display_obj_t* self, uint16 data[1] = __builtin_bswap16(x1 - 1 + self->colstart); self->send(self->bus, false, (uint8_t*) data, 4); self->send(self->bus, true, &self->set_row_command, 1); - data[0] = __builtin_bswap16(y0 + 1 + self->rowstart); - data[1] = __builtin_bswap16(y1 + self->rowstart); + data[0] = __builtin_bswap16(y0 + self->rowstart); + data[1] = __builtin_bswap16(y1 - 1 + self->rowstart); self->send(self->bus, false, (uint8_t*) data, 4); self->send(self->bus, true, &self->write_ram_command, 1); } @@ -145,3 +211,26 @@ bool displayio_display_send_pixels(displayio_display_obj_t* self, uint32_t* pixe self->send(self->bus, false, (uint8_t*) pixels, length * 4); return true; } + +void displayio_display_update_backlight(displayio_display_obj_t* self) { + if (!self->auto_brightness || self->updating_backlight) { + return; + } + if (ticks_ms - self->last_backlight_refresh < 100) { + return; + } + // TODO(tannewt): Fade the backlight based on it's existing value and a target value. The target + // should account for ambient light when possible. + common_hal_displayio_display_set_brightness(self, 1.0); + + self->last_backlight_refresh = ticks_ms; +} + +void release_display(displayio_display_obj_t* self) { + if (self->backlight_pwm.base.type == &pulseio_pwmout_type) { + common_hal_pulseio_pwmout_reset_ok(&self->backlight_pwm); + common_hal_pulseio_pwmout_deinit(&self->backlight_pwm); + } else if (self->backlight_inout.base.type == &digitalio_digitalinout_type) { + common_hal_digitalio_digitalinout_deinit(&self->backlight_inout); + } +} diff --git a/shared-module/displayio/Display.h b/shared-module/displayio/Display.h index 1f1355d31..0d7393aff 100644 --- a/shared-module/displayio/Display.h +++ b/shared-module/displayio/Display.h @@ -27,7 +27,9 @@ #ifndef MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_DISPLAY_H #define MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_DISPLAY_H -#include "shared-module/displayio/Group.h" +#include "shared-bindings/digitalio/DigitalInOut.h" +#include "shared-bindings/displayio/Group.h" +#include "shared-bindings/pulseio/PWMOut.h" typedef bool (*display_bus_begin_transaction)(mp_obj_t bus); typedef void (*display_bus_send)(mp_obj_t bus, bool command, uint8_t *data, uint32_t data_length); @@ -50,6 +52,16 @@ typedef struct { display_bus_begin_transaction begin_transaction; display_bus_send send; display_bus_end_transaction end_transaction; + union { + digitalio_digitalinout_obj_t backlight_inout; + pulseio_pwmout_obj_t backlight_pwm; + }; + uint64_t last_backlight_refresh; + bool auto_brightness:1; + bool updating_backlight:1; } displayio_display_obj_t; +void displayio_display_update_backlight(displayio_display_obj_t* self); +void release_display(displayio_display_obj_t* self); + #endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_DISPLAY_H diff --git a/shared-module/displayio/Group.c b/shared-module/displayio/Group.c index 255349d7c..95043e4f3 100644 --- a/shared-module/displayio/Group.c +++ b/shared-module/displayio/Group.c @@ -27,7 +27,7 @@ #include "shared-bindings/displayio/Group.h" #include "py/runtime.h" -#include "shared-bindings/displayio/Sprite.h" +#include "shared-bindings/displayio/TileGrid.h" void common_hal_displayio_group_construct(displayio_group_t* self, uint32_t max_size) { mp_obj_t* children = m_new(mp_obj_t, max_size); @@ -40,10 +40,10 @@ void common_hal_displayio_group_append(displayio_group_t* self, mp_obj_t layer) } mp_obj_t native_layer = mp_instance_cast_to_native_base(layer, &displayio_group_type); if (native_layer == MP_OBJ_NULL) { - native_layer = mp_instance_cast_to_native_base(layer, &displayio_sprite_type); + native_layer = mp_instance_cast_to_native_base(layer, &displayio_tilegrid_type); } if (native_layer == MP_OBJ_NULL) { - mp_raise_ValueError(translate("Layer must be a Group or Sprite subclass.")); + mp_raise_ValueError(translate("Layer must be a Group or TileGrid subclass.")); } self->children[self->size] = layer; self->size++; @@ -77,8 +77,8 @@ bool displayio_group_get_pixel(displayio_group_t *self, int16_t x, int16_t y, ui y /= self->scale; for (int32_t i = self->size - 1; i >= 0 ; i--) { mp_obj_t layer = self->children[i]; - if (MP_OBJ_IS_TYPE(layer, &displayio_sprite_type)) { - if (displayio_sprite_get_pixel(layer, x, y, pixel)) { + if (MP_OBJ_IS_TYPE(layer, &displayio_tilegrid_type)) { + if (displayio_tilegrid_get_pixel(layer, x, y, pixel)) { return true; } } else if (MP_OBJ_IS_TYPE(layer, &displayio_group_type)) { @@ -97,12 +97,15 @@ bool displayio_group_needs_refresh(displayio_group_t *self) { } for (int32_t i = self->size - 1; i >= 0 ; i--) { mp_obj_t layer = self->children[i]; - if (MP_OBJ_IS_TYPE(layer, &displayio_sprite_type)) { - if (displayio_sprite_needs_refresh(layer)) { + if (MP_OBJ_IS_TYPE(layer, &displayio_tilegrid_type)) { + if (displayio_tilegrid_needs_refresh(layer)) { + return true; + } + } else if (MP_OBJ_IS_TYPE(layer, &displayio_group_type)) { + if (displayio_group_needs_refresh(layer)) { return true; } } - // TODO: Tiled layer } return false; } @@ -111,9 +114,10 @@ void displayio_group_finish_refresh(displayio_group_t *self) { self->needs_refresh = false; for (int32_t i = self->size - 1; i >= 0 ; i--) { mp_obj_t layer = self->children[i]; - if (MP_OBJ_IS_TYPE(layer, &displayio_sprite_type)) { - displayio_sprite_finish_refresh(layer); + if (MP_OBJ_IS_TYPE(layer, &displayio_tilegrid_type)) { + displayio_tilegrid_finish_refresh(layer); + } else if (MP_OBJ_IS_TYPE(layer, &displayio_group_type)) { + displayio_group_finish_refresh(layer); } - // TODO: Tiled layer } } diff --git a/shared-module/displayio/Sprite.c b/shared-module/displayio/TileGrid.c index da6eff896..b90603afe 100644 --- a/shared-module/displayio/Sprite.c +++ b/shared-module/displayio/TileGrid.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "shared-bindings/displayio/Sprite.h" +#include "shared-bindings/displayio/TileGrid.h" #include "shared-bindings/displayio/Bitmap.h" #include "shared-bindings/displayio/ColorConverter.h" @@ -32,50 +32,78 @@ #include "shared-bindings/displayio/Palette.h" #include "shared-bindings/displayio/Shape.h" -void common_hal_displayio_sprite_construct(displayio_sprite_t *self, mp_obj_t bitmap, - mp_obj_t pixel_shader, uint16_t width, uint16_t height, uint16_t x, uint16_t y) { - self->width = width; - self->height = height; +void common_hal_displayio_tilegrid_construct(displayio_tilegrid_t *self, mp_obj_t bitmap, + uint16_t bitmap_width_in_tiles, + mp_obj_t pixel_shader, uint16_t width, uint16_t height, + uint16_t tile_width, uint16_t tile_height, uint16_t x, uint16_t y, uint8_t default_tile) { + uint32_t total_tiles = width * height; + // Sprites will only have one tile so save a little memory by inlining values in the pointer. + uint8_t inline_tiles = sizeof(uint8_t*); + if (total_tiles <= inline_tiles) { + self->inline_tiles = true; + } else { + self->tiles = (uint8_t*) m_malloc(total_tiles, false); + self->inline_tiles = false; + } + self->bitmap_width_in_tiles = bitmap_width_in_tiles; + self->width_in_tiles = width; + self->height_in_tiles = height; + self->total_width = width * tile_width; + self->total_height = height * tile_height; + self->tile_width = tile_width; + self->tile_height = tile_height; self->bitmap = bitmap; self->pixel_shader = pixel_shader; self->x = x; self->y = y; } -void common_hal_displayio_sprite_get_position(displayio_sprite_t *self, int16_t* x, int16_t* y) { +void common_hal_displayio_tilegrid_get_position(displayio_tilegrid_t *self, int16_t* x, int16_t* y) { *x = self->x; *y = self->y; } -void common_hal_displayio_sprite_set_position(displayio_sprite_t *self, int16_t x, int16_t y) { +void common_hal_displayio_tilegrid_set_position(displayio_tilegrid_t *self, int16_t x, int16_t y) { self->x = x; self->y = y; self->needs_refresh = true; } - -mp_obj_t common_hal_displayio_sprite_get_pixel_shader(displayio_sprite_t *self) { +mp_obj_t common_hal_displayio_tilegrid_get_pixel_shader(displayio_tilegrid_t *self) { return self->pixel_shader; } -void common_hal_displayio_sprite_set_pixel_shader(displayio_sprite_t *self, mp_obj_t pixel_shader) { +void common_hal_displayio_tilegrid_set_pixel_shader(displayio_tilegrid_t *self, mp_obj_t pixel_shader) { self->pixel_shader = pixel_shader; self->needs_refresh = true; } -bool displayio_sprite_get_pixel(displayio_sprite_t *self, int16_t x, int16_t y, uint16_t* pixel) { +bool displayio_tilegrid_get_pixel(displayio_tilegrid_t *self, int16_t x, int16_t y, uint16_t* pixel) { x -= self->x; y -= self->y; - if (y < 0 || y >= self->height || x >= self->width || x < 0) { + if (y < 0 || y >= self->total_height || x >= self->total_width || x < 0) { + return false; + } + + uint8_t* tiles = self->tiles; + if (self->inline_tiles) { + tiles = (uint8_t*) &self->tiles; + } + if (tiles == NULL) { return false; } + uint16_t tile_location = ((y / self->tile_height + self->top_left_y) % self->height_in_tiles) * self->width_in_tiles + (x / self->tile_width + self->top_left_x) % self->width_in_tiles; + uint8_t tile = tiles[tile_location]; + uint16_t tile_x = tile_x = (tile % self->bitmap_width_in_tiles) * self->tile_width + x % self->tile_width; + uint16_t tile_y = tile_y = (tile / self->bitmap_width_in_tiles) * self->tile_height + y % self->tile_height; + uint32_t value = 0; if (MP_OBJ_IS_TYPE(self->bitmap, &displayio_bitmap_type)) { - value = common_hal_displayio_bitmap_get_pixel(self->bitmap, x, y); + value = common_hal_displayio_bitmap_get_pixel(self->bitmap, tile_x, tile_y); } else if (MP_OBJ_IS_TYPE(self->bitmap, &displayio_shape_type)) { - value = common_hal_displayio_shape_get_pixel(self->bitmap, x, y); + value = common_hal_displayio_shape_get_pixel(self->bitmap, tile_x, tile_y); } else if (MP_OBJ_IS_TYPE(self->bitmap, &displayio_ondiskbitmap_type)) { - value = common_hal_displayio_ondiskbitmap_get_pixel(self->bitmap, x, y); + value = common_hal_displayio_ondiskbitmap_get_pixel(self->bitmap, tile_x, tile_y); } if (self->pixel_shader == mp_const_none) { @@ -90,11 +118,29 @@ bool displayio_sprite_get_pixel(displayio_sprite_t *self, int16_t x, int16_t y, return false; } -bool displayio_sprite_needs_refresh(displayio_sprite_t *self) { +void common_hal_displayio_textgrid_set_tile(displayio_tilegrid_t *self, uint16_t x, uint16_t y, uint8_t tile_index) { + uint8_t* tiles = self->tiles; + if (self->inline_tiles) { + tiles = (uint8_t*) &self->tiles; + } + if (tiles == NULL) { + return; + } + tiles[y * self->width_in_tiles + x] = tile_index; + self->needs_refresh = true; +} + + +void common_hal_displayio_textgrid_set_top_left(displayio_tilegrid_t *self, uint16_t x, uint16_t y) { + self->top_left_x = x; + self->top_left_y = y; +} + +bool displayio_tilegrid_needs_refresh(displayio_tilegrid_t *self) { return self->needs_refresh || displayio_palette_needs_refresh(self->pixel_shader); } -void displayio_sprite_finish_refresh(displayio_sprite_t *self) { +void displayio_tilegrid_finish_refresh(displayio_tilegrid_t *self) { self->needs_refresh = false; displayio_palette_finish_refresh(self->pixel_shader); // TODO(tannewt): We could double buffer changes to position and move them over here. diff --git a/shared-module/displayio/TileGrid.h b/shared-module/displayio/TileGrid.h new file mode 100644 index 000000000..59645553d --- /dev/null +++ b/shared-module/displayio/TileGrid.h @@ -0,0 +1,59 @@ +/* + * This file is part of the Micro Python 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_TILEGRID_H +#define MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_TILEGRID_H + +#include <stdbool.h> +#include <stdint.h> + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + mp_obj_t bitmap; + mp_obj_t pixel_shader; + uint16_t x; + uint16_t y; + uint16_t bitmap_width_in_tiles; + uint16_t width_in_tiles; + uint16_t height_in_tiles; + uint16_t total_width; + uint16_t total_height; + uint16_t tile_width; + uint16_t tile_height; + uint16_t top_left_x; + uint16_t top_left_y; + uint8_t* tiles; + bool needs_refresh; + bool inline_tiles; +} displayio_tilegrid_t; + +bool displayio_tilegrid_get_pixel(displayio_tilegrid_t *self, int16_t x, int16_t y, uint16_t *pixel); +bool displayio_tilegrid_needs_refresh(displayio_tilegrid_t *self); +void displayio_tilegrid_finish_refresh(displayio_tilegrid_t *self); + +#endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_TILEGRID_H diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index c86e48a12..f09e4e791 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -6,7 +6,8 @@ #include "shared-bindings/displayio/Display.h" #include "shared-bindings/displayio/Group.h" #include "shared-bindings/displayio/Palette.h" -#include "shared-bindings/displayio/Sprite.h" +#include "supervisor/shared/display.h" +#include "supervisor/memory.h" #include "supervisor/usb.h" primary_display_t displays[CIRCUITPY_DISPLAY_LIMIT]; @@ -17,6 +18,7 @@ void displayio_refresh_displays(void) { continue; } displayio_display_obj_t* display = &displays[i].display; + displayio_display_update_backlight(display); if (!displayio_display_frame_queued(display)) { return; @@ -66,78 +68,28 @@ void displayio_refresh_displays(void) { } } -uint32_t blinka_bitmap_data[32] = { - 0x00000011, 0x11000000, - 0x00000111, 0x53100000, - 0x00000111, 0x56110000, - 0x00000111, 0x11140000, - 0x00000111, 0x20002000, - 0x00000011, 0x13000000, - 0x00000001, 0x11200000, - 0x00000000, 0x11330000, - 0x00000000, 0x01122000, - 0x00001111, 0x44133000, - 0x00032323, 0x24112200, - 0x00111114, 0x44113300, - 0x00323232, 0x34112200, - 0x11111144, 0x44443300, - 0x11111111, 0x11144401, - 0x23232323, 0x21111110 -}; - -displayio_bitmap_t blinka_bitmap = { - .base = {.type = &displayio_bitmap_type }, - .width = 16, - .height = 16, - .data = blinka_bitmap_data, - .stride = 2, - .bits_per_value = 4, - .x_shift = 3, - .x_mask = 0x7, - .bitmask = 0xf -}; - -uint32_t blinka_transparency[1] = {0x80000000}; - -// These colors are RGB 565 with the bytes swapped. -uint32_t blinka_colors[8] = {0x78890000, 0x9F86B8FC, 0xffff0D5A, 0x0000f501, - 0x00000000, 0x00000000, 0x00000000, 0x00000000}; - -displayio_palette_t blinka_palette = { - .base = {.type = &displayio_palette_type }, - .opaque = blinka_transparency, - .colors = blinka_colors, - .color_count = 16, - .needs_refresh = false -}; - -displayio_sprite_t blinka_sprite = { - .base = {.type = &displayio_sprite_type }, - .bitmap = &blinka_bitmap, - .pixel_shader = &blinka_palette, - .x = 0, - .y = 0, - .width = 16, - .height = 16, - .needs_refresh = false -}; - -mp_obj_t splash_children[1] = { - &blinka_sprite, -}; +void common_hal_displayio_release_displays(void) { + for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { + mp_const_obj_t bus_type = displays[i].fourwire_bus.base.type; + if (bus_type == NULL) { + continue; + } else if (bus_type == &displayio_fourwire_type) { + common_hal_displayio_fourwire_deinit(&displays[i].fourwire_bus); + } else if (bus_type == &displayio_parallelbus_type) { + common_hal_displayio_parallelbus_deinit(&displays[i].parallel_bus); + } + displays[i].fourwire_bus.base.type = &mp_type_NoneType; + } + for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { + release_display(&displays[i].display); + displays[i].display.base.type = &mp_type_NoneType; + } -displayio_group_t splash = { - .base = {.type = &displayio_group_type }, - .x = 0, - .y = 0, - .scale = 2, - .size = 1, - .max_size = 1, - .children = splash_children, - .needs_refresh = true -}; + supervisor_stop_terminal(); +} void reset_displays(void) { + #if CIRCUITPY_DISPLAYIO // The SPI buses used by FourWires may be allocated on the heap so we need to move them inline. for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { if (displays[i].fourwire_bus.base.type != &displayio_fourwire_type) { @@ -166,23 +118,8 @@ void reset_displays(void) { continue; } displayio_display_obj_t* display = &displays[i].display; - common_hal_displayio_display_show(display, &splash); - } -} - -void common_hal_displayio_release_displays(void) { - for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { - mp_const_obj_t bus_type = displays[i].fourwire_bus.base.type; - if (bus_type == NULL) { - continue; - } else if (bus_type == &displayio_fourwire_type) { - common_hal_displayio_fourwire_deinit(&displays[i].fourwire_bus); - } else if (bus_type == &displayio_parallelbus_type) { - common_hal_displayio_parallelbus_deinit(&displays[i].parallel_bus); - } - displays[i].fourwire_bus.base.type = &mp_type_NoneType; - } - for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { - displays[i].display.base.type = &mp_type_NoneType; + display->auto_brightness = true; + common_hal_displayio_display_show(display, &circuitpython_splash); } + #endif } diff --git a/shared-module/displayio/__init__.h b/shared-module/displayio/__init__.h index fdabd4ec4..5b56ed55c 100644 --- a/shared-module/displayio/__init__.h +++ b/shared-module/displayio/__init__.h @@ -29,6 +29,7 @@ #include "shared-bindings/displayio/Display.h" #include "shared-bindings/displayio/FourWire.h" +#include "shared-bindings/displayio/Group.h" #include "shared-bindings/displayio/ParallelBus.h" typedef struct { @@ -41,6 +42,8 @@ typedef struct { extern primary_display_t displays[CIRCUITPY_DISPLAY_LIMIT]; +extern displayio_group_t circuitpython_splash; + void displayio_refresh_displays(void); void reset_displays(void); diff --git a/shared-module/terminalio/Terminal.c b/shared-module/terminalio/Terminal.c new file mode 100644 index 000000000..6734fa30e --- /dev/null +++ b/shared-module/terminalio/Terminal.c @@ -0,0 +1,127 @@ +/* + * 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. + */ + +#include "shared-module/terminalio/Terminal.h" + +#include "shared-module/displayio/__init__.h" +#include "shared-bindings/displayio/TileGrid.h" + +void common_hal_terminalio_terminal_construct(terminalio_terminal_obj_t *self, displayio_tilegrid_t* tilegrid, const uint8_t* unicode_characters, size_t unicode_characters_len) { + self->cursor_x = 0; + self->cursor_y = 0; + self->tilegrid = tilegrid; + self->unicode_characters = unicode_characters; + self->unicode_characters_len = unicode_characters_len; + self->first_row = 0; +} + +size_t common_hal_terminalio_terminal_write(terminalio_terminal_obj_t *self, const byte *data, size_t len, int *errcode) { + const byte* i = data; + uint16_t start_y = self->cursor_y; + while (i < data + len) { + unichar c = utf8_get_char(i); + i = utf8_next_char(i); + // Always handle ASCII. + if (c < 128) { + if (c >= 0x20 && c <= 0x7e) { + common_hal_displayio_textgrid_set_tile(self->tilegrid, self->cursor_x, self->cursor_y, c - 0x20); + self->cursor_x++; + } + if (c == '\r') { + self->cursor_x = 0; + } else if (c == '\n') { + self->cursor_y++; + // Commands below are used by MicroPython in the REPL + } else if (c == '\b') { + if (self->cursor_x > 0) { + self->cursor_x--; + } + } else if (c == 0x1b) { + if (i[0] == '[') { + if (i[1] == 'K') { + // Clear the rest of the line. + for (uint16_t j = self->cursor_x; j < self->tilegrid->width_in_tiles; j++) { + common_hal_displayio_textgrid_set_tile(self->tilegrid, j, self->cursor_y, 0); + } + i += 2; + } else { + // Handle commands of the form \x1b[####D + uint16_t n = 0; + uint8_t j = 1; + for (; j < 6; j++) { + if ('0' <= i[j] && i[j] <= '9') { + n = n * 10 + (i[j] - '0'); + } else { + c = i[j]; + } + } + if (c == 'D') { + if (n > self->cursor_x) { + self->cursor_x = 0; + } else { + self->cursor_x -= n; + } + i += j; + } + } + } + } + } else { + // Do a linear search of the mapping for unicode. + const byte* j = self->unicode_characters; + uint8_t k = 0; + while (j < self->unicode_characters + self->unicode_characters_len) { + unichar potential_c = utf8_get_char(j); + j = utf8_next_char(j); + if (c == potential_c) { + common_hal_displayio_textgrid_set_tile(self->tilegrid, self->cursor_x, self->cursor_y, 0x7f - 0x20 + k); + self->cursor_x++; + break; + } + } + } + if (self->cursor_x >= self->tilegrid->width_in_tiles) { + self->cursor_y++; + self->cursor_x %= self->tilegrid->width_in_tiles; + } + if (self->cursor_y >= self->tilegrid->height_in_tiles) { + self->cursor_y %= self->tilegrid->height_in_tiles; + } + if (self->cursor_y != start_y) { + // clear the new row + for (uint16_t j = 0; j < self->tilegrid->width_in_tiles; j++) { + common_hal_displayio_textgrid_set_tile(self->tilegrid, j, self->cursor_y, 0); + start_y = self->cursor_y; + } + common_hal_displayio_textgrid_set_top_left(self->tilegrid, 0, (start_y + self->tilegrid->height_in_tiles + 1) % self->tilegrid->height_in_tiles); + } + } + return i - data; +} + +bool common_hal_terminalio_terminal_ready_to_tx(terminalio_terminal_obj_t *self) { + return true; +} diff --git a/shared-module/displayio/Sprite.h b/shared-module/terminalio/Terminal.h index dc368c4b7..fe9dcf0c4 100644 --- a/shared-module/displayio/Sprite.h +++ b/shared-module/terminalio/Terminal.h @@ -1,5 +1,5 @@ /* - * This file is part of the Micro Python project, http://micropython.org/ + * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * @@ -24,27 +24,23 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_SPRITE_H -#define MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_SPRITE_H +#ifndef SHARED_MODULE_TERMINALIO_TERMINAL_H +#define SHARED_MODULE_TERMINALIO_TERMINAL_H -#include <stdbool.h> #include <stdint.h> +#include <stdbool.h> #include "py/obj.h" +#include "shared-module/displayio/TileGrid.h" -typedef struct { +typedef struct { mp_obj_base_t base; - mp_obj_t bitmap; - mp_obj_t pixel_shader; - uint16_t x; - uint16_t y; - uint16_t width; - uint16_t height; - bool needs_refresh; -} displayio_sprite_t; - -bool displayio_sprite_get_pixel(displayio_sprite_t *sprite, int16_t x, int16_t y, uint16_t *pixel); -bool displayio_sprite_needs_refresh(displayio_sprite_t *self); -void displayio_sprite_finish_refresh(displayio_sprite_t *self); + uint16_t cursor_x; + uint16_t cursor_y; + displayio_tilegrid_t* tilegrid; + const byte* unicode_characters; + uint16_t unicode_characters_len; + uint16_t first_row; +} terminalio_terminal_obj_t; -#endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_SPRITE_H +#endif /* SHARED_MODULE_TERMINALIO_TERMINAL_H */ diff --git a/shared-module/terminalio/__init__.c b/shared-module/terminalio/__init__.c new file mode 100644 index 000000000..3f61f4823 --- /dev/null +++ b/shared-module/terminalio/__init__.c @@ -0,0 +1,27 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2018 hathach 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/terminalio/__init__.h" diff --git a/shared-module/terminalio/__init__.h b/shared-module/terminalio/__init__.h new file mode 100644 index 000000000..e925dd429 --- /dev/null +++ b/shared-module/terminalio/__init__.h @@ -0,0 +1,30 @@ +/* + * 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. + */ + +#ifndef SHARED_MODULE_TERMINALIO___INIT___H +#define SHARED_MODULE_TERMINALIO___INIT___H + +#endif /* SHARED_MODULE_TERMINALIO___INIT___H */ diff --git a/supervisor/memory.h b/supervisor/memory.h index c89f14bd9..f557744ae 100755 --- a/supervisor/memory.h +++ b/supervisor/memory.h @@ -57,4 +57,7 @@ static inline uint16_t align32_size(uint16_t size) { return size; } +// Called after the heap is freed in case the supervisor wants to save some values. +void supervisor_move_memory(void); + #endif // MICROPY_INCLUDED_SUPERVISOR_MEMORY_H diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c new file mode 100644 index 000000000..3a430f568 --- /dev/null +++ b/supervisor/shared/display.c @@ -0,0 +1,188 @@ +/* + * 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. + */ + +#include "supervisor/shared/display.h" + +#include <string.h> + +#include "py/mpstate.h" +#include "shared-bindings/displayio/Group.h" +#include "shared-bindings/displayio/Palette.h" +#include "shared-bindings/displayio/TileGrid.h" +#include "supervisor/memory.h" + +extern uint32_t blinka_bitmap_data[]; +extern displayio_bitmap_t blinka_bitmap; +extern displayio_group_t circuitpython_splash; + +static supervisor_allocation* tilegrid_tiles = NULL; + +void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) { + displayio_tilegrid_t* grid = &supervisor_terminal_text_grid; + uint16_t width_in_tiles = (width_px - blinka_bitmap.width) / grid->tile_width; + // determine scale based on h + uint8_t scale = 1; + if (width_in_tiles > 80) { + scale = 2; + } + width_in_tiles = (width_px - blinka_bitmap.width * scale) / (grid->tile_width * scale); + uint16_t height_in_tiles = height_px / (grid->tile_height * scale); + circuitpython_splash.scale = scale; + + uint16_t total_tiles = width_in_tiles * height_in_tiles; + + // First try to allocate outside the heap. This will fail when the VM is running. + tilegrid_tiles = allocate_memory(total_tiles, false); + uint8_t* tiles; + if (tilegrid_tiles == NULL) { + tiles = m_malloc(total_tiles, true); + MP_STATE_VM(terminal_tilegrid_tiles) = tiles; + } else { + tiles = (uint8_t*) tilegrid_tiles->ptr; + } + + if (tiles == NULL) { + return; + } + + grid->width_in_tiles = width_in_tiles; + grid->height_in_tiles = height_in_tiles; + grid->total_width = width_in_tiles * grid->tile_width; + grid->total_height = height_in_tiles * grid->tile_height; + grid->tiles = tiles; + + supervisor_terminal.cursor_x = 0; + supervisor_terminal.cursor_y = 0; +} + +void supervisor_stop_terminal(void) { + if (tilegrid_tiles != NULL) { + free_memory(tilegrid_tiles); + supervisor_terminal_text_grid.inline_tiles = false; + supervisor_terminal_text_grid.tiles = NULL; + } +} + +void supervisor_display_move_memory(void) { + #if CIRCUITPY_DISPLAYIO + displayio_tilegrid_t* grid = &supervisor_terminal_text_grid; + if (MP_STATE_VM(terminal_tilegrid_tiles) == NULL || grid->tiles != MP_STATE_VM(terminal_tilegrid_tiles)) { + return; + } + uint16_t total_tiles = grid->width_in_tiles * grid->height_in_tiles; + + tilegrid_tiles = allocate_memory(align32_size(total_tiles), false); + if (tilegrid_tiles != NULL) { + memcpy(tilegrid_tiles->ptr, grid->tiles, total_tiles); + grid->tiles = (uint8_t*) tilegrid_tiles->ptr; + } else { + grid->tiles = NULL; + grid->inline_tiles = false; + } + MP_STATE_VM(terminal_tilegrid_tiles) = NULL; + #endif +} + +uint32_t blinka_bitmap_data[32] = { + 0x00000011, 0x11000000, + 0x00000111, 0x53100000, + 0x00000111, 0x56110000, + 0x00000111, 0x11140000, + 0x00000111, 0x20002000, + 0x00000011, 0x13000000, + 0x00000001, 0x11200000, + 0x00000000, 0x11330000, + 0x00000000, 0x01122000, + 0x00001111, 0x44133000, + 0x00032323, 0x24112200, + 0x00111114, 0x44113300, + 0x00323232, 0x34112200, + 0x11111144, 0x44443300, + 0x11111111, 0x11144401, + 0x23232323, 0x21111110 +}; + +displayio_bitmap_t blinka_bitmap = { + .base = {.type = &displayio_bitmap_type }, + .width = 16, + .height = 16, + .data = blinka_bitmap_data, + .stride = 2, + .bits_per_value = 4, + .x_shift = 3, + .x_mask = 0x7, + .bitmask = 0xf +}; + +uint32_t blinka_transparency[1] = {0x80000000}; + +// These colors are RGB 565 with the bytes swapped. +uint32_t blinka_colors[8] = {0x78890000, 0x9F86B8FC, 0xffff0D5A, 0x0000f501, + 0x00000000, 0x00000000, 0x00000000, 0x00000000}; + +displayio_palette_t blinka_palette = { + .base = {.type = &displayio_palette_type }, + .opaque = blinka_transparency, + .colors = blinka_colors, + .color_count = 16, + .needs_refresh = false +}; + +displayio_tilegrid_t blinka_sprite = { + .base = {.type = &displayio_tilegrid_type }, + .bitmap = &blinka_bitmap, + .pixel_shader = &blinka_palette, + .x = 0, + .y = 0, + .bitmap_width_in_tiles = 1, + .width_in_tiles = 1, + .height_in_tiles = 1, + .total_width = 16, + .total_height = 16, + .tile_width = 16, + .tile_height = 16, + .top_left_x = 16, + .top_left_y = 16, + .tiles = 0, + .needs_refresh = false, + .inline_tiles = true +}; + +mp_obj_t splash_children[2] = { + &blinka_sprite, + &supervisor_terminal_text_grid +}; + +displayio_group_t circuitpython_splash = { + .base = {.type = &displayio_group_type }, + .x = 0, + .y = 0, + .scale = 2, + .size = 2, + .max_size = 2, + .children = splash_children, + .needs_refresh = true +}; diff --git a/supervisor/shared/display.h b/supervisor/shared/display.h new file mode 100644 index 000000000..cca907916 --- /dev/null +++ b/supervisor/shared/display.h @@ -0,0 +1,48 @@ +/* + * 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_SUPERVISOR_SHARED_DISPLAY_H +#define MICROPY_INCLUDED_SUPERVISOR_SHARED_DISPLAY_H + +#include "shared-bindings/displayio/Bitmap.h" +#include "shared-bindings/displayio/TileGrid.h" +#include "shared-bindings/terminalio/Terminal.h" + +// These are autogenerated resources. + +// This is fixed so it doesn't need to be in RAM. +extern const displayio_bitmap_t supervisor_terminal_font; + +// These will change so they must live in RAM. +extern displayio_tilegrid_t supervisor_terminal_text_grid; +extern terminalio_terminal_obj_t supervisor_terminal; + +void supervisor_start_terminal(uint16_t width_px, uint16_t height_px); +void supervisor_stop_terminal(void); + +void supervisor_display_move_memory(void); + +#endif // MICROPY_INCLUDED_SUPERVISOR_SHARED_DISPLAY_H diff --git a/supervisor/shared/memory.c b/supervisor/shared/memory.c index 6c8be3be8..11133415d 100755 --- a/supervisor/shared/memory.c +++ b/supervisor/shared/memory.c @@ -28,6 +28,8 @@ #include <stddef.h> +#include "supervisor/shared/display.h" + #define CIRCUITPY_SUPERVISOR_ALLOC_COUNT 8 static supervisor_allocation allocations[CIRCUITPY_SUPERVISOR_ALLOC_COUNT]; @@ -114,3 +116,7 @@ supervisor_allocation* allocate_memory(uint32_t length, bool high) { alloc->length = length; return alloc; } + +void supervisor_move_memory(void) { + supervisor_display_move_memory(); +} diff --git a/supervisor/shared/serial.c b/supervisor/shared/serial.c index c57688ddc..ed210416f 100644 --- a/supervisor/shared/serial.c +++ b/supervisor/shared/serial.c @@ -26,6 +26,10 @@ #include <string.h> +#include "py/mpconfig.h" + +#include "supervisor/shared/display.h" +#include "shared-bindings/terminalio/Terminal.h" #include "supervisor/serial.h" #include "supervisor/usb.h" @@ -48,6 +52,10 @@ bool serial_bytes_available(void) { } void serial_write_substring(const char* text, uint32_t length) { + #if CIRCUITPY_DISPLAYIO + int errcode; + common_hal_terminalio_terminal_write(&supervisor_terminal, (const uint8_t*) text, length, &errcode); + #endif if (!tud_cdc_connected()) { return; } diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk index 0bbfd9141..f21365d2a 100644 --- a/supervisor/supervisor.mk +++ b/supervisor/supervisor.mk @@ -3,6 +3,7 @@ SRC_SUPERVISOR = \ supervisor/port.c \ supervisor/shared/autoreload.c \ supervisor/shared/board_busses.c \ + supervisor/shared/display.c \ supervisor/shared/filesystem.c \ supervisor/shared/flash.c \ supervisor/shared/micropython.c \ @@ -71,7 +72,7 @@ else CFLAGS += -DUSB_AVAILABLE endif -SUPERVISOR_O = $(addprefix $(BUILD)/, $(SRC_SUPERVISOR:.c=.o)) +SUPERVISOR_O = $(addprefix $(BUILD)/, $(SRC_SUPERVISOR:.c=.o)) $(BUILD)/autogen_display_resources.o $(BUILD)/supervisor/shared/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h @@ -90,3 +91,13 @@ autogen_usb_descriptor.intermediate: ../../tools/gen_usb_descriptor.py Makefile --serial_number_length $(USB_SERIAL_NUMBER_LENGTH)\ --output_c_file $(BUILD)/autogen_usb_descriptor.c\ --output_h_file $(BUILD)/genhdr/autogen_usb_descriptor.h + +CIRCUITPY_DISPLAY_FONT = "../../tools/Tecate-bitmap-fonts/bitmap/terminus-font-4.39/ter-u12n.bdf" + +$(BUILD)/autogen_display_resources.c: ../../tools/gen_display_resources.py $(HEADER_BUILD)/qstrdefs.generated.h Makefile | $(HEADER_BUILD) + $(STEPECHO) "GEN $@" + $(Q)install -d $(BUILD)/genhdr + $(Q)$(PYTHON3) ../../tools/gen_display_resources.py \ + --font $(CIRCUITPY_DISPLAY_FONT) \ + --sample_file $(HEADER_BUILD)/qstrdefs.generated.h \ + --output_c_file $(BUILD)/autogen_display_resources.c diff --git a/tools/Tecate-bitmap-fonts b/tools/Tecate-bitmap-fonts new file mode 160000 +Subproject 6f52a7ca0838967cc57e9a44d76c6e1f60e6284 diff --git a/tools/bitmap_font b/tools/bitmap_font new file mode 160000 +Subproject 62dd78abdd0b823824fe15d1bab0611246145c2 diff --git a/tools/gen_display_resources.py b/tools/gen_display_resources.py new file mode 100644 index 000000000..e0021650d --- /dev/null +++ b/tools/gen_display_resources.py @@ -0,0 +1,174 @@ +import argparse + +import os +import struct +import sys + +sys.path.append("bitmap_font") +sys.path.append("../../tools/bitmap_font") + +from adafruit_bitmap_font import bitmap_font + +parser = argparse.ArgumentParser(description='Generate USB descriptors.') +parser.add_argument('--font', type=str, + help='Font path', required=True) +parser.add_argument('--extra_characters', type=str, + help='Unicode string of extra characters') +parser.add_argument('--sample_file', type=argparse.FileType('r'), + help='Text file that includes strings to support.') +parser.add_argument('--output_c_file', type=argparse.FileType('w'), required=True) + +args = parser.parse_args() + +class BitmapStub: + def __init__(self, width, height, color_depth): + self.width = width + self.rows = [b''] * height + + def _load_row(self, y, row): + self.rows[y] = bytes(row) + +f = bitmap_font.load_font(args.font, BitmapStub) +real_bb = [0, 0] + +# Load extra characters from the sample file. +sample_characters = set() +if args.sample_file: + for line in args.sample_file: + # Skip comments because we add additional characters in our huffman comments. + if line.startswith("//"): + continue + for c in line.strip(): + sample_characters.add(c) + +# Merge visible ascii, sample characters and extra characters. +visible_ascii = bytes(range(0x20, 0x7f)).decode("utf-8") +all_characters = visible_ascii +for c in sample_characters: + if c not in all_characters: + all_characters += c +if args.extra_characters: + all_characters.extend(args.extra_characters) +filtered_characters = all_characters + +# Try to pre-load all of the glyphs. Misses will still be slow later. +f.load_glyphs(set(all_characters)) + +# Get each glyph. +for c in all_characters: + g = f.get_glyph(ord(c)) + if not g: + print("Font missing character:", c, ord(c)) + filtered_characters = filtered_characters.replace(c, "") + continue + x, y, dx, dy = g["bounds"] + if g["shift"][1] != 0: + raise RuntimeError("y shift") + real_bb[0] = max(real_bb[0], x - dx) + real_bb[1] = max(real_bb[1], y - dy) + +tile_x, tile_y = real_bb +total_bits = tile_x * len(all_characters) +total_bits += 32 - total_bits % 32 +bytes_per_row = total_bits // 8 +b = bytearray(bytes_per_row * tile_y) + +for x, c in enumerate(filtered_characters): + g = f.get_glyph(ord(c)) + start_bit = x * tile_x + g["bounds"][2] + start_y = (tile_y - 2) - (g["bounds"][1] + g["bounds"][3]) + for y, row in enumerate(g["bitmap"].rows): + for i in range(g["bounds"][0]): + byte = i // 8 + bit = i % 8 + if row[byte] & (1 << (7-bit)) != 0: + overall_bit = start_bit + (start_y + y) * bytes_per_row * 8 + i + b[overall_bit // 8] |= 1 << (7 - (overall_bit % 8)) + + +extra_characters = "" +for c in filtered_characters: + if c not in visible_ascii: + extra_characters += c + +c_file = args.output_c_file + +c_file.write("""\ + +#include "shared-bindings/displayio/Palette.h" +#include "supervisor/shared/display.h" + +""") + +c_file.write("""\ +uint32_t terminal_transparency[1] = {0x00000000}; + +// These colors are RGB 565 with the bytes swapped. +uint32_t terminal_colors[1] = {0xffff0000}; + +displayio_palette_t supervisor_terminal_color = { + .base = {.type = &displayio_palette_type }, + .opaque = terminal_transparency, + .colors = terminal_colors, + .color_count = 2, + .needs_refresh = false +}; +""") + +c_file.write("""\ +displayio_tilegrid_t supervisor_terminal_text_grid = {{ + .base = {{ .type = &displayio_tilegrid_type }}, + .bitmap = (displayio_bitmap_t*) &supervisor_terminal_font, + .pixel_shader = &supervisor_terminal_color, + .x = 16, + .y = 0, + .bitmap_width_in_tiles = {0}, + .width_in_tiles = 1, + .height_in_tiles = 1, + .total_width = {1}, + .total_height = {2}, + .tile_width = {1}, + .tile_height = {2}, + .tiles = NULL, + .needs_refresh = false, + .inline_tiles = false +}}; +""".format(len(all_characters), tile_x, tile_y)) + +c_file.write("""\ +const uint32_t font_bitmap_data[{}] = {{ +""".format(bytes_per_row * tile_y // 4)) + +for i, word in enumerate(struct.iter_unpack(">I", b)): + c_file.write("0x{:08x}, ".format(word[0])) + if (i + 1) % (bytes_per_row // 4) == 0: + c_file.write("\n") + +c_file.write("""\ +}; +""") + +c_file.write("""\ +const displayio_bitmap_t supervisor_terminal_font = {{ + .base = {{.type = &displayio_bitmap_type }}, + .width = {}, + .height = {}, + .data = (uint32_t*) font_bitmap_data, + .stride = {}, + .bits_per_value = 1, + .x_shift = 5, + .x_mask = 0x1f, + .bitmask = 0x1 +}}; +""".format(len(all_characters) * tile_x, tile_y, bytes_per_row / 4)) + +c_file.write("""\ +terminalio_terminal_obj_t supervisor_terminal = {{ + .base = {{.type = &terminalio_terminal_type }}, + .cursor_x = 0, + .cursor_y = 0, + .tilegrid = &supervisor_terminal_text_grid, + .unicode_characters = (const uint8_t*) "{}", + .unicode_characters_len = {} +}}; +""".format(extra_characters, len(extra_characters.encode("utf-8")))) |
