Initial commit bool column_and_page_addressing

This commit is contained in:
Mark Roberts 2020-09-21 18:42:16 -04:00
parent 9cc803eb95
commit f21dc253e0
4 changed files with 11 additions and 3 deletions

View File

@ -105,6 +105,7 @@
//| :param bool auto_brightness: If True, brightness is controlled via an ambient light sensor or other mechanism.
//| :param bool single_byte_bounds: Display column and row commands use single bytes
//| :param bool data_as_commands: Treat all init and boundary data as SPI commands. Certain displays require this.
//| :param bool column_and_page_addressing: Special quirk for SH1107, use upper/lower column set and page set
//| :param bool auto_refresh: Automatically refresh the screen
//| :param int native_frames_per_second: Number of display refreshes per second that occur with the given init_sequence.
//| :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
{ MP_QSTR_auto_refresh, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} },
{ MP_QSTR_native_frames_per_second, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 60} },
{ MP_QSTR_backlight_on_high, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} },
{ MP_QSTR_column_and_page_addressing, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} },
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
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
args[ARG_data_as_commands].u_bool,
args[ARG_auto_refresh].u_bool,
args[ARG_native_frames_per_second].u_int,
args[ARG_backlight_on_high].u_bool
args[ARG_backlight_on_high].u_bool,
args[ARG_column_and_page_addressing].u_bool
);
return self;

View File

@ -45,7 +45,8 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
uint8_t set_column_command, uint8_t set_row_command, uint8_t write_ram_command, uint8_t set_vertical_scroll,
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 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 common_hal_displayio_display_show(displayio_display_obj_t* self,
displayio_group_t* root_group);

View File

@ -48,7 +48,8 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
uint8_t set_row_command, uint8_t write_ram_command, uint8_t set_vertical_scroll,
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 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 {
// Turn off auto-refresh as we init.
self->auto_refresh = false;
uint16_t ram_width = 0x100;
@ -68,6 +69,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
self->first_manual_refresh = !auto_refresh;
self->data_as_commands = data_as_commands;
self->backlight_on_high = backlight_on_high;
self->column_and_page_addressing = column_and_page_addressing;
self->native_frames_per_second = native_frames_per_second;
self->native_ms_per_frame = 1000 / native_frames_per_second;

View File

@ -60,6 +60,8 @@ typedef struct {
bool auto_brightness;
bool updating_backlight;
bool backlight_on_high;
// new quirk for sh1107
bool column_and_page_addressing;
} displayio_display_obj_t;
void displayio_display_background(displayio_display_obj_t* self);