#include "display.h" #include "esp_log.h" #include "lvgl.h" void setup() { Display d; ESP_LOGI(TAG, "Display LVGL Scroll Text"); // Lock the mutex due to the LVGL APIs are not thread-safe _lock_acquire(&Display::lvgl_api_lock_); // UI function { lv_obj_t *scr = lv_display_get_screen_active(d.get_display()); lv_obj_t *label = lv_label_create(scr); // Circular scroll lv_label_set_long_mode(label, LV_LABEL_LONG_SCROLL_CIRCULAR); lv_label_set_text(label, "Hello hello hello hello hello hello hello hello."); // Size of the screen // if you use rotation 90 or 270 use lv_display_get_vertical_resolution lv_obj_set_width(label, lv_display_get_horizontal_resolution(d.get_display())); lv_obj_align(label, LV_ALIGN_TOP_MID, 0, 0); } _lock_release(&Display::lvgl_api_lock_); } void loop() { }