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

pkg/lvgl: bump to v8.2.0

Co-authored-by: Kaspar Schleiser <kaspar@schleiser.de>
Co-authored-by: Koen Zandberg <koen@bergzand.net>
This commit is contained in:
Alexandre Abadie 2021-06-04 13:57:55 +02:00
parent c190a87dce
commit 0a33a08f21
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
9 changed files with 649 additions and 619 deletions

View File

@ -13,10 +13,11 @@ menuconfig PACKAGE_LVGL
select MODULE_LVGL
select MODULE_LVGL_CORE
select MODULE_LVGL_DRAW
select MODULE_LVGL_DRAW_SW
select MODULE_LVGL_EXTRA
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
@ -49,6 +50,12 @@ config MODULE_LVGL_CORE
config MODULE_LVGL_DRAW
bool
config MODULE_LVGL_DRAW_SW
bool
config MODULE_LVGL_EXTRA
bool
config MODULE_LVGL_FONT
bool
@ -58,17 +65,132 @@ config MODULE_LVGL_HAL
config MODULE_LVGL_MISC
bool
config MODULE_LVGL_THEMES
bool
config MODULE_LVGL_WIDGETS
bool
config MODULE_LVGL_WIDGET_ARC
bool "Arc widget"
config MODULE_LVGL_WIDGET_BAR
bool "Bar widget"
config MODULE_LVGL_WIDGET_BTN
bool "Button widget"
config MODULE_LVGL_WIDGET_BTNMATRIX
bool "Button matrix widget"
config MODULE_LVGL_WIDGET_CANVAS
bool "Canvas widget"
config MODULE_LVGL_WIDGET_CHECKBOX
bool "Checkbox widget"
config MODULE_LVGL_WIDGET_DROPDOWN
bool "Dropdown widget"
select MODULE_LVGL_WIDGET_LABEL
config MODULE_LVGL_WIDGET_IMG
bool "Image widget"
select MODULE_LVGL_WIDGET_LABEL
config MODULE_LVGL_WIDGET_LABEL
bool "Label widget"
config MODULE_LVGL_WIDGET_LINE
bool "Line widget"
config MODULE_LVGL_WIDGET_ROLLER
bool "Roller widget"
select MODULE_LVGL_WIDGET_LABEL
config MODULE_LVGL_WIDGET_SLIDER
bool "Slider widget"
select MODULE_LVGL_WIDGET_BAR
config MODULE_LVGL_WIDGET_SWITCH
bool "Switch widget"
config MODULE_LVGL_WIDGET_TEXTAREA
bool "Textarea widget"
select MODULE_LVGL_WIDGET_LABEL
config MODULE_LVGL_WIDGET_TABLE
bool "Table widget"
config MODULE_LVGL_EXTRA_LAYOUT_FLEX
bool "Flex extra layout"
config MODULE_LVGL_EXTRA_LAYOUT_GRID
bool "Grid extra layout"
config MODULE_LVGL_EXTRA_THEME_BASIC
bool "Extra theme basic"
config MODULE_LVGL_EXTRA_THEME_DEFAULT
bool "Extra theme default"
config MODULE_LVGL_EXTRA_THEME_DEFAULT_DARK
bool "Extra theme default in dark mode"
config MODULE_LVGL_EXTRA_THEME_DEFAULT_GROW
bool "Extra theme default with button grow mode"
config MODULE_LVGL_EXTRA_THEME_MONO
bool "Extra theme mono"
config MODULE_LVGL_EXTRA_WIDGET_ANIMING
bool "Animing extra widget"
config MODULE_LVGL_EXTRA_WIDGET_CALENDAR
bool "Calendar extra widget"
config MODULE_LVGL_EXTRA_WIDGET_CHART
bool "Chart extra widget"
config MODULE_LVGL_EXTRA_WIDGET_COLORWHEEL
bool "Colorwheel extra widget"
config MODULE_LVGL_EXTRA_WIDGET_IMGBIN
bool "Imgbin extra widget"
config MODULE_LVGL_EXTRA_WIDGET_LED
bool "Led extra widget"
config MODULE_LVGL_EXTRA_WIDGET_LIST
bool "List extra widget"
config MODULE_LVGL_EXTRA_WIDGET_MENU
bool "Menu extra widget"
config MODULE_LVGL_EXTRA_WIDGET_METER
bool "Meter extra widget"
config MODULE_LVGL_EXTRA_WIDGET_MSGBOX
bool "Message box extra widget"
config MODULE_LVGL_EXTRA_WIDGET_SPINBOX
bool "Spinbox extra widget"
config MODULE_LVGL_EXTRA_WIDGET_SPINNER
bool "Spinner extra widget"
config MODULE_LVGL_EXTRA_WIDGET_TABVIEW
bool "Tabview extra widget"
config MODULE_LVGL_EXTRA_WIDGET_TILEVIEW
bool "Tileview extra widget"
config MODULE_LVGL_EXTRA_WIDGET_WIN
bool "Window extra widget"
select MODULE_LVGL_WIDGET_BTN
select MODULE_LVGL_WIDGET_IMG
select MODULE_LVGL_WIDGET_LABEL
endif # TEST_KCONFIG
menuconfig KCONFIG_USEPKG_LVGL
bool "Configure LVGL"
depends on USEPKG_LVGL
help
Configure LVGL package via Kconfig.

