Eliminate some warnings

This commit is contained in:
Gabor
2016-12-21 15:34:01 +01:00
44 changed files with 512 additions and 365 deletions

View File

@@ -259,7 +259,7 @@ static void dispi_proc_press(lv_dispi_t * dispi_p)
/*If there is active object and it can be dragged run the drag*/
if(dispi_p->act_obj != NULL) {
dispi_p->act_obj->signal_f(dispi_p->act_obj, LV_SIGNAL_PRESSING, dispi_p);
dispi_drag(dispi_p);
/*If there is no drag then check for long press time*/

View File

@@ -38,8 +38,8 @@ typedef struct
typedef enum
{
LV_ACTION_RES_OK = 0,
LV_ACTION_RES_INV = 0,
LV_ACTION_RES_INV = 0,
LV_ACTION_RES_OK,
}lv_action_res_t;
typedef lv_action_res_t ( * lv_action_t) (struct __LV_OBJ_T * obj, lv_dispi_t * dispi);

View File

@@ -35,6 +35,7 @@
**********************/
static void lv_obj_pos_child_refr(lv_obj_t * obj, cord_t x_diff, cord_t y_diff);
static void lv_style_refr_core(void * style_p, lv_obj_t * obj);
static void lv_obj_del_child(lv_obj_t * obj);
static bool lv_obj_design(lv_obj_t * obj, const area_t * mask_p, lv_design_mode_t mode);
/**********************
@@ -95,6 +96,12 @@ void lv_init(void)
/*Init the display input handling*/
lv_dispi_init();
#endif
/*Initialize the application level*/
#if LV_APP_ENABLE != 0
lv_app_init();
#endif
}
/**
@@ -290,7 +297,7 @@ void lv_obj_del(lv_obj_t * obj)
i_next = ll_get_next(&(obj->child_ll), i);
/*Call the recursive del to the child too*/
lv_obj_del(i);
lv_obj_del_child(i);
/*Set i to the next node*/
i = i_next;
@@ -1481,4 +1488,43 @@ static void lv_style_refr_core(void * style_p, lv_obj_t * obj)
}
}
/**
* Called by 'lv_obj_del' to delete the children objects
* @param obj pointer to an object (all of its children will be deleted)
*/
static void lv_obj_del_child(lv_obj_t * obj)
{
lv_obj_t * i;
lv_obj_t * i_next;
i = ll_get_head(&(obj->child_ll));
while(i != NULL) {
/*Get the next object before delete this*/
i_next = ll_get_next(&(obj->child_ll), i);
/*Call the recursive del to the child too*/
lv_obj_del_child(i);
/*Set i to the next node*/
i = i_next;
}
/*Remove the animations from this object*/
anim_del(obj, NULL);
/*Remove the object from parent's children list*/
lv_obj_t * par = lv_obj_get_parent(obj);
ll_rem(&(par->child_ll), obj);
/* All children deleted.
* Now clean up the object specific data*/
obj->signal_f(obj, LV_SIGNAL_CLEANUP, NULL);
/*Delete the base objects*/
if(obj->ext != NULL) dm_free(obj->ext);
if(obj->style_iso != 0) dm_free(obj->style_p);
dm_free(obj); /*Free the object itself*/
}

View File

