mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
Merge pull request #384 from Krastanov/external_ticks
Add a system time callback to be used without `lv_tick_inc`.
This commit is contained in:
commit
a50b6f56d5
@ -24,6 +24,11 @@
|
|||||||
#define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/
|
#define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/
|
||||||
#define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/
|
#define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/
|
||||||
#endif /*LV_MEM_CUSTOM*/
|
#endif /*LV_MEM_CUSTOM*/
|
||||||
|
#define LV_TICK_CUSTOM 0 /*1: use a custom tick source (removing the need to manually update the tick with `lv_tick_inc`) */
|
||||||
|
#if LV_TICK_CUSTOM == 1
|
||||||
|
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the sys time function*/
|
||||||
|
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/
|
||||||
|
#endif /*LV_TICK_CUSTOM*/
|
||||||
|
|
||||||
/*===================
|
/*===================
|
||||||
Graphical settings
|
Graphical settings
|
||||||
|
@ -15,6 +15,10 @@
|
|||||||
#include "lv_hal_tick.h"
|
#include "lv_hal_tick.h"
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#if LV_TICK_CUSTOM == 1
|
||||||
|
#include LV_TICK_CUSTOM_INCLUDE
|
||||||
|
#endif
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
*********************/
|
*********************/
|
||||||
@ -57,6 +61,7 @@ LV_ATTRIBUTE_TICK_INC void lv_tick_inc(uint32_t tick_period)
|
|||||||
*/
|
*/
|
||||||
uint32_t lv_tick_get(void)
|
uint32_t lv_tick_get(void)
|
||||||
{
|
{
|
||||||
|
#if LV_TICK_CUSTOM == 0
|
||||||
uint32_t result;
|
uint32_t result;
|
||||||
do {
|
do {
|
||||||
tick_irq_flag = 1;
|
tick_irq_flag = 1;
|
||||||
@ -64,6 +69,9 @@ uint32_t lv_tick_get(void)
|
|||||||
} while(!tick_irq_flag); /*'lv_tick_inc()' clears this flag which can be in an interrupt. Continue until make a non interrupted cycle */
|
} while(!tick_irq_flag); /*'lv_tick_inc()' clears this flag which can be in an interrupt. Continue until make a non interrupted cycle */
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
#else
|
||||||
|
return LV_TICK_CUSTOM_SYS_TIME_EXPR;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user