fix SH110x mode, the SH1107 is actually column not row mode BUT the SD1107 module we use is vertical orientation (confusing!) so row/col are NOT swapped. we will have to fix the SH1107 driver to match. this fix required for SH1106 (which uses the same page mode commands but ISNT rotated)

This commit is contained in:
lady ada 2021-06-06 18:25:40 -04:00
parent 01195c2089
commit 8f1c25c8ae
2 changed files with 17 additions and 16 deletions

View File

@ -249,8 +249,8 @@ STATIC bool _refresh_area(displayio_display_obj_t *self, const displayio_area_t
// for SH1107 and other boundary constrained controllers
// write one single row at a time
if (self->SH1107_addressing) {
subrectangles = rows_per_buffer; // vertical (column mode) write each separately (height times)
rows_per_buffer = 1;
subrectangles = rows_per_buffer/8; // vertical (column mode) write each separately (height times)
rows_per_buffer = 8;
} else if (displayio_area_size(&clipped) > buffer_size * pixels_per_word) {
rows_per_buffer = buffer_size * pixels_per_word / displayio_area_width(&clipped);
if (rows_per_buffer == 0) {

View File

@ -260,14 +260,15 @@ 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 "SH1107_addressing"
// Note... column is y! page is x!
// Page address command = 0xB0
// Column lower command = 0x00, Column upper command = 0x10
if (SH1107_addressing) {
// set the page to our x value
data[0] = 0xB0 | (x1 & 0x0F);
data_length = 1;
data[0] = ((x1 >> 4) & 0x0F) | 0x10; // 0x10 to 0x17
data[1] = x1 & 0x0F; // 0x00 to 0x0F
data_length = 2;
}
self->send(self->bus, data_type, chip_select, data, data_length);
displayio_display_core_end_transaction(self);
@ -299,16 +300,16 @@ 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 "SH1107_addressing"
// Note... column is y! page is x!
// Column lower command = 0x00, Column upper command = 0x10
if (SH1107_addressing) {
data[0] = y1 & 0x0F; // 0x00 to 0x0F
data[1] = (y1 >> 4 & 0x0F) | 0x10; // 0x10 to 0x17
data_length = 2;
}
self->send(self->bus, data_type, chip_select, data, data_length);
// Quirk for SH1107 "SH1107_addressing"
// Page address command = 0xB0
if (SH1107_addressing) {
// set the page to our y value
data[0] = 0xB0 | y1;
data_length = 1;
}
self->send(self->bus, data_type, chip_select, data, data_length);
displayio_display_core_end_transaction(self);
if (set_current_row_command != NO_COMMAND) {