Fixing comments for PR

This commit is contained in:
Amit Sides 2021-08-25 15:07:19 -07:00
parent 1b6283a5ae
commit 98f026fbb4
4 changed files with 20 additions and 9 deletions

View File

@ -217,7 +217,11 @@ STATIC mp_obj_t displayio_epaperdisplay_obj_show(mp_obj_t self_in, mp_obj_t grou
} }
MP_DEFINE_CONST_FUN_OBJ_2(displayio_epaperdisplay_show_obj, displayio_epaperdisplay_obj_show); MP_DEFINE_CONST_FUN_OBJ_2(displayio_epaperdisplay_show_obj, displayio_epaperdisplay_obj_show);
STATIC mp_obj_t update_refresh_mode(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) //| def update_refresh_mode(self, start_sequence, seconds_per_frame) -> None:
//| """Sets the ``start_sequence`` and ``seconds_per_frame`` parameters to enable
//| quicker refresh modes of the display."""
//|
STATIC mp_obj_t displayio_epaperdisplay_update_refresh_mode(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args)
{ {
enum { ARG_start_sequence, ARG_seconds_per_frame }; enum { ARG_start_sequence, ARG_seconds_per_frame };
static const mp_arg_t allowed_args[] = { static const mp_arg_t allowed_args[] = {
@ -234,12 +238,10 @@ STATIC mp_obj_t update_refresh_mode(size_t n_args, const mp_obj_t *pos_args, mp_
float seconds_per_frame = mp_obj_get_float(args[ARG_seconds_per_frame].u_obj); float seconds_per_frame = mp_obj_get_float(args[ARG_seconds_per_frame].u_obj);
// Update parameters // Update parameters
self->start_sequence = (uint8_t *)start_sequence.buf; displayio_epaperdisplay_change_refresh_mode_parameters(self, &start_sequence, seconds_per_frame);
self->start_sequence_len = start_sequence.len;
self->milliseconds_per_frame = seconds_per_frame * 1000;
return mp_const_none; return mp_const_none;
} }
MP_DEFINE_CONST_FUN_OBJ_KW(update_refresh_mode_obj, 3, update_refresh_mode); MP_DEFINE_CONST_FUN_OBJ_KW(displayio_epaperdisplay_update_refresh_mode_obj, 3, displayio_epaperdisplay_update_refresh_mode);
//| def refresh(self) -> None: //| def refresh(self) -> None:
//| """Refreshes the display immediately or raises an exception if too soon. Use //| """Refreshes the display immediately or raises an exception if too soon. Use
@ -363,7 +365,7 @@ const mp_obj_property_t displayio_epaperdisplay_bus_obj = {
STATIC const mp_rom_map_elem_t displayio_epaperdisplay_locals_dict_table[] = { STATIC const mp_rom_map_elem_t displayio_epaperdisplay_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&displayio_epaperdisplay_show_obj) }, { MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&displayio_epaperdisplay_show_obj) },
{ MP_ROM_QSTR(MP_QSTR_update_refresh_mode), MP_ROM_PTR(&update_refresh_mode_obj) }, { MP_ROM_QSTR(MP_QSTR_update_refresh_mode), MP_ROM_PTR(&displayio_epaperdisplay_update_refresh_mode_obj) },
{ MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&displayio_epaperdisplay_refresh_obj) }, { MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&displayio_epaperdisplay_refresh_obj) },
{ MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_epaperdisplay_width_obj) }, { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_epaperdisplay_width_obj) },

View File

@ -39,7 +39,7 @@ extern const mp_obj_type_t displayio_epaperdisplay_type;
#define NO_COMMAND 0x100 #define NO_COMMAND 0x100
void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t *self, void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t *self,
mp_obj_t bus, uint8_t *start_sequence, uint16_t start_sequence_len, const uint8_t *stop_sequence, uint16_t stop_sequence_len, mp_obj_t bus, const uint8_t *start_sequence, uint16_t start_sequence_len, const uint8_t *stop_sequence, uint16_t stop_sequence_len,
uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height, int16_t colstart, int16_t rowstart, uint16_t rotation, uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height, int16_t colstart, int16_t rowstart, uint16_t rotation,
uint16_t set_column_window_command, uint16_t set_row_window_command, uint16_t set_column_window_command, uint16_t set_row_window_command,
uint16_t set_current_column_command, uint16_t set_current_row_command, uint16_t set_current_column_command, uint16_t set_current_row_command,

View File

@ -43,7 +43,7 @@
#include <string.h> #include <string.h>
void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t *self, void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t *self,
mp_obj_t bus, uint8_t *start_sequence, uint16_t start_sequence_len, mp_obj_t bus, const uint8_t *start_sequence, uint16_t start_sequence_len,
const uint8_t *stop_sequence, uint16_t stop_sequence_len, const uint8_t *stop_sequence, uint16_t stop_sequence_len,
uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height, uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height,
int16_t colstart, int16_t rowstart, uint16_t rotation, int16_t colstart, int16_t rowstart, uint16_t rotation,
@ -163,6 +163,13 @@ STATIC void send_command_sequence(displayio_epaperdisplay_obj_t *self,
} }
} }
void displayio_epaperdisplay_change_refresh_mode_parameters(displayio_epaperdisplay_obj_t *self,
mp_buffer_info_t *start_sequence, float seconds_per_frame) {
self->start_sequence = (uint8_t *)start_sequence->buf;
self->start_sequence_len = start_sequence->len;
self->milliseconds_per_frame = seconds_per_frame * 1000;
}
void displayio_epaperdisplay_start_refresh(displayio_epaperdisplay_obj_t *self) { void displayio_epaperdisplay_start_refresh(displayio_epaperdisplay_obj_t *self) {
// run start sequence // run start sequence
self->core.bus_reset(self->core.bus); self->core.bus_reset(self->core.bus);

View File

@ -38,7 +38,7 @@ typedef struct {
displayio_display_core_t core; displayio_display_core_t core;
digitalio_digitalinout_obj_t busy; digitalio_digitalinout_obj_t busy;
uint32_t milliseconds_per_frame; uint32_t milliseconds_per_frame;
uint8_t *start_sequence; const uint8_t *start_sequence;
uint32_t start_sequence_len; uint32_t start_sequence_len;
const uint8_t *stop_sequence; const uint8_t *stop_sequence;
uint32_t stop_sequence_len; uint32_t stop_sequence_len;
@ -59,6 +59,8 @@ typedef struct {
display_chip_select_behavior_t chip_select; display_chip_select_behavior_t chip_select;
} displayio_epaperdisplay_obj_t; } displayio_epaperdisplay_obj_t;
void displayio_epaperdisplay_change_refresh_mode_parameters(displayio_epaperdisplay_obj_t *self,
mp_buffer_info_t *start_sequence, float seconds_per_frame);
void displayio_epaperdisplay_background(displayio_epaperdisplay_obj_t *self); void displayio_epaperdisplay_background(displayio_epaperdisplay_obj_t *self);
void release_epaperdisplay(displayio_epaperdisplay_obj_t *self); void release_epaperdisplay(displayio_epaperdisplay_obj_t *self);
size_t maybe_refresh_epaperdisplay(void); size_t maybe_refresh_epaperdisplay(void);