View File

@ -1,25 +1,75 @@
PKG_NAME=lvgl
PKG_URL=https://github.com/littlevgl/lvgl
PKG_VERSION=ec9de515b36641be565d7bace5863ab631ce3b69 # v7.11.0
PKG_VERSION=0b5a1d4b23975b920ff841ea9cd038802f51711b # v8.2.0
PKG_LICENSE=MIT
include $(RIOTBASE)/pkg/pkg.mk
LVGL_MODULES = \
lvgl_core \
lvgl_draw \
lvgl_font \
lvgl_hal \
lvgl_misc \
lvgl_themes \
lvgl_widgets \
CFLAGS += -Wno-empty-body
LVGL_DEFAULT_MODULES = \
lvgl_core \
lvgl_draw \
lvgl_draw_sw \
lvgl_extra \
lvgl_font \
lvgl_hal \
lvgl_misc \
lvgl_widgets \
#
CFLAGS += -Wno-cast-align
LVGL_EXTRA_LAYOUTS_MODULES = \
lvgl_extra_layout_flex \
lvgl_extra_layout_grid \
#
LVGL_EXTRA_THEMES_MODULES = \
lvgl_extra_theme_basic \
lvgl_extra_theme_default \
lvgl_extra_theme_mono \
#
LVGL_EXTRA_WIDGETS_MODULES = \
lvgl_extra_widget_animimg \
lvgl_extra_widget_calendar \
lvgl_extra_widget_chart \
lvgl_extra_widget_colorwheel \
lvgl_extra_widget_imgbtn \
lvgl_extra_widget_keyboard \
lvgl_extra_widget_led \
lvgl_extra_widget_list \
lvgl_extra_widget_menu \
lvgl_extra_widget_meter \
lvgl_extra_widget_msgbox \
lvgl_extra_widget_span \
lvgl_extra_widget_spinbox \
lvgl_extra_widget_spinner \
lvgl_extra_widget_tabview \
lvgl_extra_widget_tileview \
lvgl_extra_widget_win \
#
LVGL_MODULES = $(LVGL_DEFAULT_MODULES) $(LVGL_EXTRA_LAYOUTS_MODULES) $(LVGL_EXTRA_THEMES_MODULES) $(LVGL_EXTRA_WIDGETS_MODULES)
LVGL_MODULES_USED = $(filter $(LVGL_MODULES),$(USEMODULE))
.PHONY: lvgl_%
all: $(LVGL_MODULES)
all: $(LVGL_MODULES_USED)
lvgl_extra_layout_%:
$(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/src/extra/layouts/$* -f $(CURDIR)/Makefile.lvgl_module MODULE=$@
lvgl_extra_theme_%:
$(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/src/extra/themes/$* -f $(CURDIR)/Makefile.lvgl_module MODULE=$@
lvgl_extra_widget_%:
$(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/src/extra/widgets/$* -f $(CURDIR)/Makefile.lvgl_module MODULE=$@
lvgl_extra:
$(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/src/extra -f $(CURDIR)/Makefile.lvgl_module MODULE=$@
lvgl_draw_sw:
$(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/src/draw/sw -f $(CURDIR)/Makefile.lvgl_module MODULE=$@
lvgl_%:
$(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/src/lv_$* -f $(CURDIR)/Makefile.lvgl_module MODULE=$@
$(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/src/$* -f $(CURDIR)/Makefile.lvgl_module MODULE=$@

View File

@ -1,12 +1,30 @@
USEMODULE += lvgl
USEMODULE += lvgl_core
USEMODULE += lvgl_draw
USEMODULE += lvgl_draw_sw
USEMODULE += lvgl_extra
USEMODULE += lvgl_font
USEMODULE += lvgl_hal
USEMODULE += lvgl_misc
USEMODULE += lvgl_themes
USEMODULE += lvgl_widgets
ifneq (,$(filter lvgl_extra_widget_spinner,$(USEMODULE)))
USEMODULE += lvgl_widget_arc
endif
ifneq (,$(filter lvgl_extra_widget_win,$(USEMODULE)))
USEMODULE += lvgl_widget_btn
USEMODULE += lvgl_widget_img
endif
ifneq (,$(filter lvgl_widget_textarea lvgl_widget_roller lvgl_widget_img lvgl_widget_dropdown lvgl_extra_widget_win,$(USEMODULE)))
USEMODULE += lvgl_widget_label
endif
ifneq (,$(filter lvgl_widget_slider,$(USEMODULE)))
USEMODULE += lvgl_widget_bar
endif
ifneq (,$(filter lvgl_contrib,$(USEMODULE)))
USEMODULE += disp_dev
USEMODULE += core_thread_flags

View File

@ -4,6 +4,9 @@ INCLUDES += -I$(PKGDIRBASE)
# Don't use relative includes in lvgl
CFLAGS += -DLV_CONF_INCLUDE_SIMPLE
# fix "cast increases required alignment of target type" raised from a header file
CFLAGS += -Wno-cast-align
ifneq (,$(filter lvgl_contrib,$(USEMODULE)))
DIRS += $(RIOTBASE)/pkg/lvgl/contrib
endif
@ -16,3 +19,24 @@ PSEUDOMODULES += lvgl
# touch capabilities are available via a pseudomodule
PSEUDOMODULES += lvgl_contrib_touch
# extra modes for the default theme
PSEUDOMODULES += lvgl_extra_theme_default_dark
PSEUDOMODULES += lvgl_extra_theme_default_grow
# extra lvgl widgets defined as pseudomodules
PSEUDOMODULES += lvgl_widget_arc
PSEUDOMODULES += lvgl_widget_bar
PSEUDOMODULES += lvgl_widget_btn
PSEUDOMODULES += lvgl_widget_btnmatrix
PSEUDOMODULES += lvgl_widget_canvas
PSEUDOMODULES += lvgl_widget_checkbox
PSEUDOMODULES += lvgl_widget_dropdown
PSEUDOMODULES += lvgl_widget_img
PSEUDOMODULES += lvgl_widget_label
PSEUDOMODULES += lvgl_widget_line
PSEUDOMODULES += lvgl_widget_roller
PSEUDOMODULES += lvgl_widget_slider
PSEUDOMODULES += lvgl_widget_switch
PSEUDOMODULES += lvgl_widget_textarea
PSEUDOMODULES += lvgl_widget_table

View File

@ -32,27 +32,31 @@
#include "screen_dev.h"
#ifndef LVGL_COLOR_BUF_SIZE
#define LVGL_COLOR_BUF_SIZE (LV_HOR_RES_MAX * 5)
#define LVGL_COLOR_BUF_SIZE (LV_HOR_RES_MAX * 10)
#endif
#ifndef CONFIG_LVGL_INACTIVITY_PERIOD_MS
#define CONFIG_LVGL_INACTIVITY_PERIOD_MS (5 * MS_PER_SEC) /* 5s */
#define CONFIG_LVGL_INACTIVITY_PERIOD_MS (5 * MS_PER_SEC) /* 5s */
#endif
#ifndef CONFIG_LVGL_TASK_HANDLER_DELAY_MS
#define CONFIG_LVGL_TASK_HANDLER_DELAY_MS (5) /* 5ms */
#define CONFIG_LVGL_TASK_HANDLER_DELAY_MS (5) /* 5ms */
#endif
#ifndef LVGL_THREAD_FLAG
#define LVGL_THREAD_FLAG (1 << 7)
#define LVGL_THREAD_FLAG (1 << 7)
#endif
static kernel_pid_t _task_thread_pid;
static lv_disp_buf_t disp_buf;
static lv_color_t buf[LVGL_COLOR_BUF_SIZE];
static lv_disp_draw_buf_t disp_buf;
static lv_color_t draw_buf[LVGL_COLOR_BUF_SIZE];
static screen_dev_t *_screen_dev = NULL;
static lv_disp_drv_t disp_drv;
#if IS_USED(MODULE_TOUCH_DEV)
static lv_indev_drv_t indev_drv;
#endif
static void _disp_map(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_p)
{
@ -60,6 +64,10 @@ static void _disp_map(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *col
return;
}
if (!area) {
return;
}
disp_dev_map(_screen_dev->display, area->x1, area->x2, area->y1, area->y2,
(const uint16_t *)color_p);
@ -70,10 +78,14 @@ static void _disp_map(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *col
#if IS_USED(MODULE_TOUCH_DEV)
/* adapted from https://github.com/lvgl/lvgl/tree/v6.1.2#add-littlevgl-to-your-project */
static bool _touch_read(lv_indev_drv_t *indev_driver, lv_indev_data_t *data)
static void _touch_read(lv_indev_drv_t *indev_driver, lv_indev_data_t *data)
{
if (!_screen_dev->touch) {
return false;
return;
}
if (!data) {
return;
}
(void)indev_driver;
@ -94,7 +106,7 @@ static bool _touch_read(lv_indev_drv_t *indev_driver, lv_indev_data_t *data)
data->point.x = last_x;
data->point.y = last_y;
return false;
return;
}
#endif
@ -104,21 +116,20 @@ void lvgl_init(screen_dev_t *screen_dev)
_screen_dev = screen_dev;
assert(screen_dev->display);
lv_disp_drv_t disp_drv;
lv_disp_draw_buf_init(&disp_buf, draw_buf, NULL, LVGL_COLOR_BUF_SIZE);
lv_disp_drv_init(&disp_drv);
disp_drv.draw_buf = &disp_buf;
disp_drv.flush_cb = _disp_map;
/* Configure horizontal and vertical resolutions based on the
underlying display device parameters */
disp_drv.hor_res = disp_dev_width(screen_dev->display);
disp_drv.ver_res = disp_dev_height(screen_dev->display);
disp_drv.flush_cb = _disp_map;
disp_drv.buffer = &disp_buf;
lv_disp_drv_register(&disp_drv);
lv_disp_buf_init(&disp_buf, buf, NULL, LVGL_COLOR_BUF_SIZE);
#if IS_USED(MODULE_TOUCH_DEV)
if (screen_dev->touch) {
lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = _touch_read;
@ -131,18 +142,15 @@ void lvgl_run(void)
{
_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();
lv_timer_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);
}

File diff suppressed because it is too large Load Diff

View File

@ -19,18 +19,40 @@
#ifndef LVGL_RIOT_CONF_H
#define LVGL_RIOT_CONF_H
#include "board.h"
#ifdef __cplusplus
extern "C" {
#endif
/** Maximal horizontal resolution to support by the library.*/
#ifndef LV_HOR_RES_MAX
#ifdef LCD_SCREEN_WIDTH
#define LV_HOR_RES_MAX (LCD_SCREEN_WIDTH)
#else
#define LV_HOR_RES_MAX (320)
#endif
#endif
/** Maximal vertical resolution to support by the library.*/
#ifndef LV_VER_RES_MAX
#ifdef LCD_SCREEN_HEIGHT
#define LV_VER_RES_MAX (LCD_SCREEN_HEIGHT)
#else
#define LV_VER_RES_MAX (240)
#endif
#endif
/** Will be added where memories needs to be aligned (with -Os data might not be aligned to boundary by default).
* E.g. __attribute__((aligned(4)))*/
#define LV_ATTRIBUTE_MEM_ALIGN __attribute__((aligned(4)))
/* 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 "ztimer.h" /*Header for the sys time function*/
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (ztimer_now(ZTIMER_MSEC)) /*Expression evaluating to current systime in ms*/
#endif /*LV_TICK_CUSTOM*/
#ifdef __cplusplus
}

View File

@ -1,5 +0,0 @@
# 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

@ -1,5 +0,0 @@
# 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