1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 05:12:57 +01:00

Merge pull request #16346 from aabadie/pr/pkg/lvgl_bump

pkg/lvgl: bump to latest version + model configuration in Kconfig
This commit is contained in:
Leandro Lanzieri 2021-04-28 13:00:06 +02:00 committed by GitHub
commit 99fd0944a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 188 additions and 66 deletions

View File

@ -43,6 +43,8 @@ tests/pkg_libcose
tests/pkg_libfixmath
tests/pkg_libhydrogen
tests/pkg_lora-serialization
tests/pkg_lvgl
tests/pkg_lvgl_touch
tests/pkg_micro-ecc
tests/pkg_minmea
tests/pkg_monocypher

View File

@ -176,7 +176,7 @@ GENERATED_DIR_DEP := $(if $(CLEAN),,|) $(GENERATED_DIR)
# Generates a .config file by merging multiple sources specified in
# MERGE_SOURCES. This will also generate KCONFIG_OUT_DEP with the list of used
# Kconfig files.
$(KCONFIG_OUT_CONFIG): $(KCONFIG_EXTERNAL_CONFIGS)
$(KCONFIG_OUT_CONFIG): $(KCONFIG_EXTERNAL_CONFIGS) | pkg-prepare
$(KCONFIG_OUT_CONFIG): $(GENERATED_DEPENDENCIES_DEP) $(GENCONFIG) $(MERGE_SOURCES) $(GENERATED_DIR_DEP)
$(Q) $(GENCONFIG) \
--config-out=$(KCONFIG_OUT_CONFIG) \

View File

@ -23,6 +23,7 @@ rsource "libcose/Kconfig"
rsource "libfixmath/Kconfig"
rsource "libhydrogen/Kconfig"
rsource "lora-serialization/Kconfig"
rsource "lvgl/Kconfig"
rsource "micro-ecc/Kconfig"
rsource "microcoap/Kconfig"
rsource "minmea/Kconfig"

90
pkg/lvgl/Kconfig Normal file
View File

@ -0,0 +1,90 @@
# Copyright (c) 2021 Inria
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#
if TEST_KCONFIG
menuconfig PACKAGE_LVGL
bool "LVGL package"
imply MODULE_AUTO_INIT_SCREEN
select MODULE_LVGL
select MODULE_LVGL_CORE
select MODULE_LVGL_DRAW
select MODULE_LVGL_FONT
select MODULE_LVGL_HAL
select MODULE_LVGL_MISC
select MODULE_LVGL_THEMES
select MODULE_LVGL_WIDGETS
# lvgl is not compatible with non 32bit platforms
# Building lv_misc triggers the error:
# "left shift count >= width of type [-Werror=shift-count-overflow]"
depends on !HAS_ARCH_8BIT
depends on !HAS_ARCH_16BIT
if PACKAGE_LVGL
config MODULE_LVGL_CONTRIB
bool "Contrib"
select MODULE_DISP_DEV
select MODULE_CORE_THREAD_FLAGS
select MODULE_XTIMER
config MODULE_LVGL_CONTRIB_TOUCH
bool "Touch support"
select MODULE_TOUCH_DEV
endif # PACKAGE_LVGL
config MODULE_LVGL
bool
config MODULE_LVGL_CORE
bool
config MODULE_LVGL_DRAW
bool
config MODULE_LVGL_FONT
bool
config MODULE_LVGL_HAL
bool
config MODULE_LVGL_MISC
bool
config MODULE_LVGL_THEMES
bool
config MODULE_LVGL_WIDGETS
bool
endif # TEST_KCONFIG
menuconfig KCONFIG_USEPKG_LVGL
bool "Configure LVGL"
depends on USEPKG_LVGL
help
Configure LVGL package via Kconfig.
if KCONFIG_USEPKG_LVGL
menu "LVGL RIOT configuration"
config LVGL_INACTIVITY_PERIOD_MS
int "Inactivity period before blocking the LVGL thread (in ms)"
default 5000
config LVGL_TASK_HANDLER_DELAY_US
int "Delay between calls to the lvgl task handler (in us)"
default 5000
endmenu
osource "$(RIOTBASE)/build/pkg/lvgl/Kconfig"
endif

View File

@ -1,6 +1,6 @@
PKG_NAME=lvgl
PKG_URL=https://github.com/littlevgl/lvgl
PKG_VERSION=5035c0c7809d288d5b5d141a22b0bf9bf932cf1b # v7.7.1
PKG_VERSION=ec9de515b36641be565d7bace5863ab631ce3b69 # v7.11.0
PKG_LICENSE=MIT
include $(RIOTBASE)/pkg/pkg.mk

View File

@ -8,26 +8,8 @@ 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)
# Configure the lvgl_riot_conf.h header for lvgl kconfig management
CFLAGS += -DLV_CONF_KCONFIG_EXTERNAL_INCLUDE=\""lvgl_riot_conf.h"\"
# lvgl module is not a concrete module, so declare it as a pseudomodule
PSEUDOMODULES += lvgl

