ESPHome
2024.12.2
|
Component for rendering LVGL. More...
#include <lvgl_esphome.h>
Public Member Functions | |
LvglComponent (std::vector< display::Display *> displays, float buffer_frac, bool full_refresh, int draw_rounding, bool resume_on_input) | |
float | get_setup_priority () const override |
void | setup () override |
void | update () override |
void | loop () override |
void | add_on_idle_callback (std::function< void(uint32_t)> &&callback) |
void | add_on_pause_callback (std::function< void(bool)> &&callback) |
void | dump_config () override |
bool | is_idle (uint32_t idle_ms) |
lv_disp_t * | get_disp () |
lv_obj_t * | get_scr_act () |
void | set_paused (bool paused, bool show_snow) |
bool | is_paused () const |
void | maybe_wakeup () |
void | add_page (LvPageType *page) |
void | show_page (size_t index, lv_scr_load_anim_t anim, uint32_t time) |
void | show_next_page (lv_scr_load_anim_t anim, uint32_t time) |
void | show_prev_page (lv_scr_load_anim_t anim, uint32_t time) |
void | set_page_wrap (bool wrap) |
void | set_focus_mark (lv_group_t *group) |
void | restore_focus_mark (lv_group_t *group) |
Public Member Functions inherited from esphome::PollingComponent | |
PollingComponent () | |
PollingComponent (uint32_t update_interval) | |
Initialize this polling component with the given update interval in ms. More... | |
virtual void | set_update_interval (uint32_t update_interval) |
Manually set the update interval in ms for this polling object. More... | |
void | call_setup () override |
virtual uint32_t | get_update_interval () const |
Get the update interval in ms of this sensor. More... | |
void | start_poller () |
void | stop_poller () |
Public Member Functions inherited from esphome::Component | |
float | get_actual_setup_priority () const |
void | set_setup_priority (float priority) |
virtual float | get_loop_priority () const |
priority of loop(). More... | |
void | call () |
virtual void | on_shutdown () |
virtual void | on_safe_shutdown () |
uint32_t | get_component_state () const |
virtual void | mark_failed () |
Mark this component as failed. More... | |
bool | is_failed () const |
bool | is_ready () const |
virtual bool | can_proceed () |
bool | status_has_warning () const |
bool | status_has_error () const |
void | status_set_warning (const char *message="unspecified") |
void | status_set_error (const char *message="unspecified") |
void | status_clear_warning () |
void | status_clear_error () |
void | status_momentary_warning (const std::string &name, uint32_t length=5000) |
void | status_momentary_error (const std::string &name, uint32_t length=5000) |
bool | has_overridden_loop () const |
void | set_component_source (const char *source) |
Set where this component was loaded from for some debug messages. More... | |
const char * | get_component_source () const |
Get the integration where this component was declared as a string. More... | |
Static Public Member Functions | |
static void | static_flush_cb (lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p) |
static void | esphome_lvgl_init () |
Initialize the LVGL library and register custom events. More... | |
static void | add_event_cb (lv_obj_t *obj, event_callback_t callback, lv_event_code_t event) |
static void | add_event_cb (lv_obj_t *obj, event_callback_t callback, lv_event_code_t event1, lv_event_code_t event2) |
static void | add_event_cb (lv_obj_t *obj, event_callback_t callback, lv_event_code_t event1, lv_event_code_t event2, lv_event_code_t event3) |
Data Fields | |
size_t | draw_rounding {2} |
display::DisplayRotation | rotation {display::DISPLAY_ROTATION_0_DEGREES} |
Protected Member Functions | |
void | write_random_ () |
void | draw_buffer_ (const lv_area_t *area, lv_color_t *ptr) |
void | flush_cb_ (lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p) |
Protected Member Functions inherited from esphome::Component | |
virtual void | call_loop () |
virtual void | call_dump_config () |
void | set_interval (const std::string &name, uint32_t interval, std::function< void()> &&f) |
Set an interval function with a unique name. More... | |
void | set_interval (uint32_t interval, std::function< void()> &&f) |
bool | cancel_interval (const std::string &name) |
Cancel an interval function. More... | |
void | set_retry (const std::string &name, uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> &&f, float backoff_increase_factor=1.0f) |
Set an retry function with a unique name. More... | |
void | set_retry (uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> &&f, float backoff_increase_factor=1.0f) |
bool | cancel_retry (const std::string &name) |
Cancel a retry function. More... | |
void | set_timeout (const std::string &name, uint32_t timeout, std::function< void()> &&f) |
Set a timeout function with a unique name. More... | |
void | set_timeout (uint32_t timeout, std::function< void()> &&f) |
bool | cancel_timeout (const std::string &name) |
Cancel a timeout function. More... | |
void | defer (const std::string &name, std::function< void()> &&f) |
Defer a callback to the next loop() call. More... | |
void | defer (std::function< void()> &&f) |
Defer a callback to the next loop() call. More... | |
bool | cancel_defer (const std::string &name) |
Cancel a defer callback using the specified name, name must not be empty. More... | |
Protected Attributes | |
std::vector< display::Display * > | displays_ {} |
size_t | buffer_frac_ {1} |
bool | full_refresh_ {} |
bool | resume_on_input_ {} |
lv_disp_draw_buf_t | draw_buf_ {} |
lv_disp_drv_t | disp_drv_ {} |
lv_disp_t * | disp_ {} |
bool | paused_ {} |
std::vector< LvPageType * > | pages_ {} |
size_t | current_page_ {0} |
bool | show_snow_ {} |
bool | page_wrap_ {true} |
std::map< lv_group_t *, lv_obj_t * > | focus_marks_ {} |
CallbackManager< void(uint32_t)> | idle_callbacks_ {} |
CallbackManager< void(bool)> | pause_callbacks_ {} |
lv_color_t * | rotate_buf_ {} |
Protected Attributes inherited from esphome::PollingComponent | |
uint32_t | update_interval_ |
Protected Attributes inherited from esphome::Component | |
uint32_t | component_state_ {0x0000} |
State of this component. More... | |
float | setup_priority_override_ {NAN} |
const char * | component_source_ {nullptr} |
Component for rendering LVGL.
This component renders LVGL widgets on a display. Some initialisation must be done in the constructor since LVGL needs to be initialised before any widgets can be created.
displays | a list of displays to render onto. All displays must have the same resolution. |
buffer_frac | the fraction of the display resolution to use for the LVGL draw buffer. A higher value will make animations smoother but also increase memory usage. |
full_refresh | if true, the display will be fully refreshed on every frame. If false, only changed areas will be updated. |
draw_rounding | the rounding to use when drawing. A value of 1 will draw without any rounding, a value of 2 will round to the nearest multiple of 2, and so on. |
resume_on_input | if true, this component will resume rendering when the user presses a key or clicks on the screen. |
Definition at line 136 of file lvgl_esphome.h.
esphome::lvgl::LvglComponent::LvglComponent | ( | std::vector< display::Display *> | displays, |
float | buffer_frac, | ||
bool | full_refresh, | ||
int | draw_rounding, | ||
bool | resume_on_input | ||
) |
Definition at line 409 of file lvgl_esphome.cpp.
|
static |
Definition at line 106 of file lvgl_esphome.cpp.
|
static |
Definition at line 109 of file lvgl_esphome.cpp.
|
static |
Definition at line 114 of file lvgl_esphome.cpp.
|
inline |
Definition at line 148 of file lvgl_esphome.h.
|
inline |
Definition at line 151 of file lvgl_esphome.h.
void esphome::lvgl::LvglComponent::add_page | ( | LvPageType * | page | ) |
Definition at line 120 of file lvgl_esphome.cpp.
|
protected |
Definition at line 146 of file lvgl_esphome.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 85 of file lvgl_esphome.cpp.
|
static |
Initialize the LVGL library and register custom events.
Definition at line 101 of file lvgl_esphome.cpp.
|
protected |
Definition at line 198 of file lvgl_esphome.cpp.
|
inline |
Definition at line 154 of file lvgl_esphome.h.
|
inline |
Definition at line 155 of file lvgl_esphome.h.
|
inlineoverridevirtual |
Reimplemented from esphome::Component.
Definition at line 144 of file lvgl_esphome.h.
|
inline |
Definition at line 153 of file lvgl_esphome.h.
|
inline |
Definition at line 160 of file lvgl_esphome.h.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 472 of file lvgl_esphome.cpp.
|
inline |
Definition at line 162 of file lvgl_esphome.h.
|
inline |
Definition at line 182 of file lvgl_esphome.h.
|
inline |
Definition at line 181 of file lvgl_esphome.h.
|
inline |
Definition at line 180 of file lvgl_esphome.h.
void esphome::lvgl::LvglComponent::set_paused | ( | bool | paused, |
bool | show_snow | ||
) |
Definition at line 91 of file lvgl_esphome.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 440 of file lvgl_esphome.cpp.
void esphome::lvgl::LvglComponent::show_next_page | ( | lv_scr_load_anim_t | anim, |
uint32_t | time | ||
) |
Definition at line 130 of file lvgl_esphome.cpp.
void esphome::lvgl::LvglComponent::show_page | ( | size_t | index, |
lv_scr_load_anim_t | anim, | ||
uint32_t | time | ||
) |
Definition at line 124 of file lvgl_esphome.cpp.
void esphome::lvgl::LvglComponent::show_prev_page | ( | lv_scr_load_anim_t | anim, |
uint32_t | time | ||
) |
Definition at line 138 of file lvgl_esphome.cpp.
|
static |
Definition at line 489 of file lvgl_esphome.cpp.
|
overridevirtual |
Implements esphome::PollingComponent.
Definition at line 465 of file lvgl_esphome.cpp.
|
protected |
Definition at line 361 of file lvgl_esphome.cpp.
|
protected |
Definition at line 199 of file lvgl_esphome.h.
|
protected |
Definition at line 208 of file lvgl_esphome.h.
|
protected |
Definition at line 205 of file lvgl_esphome.h.
|
protected |
Definition at line 204 of file lvgl_esphome.h.
|
protected |
Definition at line 198 of file lvgl_esphome.h.
|
protected |
Definition at line 203 of file lvgl_esphome.h.
size_t esphome::lvgl::LvglComponent::draw_rounding {2} |
Definition at line 189 of file lvgl_esphome.h.
|
protected |
Definition at line 211 of file lvgl_esphome.h.
|
protected |
Definition at line 200 of file lvgl_esphome.h.
|
protected |
Definition at line 213 of file lvgl_esphome.h.
|
protected |
Definition at line 210 of file lvgl_esphome.h.
|
protected |
Definition at line 207 of file lvgl_esphome.h.
|
protected |
Definition at line 214 of file lvgl_esphome.h.
|
protected |
Definition at line 206 of file lvgl_esphome.h.
|
protected |
Definition at line 201 of file lvgl_esphome.h.
|
protected |
Definition at line 215 of file lvgl_esphome.h.
display::DisplayRotation esphome::lvgl::LvglComponent::rotation {display::DISPLAY_ROTATION_0_DEGREES} |
Definition at line 191 of file lvgl_esphome.h.
|
protected |
Definition at line 209 of file lvgl_esphome.h.