Merge pull request #1998 from tannewt/monocolor

Add support for grayscale displays
crypto-aes
Dan Halbert 3 years ago committed by GitHub
commit 82ab998cd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      locale/ID.po
  2. 18
      locale/circuitpython.pot
  3. 18
      locale/de_DE.po
  4. 18
      locale/en_US.po
  5. 18
      locale/en_x_pirate.po
  6. 18
      locale/es.po
  7. 18
      locale/fil.po
  8. 18
      locale/fr.po
  9. 18
      locale/it_IT.po
  10. 18
      locale/pl.po
  11. 18
      locale/pt_BR.po
  12. 18
      locale/zh_Latn_pinyin.po
  13. 3
      ports/atmel-samd/boards/hallowing_m0_express/board.c
  14. 1
      ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk
  15. 3
      ports/atmel-samd/boards/pybadge/board.c
  16. 3
      ports/atmel-samd/boards/pybadge_airlift/board.c
  17. 3
      ports/atmel-samd/boards/pygamer/board.c
  18. 3
      ports/atmel-samd/boards/pygamer_advance/board.c
  19. 5
      ports/atmel-samd/boards/pyportal/board.c
  20. 3
      ports/atmel-samd/boards/ugame10/board.c
  21. 9
      ports/atmel-samd/common-hal/busio/I2C.c
  22. 1
      ports/atmel-samd/common-hal/busio/SPI.h
  23. 17
      ports/atmel-samd/common-hal/displayio/ParallelBus.c
  24. 2
      ports/atmel-samd/mpconfigport.mk
  25. 17
      ports/nrf/common-hal/busio/I2C.c
  26. 2
      ports/nrf/common-hal/busio/SPI.c
  27. 1
      py/circuitpy_defns.mk
  28. 7
      shared-bindings/_stage/__init__.c
  29. 3
      shared-bindings/busio/I2C.h
  30. 8
      shared-bindings/displayio/ColorConverter.c
  31. 4
      shared-bindings/displayio/ColorConverter.h
  32. 24
      shared-bindings/displayio/Display.c
  33. 8
      shared-bindings/displayio/Display.h
  34. 138
      shared-bindings/displayio/I2CDisplay.c
  35. 46
      shared-bindings/displayio/I2CDisplay.h
  36. 27
      shared-bindings/displayio/Palette.c
  37. 2
      shared-bindings/displayio/Palette.h
  38. 3
      shared-bindings/displayio/__init__.c
  39. 35
      shared-module/displayio/ColorConverter.c
  40. 4
      shared-module/displayio/ColorConverter.h
  41. 171
      shared-module/displayio/Display.c
  42. 4
      shared-module/displayio/Display.h
  43. 21
      shared-module/displayio/FourWire.c
  44. 6
      shared-module/displayio/FourWire.h
  45. 6
      shared-module/displayio/Group.c
  46. 3
      shared-module/displayio/Group.h
  47. 105
      shared-module/displayio/I2CDisplay.c
  48. 41
      shared-module/displayio/I2CDisplay.h
  49. 50
      shared-module/displayio/Palette.c
  50. 21
      shared-module/displayio/Palette.h
  51. 52
      shared-module/displayio/TileGrid.c
  52. 3
      shared-module/displayio/TileGrid.h
  53. 135
      shared-module/displayio/__init__.c
  54. 2
      shared-module/displayio/__init__.h
  55. 2
      shared-module/terminalio/Terminal.c
  56. 49
      supervisor/shared/display.c
  57. 17
      tools/gen_display_resources.py

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-09 09:06-0400\n"
"POT-Creation-Date: 2019-07-19 16:10-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -312,6 +312,10 @@ msgstr ""
msgid "Both pins must support hardware interrupts"
msgstr "Kedua pin harus mendukung hardware interrut"
#: shared-bindings/displayio/Display.c
msgid "Brightness must be 0-1.0"
msgstr ""
#: shared-bindings/supervisor/__init__.c
msgid "Brightness must be between 0 and 255"
msgstr ""
@ -443,6 +447,10 @@ msgstr "Clock unit sedang digunakan"
msgid "Column entry must be digitalio.DigitalInOut"
msgstr ""
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
msgid "Command must be an int between 0 and 255"
msgstr ""
@ -1171,7 +1179,8 @@ msgstr "Untuk keluar, silahkan reset board tanpa "
msgid "Too many channels in sample."
msgstr "Terlalu banyak channel dalam sampel"
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
msgid "Too many display busses"
msgstr ""
@ -1212,6 +1221,11 @@ msgstr ""
msgid "Unable to allocate buffers for signed conversion"
msgstr "Tidak dapat mengalokasikan buffer untuk signed conversion"
#: shared-module/displayio/I2CDisplay.c
#, c-format
msgid "Unable to find I2C Display at %x"
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Unable to find free GCLK"

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-11 18:42-0400\n"
"POT-Creation-Date: 2019-07-19 16:10-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -308,6 +308,10 @@ msgstr ""
msgid "Both pins must support hardware interrupts"
msgstr ""
#: shared-bindings/displayio/Display.c
msgid "Brightness must be 0-1.0"
msgstr ""
#: shared-bindings/supervisor/__init__.c
msgid "Brightness must be between 0 and 255"
msgstr ""
@ -433,6 +437,10 @@ msgstr ""
msgid "Column entry must be digitalio.DigitalInOut"
msgstr ""
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
msgid "Command must be an int between 0 and 255"
msgstr ""
@ -1148,7 +1156,8 @@ msgstr ""
msgid "Too many channels in sample."
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
msgid "Too many display busses"
msgstr ""
@ -1189,6 +1198,11 @@ msgstr ""
msgid "Unable to allocate buffers for signed conversion"
msgstr ""
#: shared-module/displayio/I2CDisplay.c
#, c-format
msgid "Unable to find I2C Display at %x"
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Unable to find free GCLK"

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-09 09:06-0400\n"
"POT-Creation-Date: 2019-07-19 16:10-0700\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: Pascal Deneaux\n"
"Language-Team: Sebastian Plamauer, Pascal Deneaux\n"
@ -312,6 +312,10 @@ msgstr "Bit depth muss ein Vielfaches von 8 sein."
msgid "Both pins must support hardware interrupts"
msgstr "Beide pins müssen Hardware Interrupts unterstützen"
#: shared-bindings/displayio/Display.c
msgid "Brightness must be 0-1.0"
msgstr ""
#: shared-bindings/supervisor/__init__.c
msgid "Brightness must be between 0 and 255"
msgstr "Die Helligkeit muss zwischen 0 und 255 liegen"
@ -437,6 +441,10 @@ msgstr "Clock unit wird benutzt"
msgid "Column entry must be digitalio.DigitalInOut"
msgstr ""
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
msgid "Command must be an int between 0 and 255"
msgstr "Der Befehl muss ein int zwischen 0 und 255 sein"
@ -1177,7 +1185,8 @@ msgstr "Zum beenden, resette bitte das board ohne "
msgid "Too many channels in sample."
msgstr "Zu viele Kanäle im sample"
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
msgid "Too many display busses"
msgstr ""
@ -1218,6 +1227,11 @@ msgstr "Der UUID-Wert ist kein str-, int- oder Byte-Puffer"
msgid "Unable to allocate buffers for signed conversion"
msgstr "Konnte keine Buffer für Vorzeichenumwandlung allozieren"
#: shared-module/displayio/I2CDisplay.c
#, c-format
msgid "Unable to find I2C Display at %x"
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Unable to find free GCLK"

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-09 09:06-0400\n"
"POT-Creation-Date: 2019-07-19 16:10-0700\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -308,6 +308,10 @@ msgstr ""
msgid "Both pins must support hardware interrupts"
msgstr ""
#: shared-bindings/displayio/Display.c
msgid "Brightness must be 0-1.0"
msgstr ""
#: shared-bindings/supervisor/__init__.c
msgid "Brightness must be between 0 and 255"
msgstr ""
@ -433,6 +437,10 @@ msgstr ""
msgid "Column entry must be digitalio.DigitalInOut"
msgstr ""
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
msgid "Command must be an int between 0 and 255"
msgstr ""
@ -1148,7 +1156,8 @@ msgstr ""
msgid "Too many channels in sample."
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
msgid "Too many display busses"
msgstr ""
@ -1189,6 +1198,11 @@ msgstr ""
msgid "Unable to allocate buffers for signed conversion"
msgstr ""
#: shared-module/displayio/I2CDisplay.c
#, c-format
msgid "Unable to find I2C Display at %x"
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Unable to find free GCLK"

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-09 09:06-0400\n"
"POT-Creation-Date: 2019-07-19 16:10-0700\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: @sommersoft, @MrCertainly\n"
@ -312,6 +312,10 @@ msgstr ""
msgid "Both pins must support hardware interrupts"
msgstr ""
#: shared-bindings/displayio/Display.c
msgid "Brightness must be 0-1.0"
msgstr ""
#: shared-bindings/supervisor/__init__.c
msgid "Brightness must be between 0 and 255"
msgstr ""
@ -437,6 +441,10 @@ msgstr ""
msgid "Column entry must be digitalio.DigitalInOut"
msgstr ""
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
msgid "Command must be an int between 0 and 255"
msgstr ""
@ -1152,7 +1160,8 @@ msgstr ""
msgid "Too many channels in sample."
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
msgid "Too many display busses"
msgstr ""
@ -1193,6 +1202,11 @@ msgstr ""
msgid "Unable to allocate buffers for signed conversion"
msgstr ""
#: shared-module/displayio/I2CDisplay.c
#, c-format
msgid "Unable to find I2C Display at %x"
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Unable to find free GCLK"

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-09 09:07-0400\n"
"POT-Creation-Date: 2019-07-19 16:10-0700\n"
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -316,6 +316,10 @@ msgstr "Bits depth debe ser múltiplo de 8."
msgid "Both pins must support hardware interrupts"
msgstr "Ambos pines deben soportar interrupciones por hardware"
#: shared-bindings/displayio/Display.c
msgid "Brightness must be 0-1.0"
msgstr ""
#: shared-bindings/supervisor/__init__.c
msgid "Brightness must be between 0 and 255"
msgstr "El brillo debe estar entro 0 y 255"
@ -441,6 +445,10 @@ msgstr "Clock unit está siendo utilizado"
msgid "Column entry must be digitalio.DigitalInOut"
msgstr "Entrada de columna debe ser digitalio.DigitalInOut"
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
msgid "Command must be an int between 0 and 255"
msgstr "Command debe estar entre 0 y 255."
@ -1188,7 +1196,8 @@ msgstr "Para salir, por favor reinicia la tarjeta sin "
msgid "Too many channels in sample."
msgstr "Demasiados canales en sample."
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
msgid "Too many display busses"
msgstr "Demasiados buses de pantalla"
@ -1229,6 +1238,11 @@ msgstr "UUID valor no es un str, int o byte buffer"
msgid "Unable to allocate buffers for signed conversion"
msgstr "No se pudieron asignar buffers para la conversión con signo"
#: shared-module/displayio/I2CDisplay.c
#, c-format
msgid "Unable to find I2C Display at %x"
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Unable to find free GCLK"

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-09 09:06-0400\n"
"POT-Creation-Date: 2019-07-19 16:10-0700\n"
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
"Language-Team: fil\n"
@ -314,6 +314,10 @@ msgstr "Bit depth ay dapat multiple ng 8."
msgid "Both pins must support hardware interrupts"
msgstr "Ang parehong mga pin ay dapat na sumusuporta sa hardware interrupts"
#: shared-bindings/displayio/Display.c
msgid "Brightness must be 0-1.0"
msgstr ""
#: shared-bindings/supervisor/__init__.c
msgid "Brightness must be between 0 and 255"
msgstr "Ang liwanag ay dapat sa gitna ng 0 o 255"
@ -441,6 +445,10 @@ msgstr "Clock unit ginagamit"
msgid "Column entry must be digitalio.DigitalInOut"
msgstr ""
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#, fuzzy
msgid "Command must be an int between 0 and 255"
@ -1191,7 +1199,8 @@ msgstr "Para lumabas, paki-reset ang board na wala ang "
msgid "Too many channels in sample."
msgstr "Sobra ang channels sa sample."
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
msgid "Too many display busses"
msgstr ""
@ -1232,6 +1241,11 @@ msgstr ""
msgid "Unable to allocate buffers for signed conversion"
msgstr "Hindi ma-allocate ang buffers para sa naka-sign na conversion"
#: shared-module/displayio/I2CDisplay.c
#, c-format
msgid "Unable to find I2C Display at %x"
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Unable to find free GCLK"

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-09 09:06-0400\n"
"POT-Creation-Date: 2019-07-19 16:10-0700\n"
"PO-Revision-Date: 2019-04-14 20:05+0100\n"
"Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n"
"Language-Team: fr\n"
@ -319,6 +319,10 @@ msgstr "La profondeur de bit doit être un multiple de 8."
msgid "Both pins must support hardware interrupts"
msgstr "Les deux entrées doivent supporter les interruptions matérielles"
#: shared-bindings/displayio/Display.c
msgid "Brightness must be 0-1.0"
msgstr ""
#: shared-bindings/supervisor/__init__.c
msgid "Brightness must be between 0 and 255"
msgstr "La luminosité doit être entre 0 et 255"
@ -447,6 +451,10 @@ msgstr "Horloge en cours d'utilisation"
msgid "Column entry must be digitalio.DigitalInOut"
msgstr "L'entrée 'Column' doit être un digitalio.DigitalInOut"
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#, fuzzy
msgid "Command must be an int between 0 and 255"
@ -1212,7 +1220,8 @@ msgstr "Pour quitter, redémarrez la carte SVP sans "
msgid "Too many channels in sample."
msgstr "Trop de canaux dans l'échantillon."
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
msgid "Too many display busses"
msgstr "Trop de bus d'affichage"
@ -1256,6 +1265,11 @@ msgstr ""
msgid "Unable to allocate buffers for signed conversion"
msgstr "Impossible d'allouer des tampons pour une conversion signée"
#: shared-module/displayio/I2CDisplay.c
#, c-format
msgid "Unable to find I2C Display at %x"
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Unable to find free GCLK"

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-09 09:06-0400\n"
"POT-Creation-Date: 2019-07-19 16:10-0700\n"
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
"Language-Team: \n"
@ -314,6 +314,10 @@ msgstr "La profondità di bit deve essere multipla di 8."
msgid "Both pins must support hardware interrupts"
msgstr "Entrambi i pin devono supportare gli interrupt hardware"
#: shared-bindings/displayio/Display.c
msgid "Brightness must be 0-1.0"
msgstr ""
#: shared-bindings/supervisor/__init__.c
msgid "Brightness must be between 0 and 255"
msgstr "La luminosità deve essere compreso tra 0 e 255"
@ -442,6 +446,10 @@ msgstr "Unità di clock in uso"
msgid "Column entry must be digitalio.DigitalInOut"
msgstr ""
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#, fuzzy
msgid "Command must be an int between 0 and 255"
@ -1190,7 +1198,8 @@ msgstr "Per uscire resettare la scheda senza "
msgid "Too many channels in sample."
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
msgid "Too many display busses"
msgstr ""
@ -1231,6 +1240,11 @@ msgstr ""
msgid "Unable to allocate buffers for signed conversion"
msgstr "Ipossibilitato ad allocare buffer per la conversione con segno"
#: shared-module/displayio/I2CDisplay.c
#, c-format
msgid "Unable to find I2C Display at %x"
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Unable to find free GCLK"

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-09 09:06-0400\n"
"POT-Creation-Date: 2019-07-19 16:10-0700\n"
"PO-Revision-Date: 2019-03-19 18:37-0700\n"
"Last-Translator: Radomir Dopieralski <circuitpython@sheep.art.pl>\n"
"Language-Team: pl\n"
@ -311,6 +311,10 @@ msgstr "Głębia musi być wielokrotnością 8."
msgid "Both pins must support hardware interrupts"
msgstr "Obie nóżki muszą wspierać przerwania sprzętowe"
#: shared-bindings/displayio/Display.c
msgid "Brightness must be 0-1.0"
msgstr ""
#: shared-bindings/supervisor/__init__.c
msgid "Brightness must be between 0 and 255"
msgstr "Jasność musi być pomiędzy 0 a 255"
@ -436,6 +440,10 @@ msgstr "Jednostka zegara w użyciu"
msgid "Column entry must be digitalio.DigitalInOut"
msgstr "Kolumny muszą być typu digitalio.DigitalInOut"
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
msgid "Command must be an int between 0 and 255"
msgstr "Komenda musi być int pomiędzy 0 a 255"
@ -1168,7 +1176,8 @@ msgstr "By wyjść, proszę zresetować płytkę bez "
msgid "Too many channels in sample."
msgstr "Zbyt wiele kanałów."
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
msgid "Too many display busses"
msgstr "Zbyt wiele magistrali"
@ -1209,6 +1218,11 @@ msgstr "UUID nie jest typu str, int lub bytes"
msgid "Unable to allocate buffers for signed conversion"
msgstr "Nie udała się alokacja buforów do konwersji ze znakiem"
#: shared-module/displayio/I2CDisplay.c
#, c-format
msgid "Unable to find I2C Display at %x"
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Unable to find free GCLK"

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-09 09:06-0400\n"
"POT-Creation-Date: 2019-07-19 16:10-0700\n"
"PO-Revision-Date: 2018-10-02 21:14-0000\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -311,6 +311,10 @@ msgstr ""
msgid "Both pins must support hardware interrupts"
msgstr "Ambos os pinos devem suportar interrupções de hardware"
#: shared-bindings/displayio/Display.c
msgid "Brightness must be 0-1.0"
msgstr ""
#: shared-bindings/supervisor/__init__.c
msgid "Brightness must be between 0 and 255"
msgstr "O brilho deve estar entre 0 e 255"
@ -438,6 +442,10 @@ msgstr "Unidade de Clock em uso"
msgid "Column entry must be digitalio.DigitalInOut"
msgstr ""
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#, fuzzy
msgid "Command must be an int between 0 and 255"
@ -1168,7 +1176,8 @@ msgstr "Para sair, por favor, reinicie a placa sem "
msgid "Too many channels in sample."
msgstr "Muitos canais na amostra."
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
msgid "Too many display busses"
msgstr ""
@ -1209,6 +1218,11 @@ msgstr ""
msgid "Unable to allocate buffers for signed conversion"
msgstr "Não é possível alocar buffers para conversão assinada"
#: shared-module/displayio/I2CDisplay.c
#, c-format
msgid "Unable to find I2C Display at %x"
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Unable to find free GCLK"

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: circuitpython-cn\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-09 09:06-0400\n"
"POT-Creation-Date: 2019-07-19 16:10-0700\n"
"PO-Revision-Date: 2019-04-13 10:10-0700\n"
"Last-Translator: hexthat\n"
"Language-Team: Chinese Hanyu Pinyin\n"
@ -312,6 +312,10 @@ msgstr "Bǐtè shēndù bìxū shì 8 bèi yǐshàng."
msgid "Both pins must support hardware interrupts"
msgstr "Liǎng gè yǐn jiǎo dōu bìxū zhīchí yìngjiàn zhōngduàn"
#: shared-bindings/displayio/Display.c
msgid "Brightness must be 0-1.0"
msgstr ""
#: shared-bindings/supervisor/__init__.c
msgid "Brightness must be between 0 and 255"
msgstr "Liàngdù bìxū jiè yú 0 dào 255 zhī jiān"
@ -437,6 +441,10 @@ msgstr "Shǐyòng shízhōng dānwèi"
msgid "Column entry must be digitalio.DigitalInOut"
msgstr "Liè tiáomù bìxū shì digitalio.DigitalInOut"
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
msgid "Command must be an int between 0 and 255"
msgstr "Mìnglìng bìxū shì 0 dào 255 zhī jiān de int"
@ -1173,7 +1181,8 @@ msgstr "Yào tuìchū, qǐng chóng zhì bǎnkuài ér bùyòng "
msgid "Too many channels in sample."
msgstr "Chōuyàng zhōng de píndào tài duō."
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
msgid "Too many display busses"
msgstr "Xiǎnshì zǒngxiàn tài duōle"
@ -1214,6 +1223,11 @@ msgstr "UUID zhí bùshì str,int huò zì jié huǎnchōng qū"
msgid "Unable to allocate buffers for signed conversion"
msgstr "Wúfǎ fēnpèi huǎnchōng qū yòng yú qiānmíng zhuǎnhuàn"
#: shared-module/displayio/I2CDisplay.c
#, c-format
msgid "Unable to find I2C Display at %x"
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Unable to find free GCLK"

