add user data where is was missing

This commit is contained in:
Gabor Kiss-Vamosi
2019-04-22 08:45:07 +02:00
parent 2d5183b05d
commit e2cfba7c9f
26 changed files with 217 additions and 220 deletions

View File

@@ -52,10 +52,9 @@ typedef struct _lv_group_t
{ {
lv_ll_t obj_ll; /*Linked list to store the objects in the group */ lv_ll_t obj_ll; /*Linked list to store the objects in the group */
lv_obj_t ** obj_focus; /*The object in focus*/ lv_obj_t ** obj_focus; /*The object in focus*/
lv_group_style_mod_func_t
style_mod; /*A function which modifies the style of the focused object*/ lv_group_style_mod_func_t style_mod; /*A function to modifies the style of the focused object*/
lv_group_style_mod_func_t lv_group_style_mod_func_t style_mod_edit; /*A function which modifies the style of the edited object*/
style_mod_edit; /*A function which modifies the style of the focused object*/
lv_group_focus_cb_t focus_cb; /*A function to call when a new object is focused (optional)*/ lv_group_focus_cb_t focus_cb; /*A function to call when a new object is focused (optional)*/
lv_style_t style_tmp; /*Stores the modified style of the focused object */ lv_style_t style_tmp; /*Stores the modified style of the focused object */
#if LV_USE_USER_DATA_SINGLE #if LV_USE_USER_DATA_SINGLE

View File

@@ -219,16 +219,6 @@ void lv_indev_set_button_points(lv_indev_t * indev, const lv_point_t * points)
} }
} }
/**
* Set feedback callback for indev.
* @param indev pointer to an input device
* @param feedback feedback callback
*/
void lv_indev_set_feedback(lv_indev_t * indev, lv_indev_feedback_t feedback)
{
indev->feedback = feedback;
}
/** /**
* Get the last point of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON) * Get the last point of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
* @param indev pointer to an input device * @param indev pointer to an input device
@@ -295,16 +285,6 @@ void lv_indev_get_vect(const lv_indev_t * indev, lv_point_t * point)
} }
} }
/**
* Get feedback callback for indev.
* @param indev pointer to an input device
* @return feedback callback
*/
lv_indev_feedback_t lv_indev_get_feedback(const lv_indev_t * indev)
{
return indev->feedback;
}
/** /**
* Do nothing until the next release * Do nothing until the next release
* @param indev pointer to an input device * @param indev pointer to an input device

View File

@@ -97,13 +97,6 @@ void lv_indev_set_group(lv_indev_t * indev, lv_group_t * group);
*/ */
void lv_indev_set_button_points(lv_indev_t * indev, const lv_point_t * points); void lv_indev_set_button_points(lv_indev_t * indev, const lv_point_t * points);
/**
* Set feedback callback for indev.
* @param indev pointer to an input device
* @param feedback feedback callback
*/
void lv_indev_set_feedback(lv_indev_t * indev, lv_indev_feedback_t feedback);
/** /**
* Get the last point of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON) * Get the last point of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
* @param indev pointer to an input device * @param indev pointer to an input device
@@ -134,13 +127,6 @@ bool lv_indev_is_dragging(const lv_indev_t * indev);
*/ */
void lv_indev_get_vect(const lv_indev_t * indev, lv_point_t * point); void lv_indev_get_vect(const lv_indev_t * indev, lv_point_t * point);
/**
* Get feedback callback for indev.
* @param indev pointer to an input device
* @return feedback callback
*/
lv_indev_feedback_t lv_indev_get_feedback(const lv_indev_t * indev);
/** /**
* Do nothing until the next release * Do nothing until the next release
* @param indev pointer to an input device * @param indev pointer to an input device

View File

@@ -1383,10 +1383,10 @@ void lv_obj_refresh_ext_draw_pad(lv_obj_t * obj)
* @param type type of animation from 'lv_anim_builtin_t'. 'OR' it with ANIM_IN or ANIM_OUT * @param type type of animation from 'lv_anim_builtin_t'. 'OR' it with ANIM_IN or ANIM_OUT
* @param time time of animation in milliseconds * @param time time of animation in milliseconds
* @param delay delay before the animation in milliseconds * @param delay delay before the animation in milliseconds
* @param cb a function to call when the animation is ready * @param ready_cb a function to call when the animation is ready
*/ */
void lv_obj_animate(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint16_t delay, void lv_obj_animate(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint16_t delay,
void (*cb)(lv_obj_t *)) lv_anim_ready_cb_t ready_cb)
{ {
lv_obj_t * par = lv_obj_get_parent(obj); lv_obj_t * par = lv_obj_get_parent(obj);
@@ -1398,8 +1398,8 @@ void lv_obj_animate(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint1
a.var = obj; a.var = obj;
a.time = time; a.time = time;
a.act_time = (int32_t)-delay; a.act_time = (int32_t)-delay;
a.end_cb = (void (*)(void *))cb; a.ready_cb = ready_cb;
a.path = lv_anim_path_linear; a.path_cb = lv_anim_path_linear;
a.playback_pause = 0; a.playback_pause = 0;
a.repeat_pause = 0; a.repeat_pause = 0;
a.playback = 0; a.playback = 0;
@@ -1408,37 +1408,37 @@ void lv_obj_animate(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint1
/*Init to ANIM_IN*/ /*Init to ANIM_IN*/
switch(type) { switch(type) {
case LV_ANIM_FLOAT_LEFT: case LV_ANIM_FLOAT_LEFT:
a.fp = (void (*)(void *, int32_t))lv_obj_set_x; a.exec_cb = (void (*)(void *, int32_t))lv_obj_set_x;
a.start = -lv_obj_get_width(obj); a.start = -lv_obj_get_width(obj);
a.end = lv_obj_get_x(obj); a.end = lv_obj_get_x(obj);
break; break;
case LV_ANIM_FLOAT_RIGHT: case LV_ANIM_FLOAT_RIGHT:
a.fp = (void (*)(void *, int32_t))lv_obj_set_x; a.exec_cb = (void (*)(void *, int32_t))lv_obj_set_x;
a.start = lv_obj_get_width(par); a.start = lv_obj_get_width(par);
a.end = lv_obj_get_x(obj); a.end = lv_obj_get_x(obj);
break; break;
case LV_ANIM_FLOAT_TOP: case LV_ANIM_FLOAT_TOP:
a.fp = (void (*)(void *, int32_t))lv_obj_set_y; a.exec_cb = (void (*)(void *, int32_t))lv_obj_set_y;
a.start = -lv_obj_get_height(obj); a.start = -lv_obj_get_height(obj);
a.end = lv_obj_get_y(obj); a.end = lv_obj_get_y(obj);
break; break;
case LV_ANIM_FLOAT_BOTTOM: case LV_ANIM_FLOAT_BOTTOM:
a.fp = (void (*)(void *, int32_t))lv_obj_set_y; a.exec_cb = (void (*)(void *, int32_t))lv_obj_set_y;
a.start = lv_obj_get_height(par); a.start = lv_obj_get_height(par);
a.end = lv_obj_get_y(obj); a.end = lv_obj_get_y(obj);
break; break;
case LV_ANIM_GROW_H: case LV_ANIM_GROW_H:
a.fp = (void (*)(void *, int32_t))lv_obj_set_width; a.exec_cb = (void (*)(void *, int32_t))lv_obj_set_width;
a.start = 0; a.start = 0;
a.end = lv_obj_get_width(obj); a.end = lv_obj_get_width(obj);
break; break;
case LV_ANIM_GROW_V: case LV_ANIM_GROW_V:
a.fp = (void (*)(void *, int32_t))lv_obj_set_height; a.exec_cb = (void (*)(void *, int32_t))lv_obj_set_height;
a.start = 0; a.start = 0;
a.end = lv_obj_get_height(obj); a.end = lv_obj_get_height(obj);
break; break;
case LV_ANIM_NONE: case LV_ANIM_NONE:
a.fp = NULL; a.exec_cb = NULL;
a.start = 0; a.start = 0;
a.end = 0; a.end = 0;
break; break;
@@ -2091,7 +2091,9 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
lv_indev_t * indev_act = lv_indev_get_act(); lv_indev_t * indev_act = lv_indev_get_act();
if(sign > _LV_SIGNAL_FEEDBACK_SECTION_START && sign < _LV_SIGNAL_FEEDBACK_SECTION_END) { if(sign > _LV_SIGNAL_FEEDBACK_SECTION_START && sign < _LV_SIGNAL_FEEDBACK_SECTION_END) {
if(indev_act != NULL && indev_act->feedback != NULL) indev_act->feedback(indev_act, sign); if(indev_act != NULL) {
if(indev_act->driver.feedback_cb) indev_act->driver.feedback_cb(&indev_act->driver, sign);
}
} }
if(sign == LV_SIGNAL_CHILD_CHG) { if(sign == LV_SIGNAL_CHILD_CHG) {

View File

@@ -612,16 +612,17 @@ void * lv_obj_allocate_ext_attr(lv_obj_t * obj, uint16_t ext_size);
void lv_obj_refresh_ext_draw_pad(lv_obj_t * obj); void lv_obj_refresh_ext_draw_pad(lv_obj_t * obj);
#if LV_USE_ANIMATION #if LV_USE_ANIMATION
/** /**
* Animate an object * Animate an object
* @param obj pointer to an object to animate * @param obj pointer to an object to animate
* @param type type of animation from 'lv_anim_builtin_t'. 'OR' it with ANIM_IN or ANIM_OUT * @param type type of animation from 'lv_anim_builtin_t'. 'OR' it with ANIM_IN or ANIM_OUT
* @param time time of animation in milliseconds * @param time time of animation in milliseconds
* @param delay delay before the animation in milliseconds * @param delay delay before the animation in milliseconds
* @param cb a function to call when the animation is ready * @param ready_cb a function to call when the animation is ready
*/ */
void lv_obj_animate(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint16_t delay, void lv_obj_animate(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint16_t delay,
void (*cb)(lv_obj_t *)); lv_anim_ready_cb_t ready_cb);
#endif #endif
/*======================= /*=======================

View File

@@ -33,7 +33,7 @@ typedef struct
will be modified too*/ will be modified too*/
lv_style_t style_end; lv_style_t style_end;
lv_style_t * style_anim; lv_style_t * style_anim;
void (*end_cb)(void *); lv_anim_ready_cb_t ready_cb;
} lv_style_anim_dsc_t; } lv_style_anim_dsc_t;
#endif #endif
@@ -42,7 +42,7 @@ typedef struct
**********************/ **********************/
#if LV_USE_ANIMATION #if LV_USE_ANIMATION
static void style_animator(lv_style_anim_dsc_t * dsc, int32_t val); static void style_animator(lv_style_anim_dsc_t * dsc, int32_t val);
static void style_animation_common_end_cb(void * ptr); static void style_animation_common_end_cb(lv_anim_t * a);
#endif #endif
/********************** /**********************
@@ -303,15 +303,15 @@ void * lv_style_anim_create(lv_style_anim_t * anim)
memcpy(&dsc->style_start, anim->style_start, sizeof(lv_style_t)); memcpy(&dsc->style_start, anim->style_start, sizeof(lv_style_t));
memcpy(&dsc->style_end, anim->style_end, sizeof(lv_style_t)); memcpy(&dsc->style_end, anim->style_end, sizeof(lv_style_t));
memcpy(dsc->style_anim, anim->style_start, sizeof(lv_style_t)); memcpy(dsc->style_anim, anim->style_start, sizeof(lv_style_t));
dsc->end_cb = anim->end_cb; dsc->ready_cb = anim->ready_cb;
lv_anim_t a; lv_anim_t a;
a.var = (void *)dsc; a.var = (void *)dsc;
a.start = 0; a.start = 0;
a.end = STYLE_MIX_MAX; a.end = STYLE_MIX_MAX;
a.fp = (lv_anim_fp_t)style_animator; a.exec_cb = (lv_anim_exec_cb_t)style_animator;
a.path = lv_anim_path_linear; a.path_cb = lv_anim_path_linear;
a.end_cb = style_animation_common_end_cb; a.ready_cb = style_animation_common_end_cb;
a.act_time = anim->act_time; a.act_time = anim->act_time;
a.time = anim->time; a.time = anim->time;
a.playback = anim->playback; a.playback = anim->playback;
@@ -348,13 +348,15 @@ static void style_animator(lv_style_anim_dsc_t * dsc, int32_t val)
/** /**
* Called when a style animation is ready * Called when a style animation is ready
* It called the user defined call back and free the allocated memories * It called the user defined call back and free the allocated memories
* @param ptr the 'animated variable' set by lv_style_anim_create() * @param a pointer to the animation
*/ */
static void style_animation_common_end_cb(void * ptr) static void style_animation_common_end_cb(lv_anim_t * a)
{ {
lv_style_anim_dsc_t * dsc = ptr; /*To avoid casting*/
if(dsc->end_cb) dsc->end_cb(dsc); (void) a; /*Unused*/
lv_style_anim_dsc_t * dsc = a->var; /*To avoid casting*/
if(dsc->ready_cb) dsc->ready_cb(a);
lv_mem_free(dsc); lv_mem_free(dsc);
} }

View File

@@ -115,11 +115,19 @@ typedef struct
const lv_style_t * style_start; /*Pointer to the starting style*/ const lv_style_t * style_start; /*Pointer to the starting style*/
const lv_style_t * style_end; /*Pointer to the destination style*/ const lv_style_t * style_end; /*Pointer to the destination style*/
lv_style_t * style_anim; /*Pointer to a style to animate*/ lv_style_t * style_anim; /*Pointer to a style to animate*/
lv_anim_cb_t end_cb; /*Call it when the animation is ready (NULL if unused)*/ lv_anim_ready_cb_t ready_cb; /*Call it when the animation is ready (NULL if unused)*/
int16_t time; /*Animation time in ms*/ int16_t time; /*Animation time in ms*/
int16_t act_time; /*Current time in animation. Set to negative to make delay.*/ int16_t act_time; /*Current time in animation. Set to negative to make delay.*/
uint16_t playback_pause; /*Wait before play back*/ uint16_t playback_pause; /*Wait before play back*/
uint16_t repeat_pause; /*Wait before repeat*/ uint16_t repeat_pause; /*Wait before repeat*/
#if LV_USE_USER_DATA_SINGLE
lv_anim_user_data_t user_data; /*Custom user data*/
#endif
#if LV_USE_USER_DATA_MULTI
lv_anim_user_data_t ready_user_data;
#endif
uint8_t playback : 1; /*When the animation is ready play it back*/ uint8_t playback : 1; /*When the animation is ready play it back*/
uint8_t repeat : 1; /*Repeat the animation infinitely*/ uint8_t repeat : 1; /*Repeat the animation infinitely*/
} lv_style_anim_t; } lv_style_anim_t;
@@ -135,7 +143,8 @@ a.playback = 0;
a.playback_pause = 0; a.playback_pause = 0;
a.repeat = 0; a.repeat = 0;
a.repeat_pause = 0; a.repeat_pause = 0;
a.end_cb = NULL; a.ready_cb = NULL;
a.user_data = NULL;
lv_style_anim_create(&a); lv_style_anim_create(&a);
*/ */
#endif #endif

View File

@@ -158,7 +158,7 @@ void lv_draw_fill(const lv_area_t * cords_p, const lv_area_t * mask_p, lv_color_
else if(opa == LV_OPA_COVER) { else if(opa == LV_OPA_COVER) {
/*Use hw fill if present*/ /*Use hw fill if present*/
if(disp->driver.mem_fill_cb) { if(disp->driver.mem_fill_cb) {
disp->driver.mem_fill_cb(vdb->buf_act, &vdb->area, &vdb_rel_a, color); disp->driver.mem_fill_cb(&disp->driver, vdb->buf_act, &vdb->area, &vdb_rel_a, color);
} }
/*Use hw blend if present and the area is not too small*/ /*Use hw blend if present and the area is not too small*/
else if(lv_area_get_height(&vdb_rel_a) > VFILL_HW_ACC_SIZE_LIMIT && else if(lv_area_get_height(&vdb_rel_a) > VFILL_HW_ACC_SIZE_LIMIT &&
@@ -175,7 +175,7 @@ void lv_draw_fill(const lv_area_t * cords_p, const lv_area_t * mask_p, lv_color_
/*Blend the filled line to every line VDB line-by-line*/ /*Blend the filled line to every line VDB line-by-line*/
lv_coord_t row; lv_coord_t row;
for(row = vdb_rel_a.y1; row <= vdb_rel_a.y2; row++) { for(row = vdb_rel_a.y1; row <= vdb_rel_a.y2; row++) {
disp->driver.mem_blend_cb(&vdb_buf_tmp[vdb_rel_a.x1], color_array_tmp, w, opa); disp->driver.mem_blend_cb(&disp->driver, &vdb_buf_tmp[vdb_rel_a.x1], color_array_tmp, w, opa);
vdb_buf_tmp += vdb_width; vdb_buf_tmp += vdb_width;
} }
@@ -200,7 +200,7 @@ void lv_draw_fill(const lv_area_t * cords_p, const lv_area_t * mask_p, lv_color_
} }
lv_coord_t row; lv_coord_t row;
for(row = vdb_rel_a.y1; row <= vdb_rel_a.y2; row++) { for(row = vdb_rel_a.y1; row <= vdb_rel_a.y2; row++) {
disp->driver.mem_blend_cb(&vdb_buf_tmp[vdb_rel_a.x1], color_array_tmp, w, opa); disp->driver.mem_blend_cb(&disp->driver, &vdb_buf_tmp[vdb_rel_a.x1], color_array_tmp, w, opa);
vdb_buf_tmp += vdb_width; vdb_buf_tmp += vdb_width;
} }
@@ -441,7 +441,7 @@ void lv_draw_map(const lv_area_t * cords_p, const lv_area_t * mask_p, const uint
if(disp->driver.mem_blend_cb == false) { if(disp->driver.mem_blend_cb == false) {
sw_mem_blend(vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa); sw_mem_blend(vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa);
} else { } else {
disp->driver.mem_blend_cb(vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa); disp->driver.mem_blend_cb(&disp->driver, vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa);
} }
#else #else
sw_mem_blend(vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa); sw_mem_blend(vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa);

View File

@@ -92,10 +92,10 @@ typedef struct _disp_drv_t
#if LV_USE_GPU #if LV_USE_GPU
/*OPTIONAL: Blend two memories using opacity (GPU only)*/ /*OPTIONAL: Blend two memories using opacity (GPU only)*/
void (*mem_blend_cb)(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa); void (*mem_blend_cb)(struct _disp_drv_t * disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa);
/*OPTIONAL: Fill a memory with a color (GPU only)*/ /*OPTIONAL: Fill a memory with a color (GPU only)*/
void (*mem_fill_cb)(lv_color_t * dest_buf, const lv_area_t * dest_area, void (*mem_fill_cb)(struct _disp_drv_t * disp_drv, lv_color_t * dest_buf, const lv_area_t * dest_area,
const lv_area_t * fill_area, lv_color_t color); const lv_area_t * fill_area, lv_color_t color);
#endif #endif

View File

@@ -54,6 +54,7 @@ typedef uint8_t lv_indev_type_t;
enum { LV_INDEV_STATE_REL = 0, LV_INDEV_STATE_PR }; enum { LV_INDEV_STATE_REL = 0, LV_INDEV_STATE_PR };
typedef uint8_t lv_indev_state_t; typedef uint8_t lv_indev_state_t;
/*Data type when an input device is read */ /*Data type when an input device is read */
typedef struct typedef struct
{ {
@@ -73,18 +74,23 @@ typedef struct _lv_indev_drv_t
/*Input device type*/ /*Input device type*/
lv_indev_type_t type; lv_indev_type_t type;
/*Function pointer to read_cb data. Return 'true' if there is still data to be read_cb /*Function pointer to read input device data.
* (buffered)*/ * Return 'true' if there is still data to be read (buffered)*/
bool (*read_cb)(struct _lv_indev_drv_t * indev_drv, lv_indev_data_t * data); bool (*read_cb)(struct _lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
#if LV_USE_USER_DATA_MULTI /*Called when an action happened on the input device.*/
lv_indev_drv_user_data_t read_user_data; void (*feedback_cb)(struct _lv_indev_drv_t *, uint8_t);
#endif
#if LV_USE_USER_DATA_SINGLE #if LV_USE_USER_DATA_SINGLE
lv_indev_drv_user_data_t user_data; lv_indev_drv_user_data_t user_data;
#endif #endif
#if LV_USE_USER_DATA_MULTI
lv_indev_drv_user_data_t read_user_data;
lv_indev_drv_user_data_t feedback_user_data;
#endif
/*Pointer to the assigned display*/ /*Pointer to the assigned display*/
struct _disp_t * disp; struct _disp_t * disp;
@@ -143,8 +149,6 @@ typedef struct _lv_indev_proc_t
uint8_t wait_until_release : 1; uint8_t wait_until_release : 1;
} lv_indev_proc_t; } lv_indev_proc_t;
typedef void (*lv_indev_feedback_t)(struct _lv_indev_t *, uint8_t);
struct _lv_obj_t; struct _lv_obj_t;
struct _lv_group_t; struct _lv_group_t;
@@ -154,7 +158,6 @@ typedef struct _lv_indev_t
{ {
lv_indev_drv_t driver; lv_indev_drv_t driver;
lv_indev_proc_t proc; lv_indev_proc_t proc;
lv_indev_feedback_t feedback;
struct _lv_obj_t * cursor; /*Cursor for LV_INPUT_TYPE_POINTER*/ struct _lv_obj_t * cursor; /*Cursor for LV_INPUT_TYPE_POINTER*/
struct _lv_group_t * group; /*Keypad destination group*/ struct _lv_group_t * group; /*Keypad destination group*/
const lv_point_t * btn_points; /*Array points assigned to the button ()screen will be pressed const lv_point_t * btn_points; /*Array points assigned to the button ()screen will be pressed

View File

@@ -68,8 +68,8 @@ void lv_anim_create(lv_anim_t * anim_p)
{ {
LV_LOG_TRACE("animation create started") LV_LOG_TRACE("animation create started")
/* Do not let two animations for the same 'var' with the same 'fp'*/ /* Do not let two animations for the same 'var' with the same 'fp'*/
if(anim_p->fp != NULL) if(anim_p->exec_cb != NULL)
lv_anim_del(anim_p->var, anim_p->fp); /*fp == NULL would delete all animations of var*/ lv_anim_del(anim_p->var, anim_p->exec_cb); /*fp == NULL would delete all animations of var*/
/*Add the new animation to the animation linked list*/ /*Add the new animation to the animation linked list*/
lv_anim_t * new_anim = lv_ll_ins_head(&LV_GC_ROOT(_lv_anim_ll)); lv_anim_t * new_anim = lv_ll_ins_head(&LV_GC_ROOT(_lv_anim_ll));
@@ -81,7 +81,7 @@ void lv_anim_create(lv_anim_t * anim_p)
memcpy(new_anim, anim_p, sizeof(lv_anim_t)); memcpy(new_anim, anim_p, sizeof(lv_anim_t));
/*Set the start value*/ /*Set the start value*/
if(new_anim->fp != NULL) new_anim->fp(new_anim->var, new_anim->start); if(new_anim->exec_cb != NULL) new_anim->exec_cb(new_anim->var, new_anim->start);
/* Creating an animation changed the linked list. /* 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_task`)*/
@@ -97,7 +97,7 @@ void lv_anim_create(lv_anim_t * anim_p)
* or NULL to delete all animations of 'var' * or NULL to delete all animations of 'var'
* @return true: at least 1 animation is deleted, false: no animation is deleted * @return true: at least 1 animation is deleted, false: no animation is deleted
*/ */
bool lv_anim_del(void * var, lv_anim_fp_t fp) bool lv_anim_del(void * var, lv_anim_exec_cb_t fp)
{ {
lv_anim_t * a; lv_anim_t * a;
lv_anim_t * a_next; lv_anim_t * a_next;
@@ -107,7 +107,7 @@ bool lv_anim_del(void * var, lv_anim_fp_t fp)
/*'a' might be deleted, so get the next object while 'a' is valid*/ /*'a' might be deleted, so get the next object while 'a' is valid*/
a_next = lv_ll_get_next(&LV_GC_ROOT(_lv_anim_ll), a); a_next = lv_ll_get_next(&LV_GC_ROOT(_lv_anim_ll), a);
if(a->var == var && (a->fp == fp || fp == NULL)) { if(a->var == var && (a->exec_cb == fp || fp == NULL)) {
lv_ll_rem(&LV_GC_ROOT(_lv_anim_ll), a); lv_ll_rem(&LV_GC_ROOT(_lv_anim_ll), a);
lv_mem_free(a); lv_mem_free(a);
anim_list_changed = true; /*Read by `anim_task`. It need to know if a delete occurred in anim_list_changed = true; /*Read by `anim_task`. It need to know if a delete occurred in
@@ -386,9 +386,9 @@ static void anim_task(void * param)
if(a->act_time > a->time) a->act_time = a->time; if(a->act_time > a->time) a->act_time = a->time;
int32_t new_value; int32_t new_value;
new_value = a->path(a); new_value = a->path_cb(a);
if(a->fp != NULL) a->fp(a->var, new_value); /*Apply the calculated value*/ if(a->exec_cb != NULL) a->exec_cb(a->var, new_value); /*Apply the calculated value*/
/*If the time is elapsed the animation is ready*/ /*If the time is elapsed the animation is ready*/
if(a->act_time >= a->time) { if(a->act_time >= a->time) {
@@ -422,7 +422,7 @@ static bool anim_ready_handler(lv_anim_t * a)
* - no repeat, play back is enabled and play back is ready */ * - no repeat, play back is enabled and play back is ready */
if((a->repeat == 0 && a->playback == 0) || if((a->repeat == 0 && a->playback == 0) ||
(a->repeat == 0 && a->playback == 1 && a->playback_now == 1)) { (a->repeat == 0 && a->playback == 1 && a->playback_now == 1)) {
void (*cb)(void *) = a->end_cb; lv_anim_ready_cb_t ready_cb = a->ready_cb;
void * p = a->var; void * p = a->var;
lv_ll_rem(&LV_GC_ROOT(_lv_anim_ll), a); lv_ll_rem(&LV_GC_ROOT(_lv_anim_ll), a);
lv_mem_free(a); lv_mem_free(a);
@@ -431,7 +431,7 @@ static bool anim_ready_handler(lv_anim_t * a)
/* Call the callback function at the end*/ /* Call the callback function at the end*/
/* Check if an animation is deleted in the cb function /* Check if an animation is deleted in the cb function
* if yes then the caller function has to know this*/ * if yes then the caller function has to know this*/
if(cb != NULL) cb(p); if(ready_cb != NULL) ready_cb(p);
} }
/*If the animation is not deleted then restart it*/ /*If the animation is not deleted then restart it*/
else { else {

View File

@@ -34,23 +34,37 @@ extern "C" {
struct _lv_anim_t; struct _lv_anim_t;
typedef int32_t (*lv_anim_path_t)(const struct _lv_anim_t *); /*Generic prototype of "animator" functions*/
typedef void (*lv_anim_exec_cb_t)(void *, int32_t);
typedef void (*lv_anim_fp_t)(void *, int32_t); /*Get the current value in an animation*/
typedef void (*lv_anim_cb_t)(void *); typedef int32_t (*lv_anim_path_cb_t)(const struct _lv_anim_t *);
/*Callback for animation ready*/
typedef void (*lv_anim_ready_cb_t)(struct _lv_anim_t *);
typedef struct _lv_anim_t typedef struct _lv_anim_t
{ {
void * var; /*Variable to animate*/ void * var; /*Variable to animate*/
lv_anim_fp_t fp; /*Animator function*/ lv_anim_exec_cb_t exec_cb; /*Function to execute to animate*/
lv_anim_cb_t end_cb; /*Call it when the animation is ready*/ lv_anim_path_cb_t path_cb; /*An array with the steps of animations*/
lv_anim_path_t path; /*An array with the steps of animations*/ lv_anim_ready_cb_t ready_cb; /*Call it when the animation is ready*/
int32_t start; /*Start value*/ int32_t start; /*Start value*/
int32_t end; /*End value*/ int32_t end; /*End value*/
uint16_t time; /*Animation time in ms*/ uint16_t time; /*Animation time in ms*/
int16_t act_time; /*Current time in animation. Set to negative to make delay.*/ int16_t act_time; /*Current time in animation. Set to negative to make delay.*/
uint16_t playback_pause; /*Wait before play back*/ uint16_t playback_pause; /*Wait before play back*/
uint16_t repeat_pause; /*Wait before repeat*/ uint16_t repeat_pause; /*Wait before repeat*/
#if LV_USE_USER_DATA_SINGLE
lv_anim_user_data_t user_data; /*Custom user data*/
#endif
#if LV_USE_USER_DATA_MULTI
lv_anim_user_data_t exec_user_data;
lv_anim_user_data_t path_user_data;
lv_anim_user_data_t ready_user_data;
#endif
uint8_t playback : 1; /*When the animation is ready play it back*/ uint8_t playback : 1; /*When the animation is ready play it back*/
uint8_t repeat : 1; /*Repeat the animation infinitely*/ uint8_t repeat : 1; /*Repeat the animation infinitely*/
/*Animation system use these - user shouldn't set*/ /*Animation system use these - user shouldn't set*/
@@ -63,15 +77,16 @@ lv_anim_t a;
a.var = obj; a.var = obj;
a.start = lv_obj_get_height(obj); a.start = lv_obj_get_height(obj);
a.end = new_height; a.end = new_height;
a.fp = (lv_anim_fp_t)lv_obj_set_height; a.exec_cb = (lv_anim_fp_t)lv_obj_set_height;
a.path = lv_anim_path_linear; a.path_cb = lv_anim_path_linear;
a.end_cb = NULL; a.ready_cb = NULL;
a.act_time = 0; a.act_time = 0;
a.time = 200; a.time = 200;
a.playback = 0; a.playback = 0;
a.playback_pause = 0; a.playback_pause = 0;
a.repeat = 0; a.repeat = 0;
a.repeat_pause = 0; a.repeat_pause = 0;
a.user_data = NULL;
lv_anim_create(&a); lv_anim_create(&a);
*/ */
/********************** /**********************
@@ -96,7 +111,7 @@ void lv_anim_create(lv_anim_t * anim_p);
* or NULL to ignore it and delete all animation with 'var * or NULL to ignore it and delete all animation with 'var
* @return true: at least 1 animation is deleted, false: no animation is deleted * @return true: at least 1 animation is deleted, false: no animation is deleted
*/ */
bool lv_anim_del(void * var, lv_anim_fp_t fp); bool lv_anim_del(void * var, lv_anim_exec_cb_t fp);
/** /**
* Get the number of currently running animations * Get the number of currently running animations
@@ -162,6 +177,7 @@ int32_t lv_anim_path_bounce(const lv_anim_t * a);
* @return the current value to set * @return the current value to set
*/ */
int32_t lv_anim_path_step(const lv_anim_t * a); int32_t lv_anim_path_step(const lv_anim_t * a);
/********************** /**********************
* MACROS * MACROS
**********************/ **********************/

View File

@@ -31,7 +31,7 @@ static bool lv_bar_design(lv_obj_t * bar, const lv_area_t * mask, lv_design_mode
static lv_res_t lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param); static lv_res_t lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param);
static void lv_bar_animate(void * bar, int32_t value); static void lv_bar_animate(void * bar, int32_t value);
static void lv_bar_anim_ready(void * bar); static void lv_bar_anim_ready(lv_anim_t * a);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
@@ -158,9 +158,9 @@ void lv_bar_set_value(lv_obj_t * bar, int16_t value, bool anim)
a.var = bar; a.var = bar;
a.start = LV_BAR_ANIM_STATE_START; a.start = LV_BAR_ANIM_STATE_START;
a.end = LV_BAR_ANIM_STATE_END; a.end = LV_BAR_ANIM_STATE_END;
a.fp = (lv_anim_fp_t)lv_bar_animate; a.exec_cb = (lv_anim_exec_cb_t)lv_bar_animate;
a.path = lv_anim_path_linear; a.path_cb = lv_anim_path_linear;
a.end_cb = lv_bar_anim_ready; a.ready_cb = lv_bar_anim_ready;
a.act_time = 0; a.act_time = 0;
a.time = ext->anim_time; a.time = ext->anim_time;
a.playback = 0; a.playback = 0;
@@ -482,11 +482,11 @@ static void lv_bar_animate(void * bar, int32_t value)
lv_obj_invalidate(bar); lv_obj_invalidate(bar);
} }
static void lv_bar_anim_ready(void * bar) static void lv_bar_anim_ready(lv_anim_t * a)
{ {
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar); lv_bar_ext_t * ext = lv_obj_get_ext_attr(a->var);
ext->anim_state = LV_BAR_ANIM_STATE_INV; ext->anim_state = LV_BAR_ANIM_STATE_INV;
lv_bar_set_value(bar, ext->anim_end, false); lv_bar_set_value(a->var, ext->anim_end, false);
} }
#endif #endif

View File

@@ -36,7 +36,7 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param);
#if LV_USE_ANIMATION && LV_BTN_INK_EFFECT #if LV_USE_ANIMATION && LV_BTN_INK_EFFECT
static void lv_btn_ink_effect_anim(lv_obj_t * btn, int32_t val); static void lv_btn_ink_effect_anim(lv_obj_t * btn, int32_t val);
static void lv_btn_ink_effect_anim_ready(void * p); static void lv_btn_ink_effect_anim_ready(lv_anim_t * a);
#endif #endif
/********************** /**********************
@@ -502,7 +502,7 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
#if LV_USE_ANIMATION && LV_BTN_INK_EFFECT #if LV_USE_ANIMATION && LV_BTN_INK_EFFECT
/*Forget the old inked button*/ /*Forget the old inked button*/
if(ink_obj != NULL && ink_obj != btn) { if(ink_obj != NULL && ink_obj != btn) {
lv_anim_del(ink_obj, (lv_anim_fp_t)lv_btn_ink_effect_anim); lv_anim_del(ink_obj, (lv_anim_exec_cb_t)lv_btn_ink_effect_anim);
lv_obj_invalidate(ink_obj); lv_obj_invalidate(ink_obj);
ink_obj = NULL; ink_obj = NULL;
} }
@@ -517,9 +517,9 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
a.var = btn; a.var = btn;
a.start = 0; a.start = 0;
a.end = LV_BTN_INK_VALUE_MAX; a.end = LV_BTN_INK_VALUE_MAX;
a.fp = (lv_anim_fp_t)lv_btn_ink_effect_anim; a.exec_cb = (lv_anim_exec_cb_t)lv_btn_ink_effect_anim;
a.path = lv_anim_path_linear; a.path_cb = lv_anim_path_linear;
a.end_cb = lv_btn_ink_effect_anim_ready; a.ready_cb = lv_btn_ink_effect_anim_ready;
a.act_time = 0; a.act_time = 0;
a.time = ext->ink_in_time; a.time = ext->ink_in_time;
a.playback = 0; a.playback = 0;
@@ -586,9 +586,9 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
a.var = ink_obj; a.var = ink_obj;
a.start = LV_BTN_INK_VALUE_MAX; a.start = LV_BTN_INK_VALUE_MAX;
a.end = 0; a.end = 0;
a.fp = (lv_anim_fp_t)lv_btn_ink_effect_anim; a.exec_cb = (lv_anim_exec_cb_t)lv_btn_ink_effect_anim;
a.path = lv_anim_path_linear; a.path_cb = lv_anim_path_linear;
a.end_cb = lv_btn_ink_effect_anim_ready; a.ready_cb = lv_btn_ink_effect_anim_ready;
a.act_time = 0; a.act_time = 0;
a.time = ext->ink_out_time; a.time = ext->ink_out_time;
a.playback = 0; a.playback = 0;
@@ -624,7 +624,7 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
} else if(sign == LV_SIGNAL_CLEANUP) { } else if(sign == LV_SIGNAL_CLEANUP) {
#if LV_USE_ANIMATION && LV_BTN_INK_EFFECT #if LV_USE_ANIMATION && LV_BTN_INK_EFFECT
if(btn == ink_obj) { if(btn == ink_obj) {
lv_anim_del(ink_obj, (lv_anim_fp_t)lv_btn_ink_effect_anim); lv_anim_del(ink_obj, (lv_anim_exec_cb_t)lv_btn_ink_effect_anim);
ink_obj = NULL; ink_obj = NULL;
} }
#endif #endif
@@ -657,11 +657,11 @@ static void lv_btn_ink_effect_anim(lv_obj_t * btn, int32_t val)
/** /**
* Called to clean up when the ink animation is ready * Called to clean up when the ink animation is ready
* @param p unused * @param a unused
*/ */
static void lv_btn_ink_effect_anim_ready(void * p) static void lv_btn_ink_effect_anim_ready(lv_anim_t * a)
{ {
(void)p; /*Unused*/ (void) a; /*Unused*/
lv_btn_ext_t * ext = lv_obj_get_ext_attr(ink_obj); lv_btn_ext_t * ext = lv_obj_get_ext_attr(ink_obj);
lv_btn_state_t state = lv_btn_get_state(ink_obj); lv_btn_state_t state = lv_btn_get_state(ink_obj);
@@ -675,9 +675,9 @@ static void lv_btn_ink_effect_anim_ready(void * p)
a.var = ink_obj; a.var = ink_obj;
a.start = LV_BTN_INK_VALUE_MAX; a.start = LV_BTN_INK_VALUE_MAX;
a.end = 0; a.end = 0;
a.fp = (lv_anim_fp_t)lv_btn_ink_effect_anim; a.exec_cb = (lv_anim_exec_cb_t)lv_btn_ink_effect_anim;
a.path = lv_anim_path_linear; a.path_cb = lv_anim_path_linear;
a.end_cb = lv_btn_ink_effect_anim_ready; a.ready_cb = lv_btn_ink_effect_anim_ready;
a.act_time = -ext->ink_wait_time; a.act_time = -ext->ink_wait_time;
a.time = ext->ink_out_time; a.time = ext->ink_out_time;
a.playback = 0; a.playback = 0;

View File

@@ -872,7 +872,7 @@ static void lv_ddlist_refr_size(lv_obj_t * ddlist, bool anim_en)
lv_ddlist_pos_current_option(ddlist); lv_ddlist_pos_current_option(ddlist);
if(ext->opened) lv_page_set_sb_mode(ddlist, LV_SB_MODE_UNHIDE); if(ext->opened) lv_page_set_sb_mode(ddlist, LV_SB_MODE_UNHIDE);
#if LV_USE_ANIMATION #if LV_USE_ANIMATION
lv_anim_del(ddlist, (lv_anim_fp_t)lv_ddlist_adjust_height); /*If an animation is in progress then lv_anim_del(ddlist, (lv_anim_exec_cb_t)lv_ddlist_adjust_height); /*If an animation is in progress then
it will overwrite this changes*/ it will overwrite this changes*/
lv_ddlist_anim_cb(ddlist); /*Force animation complete to fix highlight selection*/ lv_ddlist_anim_cb(ddlist); /*Force animation complete to fix highlight selection*/
} else { } else {
@@ -880,9 +880,9 @@ static void lv_ddlist_refr_size(lv_obj_t * ddlist, bool anim_en)
a.var = ddlist; a.var = ddlist;
a.start = lv_obj_get_height(ddlist); a.start = lv_obj_get_height(ddlist);
a.end = new_height; a.end = new_height;
a.fp = (lv_anim_fp_t)lv_ddlist_adjust_height; a.exec_cb = (lv_anim_exec_cb_t)lv_ddlist_adjust_height;
a.path = lv_anim_path_linear; a.path_cb = lv_anim_path_linear;
a.end_cb = (lv_anim_cb_t)lv_ddlist_anim_cb; a.ready_cb = (lv_anim_ready_cb_t)lv_ddlist_anim_cb;
a.act_time = 0; a.act_time = 0;
a.time = ext->anim_time; a.time = ext->anim_time;
a.playback = 0; a.playback = 0;

View File

@@ -264,10 +264,10 @@ void lv_label_set_long_mode(lv_obj_t * label, lv_label_long_mode_t long_mode)
#if LV_USE_ANIMATION #if LV_USE_ANIMATION
/*Delete the old animation (if exists)*/ /*Delete the old animation (if exists)*/
lv_anim_del(label, (lv_anim_fp_t)lv_obj_set_x); lv_anim_del(label, (lv_anim_exec_cb_t)lv_obj_set_x);
lv_anim_del(label, (lv_anim_fp_t)lv_obj_set_y); lv_anim_del(label, (lv_anim_exec_cb_t)lv_obj_set_y);
lv_anim_del(label, (lv_anim_fp_t)lv_label_set_offset_x); lv_anim_del(label, (lv_anim_exec_cb_t)lv_label_set_offset_x);
lv_anim_del(label, (lv_anim_fp_t)lv_label_set_offset_y); lv_anim_del(label, (lv_anim_exec_cb_t)lv_label_set_offset_y);
#endif #endif
ext->offset.x = 0; ext->offset.x = 0;
ext->offset.y = 0; ext->offset.y = 0;
@@ -948,8 +948,8 @@ static void lv_label_refr_text(lv_obj_t * label)
anim.repeat = 1; anim.repeat = 1;
anim.playback = 1; anim.playback = 1;
anim.start = 0; anim.start = 0;
anim.end_cb = NULL; anim.ready_cb = NULL;
anim.path = lv_anim_path_linear; anim.path_cb = lv_anim_path_linear;
anim.playback_pause = anim.playback_pause =
(((lv_font_get_width(style->text.font, ' ') + style->text.letter_space) * 1000) / (((lv_font_get_width(style->text.font, ' ') + style->text.letter_space) * 1000) /
ext->anim_speed) * LV_LABEL_WAIT_CHAR_COUNT; ext->anim_speed) * LV_LABEL_WAIT_CHAR_COUNT;
@@ -959,24 +959,24 @@ static void lv_label_refr_text(lv_obj_t * label)
bool hor_anim = false; bool hor_anim = false;
if(size.x > lv_obj_get_width(label)) { if(size.x > lv_obj_get_width(label)) {
anim.end = lv_obj_get_width(label) - size.x; anim.end = lv_obj_get_width(label) - size.x;
anim.fp = (lv_anim_fp_t)lv_label_set_offset_x; anim.exec_cb = (lv_anim_exec_cb_t)lv_label_set_offset_x;
anim.time = lv_anim_speed_to_time(ext->anim_speed, anim.start, anim.end); anim.time = lv_anim_speed_to_time(ext->anim_speed, anim.start, anim.end);
lv_anim_create(&anim); lv_anim_create(&anim);
hor_anim = true; hor_anim = true;
} else { } else {
/*Delete the offset animation if not required*/ /*Delete the offset animation if not required*/
lv_anim_del(label, (lv_anim_fp_t)lv_label_set_offset_x); lv_anim_del(label, (lv_anim_exec_cb_t)lv_label_set_offset_x);
ext->offset.x = 0; ext->offset.x = 0;
} }
if(size.y > lv_obj_get_height(label) && hor_anim == false) { if(size.y > lv_obj_get_height(label) && hor_anim == false) {
anim.end = lv_obj_get_height(label) - size.y - (lv_font_get_height(font)); anim.end = lv_obj_get_height(label) - size.y - (lv_font_get_height(font));
anim.fp = (lv_anim_fp_t)lv_label_set_offset_y; anim.exec_cb = (lv_anim_exec_cb_t)lv_label_set_offset_y;
anim.time = lv_anim_speed_to_time(ext->anim_speed, anim.start, anim.end); anim.time = lv_anim_speed_to_time(ext->anim_speed, anim.start, anim.end);
lv_anim_create(&anim); lv_anim_create(&anim);
} else { } else {
/*Delete the offset animation if not required*/ /*Delete the offset animation if not required*/
lv_anim_del(label, (lv_anim_fp_t)lv_label_set_offset_y); lv_anim_del(label, (lv_anim_exec_cb_t)lv_label_set_offset_y);
ext->offset.y = 0; ext->offset.y = 0;
} }
#endif #endif
@@ -992,32 +992,32 @@ static void lv_label_refr_text(lv_obj_t * label)
anim.act_time = anim.act_time =
-(((lv_font_get_width(style->text.font, ' ') + style->text.letter_space) * 1000) / -(((lv_font_get_width(style->text.font, ' ') + style->text.letter_space) * 1000) /
ext->anim_speed) * LV_LABEL_WAIT_CHAR_COUNT; ext->anim_speed) * LV_LABEL_WAIT_CHAR_COUNT;
anim.end_cb = NULL; anim.ready_cb = NULL;
anim.path = lv_anim_path_linear; anim.path_cb = lv_anim_path_linear;
anim.playback_pause = 0; anim.playback_pause = 0;
anim.repeat_pause = 0; anim.repeat_pause = 0;
bool hor_anim = false; bool hor_anim = false;
if(size.x > lv_obj_get_width(label)) { if(size.x > lv_obj_get_width(label)) {
anim.end = -size.x - lv_font_get_width(font, ' ') * LV_LABEL_WAIT_CHAR_COUNT; anim.end = -size.x - lv_font_get_width(font, ' ') * LV_LABEL_WAIT_CHAR_COUNT;
anim.fp = (lv_anim_fp_t)lv_label_set_offset_x; anim.exec_cb = (lv_anim_exec_cb_t)lv_label_set_offset_x;
anim.time = lv_anim_speed_to_time(ext->anim_speed, anim.start, anim.end); anim.time = lv_anim_speed_to_time(ext->anim_speed, anim.start, anim.end);
lv_anim_create(&anim); lv_anim_create(&anim);
hor_anim = true; hor_anim = true;
} else { } else {
/*Delete the offset animation if not required*/ /*Delete the offset animation if not required*/
lv_anim_del(label, (lv_anim_fp_t)lv_label_set_offset_x); lv_anim_del(label, (lv_anim_exec_cb_t)lv_label_set_offset_x);
ext->offset.x = 0; ext->offset.x = 0;
} }
if(size.y > lv_obj_get_height(label) && hor_anim == false) { if(size.y > lv_obj_get_height(label) && hor_anim == false) {
anim.end = -size.y - (lv_font_get_height(font)); anim.end = -size.y - (lv_font_get_height(font));
anim.fp = (lv_anim_fp_t)lv_label_set_offset_y; anim.exec_cb = (lv_anim_exec_cb_t)lv_label_set_offset_y;
anim.time = lv_anim_speed_to_time(ext->anim_speed, anim.start, anim.end); anim.time = lv_anim_speed_to_time(ext->anim_speed, anim.start, anim.end);
lv_anim_create(&anim); lv_anim_create(&anim);
} else { } else {
/*Delete the offset animation if not required*/ /*Delete the offset animation if not required*/
lv_anim_del(label, (lv_anim_fp_t)lv_label_set_offset_y); lv_anim_del(label, (lv_anim_exec_cb_t)lv_label_set_offset_y);
ext->offset.y = 0; ext->offset.y = 0;
} }
#endif #endif

View File

@@ -627,9 +627,9 @@ void lv_list_up(const lv_obj_t * list)
a.var = scrl; a.var = scrl;
a.start = lv_obj_get_y(scrl); a.start = lv_obj_get_y(scrl);
a.end = new_y; a.end = new_y;
a.fp = (lv_anim_fp_t)lv_obj_set_y; a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_y;
a.path = lv_anim_path_linear; a.path_cb = lv_anim_path_linear;
a.end_cb = NULL; a.ready_cb = NULL;
a.act_time = 0; a.act_time = 0;
a.time = LV_LIST_DEF_ANIM_TIME; a.time = LV_LIST_DEF_ANIM_TIME;
a.playback = 0; a.playback = 0;
@@ -670,9 +670,9 @@ void lv_list_down(const lv_obj_t * list)
a.var = scrl; a.var = scrl;
a.start = lv_obj_get_y(scrl); a.start = lv_obj_get_y(scrl);
a.end = new_y; a.end = new_y;
a.fp = (lv_anim_fp_t)lv_obj_set_y; a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_y;
a.path = lv_anim_path_linear; a.path_cb = lv_anim_path_linear;
a.end_cb = NULL; a.ready_cb = NULL;
a.act_time = 0; a.act_time = 0;
a.time = LV_LIST_DEF_ANIM_TIME; a.time = LV_LIST_DEF_ANIM_TIME;
a.playback = 0; a.playback = 0;

View File

@@ -36,7 +36,7 @@
**********************/ **********************/
static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param); static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param);
static void mbox_realign(lv_obj_t * mbox); static void mbox_realign(lv_obj_t * mbox);
static void lv_mbox_close_end_cb(lv_obj_t * mbox); static void lv_mbox_close_ready_cb(lv_anim_t * a);
static void lv_mbox_default_event_cb(lv_obj_t * mbox, lv_event_t event); static void lv_mbox_default_event_cb(lv_obj_t * mbox, lv_event_t event);
/********************** /**********************
@@ -204,12 +204,12 @@ void lv_mbox_start_auto_close(lv_obj_t * mbox, uint16_t delay)
/*Add shrinking animations*/ /*Add shrinking animations*/
lv_obj_animate(mbox, LV_ANIM_GROW_H | LV_ANIM_OUT, ext->anim_time, delay, NULL); lv_obj_animate(mbox, LV_ANIM_GROW_H | LV_ANIM_OUT, ext->anim_time, delay, NULL);
lv_obj_animate(mbox, LV_ANIM_GROW_V | LV_ANIM_OUT, ext->anim_time, delay, lv_obj_animate(mbox, LV_ANIM_GROW_V | LV_ANIM_OUT, ext->anim_time, delay,
lv_mbox_close_end_cb); lv_mbox_close_ready_cb);
/*Disable fit to let shrinking work*/ /*Disable fit to let shrinking work*/
lv_cont_set_fit(mbox, LV_FIT_NONE); lv_cont_set_fit(mbox, LV_FIT_NONE);
} else { } else {
lv_obj_animate(mbox, LV_ANIM_NONE, ext->anim_time, delay, lv_mbox_close_end_cb); lv_obj_animate(mbox, LV_ANIM_NONE, ext->anim_time, delay, lv_mbox_close_ready_cb);
} }
#else #else
(void)delay; /*Unused*/ (void)delay; /*Unused*/
@@ -491,9 +491,9 @@ static void mbox_realign(lv_obj_t * mbox)
} }
} }
static void lv_mbox_close_end_cb(lv_obj_t * mbox) static void lv_mbox_close_ready_cb(lv_anim_t * a)
{ {
lv_obj_del(mbox); lv_obj_del(a->var);
} }
static void lv_mbox_default_event_cb(lv_obj_t * mbox, lv_event_t event) static void lv_mbox_default_event_cb(lv_obj_t * mbox, lv_event_t event)

View File

@@ -41,7 +41,7 @@ static bool lv_scrl_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mo
static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param); static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param);
static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param); static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param);
static void edge_flash_anim(void * page, int32_t v); static void edge_flash_anim(void * page, int32_t v);
static void edge_flash_anim_end(void * page); static void edge_flash_anim_end(lv_anim_t * a);
static void scrl_def_event_cb(lv_obj_t * scrl, lv_event_t event); static void scrl_def_event_cb(lv_obj_t * scrl, lv_event_t event);
/********************** /**********************
@@ -433,12 +433,12 @@ void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, uint16_t anim_time)
#else #else
/* Be sure there is no position changing animation in progress /* Be sure there is no position changing animation in progress
* because it can overide the current changes*/ * because it can overide the current changes*/
lv_anim_del(page, (lv_anim_fp_t)lv_obj_set_x); lv_anim_del(page, (lv_anim_exec_cb_t)lv_obj_set_x);
lv_anim_del(page, (lv_anim_fp_t)lv_obj_set_y); lv_anim_del(page, (lv_anim_exec_cb_t)lv_obj_set_y);
lv_anim_del(page, (lv_anim_fp_t)lv_obj_set_pos); lv_anim_del(page, (lv_anim_exec_cb_t)lv_obj_set_pos);
lv_anim_del(ext->scrl, (lv_anim_fp_t)lv_obj_set_x); lv_anim_del(ext->scrl, (lv_anim_exec_cb_t)lv_obj_set_x);
lv_anim_del(ext->scrl, (lv_anim_fp_t)lv_obj_set_y); lv_anim_del(ext->scrl, (lv_anim_exec_cb_t)lv_obj_set_y);
lv_anim_del(ext->scrl, (lv_anim_fp_t)lv_obj_set_pos); lv_anim_del(ext->scrl, (lv_anim_exec_cb_t)lv_obj_set_pos);
#endif #endif
const lv_style_t * style = lv_page_get_style(page, LV_PAGE_STYLE_BG); const lv_style_t * style = lv_page_get_style(page, LV_PAGE_STYLE_BG);
@@ -500,17 +500,17 @@ void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, uint16_t anim_time)
a.start = lv_obj_get_y(ext->scrl); a.start = lv_obj_get_y(ext->scrl);
a.end = scrlable_y; a.end = scrlable_y;
a.time = anim_time; a.time = anim_time;
a.end_cb = NULL; a.ready_cb = NULL;
a.playback = 0; a.playback = 0;
a.repeat = 0; a.repeat = 0;
a.var = ext->scrl; a.var = ext->scrl;
a.path = lv_anim_path_linear; a.path_cb = lv_anim_path_linear;
a.fp = (lv_anim_fp_t)lv_obj_set_y; a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_y;
lv_anim_create(&a); lv_anim_create(&a);
a.start = lv_obj_get_x(ext->scrl); a.start = lv_obj_get_x(ext->scrl);
a.end = scrlable_x; a.end = scrlable_x;
a.fp = (lv_anim_fp_t)lv_obj_set_x; a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_x;
lv_anim_create(&a); lv_anim_create(&a);
#endif #endif
} }
@@ -530,9 +530,9 @@ void lv_page_scroll_hor(lv_obj_t * page, lv_coord_t dist)
a.var = scrl; a.var = scrl;
a.start = lv_obj_get_x(scrl); a.start = lv_obj_get_x(scrl);
a.end = a.start + dist; a.end = a.start + dist;
a.fp = (lv_anim_fp_t)lv_obj_set_x; a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_x;
a.path = lv_anim_path_linear; a.path_cb = lv_anim_path_linear;
a.end_cb = NULL; a.ready_cb = NULL;
a.act_time = 0; a.act_time = 0;
a.time = LV_PAGE_SCROLL_ANIM_TIME; a.time = LV_PAGE_SCROLL_ANIM_TIME;
a.playback = 0; a.playback = 0;
@@ -559,9 +559,9 @@ void lv_page_scroll_ver(lv_obj_t * page, lv_coord_t dist)
a.var = scrl; a.var = scrl;
a.start = lv_obj_get_y(scrl); a.start = lv_obj_get_y(scrl);
a.end = a.start + dist; a.end = a.start + dist;
a.fp = (lv_anim_fp_t)lv_obj_set_y; a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_y;
a.path = lv_anim_path_linear; a.path_cb = lv_anim_path_linear;
a.end_cb = NULL; a.ready_cb = NULL;
a.act_time = 0; a.act_time = 0;
a.time = LV_PAGE_SCROLL_ANIM_TIME; a.time = LV_PAGE_SCROLL_ANIM_TIME;
a.playback = 0; a.playback = 0;
@@ -588,9 +588,9 @@ void lv_page_start_edge_flash(lv_obj_t * page)
a.var = page; a.var = page;
a.start = 0; a.start = 0;
a.end = LV_PAGE_END_FLASH_SIZE; a.end = LV_PAGE_END_FLASH_SIZE;
a.fp = (lv_anim_fp_t)edge_flash_anim; a.exec_cb = (lv_anim_exec_cb_t)edge_flash_anim;
a.path = lv_anim_path_linear; a.path_cb = lv_anim_path_linear;
a.end_cb = edge_flash_anim_end; a.ready_cb = edge_flash_anim_end;
a.act_time = 0; a.act_time = 0;
a.time = LV_PAGE_END_ANIM_TIME; a.time = LV_PAGE_END_ANIM_TIME;
a.playback = 1; a.playback = 1;
@@ -1201,14 +1201,14 @@ static void edge_flash_anim(void * page, int32_t v)
lv_obj_invalidate(page); lv_obj_invalidate(page);
} }
static void edge_flash_anim_end(void * page) static void edge_flash_anim_end(lv_anim_t * a)
{ {
lv_page_ext_t * ext = lv_obj_get_ext_attr(page); lv_page_ext_t * ext = lv_obj_get_ext_attr(a->var);
ext->edge_flash.top_ip = 0; ext->edge_flash.top_ip = 0;
ext->edge_flash.bottom_ip = 0; ext->edge_flash.bottom_ip = 0;
ext->edge_flash.left_ip = 0; ext->edge_flash.left_ip = 0;
ext->edge_flash.right_ip = 0; ext->edge_flash.right_ip = 0;
lv_obj_invalidate(page); lv_obj_invalidate(a->var);
} }
#endif #endif

View File

@@ -189,9 +189,9 @@ void lv_preload_set_anim_type(lv_obj_t * preload, lv_preload_type_t type)
a.start = 0; a.start = 0;
a.end = 360; a.end = 360;
} }
a.fp = (lv_anim_fp_t)lv_preload_spinner_anim; a.exec_cb = (lv_anim_exec_cb_t)lv_preload_spinner_anim;
a.path = lv_anim_path_ease_in_out; a.path_cb = lv_anim_path_ease_in_out;
a.end_cb = NULL; a.ready_cb = NULL;
a.act_time = 0; a.act_time = 0;
a.time = ext->time; a.time = ext->time;
a.playback = 0; a.playback = 0;
@@ -211,9 +211,9 @@ void lv_preload_set_anim_type(lv_obj_t * preload, lv_preload_type_t type)
b.start = ext->arc_length; b.start = ext->arc_length;
b.end = 360 - ext->arc_length; b.end = 360 - ext->arc_length;
} }
b.fp = (lv_anim_fp_t)lv_preload_set_arc_length; b.exec_cb = (lv_anim_exec_cb_t)lv_preload_set_arc_length;
b.path = lv_anim_path_ease_in_out; b.path_cb = lv_anim_path_ease_in_out;
b.end_cb = NULL; b.ready_cb = NULL;
b.act_time = 0; b.act_time = 0;
b.time = ext->time; b.time = ext->time;
b.playback = 1; b.playback = 1;
@@ -237,9 +237,9 @@ void lv_preload_set_anim_type(lv_obj_t * preload, lv_preload_type_t type)
a.start = 0; a.start = 0;
a.end = 360; a.end = 360;
} }
a.fp = (lv_anim_fp_t)lv_preload_spinner_anim; a.exec_cb = (lv_anim_exec_cb_t)lv_preload_spinner_anim;
a.path = lv_anim_path_ease_in_out; a.path_cb = lv_anim_path_ease_in_out;
a.end_cb = NULL; a.ready_cb = NULL;
a.act_time = 0; a.act_time = 0;
a.time = ext->time; a.time = ext->time;
a.playback = 0; a.playback = 0;

