diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-04-21 10:00:05 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-04-21 10:00:05 +1000 |
| commit | f9558044955827b476ce21548d544530c1457026 (patch) | |
| tree | d1153230b993da70778c60dde227747b7527f05d /src/main/main.cpp | |
| parent | 27c63ebb957aa5b942939aea33431ac50d101a26 (diff) | |
| download | tangara-fw-f9558044955827b476ce21548d544530c1457026.tar.gz | |
use a freertos timer for lvgl ticks
Diffstat (limited to 'src/main/main.cpp')
| -rw-r--r-- | src/main/main.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/main.cpp b/src/main/main.cpp index 77a1e14b..b1cee384 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -18,6 +18,8 @@ #include "esp_log.h" #include "font/lv_font.h" #include "freertos/portmacro.h" +#include "freertos/projdefs.h" +#include "freertos/timers.h" #include "hal/gpio_types.h" #include "hal/spi_types.h" #include "lvgl/lvgl.h" @@ -40,8 +42,8 @@ static const char* TAG = "MAIN"; -void IRAM_ATTR tick_hook(void) { - // lv_tick_inc(1); +auto tick_hook(TimerHandle_t xTimer) -> void { + lv_tick_inc(1); } static const size_t kLvglStackSize = 8 * 1024; @@ -64,7 +66,7 @@ extern "C" void lvgl_main(void* voidArgs) { lv_init(); // 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"); std::unique_ptr<drivers::Display> display = |
