summaryrefslogtreecommitdiff
path: root/shared-bindings
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2020-11-11 16:53:45 -0800
committerScott Shawcroft <scott@tannewt.org>2020-11-13 18:57:52 -0800
commit78ccac930fbcb3dddd3a1a79809a2ec371d34c6a (patch)
tree4e03a06e71d2b83c62bab3d926bae2aef9f16bce /shared-bindings
parent8d4296f96430795936a22769da35732e5342b25c (diff)
Add .busy property to EPaperDisplay
Diffstat (limited to 'shared-bindings')
-rw-r--r--shared-bindings/displayio/EPaperDisplay.c18
-rw-r--r--shared-bindings/displayio/EPaperDisplay.h1
2 files changed, 19 insertions, 0 deletions
diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c
index 8518e3714..ebff64008 100644
--- a/shared-bindings/displayio/EPaperDisplay.c
+++ b/shared-bindings/displayio/EPaperDisplay.c
@@ -245,6 +245,23 @@ const mp_obj_property_t displayio_epaperdisplay_time_to_refresh_obj = {
(mp_obj_t)&mp_const_none_obj},
};
+//| busy: bool
+//| """True when the display is refreshing. This uses the ``busy_pin`` when available or the
+//| ``refresh_time`` otherwise."""
+//|
+STATIC mp_obj_t displayio_epaperdisplay_obj_get_busy(mp_obj_t self_in) {
+ displayio_epaperdisplay_obj_t *self = native_display(self_in);
+ return mp_obj_new_bool(common_hal_displayio_epaperdisplay_get_busy(self));
+}
+MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_get_busy_obj, displayio_epaperdisplay_obj_get_busy);
+
+const mp_obj_property_t displayio_epaperdisplay_busy_obj = {
+ .base.type = &mp_type_property,
+ .proxy = {(mp_obj_t)&displayio_epaperdisplay_get_busy_obj,
+ (mp_obj_t)&mp_const_none_obj,
+ (mp_obj_t)&mp_const_none_obj},
+};
+
//| width: int
//| """Gets the width of the display in pixels"""
//|
@@ -301,6 +318,7 @@ STATIC const mp_rom_map_elem_t displayio_epaperdisplay_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_epaperdisplay_width_obj) },
{ MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_epaperdisplay_height_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_time_to_refresh), MP_ROM_PTR(&displayio_epaperdisplay_time_to_refresh_obj) },
};
STATIC MP_DEFINE_CONST_DICT(displayio_epaperdisplay_locals_dict, displayio_epaperdisplay_locals_dict_table);
diff --git a/shared-bindings/displayio/EPaperDisplay.h b/shared-bindings/displayio/EPaperDisplay.h
index 9a2d93bac..f785203a4 100644
--- a/shared-bindings/displayio/EPaperDisplay.h
+++ b/shared-bindings/displayio/EPaperDisplay.h
@@ -52,6 +52,7 @@ bool common_hal_displayio_epaperdisplay_show(displayio_epaperdisplay_obj_t* self
// Returns time in milliseconds.
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);
uint16_t common_hal_displayio_epaperdisplay_get_width(displayio_epaperdisplay_obj_t* self);
uint16_t common_hal_displayio_epaperdisplay_get_height(displayio_epaperdisplay_obj_t* self);