View File

@@ -37,6 +37,7 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign,
static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * param); static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * param);
static void refr_position(lv_obj_t * roller, bool anim_en); static void refr_position(lv_obj_t * roller, bool anim_en);
static void inf_normalize(void * roller_scrl); static void inf_normalize(void * roller_scrl);
static void scroll_anim_ready_cb(lv_anim_t * a);
static void draw_bg(lv_obj_t * roller, const lv_area_t * mask); static void draw_bg(lv_obj_t * roller, const lv_area_t * mask);
/********************** /**********************
@@ -399,7 +400,7 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
lv_obj_set_height(lv_page_get_scrl(roller), lv_obj_set_height(lv_page_get_scrl(roller),
lv_obj_get_height(ext->ddlist.label) + lv_obj_get_height(roller)); lv_obj_get_height(ext->ddlist.label) + lv_obj_get_height(roller));
lv_obj_align(ext->ddlist.label, NULL, obj_align, 0, 0); lv_obj_align(ext->ddlist.label, NULL, obj_align, 0, 0);
lv_anim_del(lv_page_get_scrl(roller), (lv_anim_fp_t)lv_obj_set_y); lv_anim_del(lv_page_get_scrl(roller), (lv_anim_exec_cb_t)lv_obj_set_y);
lv_ddlist_set_selected(roller, ext->ddlist.sel_opt_id); lv_ddlist_set_selected(roller, ext->ddlist.sel_opt_id);
refr_position(roller, false); refr_position(roller, false);
@@ -413,7 +414,7 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
lv_obj_get_height(ext->ddlist.label) + lv_obj_get_height(roller)); lv_obj_get_height(ext->ddlist.label) + lv_obj_get_height(roller));
lv_obj_align(ext->ddlist.label, NULL, obj_align, 0, 0); lv_obj_align(ext->ddlist.label, NULL, obj_align, 0, 0);
lv_anim_del(lv_page_get_scrl(roller), (lv_anim_fp_t)lv_obj_set_y); lv_anim_del(lv_page_get_scrl(roller), (lv_anim_exec_cb_t)lv_obj_set_y);
lv_ddlist_set_selected(roller, ext->ddlist.sel_opt_id); lv_ddlist_set_selected(roller, ext->ddlist.sel_opt_id);
refr_position(roller, false); refr_position(roller, false);
} }
@@ -632,9 +633,9 @@ static void refr_position(lv_obj_t * roller, bool anim_en)
a.var = roller_scrl; a.var = roller_scrl;
a.start = lv_obj_get_y(roller_scrl); a.start = lv_obj_get_y(roller_scrl);
a.end = new_y; a.end = new_y;
a.fp = (lv_anim_fp_t)lv_obj_set_y; a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_y;
a.path = lv_anim_path_linear; a.path_cb = lv_anim_path_linear;
a.end_cb = inf_normalize; a.ready_cb = scroll_anim_ready_cb;
a.act_time = 0; a.act_time = 0;
a.time = ext->ddlist.anim_time; a.time = ext->ddlist.anim_time;
a.playback = 0; a.playback = 0;
@@ -677,4 +678,9 @@ static void inf_normalize(void * scrl)
} }
} }
static void scroll_anim_ready_cb(lv_anim_t * a)
{
inf_normalize(a->var);
}
#endif #endif

View File

@@ -38,9 +38,6 @@ extern "C" {
* TYPEDEFS * TYPEDEFS
**********************/ **********************/
/*callback on value change*/
typedef void (*lv_spinbox_value_changed_cb_t)(lv_obj_t * spinbox, int32_t new_value);
/*Data of spinbox*/ /*Data of spinbox*/
typedef struct typedef struct
{ {

View File

@@ -163,17 +163,17 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, const lv_obj_t * copy)
/*Create a cursor blinker animation*/ /*Create a cursor blinker animation*/
lv_anim_t a; lv_anim_t a;
a.var = new_ta; a.var = new_ta;
a.fp = (lv_anim_fp_t)cursor_blink_anim; a.exec_cb = (lv_anim_exec_cb_t)cursor_blink_anim;
a.time = LV_TA_CURSOR_BLINK_TIME; a.time = LV_TA_CURSOR_BLINK_TIME;
a.act_time = 0; a.act_time = 0;
a.end_cb = NULL; a.ready_cb = NULL;
a.start = 1; a.start = 1;
a.end = 0; a.end = 0;
a.repeat = 1; a.repeat = 1;
a.repeat_pause = 0; a.repeat_pause = 0;
a.playback = 1; a.playback = 1;
a.playback_pause = 0; a.playback_pause = 0;
a.path = lv_anim_path_step; a.path_cb = lv_anim_path_step;
lv_anim_create(&a); lv_anim_create(&a);
#endif #endif
@@ -248,17 +248,17 @@ void lv_ta_add_char(lv_obj_t * ta, uint32_t c)
/*Auto hide characters*/ /*Auto hide characters*/
lv_anim_t a; lv_anim_t a;
a.var = ta; a.var = ta;
a.fp = (lv_anim_fp_t)pwd_char_hider_anim; a.exec_cb = (lv_anim_exec_cb_t)pwd_char_hider_anim;
a.time = LV_TA_PWD_SHOW_TIME; a.time = LV_TA_PWD_SHOW_TIME;
a.act_time = 0; a.act_time = 0;
a.end_cb = (lv_anim_cb_t)pwd_char_hider; a.ready_cb = (lv_anim_ready_cb_t)pwd_char_hider;
a.start = 0; a.start = 0;
a.end = 1; a.end = 1;
a.repeat = 0; a.repeat = 0;
a.repeat_pause = 0; a.repeat_pause = 0;
a.playback = 0; a.playback = 0;
a.playback_pause = 0; a.playback_pause = 0;
a.path = lv_anim_path_step; a.path_cb = lv_anim_path_step;
lv_anim_create(&a); lv_anim_create(&a);
#else #else
pwd_char_hider(ta); pwd_char_hider(ta);
@@ -328,17 +328,17 @@ void lv_ta_add_text(lv_obj_t * ta, const char * txt)
/*Auto hide characters*/ /*Auto hide characters*/
lv_anim_t a; lv_anim_t a;
a.var = ta; a.var = ta;
a.fp = (lv_anim_fp_t)pwd_char_hider_anim; a.exec_cb = (lv_anim_exec_cb_t)pwd_char_hider_anim;
a.time = LV_TA_PWD_SHOW_TIME; a.time = LV_TA_PWD_SHOW_TIME;
a.act_time = 0; a.act_time = 0;
a.end_cb = (lv_anim_cb_t)pwd_char_hider; a.ready_cb = (lv_anim_ready_cb_t)pwd_char_hider;
a.start = 0; a.start = 0;
a.end = 1; a.end = 1;
a.repeat = 0; a.repeat = 0;
a.repeat_pause = 0; a.repeat_pause = 0;
a.playback = 0; a.playback = 0;
a.playback_pause = 0; a.playback_pause = 0;
a.path = lv_anim_path_step; a.path_cb = lv_anim_path_step;
lv_anim_create(&a); lv_anim_create(&a);
#else #else
pwd_char_hider(ta); pwd_char_hider(ta);
@@ -468,17 +468,17 @@ void lv_ta_set_text(lv_obj_t * ta, const char * txt)
/*Auto hide characters*/ /*Auto hide characters*/
lv_anim_t a; lv_anim_t a;
a.var = ta; a.var = ta;
a.fp = (lv_anim_fp_t)pwd_char_hider_anim; a.exec_cb = (lv_anim_exec_cb_t)pwd_char_hider_anim;
a.time = LV_TA_PWD_SHOW_TIME; a.time = LV_TA_PWD_SHOW_TIME;
a.act_time = 0; a.act_time = 0;
a.end_cb = (lv_anim_cb_t)pwd_char_hider; a.ready_cb = (lv_anim_ready_cb_t)pwd_char_hider;
a.start = 0; a.start = 0;
a.end = 1; a.end = 1;
a.repeat = 0; a.repeat = 0;
a.repeat_pause = 0; a.repeat_pause = 0;
a.playback = 0; a.playback = 0;
a.playback_pause = 0; a.playback_pause = 0;
a.path = lv_anim_path_step; a.path_cb = lv_anim_path_step;
lv_anim_create(&a); lv_anim_create(&a);
#else #else
pwd_char_hider(ta); pwd_char_hider(ta);
@@ -574,17 +574,17 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos)
/*Reset cursor blink animation*/ /*Reset cursor blink animation*/
lv_anim_t a; lv_anim_t a;
a.var = ta; a.var = ta;
a.fp = (lv_anim_fp_t)cursor_blink_anim; a.exec_cb = (lv_anim_exec_cb_t)cursor_blink_anim;
a.time = LV_TA_CURSOR_BLINK_TIME; a.time = LV_TA_CURSOR_BLINK_TIME;
a.act_time = 0; a.act_time = 0;
a.end_cb = NULL; a.ready_cb = NULL;
a.start = 1; a.start = 1;
a.end = 0; a.end = 0;
a.repeat = 1; a.repeat = 1;
a.repeat_pause = 0; a.repeat_pause = 0;
a.playback = 1; a.playback = 1;
a.playback_pause = 0; a.playback_pause = 0;
a.path = lv_anim_path_step; a.path_cb = lv_anim_path_step;
lv_anim_create(&a); lv_anim_create(&a);
#endif #endif

