summaryrefslogtreecommitdiff
path: root/supervisor/shared
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2019-07-05 19:01:54 -0700
committerScott Shawcroft <scott@tannewt.org>2019-07-19 16:06:11 -0700
commit6797ec6ed396f65916fe816f8b2b49114253dd86 (patch)
tree31f26206469b803be6d1ef3d5d5b61c27e2fff0b /supervisor/shared
parenta98bfa628e9f4469bbad5bafb042d7a2c3c15346 (diff)
Add support for grayscale displays that are < 8 bit depth.
This also improves Palette so it stores the original RGB888 colors. Lastly, it adds I2CDisplay as a display bus to talk over I2C. Particularly useful for the SSD1306. Fixes #1828. Fixes #1956
Diffstat (limited to 'supervisor/shared')
-rw-r--r--supervisor/shared/display.c49
1 files changed, 40 insertions, 9 deletions
diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c
index 414f85034..6a39cbe8e 100644
--- a/supervisor/shared/display.c
+++ b/supervisor/shared/display.c
@@ -82,8 +82,7 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) {
grid->pixel_height = height_in_tiles * grid->tile_height;
grid->tiles = tiles;
- supervisor_terminal.cursor_x = 0;
- supervisor_terminal.cursor_y = 0;
+ common_hal_terminalio_terminal_construct(&supervisor_terminal, grid, &supervisor_terminal_font);
}
void supervisor_stop_terminal(void) {
@@ -147,17 +146,49 @@ displayio_bitmap_t blinka_bitmap = {
.read_only = true
};
-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_color_t blinka_colors[7] = {
+ {
+ .rgb888 = 0x000000,
+ .rgb565 = 0x0000,
+ .luma = 0x00,
+ .transparent = true
+ },
+ {
+ .rgb888 = 0x8428bc,
+ .rgb565 = 0x7889,
+ .luma = 0xff // We cheat the luma here. It is actually 0x60
+ },
+ {
+ .rgb888 = 0xff89bc,
+ .rgb565 = 0xB8FC,
+ .luma = 0xb5
+ },
+ {
+ .rgb888 = 0x7beffe,
+ .rgb565 = 0x9F86,
+ .luma = 0xe0
+ },
+ {
+ .rgb888 = 0x51395f,
+ .rgb565 = 0x0D5A,
+ .luma = 0x47
+ },
+ {
+ .rgb888 = 0xffffff,
+ .rgb565 = 0xffff,
+ .luma = 0xff
+ },
+ {
+ .rgb888 = 0x0736a0,
+ .rgb565 = 0xf501,
+ .luma = 0x44
+ },
+};
displayio_palette_t blinka_palette = {
.base = {.type = &displayio_palette_type },
- .opaque = blinka_transparency,
.colors = blinka_colors,
- .color_count = 16,
+ .color_count = 7,
.needs_refresh = false
};