Skip to content

Commit

Permalink
[lvgl]: update
Browse files Browse the repository at this point in the history
  • Loading branch information
jiale-gdyd committed Nov 2, 2022
1 parent 8c38256 commit e1a1108
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 5 deletions.
20 changes: 20 additions & 0 deletions project/gui/lvgl/lvgl8/lvgl/src/misc/lv_anim.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions project/gui/lvgl/lvgl8/lvgl/src/misc/lv_printf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
28 changes: 28 additions & 0 deletions project/gui/lvgl/lvgl8/lvgl/src/widgets/animimg/lv_animimg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
**********************/
Expand Down
30 changes: 29 additions & 1 deletion project/gui/lvgl/lvgl8/lvgl/src/widgets/animimg/lv_animimg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down

0 comments on commit e1a1108

Please sign in to comment.