ESPHome 2026.10.0-dev
Loading...
Searching...
No Matches
lvgl_esphome.h
Go to the documentation of this file.
1#pragma once
3
4#ifdef USE_BINARY_SENSOR
6#endif // USE_BINARY_SENSOR
7#ifdef USE_IMAGE
9#endif // USE_IMAGE
10#ifdef USE_LVGL_ROTARY_ENCODER
12#endif // USE_LVGL_ROTARY_ENCODER
13
14// required for clang-tidy
15#ifndef LV_CONF_H
16#define LV_CONF_SKIP 1 // NOLINT
17#endif // LV_CONF_H
18
22
23#include <list>
24#include <lvgl.h>
25#include <map>
26#include <utility>
27#include <vector>
28
29#ifdef USE_ESP32_VARIANT_ESP32P4
30#include "driver/ppa.h"
31#endif
32
33#ifdef USE_FONT
35#endif // USE_FONT
36#ifdef USE_TOUCHSCREEN
38#endif // USE_TOUCHSCREEN
39
40#if defined(USE_LVGL_BUTTONMATRIX) || defined(USE_LVGL_KEYBOARD)
42#endif // USE_LVGL_BUTTONMATRIX
43
44namespace esphome::lvgl {
45
46#if LV_COLOR_DEPTH == 16
47using lv_color_data = uint16_t;
48#endif
49#if LV_COLOR_DEPTH == 32
51#endif
52
53extern lv_event_code_t lv_update_event; // NOLINT
54extern std::string lv_event_code_name_for(lv_event_t *event);
55
56lv_obj_t *lv_container_create(lv_obj_t *parent);
57#ifdef USE_LVGL_SCALE
58void lv_scale_draw_event_cb(lv_event_t *e, int16_t range_start, int16_t range_end, lv_color_t color_start,
59 lv_color_t color_end, int width, bool local);
60#endif
61#ifdef USE_LVGL_TABLE
64#endif
65#if LV_COLOR_DEPTH == 16
67#elif LV_COLOR_DEPTH == 32
69#else // LV_COLOR_DEPTH
71#endif // LV_COLOR_DEPTH
72
73#if defined(USE_FONT) && defined(USE_LVGL_FONT)
74inline void lv_obj_set_style_text_font(lv_obj_t *obj, const font::Font *font, lv_style_selector_t part) {
75 lv_obj_set_style_text_font(obj, font->get_lv_font(), part);
76}
77inline void lv_style_set_text_font(lv_style_t *style, const font::Font *font) {
78 lv_style_set_text_font(style, font->get_lv_font());
79}
80#endif
81
82#ifdef USE_IMAGE
83#ifdef USE_LVGL_IMAGE
84// Shortcut / overload, so that the source of an image widget can easily be updated from within a lambda.
85inline void lv_image_set_src(lv_obj_t *obj, image::Image *image) { ::lv_image_set_src(obj, image->get_lv_image_dsc()); }
86
87inline void lv_obj_set_style_bitmap_mask_src(lv_obj_t *obj, image::Image *image, lv_style_selector_t selector) {
89}
90
91inline void lv_obj_set_style_bg_image_src(lv_obj_t *obj, image::Image *image, lv_style_selector_t selector) {
93}
94inline void lv_style_set_bg_image_src(lv_style_t *style, image::Image *image) {
96}
97inline void lv_style_set_bitmap_mask_src(lv_style_t *style, image::Image *image) {
99}
100#endif
101
102#ifdef USE_LVGL_ANIMIMG
103inline void lv_animimg_set_src(lv_obj_t *img, std::vector<image::Image *> images) {
104 auto *dsc = static_cast<std::vector<lv_image_dsc_t *> *>(lv_obj_get_user_data(img));
105 if (dsc == nullptr) {
106 // object will be lazily allocated but never freed.
107 dsc = new std::vector<lv_image_dsc_t *>(images.size()); // NOLINT
108 lv_obj_set_user_data(img, dsc);
109 }
110 dsc->clear();
111 for (auto &image : images) {
112 dsc->push_back(image->get_lv_image_dsc());
113 }
114 lv_animimg_set_src(img, (const void **) dsc->data(), dsc->size());
115}
116#endif // USE_LVGL_ANIMIMG
117#endif // USE_IMAGE
118
119#ifdef USE_LVGL_METER
120int16_t lv_get_needle_angle_for_value(lv_obj_t *obj, int32_t value);
121#endif
122
123#ifdef USE_LVGL_LIST
124// Returns the index, within `list`, of the entry that contains `child`: `child` itself if it's a
125// direct child of `list`, or the ancestor of `child` that is, when `child` is nested inside a
126// widget hierarchy added via `lvgl.list.add`. Returns -1 if `child` isn't inside `list` at all.
127int lv_list_get_row_index(lv_obj_t *list, lv_obj_t *child);
128
129// Returns the entry at `index` within `list`, or nullptr (logging why) if `index` is out of
130// range -- shared by every `lvgl.list.remove` call site, since a templatable index can go out of
131// range at runtime in ways config validation can't catch (e.g. driven by a sensor value).
132lv_obj_t *lv_list_get_row_for_remove(lv_obj_t *list, int index);
133#endif
134
135#ifdef USE_LVGL_GRADIENT
143lv_color_t lv_grad_calculate_color(const lv_grad_dsc_t *dsc, int32_t pos);
144#endif // USE_LVGL_GRADIENT
145
146// Parent class for things that wrap an LVGL object
148 public:
149 virtual ~LvCompound() = default;
150 virtual void set_obj(lv_obj_t *lv_obj) { this->obj = lv_obj; }
151 lv_obj_t *obj{};
152};
153
154// Frees a heap-allocated LvCompound wrapper on LV_EVENT_DELETE, since lv_obj_del() only knows how to destroy LVGL's own
155// object tree, not a separate C++ object paired with one of its nodes.
156template<typename T> void delete_lv_compound_on_delete(lv_event_t *e) {
157 delete static_cast<T *>(lv_event_get_user_data(e));
158}
159
160class LvglComponent;
161
162class LvPageType : public Parented<LvglComponent> {
163 public:
165
166 void setup(size_t index) {
167 this->index = index;
168 this->obj = lv_obj_create(nullptr);
169 }
170
171 bool is_showing() const;
172
173 lv_obj_t *obj{};
174 size_t index{};
175 bool skip;
176};
177
178using event_callback_t = void(lv_event_t *);
179
180class LvLambdaComponent final : public Component {
181 public:
182 LvLambdaComponent(void (*callback)()) : callback_(callback) {}
183
184 void setup() override { this->callback_(); }
185 // execute after the LvglComponent is setup
186 float get_setup_priority() const override { return setup_priority::PROCESSOR - 5; }
187
188 protected:
189 void (*callback_)();
190};
191
192template<typename... Ts> class ObjUpdateAction final : public Action<Ts...> {
193 public:
194 explicit ObjUpdateAction(std::function<void(Ts...)> &&lamb) : lamb_(std::move(lamb)) {}
195
196 protected:
197 void play(const Ts &...x) override { this->lamb_(x...); }
198
199 std::function<void(Ts...)> lamb_;
200};
201#ifdef USE_LVGL_ANIMIMG
202void lv_animimg_stop(lv_obj_t *obj);
203#endif // USE_LVGL_ANIMIMG
209
210enum class Orientation : uint8_t {
211 UNKNOWN,
212 LANDSCAPE,
213 PORTRAIT,
214};
215
216class LvglComponent final : public PollingComponent {
217 constexpr static const char *const TAG = "lvgl";
218
219 public:
220 LvglComponent(std::vector<display::Display *> displays, float buffer_frac, bool full_refresh, int draw_rounding,
221 bool resume_on_input, bool update_when_display_idle, RotationType rotation_type);
222 static void static_flush_cb(lv_display_t *disp_drv, const lv_area_t *area, uint8_t *color_p);
228 static lv_point_t get_touch_relative_to_obj(lv_obj_t *obj);
229
230 float get_setup_priority() const override { return setup_priority::PROCESSOR; }
231 void setup() override;
232 void update() override;
233 void loop() override;
234 template<typename F> void add_on_idle_callback(F &&callback) { this->idle_callbacks_.add(std::forward<F>(callback)); }
235
236 static void render_end_cb(lv_event_t *event);
237 static void render_start_cb(lv_event_t *event);
238 void dump_config() override;
239 lv_display_t *get_disp() { return this->disp_; }
240 lv_obj_t *get_screen_active() { return lv_display_get_screen_active(this->disp_); }
241 // Pause or resume the display.
242 // @param paused If true, pause the display. If false, resume the display.
243 // @param show_snow If true, show the snow effect when paused.
244 void set_paused(bool paused, bool show_snow);
246 this->refr_timer_period_ = period;
247 if (this->refr_timer_ != nullptr)
248 lv_timer_set_period(this->refr_timer_, period);
249 }
250
251 // Returns true if the display has been explicitly paused via set_paused().
252 bool is_paused() const { return this->paused_; }
253 // If the display is paused and we have resume_on_input_ set to true, resume the display.
255 if (this->paused_ && this->resume_on_input_) {
256 this->set_paused(false, false);
257 }
258 }
259
263 static void esphome_lvgl_init();
264
265 // Convenience overloads for adding a callback for one or more events
266 static void add_event_cb(lv_obj_t *obj, event_callback_t callback, lv_event_code_t event, void *user_data = nullptr);
267 static void add_event_cb(lv_obj_t *obj, event_callback_t callback, lv_event_code_t event1, lv_event_code_t event2,
268 void *user_data = nullptr);
269 static void add_event_cb(lv_obj_t *obj, event_callback_t callback, lv_event_code_t event1, lv_event_code_t event2,
270 lv_event_code_t event3, void *user_data = nullptr);
271
272 // change the state of a widget and fire an event if changed (only needed for CHECKED)
273
274 static void lv_obj_set_state_value(lv_obj_t *obj, lv_state_t state, bool value) {
275 if (value != lv_obj_has_state(obj, state)) {
276 if (value) {
277 lv_obj_add_state(obj, state);
278 } else {
279 lv_obj_remove_state(obj, state);
280 }
281 if (state == LV_STATE_CHECKED)
282 lv_obj_send_event(obj, lv_update_event, nullptr);
283 }
284 }
285
286 // change the state of a buttonmatrix button and fire an event if changed (only needed for CHECKED)
287#ifdef USE_LVGL_BUTTONMATRIX
288 static void lv_buttonmatrix_set_button_ctrl_value(lv_obj_t *obj, uint32_t index, lv_buttonmatrix_ctrl_t ctrl,
289 bool value) {
290 if (value != lv_buttonmatrix_has_button_ctrl(obj, index, ctrl)) {
291 if (value) {
292 lv_buttonmatrix_set_button_ctrl(obj, index, ctrl);
293 } else {
294 lv_buttonmatrix_clear_button_ctrl(obj, index, ctrl);
295 }
296 if (ctrl == LV_BUTTONMATRIX_CTRL_CHECKED)
297 lv_obj_send_event(obj, lv_update_event, nullptr);
298 }
299 }
300#endif
301
302 void add_page(LvPageType *page);
303 void show_page(size_t index, lv_screen_load_anim_t anim, uint32_t time);
304 void show_next_page(lv_screen_load_anim_t anim, uint32_t time);
305 void show_prev_page(lv_screen_load_anim_t anim, uint32_t time);
306 void set_page_wrap(bool wrap) { this->page_wrap_ = wrap; }
307 void set_big_endian(bool big_endian) { this->big_endian_ = big_endian; }
308 size_t get_current_page() const;
309 void set_focus_mark(lv_group_t *group) { this->focus_marks_[group] = lv_group_get_focused(group); }
310 void restore_focus_mark(lv_group_t *group) {
311 auto *mark = this->focus_marks_[group];
312 if (mark != nullptr) {
313 lv_group_focus_obj(mark);
314 }
315 }
316 // rounding factor to align bounds of update area when drawing
317 size_t draw_rounding{2};
318
319 void set_pause_trigger(Trigger<> *trigger) { this->pause_callback_ = trigger; }
320 void set_resume_trigger(Trigger<> *trigger) { this->resume_callback_ = trigger; }
321 void set_draw_start_trigger(Trigger<> *trigger) { this->draw_start_callback_ = trigger; }
322 void set_draw_end_trigger(Trigger<> *trigger) { this->draw_end_callback_ = trigger; }
323 void set_landscape_trigger(Trigger<> *trigger) { this->landscape_callback_ = trigger; }
324 void set_portrait_trigger(Trigger<> *trigger) { this->portrait_callback_ = trigger; }
327 void set_rotation(int angle);
329 void rotate_coordinates(int32_t &x, int32_t &y) const;
330
331 uint16_t get_width() const { return lv_display_get_horizontal_resolution(this->disp_); }
332 uint16_t get_height() const { return lv_display_get_vertical_resolution(this->disp_); }
333
334 protected:
335 void set_resolution_() const;
336 // Determine the current orientation from the effective resolution and fire the
337 // landscape/portrait trigger if it has changed since the last check.
338 void update_orientation_();
339 void draw_end_();
340 // Not checking for non-null callback since the
341 // LVGL callback that calls it is not set in that case
342 void draw_start_() const { this->draw_start_callback_->trigger(); }
343 // Returns true if update_when_display_idle is enabled and at least one underlying display
344 // component is currently busy (e.g. mid-refresh).
345 bool displays_busy_() const;
346
347 void write_random_();
348 void draw_buffer_(const lv_area_t *area, lv_color_data *ptr);
349#ifdef USE_ESP32_VARIANT_ESP32P4
350 bool ppa_rotate_(const lv_color_data *src, lv_color_data *dst, uint16_t width, uint16_t height,
351 uint32_t height_rounded);
352#endif
353 void flush_cb_(lv_display_t *disp_drv, const lv_area_t *area, uint8_t *color_p);
354
355 std::vector<display::Display *> displays_{};
356 size_t buffer_frac_{1};
360
361 uint8_t *draw_buf_{};
362 lv_display_t *disp_{};
363 // The display's own periodic refresh timer, effectively paused while the display is busy (see
364 // displays_busy_()) so LVGL neither renders nor flushes to it, without losing track of
365 // invalidated areas. Other timers (indev reading, animations, ...) keep running as normal.
366 lv_timer_t *refr_timer_{};
367 // Tracks whether refr_timer_ is currently paused, so loop() can detect the busy -> idle edge
368 // and kick off an immediate refresh instead of waiting for the timer's next natural period.
371 uint16_t width_{};
372 uint16_t height_{};
373 bool paused_{};
374 std::vector<LvPageType *> pages_{};
375 size_t current_page_{0};
377 bool page_wrap_{true};
379 std::map<lv_group_t *, lv_obj_t *> focus_marks_{};
380
389 void *rotate_buf_{};
392#ifdef USE_ESP32_VARIANT_ESP32P4
393 ppa_client_handle_t ppa_client_{};
394#endif
395};
396
397class IdleTrigger final : public Trigger<> {
398 public:
399 explicit IdleTrigger(LvglComponent *parent, TemplatableFn<uint32_t> timeout);
400
401 protected:
403 bool is_idle_{};
404};
405
406template<typename... Ts> class LvglAction final : public Action<Ts...>, public Parented<LvglComponent> {
407 public:
408 explicit LvglAction(std::function<void(LvglComponent *)> &&lamb) : action_(std::move(lamb)) {}
409
410 protected:
411 void play(const Ts &...x) override { this->action_(this->parent_); }
412 std::function<void(LvglComponent *)> action_{};
413};
414
415template<typename Tc, typename... Ts> class LvglCondition final : public Condition<Ts...>, public Parented<Tc> {
416 public:
417 LvglCondition(std::function<bool(Tc *)> &&condition_lambda) : condition_lambda_(std::move(condition_lambda)) {}
418 bool check(const Ts &...x) override { return this->condition_lambda_(this->parent_); }
419
420 protected:
421 std::function<bool(Tc *)> condition_lambda_{};
422};
423
424#ifdef USE_LVGL_TOUCHSCREEN
425class LVTouchListener final : public touchscreen::TouchListener, public Parented<LvglComponent> {
426 public:
427 LVTouchListener(uint16_t long_press_time, uint16_t long_press_repeat_time, LvglComponent *parent);
428 void update(const touchscreen::TouchPoints_t &tpoints) override;
429 void release() override {
430 touch_pressed_ = false;
431 this->parent_->maybe_wakeup();
432 }
433 lv_indev_t *get_drv() { return this->drv_; }
434
435 protected:
436 lv_indev_t *drv_{};
439};
440#endif // USE_LVGL_TOUCHSCREEN
441
442#ifdef USE_LVGL_METER
443
444class IndicatorLine : public LvCompound {
445 public:
446 IndicatorLine() = default;
447
448 void set_obj(lv_obj_t *lv_obj) override;
449
450 void set_value(int value);
451
452 private:
453 void update_length_();
454
455 int16_t angle_{};
456 lv_point_precise_t points_[2]{};
457};
458#endif
459
460#ifdef USE_LVGL_KEY_LISTENER
461class LVEncoderListener final : public Parented<LvglComponent> {
462 public:
463 LVEncoderListener(lv_indev_type_t type, uint16_t long_press_time, uint16_t long_press_repeat_time);
464
465#ifdef USE_BINARY_SENSOR
466 void add_button(binary_sensor::BinarySensor *button, lv_key_t key) {
467 button->add_on_state_callback([this, key](bool state) { this->event(key, state); });
468 }
469#endif
470
471#ifdef USE_LVGL_ROTARY_ENCODER
473 sensor->register_listener([this](int32_t count) { this->set_count(count); });
474 }
475#endif // USE_LVGL_ROTARY_ENCODER
476
477 void event(int key, bool pressed) {
478 if (!this->parent_->is_paused()) {
479 this->pressed_ = pressed;
480 this->key_ = key;
481 } else if (!pressed) {
482 // maybe wakeup on release if paused
483 this->parent_->maybe_wakeup();
484 }
485 }
486
487 void set_count(int32_t count) {
488 if (!this->parent_->is_paused()) {
489 this->count_ = count;
490 } else {
491 this->parent_->maybe_wakeup();
492 }
493 }
494
495 lv_indev_t *get_drv() { return this->drv_; }
496
497 protected:
498 lv_indev_t *drv_{};
499 bool pressed_{};
500 int32_t count_{};
501 int32_t last_count_{};
502 int key_{};
503};
504#endif // USE_LVGL_KEY_LISTENER
505
506#ifdef USE_LVGL_LINE
507class LvLineType : public LvCompound {
508 public:
510 this->points_ = std::move(points);
511 lv_line_set_points(this->obj, this->points_.begin(), this->points_.size());
512 }
513
514 protected:
516};
517#endif
518#ifdef USE_LVGL_TABLE
519// Unlike most size properties, lv_table_set_column_width() only accepts a literal pixel
520// count, so percentage column widths must be recomputed by hand whenever the table's own
521// content width changes.
522class LvTableType : public LvCompound {
523 public:
524 void set_obj(lv_obj_t *lv_obj) override;
525 // count is the number of percentage-width columns, known at code-generation time.
526 void init_column_pct(size_t count) { this->column_pct_.init(count); }
527 void add_column_width_pct(uint32_t col, uint8_t pct);
528
529 protected:
531
532 struct ColumnPct {
534 uint8_t pct;
535 };
537};
538#endif // USE_LVGL_TABLE
539#if defined(USE_LVGL_DROPDOWN) || defined(LV_USE_ROLLER)
540class LvSelectable : public LvCompound {
541 public:
542 virtual size_t get_selected_index() = 0;
543 virtual void set_selected_index(size_t index, lv_anim_enable_t anim) = 0;
544 void set_selected_text(const std::string &text, lv_anim_enable_t anim);
545 std::string get_selected_text();
548
549 protected:
550 virtual void set_option_string(const char *options) = 0;
552};
553
554#ifdef USE_LVGL_DROPDOWN
556 public:
557 size_t get_selected_index() override { return lv_dropdown_get_selected(this->obj); }
558 void set_selected_index(size_t index, lv_anim_enable_t anim) override { lv_dropdown_set_selected(this->obj, index); }
559
560 protected:
561 void set_option_string(const char *options) override { lv_dropdown_set_options(this->obj, options); }
562};
563#endif // USE_LVGL_DROPDOWN
564
565#ifdef USE_LVGL_ROLLER
567 public:
568 size_t get_selected_index() override { return lv_roller_get_selected(this->obj); }
569 void set_selected_index(size_t index, lv_anim_enable_t anim) override {
570 lv_roller_set_selected(this->obj, index, anim);
571 }
572 void set_mode(lv_roller_mode_t mode) { this->mode_ = mode; }
573
574 protected:
575 void set_option_string(const char *options) override { lv_roller_set_options(this->obj, options, this->mode_); }
576 lv_roller_mode_t mode_{LV_ROLLER_MODE_NORMAL};
577};
578#endif
579#endif // defined(USE_LVGL_DROPDOWN) || defined(LV_USE_ROLLER)
580
581#ifdef USE_LVGL_BUTTONMATRIX
583 public:
584 void set_obj(lv_obj_t *lv_obj) override;
585 uint16_t get_selected() { return lv_buttonmatrix_get_selected_button(this->obj); }
586 void set_key(size_t idx, uint8_t key) { this->key_map_[idx] = key; }
587
588 protected:
589 std::map<size_t, uint8_t> key_map_{};
590};
591#endif // USE_LVGL_BUTTONMATRIX
592
593#ifdef USE_LVGL_KEYBOARD
595 public:
596 void set_obj(lv_obj_t *lv_obj) override;
597};
598#endif // USE_LVGL_KEYBOARD
599} // namespace esphome::lvgl
BedjetMode mode
BedJet operating mode.
Base class for all automation conditions.
Definition automation.h:438
Fixed-capacity vector - allocates once at runtime, never reallocates This avoids std::vector template...
Definition helpers.h:545
Helper class to easily give an object a parent of type T.
Definition helpers.h:1910
This class simplifies creating components that periodically check a state.
Definition component.h:510
void add_on_state_callback(F &&callback)
Function-pointer-only templatable storage (4 bytes on 32-bit).
Definition automation.h:19
void trigger(const Ts &...x) ESPHOME_ALWAYS_INLINE
Inform the parent automation that the event has triggered.
Definition automation.h:461
Base class for all binary_sensor-type classes.
const lv_font_t * get_lv_font() const
Definition font.h:76
lv_image_dsc_t * get_lv_image_dsc()
Definition image.cpp:107
interface for components that provide keypresses
Definition key_provider.h:9
TemplatableFn< uint32_t > timeout_
IdleTrigger(LvglComponent *parent, TemplatableFn< uint32_t > timeout)
void set_obj(lv_obj_t *lv_obj) override
void add_button(binary_sensor::BinarySensor *button, lv_key_t key)
void event(int key, bool pressed)
void set_sensor(rotary_encoder::RotaryEncoderSensor *sensor)
LVEncoderListener(lv_indev_type_t type, uint16_t long_press_time, uint16_t long_press_repeat_time)
LVTouchListener(uint16_t long_press_time, uint16_t long_press_repeat_time, LvglComponent *parent)
touchscreen::TouchPoint touch_point_
void update(const touchscreen::TouchPoints_t &tpoints) override
void set_key(size_t idx, uint8_t key)
std::map< size_t, uint8_t > key_map_
void set_obj(lv_obj_t *lv_obj) override
virtual ~LvCompound()=default
virtual void set_obj(lv_obj_t *lv_obj)
size_t get_selected_index() override
void set_option_string(const char *options) override
void set_selected_index(size_t index, lv_anim_enable_t anim) override
void set_obj(lv_obj_t *lv_obj) override
LvLambdaComponent(void(*callback)())
float get_setup_priority() const override
void set_points(FixedVector< lv_point_precise_t > points)
FixedVector< lv_point_precise_t > points_
void setup(size_t index)
void set_mode(lv_roller_mode_t mode)
void set_option_string(const char *options) override
void set_selected_index(size_t index, lv_anim_enable_t anim) override
size_t get_selected_index() override
const FixedVector< const char * > & get_options()
void set_selected_text(const std::string &text, lv_anim_enable_t anim)
FixedVector< const char * > options_
virtual void set_selected_index(size_t index, lv_anim_enable_t anim)=0
virtual size_t get_selected_index()=0
virtual void set_option_string(const char *options)=0
void set_options(FixedVector< const char * > options)
void init_column_pct(size_t count)
void set_obj(lv_obj_t *lv_obj) override
void add_column_width_pct(uint32_t col, uint8_t pct)
FixedVector< ColumnPct > column_pct_
void play(const Ts &...x) override
LvglAction(std::function< void(LvglComponent *)> &&lamb)
std::function< void(LvglComponent *)> action_
Component for rendering LVGL.
void set_paused(bool paused, bool show_snow)
void set_pause_trigger(Trigger<> *trigger)
void set_landscape_trigger(Trigger<> *trigger)
display::DisplayRotation rotation_
void rotate_coordinates(int32_t &x, int32_t &y) const
std::vector< LvPageType * > pages_
void set_rotation(display::DisplayRotation rotation)
void set_focus_mark(lv_group_t *group)
bool ppa_rotate_(const lv_color_data *src, lv_color_data *dst, uint16_t width, uint16_t height, uint32_t height_rounded)
void set_draw_end_trigger(Trigger<> *trigger)
static void lv_obj_set_state_value(lv_obj_t *obj, lv_state_t state, bool value)
void set_refresh_interval(uint32_t period)
CallbackManager< void(uint32_t)> idle_callbacks_
void set_portrait_trigger(Trigger<> *trigger)
void set_big_endian(bool big_endian)
void show_next_page(lv_screen_load_anim_t anim, uint32_t time)
void set_resume_trigger(Trigger<> *trigger)
std::vector< display::Display * > displays_
static void esphome_lvgl_init()
Initialize the LVGL library and register custom events.
void show_prev_page(lv_screen_load_anim_t anim, uint32_t time)
static void lv_buttonmatrix_set_button_ctrl_value(lv_obj_t *obj, uint32_t index, lv_buttonmatrix_ctrl_t ctrl, bool value)
ppa_client_handle_t ppa_client_
LvglComponent(std::vector< display::Display * > displays, float buffer_frac, bool full_refresh, int draw_rounding, bool resume_on_input, bool update_when_display_idle, RotationType rotation_type)
static void render_start_cb(lv_event_t *event)
static lv_point_t get_touch_relative_to_obj(lv_obj_t *obj)
void add_on_idle_callback(F &&callback)
void add_page(LvPageType *page)
float get_setup_priority() const override
static void static_flush_cb(lv_display_t *disp_drv, const lv_area_t *area, uint8_t *color_p)
std::map< lv_group_t *, lv_obj_t * > focus_marks_
static void render_end_cb(lv_event_t *event)
void draw_buffer_(const lv_area_t *area, lv_color_data *ptr)
void show_page(size_t index, lv_screen_load_anim_t anim, uint32_t time)
display::DisplayRotation get_rotation() const
static void add_event_cb(lv_obj_t *obj, event_callback_t callback, lv_event_code_t event, void *user_data=nullptr)
void set_draw_start_trigger(Trigger<> *trigger)
void restore_focus_mark(lv_group_t *group)
void flush_cb_(lv_display_t *disp_drv, const lv_area_t *area, uint8_t *color_p)
LvglCondition(std::function< bool(Tc *)> &&condition_lambda)
bool check(const Ts &...x) override
std::function< bool(Tc *)> condition_lambda_
void play(const Ts &...x) override
std::function< void(Ts...)> lamb_
ObjUpdateAction(std::function< void(Ts...)> &&lamb)
uint16_t type
uint8_t options
bool state
Definition fan.h:2
@ DISPLAY_ROTATION_0_DEGREES
Definition display.h:134
void lv_obj_set_style_bitmap_mask_src(lv_obj_t *obj, image::Image *image, lv_style_selector_t selector)
lv_color_t lv_grad_calculate_color(const lv_grad_dsc_t *dsc, int32_t pos)
void lv_style_set_text_font(lv_style_t *style, const font::Font *font)
void lv_animimg_stop(lv_obj_t *obj)
uint16_t lv_color_data
int lv_list_get_row_index(lv_obj_t *list, lv_obj_t *child)
void(lv_event_t *) event_callback_t
void lv_animimg_set_src(lv_obj_t *img, std::vector< image::Image * > images)
void lv_image_set_src(lv_obj_t *obj, image::Image *image)
void lv_style_set_bg_image_src(lv_style_t *style, image::Image *image)
uint32_t lv_table_get_selected_row(lv_obj_t *obj)
void lv_style_set_bitmap_mask_src(lv_style_t *style, image::Image *image)
void lv_obj_set_style_text_font(lv_obj_t *obj, const font::Font *font, lv_style_selector_t part)
void lv_obj_set_style_bg_image_src(lv_obj_t *obj, image::Image *image, lv_style_selector_t selector)
lv_event_code_t lv_update_event
int16_t lv_get_needle_angle_for_value(lv_obj_t *obj, int32_t value)
lv_obj_t * lv_container_create(lv_obj_t *parent)
lv_obj_t * lv_list_get_row_for_remove(lv_obj_t *list, int index)
std::string lv_event_code_name_for(lv_event_t *event)
void lv_scale_draw_event_cb(lv_event_t *e, int16_t range_start, int16_t range_end, lv_color_t color_start, lv_color_t color_end, int width, bool local)
Function to apply colors to ticks based on position.
void delete_lv_compound_on_delete(lv_event_t *e)
uint32_t lv_table_get_selected_column(lv_obj_t *obj)
constexpr float PROCESSOR
For components that use data from sensors like displays.
Definition component.h:47
std::vector< TouchPoint > TouchPoints_t
Definition touchscreen.h:29
size_t size_t pos
Definition helpers.h:1092
const void * src
Definition hal.h:64
STL namespace.
static void uint32_t
uint16_t x
Definition tt21100.cpp:5
uint16_t y
Definition tt21100.cpp:6