Skip to content

Commit d1d9215

Browse files
committed
A little more partial work
1 parent a127f81 commit d1d9215

4 files changed

Lines changed: 28 additions & 3 deletions

File tree

locale/circuitpython.pot

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,6 +1757,10 @@ msgstr ""
17571757
msgid "Parameter error"
17581758
msgstr ""
17591759

1760+
#: shared-module/epaperdisplay/EPaperDisplay.c
1761+
msgid "Partial display not supported"
1762+
msgstr ""
1763+
17601764
#: ports/espressif/common-hal/audiobusio/__init__.c
17611765
msgid "Peripheral in use"
17621766
msgstr ""

shared-bindings/epaperdisplay/EPaperDisplay.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,10 @@ MP_DEFINE_CONST_FUN_OBJ_KW(epaperdisplay_epaperdisplay_update_refresh_mode_obj,
313313

314314
//| def refresh(self, partial: bool = False) -> None:
315315
//| """Refreshes the display immediately or raises an exception if too soon. Use
316-
//| ``time.sleep(display.time_to_refresh)`` to sleep until a refresh can occur."""
316+
//| ``time.sleep(display.time_to_refresh)`` to sleep until a refresh can occur.
317+
//|
318+
//| When partial is True, only the changed displayio areas are updated in black and white
319+
//| mode."""
317320
//| ...
318321
//|
319322
static mp_obj_t epaperdisplay_epaperdisplay_obj_refresh(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {

shared-module/epaperdisplay/EPaperDisplay.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,18 @@ static bool _clean_area(epaperdisplay_epaperdisplay_obj_t *self) {
439439
return true;
440440
}
441441

442-
bool common_hal_epaperdisplay_epaperdisplay_refresh(epaperdisplay_epaperdisplay_obj_t *self) {
443-
442+
bool common_hal_epaperdisplay_epaperdisplay_refresh(epaperdisplay_epaperdisplay_obj_t *self, bool partial) {
443+
#if CIRCUITPY_EPAPERDISPLAY_PARTIAL
444+
if (partial && (self->partial_window_command == NO_COMMAND ||
445+
self->partial_start_command == NO_COMMAND ||
446+
self->partial_end_command == NO_COMMAND)) {
447+
mp_raise_RuntimeError(MP_ERROR_TEXT("Partial display not supported"));
448+
}
449+
#else
450+
if (partial) {
451+
mp_raise_RuntimeError(MP_ERROR_TEXT("Partial display not supported"));
452+
}
453+
#endif
444454
if (self->refreshing && self->busy.base.type == &digitalio_digitalinout_type) {
445455
if (common_hal_digitalio_digitalinout_get_value(&self->busy) != self->busy_state) {
446456
supervisor_disable_tick();

shared-module/epaperdisplay/EPaperDisplay.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ typedef struct {
3737
bool grayscale;
3838
bool acep;
3939
bool two_byte_sequence_length;
40+
#if CIRCUITPY_EPAPERDISPLAY_PARTIAL
41+
bool save_full_framebuffer;
42+
uint8_t *full_framebuffer;
43+
uint16_t full_framebuffer_size;
44+
uint16_t partial_window_command;
45+
uint16_t partial_start_command;
46+
uint16_t partial_stop_command;
47+
#endif
4048
display_chip_select_behavior_t chip_select;
4149
} epaperdisplay_epaperdisplay_obj_t;
4250

0 commit comments

Comments
 (0)