View File

@@ -379,9 +379,9 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
a.var = ext->content; a.var = ext->content;
a.start = lv_obj_get_x(ext->content); a.start = lv_obj_get_x(ext->content);
a.end = cont_x; a.end = cont_x;
a.fp = (lv_anim_fp_t)lv_obj_set_x; a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_x;
a.path = lv_anim_path_linear; a.path_cb = lv_anim_path_linear;
a.end_cb = NULL; a.ready_cb = NULL;
a.act_time = 0; a.act_time = 0;
a.time = ext->anim_time; a.time = ext->anim_time;
a.playback = 0; a.playback = 0;
@@ -431,18 +431,18 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
case LV_TABVIEW_BTNS_POS_BOTTOM: case LV_TABVIEW_BTNS_POS_BOTTOM:
a.start = lv_obj_get_x(ext->indic); a.start = lv_obj_get_x(ext->indic);
a.end = indic_pos; a.end = indic_pos;
a.fp = (lv_anim_fp_t)lv_obj_set_x; a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_x;
break; break;
case LV_TABVIEW_BTNS_POS_LEFT: case LV_TABVIEW_BTNS_POS_LEFT:
case LV_TABVIEW_BTNS_POS_RIGHT: case LV_TABVIEW_BTNS_POS_RIGHT:
a.start = lv_obj_get_y(ext->indic); a.start = lv_obj_get_y(ext->indic);
a.end = indic_pos; a.end = indic_pos;
a.fp = (lv_anim_fp_t)lv_obj_set_y; a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_y;
break; break;
} }
a.path = lv_anim_path_linear; a.path_cb = lv_anim_path_linear;
a.end_cb = NULL; a.ready_cb = NULL;
a.act_time = 0; a.act_time = 0;
a.time = ext->anim_time; a.time = ext->anim_time;
a.playback = 0; a.playback = 0;

