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:
parent
01195c2089
commit
8f1c25c8ae
@ -249,8 +249,8 @@ STATIC bool _refresh_area(displayio_display_obj_t *self, const displayio_area_t
|
|||||||
// for SH1107 and other boundary constrained controllers
|
// for SH1107 and other boundary constrained controllers
|
||||||
// write one single row at a time
|
// write one single row at a time
|
||||||
if (self->SH1107_addressing) {
|
if (self->SH1107_addressing) {
|
||||||
subrectangles = rows_per_buffer; // vertical (column mode) write each separately (height times)
|
subrectangles = rows_per_buffer/8; // vertical (column mode) write each separately (height times)
|
||||||
rows_per_buffer = 1;
|
rows_per_buffer = 8;
|
||||||
} else if (displayio_area_size(&clipped) > buffer_size * pixels_per_word) {
|
} else if (displayio_area_size(&clipped) > buffer_size * pixels_per_word) {
|
||||||
rows_per_buffer = buffer_size * pixels_per_word / displayio_area_width(&clipped);
|
rows_per_buffer = buffer_size * pixels_per_word / displayio_area_width(&clipped);
|
||||||
if (rows_per_buffer == 0) {
|
if (rows_per_buffer == 0) {
|
||||||
|
@ -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 >> 8;
|
||||||
data[data_length++] = x2 & 0xff;
|
data[data_length++] = x2 & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quirk for SH1107 "SH1107_addressing"
|
// Quirk for SH1107 "SH1107_addressing"
|
||||||
// Note... column is y! page is x!
|
// Column lower command = 0x00, Column upper command = 0x10
|
||||||
// Page address command = 0xB0
|
|
||||||
if (SH1107_addressing) {
|
if (SH1107_addressing) {
|
||||||
// set the page to our x value
|
data[0] = ((x1 >> 4) & 0x0F) | 0x10; // 0x10 to 0x17
|
||||||
data[0] = 0xB0 | (x1 & 0x0F);
|
data[1] = x1 & 0x0F; // 0x00 to 0x0F
|
||||||
data_length = 1;
|
data_length = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
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 >> 8;
|
||||||
data[data_length++] = y2 & 0xff;
|
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);
|
displayio_display_core_end_transaction(self);
|
||||||
|
|
||||||
if (set_current_row_command != NO_COMMAND) {
|
if (set_current_row_command != NO_COMMAND) {
|
||||||
|
Loading…
Reference in New Issue
Block a user