diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index cbaa54b90e..9f4bf97a73 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -107,6 +107,10 @@ msgstr "" msgid "%q must be %d-%d" msgstr "" +#: shared-bindings/displayio/Display.c +msgid "%q must be 1 when %q is True" +msgstr "" + #: py/argcheck.c shared-bindings/gifio/GifWriter.c msgid "%q must be <= %d" msgstr "" diff --git a/ports/stm/boards/thunderpack_v12/mpconfigboard.mk b/ports/stm/boards/thunderpack_v12/mpconfigboard.mk index 526415ca30..f7905f6945 100644 --- a/ports/stm/boards/thunderpack_v12/mpconfigboard.mk +++ b/ports/stm/boards/thunderpack_v12/mpconfigboard.mk @@ -14,6 +14,7 @@ EXTERNAL_FLASH_DEVICES = GD25Q16C CIRCUITPY_NVM = 1 CIRCUITPY_BITMAPTOOLS = 0 CIRCUITPY_BLEIO_HCI = 0 +CIRCUITPY_ONEWIREIO = 0 CIRCUITPY_ZLIB = 0 MCU_SERIES = F4 diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index 253887f1de..b19c0bac53 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -170,14 +170,20 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a mp_raise_ValueError(translate("Display rotation must be in 90 degree increments")); } + const bool sh1107_addressing = args[ARG_SH1107_addressing].u_bool; + const mp_int_t color_depth = args[ARG_color_depth].u_int; + if (sh1107_addressing && color_depth != 1) { + mp_raise_ValueError_varg(translate("%q must be 1 when %q is True"), MP_QSTR_color_depth, MP_QSTR_SH1107_addressing); + } + primary_display_t *disp = allocate_display_or_raise(); displayio_display_obj_t *self = &disp->display; - ; + self->base.type = &displayio_display_type; 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_grayscale].u_bool, + color_depth, args[ARG_grayscale].u_bool, args[ARG_pixels_in_byte_share_row].u_bool, args[ARG_bytes_per_cell].u_bool, args[ARG_reverse_pixels_in_byte].u_bool, @@ -194,7 +200,7 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a args[ARG_auto_refresh].u_bool, args[ARG_native_frames_per_second].u_int, args[ARG_backlight_on_high].u_bool, - args[ARG_SH1107_addressing].u_bool + sh1107_addressing ); return self; diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c index 579dca49fc..255cd49e06 100644 --- a/shared-module/displayio/Display.c +++ b/shared-module/displayio/Display.c @@ -74,7 +74,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self, self->first_manual_refresh = !auto_refresh; self->data_as_commands = data_as_commands; self->backlight_on_high = backlight_on_high; - self->SH1107_addressing = SH1107_addressing; + self->SH1107_addressing = SH1107_addressing && color_depth == 1; self->native_frames_per_second = native_frames_per_second; self->native_ms_per_frame = 1000 / native_frames_per_second;