ESPHome 2026.11.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#ifdef USE_LVGL_MENU
147// True if `e` is a click on `menu`'s back button while already at the root page -- the one
148// case LVGL's own docs say the app must handle itself (there is no default behavior).
149bool lv_menu_back_button_is_root_click(lv_obj_t *menu, lv_event_t *e);
150#endif // USE_LVGL_MENU
151
152// Parent class for things that wrap an LVGL object
154 public:
155 virtual ~LvCompound() = default;
156 virtual void set_obj(lv_obj_t *lv_obj) { this->obj = lv_obj; }
157 lv_obj_t *obj{};
158};
159
160// Frees a heap-allocated LvCompound wrapper on LV_EVENT_DELETE, since lv_obj_del() only knows how to destroy LVGL's own
161// object tree, not a separate C++ object paired with one of its nodes.
162template<typename T> void delete_lv_compound_on_delete(lv_event_t *e) {
163 delete static_cast<T *>(lv_event_get_user_data(e));
164}
165
166class LvglComponent;
167
168class LvPageType : public Parented<LvglComponent> {
169 public:
171
172 void setup(size_t index) {
173 this->index = index;
174 this->obj = lv_obj_create(nullptr);
175 }
176
177 bool is_showing() const;
178
179 lv_obj_t *obj{};
180 size_t index{};
181 bool skip;
182};
183
184using event_callback_t = void(lv_event_t *);
185
186class LvLambdaComponent final : public Component {
187 public:
188 LvLambdaComponent(void (*callback)()) : callback_(callback) {}
189
190 void setup() override { this->callback_(); }
191 // execute after the LvglComponent is setup
192 float get_setup_priority() const override { return setup_priority::PROCESSOR - 5; }
193
194 protected:
195 void (*callback_)();
196};
197
198template<typename... Ts> class ObjUpdateAction final : public Action<Ts...> {
199 public:
200 explicit ObjUpdateAction(std::function<void(Ts...)> &&lamb) : lamb_(std::move(lamb)) {}
201
202 protected:
203 void play(const Ts &...x) override { this->lamb_(x...); }
204
205 std::function<void(Ts...)> lamb_;
206};
207#ifdef USE_LVGL_ANIMIMG
208void lv_animimg_stop(lv_obj_t *obj);
209#endif // USE_LVGL_ANIMIMG
215
216enum class Orientation : uint8_t {
217 UNKNOWN,
218 LANDSCAPE,
219 PORTRAIT,
220};
221
222class LvglComponent final : public PollingComponent {
223 constexpr static const char *const TAG = "lvgl"; // NOLINT: lvgl does not build for ESP8266
224
225 public:
226 LvglComponent(std::vector<display::Display *> displays, float buffer_frac, bool full_refresh, int draw_rounding,
227 bool resume_on_input, bool update_when_display_idle, RotationType rotation_type);
228 static void static_flush_cb(lv_display_t *disp_drv, const lv_area_t *area, uint8_t *color_p);
234 static lv_point_t get_touch_relative_to_obj(lv_obj_t *obj);
235
236 float get_setup_priority() const override { return setup_priority::PROCESSOR; }
237 void setup() override;
238 void update() override;
239 void loop() override;
240 template<typename F> void add_on_idle_callback(F &&callback) { this->idle_callbacks_.add(std::forward<F>(callback)); }
241
242 static void render_end_cb(lv_event_t *event);
243 static void render_start_cb(lv_event_t *event);
244 void dump_config() override;
245 lv_display_t *get_disp() { return this->disp_; }
246 lv_obj_t *get_screen_active() { return lv_display_get_screen_active(this->disp_); }
247 // Pause or resume the display.
248 // @param paused If true, pause the display. If false, resume the display.
249 // @param show_snow If true, show the snow effect when paused.
250 void set_paused(bool paused, bool show_snow);
252 this->refr_timer_period_ = period;
253 if (this->refr_timer_ != nullptr)
254 lv_timer_set_period(this->refr_timer_, period);
255 }
256
257 // Returns true if the display has been explicitly paused via set_paused().
258 bool is_paused() const { return this->paused_; }
259 // If the display is paused and we have resume_on_input_ set to true, resume the display.
261 if (this->paused_ && this->resume_on_input_) {
262 this->set_paused(false, false);
263 }
264 }
265
269 static void esphome_lvgl_init();
270
271 // Convenience overloads for adding a callback for one or more events
272 static void add_event_cb(lv_obj_t *obj, event_callback_t callback, lv_event_code_t event, void *user_data = nullptr);
273 static void add_event_cb(lv_obj_t *obj, event_callback_t callback, lv_event_code_t event1, lv_event_code_t event2,
274 void *user_data = nullptr);
275 static void add_event_cb(lv_obj_t *obj, event_callback_t callback, lv_event_code_t event1, lv_event_code_t event2,
276 lv_event_code_t event3, void *user_data = nullptr);
277
278 // Set or clear LV_OBJ_FLAG_LAYOUT_2, LV_OBJ_FLAG_WIDGET_1 or LV_OBJ_FLAG_WIDGET_2, which have no setter in LVGL 9.6
279 static void lv_obj_set_custom_flag(lv_obj_t *obj, lv_obj_flag_t flag, bool value);
280
281 // change the state of a widget and fire an event if changed (only needed for CHECKED)
282
283 static void lv_obj_set_state_value(lv_obj_t *obj, lv_state_t state, bool value) {
284 if (value != lv_obj_has_state(obj, state)) {
285 if (value) {
286 lv_obj_add_state(obj, state);
287 } else {
288 lv_obj_remove_state(obj, state);
289 }
290 if (state == LV_STATE_CHECKED)
291 lv_obj_send_event(obj, lv_update_event, nullptr);
292 }
293 }
294
295 // change the state of a buttonmatrix button and fire an event if changed (only needed for CHECKED)
296#ifdef USE_LVGL_BUTTONMATRIX
297 static void lv_buttonmatrix_set_button_ctrl_value(lv_obj_t *obj, uint32_t index, lv_buttonmatrix_ctrl_t ctrl,
298 bool value) {
299 if (value != lv_buttonmatrix_has_button_ctrl(obj, index, ctrl)) {
300 if (value) {
301 lv_buttonmatrix_set_button_ctrl(obj, index, ctrl);
302 } else {
303 lv_buttonmatrix_clear_button_ctrl(obj, index, ctrl);
304 }
305 if (ctrl == LV_BUTTONMATRIX_CTRL_CHECKED)
306 lv_obj_send_event(obj, lv_update_event, nullptr);
307 }
308 }
309#endif
310
311 void add_page(LvPageType *page);
312 void show_page(size_t index, lv_screen_load_anim_t anim, uint32_t time);
313 void show_next_page(lv_screen_load_anim_t anim, uint32_t time);
314 void show_prev_page(lv_screen_load_anim_t anim, uint32_t time);
315 void set_page_wrap(bool wrap) { this->page_wrap_ = wrap; }
316 void set_big_endian(bool big_endian) { this->big_endian_ = big_endian; }
317 size_t get_current_page() const;
318 void set_focus_mark(lv_group_t *group) { this->focus_marks_[group] = lv_group_get_focused(group); }
319 void restore_focus_mark(lv_group_t *group) {
320 auto *mark = this->focus_marks_[group];
321 if (mark != nullptr) {
322 lv_group_focus_obj(mark);
323 }
324 }
325 // rounding factor to align bounds of update area when drawing
326 size_t draw_rounding{2};
327
328 void set_pause_trigger(Trigger<> *trigger) { this->pause_callback_ = trigger; }
329 void set_resume_trigger(Trigger<> *trigger) { this->resume_callback_ = trigger; }
330 void set_draw_start_trigger(Trigger<> *trigger) { this->draw_start_callback_ = trigger; }
331 void set_draw_end_trigger(Trigger<> *trigger) { this->draw_end_callback_ = trigger; }
332 void set_landscape_trigger(Trigger<> *trigger) { this->landscape_callback_ = trigger; }
333 void set_portrait_trigger(Trigger<> *trigger) { this->portrait_callback_ = trigger; }
336 void set_rotation(int angle);
338 void rotate_coordinates(int32_t &x, int32_t &y) const;
339
340 uint16_t get_width() const { return lv_display_get_horizontal_resolution(this->disp_); }
341 uint16_t get_height() const { return lv_display_get_vertical_resolution(this->disp_); }
342
343 protected:
344 void set_resolution_() const;
345 // Determine the current orientation from the effective resolution and fire the
346 // landscape/portrait trigger if it has changed since the last check.
347 void update_orientation_();
348 void draw_end_();
349 // Not checking for non-null callback since the
350 // LVGL callback that calls it is not set in that case
351 void draw_start_() const { this->draw_start_callback_->trigger(); }
352 // Returns true if update_when_display_idle is enabled and at least one underlying display
353 // component is currently busy (e.g. mid-refresh).
354 bool displays_busy_() const;
355
356 void write_random_();
357 void draw_buffer_(const lv_area_t *area, lv_color_data *ptr);
358#ifdef USE_ESP32_VARIANT_ESP32P4
359 bool ppa_rotate_(const lv_color_data *src, lv_color_data *dst, uint16_t width, uint16_t height,
360 uint32_t height_rounded);
361#endif
362 void flush_cb_(lv_display_t *disp_drv, const lv_area_t *area, uint8_t *color_p);
363
364 std::vector<display::Display *> displays_{};
365 size_t buffer_frac_{1};
369
370 uint8_t *draw_buf_{};
371 lv_display_t *disp_{};
372 // The display's own periodic refresh timer, effectively paused while the display is busy (see
373 // displays_busy_()) so LVGL neither renders nor flushes to it, without losing track of
374 // invalidated areas. Other timers (indev reading, animations, ...) keep running as normal.
375 lv_timer_t *refr_timer_{};
376 // Tracks whether refr_timer_ is currently paused, so loop() can detect the busy -> idle edge
377 // and kick off an immediate refresh instead of waiting for the timer's next natural period.
380 uint16_t width_{};
381 uint16_t height_{};
382 bool paused_{};
383 std::vector<LvPageType *> pages_{};
384 size_t current_page_{0};
386 bool page_wrap_{true};
388 std::map<lv_group_t *, lv_obj_t *> focus_marks_{};
389
398 void *rotate_buf_{};
401#ifdef USE_ESP32_VARIANT_ESP32P4
402 ppa_client_handle_t ppa_client_{};
403#endif
404};
405
406class IdleTrigger final : public Trigger<> {
407 public:
408 explicit IdleTrigger(LvglComponent *parent, TemplatableFn<uint32_t> timeout);
409
410 protected:
412 bool is_idle_{};
413};
414
415template<typename... Ts> class LvglAction final : public Action<Ts...>, public Parented<LvglComponent> {
416 public:
417 explicit LvglAction(std::function<void(LvglComponent *)> &&lamb) : action_(std::move(lamb)) {}
418
419 protected:
420 void play(const Ts &...x) override { this->action_(this->parent_); }
421 std::function<void(LvglComponent *)> action_{};
422};
423
424template<typename Tc, typename... Ts> class LvglCondition final : public Condition<Ts...>, public Parented<Tc> {
425 public:
426 LvglCondition(std::function<bool(Tc *)> &&condition_lambda) : condition_lambda_(std::move(condition_lambda)) {}
427 bool check(const Ts &...x) override { return this->condition_lambda_(this->parent_); }
428
429 protected:
430 std::function<bool(Tc *)> condition_lambda_{};
431};
432
433#ifdef USE_LVGL_TOUCHSCREEN
434class LVTouchListener final : public touchscreen::TouchListener, public Parented<LvglComponent> {
435 public:
436 LVTouchListener(uint16_t long_press_time, uint16_t long_press_repeat_time, LvglComponent *parent);
437 void update(const touchscreen::TouchPoints_t &tpoints) override;
438 void release() override {
439 touch_pressed_ = false;
440 this->parent_->maybe_wakeup();
441 }
442 lv_indev_t *get_drv() { return this->drv_; }
443
444 protected:
445 lv_indev_t *drv_{};
448};
449#endif // USE_LVGL_TOUCHSCREEN
450
451#ifdef USE_LVGL_METER
452
453class IndicatorLine : public LvCompound {
454 public:
455 IndicatorLine() = default;
456
457 void set_obj(lv_obj_t *lv_obj) override;
458
459 void set_value(int value);
460
461 private:
462 void update_length_();
463
464 int16_t angle_{};
465 lv_point_precise_t points_[2]{};
466};
467#endif
468
469#ifdef USE_LVGL_KEY_LISTENER
470class LVEncoderListener final : public Parented<LvglComponent> {
471 public:
472 LVEncoderListener(lv_indev_type_t type, uint16_t long_press_time, uint16_t long_press_repeat_time);
473
474#ifdef USE_BINARY_SENSOR
476 button->add_on_state_callback([this, key](bool state) { this->event(key, state); });
477 }
478#endif
479
480#ifdef USE_LVGL_ROTARY_ENCODER
482 sensor->register_listener([this](int32_t count) { this->set_count(count); });
483 }
484#endif // USE_LVGL_ROTARY_ENCODER
485
486 void event(int key, bool pressed) {
487 if (!this->parent_->is_paused()) {
488 this->pressed_ = pressed;
489 this->key_ = key;
490 } else if (!pressed) {
491 // maybe wakeup on release if paused
492 this->parent_->maybe_wakeup();
493 }
494 }
495
496 void set_count(int32_t count) {
497 if (!this->parent_->is_paused()) {
498 this->count_ = count;
499 } else {
500 this->parent_->maybe_wakeup();
501 }
502 }
503
504 lv_indev_t *get_drv() { return this->drv_; }
505
506 protected:
507 lv_indev_t *drv_{};
508 bool pressed_{};
509 int32_t count_{};
510 int32_t last_count_{};
511 int key_{};
512};
513#endif // USE_LVGL_KEY_LISTENER
514
515#ifdef USE_LVGL_LINE
516class LvLineType : public LvCompound {
517 public:
519 this->points_ = std::move(points);
520 lv_line_set_points(this->obj, this->points_.begin(), this->points_.size());
521 }
522
523 protected:
525};
526#endif
527#ifdef USE_LVGL_TABLE
528// Unlike most size properties, lv_table_set_column_width() only accepts a literal pixel
529// count, so percentage column widths must be recomputed by hand whenever the table's own
530// content width changes.
531class LvTableType : public LvCompound {
532 public:
533 void set_obj(lv_obj_t *lv_obj) override;
534 // count is the number of percentage-width columns, known at code-generation time.
535 void init_column_pct(size_t count) { this->column_pct_.init(count); }
536 void add_column_width_pct(uint32_t col, uint8_t pct);
537
538 protected:
540
541 struct ColumnPct {
543 uint8_t pct;
544 };
546};
547#endif // USE_LVGL_TABLE
548#if defined(USE_LVGL_DROPDOWN) || defined(LV_USE_ROLLER)
549class LvSelectable : public LvCompound {
550 public:
551 virtual size_t get_selected_index() = 0;
552 virtual void set_selected_index(size_t index, lv_anim_enable_t anim) = 0;
553 void set_selected_text(const std::string &text, lv_anim_enable_t anim);
554 std::string get_selected_text();
557
558 protected:
559 virtual void set_option_string(const char *options) = 0;
561};
562
563#ifdef USE_LVGL_DROPDOWN
565 public:
566 size_t get_selected_index() override { return lv_dropdown_get_selected(this->obj); }
567 void set_selected_index(size_t index, lv_anim_enable_t anim) override { lv_dropdown_set_selected(this->obj, index); }
568
569 protected:
570 void set_option_string(const char *options) override { lv_dropdown_set_options(this->obj, options); }
571};
572#endif // USE_LVGL_DROPDOWN
573
574#ifdef USE_LVGL_ROLLER
576 public:
577 size_t get_selected_index() override { return lv_roller_get_selected(this->obj); }
578 void set_selected_index(size_t index, lv_anim_enable_t anim) override {
579 lv_roller_set_selected(this->obj, index, anim);
580 }
581 void set_mode(lv_roller_mode_t mode) { this->mode_ = mode; }
582
583 protected:
584 void set_option_string(const char *options) override { lv_roller_set_options(this->obj, options, this->mode_); }
585 lv_roller_mode_t mode_{LV_ROLLER_MODE_NORMAL};
586};
587#endif
588#endif // defined(USE_LVGL_DROPDOWN) || defined(LV_USE_ROLLER)
589
590#ifdef USE_LVGL_BUTTONMATRIX
592 public:
593 void set_obj(lv_obj_t *lv_obj) override;
594 uint16_t get_selected() { return lv_buttonmatrix_get_selected_button(this->obj); }
595 void set_key(size_t idx, uint8_t key) { this->key_map_[idx] = key; }
596
597 protected:
598 std::map<size_t, uint8_t> key_map_{};
599};
600#endif // USE_LVGL_BUTTONMATRIX
601
602#ifdef USE_LVGL_KEYBOARD
604 public:
605 void set_obj(lv_obj_t *lv_obj) override;
606};
607#endif // USE_LVGL_KEYBOARD
608} // namespace esphome::lvgl
BedjetMode mode
BedJet operating mode.
Base class for all automation conditions.
Definition automation.h:533
Fixed-capacity vector - sized once through init() or try_init(); push_back never reallocates This avo...
Definition helpers.h:624
Helper class to easily give an object a parent of type T.
Definition helpers.h:2073
This class simplifies creating components that periodically check a state.
Definition component.h:519
void add_on_state_callback(F &&callback)
Function-pointer-only templatable storage (4 bytes on 32-bit).
Definition automation.h:20
void trigger(const Ts &...x) ESPHOME_ALWAYS_INLINE
Inform the parent automation that the event has triggered.
Definition automation.h:556
Base class for all binary_sensor-type classes.
const lv_font_t * get_lv_font() const
Definition font.h:90
lv_image_dsc_t * get_lv_image_dsc()
Definition image.cpp:167
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)
static void lv_obj_set_custom_flag(lv_obj_t *obj, lv_obj_flag_t flag, bool value)
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)
uint8_t options
uint8_t type
const char * key
bool state
Definition fan.h:2
unsigned count
Definition gif.cpp:51
@ DISPLAY_ROTATION_0_DEGREES
Definition display.h:136
bool lv_menu_back_button_is_root_click(lv_obj_t *menu, lv_event_t *e)
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:1255
const void * src
Definition hal.h:68
STL namespace.
static void uint32_t
uint16_t x
Definition tt21100.cpp:5
uint16_t y
Definition tt21100.cpp:6