Skip to content

Commit 08189ed

Browse files
committed
Quirk coded up for ...set_region_to_update
1 parent f21dc25 commit 08189ed

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

shared-module/displayio/Display.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
4949
uint8_t* init_sequence, uint16_t init_sequence_len, const mcu_pin_obj_t* backlight_pin,
5050
uint16_t brightness_command, mp_float_t brightness, bool auto_brightness,
5151
bool single_byte_bounds, bool data_as_commands, bool auto_refresh, uint16_t native_frames_per_second,
52-
bool backlight_on_high), bool column_and_page_addressing {
52+
bool backlight_on_high, bool column_and_page_addressing) {
5353
// Turn off auto-refresh as we init.
5454
self->auto_refresh = false;
5555
uint16_t ram_width = 0x100;

shared-module/displayio/display_core.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,16 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t* self,
253253
data[data_length++] = x2 >> 8;
254254
data[data_length++] = x2 & 0xff;
255255
}
256+
// Quirk for SH1107 "column_and_page_addressing"
257+
// Column lower command = 0x00, Column upper command = 0x10
258+
if (column_and_page_addressing) {
259+
data[0] = 0x00 | (x1 & 0x0F);
260+
data[1] = 0x10 | (x1 >> 4);
261+
data_length = 2;
262+
}
256263
self->send(self->bus, data_type, chip_select, data, data_length);
257264
displayio_display_core_end_transaction(self);
265+
258266
if (set_current_column_command != NO_COMMAND) {
259267
uint8_t command = set_current_column_command;
260268
displayio_display_core_begin_transaction(self);
@@ -283,6 +291,14 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t* self,
283291
data[data_length++] = y2 >> 8;
284292
data[data_length++] = y2 & 0xff;
285293
}
294+
// Quirk for SH1107 "column_and_page_addressing"
295+
// Page address command = 0xB0
296+
if (column_and_page_addressing) {
297+
data[0] = 0xB0 | (y1 & 0x07);
298+
data_length = 1;
299+
}
300+
self->send(self->bus, data_type, chip_select, data, data_length);
301+
286302
self->send(self->bus, data_type, chip_select, data, data_length);
287303
displayio_display_core_end_transaction(self);
288304

0 commit comments

Comments
 (0)