Skip to content

Commit 98f026f

Browse files
committed
Fixing comments for PR
1 parent 1b6283a commit 98f026f

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

shared-bindings/displayio/EPaperDisplay.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,11 @@ STATIC mp_obj_t displayio_epaperdisplay_obj_show(mp_obj_t self_in, mp_obj_t grou
217217
}
218218
MP_DEFINE_CONST_FUN_OBJ_2(displayio_epaperdisplay_show_obj, displayio_epaperdisplay_obj_show);
219219

220-
STATIC mp_obj_t update_refresh_mode(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args)
220+
//| def update_refresh_mode(self, start_sequence, seconds_per_frame) -> None:
221+
//| """Sets the ``start_sequence`` and ``seconds_per_frame`` parameters to enable
222+
//| quicker refresh modes of the display."""
223+
//|
224+
STATIC mp_obj_t displayio_epaperdisplay_update_refresh_mode(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args)
221225
{
222226
enum { ARG_start_sequence, ARG_seconds_per_frame };
223227
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_
234238
float seconds_per_frame = mp_obj_get_float(args[ARG_seconds_per_frame].u_obj);
235239

236240
// Update parameters
237-
self->start_sequence = (uint8_t *)start_sequence.buf;
238-
self->start_sequence_len = start_sequence.len;
239-
self->milliseconds_per_frame = seconds_per_frame * 1000;
241+
displayio_epaperdisplay_change_refresh_mode_parameters(self, &start_sequence, seconds_per_frame);
240242
return mp_const_none;
241243
}
242-
MP_DEFINE_CONST_FUN_OBJ_KW(update_refresh_mode_obj, 3, update_refresh_mode);
244+
MP_DEFINE_CONST_FUN_OBJ_KW(displayio_epaperdisplay_update_refresh_mode_obj, 3, displayio_epaperdisplay_update_refresh_mode);
243245

244246
//| def refresh(self) -> None:
245247
//| """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 = {
363365

364366
STATIC const mp_rom_map_elem_t displayio_epaperdisplay_locals_dict_table[] = {
365367
{ MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&displayio_epaperdisplay_show_obj) },
366-
{ MP_ROM_QSTR(MP_QSTR_update_refresh_mode), MP_ROM_PTR(&update_refresh_mode_obj) },
368+
{ MP_ROM_QSTR(MP_QSTR_update_refresh_mode), MP_ROM_PTR(&displayio_epaperdisplay_update_refresh_mode_obj) },
367369
{ MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&displayio_epaperdisplay_refresh_obj) },
368370

369371
{ MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_epaperdisplay_width_obj) },

shared-bindings/displayio/EPaperDisplay.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ extern const mp_obj_type_t displayio_epaperdisplay_type;
3939
#define NO_COMMAND 0x100
4040

4141
void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t *self,
42-
mp_obj_t bus, uint8_t *start_sequence, uint16_t start_sequence_len, const uint8_t *stop_sequence, uint16_t stop_sequence_len,
42+
mp_obj_t bus, const uint8_t *start_sequence, uint16_t start_sequence_len, const uint8_t *stop_sequence, uint16_t stop_sequence_len,
4343
uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height, int16_t colstart, int16_t rowstart, uint16_t rotation,
4444
uint16_t set_column_window_command, uint16_t set_row_window_command,
4545
uint16_t set_current_column_command, uint16_t set_current_row_command,

shared-module/displayio/EPaperDisplay.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#include <string.h>
4444

4545
void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t *self,
46-
mp_obj_t bus, uint8_t *start_sequence, uint16_t start_sequence_len,
46+
mp_obj_t bus, const uint8_t *start_sequence, uint16_t start_sequence_len,
4747
const uint8_t *stop_sequence, uint16_t stop_sequence_len,
4848
uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height,
4949
int16_t colstart, int16_t rowstart, uint16_t rotation,
@@ -163,6 +163,13 @@ STATIC void send_command_sequence(displayio_epaperdisplay_obj_t *self,
163163
}
164164
}
165165

166+
void displayio_epaperdisplay_change_refresh_mode_parameters(displayio_epaperdisplay_obj_t *self,
167+
mp_buffer_info_t *start_sequence, float seconds_per_frame) {
168+
self->start_sequence = (uint8_t *)start_sequence->buf;
169+
self->start_sequence_len = start_sequence->len;
170+
self->milliseconds_per_frame = seconds_per_frame * 1000;
171+
}
172+
166173
void displayio_epaperdisplay_start_refresh(displayio_epaperdisplay_obj_t *self) {
167174
// run start sequence
168175
self->core.bus_reset(self->core.bus);

shared-module/displayio/EPaperDisplay.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ typedef struct {
3838
displayio_display_core_t core;
3939
digitalio_digitalinout_obj_t busy;
4040
uint32_t milliseconds_per_frame;
41-
uint8_t *start_sequence;
41+
const uint8_t *start_sequence;
4242
uint32_t start_sequence_len;
4343
const uint8_t *stop_sequence;
4444
uint32_t stop_sequence_len;
@@ -59,6 +59,8 @@ typedef struct {
5959
display_chip_select_behavior_t chip_select;
6060
} displayio_epaperdisplay_obj_t;
6161

62+
void displayio_epaperdisplay_change_refresh_mode_parameters(displayio_epaperdisplay_obj_t *self,
63+
mp_buffer_info_t *start_sequence, float seconds_per_frame);
6264
void displayio_epaperdisplay_background(displayio_epaperdisplay_obj_t *self);
6365
void release_epaperdisplay(displayio_epaperdisplay_obj_t *self);
6466
size_t maybe_refresh_epaperdisplay(void);

0 commit comments

Comments
 (0)