diff --git a/src/W800_SDK_v1.00.10/lvgl/lvgl_port/lv_port_tick.c b/src/W800_SDK_v1.00.10/lvgl/lvgl_port/lv_port_tick.c new file mode 100644 index 0000000..df7e1d2 --- /dev/null +++ b/src/W800_SDK_v1.00.10/lvgl/lvgl_port/lv_port_tick.c @@ -0,0 +1,40 @@ + +#include "wm_include.h" +#include "lvgl.h" +#include "app_log.h" + +static uint8_t lv_tick_timer_id = WM_TIMER_ID_INVALID; + +static void lv_tick_timer_irq_cb(void *arg) +{ + (void)arg; + lv_tick_inc(1); +} + +void lv_port_tick_init(void) +{ + if(WM_TIMER_ID_INVALID == lv_tick_timer_id) + { + struct tls_timer_cfg lv_tick_timer_cfg = + { + .is_repeat = true, + .unit = TLS_TIMER_UNIT_MS, + .timeout = 1, + .callback = &(lv_tick_timer_irq_cb), + .arg = NULL, + }; + + if((lv_tick_timer_id = tls_timer_create(&lv_tick_timer_cfg)) == WM_TIMER_ID_INVALID) + APP_LOG_ERROR("Failed to create LVGL tick timer"); + } +} + +void lv_port_tick_start(void) +{ + tls_timer_start(lv_tick_timer_id); +} + +void lv_port_tick_stop(void) +{ + tls_timer_stop(lv_tick_timer_id); +} \ No newline at end of file diff --git a/src/W800_SDK_v1.00.10/lvgl/lvgl_port/lv_port_tick.h b/src/W800_SDK_v1.00.10/lvgl/lvgl_port/lv_port_tick.h new file mode 100644 index 0000000..343e6fe --- /dev/null +++ b/src/W800_SDK_v1.00.10/lvgl/lvgl_port/lv_port_tick.h @@ -0,0 +1,63 @@ +/** + * @file lv_port_tick.h + * + */ + +/*Copy this file as "lv_port_tick.h" and set this value to "1" to enable content*/ +#if 1 + +#ifndef LV_PORT_TICK_H +#define LV_PORT_TICK_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * @brief Creates the timer used to call @ref lv_tick_inc periodically. + * This is needed to run lvgl. + * @note This funcion does not start the timer, you must call @ref lv_port_tick_start for that ! + * + */ +void lv_port_tick_init(void); + +/** + * @brief Starts the timer used to call @ref lv_tick_inc periodically. @ref lv_port_tick_init should be called first at least once. + * + */ +void lv_port_tick_start(void); + +/** + * @brief Stops the timer which calls @ref lv_tick_inc periodically. + * This function can be used to pause lvgl. + * + */ +void lv_port_tick_stop(void); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_PORT_TICK_H*/ + +#endif /*Disable/Enable content*/ \ No newline at end of file diff --git a/src/W800_SDK_v1.00.10/lvgl/lvgl_port/lvgl_port_tick.c b/src/W800_SDK_v1.00.10/lvgl/lvgl_port/lvgl_port_tick.c deleted file mode 100644 index 96cf5cf..0000000 --- a/src/W800_SDK_v1.00.10/lvgl/lvgl_port/lvgl_port_tick.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "FreeRTOS.h" -#include "lvgl.h" - -void vApplicationTickHook(void) -{ - /* One tick is 2 ms because configTICK_RATE_HZ = 500. */ - lv_tick_inc(2); -} \ No newline at end of file