Fix SH110x
This commit is contained in:
parent
87fc5eff26
commit
eab202aa53
@ -65,7 +65,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self,
|
||||
}
|
||||
displayio_display_core_construct(&self->core, bus, width, height, ram_width, ram_height, colstart, rowstart, rotation,
|
||||
color_depth, grayscale, pixels_in_byte_share_row, bytes_per_cell, reverse_pixels_in_byte, reverse_bytes_in_word,
|
||||
set_column_command, set_row_command, NO_COMMAND, NO_COMMAND, self->data_as_commands, false /* always_toggle_chip_select */,
|
||||
set_column_command, set_row_command, NO_COMMAND, NO_COMMAND, data_as_commands, false /* always_toggle_chip_select */,
|
||||
SH1107_addressing && color_depth == 1, false /*address_little_endian */);
|
||||
|
||||
self->write_ram_command = write_ram_command;
|
||||
@ -86,7 +86,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self,
|
||||
while (!displayio_display_core_begin_transaction(&self->core)) {
|
||||
RUN_BACKGROUND_TASKS;
|
||||
}
|
||||
if (self->data_as_commands) {
|
||||
if (self->core.data_as_commands) {
|
||||
uint8_t full_command[data_size + 1];
|
||||
full_command[0] = cmd[0];
|
||||
memcpy(full_command + 1, data, data_size);
|
||||
@ -185,7 +185,7 @@ bool common_hal_displayio_display_set_brightness(displayio_display_obj_t *self,
|
||||
} else if (self->brightness_command != NO_BRIGHTNESS_COMMAND) {
|
||||
ok = displayio_display_core_begin_transaction(&self->core);
|
||||
if (ok) {
|
||||
if (self->data_as_commands) {
|
||||
if (self->core.data_as_commands) {
|
||||
uint8_t set_brightness[2] = {self->brightness_command, (uint8_t)(0xff * brightness)};
|
||||
self->core.send(self->core.bus, DISPLAY_COMMAND, CHIP_SELECT_TOGGLE_EVERY_BYTE, set_brightness, 2);
|
||||
} else {
|
||||
@ -226,7 +226,7 @@ STATIC const displayio_area_t *_get_refresh_areas(displayio_display_obj_t *self)
|
||||
}
|
||||
|
||||
STATIC void _send_pixels(displayio_display_obj_t *self, uint8_t *pixels, uint32_t length) {
|
||||
if (!self->data_as_commands) {
|
||||
if (!self->core.data_as_commands) {
|
||||
self->core.send(self->core.bus, DISPLAY_COMMAND, CHIP_SELECT_TOGGLE_EVERY_BYTE, &self->write_ram_command, 1);
|
||||
}
|
||||
self->core.send(self->core.bus, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, pixels, length);
|
||||
@ -247,7 +247,7 @@ STATIC bool _refresh_area(displayio_display_obj_t *self, const displayio_area_t
|
||||
uint16_t subrectangles = 1;
|
||||
// for SH1107 and other boundary constrained controllers
|
||||
// write one single row at a time
|
||||
if (self->SH1107_addressing) {
|
||||
if (self->core.SH1107_addressing) {
|
||||
subrectangles = rows_per_buffer / 8; // page addressing mode writes 8 rows at a time
|
||||
rows_per_buffer = 8;
|
||||
} else if (displayio_area_size(&clipped) > buffer_size * pixels_per_word) {
|
||||
|
@ -50,15 +50,10 @@ typedef struct {
|
||||
uint16_t brightness_command;
|
||||
uint16_t native_frames_per_second;
|
||||
uint16_t native_ms_per_frame;
|
||||
uint8_t set_column_command;
|
||||
uint8_t set_row_command;
|
||||
uint8_t write_ram_command;
|
||||
bool auto_refresh;
|
||||
bool first_manual_refresh;
|
||||
bool data_as_commands;
|
||||
bool backlight_on_high;
|
||||
// new quirk for sh1107
|
||||
bool SH1107_addressing;
|
||||
} displayio_display_obj_t;
|
||||
|
||||
void displayio_display_background(displayio_display_obj_t *self);
|
||||
|
Loading…
x
Reference in New Issue
Block a user