diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c index f75f0392f7..7946111b73 100644 --- a/shared-module/displayio/Display.c +++ b/shared-module/displayio/Display.c @@ -29,6 +29,7 @@ #include "py/runtime.h" #include "shared-bindings/displayio/FourWire.h" #include "shared-bindings/displayio/ParallelBus.h" +#include "shared-bindings/time/__init__.h" #include @@ -73,18 +74,15 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self, uint8_t *data = cmd + 2; self->send(self->bus, true, cmd, 1); self->send(self->bus, false, data, data_size); + uint16_t delay_length_ms = 10; if (delay) { data_size++; - uint16_t delay_length_ms = *(cmd + 1 + data_size); + delay_length_ms = *(cmd + 1 + data_size); if (delay_length_ms == 255) { delay_length_ms = 500; } - uint64_t start = ticks_ms; - while (ticks_ms - start < delay_length_ms) {} - } else { - uint64_t start = ticks_ms; - while (ticks_ms - start < 10) {} } + common_hal_time_delay_ms(delay_length_ms); i += 2 + data_size; } self->end_transaction(self->bus); diff --git a/shared-module/displayio/Palette.c b/shared-module/displayio/Palette.c index 5f410d7869..e810be8752 100644 --- a/shared-module/displayio/Palette.c +++ b/shared-module/displayio/Palette.c @@ -47,9 +47,9 @@ void common_hal_displayio_palette_make_transparent(displayio_palette_t* self, ui void common_hal_displayio_palette_set_color(displayio_palette_t* self, uint32_t palette_index, uint32_t color) { uint32_t shift = (palette_index % 2) * 16; uint32_t masked = self->colors[palette_index / 2] & ~(0xffff << shift); - uint32_t b5 = (color >> 19); + uint32_t r5 = (color >> 19); uint32_t g6 = (color >> 10) & 0x3f; - uint32_t r5 = (color >> 3) & 0x1f; + uint32_t b5 = (color >> 3) & 0x1f; uint32_t packed = r5 << 11 | g6 << 5 | b5; // swap bytes packed = __builtin_bswap16(packed); diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index 59a5cf398e..c86e48a125 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -99,8 +99,8 @@ displayio_bitmap_t blinka_bitmap = { uint32_t blinka_transparency[1] = {0x80000000}; -// TODO(tannewt): Fix these colors -uint32_t blinka_colors[8] = {0x91780000, 0x879FFC98, 0xffff0000, 0x0000f501, +// 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 = {