Merge pull request #7215 from FoamyGuy/set_root_group
displayio.show() API change
This commit is contained in:
commit
9e104c04ae
@ -423,8 +423,21 @@ STATIC mp_obj_t displayio_display_obj_get_root_group(mp_obj_t self_in) {
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_root_group_obj, displayio_display_obj_get_root_group);
|
MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_root_group_obj, displayio_display_obj_get_root_group);
|
||||||
|
|
||||||
MP_PROPERTY_GETTER(displayio_display_root_group_obj,
|
STATIC mp_obj_t displayio_display_obj_set_root_group(mp_obj_t self_in, mp_obj_t group_in) {
|
||||||
(mp_obj_t)&displayio_display_get_root_group_obj);
|
displayio_display_obj_t *self = native_display(self_in);
|
||||||
|
displayio_group_t *group = NULL;
|
||||||
|
if (group_in != mp_const_none) {
|
||||||
|
group = MP_OBJ_TO_PTR(native_group(group_in));
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
MP_PROPERTY_GETSET(displayio_display_root_group_obj,
|
||||||
|
(mp_obj_t)&displayio_display_get_root_group_obj,
|
||||||
|
(mp_obj_t)&displayio_display_set_root_group_obj);
|
||||||
|
|
||||||
|
|
||||||
//| def fill_row(self, y: int, buffer: WriteableBuffer) -> WriteableBuffer:
|
//| def fill_row(self, y: int, buffer: WriteableBuffer) -> WriteableBuffer:
|
||||||
|
@ -67,5 +67,6 @@ bool common_hal_displayio_display_set_brightness(displayio_display_obj_t *self,
|
|||||||
|
|
||||||
mp_obj_t common_hal_displayio_display_get_bus(displayio_display_obj_t *self);
|
mp_obj_t common_hal_displayio_display_get_bus(displayio_display_obj_t *self);
|
||||||
mp_obj_t common_hal_displayio_display_get_root_group(displayio_display_obj_t *self);
|
mp_obj_t common_hal_displayio_display_get_root_group(displayio_display_obj_t *self);
|
||||||
|
mp_obj_t common_hal_displayio_display_set_root_group(displayio_display_obj_t *self, displayio_group_t *root_group);
|
||||||
|
|
||||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_DISPLAY_H
|
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_DISPLAY_H
|
||||||
|
@ -349,6 +349,30 @@ MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_get_bus_obj, displayio_epaperd
|
|||||||
MP_PROPERTY_GETTER(displayio_epaperdisplay_bus_obj,
|
MP_PROPERTY_GETTER(displayio_epaperdisplay_bus_obj,
|
||||||
(mp_obj_t)&displayio_epaperdisplay_get_bus_obj);
|
(mp_obj_t)&displayio_epaperdisplay_get_bus_obj);
|
||||||
|
|
||||||
|
//| root_group: Group
|
||||||
|
//| """The root group on the epaper display."""
|
||||||
|
//|
|
||||||
|
STATIC mp_obj_t displayio_epaperdisplay_obj_get_root_group(mp_obj_t self_in) {
|
||||||
|
displayio_epaperdisplay_obj_t *self = native_display(self_in);
|
||||||
|
return common_hal_displayio_epaperdisplay_get_root_group(self);
|
||||||
|
}
|
||||||
|
MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_get_root_group_obj, displayio_epaperdisplay_obj_get_root_group);
|
||||||
|
|
||||||
|
STATIC mp_obj_t displayio_epaperdisplay_obj_set_root_group(mp_obj_t self_in, mp_obj_t group_in) {
|
||||||
|
displayio_epaperdisplay_obj_t *self = native_display(self_in);
|
||||||
|
displayio_group_t *group = NULL;
|
||||||
|
if (group_in != mp_const_none) {
|
||||||
|
group = MP_OBJ_TO_PTR(native_group(group_in));
|
||||||
|
}
|
||||||
|
|
||||||
|
common_hal_displayio_epaperdisplay_set_root_group(self, group);
|
||||||
|
return mp_const_none;
|
||||||
|
}
|
||||||
|
MP_DEFINE_CONST_FUN_OBJ_2(displayio_epaperdisplay_set_root_group_obj, displayio_epaperdisplay_obj_set_root_group);
|
||||||
|
|
||||||
|
MP_PROPERTY_GETSET(displayio_epaperdisplay_root_group_obj,
|
||||||
|
(mp_obj_t)&displayio_epaperdisplay_get_root_group_obj,
|
||||||
|
(mp_obj_t)&displayio_epaperdisplay_set_root_group_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) },
|
||||||
@ -361,6 +385,7 @@ STATIC const mp_rom_map_elem_t displayio_epaperdisplay_locals_dict_table[] = {
|
|||||||
{ MP_ROM_QSTR(MP_QSTR_bus), MP_ROM_PTR(&displayio_epaperdisplay_bus_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_bus), MP_ROM_PTR(&displayio_epaperdisplay_bus_obj) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_busy), MP_ROM_PTR(&displayio_epaperdisplay_busy_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_busy), MP_ROM_PTR(&displayio_epaperdisplay_busy_obj) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_time_to_refresh), MP_ROM_PTR(&displayio_epaperdisplay_time_to_refresh_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_time_to_refresh), MP_ROM_PTR(&displayio_epaperdisplay_time_to_refresh_obj) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_root_group), MP_ROM_PTR(&displayio_epaperdisplay_root_group_obj) },
|
||||||
};
|
};
|
||||||
STATIC MP_DEFINE_CONST_DICT(displayio_epaperdisplay_locals_dict, displayio_epaperdisplay_locals_dict_table);
|
STATIC MP_DEFINE_CONST_DICT(displayio_epaperdisplay_locals_dict, displayio_epaperdisplay_locals_dict_table);
|
||||||
|
|
||||||
|
@ -48,6 +48,9 @@ bool common_hal_displayio_epaperdisplay_refresh(displayio_epaperdisplay_obj_t *s
|
|||||||
|
|
||||||
bool common_hal_displayio_epaperdisplay_show(displayio_epaperdisplay_obj_t *self, displayio_group_t *root_group);
|
bool common_hal_displayio_epaperdisplay_show(displayio_epaperdisplay_obj_t *self, displayio_group_t *root_group);
|
||||||
|
|
||||||
|
mp_obj_t common_hal_displayio_epaperdisplay_get_root_group(displayio_epaperdisplay_obj_t *self);
|
||||||
|
bool common_hal_displayio_epaperdisplay_set_root_group(displayio_epaperdisplay_obj_t *self, displayio_group_t *root_group);
|
||||||
|
|
||||||
// Returns time in milliseconds.
|
// Returns time in milliseconds.
|
||||||
uint32_t common_hal_displayio_epaperdisplay_get_time_to_refresh(displayio_epaperdisplay_obj_t *self);
|
uint32_t common_hal_displayio_epaperdisplay_get_time_to_refresh(displayio_epaperdisplay_obj_t *self);
|
||||||
bool common_hal_displayio_epaperdisplay_get_busy(displayio_epaperdisplay_obj_t *self);
|
bool common_hal_displayio_epaperdisplay_get_busy(displayio_epaperdisplay_obj_t *self);
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "shared-bindings/displayio/Shape.h"
|
#include "shared-bindings/displayio/Shape.h"
|
||||||
#include "shared-bindings/displayio/TileGrid.h"
|
#include "shared-bindings/displayio/TileGrid.h"
|
||||||
|
#include "shared-module/displayio/__init__.h"
|
||||||
|
|
||||||
//| """Native helpers for driving displays
|
//| """Native helpers for driving displays
|
||||||
//|
|
//|
|
||||||
@ -95,6 +96,7 @@ STATIC const mp_rom_map_elem_t displayio_module_globals_table[] = {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
{ MP_ROM_QSTR(MP_QSTR_release_displays), MP_ROM_PTR(&displayio_release_displays_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_release_displays), MP_ROM_PTR(&displayio_release_displays_obj) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_CIRCUITPYTHON_TERMINAL), MP_ROM_PTR(&circuitpython_splash) },
|
||||||
};
|
};
|
||||||
STATIC MP_DEFINE_CONST_DICT(displayio_module_globals, displayio_module_globals_table);
|
STATIC MP_DEFINE_CONST_DICT(displayio_module_globals, displayio_module_globals_table);
|
||||||
|
|
||||||
|
@ -328,8 +328,24 @@ STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_root_group(mp_obj_t sel
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(framebufferio_framebufferdisplay_get_root_group_obj, framebufferio_framebufferdisplay_obj_get_root_group);
|
MP_DEFINE_CONST_FUN_OBJ_1(framebufferio_framebufferdisplay_get_root_group_obj, framebufferio_framebufferdisplay_obj_get_root_group);
|
||||||
|
|
||||||
MP_PROPERTY_GETTER(framebufferio_framebufferdisplay_root_group_obj,
|
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_set_root_group(mp_obj_t self_in, mp_obj_t group_in) {
|
||||||
(mp_obj_t)&framebufferio_framebufferdisplay_get_root_group_obj);
|
framebufferio_framebufferdisplay_obj_t *self = native_display(self_in);
|
||||||
|
displayio_group_t *group = NULL;
|
||||||
|
if (group_in != mp_const_none) {
|
||||||
|
group = MP_OBJ_TO_PTR(native_group(group_in));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ok = common_hal_framebufferio_framebufferdisplay_set_root_group(self, group);
|
||||||
|
if (!ok) {
|
||||||
|
mp_raise_ValueError(translate("Group already used"));
|
||||||
|
}
|
||||||
|
return mp_const_none;
|
||||||
|
}
|
||||||
|
MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_set_root_group_obj, framebufferio_framebufferdisplay_obj_set_root_group);
|
||||||
|
|
||||||
|
MP_PROPERTY_GETSET(framebufferio_framebufferdisplay_root_group_obj,
|
||||||
|
(mp_obj_t)&framebufferio_framebufferdisplay_get_root_group_obj,
|
||||||
|
(mp_obj_t)&framebufferio_framebufferdisplay_set_root_group_obj);
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t framebufferio_framebufferdisplay_locals_dict_table[] = {
|
STATIC const mp_rom_map_elem_t framebufferio_framebufferdisplay_locals_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&framebufferio_framebufferdisplay_show_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&framebufferio_framebufferdisplay_show_obj) },
|
||||||
|
@ -61,5 +61,6 @@ bool common_hal_framebufferio_framebufferdisplay_set_brightness(framebufferio_fr
|
|||||||
mp_obj_t common_hal_framebufferio_framebufferdisplay_framebuffer(framebufferio_framebufferdisplay_obj_t *self);
|
mp_obj_t common_hal_framebufferio_framebufferdisplay_framebuffer(framebufferio_framebufferdisplay_obj_t *self);
|
||||||
|
|
||||||
mp_obj_t common_hal_framebufferio_framebufferdisplay_get_root_group(framebufferio_framebufferdisplay_obj_t *self);
|
mp_obj_t common_hal_framebufferio_framebufferdisplay_get_root_group(framebufferio_framebufferdisplay_obj_t *self);
|
||||||
|
mp_obj_t common_hal_framebufferio_framebufferdisplay_set_root_group(framebufferio_framebufferdisplay_obj_t *self, displayio_group_t *root_group);
|
||||||
|
|
||||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_FRAMEBUFFERDISPLAY_H
|
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_FRAMEBUFFERDISPLAY_H
|
||||||
|
@ -136,12 +136,15 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self,
|
|||||||
|
|
||||||
// Set the group after initialization otherwise we may send pixels while we delay in
|
// Set the group after initialization otherwise we may send pixels while we delay in
|
||||||
// initialization.
|
// initialization.
|
||||||
common_hal_displayio_display_show(self, &circuitpython_splash);
|
common_hal_displayio_display_set_root_group(self, &circuitpython_splash);
|
||||||
common_hal_displayio_display_set_auto_refresh(self, auto_refresh);
|
common_hal_displayio_display_set_auto_refresh(self, auto_refresh);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool common_hal_displayio_display_show(displayio_display_obj_t *self, displayio_group_t *root_group) {
|
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);
|
if (root_group == NULL) {
|
||||||
|
root_group = &circuitpython_splash;
|
||||||
|
}
|
||||||
|
return displayio_display_core_set_root_group(&self->core, root_group);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t common_hal_displayio_display_get_width(displayio_display_obj_t *self) {
|
uint16_t common_hal_displayio_display_get_width(displayio_display_obj_t *self) {
|
||||||
@ -206,6 +209,9 @@ mp_obj_t common_hal_displayio_display_get_bus(displayio_display_obj_t *self) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mp_obj_t common_hal_displayio_display_get_root_group(displayio_display_obj_t *self) {
|
mp_obj_t common_hal_displayio_display_get_root_group(displayio_display_obj_t *self) {
|
||||||
|
if (self->core.current_group == NULL) {
|
||||||
|
return mp_const_none;
|
||||||
|
}
|
||||||
return self->core.current_group;
|
return self->core.current_group;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,6 +404,14 @@ void common_hal_displayio_display_set_auto_refresh(displayio_display_obj_t *self
|
|||||||
self->auto_refresh = auto_refresh;
|
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) {
|
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) {
|
if (self->auto_refresh && (supervisor_ticks_ms64() - self->core.last_refresh) > self->native_ms_per_frame) {
|
||||||
_refresh_display(self);
|
_refresh_display(self);
|
||||||
@ -421,7 +435,10 @@ void release_display(displayio_display_obj_t *self) {
|
|||||||
|
|
||||||
void reset_display(displayio_display_obj_t *self) {
|
void reset_display(displayio_display_obj_t *self) {
|
||||||
common_hal_displayio_display_set_auto_refresh(self, true);
|
common_hal_displayio_display_set_auto_refresh(self, true);
|
||||||
common_hal_displayio_display_show(self, NULL);
|
circuitpython_splash.x = 0; // reset position in case someone moved it.
|
||||||
|
circuitpython_splash.y = 0;
|
||||||
|
supervisor_start_terminal(self->core.width, self->core.height);
|
||||||
|
common_hal_displayio_display_set_root_group(self, &circuitpython_splash);
|
||||||
}
|
}
|
||||||
|
|
||||||
void displayio_display_collect_ptrs(displayio_display_obj_t *self) {
|
void displayio_display_collect_ptrs(displayio_display_obj_t *self) {
|
||||||
|
@ -64,7 +64,6 @@ typedef struct {
|
|||||||
void displayio_display_background(displayio_display_obj_t *self);
|
void displayio_display_background(displayio_display_obj_t *self);
|
||||||
void release_display(displayio_display_obj_t *self);
|
void release_display(displayio_display_obj_t *self);
|
||||||
void reset_display(displayio_display_obj_t *self);
|
void reset_display(displayio_display_obj_t *self);
|
||||||
|
|
||||||
void displayio_display_collect_ptrs(displayio_display_obj_t *self);
|
void displayio_display_collect_ptrs(displayio_display_obj_t *self);
|
||||||
|
|
||||||
#endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_DISPLAY_H
|
#endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_DISPLAY_H
|
||||||
|
@ -103,7 +103,14 @@ 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) {
|
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);
|
if (root_group == NULL) {
|
||||||
|
root_group = &circuitpython_splash;
|
||||||
|
}
|
||||||
|
return displayio_display_core_set_root_group(&self->core, root_group);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool common_hal_displayio_epaperdisplay_set_root_group(displayio_epaperdisplay_obj_t *self, displayio_group_t *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) {
|
STATIC const displayio_area_t *displayio_epaperdisplay_get_refresh_areas(displayio_epaperdisplay_obj_t *self) {
|
||||||
@ -239,6 +246,12 @@ uint16_t common_hal_displayio_epaperdisplay_get_rotation(displayio_epaperdisplay
|
|||||||
return self->core.rotation;
|
return self->core.rotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mp_obj_t common_hal_displayio_epaperdisplay_get_root_group(displayio_epaperdisplay_obj_t *self) {
|
||||||
|
if (self->core.current_group == NULL) {
|
||||||
|
return mp_const_none;
|
||||||
|
}
|
||||||
|
return self->core.current_group;
|
||||||
|
}
|
||||||
|
|
||||||
STATIC bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t *self, const displayio_area_t *area) {
|
STATIC bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t *self, const displayio_area_t *area) {
|
||||||
uint16_t buffer_size = 128; // In uint32_ts
|
uint16_t buffer_size = 128; // In uint32_ts
|
||||||
|
@ -162,17 +162,10 @@ 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
|
if (root_group == NULL) {
|
||||||
circuitpython_splash.in_group = false;
|
// Show nothing on the display
|
||||||
// force the circuit_python_splash out of any group (Note: could cause problems with the parent group)
|
|
||||||
circuitpython_splash.x = 0; // reset position in case someone moved it.
|
|
||||||
circuitpython_splash.y = 0;
|
|
||||||
|
|
||||||
supervisor_start_terminal(self->width, self->height);
|
|
||||||
|
|
||||||
root_group = &circuitpython_splash;
|
|
||||||
}
|
}
|
||||||
if (root_group == self->current_group) {
|
if (root_group == self->current_group) {
|
||||||
return true;
|
return true;
|
||||||
@ -366,7 +359,10 @@ void displayio_display_core_collect_ptrs(displayio_display_core_t *self) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool displayio_display_core_fill_area(displayio_display_core_t *self, displayio_area_t *area, uint32_t *mask, uint32_t *buffer) {
|
bool displayio_display_core_fill_area(displayio_display_core_t *self, displayio_area_t *area, uint32_t *mask, uint32_t *buffer) {
|
||||||
return displayio_group_fill_area(self->current_group, &self->colorspace, area, mask, buffer);
|
if (self->current_group != NULL) {
|
||||||
|
return displayio_group_fill_area(self->current_group,&self->colorspace, area, mask, buffer);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool displayio_display_core_clip_area(displayio_display_core_t *self, const displayio_area_t *area, displayio_area_t *clipped) {
|
bool displayio_display_core_clip_area(displayio_display_core_t *self, const displayio_area_t *area, displayio_area_t *clipped) {
|
||||||
|
@ -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,
|
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);
|
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_width(displayio_display_core_t *self);
|
||||||
uint16_t displayio_display_core_get_height(displayio_display_core_t *self);
|
uint16_t displayio_display_core_get_height(displayio_display_core_t *self);
|
||||||
|
@ -102,7 +102,10 @@ void common_hal_framebufferio_framebufferdisplay_construct(framebufferio_framebu
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool common_hal_framebufferio_framebufferdisplay_show(framebufferio_framebufferdisplay_obj_t *self, displayio_group_t *root_group) {
|
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);
|
if (root_group == NULL) {
|
||||||
|
root_group = &circuitpython_splash;
|
||||||
|
}
|
||||||
|
return displayio_display_core_set_root_group(&self->core, root_group);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t common_hal_framebufferio_framebufferdisplay_get_width(framebufferio_framebufferdisplay_obj_t *self) {
|
uint16_t common_hal_framebufferio_framebufferdisplay_get_width(framebufferio_framebufferdisplay_obj_t *self) {
|
||||||
@ -360,5 +363,16 @@ void framebufferio_framebufferdisplay_reset(framebufferio_framebufferdisplay_obj
|
|||||||
}
|
}
|
||||||
|
|
||||||
mp_obj_t common_hal_framebufferio_framebufferdisplay_get_root_group(framebufferio_framebufferdisplay_obj_t *self) {
|
mp_obj_t common_hal_framebufferio_framebufferdisplay_get_root_group(framebufferio_framebufferdisplay_obj_t *self) {
|
||||||
|
if (self->core.current_group == NULL) {
|
||||||
|
return mp_const_none;
|
||||||
|
}
|
||||||
return self->core.current_group;
|
return self->core.current_group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mp_obj_t common_hal_framebufferio_framebufferdisplay_set_root_group(framebufferio_framebufferdisplay_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;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user