pkg/lvgl: prepare config variables for Kconfig
This commit is contained in:
parent
f30065e61f
commit
438753f285
@ -8,27 +8,6 @@ ifneq (,$(filter lvgl_contrib,$(USEMODULE)))
|
|||||||
DIRS += $(RIOTBASE)/pkg/lvgl/contrib
|
DIRS += $(RIOTBASE)/pkg/lvgl/contrib
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Configuration options
|
|
||||||
# Graphical settings
|
|
||||||
LVGL_COLOR_DEPTH ?= 16
|
|
||||||
LVGL_COLOR_16_SWAP ?= 1
|
|
||||||
|
|
||||||
# Memory settings
|
|
||||||
LVGL_MEM_SIZE ?= 5U*1024U
|
|
||||||
|
|
||||||
# Engine settings
|
|
||||||
LVGL_INACTIVITY_PERIOD_MS ?= 5*MS_PER_SEC # 5s
|
|
||||||
LVGL_TASK_HANDLER_DELAY_US ?= 5*US_PER_MS # 5ms
|
|
||||||
LVGL_TASK_THREAD_PRIO ?= THREAD_PRIORITY_MAIN+1
|
|
||||||
|
|
||||||
# Set the CFLAGS variable accordingly
|
|
||||||
CFLAGS += -DLV_COLOR_DEPTH=$(LVGL_COLOR_DEPTH)
|
|
||||||
CFLAGS += -DLV_COLOR_16_SWAP=$(LVGL_COLOR_16_SWAP)
|
|
||||||
CFLAGS += -DLV_MEM_SIZE=$(LVGL_MEM_SIZE)
|
|
||||||
CFLAGS += -DLVGL_INACTIVITY_PERIOD_MS=$(LVGL_INACTIVITY_PERIOD_MS)
|
|
||||||
CFLAGS += -DLVGL_TASK_HANDLER_DELAY_US=$(LVGL_TASK_HANDLER_DELAY_US)
|
|
||||||
CFLAGS += -DLVGL_TASK_THREAD_PRIO=$(LVGL_TASK_THREAD_PRIO)
|
|
||||||
|
|
||||||
# lvgl module is not a concrete module, so declare it as a pseudomodule
|
# lvgl module is not a concrete module, so declare it as a pseudomodule
|
||||||
PSEUDOMODULES += lvgl
|
PSEUDOMODULES += lvgl
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,6 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
#include "lvgl/lvgl.h"
|
#include "lvgl/lvgl.h"
|
||||||
#include "lv_conf.h"
|
|
||||||
#include "lvgl_riot.h"
|
#include "lvgl_riot.h"
|
||||||
|
|
||||||
#include "screen_dev.h"
|
#include "screen_dev.h"
|
||||||
@ -39,12 +38,12 @@
|
|||||||
#define LVGL_COLOR_BUF_SIZE (LV_HOR_RES_MAX * 5)
|
#define LVGL_COLOR_BUF_SIZE (LV_HOR_RES_MAX * 5)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef LVGL_INACTIVITY_PERIOD_MS
|
#ifndef CONFIG_LVGL_INACTIVITY_PERIOD_MS
|
||||||
#define LVGL_INACTIVITY_PERIOD_MS (1 * MS_PER_SEC) /* 1s */
|
#define CONFIG_LVGL_INACTIVITY_PERIOD_MS (5 * MS_PER_SEC) /* 5s */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef LVGL_TASK_HANDLER_DELAY_US
|
#ifndef CONFIG_LVGL_TASK_HANDLER_DELAY_US
|
||||||
#define LVGL_TASK_HANDLER_DELAY_US (5 * US_PER_MS) /* 5ms */
|
#define CONFIG_LVGL_TASK_HANDLER_DELAY_US (5 * US_PER_MS) /* 5ms */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef LVGL_THREAD_FLAG
|
#ifndef LVGL_THREAD_FLAG
|
||||||
@ -65,9 +64,9 @@ static void *_task_thread(void *arg)
|
|||||||
(void)arg;
|
(void)arg;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
/* Normal operation (no sleep) in < LVGL_INACTIVITY_PERIOD_MS msec
|
/* Normal operation (no sleep) in < CONFIG_LVGL_INACTIVITY_PERIOD_MS msec
|
||||||
inactivity */
|
inactivity */
|
||||||
if (lv_disp_get_inactive_time(NULL) < LVGL_INACTIVITY_PERIOD_MS) {
|
if (lv_disp_get_inactive_time(NULL) < CONFIG_LVGL_INACTIVITY_PERIOD_MS) {
|
||||||
lv_task_handler();
|
lv_task_handler();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -78,7 +77,7 @@ static void *_task_thread(void *arg)
|
|||||||
lv_disp_trig_activity(NULL);
|
lv_disp_trig_activity(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
xtimer_usleep(LVGL_TASK_HANDLER_DELAY_US);
|
xtimer_usleep(CONFIG_LVGL_TASK_HANDLER_DELAY_US);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@ -8,26 +8,14 @@
|
|||||||
## Configuration options
|
## Configuration options
|
||||||
|
|
||||||
The package can be configured with using several variables. These variables can
|
The package can be configured with using several variables. These variables can
|
||||||
either be passed directly to build command line or set in the application
|
either be configured using CFLAGS or using Kconfig (via `make menuconfig`).
|
||||||
Makefile.
|
LVGL_TASK_THREAD_PRIO cannot be configured via Kconfig.
|
||||||
|
|
||||||
### Graphical settings
|
|
||||||
|
|
||||||
- `LVGL_COLOR_DEPTH`: configure the color depth in bit of the screen (default: 16)
|
|
||||||
- `LVGL_COLOR_16_SWAP`: enable byte swap when communicating with the screen
|
|
||||||
driver (default: 1, enabled)
|
|
||||||
|
|
||||||
### Memory settings
|
|
||||||
|
|
||||||
`LVGL_MEM_SIZE`: configure the maximum memory size used by lvgl. This depends
|
|
||||||
on the number of lvgl widgets and objects used by the interface (default:
|
|
||||||
5U*1024U, 5KiB). Must be greater than 2KiB.
|
|
||||||
|
|
||||||
### Engine settings
|
### Engine settings
|
||||||
|
|
||||||
- `LVGL_INACTIVITY_PERIOD_MS`: maximum inactivity period before going to sleep in ms.
|
- `CONFIG_LVGL_INACTIVITY_PERIOD_MS`: maximum inactivity period before going to sleep in ms.
|
||||||
(default: 1s)
|
(default: 5s)
|
||||||
- `LVGL_TASK_HANDLER_DELAY_US`: delay between lvgl task handle call in ms.
|
- `CONFIG_LVGL_TASK_HANDLER_DELAY_US`: delay between lvgl task handle call in us.
|
||||||
(default: 5ms)
|
(default: 5ms)
|
||||||
- `LVGL_TASK_THREAD_PRIO`: lvgl task handler thread priority.
|
- `LVGL_TASK_THREAD_PRIO`: lvgl task handler thread priority.
|
||||||
(default: THREAD_PRIORITY_MAIN - 1)
|
(default: THREAD_PRIORITY_MAIN - 1)
|
||||||
@ -35,7 +23,7 @@ on the number of lvgl widgets and objects used by the interface (default:
|
|||||||
Example of command line for changing the max activity period to 5s:
|
Example of command line for changing the max activity period to 5s:
|
||||||
|
|
||||||
```
|
```
|
||||||
LVGL_ACTIVITY_PERIOD=5000 make -C tests/pkg_lvgl
|
CFLAGS=-DCONFIG_LVGL_ACTIVITY_PERIOD=5000 make -C tests/pkg_lvgl
|
||||||
```
|
```
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user