Skip to content

Commit 6697544

Browse files
committed
Introduce displayio to render graphics to displays.
It's designed to minimize RAM footprint by using Sprites to represent objects on the screen. The object model also facilitates partial screen updating which reduces the bandwidth needed to display. This is all handled in C. Python simply manipulates the objects with the ability to synchronize to frame timing.
1 parent 9b98ad7 commit 6697544

File tree

36 files changed

+2261
-7
lines changed

36 files changed

+2261
-7
lines changed

locale/circuitpython.pot

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2022,6 +2022,64 @@ msgstr ""
20222022
msgid "Unsupported pull value."
20232023
msgstr ""
20242024

2025+
#: shared-bindings/displayio/Bitmap.c:66
2026+
msgid "value_size must be power of two"
2027+
msgstr ""
2028+
2029+
#: shared-bindings/displayio/Bitmap.c:85
2030+
msgid "y should be an int"
2031+
msgstr ""
2032+
2033+
#: shared-bindings/displayio/Bitmap.c:90
2034+
msgid "row buffer must be a bytearray or array of type 'b' or 'B'"
2035+
msgstr ""
2036+
2037+
#: shared-bindings/displayio/Bitmap.c:95
2038+
msgid "row data must be a buffer"
2039+
msgstr ""
2040+
2041+
#: shared-bindings/displayio/FourWire.c:55
2042+
#: shared-bindings/displayio/FourWire.c:64
2043+
msgid "displayio is a work in progress"
2044+
msgstr ""
2045+
2046+
#: shared-bindings/displayio/Group.c:65
2047+
msgid "Group must have size at least 1"
2048+
msgstr ""
2049+
2050+
#: shared-bindings/displayio/Palette.c:94
2051+
msgid "color buffer must be a bytearray or array of type 'b' or 'B'"
2052+
msgstr ""
2053+
2054+
#: shared-bindings/displayio/Palette.c:100
2055+
msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGBA)"
2056+
msgstr ""
2057+
2058+
#: shared-bindings/displayio/Palette.c:104
2059+
msgid "color must be between 0x000000 and 0xffffff"
2060+
msgstr ""
2061+
2062+
#: shared-bindings/displayio/Palette.c:108
2063+
msgid "color buffer must be a buffer or int"
2064+
msgstr ""
2065+
2066+
#: shared-bindings/displayio/Palette.c:124
2067+
#: shared-bindings/displayio/Palette.c:138
2068+
msgid "value should be an int"
2069+
msgstr ""
2070+
2071+
#: shared-bindings/displayio/Sprite.c:44
2072+
msgid "position must be 2-tuple"
2073+
msgstr ""
2074+
2075+
#: shared-bindings/displayio/Sprite.c:86
2076+
msgid "unsupported bitmap type"
2077+
msgstr ""
2078+
2079+
#: shared-bindings/displayio/Sprite.c:151
2080+
msgid "palette must be displayio.Palette"
2081+
msgstr ""
2082+
20252083
#: shared-bindings/gamepad/GamePad.c:100
20262084
msgid "too many arguments"
20272085
msgstr ""
@@ -2236,6 +2294,14 @@ msgstr ""
22362294
msgid "Cannot transfer without MOSI and MISO pins."
22372295
msgstr ""
22382296

2297+
#: shared-module/displayio/Bitmap.c:60
2298+
msgid "row must be packed and word aligned"
2299+
msgstr ""
2300+
2301+
#: shared-module/displayio/Group.c:39
2302+
msgid "Group full"
2303+
msgstr ""
2304+
22392305
#: shared-module/struct/__init__.c:39
22402306
msgid "'S' and 'O' are not supported format types"
22412307
msgstr ""

locale/en_US.po

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2022,6 +2022,64 @@ msgstr ""
20222022
msgid "Unsupported pull value."
20232023
msgstr ""
20242024

