From a4d950a2f279a5033e246871cc6f777049dd573c Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 9 Nov 2018 12:36:38 +0100 Subject: [PATCH] lv_anim: add lv_anim_count_running --- lv_misc/lv_anim.c | 13 +++++++++++++ lv_misc/lv_anim.h | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/lv_misc/lv_anim.c b/lv_misc/lv_anim.c index 2bfbf788e..ca0d4b63d 100644 --- a/lv_misc/lv_anim.c +++ b/lv_misc/lv_anim.c @@ -115,6 +115,19 @@ bool lv_anim_del(void * var, lv_anim_fp_t fp) return del; } +/** + * Get the number of currently running animations + * @return the number of running animations + */ +uint16_t lv_anim_count_running(void) +{ + uint16_t cnt = 0; + lv_anim_t * a; + LL_READ(anim_ll, a) cnt++; + + return cnt++; +} + /** * Calculate the time of an animation with a given speed and the start and end values * @param speed speed of animation in unit/sec diff --git a/lv_misc/lv_anim.h b/lv_misc/lv_anim.h index 544f50d9d..aaf1c6bff 100644 --- a/lv_misc/lv_anim.h +++ b/lv_misc/lv_anim.h @@ -99,6 +99,12 @@ void lv_anim_create(lv_anim_t * anim_p); */ bool lv_anim_del(void * var, lv_anim_fp_t fp); +/** + * Get the number of currently running animations + * @return the number of running animations + */ +uint16_t lv_anim_count_running(void); + /** * Calculate the time of an animation with a given speed and the start and end values * @param speed speed of animation in unit/sec