change to CIRCUITPYTHON_TERMINAL. change internal API to use set_root_group

This commit is contained in:
foamyguy 2022-11-18 16:53:18 -06:00
parent 788638f727
commit 403e3ef430
7 changed files with 15 additions and 10 deletions

View File

@ -430,10 +430,7 @@ STATIC mp_obj_t displayio_display_obj_set_root_group(mp_obj_t self_in, mp_obj_t
group = MP_OBJ_TO_PTR(native_group(group_in));
}
bool ok = common_hal_displayio_display_show(self, group);
if (!ok) {
mp_raise_ValueError(translate("Group already used"));
}
common_hal_displayio_display_set_root_group(self, group);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_set_root_group_obj, displayio_display_obj_set_root_group);

View File

@ -96,7 +96,7 @@ STATIC const mp_rom_map_elem_t displayio_module_globals_table[] = {
#endif
{ MP_ROM_QSTR(MP_QSTR_release_displays), MP_ROM_PTR(&displayio_release_displays_obj) },
{ MP_ROM_QSTR(MP_QSTR_SERIAL_GROUP), MP_ROM_PTR(&circuitpython_splash) },
{ MP_ROM_QSTR(MP_QSTR_CIRCUITPYTHON_TERMINAL), MP_ROM_PTR(&circuitpython_splash) },
};
STATIC MP_DEFINE_CONST_DICT(displayio_module_globals, displayio_module_globals_table);

View File

@ -141,7 +141,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self,
}
bool common_hal_displayio_display_show(displayio_display_obj_t *self, displayio_group_t *root_group) {
return displayio_display_core_show(&self->core, root_group);
return displayio_display_core_set_root_group(&self->core, root_group);
}
uint16_t common_hal_displayio_display_get_width(displayio_display_obj_t *self) {
@ -398,6 +398,14 @@ void common_hal_displayio_display_set_auto_refresh(displayio_display_obj_t *self
self->auto_refresh = auto_refresh;
}
mp_obj_t common_hal_displayio_display_set_root_group(displayio_display_obj_t *self, displayio_group_t *root_group) {
bool ok = displayio_display_core_set_root_group(&self->core, root_group);
if (!ok) {
mp_raise_ValueError(translate("Group already used"));
}
return mp_const_none;
}
void displayio_display_background(displayio_display_obj_t *self) {
if (self->auto_refresh && (supervisor_ticks_ms64() - self->core.last_refresh) > self->native_ms_per_frame) {
_refresh_display(self);

View File

@ -103,7 +103,7 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t
}
bool common_hal_displayio_epaperdisplay_show(displayio_epaperdisplay_obj_t *self, displayio_group_t *root_group) {
return displayio_display_core_show(&self->core, root_group);
return displayio_display_core_set_root_group(&self->core, root_group);
}
STATIC const displayio_area_t *displayio_epaperdisplay_get_refresh_areas(displayio_epaperdisplay_obj_t *self) {

View File

@ -162,7 +162,7 @@ void displayio_display_core_set_rotation(displayio_display_core_t *self,
}
}
bool displayio_display_core_show(displayio_display_core_t *self, displayio_group_t *root_group) {
bool displayio_display_core_set_root_group(displayio_display_core_t *self, displayio_group_t *root_group) {
if (root_group == NULL) { // set the display to the REPL, reset REPL position and size
circuitpython_splash.in_group = false;

View File

@ -61,7 +61,7 @@ void displayio_display_core_construct(displayio_display_core_t *self,
mp_obj_t bus, 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 color_depth, bool grayscale, bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte, bool reverse_bytes_in_word);
bool displayio_display_core_show(displayio_display_core_t *self, displayio_group_t *root_group);
bool displayio_display_core_set_root_group(displayio_display_core_t *self, displayio_group_t *root_group);
uint16_t displayio_display_core_get_width(displayio_display_core_t *self);
uint16_t displayio_display_core_get_height(displayio_display_core_t *self);

View File

@ -102,7 +102,7 @@ void common_hal_framebufferio_framebufferdisplay_construct(framebufferio_framebu
}
bool common_hal_framebufferio_framebufferdisplay_show(framebufferio_framebufferdisplay_obj_t *self, displayio_group_t *root_group) {
return displayio_display_core_show(&self->core, root_group);
return displayio_display_core_set_root_group(&self->core, root_group);
}
uint16_t common_hal_framebufferio_framebufferdisplay_get_width(framebufferio_framebufferdisplay_obj_t *self) {