#include #include "driver/gpio.h" #include "esp_spi_flash.h" #include "esp_system.h" #include "nvs_flash.h" #include "sdkconfig.h" // #include "freertos/FreeRTOS.h" #include "freertos/task.h" // #include "impl_lvgl.h" static esp_err_t app_init_nvs(void) { esp_err_t ret = nvs_flash_init(); if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { ESP_ERROR_CHECK(nvs_flash_erase()); ret = nvs_flash_init(); } return ret; } static esp_err_t app_init_gpio(void) { return gpio_install_isr_service(0); } esp_err_t impl_lvgl_init(void); void app_main(void) { ESP_ERROR_CHECK(app_init_nvs()); ESP_ERROR_CHECK(app_init_gpio()); ESP_ERROR_CHECK(impl_lvgl_init()); /*Create a style for the shadow*/ impl_lvgl_lock(); lv_obj_t *test_label = lv_label_create(lv_scr_act()); lv_label_set_recolor(test_label, true); lv_label_set_text(test_label, "#000000 Test Label with# #808080 ReColor #"); lv_obj_set_width(test_label, 400); lv_obj_set_style_text_align(test_label, LV_TEXT_ALIGN_CENTER, 0); lv_obj_align(test_label, LV_ALIGN_CENTER, 0, -25); impl_lvgl_unlock(); char text_buf[32]; /* Dead loop */ for (;;) { vTaskDelay(pdMS_TO_TICKS(2000)); snprintf(text_buf, 32, "C=%d", xTaskGetTickCount()); impl_lvgl_lock(); lv_label_set_text(test_label, text_buf); lv_obj_set_style_text_align(test_label, LV_TEXT_ALIGN_CENTER, 0); impl_lvgl_unlock(); } }