View File

@@ -211,9 +211,9 @@ void lv_tileview_set_tile_act(lv_obj_t * tileview, lv_coord_t x, lv_coord_t y, b
lv_anim_t a; lv_anim_t a;
a.var = scrl; a.var = scrl;
a.fp = (lv_anim_fp_t)lv_obj_set_x; a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_x;
a.path = lv_anim_path_linear; a.path_cb = lv_anim_path_linear;
a.end_cb = NULL; a.ready_cb = NULL;
a.act_time = 0; a.act_time = 0;
a.time = ext->anim_time; a.time = ext->anim_time;
a.playback = 0; a.playback = 0;
@@ -230,7 +230,7 @@ void lv_tileview_set_tile_act(lv_obj_t * tileview, lv_coord_t x, lv_coord_t y, b
if(y_coord != y_act) { if(y_coord != y_act) {
a.start = y_act; a.start = y_act;
a.end = y_coord; a.end = y_coord;
a.fp = (lv_anim_fp_t)lv_obj_set_y; a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_y;
lv_anim_create(&a); lv_anim_create(&a);
} }
#endif #endif

View File

@@ -31,10 +31,6 @@ extern "C" {
* TYPEDEFS * TYPEDEFS
**********************/ **********************/
/* parametes: pointer to a tileview object, x, y (tile coordinates to load)
* return: LV_RES_INV: to prevent the loading of the tab; LV_RES_OK: if everything is fine*/
typedef lv_res_t (*lv_tileview_action_t)(lv_obj_t *, lv_coord_t, lv_coord_t);
/*Data of tileview*/ /*Data of tileview*/
typedef struct typedef struct
{ {