@@ -30,8 +30,8 @@ typedef struct
* STATIC PROTOTYPES
**********************/
static void lv_refr_task(void);
static void lv_refr_join_area(lv_join_t * area_a, uint32_t inv_num);
static void lv_refr_areas(lv_join_t * area_a, uint32_t area_num);
static void lv_refr_join_area(void);
static void lv_refr_areas(void);
#if LV_VDB_SIZE == 0
static void lv_refr_area_no_vdb(const area_t * area_p);
#else
@@ -45,8 +45,8 @@ static void lv_refr_obj(lv_obj_t * obj, const area_t * mask_ori_p);
/**********************
* STATIC VARIABLES
**********************/
fifo_t fifo_inv;
area_t fifo_inv_buf[LV_INV_FIFO_SIZE];
lv_join_t inv_buf[LV_INV_FIFO_SIZE];
uint16_t inv_buf_p;
/**********************
* MACROS
@@ -61,8 +61,9 @@ area_t fifo_inv_buf[LV_INV_FIFO_SIZE];
*/
void lv_refr_init(void)
{
fifo_init(&fifo_inv, fifo_inv_buf, sizeof(area_t), LV_INV_FIFO_SIZE);
inv_buf_p = 0;
memset(inv_buf, 0, sizeof(inv_buf));
ptask_t* task;
task = ptask_create(lv_refr_task, LV_REFR_PERIOD, PTASK_PRIO_MID);
dm_assert(task);
@@ -101,16 +102,22 @@ void lv_inv_area(const area_t * area_p)
com_area.x2 = com_area.x2 | 0x3;
com_area.y2 = com_area.y2 | 0x3;
#endif
/*Save the area*/
suc = fifo_push(&fifo_inv, &com_area);
/* There is no place for the new area
* clear the fifo and add the whole screen*/
if(suc == false)
{
fifo_clear(&fifo_inv);
fifo_push(&fifo_inv, &scr_area);
/*Save only if this area is not in one of the saved areas*/
uint16_t i;
for(i = 0; i < inv_buf_p; i++) {
if(area_is_in(&com_area, &inv_buf[i].area) != false) return;
}
/*Save the area*/
if(inv_buf_p < LV_INV_FIFO_SIZE) {
area_cpy(&inv_buf[inv_buf_p].area,&com_area);
} else {/*If no place for the area add the screen*/
inv_buf_p = 0;
area_cpy(&inv_buf[inv_buf_p].area,&scr_area);
}
inv_buf_p ++;
}
}
@@ -123,66 +130,50 @@ void lv_inv_area(const area_t * area_p)
*/
static void lv_refr_task(void)
{
lv_join_t area_tmp[LV_INV_FIFO_SIZE];
lv_refr_join_area();
memset(area_tmp, 0, sizeof(area_tmp));
/*Read all data from the fifo_inv*/
uint32_t inv_num;
bool suc;
for(inv_num = 0; inv_num < LV_INV_FIFO_SIZE; inv_num++)
{
suc = fifo_pop(&fifo_inv, &area_tmp[inv_num].area);
if(suc == false) /*Break id the fifo is empty*/
{
break;
}
}
lv_refr_join_area(area_tmp, inv_num);
lv_refr_areas(area_tmp, inv_num);
lv_refr_areas();
memset(inv_buf, 0, sizeof(inv_buf));
inv_buf_p = 0;
}
/**
* Join the areas which has got common parts
* @param join_a an array of areas to join
* @param inv_num item number of the array
*/
static void lv_refr_join_area(lv_join_t * area_a, uint32_t area_num)
static void lv_refr_join_area(void)
{
uint32_t join_from;
uint32_t join_in;
area_t joined_area;
for(join_in = 0; join_in < area_num; join_in++) {
if(area_a[join_in].joined != 0) continue;
for(join_in = 0; join_in < inv_buf_p; join_in++) {
if(inv_buf[join_in].joined != 0) continue;
/*Check all areas to join them in 'join_in'*/
for(join_from = 0; join_from < area_num; join_from++) {
for(join_from = 0; join_from < inv_buf_p; join_from++) {
/*Handle only unjoined areas and ignore itself*/
if(area_a[join_from].joined != 0 || join_in == join_from) {
if(inv_buf[join_from].joined != 0 || join_in == join_from) {
continue;
}
/*Check if the areas are on each other*/
if(area_is_on(&area_a[join_in].area,
&area_a[join_from].area) == false)
if(area_is_on(&inv_buf[join_in].area,
&inv_buf[join_from].area) == false)
{
continue;
}
area_join(&joined_area, &area_a[join_in].area,
&area_a[join_from].area);
area_join(&joined_area, &inv_buf[join_in].area,
&inv_buf[join_from].area);
/*Join two area only if the joined area size is smaller*/
if(area_get_size(&joined_area) <
(area_get_size(&area_a[join_in].area) + area_get_size(&area_a[join_from].area))) {
area_cpy(&area_a[join_in].area, &joined_area);
(area_get_size(&inv_buf[join_in].area) + area_get_size(&inv_buf[join_from].area))) {
area_cpy(&inv_buf[join_in].area, &joined_area);
/*Mark 'join_form' is joined into 'join_in'*/
area_a[join_from].joined = 1;
inv_buf[join_from].joined = 1;
}
}
}
@@ -190,22 +181,20 @@ static void lv_refr_join_area(lv_join_t * area_a, uint32_t area_num)
/**
* Refresh the joined areas
* @param area_a array of joined invalid areas
* @param area_num item number of the array
*/
static void lv_refr_areas(lv_join_t * area_a, uint32_t area_num)
static void lv_refr_areas(void)
{
uint32_t i;
for(i = 0; i < area_num; i++) {
for(i = 0; i < inv_buf_p; i++) {
/*Refresh the unjoined areas*/
if(area_a[i].joined == 0) {
if(inv_buf[i].joined == 0) {
/*If there is no VDB do simple drawing*/
#if LV_VDB_SIZE == 0
lv_refr_area_no_vdb(&area_a[i].area);
lv_refr_area_no_vdb(&inv_buf[i].area);
#else
/*If VDB is used...*/
lv_refr_area_with_vdb(&area_a[i].area);
lv_refr_area_with_vdb(&inv_buf[i].area);
#endif
}
@@ -314,10 +303,7 @@ static lv_obj_t * lv_refr_get_top_obj(const area_t * area_p, lv_obj_t * obj)
lv_obj_t * found_p = NULL;
/*If this object is fully cover the draw area check the children too */
if(obj->opa == OPA_COVER &&
obj->hidden == 0 &&
LV_SA(obj, lv_objs_t)->transp == 0 &&
obj->design_f(obj, area_p, LV_DESIGN_COVER_CHK) != false)
if(area_is_in(area_p, &obj->cords) && obj->hidden == 0)
{
LL_READ(obj->child_ll, i) {
found_p = lv_refr_get_top_obj(area_p, i);
@@ -328,9 +314,13 @@ static lv_obj_t * lv_refr_get_top_obj(const area_t * area_p, lv_obj_t * obj)
}
}
/*If there is no better children use this object*/
/*If no better children check this object*/
if(found_p == NULL) {
found_p = obj;
if(obj->opa == OPA_COVER &&
LV_SA(obj, lv_objs_t)->transp == 0 &&
obj->design_f(obj, area_p, LV_DESIGN_COVER_CHK) != false) {
found_p = obj;
}
}
}
@@ -408,6 +398,7 @@ static void lv_refr_obj(lv_obj_t * obj, const area_t * mask_ori_p)
/* Redraw the object */
if(obj->opa != OPA_TRANSP && LV_SA(obj, lv_objs_t)->transp == 0) {
obj->design_f(obj, &obj_ext_mask, LV_DESIGN_DRAW_MAIN);
/* tick_wait_ms(100); */ /*DEBUG: Wait after every object draw to see the order of drawing*/
}
/*Create a new 'obj_mask' without 'ext_size' because the children can't be visible there*/