7#include "core/lv_global.h"
8#include "core/lv_obj_class_private.h"
12static void *lv_alloc_draw_buf(
size_t size,
bool internal);
13static void *draw_buf_alloc_cb(
size_t size, lv_color_format_t color_format) {
return lv_alloc_draw_buf(size,
false); };
16static const char *
const TAG =
"lvgl";
18static const size_t MIN_BUFFER_FRAC = 8;
19static const size_t MIN_BUFFER_SIZE = 2048;
21static const char *
const EVENT_NAMES[] = {
28 "LONG_PRESSED_REPEAT",
59 "SCREEN_UNLOAD_START",
69static const unsigned LOG_LEVEL_MAP[] = {
70 ESPHOME_LOG_LEVEL_DEBUG, ESPHOME_LOG_LEVEL_INFO, ESPHOME_LOG_LEVEL_WARN,
71 ESPHOME_LOG_LEVEL_ERROR, ESPHOME_LOG_LEVEL_ERROR, ESPHOME_LOG_LEVEL_NONE,
76 auto event_code = lv_event_get_code(event);
77 if (event_code <
sizeof(EVENT_NAMES) /
sizeof(EVENT_NAMES[0])) {
78 return EVENT_NAMES[event_code];
82 snprintf(buf,
sizeof(buf),
"%u", event_code);
88 ESP_LOGW(TAG,
"Display rotation cannot be changed unless rotation was enabled during setup.");
124static void rounder_cb(lv_event_t *event) {
125 auto *comp =
static_cast<LvglComponent *
>(lv_event_get_user_data(event));
126 auto *area =
static_cast<lv_area_t *
>(lv_event_get_param(event));
132 area->x1 = area->x1 / draw_rounding * draw_rounding;
133 area->y1 = area->y1 / draw_rounding * draw_rounding;
135 area->x2 = (area->x2 + draw_rounding) / draw_rounding * draw_rounding - 1;
136 area->y2 = (area->y2 + draw_rounding) / draw_rounding * draw_rounding - 1;
140 auto *comp =
static_cast<LvglComponent *
>(lv_event_get_user_data(event));
145 ESP_LOGVV(TAG,
"Draw start");
146 auto *comp =
static_cast<LvglComponent *
>(lv_event_get_user_data(event));
155 " Display width/height: %d x %d\n"
156 " Buffer size: %zu%%\n"
158 " Draw rounding: %d",
161 const char *rot_type =
"hardware via display driver";
163#ifdef USE_ESP32_VARIANT_ESP32P4
164 rot_type = this->
ppa_client_ !=
nullptr ?
"software (PPA accelerated)" :
"software";
166 rot_type =
"software";
169 ESP_LOGCONFIG(TAG,
" Rotation type: %s", rot_type);
176 if (!paused && lv_screen_active() !=
nullptr) {
177 lv_display_trigger_activity(this->
disp_);
178 lv_obj_invalidate(lv_screen_active());
189 LV_GLOBAL_DEFAULT()->draw_buf_handlers.buf_malloc_cb = draw_buf_alloc_cb;
190 LV_GLOBAL_DEFAULT()->draw_buf_handlers.buf_free_cb =
lv_free_core;
191 LV_GLOBAL_DEFAULT()->image_cache_draw_buf_handlers.buf_malloc_cb = draw_buf_alloc_cb;
192 LV_GLOBAL_DEFAULT()->image_cache_draw_buf_handlers.buf_free_cb =
lv_free_core;
193 LV_GLOBAL_DEFAULT()->font_draw_buf_handlers.buf_malloc_cb = draw_buf_alloc_cb;
194 LV_GLOBAL_DEFAULT()->font_draw_buf_handlers.buf_free_cb =
lv_free_core;
195 lv_tick_set_cb([] {
return millis(); });
196 lv_update_event =
static_cast<lv_event_code_t
>(lv_event_register_id());
197 lv_api_event =
static_cast<lv_event_code_t
>(lv_event_register_id());
201 lv_obj_add_event_cb(obj, callback, event,
nullptr);
205 lv_event_code_t event2) {
211 lv_event_code_t event2, lv_event_code_t event3) {
218 this->
pages_.push_back(page);
220 lv_display_set_default(this->
disp_);
225 if (index >= this->
pages_.size())
228 if (anim == LV_SCREEN_LOAD_ANIM_NONE) {
236 if (this->
pages_.empty() || (this->current_page_ == this->pages_.size() - 1 && !this->page_wrap_))
248 if (this->
pages_.empty() || (this->current_page_ == 0 && !this->page_wrap_))
262#ifdef USE_ESP32_VARIANT_ESP32P4
265 ppa_srm_rotation_angle_t angle;
266 uint16_t out_w, out_h;
271 angle = PPA_SRM_ROTATION_ANGLE_270;
272 out_w = height_rounded;
276 angle = PPA_SRM_ROTATION_ANGLE_180;
281 angle = PPA_SRM_ROTATION_ANGLE_90;
282 out_w = height_rounded;
292 out_buf_size = LV_ROUND_UP(out_buf_size, LV_DRAW_BUF_ALIGN);
294 ppa_srm_oper_config_t srm_config{};
295 srm_config.in.buffer = src;
296 srm_config.in.pic_w = width;
297 srm_config.in.pic_h = height;
298 srm_config.in.block_w = width;
299 srm_config.in.block_h = height;
300#if LV_COLOR_DEPTH == 16
301 srm_config.in.srm_cm = PPA_SRM_COLOR_MODE_RGB565;
302#elif LV_COLOR_DEPTH == 32
303 srm_config.in.srm_cm = PPA_SRM_COLOR_MODE_ARGB8888;
305 srm_config.out.buffer = dst;
306 srm_config.out.buffer_size = out_buf_size;
307 srm_config.out.pic_w = out_w;
308 srm_config.out.pic_h = out_h;
309#if LV_COLOR_DEPTH == 16
310 srm_config.out.srm_cm = PPA_SRM_COLOR_MODE_RGB565;
311#elif LV_COLOR_DEPTH == 32
312 srm_config.out.srm_cm = PPA_SRM_COLOR_MODE_ARGB8888;
314 srm_config.rotation_angle = angle;
315 srm_config.scale_x = 1.0f;
316 srm_config.scale_y = 1.0f;
317 srm_config.mode = PPA_TRANS_MODE_BLOCKING;
319 esp_err_t ret = ppa_do_scale_rotate_mirror(this->
ppa_client_, &srm_config);
321 ESP_LOGW(TAG,
"PPA rotation failed: %s", esp_err_to_name(ret));
322 ESP_LOGW(TAG,
"PPA SRM: in=%ux%u src=%p, out=%ux%u dst=%p size=%zu, angle=%d", width, height, src, out_w, out_h,
323 dst, out_buf_size, (
int) angle);
331 auto width = lv_area_get_width(area);
332 auto height = lv_area_get_height(area);
338#ifdef USE_ESP32_VARIANT_ESP32P4
339 bool ppa_done = this->
ppa_client_ !=
nullptr && this->
ppa_rotate_(ptr, dst, width, height, height_rounded);
345 for (lv_coord_t
x = height;
x-- != 0;) {
346 for (lv_coord_t
y = 0;
y != width;
y++) {
347 dst[
y * height_rounded +
x] = *ptr++;
353 for (lv_coord_t
y = height;
y-- != 0;) {
354 for (lv_coord_t
x = width;
x-- != 0;) {
355 dst[
y * width +
x] = *ptr++;
361 for (lv_coord_t
x = 0;
x != height;
x++) {
362 for (lv_coord_t
y = width;
y-- != 0;) {
363 dst[
y * height_rounded +
x] = *ptr++;
377 x1 = this->
width_ - area->y1 - height;
379 width = height_rounded;
383 x1 = this->
width_ - x1 - width;
384 y1 = this->
height_ - y1 - height;
389 y1 = this->
height_ - area->x1 - width;
391 width = height_rounded;
409 ESP_LOGV(TAG,
"flush_cb, area=%d/%d, %d/%d took %dms", (
int) area->x1, (
int) area->y1,
410 (
int) lv_area_get_width(area), (
int) lv_area_get_height(area), (
int) (
millis() - now));
412 lv_display_flush_ready(disp_drv);
426#ifdef USE_LVGL_TOUCHSCREEN
429 this->
drv_ = lv_indev_create();
430 lv_indev_set_type(this->
drv_, LV_INDEV_TYPE_POINTER);
432 lv_indev_set_long_press_time(this->
drv_, long_press_time);
434 lv_indev_set_user_data(this->
drv_,
this);
435 lv_indev_set_read_cb(this->
drv_, [](lv_indev_t *d, lv_indev_data_t *data) {
437 if (
l->touch_pressed_) {
438 data->point.x =
l->touch_point_.x;
439 data->point.y =
l->touch_point_.y;
440 l->parent_->rotate_coordinates(data->point.x, data->point.y);
441 data->state = LV_INDEV_STATE_PRESSED;
443 data->state = LV_INDEV_STATE_RELEASED;
458 auto *scale = lv_obj_get_parent(obj);
459 auto min_value = lv_scale_get_range_min_value(scale);
460 auto max_value = lv_scale_get_range_max_value(scale);
461 value = clamp(value, min_value, max_value);
462 return ((value - min_value) * lv_scale_get_angle_range(scale) / (max_value - min_value) +
463 lv_scale_get_rotation((scale))) %
469 lv_line_set_points(lv_obj, this->points_, 2);
471 lv_obj_get_parent(
obj),
473 auto *indicator =
static_cast<IndicatorLine *
>(lv_event_get_user_data(e));
474 indicator->update_length_();
475 ESP_LOGV(TAG,
"Updated length, value = %d", indicator->angle_);
477 LV_EVENT_SIZE_CHANGED,
this);
482 if (angle != this->angle_) {
483 this->angle_ = angle;
484 this->update_length_();
488void IndicatorLine::update_length_() {
489 auto cx = lv_obj_get_width(lv_obj_get_parent(this->
obj)) / 2;
490 auto cy = lv_obj_get_height(lv_obj_get_parent(this->
obj)) / 2;
492 auto length = lv_obj_get_style_length(this->
obj, LV_PART_MAIN);
493 auto radial_offset = lv_obj_get_style_radial_offset(this->
obj, LV_PART_MAIN);
494 if (LV_COORD_IS_PCT(radial_offset)) {
495 radial_offset = radius * LV_COORD_GET_PCT(radial_offset) / 100;
497 if (LV_COORD_IS_PCT(
length)) {
502 auto x = lv_trigo_cos(this->angle_) / 32768.0f;
503 auto y = lv_trigo_sin(this->angle_) / 32768.0f;
505 this->points_[0].x = radius + radial_offset *
x;
506 this->points_[0].y = radius + radial_offset *
y;
507 this->points_[1].x = radius +
x * (radial_offset +
length);
508 this->points_[1].y = radius +
y * (radial_offset +
length);
509 lv_obj_refresh_self_size(this->
obj);
510 lv_obj_invalidate(this->
obj);
514#ifdef USE_LVGL_KEY_LISTENER
516 this->
drv_ = lv_indev_create();
517 lv_indev_set_type(this->
drv_, type);
518 lv_indev_set_long_press_time(this->
drv_, long_press_time);
519 lv_indev_set_long_press_repeat_time(this->
drv_, long_press_repeat_time);
520 lv_indev_set_user_data(this->
drv_,
this);
521 lv_indev_set_read_cb(this->
drv_, [](lv_indev_t *d, lv_indev_data_t *data) {
523 data->state =
l->pressed_ ? LV_INDEV_STATE_PRESSED : LV_INDEV_STATE_RELEASED;
525 data->enc_diff = (int16_t) (
l->count_ -
l->last_count_);
526 l->last_count_ =
l->count_;
527 data->continue_reading =
false;
532#if defined(USE_LVGL_DROPDOWN) || defined(LV_USE_ROLLER)
535 if (selected >= this->
options_.size())
540static std::string join_string(std::vector<std::string>
options) {
541 return std::accumulate(
543 [](
const std::string &a,
const std::string &b) -> std::string { return a + (!a.empty() ?
"\n" :
"") + b; });
547 auto index = std::find(this->
options_.begin(), this->options_.end(), text);
548 if (index != this->
options_.end()) {
550 lv_obj_send_event(this->
obj, lv_api_event,
nullptr);
560 lv_obj_send_event(this->
obj, LV_EVENT_REFRESH,
nullptr);
565#ifdef USE_LVGL_BUTTONMATRIX
570 [](lv_event_t *event) {
572 if (self->key_callback_.size() == 0)
574 auto key_idx = lv_buttonmatrix_get_selected_button(self->obj);
575 if (key_idx == LV_BUTTONMATRIX_BUTTON_NONE)
577 if (self->key_map_.count(key_idx) != 0) {
578 self->send_key_(self->key_map_[key_idx]);
581 const auto *str = lv_buttonmatrix_get_button_text(self->obj, key_idx);
582 auto len = strlen(str);
584 self->send_key_(*str++);
586 LV_EVENT_PRESSED,
this);
590#ifdef USE_LVGL_KEYBOARD
591static const char *
const KB_SPECIAL_KEYS[] = {
600 [](lv_event_t *event) {
601 auto *self =
static_cast<LvKeyboardType *
>(lv_event_get_user_data(event));
602 if (self->key_callback_.size() == 0)
605 auto key_idx = lv_buttonmatrix_get_selected_button(self->obj);
606 if (key_idx == LV_BUTTONMATRIX_BUTTON_NONE)
608 const char *txt = lv_buttonmatrix_get_button_text(self->obj, key_idx);
611 for (
const auto *kb_special_key : KB_SPECIAL_KEYS) {
612 if (strcmp(txt, kb_special_key) == 0)
616 self->send_key_(*txt++);
618 LV_EVENT_PRESSED,
this);
636 if (!disp->is_idle())
644 int iterations = 6 - lv_display_get_inactive_time(this->
disp_) / 60000;
647 int16_t width = lv_display_get_horizontal_resolution(this->
disp_);
648 int16_t height = lv_display_get_vertical_resolution(this->
disp_);
649 while (iterations-- != 0) {
655 int32_t
size = (
random_uint32() % 25 + 8) / this->draw_rounding * this->draw_rounding;
656 lv_area_t area{.x1 = col, .y1 = row, .x2 = col +
size - 1, .y2 = row +
size - 1};
658 if (area.x2 >= width)
660 if (area.y2 >= height)
661 area.y2 = height - 1;
664 size_t line_len = lv_area_get_width(&area) * lv_area_get_height(&area) / 2;
665 for (
size_t i = 0; i != line_len; i++) {
694 int draw_rounding,
bool resume_on_input,
bool update_when_display_idle,
696 : draw_rounding(draw_rounding),
697 displays_(std::move(displays)),
698 buffer_frac_(buffer_frac),
699 full_refresh_(full_refresh),
700 resume_on_input_(resume_on_input),
701 update_when_display_idle_(update_when_display_idle),
702 rotation_type_(rotation_type) {
703 this->
disp_ = lv_display_create(240, 240);
707 int32_t width = this->
width_;
708 int32_t height = this->
height_;
711 std::swap(width, height);
713 ESP_LOGD(TAG,
"Setting resolution to %u x %u (rotation %d)", (
unsigned) width, (
unsigned) height,
717 display->set_rotation(this->rotation_);
719 lv_display_set_resolution(this->
disp_, width, height);
724 this->
width_ = display->get_native_width();
725 this->
height_ = display->get_native_height();
727 auto width = (this->
width_ + rounding - 1) / rounding * rounding;
728 auto height = (this->
height_ + rounding - 1) / rounding * rounding;
732 auto buf_bytes =
clamp_at_least(width * height / frac * LV_COLOR_DEPTH / 8, MIN_BUFFER_SIZE);
733 void *buffer =
nullptr;
736 buffer = lv_alloc_draw_buf(buf_bytes,
true);
737 if (buffer ==
nullptr)
738 buffer = lv_alloc_draw_buf(buf_bytes,
false);
741 frac = MIN_BUFFER_FRAC;
742 buf_bytes /= MIN_BUFFER_FRAC;
743 buffer = lv_alloc_draw_buf(buf_bytes,
false);
746 if (buffer ==
nullptr) {
751 this->
draw_buf_ =
static_cast<uint8_t *
>(buffer);
753 lv_display_set_color_format(this->
disp_, LV_COLOR_FORMAT_RGB565);
755 lv_display_set_user_data(this->
disp_,
this);
756 lv_display_add_event_cb(this->
disp_, rounder_cb, LV_EVENT_INVALIDATE_AREA,
this);
757 lv_display_set_buffers(this->
disp_, this->
draw_buf_,
nullptr, buf_bytes,
758 this->
full_refresh_ ? LV_DISPLAY_RENDER_MODE_FULL : LV_DISPLAY_RENDER_MODE_PARTIAL);
760 this->
rotate_buf_ =
static_cast<lv_color_t *
>(lv_alloc_draw_buf(buf_bytes,
false));
766#ifdef USE_ESP32_VARIANT_ESP32P4
767 ppa_client_config_t ppa_config{};
768 ppa_config.oper_type = PPA_OPERATION_SRM;
769 ppa_config.max_pending_trans_num = 1;
770 if (ppa_register_client(&ppa_config, &this->
ppa_client_) != ESP_OK) {
771 ESP_LOGW(TAG,
"PPA client registration failed, using software rotation");
783 lv_log_register_print_cb([](lv_log_level_t level,
const char *buf) {
784 auto next = strchr(buf,
')');
787 while (isspace(*buf))
789 if (level >=
sizeof(LOG_LEVEL_MAP) /
sizeof(LOG_LEVEL_MAP[0]))
790 level =
sizeof(LOG_LEVEL_MAP) /
sizeof(LOG_LEVEL_MAP[0]) - 1;
791 esp_log_printf_(LOG_LEVEL_MAP[level], TAG, 0,
"%.*s", (
int) strlen(buf) - 1, buf);
794 this->
show_page(0, LV_SCREEN_LOAD_ANIM_NONE, 0);
795 lv_display_trigger_activity(this->
disp_);
811#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERBOSE
814 auto elapsed =
millis() - now;
816 ESP_LOGV(TAG,
"lv_timer_handler took %dms", (
int) (
millis() - now));
824#ifdef USE_LVGL_ANIMIMG
826 int32_t
duration = lv_animimg_get_duration(obj);
827 lv_animimg_set_duration(obj, 0);
828 lv_animimg_start(obj);
829 lv_animimg_set_duration(obj,
duration);
833 reinterpret_cast<LvglComponent *
>(lv_display_get_user_data(disp_drv))->
flush_cb_(disp_drv, area, color_p);
845 lv_color_t color_end,
int width,
bool local) {
846 auto *scale =
static_cast<lv_obj_t *
>(lv_event_get_target(e));
847 lv_draw_task_t *task = lv_event_get_draw_task(e);
849 if (lv_draw_task_get_type(task) == LV_DRAW_TASK_TYPE_LINE) {
850 auto *line_dsc =
static_cast<lv_draw_line_dsc_t *
>(lv_draw_task_get_draw_dsc(task));
851 int tick = line_dsc->base.id2;
852 if (tick >= range_start && tick <= range_end) {
855 int range = range_end - range_start;
857 ratio =
range == 0 ? 0 : (tick * 255) /
range;
860 ratio = (line_dsc->base.id1 * 255) / (lv_scale_get_total_tick_count(scale) - 1);
862 line_dsc->color = lv_color_mix(color_end, color_start, ratio);
863 line_dsc->width += width;
869static void lv_container_constructor(
const lv_obj_class_t *class_p, lv_obj_t *obj) {
870 LV_TRACE_OBJ_CREATE(
"begin");
876 .base_class = &lv_obj_class,
877 .constructor_cb = lv_container_constructor,
878 .name =
"lv_container",
883 lv_obj_class_init_obj(obj);
894#if defined(USE_HOST) || defined(USE_RP2040) || defined(USE_ESP8266)
896 auto *ptr = malloc(
size);
897 if (ptr ==
nullptr) {
898 ESP_LOGE(esphome::lvgl::TAG,
"Failed to allocate %zu bytes",
size);
906static void *lv_alloc_draw_buf(
size_t size,
bool internal) {
910#elif defined(USE_ESP32)
911static unsigned cap_bits = MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT;
913static void *lv_alloc_draw_buf(
size_t size,
bool internal) {
915 size = LV_ROUND_UP(
size, LV_DRAW_BUF_ALIGN);
916 buffer = heap_caps_aligned_alloc(LV_DRAW_BUF_ALIGN,
size, internal ? MALLOC_CAP_8BIT : cap_bits);
917 if (buffer ==
nullptr)
918 ESP_LOGW(esphome::lvgl::TAG,
"Failed to allocate %zu bytes for %sdraw buffer",
size, internal ?
"internal " :
"");
923 multi_heap_info_t heap_info;
924 heap_caps_get_info(&heap_info, cap_bits);
925 mon_p->total_size = heap_info.total_allocated_bytes + heap_info.total_free_bytes;
926 mon_p->free_size = heap_info.total_free_bytes;
927 mon_p->max_used = heap_info.total_allocated_bytes;
928 mon_p->free_biggest_size = heap_info.largest_free_block;
929 mon_p->used_cnt = heap_info.allocated_blocks;
930 mon_p->free_cnt = heap_info.free_blocks;
931 mon_p->used_pct = heap_info.allocated_blocks * 100 / (heap_info.allocated_blocks + heap_info.free_blocks);
937 ptr = heap_caps_malloc(
size, cap_bits);
938 if (ptr ==
nullptr) {
939 cap_bits = MALLOC_CAP_8BIT;
940 ptr = heap_caps_malloc(
size, cap_bits);
942 if (ptr ==
nullptr) {
943 ESP_LOGE(esphome::lvgl::TAG,
"Failed to allocate %zu bytes",
size);
946 ESP_LOGV(esphome::lvgl::TAG,
"allocate %zu - > %p",
size, ptr);
951 ESP_LOGV(esphome::lvgl::TAG,
"free %p", ptr);
958 ESP_LOGV(esphome::lvgl::TAG,
"realloc %p: %zu", ptr,
size);
959 return heap_caps_realloc(ptr,
size, cap_bits);
void mark_failed()
Mark this component as failed.
void set_parent(T *parent)
Set the parent of this object.
Function-pointer-only templatable storage (4 bytes on 32-bit).
void trigger(const Ts &...x) ESPHOME_ALWAYS_INLINE
Inform the parent automation that the event has triggered.
TemplatableFn< uint32_t > timeout_
IdleTrigger(LvglComponent *parent, TemplatableFn< uint32_t > timeout)
void set_obj(lv_obj_t *lv_obj) override
void set_value(int value)
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
virtual void set_obj(lv_obj_t *lv_obj)
void set_obj(lv_obj_t *lv_obj) override
void set_selected_text(const std::string &text, lv_anim_enable_t anim)
void set_options(std::vector< std::string > options)
std::string get_selected_text()
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.
RotationType rotation_type_
void set_paused(bool paused, bool show_snow)
size_t get_current_page() const
display::DisplayRotation rotation_
Trigger * pause_callback_
void rotate_coordinates(int32_t &x, int32_t &y) const
Trigger * resume_callback_
std::vector< LvPageType * > pages_
void set_rotation(display::DisplayRotation rotation)
void set_resolution_() const
static void add_event_cb(lv_obj_t *obj, event_callback_t callback, lv_event_code_t event)
bool ppa_rotate_(const lv_color_data *src, lv_color_data *dst, uint16_t width, uint16_t height, uint32_t height_rounded)
bool update_when_display_idle_
void dump_config() override
CallbackManager< void(uint32_t)> idle_callbacks_
lv_obj_t * get_screen_active()
void show_next_page(lv_screen_load_anim_t anim, uint32_t time)
Trigger * draw_start_callback_
Trigger * draw_end_callback_
std::vector< display::Display * > displays_
lv_display_t * get_disp()
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)
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)
void add_on_idle_callback(F &&callback)
void add_page(LvPageType *page)
static void static_flush_cb(lv_display_t *disp_drv, const lv_area_t *area, uint8_t *color_p)
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)
void flush_cb_(lv_display_t *disp_drv, const lv_area_t *area, uint8_t *color_p)
void lv_free_core(void *ptr)
void * lv_malloc_core(size_t size)
void lv_mem_monitor_core(lv_mem_monitor_t *mon_p)
void * lv_realloc_core(void *ptr, size_t size)
lv_result_t lv_mem_test_core()
@ DISPLAY_ROTATION_270_DEGREES
@ DISPLAY_ROTATION_180_DEGREES
@ DISPLAY_ROTATION_90_DEGREES
void lv_animimg_stop(lv_obj_t *obj)
void(lv_event_t *) event_callback_t
const lv_obj_class_t LV_CONTAINER_CLASS
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)
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.
lv_event_code_t lv_api_event
std::vector< TouchPoint > TouchPoints_t
T clamp_at_most(T value, U max)
void HOT esp_log_printf_(int level, const char *tag, int line, const char *format,...)
T clamp_at_least(T value, U min)
uint32_t random_uint32()
Return a random 32-bit unsigned integer.
uint32_t IRAM_ATTR HOT millis()