summaryrefslogtreecommitdiff
path: root/shared-module
diff options
context:
space:
mode:
authorMark Roberts <mdroberts1243@gmail.com>2020-09-21 21:07:42 -0400
committerMark Roberts <mdroberts1243@gmail.com>2020-09-21 21:07:42 -0400
commit08189edf247244c616b0bd4c58fdb678b6c53d0e (patch)
treeb2c5c1e09fbae9db6741c5bcbb31903e8134adca /shared-module
parentf21dc253e094854670b829f6258aac3722eefc26 (diff)
Quirk coded up for ...set_region_to_update
Diffstat (limited to 'shared-module')
-rw-r--r--shared-module/displayio/Display.c2
-rw-r--r--shared-module/displayio/display_core.c16
2 files changed, 17 insertions, 1 deletions
diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c
index d3e7ee175..b0806af29 100644
--- a/shared-module/displayio/Display.c
+++ b/shared-module/displayio/Display.c
@@ -49,7 +49,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
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, bool auto_refresh, uint16_t native_frames_per_second,
- bool backlight_on_high), bool column_and_page_addressing {
+ bool backlight_on_high, bool column_and_page_addressing) {
// Turn off auto-refresh as we init.
self->auto_refresh = false;
uint16_t ram_width = 0x100;
diff --git a/shared-module/displayio/display_core.c b/shared-module/displayio/display_core.c
index 43f2d1937..f046ab9e4 100644
--- a/shared-module/displayio/display_core.c
+++ b/shared-module/displayio/display_core.c
@@ -253,8 +253,16 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t* self,
data[data_length++] = x2 >> 8;
data[data_length++] = x2 & 0xff;
}
+ // Quirk for SH1107 "column_and_page_addressing"
+ // Column lower command = 0x00, Column upper command = 0x10
+ if (column_and_page_addressing) {
+ data[0] = 0x00 | (x1 & 0x0F);
+ data[1] = 0x10 | (x1 >> 4);
+ data_length = 2;
+ }
self->send(self->bus, data_type, chip_select, data, data_length);
displayio_display_core_end_transaction(self);
+
if (set_current_column_command != NO_COMMAND) {
uint8_t command = set_current_column_command;
displayio_display_core_begin_transaction(self);
@@ -283,6 +291,14 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t* self,
data[data_length++] = y2 >> 8;
data[data_length++] = y2 & 0xff;
}
+ // Quirk for SH1107 "column_and_page_addressing"
+ // Page address command = 0xB0
+ if (column_and_page_addressing) {
+ data[0] = 0xB0 | (y1 & 0x07);
+ data_length = 1;
+ }
+ self->send(self->bus, data_type, chip_select, data, data_length);
+
self->send(self->bus, data_type, chip_select, data, data_length);
displayio_display_core_end_transaction(self);