Quirk coded up for ...set_region_to_update

This commit is contained in:
Mark Roberts 2020-09-21 21:07:42 -04:00
parent f21dc253e0
commit 08189edf24
2 changed files with 17 additions and 1 deletions

View File

@ -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;

View File

@ -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);