@ -91,6 +91,8 @@ void board_init(void) {
1, // row start
0, // rotation
16, // Color depth
false, // Grayscale
false, // Pixels in a byte share a row. Only used for depth < 8
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
@ -98,6 +100,7 @@ void board_init(void) {
display_init_sequence,
sizeof(display_init_sequence),
&pin_PA00,
NO_BRIGHTNESS_COMMAND,
1.0f, // brightness (ignored)
true, // auto_brightness
false, // single_byte_bounds

@ -16,6 +16,7 @@ LONGINT_IMPL = MPZ
CIRCUITPY_I2CSLAVE = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_BITBANGIO = 0
SUPEROPT_GC = 0
# Include these Python libraries in firmware.

@ -93,6 +93,8 @@ void board_init(void) {
0, // row start
270, // rotation
16, // Color depth
false, // grayscale
false, // pixels in byte share row. only used for depth < 8
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
@ -100,6 +102,7 @@ void board_init(void) {
display_init_sequence,
sizeof(display_init_sequence),
&pin_PA01, // backlight pin
NO_BRIGHTNESS_COMMAND,
1.0f, // brightness (ignored)
true, // auto_brightness
false, // single_byte_bounds

@ -71,6 +71,8 @@ void board_init(void) {
0, // row start
90, // rotation
16, // Color depth
false, // grayscale
false, // pixels in byte share row. Only used for depth < 8
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
@ -78,6 +80,7 @@ void board_init(void) {
display_init_sequence,
sizeof(display_init_sequence),
&pin_PA01, // backlight pin
NO_BRIGHTNESS_COMMAND,
1.0f, // brightness (ignored)
true, // auto_brightness
false, // single_byte_bounds

@ -93,6 +93,8 @@ void board_init(void) {
0, // row start
270, // rotation
16, // Color depth
false, // Grayscale
false, // pixels in a byte share a row. Only valid for depths < 8
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
@ -100,6 +102,7 @@ void board_init(void) {
display_init_sequence,
sizeof(display_init_sequence),
&pin_PA01, // backlight pin
NO_BRIGHTNESS_COMMAND,
1.0f, // brightness (ignored)
true, // auto_brightness
false, // single_byte_bounds

@ -71,6 +71,8 @@ void board_init(void) {
0, // row start
90, // rotation
16, // Color depth
false, // Grayscale
false, // pixels in a byte share a row. Only valid for depths < 8
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
@ -78,6 +80,7 @@ void board_init(void) {
display_init_sequence,
sizeof(display_init_sequence),
&pin_PA01, // backlight pin
NO_BRIGHTNESS_COMMAND,
1.0f, // brightness (ignored)
true, // auto_brightness
false, // single_byte_bounds

@ -83,13 +83,16 @@ void board_init(void) {
0, // row start
0, // rotation
16, // Color depth
false, // grayscale
false, // pixels_in_byte_share_row (unused for depths > 8)
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
0x37, // Set vertical scroll command
display_init_sequence,
sizeof(display_init_sequence),
&pin_PB31,
&pin_PB31, // Backlight pin
NO_BRIGHTNESS_COMMAND,
1.0f, // brightness (ignored)
true, // auto_brightness
false, // single_byte_bounds

@ -91,6 +91,8 @@ void board_init(void) {
2, // row start
0, // rotation
16, // Color depth
false, // grayscale
false, // pixels in byte share row. Only used with depth < 8
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
@ -98,6 +100,7 @@ void board_init(void) {
display_init_sequence,
sizeof(display_init_sequence),
NULL,
NO_BRIGHTNESS_COMMAND,
1.0f, // brightness
false, // auto_brightness
false, // single_byte_bounds

@ -36,6 +36,8 @@
#include "shared-bindings/microcontroller/__init__.h"
#include "supervisor/shared/translate.h"
#include "common-hal/busio/SPI.h" // for never_reset_sercom
// Number of times to try to send packet if failed.
#define ATTEMPTS 2
@ -225,3 +227,10 @@ uint8_t common_hal_busio_i2c_read(busio_i2c_obj_t *self, uint16_t addr,
}
return MP_EIO;
}
void common_hal_busio_i2c_never_reset(busio_i2c_obj_t *self) {
never_reset_sercom(self->i2c_desc.device.hw);
never_reset_pin_number(self->scl_pin);
never_reset_pin_number(self->sda_pin);
}

@ -43,6 +43,7 @@ typedef struct {
} busio_spi_obj_t;
void reset_sercoms(void);
void never_reset_sercom(Sercom* sercom);
#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_BUSIO_SPI_H

@ -31,6 +31,7 @@
#include "common-hal/microcontroller/Pin.h"
#include "py/runtime.h"
#include "shared-bindings/digitalio/DigitalInOut.h"
#include "shared-bindings/microcontroller/__init__.h"
#include "tick.h"
@ -66,10 +67,6 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* sel
common_hal_digitalio_digitalinout_construct(&self->chip_select, chip_select);
common_hal_digitalio_digitalinout_switch_to_output(&self->chip_select, true, DRIVE_MODE_PUSH_PULL);
self->reset.base.type = &digitalio_digitalinout_type;
common_hal_digitalio_digitalinout_construct(&self->reset, reset);
common_hal_digitalio_digitalinout_switch_to_output(&self->reset, true, DRIVE_MODE_PUSH_PULL);
self->write.base.type = &digitalio_digitalinout_type;
common_hal_digitalio_digitalinout_construct(&self->write, write);
common_hal_digitalio_digitalinout_switch_to_output(&self->write, true, DRIVE_MODE_PUSH_PULL);
@ -82,11 +79,21 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* sel
self->write_group = &PORT->Group[write->number / 32];
self->write_mask = 1 << (write->number % 32);
if (reset != NULL) {
self->reset.base.type = &digitalio_digitalinout_type;
common_hal_digitalio_digitalinout_construct(&self->reset, reset);
common_hal_digitalio_digitalinout_switch_to_output(&self->reset, true, DRIVE_MODE_PUSH_PULL);
never_reset_pin_number(reset->number);
common_hal_digitalio_digitalinout_set_value(&self->reset, false);
common_hal_mcu_delay_us(4);
common_hal_digitalio_digitalinout_set_value(&self->reset, true);
}
never_reset_pin_number(command->number);
never_reset_pin_number(chip_select->number);
never_reset_pin_number(write->number);
never_reset_pin_number(read->number);
never_reset_pin_number(reset->number);
for (uint8_t i = 0; i < 8; i++) {
never_reset_pin_number(data_pin + i);
}

@ -17,7 +17,7 @@ endif
# Put samd21-only choices here.
ifeq ($(CHIP_FAMILY),samd21)
# frequencyio not yet verified as working on SAMD21.
CIRCUITPY_FRQUENCYIO = 0
CIRCUITPY_FREQUENCYIO = 0
endif
# Put samd51-only choices here.

@ -57,13 +57,30 @@ STATIC twim_peripheral_t twim_peripherals[] = {
#endif
};
STATIC bool never_reset[MP_ARRAY_SIZE(twim_peripherals)];
void i2c_reset(void) {
for (size_t i = 0 ; i < MP_ARRAY_SIZE(twim_peripherals); i++) {
if (never_reset[i]) {
continue;
}
nrf_twim_disable(twim_peripherals[i].twim.p_twim);
twim_peripherals[i].in_use = false;
}
}
void common_hal_busio_i2c_never_reset(busio_i2c_obj_t *self) {
for (size_t i = 0 ; i < MP_ARRAY_SIZE(twim_peripherals); i++) {
if (self->twim_peripheral == &twim_peripherals[i]) {
never_reset[i] = true;
never_reset_pin_number(self->scl_pin_number);
never_reset_pin_number(self->sda_pin_number);
break;
}
}
}
static uint8_t twi_error_to_mp(const nrfx_err_t err) {
switch (err) {
case NRFX_ERROR_DRV_TWI_ERR_ANACK:

@ -61,7 +61,7 @@ STATIC spim_peripheral_t spim_peripherals[] = {
#endif
};
STATIC bool never_reset[4];
STATIC bool never_reset[MP_ARRAY_SIZE(spim_peripherals)];
void spi_reset(void) {
for (size_t i = 0 ; i < MP_ARRAY_SIZE(spim_peripherals); i++) {

@ -317,6 +317,7 @@ $(filter $(SRC_PATTERNS), \
displayio/Display.c \
displayio/FourWire.c \
displayio/Group.c \
displayio/I2CDisplay.c \
displayio/OnDiskBitmap.c \
displayio/Palette.c \
displayio/Shape.c \

@ -95,7 +95,12 @@ STATIC mp_obj_t stage_render(size_t n_args, const mp_obj_t *args) {
MICROPY_VM_HOOK_LOOP ;
#endif
}
displayio_display_set_region_to_update(display, x0, y0, x1, y1);
displayio_area_t area;
area.x1 = x0;
area.y1 = y0;
area.x2 = x1;
area.y2 = y1;
displayio_display_set_region_to_update(display, &area);
render_stage(x0, y0, x1, y1, layers, layers_size, buffer, buffer_size, display);
displayio_display_end_transaction(display);

@ -69,4 +69,7 @@ extern uint8_t common_hal_busio_i2c_write(busio_i2c_obj_t *self, uint16_t addres
extern uint8_t common_hal_busio_i2c_read(busio_i2c_obj_t *self, uint16_t address,
uint8_t * data, size_t len);
// This is used by the supervisor to claim I2C devices indefinitely.
extern void common_hal_busio_i2c_never_reset(busio_i2c_obj_t *self);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BUSIO_I2C_H

@ -62,6 +62,8 @@ STATIC mp_obj_t displayio_colorconverter_make_new(const mp_obj_type_t *type, siz
//| .. method:: convert(color)
//|
//| Converts the given RGB888 color to RGB565
//|
STATIC mp_obj_t displayio_colorconverter_obj_convert(mp_obj_t self_in, mp_obj_t color_obj) {
displayio_colorconverter_t *self = MP_OBJ_TO_PTR(self_in);
@ -69,8 +71,10 @@ STATIC mp_obj_t displayio_colorconverter_obj_convert(mp_obj_t self_in, mp_obj_t
if (!mp_obj_get_int_maybe(color_obj, &color)) {
mp_raise_ValueError(translate("color should be an int"));
}
uint16_t output_color;
common_hal_displayio_colorconverter_convert(self, color, &output_color);
_displayio_colorspace_t colorspace;
colorspace.depth = 16;
uint32_t output_color;
common_hal_displayio_colorconverter_convert(self, &colorspace, color, &output_color);
return MP_OBJ_NEW_SMALL_INT(output_color);
}
MP_DEFINE_CONST_FUN_OBJ_2(displayio_colorconverter_convert_obj, displayio_colorconverter_obj_convert);

@ -29,9 +29,11 @@
#include "shared-module/displayio/ColorConverter.h"
#include "shared-module/displayio/Palette.h"
extern const mp_obj_type_t displayio_colorconverter_type;
void common_hal_displayio_colorconverter_construct(displayio_colorconverter_t* self);
bool common_hal_displayio_colorconverter_convert(displayio_colorconverter_t *colorconverter, uint32_t input_color, uint16_t* output_color);
void common_hal_displayio_colorconverter_convert(displayio_colorconverter_t *colorconverter, const _displayio_colorspace_t* colorspace, uint32_t input_color, uint32_t* output_color);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_COLORCONVERTER_H

@ -51,7 +51,7 @@
//| Most people should not use this class directly. Use a specific display driver instead that will
//| contain the initialization sequence at minimum.
//|
//| .. class:: Display(display_bus, init_sequence, *, width, height, colstart=0, rowstart=0, rotation=0, color_depth=16, set_column_command=0x2a, set_row_command=0x2b, write_ram_command=0x2c, set_vertical_scroll=0, backlight_pin=None, brightness=1.0, auto_brightness=False, single_byte_bounds=False, data_as_commands=False)
//| .. class:: Display(display_bus, init_sequence, *, width, height, colstart=0, rowstart=0, rotation=0, color_depth=16, grayscale=False, pixels_in_byte_share_row=True, set_column_command=0x2a, set_row_command=0x2b, write_ram_command=0x2c, set_vertical_scroll=0, backlight_pin=None, brightness_command=None, brightness=1.0, auto_brightness=False, single_byte_bounds=False, data_as_commands=False)
//|
//| Create a Display object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`).
//|
@ -88,18 +88,21 @@
//| :param int rotation: The rotation of the display in degrees clockwise. Must be in 90 degree increments (0, 90, 180, 270)
//| :param int color_depth: The number of bits of color per pixel transmitted. (Some displays
//| support 18 bit but 16 is easier to transmit. The last bit is extrapolated.)
//| :param bool grayscale: True if the display only shows a single color.
//| :param bool pixels_in_byte_share_row: True when pixels are less than a byte and a byte includes pixels from the same row of the display. When False, pixels share a column.
//| :param int 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 int write_ram_command: Command used to write pixels values into the update region. Ignored if data_as_commands is set.
//| :param int set_vertical_scroll: Command used to set the first row to show
//| :param microcontroller.Pin backlight_pin: Pin connected to the display's backlight
//| :param int brightness_command: Command to set display brightness. Usually available in OLED controllers.
//| :param bool brightness: Initial display brightness. This value is ignored if auto_brightness is True.
//| :param bool auto_brightness: If True, brightness is controlled via an ambient light sensor or other mechanism.
//| :param bool single_byte_bounds: Display column and row commands use single bytes
//| :param bool data_as_commands: Treat all init and boundary data as SPI commands. Certain displays require this.
//|
STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_display_bus, ARG_init_sequence, ARG_width, ARG_height, ARG_colstart, ARG_rowstart, ARG_rotation, ARG_color_depth, ARG_set_column_command, ARG_set_row_command, ARG_write_ram_command, ARG_set_vertical_scroll, ARG_backlight_pin, ARG_brightness, ARG_auto_brightness, ARG_single_byte_bounds, ARG_data_as_commands };
enum { ARG_display_bus, ARG_init_sequence, ARG_width, ARG_height, ARG_colstart, ARG_rowstart, ARG_rotation, ARG_color_depth, ARG_grayscale, ARG_pixels_in_byte_share_row, ARG_set_column_command, ARG_set_row_command, ARG_write_ram_command, ARG_set_vertical_scroll, ARG_backlight_pin, ARG_brightness_command, ARG_brightness, ARG_auto_brightness, ARG_single_byte_bounds, ARG_data_as_commands };
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 },
@ -109,11 +112,14 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a
{ MP_QSTR_rowstart, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} },
{ MP_QSTR_rotation, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} },
{ MP_QSTR_color_depth, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 16} },
{ MP_QSTR_grayscale, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} },
{ MP_QSTR_pixels_in_byte_share_row, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} },
{ MP_QSTR_set_column_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x2a} },
{ MP_QSTR_set_row_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x2b} },
{ MP_QSTR_write_ram_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x2c} },
{ MP_QSTR_set_vertical_scroll, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x0} },
{ MP_QSTR_backlight_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} },
{ MP_QSTR_brightness_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = NO_BRIGHTNESS_COMMAND} },
{ MP_QSTR_brightness, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_OBJ_NEW_SMALL_INT(1)} },
{ MP_QSTR_auto_brightness, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} },
{ MP_QSTR_single_byte_bounds, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} },
@ -157,11 +163,13 @@ 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, rotation,
args[ARG_color_depth].u_int, args[ARG_set_column_command].u_int, args[ARG_set_row_command].u_int,
args[ARG_color_depth].u_int, args[ARG_grayscale].u_bool, args[ARG_pixels_in_byte_share_row].u_bool,
args[ARG_set_column_command].u_int, args[ARG_set_row_command].u_int,
args[ARG_write_ram_command].u_int,
args[ARG_set_vertical_scroll].u_int,
bufinfo.buf, bufinfo.len,
MP_OBJ_TO_PTR(backlight_pin),
args[ARG_brightness_command].u_int,
brightness,
args[ARG_auto_brightness].u_bool,
args[ARG_single_byte_bounds].u_bool,
@ -234,10 +242,14 @@ STATIC mp_obj_t displayio_display_obj_get_brightness(mp_obj_t self_in) {
}
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) {
STATIC mp_obj_t displayio_display_obj_set_brightness(mp_obj_t self_in, mp_obj_t brightness_obj) {
displayio_display_obj_t *self = native_display(self_in);
common_hal_displayio_display_set_auto_brightness(self, false);
bool ok = common_hal_displayio_display_set_brightness(self, mp_obj_get_float(brightness));
mp_float_t brightness = mp_obj_get_float(brightness_obj);
if (brightness < 0 || brightness > 1.0) {
mp_raise_ValueError(translate("Brightness must be 0-1.0"));
}
bool ok = common_hal_displayio_display_set_brightness(self, brightness);
if (!ok) {
mp_raise_RuntimeError(translate("Brightness not adjustable"));
}

@ -36,11 +36,13 @@ extern const mp_obj_type_t displayio_display_type;
#define DELAY 0x80
#define NO_BRIGHTNESS_COMMAND 0x100
void common_hal_displayio_display_construct(displayio_display_obj_t* self,
mp_obj_t bus, uint16_t width, uint16_t height,
int16_t colstart, int16_t rowstart, uint16_t rotation, uint16_t color_depth,
int16_t colstart, int16_t rowstart, uint16_t rotation, uint16_t color_depth, bool grayscale, bool pixels_in_byte_share_row,
uint8_t set_column_command, uint8_t set_row_command, uint8_t write_ram_command, uint8_t set_vertical_scroll,
uint8_t* init_sequence, uint16_t init_sequence_len, const mcu_pin_obj_t* backlight_pin,
uint8_t* init_sequence, uint16_t init_sequence_len, const mcu_pin_obj_t* backlight_pin, uint16_t brightness_command,
mp_float_t brightness, bool auto_brightness,
bool single_byte_bounds, bool data_as_commands);
@ -54,7 +56,7 @@ bool displayio_display_begin_transaction(displayio_display_obj_t* self);
void displayio_display_end_transaction(displayio_display_obj_t* self);
// The second point of the region is exclusive.
void displayio_display_set_region_to_update(displayio_display_obj_t* self, uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
void displayio_display_set_region_to_update(displayio_display_obj_t* self, displayio_area_t* area);
bool displayio_display_frame_queued(displayio_display_obj_t* self);
bool displayio_display_refresh_queued(displayio_display_obj_t* self);

@ -0,0 +1,138 @@
/*
* 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.
*/
#include "shared-bindings/displayio/I2CDisplay.h"
#include <stdint.h>
#include <string.h>
#include "lib/utils/context_manager_helpers.h"
#include "py/binary.h"
#include "py/objproperty.h"
#include "py/runtime.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/util.h"
#include "shared-module/displayio/__init__.h"
#include "supervisor/shared/translate.h"
//| .. currentmodule:: displayio
//|
//| :class:`I2CDisplay` -- Manage updating a display over I2C
//| ==========================================================================
//|
//| Manage updating a display over I2C in the background while Python code runs.
//| It doesn't handle display initialization.
//|
//| .. class:: I2CDisplay(i2c_bus, *, device_address, reset=None)
//|
//| Create a I2CDisplay object associated with the given I2C bus and reset pin.
//|
//| The I2C bus and pins are then in use by the display until `displayio.release_displays()` is
//| called even after a reload. (It does this so CircuitPython can use the display after your code
//| is done.) So, the first time you initialize a display bus in code.py you should call
//| :py:func`displayio.release_displays` first, otherwise it will error after the first code.py run.
//|
//| :param busio.I2C i2c_bus: The I2C bus that make up the clock and data lines