Changed the way the lvgl tick is handled, it was previously called from
the FreeRTOS vApplicationTickHook function and is now called by a timer interrupt every ms. This permits to stop the timer and thus lvgl when it is not needed.
This commit is contained in:
parent
89c33cd7f7
commit
4184be2763
40
src/W800_SDK_v1.00.10/lvgl/lvgl_port/lv_port_tick.c
Normal file
40
src/W800_SDK_v1.00.10/lvgl/lvgl_port/lv_port_tick.c
Normal file
@ -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);
|
||||
}
|
63
src/W800_SDK_v1.00.10/lvgl/lvgl_port/lv_port_tick.h
Normal file
63
src/W800_SDK_v1.00.10/lvgl/lvgl_port/lv_port_tick.h
Normal file
@ -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*/
|
@ -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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user