1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

ptask API changes (void * parameter) are followed

This commit is contained in:
Gabor 2017-01-06 13:30:57 +01:00
parent ff2e158045
commit cf54f36daa
4 changed files with 47 additions and 21 deletions

View File

@ -28,7 +28,7 @@
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static void anim_task (void); static void anim_task (void * param);
static bool anim_ready_handler(anim_t * a); static bool anim_ready_handler(anim_t * a);
/********************** /**********************
@ -65,7 +65,7 @@ void anim_init(void)
{ {
ll_init(&anim_ll, sizeof(anim_t)); ll_init(&anim_ll, sizeof(anim_t));
last_task_run = systick_get(); last_task_run = systick_get();
ptask_create(anim_task, LV_REFR_PERIOD, PTASK_PRIO_MID); ptask_create(anim_task, LV_REFR_PERIOD, PTASK_PRIO_MID, NULL);
} }
/** /**
@ -160,8 +160,9 @@ anim_path_t * anim_get_path(anim_path_name_t name)
/** /**
* Periodically handle the animations. * Periodically handle the animations.
* @param param unused
*/ */
static void anim_task (void) static void anim_task (void * param)
{ {
uint32_t elaps; uint32_t elaps;
elaps = systick_elaps(last_task_run); elaps = systick_elaps(last_task_run);

View File

@ -27,7 +27,7 @@
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static void dispi_task(void); static void dispi_task(void * param);
static void dispi_proc_point(lv_dispi_t * dispi_p, cord_t x, cord_t y); static void dispi_proc_point(lv_dispi_t * dispi_p, cord_t x, cord_t y);
static void dispi_proc_press(lv_dispi_t * dispi_p); static void dispi_proc_press(lv_dispi_t * dispi_p);
static void disi_proc_release(lv_dispi_t * dispi_p); static void disi_proc_release(lv_dispi_t * dispi_p);
@ -59,7 +59,7 @@ void lv_dispi_init(void)
lv_dispi_reset_now = false; lv_dispi_reset_now = false;
#if LV_DISPI_READ_PERIOD != 0 #if LV_DISPI_READ_PERIOD != 0
dispi_task_p = ptask_create(dispi_task, LV_DISPI_READ_PERIOD, PTASK_PRIO_MID); dispi_task_p = ptask_create(dispi_task, LV_DISPI_READ_PERIOD, PTASK_PRIO_MID, NULL);
#else #else
dispi_task_p = ptask_create(dispi_task, 1, PTASK_PRIO_OFF); /*Not use lv_dispi*/ dispi_task_p = ptask_create(dispi_task, 1, PTASK_PRIO_OFF); /*Not use lv_dispi*/
#endif #endif
@ -105,14 +105,24 @@ void lv_dispi_get_vect(lv_dispi_t * dispi_p, point_t * point_p)
point_p->y = dispi_p->vect.y; point_p->y = dispi_p->vect.y;
} }
/**
* Do nothing until the next release
* @param dispi_p pointer to a display input
*/
void lv_dispi_wait_release(lv_dispi_t * dispi_p)
{
dispi_p->wait_release = 1;
}
/********************** /**********************
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
/** /**
* Called periodically to handle the display inputs * Called periodically to handle the display inputs
* @param param unused
*/ */
static void dispi_task(void) static void dispi_task(void * param)
{ {
static lv_dispi_t dispi[INDEV_NUM]; static lv_dispi_t dispi[INDEV_NUM];
@ -191,6 +201,8 @@ static void dispi_proc_press(lv_dispi_t * dispi_p)
{ {
lv_obj_t * pr_obj = dispi_p->act_obj; lv_obj_t * pr_obj = dispi_p->act_obj;
if(dispi_p->wait_release != 0) return;
/*If there is no last object then search*/ /*If there is no last object then search*/
if(dispi_p->act_obj == NULL) { if(dispi_p->act_obj == NULL) {
pr_obj = dispi_search_obj(dispi_p, lv_scr_act()); pr_obj = dispi_search_obj(dispi_p, lv_scr_act());
@ -294,11 +306,18 @@ static void dispi_proc_press(lv_dispi_t * dispi_p)
*/ */
static void disi_proc_release(lv_dispi_t * dispi_p) static void disi_proc_release(lv_dispi_t * dispi_p)
{ {
if(dispi_p->wait_release != 0) {
dispi_p->act_obj = NULL;
dispi_p->last_obj = NULL;
dispi_p->press_time_stamp = 0;
dispi_p->lpr_rep_time_stamp = 0;
dispi_p->wait_release = 0;
}
/*Forgot the act obj and send a released signal */ /*Forgot the act obj and send a released signal */
if(dispi_p->act_obj != NULL) { if(dispi_p->act_obj != NULL) {
dispi_p->act_obj->signal_f(dispi_p->act_obj, dispi_p->act_obj->signal_f(dispi_p->act_obj,
LV_SIGNAL_RELEASED, dispi_p); LV_SIGNAL_RELEASED, dispi_p);
dispi_p->act_obj = NULL; dispi_p->act_obj = NULL;
dispi_p->press_time_stamp = 0; dispi_p->press_time_stamp = 0;
dispi_p->lpr_rep_time_stamp = 0; dispi_p->lpr_rep_time_stamp = 0;
@ -309,6 +328,7 @@ static void disi_proc_release(lv_dispi_t * dispi_p)
if(dispi_p->last_obj != NULL && lv_dispi_reset_qry == false) { if(dispi_p->last_obj != NULL && lv_dispi_reset_qry == false) {
dispi_drag_throw(dispi_p); dispi_drag_throw(dispi_p);
} }
} }
/** /**

View File

@ -29,7 +29,7 @@ typedef struct
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static void lv_refr_task(void); static void lv_refr_task(void * param);
static void lv_refr_join_area(void); static void lv_refr_join_area(void);
static void lv_refr_areas(void); static void lv_refr_areas(void);
#if LV_VDB_SIZE == 0 #if LV_VDB_SIZE == 0
@ -65,7 +65,7 @@ void lv_refr_init(void)
memset(inv_buf, 0, sizeof(inv_buf)); memset(inv_buf, 0, sizeof(inv_buf));
ptask_t* task; ptask_t* task;
task = ptask_create(lv_refr_task, LV_REFR_PERIOD, PTASK_PRIO_MID); task = ptask_create(lv_refr_task, LV_REFR_PERIOD, PTASK_PRIO_MID, NULL);
dm_assert(task); dm_assert(task);
} }
@ -127,8 +127,9 @@ void lv_inv_area(const area_t * area_p)
/** /**
* Called periodically to handle the refreshing * Called periodically to handle the refreshing
* @param param unused
*/ */
static void lv_refr_task(void) static void lv_refr_task(void * param)
{ {
lv_refr_join_area(); lv_refr_join_area();

View File

@ -153,16 +153,20 @@ bool lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
* (The created label will be deleted automatically) */ * (The created label will be deleted automatically) */
break; break;
case LV_SIGNAL_STYLE_CHG: case LV_SIGNAL_STYLE_CHG:
lv_obj_set_style(ext->label, &style->labels); if(ext->label) {
lv_obj_set_width(ext->label, lv_obj_get_width(ta) - 2 * lv_obj_set_style(ext->label, &style->labels);
(style->pages.bg_rects.hpad + style->pages.scrl_rects.hpad)); lv_obj_set_width(ext->label, lv_obj_get_width(ta) - 2 *
lv_label_set_text(ext->label, NULL); (style->pages.bg_rects.hpad + style->pages.scrl_rects.hpad));
lv_label_set_text(ext->label, NULL);
}
break; break;
/*Set the label width according to the text area width*/ /*Set the label width according to the text area width*/
case LV_SIGNAL_CORD_CHG: case LV_SIGNAL_CORD_CHG:
lv_obj_set_width(ext->label, lv_obj_get_width(ta) - 2 * if(ext->label != NULL) {
(style->pages.bg_rects.hpad + style->pages.scrl_rects.hpad)); lv_obj_set_width(ext->label, lv_obj_get_width(ta) - 2 *
lv_label_set_text(ext->label, NULL); (style->pages.bg_rects.hpad + style->pages.scrl_rects.hpad));
lv_label_set_text(ext->label, NULL);
}
break; break;
default: default:
break; break;
@ -584,7 +588,7 @@ static void lv_tas_init(void)
{ {
/*Default style*/ /*Default style*/
lv_pages_get(LV_PAGES_DEF, &lv_tas_def.pages); lv_pages_get(LV_PAGES_DEF, &lv_tas_def.pages);
lv_tas_def.pages.sb_mode = LV_PAGE_SB_MODE_ON; lv_tas_def.pages.sb_mode = LV_PAGE_SB_MODE_DRAG;
lv_labels_get(LV_LABELS_TXT, &lv_tas_def.labels); lv_labels_get(LV_LABELS_TXT, &lv_tas_def.labels);
lv_tas_def.labels.objs.color = COLOR_MAKE(0x20, 0x20, 0x20); lv_tas_def.labels.objs.color = COLOR_MAKE(0x20, 0x20, 0x20);
@ -595,7 +599,7 @@ static void lv_tas_init(void)
memcpy(&lv_tas_simple, &lv_tas_def, sizeof(lv_tas_t)); memcpy(&lv_tas_simple, &lv_tas_def, sizeof(lv_tas_t));
lv_pages_get(LV_PAGES_SIMPLE, &lv_tas_simple.pages); lv_pages_get(LV_PAGES_SIMPLE, &lv_tas_simple.pages);
lv_tas_simple.pages.sb_mode = LV_PAGE_SB_MODE_ON; lv_tas_simple.pages.sb_mode = LV_PAGE_SB_MODE_DRAG;
lv_tas_simple.pages.scrl_rects.objs.transp = 0; /*if transp == 1 the cursor will not be drawn*/ lv_tas_simple.pages.scrl_rects.objs.transp = 0; /*if transp == 1 the cursor will not be drawn*/
lv_tas_simple.pages.bg_rects.objs.color = COLOR_WHITE; lv_tas_simple.pages.bg_rects.objs.color = COLOR_WHITE;
lv_tas_simple.pages.bg_rects.gcolor = COLOR_SILVER; lv_tas_simple.pages.bg_rects.gcolor = COLOR_SILVER;