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

pkg/lv_drivers: initial commit

This commit is contained in:
Francisco Molina 2022-02-28 09:22:36 +01:00
parent 3aeba84820
commit bab49e520d
8 changed files with 198 additions and 0 deletions

View File

@ -32,6 +32,7 @@ rsource "libcose/Kconfig"
rsource "libfixmath/Kconfig"
rsource "libhydrogen/Kconfig"
rsource "lora-serialization/Kconfig"
rsource "lv_drivers/Kconfig"
rsource "lvgl/Kconfig"
rsource "lz4/Kconfig"
rsource "mbedtls/Kconfig"

22
pkg/lv_drivers/Kconfig Normal file
View File

@ -0,0 +1,22 @@
# Copyright (c) 2022 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.
#
menuconfig PACKAGE_LV_DRIVERS
bool "LVGL Drivers Package"
depends on TEST_KCONFIG
depends on PACKAGE_LVGL
config MODULE_LV_DRIVERS_SDL
bool "Monitor driver"
depends on HAS_ARCH_NATIVE
select PACKAGE_LV_DRIVERS
config HAVE_SDL
bool
select MODULE_LV_DRIVERS_SDL if PACKAGE_LVGL
help
Indicates a display monitor is present

18
pkg/lv_drivers/Makefile Normal file
View File

@ -0,0 +1,18 @@
PKG_NAME=lv_drivers
PKG_URL=https://github.com/lvgl/lv_drivers.git
PKG_VERSION=49c4b178494625efefb07891d1c8b9c13914edff # 8.2.0
PKG_LICENSE=MIT
include $(RIOTBASE)/pkg/pkg.mk
IGNORE_MODULES := \
#
LV_DRIVERS_MODULES := $(filter-out $(IGNORE_MODULES),$(filter lv_drivers_%,$(USEMODULE)))
.PHONY: lvgl_%
all: $(LV_DRIVERS_MODULES)
lv_drivers_sdl:
"$(MAKE)" -C $(PKG_SOURCE_DIR)/sdl -f $(CURDIR)/Makefile.lv_drivers_module MODULE=$@ SRC=sdl.c

View File

@ -0,0 +1,5 @@
USEPKG += lvgl
ifneq (,$(filter lv_drivers_sdl,$(USEMODULE)))
FEATURES_REQUIRED += arch_native
endif

View File

@ -0,0 +1,20 @@
INCLUDES += -I$(PKGDIRBASE)/lv_drivers \
-I$(RIOTBASE)/pkg/lv_drivers/include \
#
# Don't use relative includes in lv_drivers, already set in LVGL package
# CFLAGS += -DLV_CONF_INCLUDE_SIMPLE
# lv_drivers module is not a concrete module, so declare it as a pseudomodule
PSEUDOMODULES += lv_drivers
ifneq (,$(filter lv_drivers_sdl,$(USEMODULE)))
SDL_LINKFLAGS = $(call memoized,SDL_LINKFLAGS,$(shell sdl2-config --libs))
LINKFLAGS += $(SDL_LINKFLAGS)
SDL_CFLAGS = $(call memoized,SDL_CFLAGS,$(shell sdl2-config --cflags))
CFLAGS += $(SDL_CFLAGS)
# add SDL to the include path
SDL_INCLUDE_PATH = $(call memoized,SDL_INCLUDE_PATH,$(shell \
sdl2-config --cflags | tr ' ' '\n' | grep '^-I' | cut -c3- | head -n1))
CFLAGS += -DSDL_INCLUDE_PATH="<$(SDL_INCLUDE_PATH)/SDL.h>"
endif

View File

@ -0,0 +1,12 @@
CFLAGS += -Wno-unused-parameter
CFLAGS += -Wno-sign-compare
CFLAGS += -Wno-unused-function
CFLAGS += -Wno-maybe-uninitialized
ifeq (llvm,$(TOOLCHAIN))
CFLAGS += -Wno-empty-translation-unit
CFLAGS += -Wno-newline-eof
CFLAGS += -Wno-missing-braces
endif
include $(RIOTBASE)/Makefile.base

36
pkg/lv_drivers/doc.txt Normal file
View File

@ -0,0 +1,36 @@
/**
@defgroup pkg_lv_drivers LittlevGL Drivers
@ingroup pkg
@brief Display controller and touchpad driver to can be directly used with
LittlevGL.
@note This package needs the 32bit version of SDL2
@see https://github.com/lvgl/lv_drivers
## Configuration options
To change the size of the screen `SDL_HOR_RES` and `SDL_VER_RES` can be changed
via `CFLAGS` or in `lv_drv_conf.h`.
For small screen a zoom factor can be applied through `SDL_ZOOM`, e.g: `SDL_ZOOM=2`
will apply a x2 zoom to the display.
### SDL Requirements
To run lvgl inside a simulator (native), SDL2 is required. Install instructions
can be found at https://docs.lvgl.io/latest/en/html/get-started/pc-simulator.html#install-sdl-2,
note that the 32bit version is needed.
On debian/ubuntu this could be as simple as installing the `libsdl2-dev:i386` package.
Using SDL2 requires more stack so in case you are using it add
```
CFLAGS += '-DTHREAD_STACKSIZE_MAIN=48*1024'
```
to your makefile. 48kB is enough for the test, other uses may need more or may
need this to be applied to other threads using `THREAD_STACKSIZE_DEFAULT`
*/

View File

@ -0,0 +1,84 @@
/*
* Copyright (C) 2022 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_lv_drivers
* @brief LittlevGL Drivers SDL2 configuration headers
*
* @note Based on upstream lv_drv_conf_template.h.
* @{
*
* @author Francisco Molina <francois-xavier.molina@inria.fr>
*/
#ifndef LV_DRV_CONF_H
#define LV_DRV_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include "kernel_defines.h"
#include "lvgl_riot_conf.h"
/*********************
* DISPLAY DRIVERS
*********************/
/*-------------------
* SDL
*-------------------*/
/**
* @brief Internal flag to enable LittlevGL SDL2 based drivers for display, mouse,
* mousewheel and keyboard
*/
#define USE_SDL IS_USED(MODULE_LV_DRIVERS_SDL)
/**
* @brief LittlevGL SDL2 display horizontal resolution
*/
#ifndef SDL_HOR_RES
#define SDL_HOR_RES 320
#endif
/**
* @brief LittlevGL SDL2 display vertical resolution
*/
#ifndef SDL_VER_RES
#define SDL_VER_RES 240
#endif
/**
* @brief LittlevGL display horizontal resolution
*/
#define LV_HOR_RES SDL_HOR_RES
/**
* @brief LittlevGL display vertical resolution
*/
#define LV_VER_RES SDL_VER_RES
/**
* @brief Enable Scale window by this factor (useful when simulating small screens)
*/
#ifndef SDL_ZOOM
#define SDL_ZOOM 1
#endif
/**
* @brief Used to test true double buffering with only address changing.
* Use 2 draw buffers, both with SDL_HOR_RES x SDL_VER_RES size
*/
#define SDL_DOUBLE_BUFFERED 0
/**
* @brief Open two windows to test multi display support
*/
#define SDL_DUAL_DISPLAY 0
#ifdef __cplusplus
}
#endif
#endif /* LV_DRV_CONF_H */
/** @} */