use a freertos timer for lvgl ticks

This commit is contained in:
jacqueline
2023-04-21 10:00:05 +10:00
parent 27c63ebb95
commit f955804495
+5 -3
View File
@@ -18,6 +18,8 @@
#include "esp_log.h" #include "esp_log.h"
#include "font/lv_font.h" #include "font/lv_font.h"
#include "freertos/portmacro.h" #include "freertos/portmacro.h"
#include "freertos/projdefs.h"
#include "freertos/timers.h"
#include "hal/gpio_types.h" #include "hal/gpio_types.h"
#include "hal/spi_types.h" #include "hal/spi_types.h"
#include "lvgl/lvgl.h" #include "lvgl/lvgl.h"
@@ -40,8 +42,8 @@
static const char* TAG = "MAIN"; static const char* TAG = "MAIN";
void IRAM_ATTR tick_hook(void) { auto tick_hook(TimerHandle_t xTimer) -> void {
// lv_tick_inc(1); lv_tick_inc(1);
} }
static const size_t kLvglStackSize = 8 * 1024; static const size_t kLvglStackSize = 8 * 1024;
@@ -64,7 +66,7 @@ extern "C" void lvgl_main(void* voidArgs) {
lv_init(); lv_init();
// LVGL has been initialised, so we can now start reporting ticks to it. // LVGL has been initialised, so we can now start reporting ticks to it.
esp_register_freertos_tick_hook(&tick_hook); xTimerCreate("lv_tick", pdMS_TO_TICKS(1), pdTRUE, NULL, &tick_hook);
ESP_LOGI(TAG, "init display"); ESP_LOGI(TAG, "init display");
std::unique_ptr<drivers::Display> display = std::unique_ptr<drivers::Display> display =