2025+
#: shared-bindings/displayio/Bitmap.c:66
2026+
msgid "value_size must be power of two"
2027+
msgstr ""
2028+
2029+
#: shared-bindings/displayio/Bitmap.c:85
2030+
msgid "y should be an int"
2031+
msgstr ""
2032+
2033+
#: shared-bindings/displayio/Bitmap.c:90
2034+
msgid "row buffer must be a bytearray or array of type 'b' or 'B'"
2035+
msgstr ""
2036+
2037+
#: shared-bindings/displayio/Bitmap.c:95
2038+
msgid "row data must be a buffer"
2039+
msgstr ""
2040+
2041+
#: shared-bindings/displayio/FourWire.c:55
2042+
#: shared-bindings/displayio/FourWire.c:64
2043+
msgid "displayio is a work in progress"
2044+
msgstr ""
2045+
2046+
#: shared-bindings/displayio/Group.c:65
2047+
msgid "Group must have size at least 1"
2048+
msgstr ""
2049+
2050+
#: shared-bindings/displayio/Palette.c:94
2051+
msgid "color buffer must be a bytearray or array of type 'b' or 'B'"
2052+
msgstr ""
2053+
2054+
#: shared-bindings/displayio/Palette.c:100
2055+
msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGBA)"
2056+
msgstr ""
2057+
2058+
#: shared-bindings/displayio/Palette.c:104
2059+
msgid "color must be between 0x000000 and 0xffffff"
2060+
msgstr ""
2061+
2062+
#: shared-bindings/displayio/Palette.c:108
2063+
msgid "color buffer must be a buffer or int"
2064+
msgstr ""
2065+
2066+
#: shared-bindings/displayio/Palette.c:124
2067+
#: shared-bindings/displayio/Palette.c:138
2068+
msgid "value should be an int"
2069+
msgstr ""
2070+
2071+
#: shared-bindings/displayio/Sprite.c:44
2072+
msgid "position must be 2-tuple"
2073+
msgstr ""
2074+
2075+
#: shared-bindings/displayio/Sprite.c:86
2076+
msgid "unsupported bitmap type"
2077+
msgstr ""
2078+
2079+
#: shared-bindings/displayio/Sprite.c:151
2080+
msgid "palette must be displayio.Palette"
2081+
msgstr ""
2082+
20252083
#: shared-bindings/gamepad/GamePad.c:100
20262084
msgid "too many arguments"
20272085
msgstr ""
@@ -2236,6 +2294,14 @@ msgstr ""
22362294
msgid "Cannot transfer without MOSI and MISO pins."
22372295
msgstr ""
22382296

2297+
#: shared-module/displayio/Bitmap.c:60
2298+
msgid "row must be packed and word aligned"
2299+
msgstr ""
2300+
2301+
#: shared-module/displayio/Group.c:39
2302+
msgid "Group full"
2303+
msgstr ""
2304+
22392305
#: shared-module/struct/__init__.c:39
22402306
msgid "'S' and 'O' are not supported format types"
22412307
msgstr ""

locale/es.po

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,6 +2068,64 @@ msgstr ""
20682068
msgid "Unsupported pull value."
20692069
msgstr ""
20702070

