Merge branch 'dev-6.0' into font

This commit is contained in:
Gabor Kiss-Vamosi
2019-04-27 19:37:24 +02:00
7 changed files with 51 additions and 26 deletions

View File

@@ -68,13 +68,13 @@ void lv_indev_init(void)
* Called periodically to read the input devices * Called periodically to read the input devices
* @param param pointer to and input device to read * @param param pointer to and input device to read
*/ */
void lv_indev_read_task(void * param) void lv_indev_read_task(lv_task_t * task)
{ {
LV_LOG_TRACE("indev read task started"); LV_LOG_TRACE("indev read task started");
lv_indev_data_t data; lv_indev_data_t data;
indev_act = param; indev_act = task->user_data;
/*Read and process all indevs*/ /*Read and process all indevs*/
if(indev_act->driver.disp == NULL) return; /*Not assigned to any displays*/ if(indev_act->driver.disp == NULL) return; /*Not assigned to any displays*/

View File

@@ -36,9 +36,9 @@ void lv_indev_init(void);
/** /**
* Called periodically to read the input devices * Called periodically to read the input devices
* @param param pointer to and input device to read * @param task pointer to the task itself
*/ */
void lv_indev_read_task(void * param); void lv_indev_read_task(lv_task_t * task);
/** /**
* Get the currently processed input device. Can be used in action functions too. * Get the currently processed input device. Can be used in action functions too.

View File

@@ -132,15 +132,15 @@ lv_disp_t * lv_refr_get_disp_refreshing(void)
/** /**
* Called periodically to handle the refreshing * Called periodically to handle the refreshing
* @param param point to a `lv_disp_t` to refresh * @param task pointer to the task itself
*/ */
void lv_disp_refr_task(void * param) void lv_disp_refr_task(lv_task_t * task)
{ {
LV_LOG_TRACE("lv_refr_task: started"); LV_LOG_TRACE("lv_refr_task: started");
uint32_t start = lv_tick_get(); uint32_t start = lv_tick_get();
disp_refr = param; disp_refr = task->user_data;
lv_refr_join_area(); lv_refr_join_area();

View File

@@ -69,9 +69,9 @@ lv_disp_t * lv_refr_get_disp_refreshing(void);
/** /**
* Called periodically to handle the refreshing * Called periodically to handle the refreshing
* @param param point to a `lv_disp_t` to refresh * @param task pointer to the task itself
*/ */
void lv_disp_refr_task(void * param); void lv_disp_refr_task(lv_task_t * task);
/********************** /**********************
* STATIC FUNCTIONS * STATIC FUNCTIONS

View File

@@ -138,7 +138,7 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void)
if(task_deleted) if(task_deleted)
break; /*If a task was deleted then this or the next item might be corrupted*/ break; /*If a task was deleted then this or the next item might be corrupted*/
if(task_created) if(task_created)
break; /*If a task was deleted then this or the next item might be corrupted*/ break; /*If a task was created then this or the next item might be corrupted*/
LV_GC_ROOT(_lv_task_act) = next; /*Load the next task*/ LV_GC_ROOT(_lv_task_act) = next; /*Load the next task*/
} }
@@ -165,7 +165,7 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void)
* @param task a function which is the task itself * @param task a function which is the task itself
* @param period call period in ms unit * @param period call period in ms unit
* @param prio priority of the task (LV_TASK_PRIO_OFF means the task is stopped) * @param prio priority of the task (LV_TASK_PRIO_OFF means the task is stopped)
* @param user_data free parameter * @param user_data custom parameter
* @return pointer to the new task * @return pointer to the new task
*/ */
lv_task_t * lv_task_create(void (*task)(void *), uint32_t period, lv_task_prio_t prio, void * user_data) lv_task_t * lv_task_create(void (*task)(void *), uint32_t period, lv_task_prio_t prio, void * user_data)
@@ -198,12 +198,20 @@ lv_task_t * lv_task_create(void (*task)(void *), uint32_t period, lv_task_prio_t
} }
new_lv_task->period = period; new_lv_task->period = period;
new_lv_task->task = task; new_lv_task->task_cb = task;
new_lv_task->prio = prio; new_lv_task->prio = prio;
new_lv_task->param = user_data;
new_lv_task->once = 0; new_lv_task->once = 0;
new_lv_task->last_run = lv_tick_get(); new_lv_task->last_run = lv_tick_get();
#if LV_USE_USER_DATA_SINGLE
new_lv_task->user_data = user_data;
#endif
#if LV_USE_USER_DATA_MULTI
new_lv_task->task_user_data = NULL;
#endif
task_created = true; task_created = true;
return new_lv_task; return new_lv_task;
@@ -322,7 +330,7 @@ static bool lv_task_exec(lv_task_t * lv_task_p)
lv_task_p->last_run = lv_tick_get(); lv_task_p->last_run = lv_tick_get();
task_deleted = false; task_deleted = false;
task_created = false; task_created = false;
lv_task_p->task(lv_task_p->param); lv_task_p->task_cb(lv_task_p);
/*Delete if it was a one shot lv_task*/ /*Delete if it was a one shot lv_task*/
if(task_deleted == false) { /*The task might be deleted by itself as well*/ if(task_deleted == false) { /*The task might be deleted by itself as well*/

View File

@@ -55,8 +55,16 @@ typedef struct
{ {
uint32_t period; uint32_t period;
uint32_t last_run; uint32_t last_run;
void (*task)(void *); void (*task_cb)(void *);
void * param;
#if LV_USE_USER_DATA_SINGLE
void * user_data;
#endif
#if LV_USE_USER_DATA_MULTI
void * task_user_data;
#endif
uint8_t prio : 3; uint8_t prio : 3;
uint8_t once : 1; uint8_t once : 1;
} lv_task_t; } lv_task_t;
@@ -80,15 +88,14 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void);
* @param task a function which is the task itself * @param task a function which is the task itself
* @param period call period in ms unit * @param period call period in ms unit
* @param prio priority of the task (LV_TASK_PRIO_OFF means the task is stopped) * @param prio priority of the task (LV_TASK_PRIO_OFF means the task is stopped)
* @param user_data free parameter * @param user_data custom parameter
* @return pointer to the new task * @return pointer to the new task_cb
*/ */
lv_task_t * lv_task_create(void (*task)(void *), uint32_t period, lv_task_prio_t prio, lv_task_t * lv_task_create(void (*task)(void *), uint32_t period, lv_task_prio_t prio, void * user_data);
void * user_data);
/** /**
* Delete a lv_task * Delete a lv_task
* @param lv_task_p pointer to task created by lv_task_p * @param lv_task_p pointer to task_cb created by lv_task_p
*/ */
void lv_task_del(lv_task_t * lv_task_p); void lv_task_del(lv_task_t * lv_task_p);

View File

@@ -118,7 +118,12 @@ lv_obj_t * lv_kb_create(lv_obj_t * par, const lv_obj_t * copy)
/*Init the new keyboard keyboard*/ /*Init the new keyboard keyboard*/
if(copy == NULL) { if(copy == NULL) {
lv_obj_set_size(new_kb, LV_DPI * 3, LV_DPI * 2); /* Set a size which fits into the parent.
* Don't use `par` directly because if the window is created on a page it is moved to the
* scrollable so the parent has changed */
lv_obj_set_size(new_kb, lv_obj_get_width_fit(lv_obj_get_parent(new_kb)),
lv_obj_get_height_fit(lv_obj_get_parent(new_kb)));
lv_obj_align(new_kb, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0); lv_obj_align(new_kb, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
lv_obj_set_event_cb(new_kb, lv_kb_def_event_cb); lv_obj_set_event_cb(new_kb, lv_kb_def_event_cb);
lv_btnm_set_map(new_kb, kb_map_lc); lv_btnm_set_map(new_kb, kb_map_lc);
@@ -350,17 +355,22 @@ void lv_kb_def_event_cb(lv_obj_t * kb, lv_event_t event)
return; return;
} else if(strcmp(txt, LV_SYMBOL_CLOSE) == 0) { } else if(strcmp(txt, LV_SYMBOL_CLOSE) == 0) {
if(kb->event_cb != lv_kb_def_event_cb) { if(kb->event_cb != lv_kb_def_event_cb) {
lv_event_send(kb, LV_EVENT_CANCEL, NULL); lv_res_t res = lv_event_send(kb, LV_EVENT_CANCEL, NULL);
if(res != LV_RES_OK) return;
} else { } else {
lv_kb_set_ta(kb, NULL); /*De-assign the text area to hide it cursor if needed*/ lv_kb_set_ta(kb, NULL); /*De-assign the text area to hide it cursor if needed*/
lv_obj_del(kb); lv_obj_del(kb);
return;
} }
return; return;
} else if(strcmp(txt, LV_SYMBOL_OK) == 0) { } else if(strcmp(txt, LV_SYMBOL_OK) == 0) {
if(kb->event_cb != lv_kb_def_event_cb) if(kb->event_cb != lv_kb_def_event_cb) {
lv_event_send(kb, LV_EVENT_APPLY, NULL); lv_res_t res = lv_event_send(kb, LV_EVENT_APPLY, NULL);
else if(res != LV_RES_OK) return;
}
else {
lv_kb_set_ta(kb, NULL); /*De-assign the text area to hide it cursor if needed*/ lv_kb_set_ta(kb, NULL); /*De-assign the text area to hide it cursor if needed*/
}
return; return;
} }