diff --git a/project/gui/lvgl/lvgl8/lvgl/src/misc/lv_anim.h b/project/gui/lvgl/lvgl8/lvgl/src/misc/lv_anim.h index a4f6380e3..bcdb50441 100644 --- a/project/gui/lvgl/lvgl8/lvgl/src/misc/lv_anim.h +++ b/project/gui/lvgl/lvgl8/lvgl/src/misc/lv_anim.h @@ -327,6 +327,26 @@ static inline uint32_t lv_anim_get_delay(lv_anim_t * a) */ uint32_t lv_anim_get_playtime(lv_anim_t * a); +/** + * Get the duration of an animation + * @param a pointer to an initialized `lv_anim_t` variable + * @return the duration of the animation in milliseconds + */ +static inline uint32_t lv_anim_get_time(lv_anim_t * a) +{ + return a->time; +} + +/** + * Get the repeat count of the animation. + * @param a pointer to an initialized `lv_anim_t` variable + * @return the repeat count or `LV_ANIM_REPEAT_INFINITE` for infinite repetition. 0: disabled repetition. + */ +static inline uint16_t lv_anim_get_repeat_count(lv_anim_t * a) +{ + return a->repeat_cnt; +} + /** * Get the user_data field of the animation * @param a pointer to an initialized `lv_anim_t` variable diff --git a/project/gui/lvgl/lvgl8/lvgl/src/misc/lv_printf.c b/project/gui/lvgl/lvgl8/lvgl/src/misc/lv_printf.c index 33b22cf70..2561c38be 100644 --- a/project/gui/lvgl/lvgl8/lvgl/src/misc/lv_printf.c +++ b/project/gui/lvgl/lvgl8/lvgl/src/misc/lv_printf.c @@ -547,7 +547,7 @@ static size_t _etoa(out_fct_type out, char * buffer, size_t idx, size_t maxlen, #endif // PRINTF_SUPPORT_FLOAT // internal vsnprintf -static int _vsnprintf(out_fct_type out, char * buffer, const size_t maxlen, const char * format, va_list va) +static int _lv_vsnprintf(out_fct_type out, char * buffer, const size_t maxlen, const char * format, va_list va) { unsigned int flags, width, precision, n; size_t idx = 0U; @@ -754,7 +754,7 @@ static int _vsnprintf(out_fct_type out, char * buffer, const size_t maxlen, cons va_list copy; va_copy(copy, *vaf->va); - idx += _vsnprintf(out, buffer + idx, maxlen - idx, vaf->fmt, copy); + idx += _lv_vsnprintf(out, buffer + idx, maxlen - idx, vaf->fmt, copy); va_end(copy); } else { @@ -866,14 +866,14 @@ int lv_snprintf_builtin(char * buffer, size_t count, const char * format, ...) { va_list va; va_start(va, format); - const int ret = _vsnprintf(_out_buffer, buffer, count, format, va); + const int ret = _lv_vsnprintf(_out_buffer, buffer, count, format, va); va_end(va); return ret; } int lv_vsnprintf_builtin(char * buffer, size_t count, const char * format, va_list va) { - return _vsnprintf(_out_buffer, buffer, count, format, va); + return _lv_vsnprintf(_out_buffer, buffer, count, format, va); } #endif diff --git a/project/gui/lvgl/lvgl8/lvgl/src/widgets/animimg/lv_animimg.c b/project/gui/lvgl/lvgl8/lvgl/src/widgets/animimg/lv_animimg.c index 87c8ff8ae..4ed09af06 100644 --- a/project/gui/lvgl/lvgl8/lvgl/src/widgets/animimg/lv_animimg.c +++ b/project/gui/lvgl/lvgl8/lvgl/src/widgets/animimg/lv_animimg.c @@ -113,6 +113,34 @@ void lv_animimg_set_repeat_count(lv_obj_t * obj, uint16_t count) * Getter functions *====================*/ +lv_img_dsc_t ** lv_animimg_get_src(lv_obj_t * obj) +{ + LV_ASSERT_OBJ(obj, MY_CLASS); + lv_animimg_t * animimg = (lv_animimg_t *)obj; + return animimg->dsc; +} + +uint8_t lv_animimg_get_src_count(lv_obj_t * obj) +{ + LV_ASSERT_OBJ(obj, MY_CLASS); + lv_animimg_t * animimg = (lv_animimg_t *)obj; + return animimg->pic_count; +} + +uint32_t lv_animimg_get_duration(lv_obj_t * obj) +{ + LV_ASSERT_OBJ(obj, MY_CLASS); + lv_animimg_t * animimg = (lv_animimg_t *)obj; + return lv_anim_get_time(&animimg->anim); +} + +uint16_t lv_animimg_get_repeat_count(lv_obj_t * obj) +{ + LV_ASSERT_OBJ(obj, MY_CLASS); + lv_animimg_t * animimg = (lv_animimg_t *)obj; + return lv_anim_get_repeat_count(&animimg->anim); +} + /********************** * STATIC FUNCTIONS **********************/ diff --git a/project/gui/lvgl/lvgl8/lvgl/src/widgets/animimg/lv_animimg.h b/project/gui/lvgl/lvgl8/lvgl/src/widgets/animimg/lv_animimg.h index a92b4a347..8486e372e 100644 --- a/project/gui/lvgl/lvgl8/lvgl/src/widgets/animimg/lv_animimg.h +++ b/project/gui/lvgl/lvgl8/lvgl/src/widgets/animimg/lv_animimg.h @@ -85,7 +85,7 @@ void lv_animimg_start(lv_obj_t * obj); void lv_animimg_set_duration(lv_obj_t * img, uint32_t duration); /** - * Set the image animation reapeatly play times. + * Set the image animation repeatly play times. * @param img pointer to an animation image object */ void lv_animimg_set_repeat_count(lv_obj_t * img, uint16_t count); @@ -94,6 +94,34 @@ void lv_animimg_set_repeat_count(lv_obj_t * img, uint16_t count); * Getter functions *====================*/ +/** + * Get the image animation images source. + * @param img pointer to an animation image object + * @return a pointer that will point to a series images + */ +lv_img_dsc_t ** lv_animimg_get_src(lv_obj_t * img); + +/** + * Get the image animation images source. + * @param img pointer to an animation image object + * @return the number of source images + */ +uint8_t lv_animimg_get_src_count(lv_obj_t * img); + +/** + * Get the image animation duration time. unit:ms + * @param img pointer to an animation image object + * @return the animation duration time + */ +uint32_t lv_animimg_get_duration(lv_obj_t * img); + +/** + * Get the image animation repeat play times. + * @param img pointer to an animation image object + * @return the repeat count + */ +uint16_t lv_animimg_get_repeat_count(lv_obj_t * img); + #endif /*LV_USE_ANIMIMG*/ #ifdef __cplusplus