2071+
#: shared-bindings/displayio/Bitmap.c:66
2072+
msgid "value_size must be power of two"
2073+
msgstr ""
2074+
2075+
#: shared-bindings/displayio/Bitmap.c:85
2076+
msgid "y should be an int"
2077+
msgstr ""
2078+
2079+
#: shared-bindings/displayio/Bitmap.c:90
2080+
msgid "row buffer must be a bytearray or array of type 'b' or 'B'"
2081+
msgstr ""
2082+
2083+
#: shared-bindings/displayio/Bitmap.c:95
2084+
msgid "row data must be a buffer"
2085+
msgstr ""
2086+
2087+
#: shared-bindings/displayio/FourWire.c:55
2088+
#: shared-bindings/displayio/FourWire.c:64
2089+
msgid "displayio is a work in progress"
2090+
msgstr ""
2091+
2092+
#: shared-bindings/displayio/Group.c:65
2093+
msgid "Group must have size at least 1"
2094+
msgstr ""
2095+
2096+
#: shared-bindings/displayio/Palette.c:94
2097+
msgid "color buffer must be a bytearray or array of type 'b' or 'B'"
2098+
msgstr ""
2099+
2100+
#: shared-bindings/displayio/Palette.c:100
2101+
msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGBA)"
2102+
msgstr ""
2103+
2104+
#: shared-bindings/displayio/Palette.c:104
2105+
msgid "color must be between 0x000000 and 0xffffff"
2106+
msgstr ""
2107+
2108+
#: shared-bindings/displayio/Palette.c:108
2109+
msgid "color buffer must be a buffer or int"
2110+
msgstr ""
2111+
2112+
#: shared-bindings/displayio/Palette.c:124
2113+
#: shared-bindings/displayio/Palette.c:138
2114+
msgid "value should be an int"
2115+
msgstr ""
2116+
2117+
#: shared-bindings/displayio/Sprite.c:44
2118+
msgid "position must be 2-tuple"
2119+
msgstr ""
2120+
2121+
#: shared-bindings/displayio/Sprite.c:86
2122+
msgid "unsupported bitmap type"
2123+
msgstr ""
2124+
2125+
#: shared-bindings/displayio/Sprite.c:151
2126+
msgid "palette must be displayio.Palette"
2127+
msgstr ""
2128+
20712129
#: shared-bindings/gamepad/GamePad.c:100
20722130
msgid "too many arguments"
20732131
msgstr ""
@@ -2283,6 +2341,14 @@ msgstr ""
22832341
msgid "Cannot transfer without MOSI and MISO pins."
22842342
msgstr ""
22852343

2344+
#: shared-module/displayio/Bitmap.c:60
2345+
msgid "row must be packed and word aligned"
2346+
msgstr ""
2347+
2348+
#: shared-module/displayio/Group.c:39
2349+
msgid "Group full"
2350+
msgstr ""
2351+
22862352
#: shared-module/struct/__init__.c:39
22872353
msgid "'S' and 'O' are not supported format types"
22882354
msgstr ""

locale/fr.po

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,6 +2051,80 @@ msgstr "Le tirage 'pull' n'est pas utilisé quand la direction est 'output'"
20512051
msgid "Unsupported pull value."
20522052
msgstr "Valeur de 'pull' non supportée"
20532053

2054+
#: shared-bindings/displayio/Bitmap.c:66
2055+
#, fuzzy
2056+
msgid "value_size must be power of two"
2057+
msgstr "'len' doit être un multiple de 4"
2058+
2059+
#: shared-bindings/displayio/Bitmap.c:85
2060+
#, fuzzy
2061+
msgid "y should be an int"
2062+
msgstr "La longueur doit être entière"
2063+
2064+
#: shared-bindings/displayio/Bitmap.c:90
2065+
#, fuzzy
2066+
msgid "row buffer must be a bytearray or array of type 'b' or 'B'"
2067+
msgstr ""
2068+
"le tampon de sample_source doit être un bytearray ou un tableau de type "
2069+
"'h','H', 'b' ou 'B'"
2070+
2071+
#: shared-bindings/displayio/Bitmap.c:95
2072+
#, fuzzy
2073+
msgid "row data must be a buffer"
2074+
msgstr "les constantes doivent être des entiers"
2075+
2076+
#: shared-bindings/displayio/FourWire.c:55
2077+
#: shared-bindings/displayio/FourWire.c:64
2078+
msgid "displayio is a work in progress"
2079+
msgstr ""
2080+
2081+
#: shared-bindings/displayio/Group.c:65
2082+
#, fuzzy
2083+
msgid "Group must have size at least 1"
2084+
msgstr "Le tampon doit être de longueur au moins 1"
2085+
2086+
#: shared-bindings/displayio/Palette.c:94
2087+
#, fuzzy
2088+
msgid "color buffer must be a bytearray or array of type 'b' or 'B'"
2089+
msgstr ""
2090+
"le tampon de sample_source doit être un bytearray ou un tableau de type "
2091+
"'h','H', 'b' ou 'B'"
2092+
2093+
#: shared-bindings/displayio/Palette.c:100
2094+
msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGBA)"
2095+
msgstr ""
2096+
2097+
#: shared-bindings/displayio/Palette.c:104
2098+
#, fuzzy
2099+
msgid "color must be between 0x000000 and 0xffffff"
2100+
msgstr "Les octets 'bytes' doivent être entre 0 et 255"
2101+
2102+
#: shared-bindings/displayio/Palette.c:108
2103+
#, fuzzy
2104+
msgid "color buffer must be a buffer or int"
2105+
msgstr "le tampon doit être un objet bytes-like"
2106+
2107+
#: shared-bindings/displayio/Palette.c:124
2108+
#: shared-bindings/displayio/Palette.c:138
2109+
#, fuzzy
2110+
msgid "value should be an int"
2111+
msgstr "Les valeurs du tableau doivent être des octets simples 'bytes'"
2112+
2113+
#: shared-bindings/displayio/Sprite.c:44
2114+
#, fuzzy
2115+
msgid "position must be 2-tuple"
2116+
msgstr "stop doit être 1 ou 2"
2117+
2118+
#: shared-bindings/displayio/Sprite.c:86
2119+
#, fuzzy
2120+
msgid "unsupported bitmap type"
2121+
msgstr "Débit non supporté"
2122+
2123+
#: shared-bindings/displayio/Sprite.c:151
2124+
#, fuzzy
2125+
msgid "palette must be displayio.Palette"
2126+
msgstr "la palette doit être longue de 32 octets"
2127+
20542128
#: shared-bindings/gamepad/GamePad.c:100
20552129
msgid "too many arguments"
20562130
msgstr "trop d'arguments"
@@ -2272,6 +2346,14 @@ msgstr "Impossible de lire sans broche MISO."
22722346
msgid "Cannot transfer without MOSI and MISO pins."
22732347
msgstr "Pas de transfert sans broches MOSI et MISO"
22742348

