Skip to content

Commit f21dc25

Browse files
committed
Initial commit bool column_and_page_addressing
1 parent 9cc803e commit f21dc25

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

shared-bindings/displayio/Display.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
//| :param bool auto_brightness: If True, brightness is controlled via an ambient light sensor or other mechanism.
106106
//| :param bool single_byte_bounds: Display column and row commands use single bytes
107107
//| :param bool data_as_commands: Treat all init and boundary data as SPI commands. Certain displays require this.
108+
//| :param bool column_and_page_addressing: Special quirk for SH1107, use upper/lower column set and page set
108109
//| :param bool auto_refresh: Automatically refresh the screen
109110
//| :param int native_frames_per_second: Number of display refreshes per second that occur with the given init_sequence.
110111
//| :param bool backlight_on_high: If True, pulling the backlight pin high turns the backlight on."""
@@ -139,6 +140,7 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a
139140
{ MP_QSTR_auto_refresh, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} },
140141
{ MP_QSTR_native_frames_per_second, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 60} },
141142
{ MP_QSTR_backlight_on_high, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} },
143+
{ MP_QSTR_column_and_page_addressing, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} },
142144
};
143145
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
144146
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
@@ -180,7 +182,8 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a
180182
args[ARG_data_as_commands].u_bool,
181183
args[ARG_auto_refresh].u_bool,
182184
args[ARG_native_frames_per_second].u_int,
183-
args[ARG_backlight_on_high].u_bool
185+
args[ARG_backlight_on_high].u_bool,
186+
args[ARG_column_and_page_addressing].u_bool
184187
);
185188

186189
return self;

shared-bindings/displayio/Display.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
4545
uint8_t set_column_command, uint8_t set_row_command, uint8_t write_ram_command, uint8_t set_vertical_scroll,
4646
uint8_t* init_sequence, uint16_t init_sequence_len, const mcu_pin_obj_t* backlight_pin, uint16_t brightness_command,
4747
mp_float_t brightness, bool auto_brightness,
48-
bool single_byte_bounds, bool data_as_commands, bool auto_refresh, uint16_t native_frames_per_second, bool backlight_on_high);
48+
bool single_byte_bounds, bool data_as_commands, bool auto_refresh, uint16_t native_frames_per_second,
49+
bool backlight_on_high, bool column_and_page_addressing);
4950

5051
bool common_hal_displayio_display_show(displayio_display_obj_t* self,
5152
displayio_group_t* root_group);

shared-module/displayio/Display.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
4848
uint8_t set_row_command, uint8_t write_ram_command, uint8_t set_vertical_scroll,
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,
51-
bool single_byte_bounds, bool data_as_commands, bool auto_refresh, uint16_t native_frames_per_second, bool backlight_on_high) {
51+
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 {
5253
// Turn off auto-refresh as we init.
5354
self->auto_refresh = false;
5455
uint16_t ram_width = 0x100;
@@ -68,6 +69,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
6869
self->first_manual_refresh = !auto_refresh;
6970
self->data_as_commands = data_as_commands;
7071
self->backlight_on_high = backlight_on_high;
72+
self->column_and_page_addressing = column_and_page_addressing;
7173

7274
self->native_frames_per_second = native_frames_per_second;
7375
self->native_ms_per_frame = 1000 / native_frames_per_second;

shared-module/displayio/Display.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ typedef struct {
6060
bool auto_brightness;
6161
bool updating_backlight;
6262
bool backlight_on_high;
63+
// new quirk for sh1107
64+
bool column_and_page_addressing;
6365
} displayio_display_obj_t;
6466

6567
void displayio_display_background(displayio_display_obj_t* self);

0 commit comments

Comments
 (0)