ESPHome 2025.9.0-dev
Loading...
Searching...
No Matches
lvgl_esphome.cpp
Go to the documentation of this file.
2#include "esphome/core/hal.h"
4#include "esphome/core/log.h"
5#include "lvgl_hal.h"
6#include "lvgl_esphome.h"
7
8#include <numeric>
9
10namespace esphome {
11namespace lvgl {
12static const char *const TAG = "lvgl";
13
14static const size_t MIN_BUFFER_FRAC = 8;
15
16static const char *const EVENT_NAMES[] = {
17 "NONE",
18 "PRESSED",
19 "PRESSING",
20 "PRESS_LOST",
21 "SHORT_CLICKED",
22 "LONG_PRESSED",
23 "LONG_PRESSED_REPEAT",
24 "CLICKED",
25 "RELEASED",
26 "SCROLL_BEGIN",
27 "SCROLL_END",
28 "SCROLL",
29 "GESTURE",
30 "KEY",
31 "FOCUSED",
32 "DEFOCUSED",
33 "LEAVE",
34 "HIT_TEST",
35 "COVER_CHECK",
36 "REFR_EXT_DRAW_SIZE",
37 "DRAW_MAIN_BEGIN",
38 "DRAW_MAIN",
39 "DRAW_MAIN_END",
40 "DRAW_POST_BEGIN",
41 "DRAW_POST",
42 "DRAW_POST_END",
43 "DRAW_PART_BEGIN",
44 "DRAW_PART_END",
45 "VALUE_CHANGED",
46 "INSERT",
47 "REFRESH",
48 "READY",
49 "CANCEL",
50 "DELETE",
51 "CHILD_CHANGED",
52 "CHILD_CREATED",
53 "CHILD_DELETED",
54 "SCREEN_UNLOAD_START",
55 "SCREEN_LOAD_START",
56 "SCREEN_LOADED",
57 "SCREEN_UNLOADED",
58 "SIZE_CHANGED",
59 "STYLE_CHANGED",
60 "LAYOUT_CHANGED",
61 "GET_SELF_SIZE",
62};
63
64std::string lv_event_code_name_for(uint8_t event_code) {
65 if (event_code < sizeof(EVENT_NAMES) / sizeof(EVENT_NAMES[0])) {
66 return EVENT_NAMES[event_code];
67 }
68 return str_sprintf("%2d", event_code);
69}
70
71static void rounder_cb(lv_disp_drv_t *disp_drv, lv_area_t *area) {
72 // cater for display driver chips with special requirements for bounds of partial
73 // draw areas. Extend the draw area to satisfy:
74 // * Coordinates must be a multiple of draw_rounding
75 auto *comp = static_cast<LvglComponent *>(disp_drv->user_data);
76 auto draw_rounding = comp->draw_rounding;
77 // round down the start coordinates
78 area->x1 = area->x1 / draw_rounding * draw_rounding;
79 area->y1 = area->y1 / draw_rounding * draw_rounding;
80 // round up the end coordinates
81 area->x2 = (area->x2 + draw_rounding) / draw_rounding * draw_rounding - 1;
82 area->y2 = (area->y2 + draw_rounding) / draw_rounding * draw_rounding - 1;
83}
84
85lv_event_code_t lv_api_event; // NOLINT
86lv_event_code_t lv_update_event; // NOLINT
88 ESP_LOGCONFIG(TAG,
89 "LVGL:\n"
90 " Display width/height: %d x %d\n"
91 " Buffer size: %zu%%\n"
92 " Rotation: %d\n"
93 " Draw rounding: %d",
94 this->disp_drv_.hor_res, this->disp_drv_.ver_res, 100 / this->buffer_frac_, this->rotation,
95 (int) this->draw_rounding);
96}
97void LvglComponent::set_paused(bool paused, bool show_snow) {
98 this->paused_ = paused;
99 this->show_snow_ = show_snow;
100 if (!paused && lv_scr_act() != nullptr) {
101 lv_disp_trig_activity(this->disp_); // resets the inactivity time
102 lv_obj_invalidate(lv_scr_act());
103 }
104 this->pause_callbacks_.call(paused);
105}
106
108 lv_init();
109 lv_update_event = static_cast<lv_event_code_t>(lv_event_register_id());
110 lv_api_event = static_cast<lv_event_code_t>(lv_event_register_id());
111}
112void LvglComponent::add_event_cb(lv_obj_t *obj, event_callback_t callback, lv_event_code_t event) {
113 lv_obj_add_event_cb(obj, callback, event, nullptr);
114}
115void LvglComponent::add_event_cb(lv_obj_t *obj, event_callback_t callback, lv_event_code_t event1,
116 lv_event_code_t event2) {
117 add_event_cb(obj, callback, event1);
118 add_event_cb(obj, callback, event2);
119}
120void LvglComponent::add_event_cb(lv_obj_t *obj, event_callback_t callback, lv_event_code_t event1,
121 lv_event_code_t event2, lv_event_code_t event3) {
122 add_event_cb(obj, callback, event1);
123 add_event_cb(obj, callback, event2);
124 add_event_cb(obj, callback, event3);
125}
127 this->pages_.push_back(page);
128 page->set_parent(this);
129 lv_disp_set_default(this->disp_);
130 page->setup(this->pages_.size() - 1);
131}
132void LvglComponent::show_page(size_t index, lv_scr_load_anim_t anim, uint32_t time) {
133 if (index >= this->pages_.size())
134 return;
135 this->current_page_ = index;
136 lv_scr_load_anim(this->pages_[this->current_page_]->obj, anim, time, 0, false);
137}
138void LvglComponent::show_next_page(lv_scr_load_anim_t anim, uint32_t time) {
139 if (this->pages_.empty() || (this->current_page_ == this->pages_.size() - 1 && !this->page_wrap_))
140 return;
141 do {
142 this->current_page_ = (this->current_page_ + 1) % this->pages_.size();
143 } while (this->pages_[this->current_page_]->skip); // skip empty pages()
144 this->show_page(this->current_page_, anim, time);
145}
146void LvglComponent::show_prev_page(lv_scr_load_anim_t anim, uint32_t time) {
147 if (this->pages_.empty() || (this->current_page_ == 0 && !this->page_wrap_))
148 return;
149 do {
150 this->current_page_ = (this->current_page_ + this->pages_.size() - 1) % this->pages_.size();
151 } while (this->pages_[this->current_page_]->skip); // skip empty pages()
152 this->show_page(this->current_page_, anim, time);
153}
154size_t LvglComponent::get_current_page() const { return this->current_page_; }
155bool LvPageType::is_showing() const { return this->parent_->get_current_page() == this->index; }
156void LvglComponent::draw_buffer_(const lv_area_t *area, lv_color_t *ptr) {
157 auto width = lv_area_get_width(area);
158 auto height = lv_area_get_height(area);
159 auto x1 = area->x1;
160 auto y1 = area->y1;
161 lv_color_t *dst = this->rotate_buf_;
162 switch (this->rotation) {
164 for (lv_coord_t x = height; x-- != 0;) {
165 for (lv_coord_t y = 0; y != width; y++) {
166 dst[y * height + x] = *ptr++;
167 }
168 }
169 y1 = x1;
170 x1 = this->disp_drv_.ver_res - area->y1 - height;
171 width = height;
172 height = lv_area_get_width(area);
173 break;
174
176 for (lv_coord_t y = height; y-- != 0;) {
177 for (lv_coord_t x = width; x-- != 0;) {
178 dst[y * width + x] = *ptr++;
179 }
180 }
181 x1 = this->disp_drv_.hor_res - x1 - width;
182 y1 = this->disp_drv_.ver_res - y1 - height;
183 break;
184
186 for (lv_coord_t x = 0; x != height; x++) {
187 for (lv_coord_t y = width; y-- != 0;) {
188 dst[y * height + x] = *ptr++;
189 }
190 }
191 x1 = y1;
192 y1 = this->disp_drv_.hor_res - area->x1 - width;
193 width = height;
194 height = lv_area_get_width(area);
195 break;
196
197 default:
198 dst = ptr;
199 break;
200 }
201 for (auto *display : this->displays_) {
202 ESP_LOGV(TAG, "draw buffer x1=%d, y1=%d, width=%d, height=%d", x1, y1, width, height);
203 display->draw_pixels_at(x1, y1, width, height, (const uint8_t *) dst, display::COLOR_ORDER_RGB, LV_BITNESS,
204 LV_COLOR_16_SWAP);
205 }
206}
207
208void LvglComponent::flush_cb_(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p) {
209 if (!this->paused_) {
210 auto now = millis();
211 this->draw_buffer_(area, color_p);
212 ESP_LOGVV(TAG, "flush_cb, area=%d/%d, %d/%d took %dms", area->x1, area->y1, lv_area_get_width(area),
213 lv_area_get_height(area), (int) (millis() - now));
214 }
215 lv_disp_flush_ready(disp_drv);
216}
217IdleTrigger::IdleTrigger(LvglComponent *parent, TemplatableValue<uint32_t> timeout) : timeout_(std::move(timeout)) {
218 parent->add_on_idle_callback([this](uint32_t idle_time) {
219 if (!this->is_idle_ && idle_time > this->timeout_.value()) {
220 this->is_idle_ = true;
221 this->trigger();
222 } else if (this->is_idle_ && idle_time < this->timeout_.value()) {
223 this->is_idle_ = false;
224 }
225 });
226}
227
228PauseTrigger::PauseTrigger(LvglComponent *parent, TemplatableValue<bool> paused) : paused_(std::move(paused)) {
229 parent->add_on_pause_callback([this](bool pausing) {
230 if (this->paused_.value() == pausing)
231 this->trigger();
232 });
233}
234
235#ifdef USE_LVGL_TOUCHSCREEN
236LVTouchListener::LVTouchListener(uint16_t long_press_time, uint16_t long_press_repeat_time, LvglComponent *parent) {
237 this->set_parent(parent);
238 lv_indev_drv_init(&this->drv_);
239 this->drv_.disp = parent->get_disp();
240 this->drv_.long_press_repeat_time = long_press_repeat_time;
241 this->drv_.long_press_time = long_press_time;
242 this->drv_.type = LV_INDEV_TYPE_POINTER;
243 this->drv_.user_data = this;
244 this->drv_.read_cb = [](lv_indev_drv_t *d, lv_indev_data_t *data) {
245 auto *l = static_cast<LVTouchListener *>(d->user_data);
246 if (l->touch_pressed_) {
247 data->point.x = l->touch_point_.x;
248 data->point.y = l->touch_point_.y;
249 data->state = LV_INDEV_STATE_PRESSED;
250 } else {
251 data->state = LV_INDEV_STATE_RELEASED;
252 }
253 };
254}
255
257 this->touch_pressed_ = !this->parent_->is_paused() && !tpoints.empty();
258 if (this->touch_pressed_)
259 this->touch_point_ = tpoints[0];
260}
261#endif // USE_LVGL_TOUCHSCREEN
262
263#ifdef USE_LVGL_KEY_LISTENER
264LVEncoderListener::LVEncoderListener(lv_indev_type_t type, uint16_t lpt, uint16_t lprt) {
265 lv_indev_drv_init(&this->drv_);
266 this->drv_.type = type;
267 this->drv_.user_data = this;
268 this->drv_.long_press_time = lpt;
269 this->drv_.long_press_repeat_time = lprt;
270 this->drv_.read_cb = [](lv_indev_drv_t *d, lv_indev_data_t *data) {
271 auto *l = static_cast<LVEncoderListener *>(d->user_data);
272 data->state = l->pressed_ ? LV_INDEV_STATE_PRESSED : LV_INDEV_STATE_RELEASED;
273 data->key = l->key_;
274 data->enc_diff = (int16_t) (l->count_ - l->last_count_);
275 l->last_count_ = l->count_;
276 data->continue_reading = false;
277 };
278}
279#endif // USE_LVGL_KEY_LISTENER
280
281#if defined(USE_LVGL_DROPDOWN) || defined(LV_USE_ROLLER)
283 auto selected = this->get_selected_index();
284 if (selected >= this->options_.size())
285 return "";
286 return this->options_[selected];
287}
288
289static std::string join_string(std::vector<std::string> options) {
290 return std::accumulate(
291 options.begin(), options.end(), std::string(),
292 [](const std::string &a, const std::string &b) -> std::string { return a + (!a.empty() ? "\n" : "") + b; });
293}
294
295void LvSelectable::set_selected_text(const std::string &text, lv_anim_enable_t anim) {
296 auto index = std::find(this->options_.begin(), this->options_.end(), text);
297 if (index != this->options_.end()) {
298 this->set_selected_index(index - this->options_.begin(), anim);
299 lv_event_send(this->obj, lv_api_event, nullptr);
300 }
301}
302
303void LvSelectable::set_options(std::vector<std::string> options) {
304 auto index = this->get_selected_index();
305 if (index >= options.size())
306 index = options.size() - 1;
307 this->options_ = std::move(options);
308 this->set_option_string(join_string(this->options_).c_str());
309 lv_event_send(this->obj, LV_EVENT_REFRESH, nullptr);
310 this->set_selected_index(index, LV_ANIM_OFF);
311}
312#endif // USE_LVGL_DROPDOWN || LV_USE_ROLLER
313
314#ifdef USE_LVGL_BUTTONMATRIX
315void LvButtonMatrixType::set_obj(lv_obj_t *lv_obj) {
316 LvCompound::set_obj(lv_obj);
317 lv_obj_add_event_cb(
318 lv_obj,
319 [](lv_event_t *event) {
320 auto *self = static_cast<LvButtonMatrixType *>(event->user_data);
321 if (self->key_callback_.size() == 0)
322 return;
323 auto key_idx = lv_btnmatrix_get_selected_btn(self->obj);
324 if (key_idx == LV_BTNMATRIX_BTN_NONE)
325 return;
326 if (self->key_map_.count(key_idx) != 0) {
327 self->send_key_(self->key_map_[key_idx]);
328 return;
329 }
330 const auto *str = lv_btnmatrix_get_btn_text(self->obj, key_idx);
331 auto len = strlen(str);
332 while (len--)
333 self->send_key_(*str++);
334 },
335 LV_EVENT_PRESSED, this);
336}
337#endif // USE_LVGL_BUTTONMATRIX
338
339#ifdef USE_LVGL_KEYBOARD
340static const char *const KB_SPECIAL_KEYS[] = {
341 "abc", "ABC", "1#",
342 // maybe add other special keys here
343};
344
345void LvKeyboardType::set_obj(lv_obj_t *lv_obj) {
346 LvCompound::set_obj(lv_obj);
347 lv_obj_add_event_cb(
348 lv_obj,
349 [](lv_event_t *event) {
350 auto *self = static_cast<LvKeyboardType *>(event->user_data);
351 if (self->key_callback_.size() == 0)
352 return;
353
354 auto key_idx = lv_btnmatrix_get_selected_btn(self->obj);
355 if (key_idx == LV_BTNMATRIX_BTN_NONE)
356 return;
357 const char *txt = lv_btnmatrix_get_btn_text(self->obj, key_idx);
358 if (txt == nullptr)
359 return;
360 for (const auto *kb_special_key : KB_SPECIAL_KEYS) {
361 if (strcmp(txt, kb_special_key) == 0)
362 return;
363 }
364 while (*txt != 0)
365 self->send_key_(*txt++);
366 },
367 LV_EVENT_PRESSED, this);
368}
369#endif // USE_LVGL_KEYBOARD
370
372 int iterations = 6 - lv_disp_get_inactive_time(this->disp_) / 60000;
373 if (iterations <= 0)
374 iterations = 1;
375 while (iterations-- != 0) {
376 auto col = random_uint32() % this->disp_drv_.hor_res;
377 col = col / this->draw_rounding * this->draw_rounding;
378 auto row = random_uint32() % this->disp_drv_.ver_res;
379 row = row / this->draw_rounding * this->draw_rounding;
380 auto size = (random_uint32() % 32) / this->draw_rounding * this->draw_rounding - 1;
381 lv_area_t area;
382 area.x1 = col;
383 area.y1 = row;
384 area.x2 = col + size;
385 area.y2 = row + size;
386 if (area.x2 >= this->disp_drv_.hor_res)
387 area.x2 = this->disp_drv_.hor_res - 1;
388 if (area.y2 >= this->disp_drv_.ver_res)
389 area.y2 = this->disp_drv_.ver_res - 1;
390
391 size_t line_len = lv_area_get_width(&area) * lv_area_get_height(&area) / 2;
392 for (size_t i = 0; i != line_len; i++) {
393 ((uint32_t *) (this->draw_buf_.buf1))[i] = random_uint32();
394 }
395 this->draw_buffer_(&area, (lv_color_t *) this->draw_buf_.buf1);
396 }
397}
398
419LvglComponent::LvglComponent(std::vector<display::Display *> displays, float buffer_frac, bool full_refresh,
420 int draw_rounding, bool resume_on_input)
421 : draw_rounding(draw_rounding),
422 displays_(std::move(displays)),
423 buffer_frac_(buffer_frac),
424 full_refresh_(full_refresh),
425 resume_on_input_(resume_on_input) {
426 lv_disp_draw_buf_init(&this->draw_buf_, nullptr, nullptr, 0);
427 lv_disp_drv_init(&this->disp_drv_);
428 this->disp_drv_.draw_buf = &this->draw_buf_;
429 this->disp_drv_.user_data = this;
430 this->disp_drv_.full_refresh = this->full_refresh_;
431 this->disp_drv_.flush_cb = static_flush_cb;
432 this->disp_drv_.rounder_cb = rounder_cb;
433 this->disp_ = lv_disp_drv_register(&this->disp_drv_);
434}
435
437 auto *display = this->displays_[0];
438 auto width = display->get_width();
439 auto height = display->get_height();
440 auto frac = this->buffer_frac_;
441 if (frac == 0)
442 frac = 1;
443 size_t buffer_pixels = width * height / frac;
444 auto buf_bytes = buffer_pixels * LV_COLOR_DEPTH / 8;
445 void *buffer = nullptr;
446 if (this->buffer_frac_ >= MIN_BUFFER_FRAC / 2)
447 buffer = malloc(buf_bytes); // NOLINT
448 if (buffer == nullptr)
449 buffer = lv_custom_mem_alloc(buf_bytes); // NOLINT
450 // if specific buffer size not set and can't get 100%, try for a smaller one
451 if (buffer == nullptr && this->buffer_frac_ == 0) {
452 frac = MIN_BUFFER_FRAC;
453 buffer_pixels /= MIN_BUFFER_FRAC;
454 buf_bytes /= MIN_BUFFER_FRAC;
455 buffer = lv_custom_mem_alloc(buf_bytes); // NOLINT
456 }
457 if (buffer == nullptr) {
458 this->status_set_error("Memory allocation failure");
459 this->mark_failed();
460 return;
461 }
462 this->buffer_frac_ = frac;
463 lv_disp_draw_buf_init(&this->draw_buf_, buffer, nullptr, buffer_pixels);
464 this->disp_drv_.hor_res = width;
465 this->disp_drv_.ver_res = height;
466 // this->setup_driver_(display->get_width(), display->get_height());
467 lv_disp_drv_update(this->disp_, &this->disp_drv_);
468 this->rotation = display->get_rotation();
470 this->rotate_buf_ = static_cast<lv_color_t *>(lv_custom_mem_alloc(buf_bytes)); // NOLINT
471 if (this->rotate_buf_ == nullptr) {
472 this->status_set_error("Memory allocation failure");
473 this->mark_failed();
474 return;
475 }
476 }
477#if LV_USE_LOG
478 lv_log_register_print_cb([](const char *buf) {
479 auto next = strchr(buf, ')');
480 if (next != nullptr)
481 buf = next + 1;
482 while (isspace(*buf))
483 buf++;
484 esp_log_printf_(LVGL_LOG_LEVEL, TAG, 0, "%.*s", (int) strlen(buf) - 1, buf);
485 });
486#endif
487 // Rotation will be handled by our drawing function, so reset the display rotation.
488 for (auto *disp : this->displays_)
489 disp->set_rotation(display::DISPLAY_ROTATION_0_DEGREES);
490 this->show_page(0, LV_SCR_LOAD_ANIM_NONE, 0);
491 lv_disp_trig_activity(this->disp_);
492}
493
495 // update indicators
496 if (this->paused_) {
497 return;
498 }
499 this->idle_callbacks_.call(lv_disp_get_inactive_time(this->disp_));
500}
502 if (this->paused_) {
503 if (this->show_snow_)
504 this->write_random_();
505 }
506 lv_timer_handler_run_in_period(5);
507}
508
509#ifdef USE_LVGL_ANIMIMG
510void lv_animimg_stop(lv_obj_t *obj) {
511 auto *animg = (lv_animimg_t *) obj;
512 int32_t duration = animg->anim.time;
513 lv_animimg_set_duration(obj, 0);
514 lv_animimg_start(obj);
515 lv_animimg_set_duration(obj, duration);
516}
517#endif
518void LvglComponent::static_flush_cb(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p) {
519 reinterpret_cast<LvglComponent *>(disp_drv->user_data)->flush_cb_(disp_drv, area, color_p);
520}
521} // namespace lvgl
522} // namespace esphome
523
524size_t lv_millis(void) { return esphome::millis(); }
525
526#if defined(USE_HOST) || defined(USE_RP2040) || defined(USE_ESP8266)
527void *lv_custom_mem_alloc(size_t size) {
528 auto *ptr = malloc(size); // NOLINT
529 if (ptr == nullptr) {
530 ESP_LOGE(esphome::lvgl::TAG, "Failed to allocate %zu bytes", size);
531 }
532 return ptr;
533}
534void lv_custom_mem_free(void *ptr) { return free(ptr); } // NOLINT
535void *lv_custom_mem_realloc(void *ptr, size_t size) { return realloc(ptr, size); } // NOLINT
536#else
537static unsigned cap_bits = MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT; // NOLINT
538
539void *lv_custom_mem_alloc(size_t size) {
540 void *ptr;
541 ptr = heap_caps_malloc(size, cap_bits);
542 if (ptr == nullptr) {
543 cap_bits = MALLOC_CAP_8BIT;
544 ptr = heap_caps_malloc(size, cap_bits);
545 }
546 if (ptr == nullptr) {
547 ESP_LOGE(esphome::lvgl::TAG, "Failed to allocate %zu bytes", size);
548 return nullptr;
549 }
550 ESP_LOGV(esphome::lvgl::TAG, "allocate %zu - > %p", size, ptr);
551 return ptr;
552}
553
554void lv_custom_mem_free(void *ptr) {
555 ESP_LOGV(esphome::lvgl::TAG, "free %p", ptr);
556 if (ptr == nullptr)
557 return;
558 heap_caps_free(ptr);
559}
560
561void *lv_custom_mem_realloc(void *ptr, size_t size) {
562 ESP_LOGV(esphome::lvgl::TAG, "realloc %p: %zu", ptr, size);
563 return heap_caps_realloc(ptr, size, cap_bits);
564}
565#endif
uint8_t l
Definition bl0906.h:0
virtual void mark_failed()
Mark this component as failed.
void status_set_error(const char *message=nullptr)
void set_parent(T *parent)
Set the parent of this object.
Definition helpers.h:664
void trigger(Ts... x)
Definition automation.h:145
IdleTrigger(LvglComponent *parent, TemplatableValue< uint32_t > timeout)
TemplatableValue< uint32_t > timeout_
LVEncoderListener(lv_indev_type_t type, uint16_t lpt, uint16_t lprt)
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_obj(lv_obj_t *lv_obj) override
virtual void set_obj(lv_obj_t *lv_obj)
void set_obj(lv_obj_t *lv_obj) override
void setup(size_t index)
void set_selected_text(const std::string &text, lv_anim_enable_t anim)
void set_options(std::vector< std::string > options)
std::vector< std::string > 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
Component for rendering LVGL.
void set_paused(bool paused, bool show_snow)
static void static_flush_cb(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p)
std::vector< LvPageType * > pages_
static void add_event_cb(lv_obj_t *obj, event_callback_t callback, lv_event_code_t event)
void show_next_page(lv_scr_load_anim_t anim, uint32_t time)
CallbackManager< void(uint32_t)> idle_callbacks_
void add_on_idle_callback(std::function< void(uint32_t)> &&callback)
lv_disp_draw_buf_t draw_buf_
display::DisplayRotation rotation
void show_page(size_t index, lv_scr_load_anim_t anim, uint32_t time)
void show_prev_page(lv_scr_load_anim_t anim, uint32_t time)
CallbackManager< void(bool)> pause_callbacks_
std::vector< display::Display * > displays_
static void esphome_lvgl_init()
Initialize the LVGL library and register custom events.
void flush_cb_(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p)
LvglComponent(std::vector< display::Display * > displays, float buffer_frac, bool full_refresh, int draw_rounding, bool resume_on_input)
void add_page(LvPageType *page)
void add_on_pause_callback(std::function< void(bool)> &&callback)
void draw_buffer_(const lv_area_t *area, lv_color_t *ptr)
PauseTrigger(LvglComponent *parent, TemplatableValue< bool > paused)
TemplatableValue< bool > paused_
uint8_t type
uint8_t options
void * lv_custom_mem_alloc(size_t size)
size_t lv_millis(void)
void lv_custom_mem_free(void *ptr)
void * lv_custom_mem_realloc(void *ptr, size_t size)
uint8_t duration
Definition msa3xx.h:0
@ DISPLAY_ROTATION_0_DEGREES
Definition display.h:135
@ DISPLAY_ROTATION_270_DEGREES
Definition display.h:138
@ DISPLAY_ROTATION_180_DEGREES
Definition display.h:137
@ DISPLAY_ROTATION_90_DEGREES
Definition display.h:136
void lv_animimg_stop(lv_obj_t *obj)
std::string lv_event_code_name_for(uint8_t event_code)
lv_event_code_t lv_update_event
void(_lv_event_t *) event_callback_t
lv_event_code_t lv_api_event
std::vector< TouchPoint > TouchPoints_t
Definition touchscreen.h:30
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
void HOT esp_log_printf_(int level, const char *tag, int line, const char *format,...)
Definition log.cpp:11
std::string size_t len
Definition helpers.h:279
uint32_t random_uint32()
Return a random 32-bit unsigned integer.
Definition helpers.cpp:17
std::string str_sprintf(const char *fmt,...)
Definition helpers.cpp:208
uint32_t IRAM_ATTR HOT millis()
Definition core.cpp:28
uint16_t x
Definition tt21100.cpp:5
uint16_t y
Definition tt21100.cpp:6