2349+
#: shared-module/displayio/Bitmap.c:60
2350+
msgid "row must be packed and word aligned"
2351+
msgstr ""
2352+
2353+
#: shared-module/displayio/Group.c:39
2354+
msgid "Group full"
2355+
msgstr ""
2356+
22752357
#: shared-module/struct/__init__.c:39
22762358
msgid "'S' and 'O' are not supported format types"
22772359
msgstr "'S' et 'O' ne sont pas des types de format supportés"

ports/atmel-samd/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ SRC_COMMON_HAL = \
308308
busio/UART.c \
309309
digitalio/__init__.c \
310310
digitalio/DigitalInOut.c \
311+
displayio/FourWire.c \
311312
i2cslave/__init__.c \
312313
i2cslave/I2CSlave.c \
313314
microcontroller/__init__.c \
@@ -381,6 +382,11 @@ SRC_SHARED_MODULE = \
381382
bitbangio/OneWire.c \
382383
bitbangio/SPI.c \
383384
busio/OneWire.c \
385+
displayio/__init__.c \
386+
displayio/Bitmap.c \
387+
displayio/Group.c \
388+
displayio/Palette.c \
389+
displayio/Sprite.c \
384390
gamepad/__init__.c \
385391
gamepad/GamePad.c \
386392
_stage/__init__.c \

ports/atmel-samd/background.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,17 @@
3030
#include "usb.h"
3131
#include "usb_mass_storage.h"
3232

33+
#include "shared-module/displayio/__init__.h"
34+
3335
volatile uint64_t last_finished_tick = 0;
3436

3537
void run_background_tasks(void) {
3638
#if (defined(SAMD21) && defined(PIN_PA02)) || defined(SAMD51)
3739
audio_dma_background();
3840
#endif
41+
#ifdef CIRCUITPY_DISPLAYIO
42+
displayio_refresh_display();
43+
#endif
3944
usb_msc_background();
4045
usb_cdc_background();
4146
last_finished_tick = ticks_ms;

ports/atmel-samd/boards/board.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@
3131

3232
#include <stdbool.h>
3333

34+
#include "py/mpconfig.h"
35+
36+
#ifdef CIRCUITPY_DISPLAYIO
37+
#include "common-hal/displayio/FourWire.h"
38+
39+
extern displayio_fourwire_obj_t board_display_obj;
40+
#endif
41+
3442
// Initializes board related state once on start up.
3543
void board_init(void);
3644

0 commit comments

Comments
 (0)