View File

@ -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;

View File

@ -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
```
*/

View File

@ -22,6 +22,7 @@ extern "C" {
#endif
#include <stdint.h>
#include "lvgl_riot_conf.h"
/*====================
Graphical settings
@ -83,9 +84,6 @@ extern "C" {
#define LV_DISP_MEDIUM_LIMIT 50
#define LV_DISP_LARGE_LIMIT 70
/* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */
typedef int16_t lv_coord_t;
/*=========================
Memory manager settings
*=========================*/
@ -298,14 +296,6 @@ typedef void * lv_img_decoder_user_data_t;
* HAL settings
*==================*/
/* 1: use a custom tick source.
* It removes the need to manually update the tick with `lv_tick_inc`) */
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM == 1
#define LV_TICK_CUSTOM_INCLUDE "xtimer.h" /*Header for the sys time function*/
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (xtimer_now_usec() / US_PER_MS) /*Expression evaluating to current systime in ms*/
#endif /*LV_TICK_CUSTOM*/
typedef void * lv_disp_drv_user_data_t; /*Type of user data in the display driver*/
typedef void * lv_indev_drv_user_data_t; /*Type of user data in the input device driver*/
@ -382,8 +372,8 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
/* Montserrat fonts with bpp = 4
* https://fonts.google.com/specimen/Montserrat */
#define LV_FONT_MONTSERRAT_12 0
#define LV_FONT_MONTSERRAT_14 1
#define LV_FONT_MONTSERRAT_12 1
#define LV_FONT_MONTSERRAT_14 0
#define LV_FONT_MONTSERRAT_16 0
#define LV_FONT_MONTSERRAT_18 0
#define LV_FONT_MONTSERRAT_20 0
@ -477,10 +467,10 @@ typedef void * lv_font_user_data_t;
#define LV_THEME_DEFAULT_COLOR_PRIMARY lv_color_hex(0x01a2b1)
#define LV_THEME_DEFAULT_COLOR_SECONDARY lv_color_hex(0x44d1b6)
#define LV_THEME_DEFAULT_FLAG LV_THEME_MATERIAL_FLAG_DARK
#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_14
#define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_14
#define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_14
#define LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_14
#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_12
#define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_12
#define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_12
#define LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_12
/*=================
* Text settings

View File

@ -0,0 +1,39 @@
/*
* Copyright (C) 2021 Inria
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup pkg_lvgl
* @{
*
* @file
* @brief Definitions specific to RIOT for the LittlevGL engine
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*/
#ifndef LVGL_RIOT_CONF_H
#define LVGL_RIOT_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */
typedef int16_t lv_coord_t;
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM == 1
#define LV_TICK_CUSTOM_INCLUDE "xtimer.h" /*Header for the sys time function*/
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (xtimer_now_usec() / US_PER_MS) /*Expression evaluating to current systime in ms*/
#endif /*LV_TICK_CUSTOM*/
#ifdef __cplusplus
}
#endif
#endif /* LVGL_RIOT_CONF_H */

View File

@ -5,7 +5,7 @@
# directory for more details.
#
config MODULE_AUTO_INIT
menuconfig MODULE_AUTO_INIT
bool "Auto-initialization system"
default y
depends on TEST_KCONFIG
@ -14,4 +14,9 @@ config MODULE_AUTO_INIT
drivers, or network interfaces) on start-up automatically. Disable if a
more custom initialization is required. If unsure, say Y.
if MODULE_AUTO_INIT
rsource "screen/Kconfig"
rsource "multimedia/Kconfig"
endif # MODULE_AUTO_INIT

View File

@ -0,0 +1,9 @@
# Copyright (c) 2021 HAW Hamburg
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#
config MODULE_AUTO_INIT_SCREEN
bool "Auto-initialize screens"

View File

@ -0,0 +1,5 @@
# Sample lvgl configuration
CONFIG_KCONFIG_USEPKG_LVGL=y
CONFIG_LV_COLOR_DEPTH_16=y
CONFIG_LV_COLOR_16_SWAP=y
CONFIG_LV_MEM_SIZE_KILOBYTES=5

View File

@ -0,0 +1,2 @@
CONFIG_PACKAGE_LVGL=y
CONFIG_MODULE_LVGL_CONTRIB=y

View File

@ -0,0 +1,5 @@
# Sample lvgl configuration
CONFIG_KCONFIG_USEPKG_LVGL=y
CONFIG_LV_COLOR_DEPTH_16=y
CONFIG_LV_COLOR_16_SWAP=y
CONFIG_LV_MEM_SIZE_KILOBYTES=5

View File

@ -0,0 +1,5 @@
CONFIG_PACKAGE_LVGL=y
CONFIG_MODULE_LVGL_CONTRIB=y
# Add touch capabilities
CONFIG_MODULE_LVGL_CONTRIB_TOUCH=y