diff --git a/pkg/lvgl/Makefile.include b/pkg/lvgl/Makefile.include index 86d3a5807e..714644097d 100644 --- a/pkg/lvgl/Makefile.include +++ b/pkg/lvgl/Makefile.include @@ -8,27 +8,6 @@ ifneq (,$(filter lvgl_contrib,$(USEMODULE))) DIRS += $(RIOTBASE)/pkg/lvgl/contrib 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 PSEUDOMODULES += lvgl diff --git a/pkg/lvgl/contrib/lvgl.c b/pkg/lvgl/contrib/lvgl.c index 94546e72c0..2245b7f9b3 100644 --- a/pkg/lvgl/contrib/lvgl.c +++ b/pkg/lvgl/contrib/lvgl.c @@ -26,7 +26,6 @@ #include "log.h" #include "lvgl/lvgl.h" -#include "lv_conf.h" #include "lvgl_riot.h" #include "screen_dev.h" @@ -39,12 +38,12 @@ #define LVGL_COLOR_BUF_SIZE (LV_HOR_RES_MAX * 5) #endif -#ifndef LVGL_INACTIVITY_PERIOD_MS -#define LVGL_INACTIVITY_PERIOD_MS (1 * MS_PER_SEC) /* 1s */ +#ifndef CONFIG_LVGL_INACTIVITY_PERIOD_MS +#define CONFIG_LVGL_INACTIVITY_PERIOD_MS (5 * MS_PER_SEC) /* 5s */ #endif -#ifndef LVGL_TASK_HANDLER_DELAY_US -#define LVGL_TASK_HANDLER_DELAY_US (5 * US_PER_MS) /* 5ms */ +#ifndef CONFIG_LVGL_TASK_HANDLER_DELAY_US +#define CONFIG_LVGL_TASK_HANDLER_DELAY_US (5 * US_PER_MS) /* 5ms */ #endif #ifndef LVGL_THREAD_FLAG @@ -65,9 +64,9 @@ static void *_task_thread(void *arg) (void)arg; while (1) { - /* Normal operation (no sleep) in < LVGL_INACTIVITY_PERIOD_MS msec + /* Normal operation (no sleep) in < CONFIG_LVGL_INACTIVITY_PERIOD_MS msec 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(); } else { @@ -78,7 +77,7 @@ static void *_task_thread(void *arg) lv_disp_trig_activity(NULL); } - xtimer_usleep(LVGL_TASK_HANDLER_DELAY_US); + xtimer_usleep(CONFIG_LVGL_TASK_HANDLER_DELAY_US); } return NULL; diff --git a/pkg/lvgl/doc.txt b/pkg/lvgl/doc.txt index 1ecfe38607..feaebc7445 100644 --- a/pkg/lvgl/doc.txt +++ b/pkg/lvgl/doc.txt @@ -8,26 +8,14 @@ ## Configuration options 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 -Makefile. - -### 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. +either be configured using CFLAGS or using Kconfig (via `make menuconfig`). +LVGL_TASK_THREAD_PRIO cannot be configured via Kconfig. ### Engine settings -- `LVGL_INACTIVITY_PERIOD_MS`: maximum inactivity period before going to sleep in ms. - (default: 1s) -- `LVGL_TASK_HANDLER_DELAY_US`: delay between lvgl task handle call in ms. +- `CONFIG_LVGL_INACTIVITY_PERIOD_MS`: maximum inactivity period before going to sleep in ms. + (default: 5s) +- `CONFIG_LVGL_TASK_HANDLER_DELAY_US`: delay between lvgl task handle call in us. (default: 5ms) - `LVGL_TASK_THREAD_PRIO`: lvgl task handler thread priority. (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: ``` -LVGL_ACTIVITY_PERIOD=5000 make -C tests/pkg_lvgl +CFLAGS=-DCONFIG_LVGL_ACTIVITY_PERIOD=5000 make -C tests/pkg_lvgl ``` */