Merge pull request #2117 from xiaoxiang781216/anim
fix(task): change all task related term to timer
This commit is contained in:
@@ -107,6 +107,6 @@ void setup()
|
||||
|
||||
void loop()
|
||||
{
|
||||
lv_task_handler(); /* let the GUI do its work */
|
||||
lv_timer_handler(); /* let the GUI do its work */
|
||||
delay(5);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#if LV_USE_ARC && LV_BUILD_EXAMPLES
|
||||
|
||||
/**
|
||||
* An `lv_task` to call periodically to set the angles of the arc
|
||||
* An `lv_timer` to call periodically to set the angles of the arc
|
||||
* @param t
|
||||
*/
|
||||
static void arc_loader(lv_timer_t * t)
|
||||
@@ -31,7 +31,7 @@ void lv_example_arc_2(void)
|
||||
lv_arc_set_angles(arc, 270, 270);
|
||||
lv_obj_align(arc, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
/* Create an `lv_task` to update the arc.
|
||||
/* Create an `lv_timer` to update the arc.
|
||||
* Store the `arc` in the user data*/
|
||||
lv_timer_create(arc_loader, 20, arc);
|
||||
}
|
||||
|
||||
@@ -225,8 +225,8 @@ typedef void * lv_user_data_t;
|
||||
/* Define a custom attribute to `lv_tick_inc` function */
|
||||
#define LV_ATTRIBUTE_TICK_INC
|
||||
|
||||
/* Define a custom attribute to `lv_task_handler` function */
|
||||
#define LV_ATTRIBUTE_TASK_HANDLER
|
||||
/* Define a custom attribute to `lv_timer_handler` function */
|
||||
#define LV_ATTRIBUTE_TIMER_HANDLER
|
||||
|
||||
/* Define a custom attribute to `lv_disp_flush_ready` function */
|
||||
#define LV_ATTRIBUTE_FLUSH_READY
|
||||
|
||||
@@ -343,6 +343,7 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
|
||||
* LV_LOG_LEVEL_INFO Log important events
|
||||
* LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
|
||||
* LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
|
||||
* LV_LOG_LEVEL_USER Only logs added by the user
|
||||
* LV_LOG_LEVEL_NONE Do not log anything */
|
||||
#ifndef LV_LOG_LEVEL
|
||||
# ifdef CONFIG_LV_LOG_LEVEL
|
||||
@@ -601,12 +602,12 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Define a custom attribute to `lv_task_handler` function */
|
||||
#ifndef LV_ATTRIBUTE_TASK_HANDLER
|
||||
# ifdef CONFIG_LV_ATTRIBUTE_TASK_HANDLER
|
||||
# define LV_ATTRIBUTE_TASK_HANDLER CONFIG_LV_ATTRIBUTE_TASK_HANDLER
|
||||
/* Define a custom attribute to `lv_timer_handler` function */
|
||||
#ifndef LV_ATTRIBUTE_TIMER_HANDLER
|
||||
# ifdef CONFIG_LV_ATTRIBUTE_TIMER_HANDLER
|
||||
# define LV_ATTRIBUTE_TIMER_HANDLER CONFIG_LV_ATTRIBUTE_TIMER_HANDLER
|
||||
# else
|
||||
# define LV_ATTRIBUTE_TASK_HANDLER
|
||||
# define LV_ATTRIBUTE_TIMER_HANDLER
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -370,16 +370,16 @@ void lv_disp_clean_dcache(lv_disp_t * disp)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a pointer to the screen refresher task to
|
||||
* modify its parameters with `lv_task_...` functions.
|
||||
* Get a pointer to the screen refresher timer to
|
||||
* modify its parameters with `lv_timer_...` functions.
|
||||
* @param disp pointer to a display
|
||||
* @return pointer to the display refresher task. (NULL on error)
|
||||
* @return pointer to the display refresher timer. (NULL on error)
|
||||
*/
|
||||
lv_timer_t * _lv_disp_get_refr_task(lv_disp_t * disp)
|
||||
lv_timer_t * _lv_disp_get_refr_timer(lv_disp_t * disp)
|
||||
{
|
||||
if(!disp) disp = lv_disp_get_default();
|
||||
if(!disp) {
|
||||
LV_LOG_WARN("lv_disp_get_refr_task: no display registered");
|
||||
LV_LOG_WARN("lv_disp_get_refr_timer: no display registered");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -144,12 +144,12 @@ void lv_disp_trig_activity(lv_disp_t * disp);
|
||||
void lv_disp_clean_dcache(lv_disp_t * disp);
|
||||
|
||||
/**
|
||||
* Get a pointer to the screen refresher task to
|
||||
* modify its parameters with `lv_task_...` functions.
|
||||
* Get a pointer to the screen refresher timer to
|
||||
* modify its parameters with `lv_timer_...` functions.
|
||||
* @param disp pointer to a display
|
||||
* @return pointer to the display refresher task. (NULL on error)
|
||||
* @return pointer to the display refresher timer. (NULL on error)
|
||||
*/
|
||||
lv_timer_t * _lv_disp_get_refr_task(lv_disp_t * disp);
|
||||
lv_timer_t * _lv_disp_get_refr_timer(lv_disp_t * disp);
|
||||
|
||||
/*------------------------------------------------
|
||||
* To improve backward compatibility
|
||||
|
||||
@@ -61,13 +61,13 @@ static lv_obj_t * indev_obj_act = NULL;
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
void lv_indev_read_task_cb(lv_timer_t * task)
|
||||
void lv_indev_read_timer_cb(lv_timer_t * timer)
|
||||
{
|
||||
INDEV_TRACE("begin");
|
||||
|
||||
lv_indev_data_t data;
|
||||
|
||||
indev_act = task->user_data;
|
||||
indev_act = timer->user_data;
|
||||
|
||||
/*Read and process all indevs*/
|
||||
if(indev_act->driver.disp == NULL) return; /*Not assigned to any displays*/
|
||||
@@ -272,10 +272,10 @@ lv_obj_t * lv_indev_get_obj_act(void)
|
||||
return indev_obj_act;
|
||||
}
|
||||
|
||||
lv_timer_t * lv_indev_get_read_task(lv_disp_t * indev)
|
||||
lv_timer_t * lv_indev_get_read_timer(lv_disp_t * indev)
|
||||
{
|
||||
if(!indev) {
|
||||
LV_LOG_WARN("lv_indev_get_read_task: indev was NULL");
|
||||
LV_LOG_WARN("lv_indev_get_read_timer: indev was NULL");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ extern "C" {
|
||||
* Called periodically to read the input devices
|
||||
* @param param pointer to and input device to read
|
||||
*/
|
||||
void lv_indev_read_task_cb(lv_timer_t * task);
|
||||
void lv_indev_read_timer_cb(lv_timer_t * timer);
|
||||
|
||||
/**
|
||||
* Enable or disable an input devices
|
||||
@@ -150,12 +150,12 @@ void lv_indev_wait_release(lv_indev_t * indev);
|
||||
lv_obj_t * lv_indev_get_obj_act(void);
|
||||
|
||||
/**
|
||||
* Get a pointer to the indev read task to
|
||||
* modify its parameters with `lv_task_...` functions.
|
||||
* Get a pointer to the indev read timer to
|
||||
* modify its parameters with `lv_timer_...` functions.
|
||||
* @param indev pointer to an input device
|
||||
* @return pointer to the indev read refresher task. (NULL on error)
|
||||
* @return pointer to the indev read refresher timer. (NULL on error)
|
||||
*/
|
||||
lv_timer_t * lv_indev_get_read_task(lv_disp_t * indev);
|
||||
lv_timer_t * lv_indev_get_read_timer(lv_disp_t * indev);
|
||||
|
||||
/**
|
||||
* Search the most top, clickable object by a point
|
||||
|
||||
@@ -80,8 +80,8 @@ void _lv_refr_init(void)
|
||||
|
||||
/**
|
||||
* Redraw the invalidated areas now.
|
||||
* Normally the redrawing is periodically executed in `lv_task_handler` but a long blocking process
|
||||
* can prevent the call of `lv_task_handler`. In this case if the GUI is updated in the process
|
||||
* Normally the redrawing is periodically executed in `lv_timer_handler` but a long blocking process
|
||||
* can prevent the call of `lv_timer_handler`. In this case if the GUI is updated in the process
|
||||
* (e.g. progress bar) this function can be called when the screen should be updated.
|
||||
* @param disp pointer to display to refresh. NULL to refresh all displays.
|
||||
*/
|
||||
@@ -90,13 +90,13 @@ void lv_refr_now(lv_disp_t * disp)
|
||||
lv_anim_refr_now();
|
||||
|
||||
if(disp) {
|
||||
_lv_disp_refr_task(disp->refr_timer);
|
||||
_lv_disp_refr_timer(disp->refr_timer);
|
||||
}
|
||||
else {
|
||||
lv_disp_t * d;
|
||||
d = lv_disp_get_next(NULL);
|
||||
while(d) {
|
||||
_lv_disp_refr_task(d->refr_timer);
|
||||
_lv_disp_refr_timer(d->refr_timer);
|
||||
d = lv_disp_get_next(d);
|
||||
}
|
||||
}
|
||||
@@ -181,9 +181,9 @@ void _lv_refr_set_disp_refreshing(lv_disp_t * disp)
|
||||
|
||||
/**
|
||||
* Called periodically to handle the refreshing
|
||||
* @param task pointer to the task itself
|
||||
* @param tmr pointer to the timer itself
|
||||
*/
|
||||
void _lv_disp_refr_task(lv_timer_t * tmr)
|
||||
void _lv_disp_refr_timer(lv_timer_t * tmr)
|
||||
{
|
||||
TRACE_REFR("begin");
|
||||
|
||||
@@ -193,7 +193,7 @@ void _lv_disp_refr_task(lv_timer_t * tmr)
|
||||
disp_refr = tmr->user_data;
|
||||
|
||||
#if LV_USE_PERF_MONITOR == 0
|
||||
/* Ensure the task does not run again automatically.
|
||||
/* Ensure the timer does not run again automatically.
|
||||
* This is done before refreshing in case refreshing invalidates something else.
|
||||
*/
|
||||
lv_timer_pause(tmr, true);
|
||||
|
||||
@@ -49,8 +49,8 @@ void _lv_refr_init(void);
|
||||
|
||||
/**
|
||||
* Redraw the invalidated areas now.
|
||||
* Normally the redrawing is periodically executed in `lv_task_handler` but a long blocking process
|
||||
* can prevent the call of `lv_task_handler`. In this case if the GUI is updated in the process
|
||||
* Normally the redrawing is periodically executed in `lv_timer_handler` but a long blocking process
|
||||
* can prevent the call of `lv_timer_handler`. In this case if the GUI is updated in the process
|
||||
* (e.g. progress bar) this function can be called when the screen should be updated.
|
||||
* @param disp pointer to display to refresh. NULL to refresh all displays.
|
||||
*/
|
||||
@@ -88,9 +88,9 @@ uint32_t lv_refr_get_fps_avg(void);
|
||||
|
||||
/**
|
||||
* Called periodically to handle the refreshing
|
||||
* @param task pointer to the task itself
|
||||
* @param timer pointer to the timer itself
|
||||
*/
|
||||
void _lv_disp_refr_task(lv_timer_t * task);
|
||||
void _lv_disp_refr_timer(lv_timer_t * timer);
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
|
||||
@@ -122,8 +122,8 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver)
|
||||
lv_disp_t * disp_def_tmp = disp_def;
|
||||
disp_def = disp; /*Temporarily change the default screen to create the default screens on the
|
||||
new display*/
|
||||
/*Create a refresh task*/
|
||||
disp->refr_timer = lv_timer_create(_lv_disp_refr_task, LV_DISP_DEF_REFR_PERIOD, disp);
|
||||
/*Create a refresh timer*/
|
||||
disp->refr_timer = lv_timer_create(_lv_disp_refr_timer, LV_DISP_DEF_REFR_PERIOD, disp);
|
||||
LV_ASSERT_MALLOC(disp->refr_timer);
|
||||
if(disp->refr_timer == NULL) return NULL;
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ typedef struct _lv_disp_t {
|
||||
/**< Driver to the display*/
|
||||
lv_disp_drv_t driver;
|
||||
|
||||
/**< A task which periodically checks the dirty areas and refreshes them*/
|
||||
/**< A timer which periodically checks the dirty areas and refreshes them*/
|
||||
lv_timer_t * refr_timer;
|
||||
|
||||
/**< The theme assigned to the screen*/
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
void lv_indev_read_task_cb(lv_timer_t * task);
|
||||
void lv_indev_read_timer_cb(lv_timer_t * timer);
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
@@ -93,12 +93,11 @@ lv_indev_t * lv_indev_drv_register(lv_indev_drv_t * driver)
|
||||
lv_memset_00(indev, sizeof(lv_indev_t));
|
||||
lv_memcpy(&indev->driver, driver, sizeof(lv_indev_drv_t));
|
||||
|
||||
indev->proc.reset_query = 1;
|
||||
indev->cursor = NULL;
|
||||
indev->group = NULL;
|
||||
indev->btn_points = NULL;
|
||||
|
||||
indev->driver.read_task = lv_timer_create(lv_indev_read_task_cb, LV_INDEV_DEF_READ_PERIOD, indev);
|
||||
indev->proc.reset_query = 1;
|
||||
indev->cursor = NULL;
|
||||
indev->group = NULL;
|
||||
indev->btn_points = NULL;
|
||||
indev->driver.read_timer = lv_timer_create(lv_indev_read_timer_cb, LV_INDEV_DEF_READ_PERIOD, indev);
|
||||
|
||||
return indev;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ typedef struct _lv_indev_drv_t {
|
||||
struct _lv_disp_t * disp;
|
||||
|
||||
/**< Task to read the periodically read the input device*/
|
||||
lv_timer_t * read_task;
|
||||
lv_timer_t * read_timer;
|
||||
|
||||
/**< Number of pixels to slide before actually drag the object*/
|
||||
uint8_t scroll_limit;
|
||||
|
||||
@@ -30,14 +30,14 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void anim_task(lv_timer_t * param);
|
||||
static void anim_timer(lv_timer_t * param);
|
||||
static void anim_mark_list_change(void);
|
||||
static void anim_ready_handler(lv_anim_t * a);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static uint32_t last_task_run;
|
||||
static uint32_t last_timer_run;
|
||||
static bool anim_list_changed;
|
||||
static bool anim_run_round;
|
||||
static lv_timer_t * _lv_anim_tmr;
|
||||
@@ -63,8 +63,8 @@ const lv_anim_path_t lv_anim_path_def = {.cb = lv_anim_path_linear};
|
||||
void _lv_anim_core_init(void)
|
||||
{
|
||||
_lv_ll_init(&LV_GC_ROOT(_lv_anim_ll), sizeof(lv_anim_t));
|
||||
_lv_anim_tmr = lv_timer_create(anim_task, LV_DISP_DEF_REFR_PERIOD, NULL);
|
||||
anim_mark_list_change(); /*Turn off the animation task*/
|
||||
_lv_anim_tmr = lv_timer_create(anim_timer, LV_DISP_DEF_REFR_PERIOD, NULL);
|
||||
anim_mark_list_change(); /*Turn off the animation timer*/
|
||||
anim_list_changed = false;
|
||||
}
|
||||
|
||||
@@ -97,9 +97,9 @@ void lv_anim_start(lv_anim_t * a)
|
||||
|
||||
if(a->exec_cb != NULL) lv_anim_del(a->var, a->exec_cb); /*fp == NULL would delete all animations of var*/
|
||||
|
||||
/*If the list is empty the anim task was suspended and it's last run measure is invalid*/
|
||||
/*If the list is empty the anim timer was suspended and it's last run measure is invalid*/
|
||||
if(_lv_ll_is_empty(&LV_GC_ROOT(_lv_anim_ll))) {
|
||||
last_task_run = lv_tick_get();
|
||||
last_timer_run = lv_tick_get();
|
||||
}
|
||||
|
||||
/*Add the new animation to the animation linked list*/
|
||||
@@ -124,7 +124,7 @@ void lv_anim_start(lv_anim_t * a)
|
||||
}
|
||||
|
||||
/* Creating an animation changed the linked list.
|
||||
* It's important if it happens in a ready callback. (see `anim_task`)*/
|
||||
* It's important if it happens in a ready callback. (see `anim_timer`)*/
|
||||
anim_mark_list_change();
|
||||
|
||||
TRACE_ANIM("finished");
|
||||
@@ -171,7 +171,7 @@ bool lv_anim_del(void * var, lv_anim_exec_xcb_t exec_cb)
|
||||
if(a->var == var && (a->exec_cb == exec_cb || exec_cb == NULL)) {
|
||||
_lv_ll_remove(&LV_GC_ROOT(_lv_anim_ll), a);
|
||||
lv_mem_free(a);
|
||||
anim_mark_list_change(); /*Read by `anim_task`. It need to know if a delete occurred in
|
||||
anim_mark_list_change(); /*Read by `anim_timer`. It need to know if a delete occurred in
|
||||
the linked list*/
|
||||
del = true;
|
||||
}
|
||||
@@ -236,12 +236,12 @@ uint32_t lv_anim_speed_to_time(uint32_t speed, int32_t start, int32_t end)
|
||||
/**
|
||||
* Manually refresh the state of the animations.
|
||||
* Useful to make the animations running in a blocking process where
|
||||
* `lv_task_handler` can't run for a while.
|
||||
* `lv_timer_handler` can't run for a while.
|
||||
* Shouldn't be used directly because it is called in `lv_refr_now()`.
|
||||
*/
|
||||
void lv_anim_refr_now(void)
|
||||
{
|
||||
anim_task(NULL);
|
||||
anim_timer(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -434,11 +434,11 @@ int32_t lv_anim_path_step(const lv_anim_path_t * path, const lv_anim_t * a)
|
||||
* Periodically handle the animations.
|
||||
* @param param unused
|
||||
*/
|
||||
static void anim_task(lv_timer_t * param)
|
||||
static void anim_timer(lv_timer_t * param)
|
||||
{
|
||||
(void)param;
|
||||
|
||||
uint32_t elaps = lv_tick_elaps(last_task_run);
|
||||
uint32_t elaps = lv_tick_elaps(last_timer_run);
|
||||
|
||||
/*Flip the run round*/
|
||||
anim_run_round = anim_run_round ? false : true;
|
||||
@@ -494,7 +494,7 @@ static void anim_task(lv_timer_t * param)
|
||||
a = _lv_ll_get_next(&LV_GC_ROOT(_lv_anim_ll), a);
|
||||
}
|
||||
|
||||
last_task_run = lv_tick_get();
|
||||
last_timer_run = lv_tick_get();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -366,7 +366,7 @@ uint32_t lv_anim_speed_to_time(uint32_t speed, int32_t start, int32_t end);
|
||||
/**
|
||||
* Manually refresh the state of the animations.
|
||||
* Useful to make the animations running in a blocking process where
|
||||
* `lv_task_handler` can't run for a while.
|
||||
* `lv_timer_handler` can't run for a while.
|
||||
* Shouldn't be used directly because it is called in `lv_refr_now()`.
|
||||
*/
|
||||
void lv_anim_refr_now(void);
|
||||
|
||||
@@ -35,7 +35,7 @@ typedef void (*lv_async_cb_t)(void *);
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Call an asynchronous function the next time lv_task_handler() is run. This function is likely to return
|
||||
* Call an asynchronous function the next time lv_timer_handler() is run. This function is likely to return
|
||||
* **before** the call actually happens!
|
||||
* @param async_xcb a callback which is the task itself.
|
||||
* (the 'x' in the argument name indicates that its not a fully generic function because it not follows
|
||||
|
||||
Reference in New Issue
Block a user