32 lines
780 B
C++
32 lines
780 B
C++
#include "display.h"
|
|
|
|
#include "esp_log.h"
|
|
#include "lvgl.h"
|
|
|
|
I2C i2c;
|
|
|
|
void setup()
|
|
{
|
|
Display d(i2c);
|
|
|
|
// UI function scope.
|
|
{
|
|
// Lock the mutex due to the LVGL APIs are not thread-safe
|
|
ScopedLock lock;
|
|
|
|
ESP_LOGI(TAG, "Display LVGL Scroll Text");
|
|
lv_obj_t *scr = lv_display_get_screen_active(d.get());
|
|
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.");
|
|
|
|
// 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));
|
|
lv_obj_align(label, LV_ALIGN_TOP_MID, 0, 0);
|
|
}
|
|
}
|
|
|
|
void loop() { }
|