1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

pkg/lvgl: remove internal background thread

This commit is contained in:
Alexandre Abadie 2021-05-20 12:38:55 +02:00
parent 9c749bc214
commit 41a185cb92
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
2 changed files with 23 additions and 37 deletions

View File

@ -30,10 +30,6 @@
#include "screen_dev.h"
#ifndef LVGL_TASK_THREAD_PRIO
#define LVGL_TASK_THREAD_PRIO (THREAD_PRIORITY_MAIN + 1)
#endif
#ifndef LVGL_COLOR_BUF_SIZE
#define LVGL_COLOR_BUF_SIZE (LV_HOR_RES_MAX * 5)
#endif
@ -50,7 +46,6 @@
#define LVGL_THREAD_FLAG (1 << 7)
#endif
static char _task_thread_stack[THREAD_STACKSIZE_LARGE];
static kernel_pid_t _task_thread_pid;
static lv_disp_buf_t disp_buf;
@ -59,30 +54,6 @@ static lv_color_t buf[LVGL_COLOR_BUF_SIZE];
static screen_dev_t *_screen_dev = NULL;
static void *_task_thread(void *arg)
{
(void)arg;
while (1) {
/* Normal operation (no sleep) in < CONFIG_LVGL_INACTIVITY_PERIOD_MS msec
inactivity */
if (lv_disp_get_inactive_time(NULL) < CONFIG_LVGL_INACTIVITY_PERIOD_MS) {
lv_task_handler();
}
else {
/* Block after LVGL_ACTIVITY_PERIOD msec inactivity */
thread_flags_wait_one(LVGL_THREAD_FLAG);
/* trigger an activity so the task handler is called on the next loop */
lv_disp_trig_activity(NULL);
}
xtimer_usleep(CONFIG_LVGL_TASK_HANDLER_DELAY_US);
}
return NULL;
}
static void _disp_map(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_p)
{
if (!_screen_dev->display) {
@ -154,15 +125,30 @@ void lvgl_init(screen_dev_t *screen_dev)
lv_indev_drv_register(&indev_drv);
}
#endif
lv_task_handler();
}
void lvgl_start(void)
void lvgl_run(void)
{
_task_thread_pid = thread_create(_task_thread_stack, sizeof(_task_thread_stack),
LVGL_TASK_THREAD_PRIO, THREAD_CREATE_STACKTEST,
_task_thread, NULL, "_task_thread");
_task_thread_pid = thread_getpid();
lv_task_handler();
while (1) {
/* Normal operation (no sleep) in < CONFIG_LVGL_INACTIVITY_PERIOD_MS msec
inactivity */
if (lv_disp_get_inactive_time(NULL) < CONFIG_LVGL_INACTIVITY_PERIOD_MS) {
lv_task_handler();
}
else {
/* Block after LVGL_ACTIVITY_PERIOD msec inactivity */
thread_flags_wait_one(LVGL_THREAD_FLAG);
/* trigger an activity so the task handler is called on the next loop */
lv_disp_trig_activity(NULL);
}
xtimer_usleep(CONFIG_LVGL_TASK_HANDLER_DELAY_US);
}
}
void lvgl_wakeup(void)

View File

@ -33,9 +33,9 @@ extern "C" {
void lvgl_init(screen_dev_t *screen_dev);
/**
* Start the lvgl task handler background thread
* Run the lvgl task handler
*/
void lvgl_start(void);
void lvgl_run(void);
/**
* @brief Wakeup lvgl when inactive