Update to LVGL release/v8.3

This commit is contained in:
Xiaosheng An 2023-08-25 13:58:14 +01:00
parent fd6071f533
commit f61c4f7041
5 changed files with 108 additions and 31 deletions

View File

@ -14,7 +14,7 @@
/*clang-format off*/ /*clang-format off*/
#include <stdint.h> #include <stdint.h>
#include "lv_demo_conf.h"
/*==================== /*====================
COLOR SETTINGS COLOR SETTINGS

@ -1 +1 @@
Subproject commit f14e31612409fc9216892cb58eb9d851667f8a11 Subproject commit 8cdabe8d42bf798d5a31e75cbd5a2cd816c29e5c

View File

@ -1,12 +1,13 @@
/** /**
* @file lv_drv_conf.h * @file lv_drv_conf.h
* Configuration file for v8.0.0 * Configuration file for v8.3.0
*/ */
/* /*
* COPY THIS FILE AS lv_drv_conf.h * COPY THIS FILE AS lv_drv_conf.h
*/ */
/* clang-format off */
#if 1 /*Set it to "1" to enable the content*/ #if 1 /*Set it to "1" to enable the content*/
#ifndef LV_DRV_CONF_H #ifndef LV_DRV_CONF_H
@ -79,16 +80,53 @@
* DISPLAY DRIVERS * DISPLAY DRIVERS
*********************/ *********************/
/*-------------------
* SDL
*-------------------*/
/* SDL based drivers for display, mouse, mousewheel and keyboard*/
#ifndef USE_SDL
# define USE_SDL 1
#endif
/* Hardware accelerated SDL driver */
#ifndef USE_SDL_GPU
# define USE_SDL_GPU 0
#endif
#if USE_SDL || USE_SDL_GPU
# define SDL_HOR_RES 800
# define SDL_VER_RES 480
#define MONITOR_HOR_RES SDL_HOR_RES
#define MONITOR_VER_RES SDL_VER_RES
/* Scale window by this factor (useful when simulating small screens) */
# define SDL_ZOOM 1
/* Used to test true double buffering with only address changing.
* Use 2 draw buffers, bith with SDL_HOR_RES x SDL_VER_RES size*/
# define SDL_DOUBLE_BUFFERED 0
/*Eclipse: <SDL2/SDL.h> Visual Studio: <SDL.h>*/
# define SDL_INCLUDE_PATH <SDL2/SDL.h>
/*Open two windows to test multi display support*/
# define SDL_DUAL_DISPLAY 0
#endif
/*------------------- /*-------------------
* Monitor of PC * Monitor of PC
*-------------------*/ *-------------------*/
/*DEPRECATED: Use the SDL driver instead. */
#ifndef USE_MONITOR #ifndef USE_MONITOR
# define USE_MONITOR 1 # define USE_MONITOR 0
#endif #endif
#if USE_MONITOR #if USE_MONITOR
# define MONITOR_HOR_RES 800 # define MONITOR_HOR_RES 480
# define MONITOR_VER_RES 600 # define MONITOR_VER_RES 320
/* Scale window by this factor (useful when simulating small screens) */ /* Scale window by this factor (useful when simulating small screens) */
# define MONITOR_ZOOM 1 # define MONITOR_ZOOM 1
@ -143,9 +181,18 @@
#endif #endif
#if USE_WAYLAND #if USE_WAYLAND
# define WAYLAND_HOR_RES 480 /* Support for client-side decorations */
# define WAYLAND_VER_RES 320 # ifndef LV_WAYLAND_CLIENT_SIDE_DECORATIONS
# define WAYLAND_SURF_TITLE "LVGL" # define LV_WAYLAND_CLIENT_SIDE_DECORATIONS 1
# endif
/* Support for (deprecated) wl-shell protocol */
# ifndef LV_WAYLAND_WL_SHELL
# define LV_WAYLAND_WL_SHELL 1
# endif
/* Support for xdg-shell protocol */
# ifndef LV_WAYLAND_XDG_SHELL
# define LV_WAYLAND_XDG_SHELL 0
# endif
#endif #endif
/*---------------- /*----------------
@ -276,7 +323,8 @@
#endif #endif
#if USE_FBDEV #if USE_FBDEV
# define FBDEV_PATH "/dev/fb0" # define FBDEV_PATH "/dev/fb0"
# define FBDEV_DISPLAY_POWER_ON 1 /* 1 to force display power during initialization */
#endif #endif
/*----------------------------------------- /*-----------------------------------------
@ -287,7 +335,8 @@
#endif #endif
#if USE_BSD_FBDEV #if USE_BSD_FBDEV
# define FBDEV_PATH "/dev/fb0" # define FBDEV_PATH "/dev/fb0"
# define FBDEV_DISPLAY_POWER_ON 1 /* 1 to force display power during initialization */
#endif #endif
/*----------------------------------------- /*-----------------------------------------
@ -352,8 +401,9 @@
/*--------------------------------------- /*---------------------------------------
* Mouse or touchpad on PC (using SDL) * Mouse or touchpad on PC (using SDL)
*-------------------------------------*/ *-------------------------------------*/
/*DEPRECATED: Use the SDL driver instead. */
#ifndef USE_MOUSE #ifndef USE_MOUSE
# define USE_MOUSE 1 # define USE_MOUSE 0
#endif #endif
#if USE_MOUSE #if USE_MOUSE
@ -363,8 +413,9 @@
/*------------------------------------------- /*-------------------------------------------
* Mousewheel as encoder on PC (using SDL) * Mousewheel as encoder on PC (using SDL)
*------------------------------------------*/ *------------------------------------------*/
/*DEPRECATED: Use the SDL driver instead. */
#ifndef USE_MOUSEWHEEL #ifndef USE_MOUSEWHEEL
# define USE_MOUSEWHEEL 1 # define USE_MOUSEWHEEL 0
#endif #endif
#if USE_MOUSEWHEEL #if USE_MOUSEWHEEL
@ -372,15 +423,22 @@
#endif #endif
/*------------------------------------------------- /*-------------------------------------------------
* Touchscreen as libinput interface (for Linux based systems) * Touchscreen, mouse/touchpad or keyboard as libinput interface (for Linux based systems)
*------------------------------------------------*/ *------------------------------------------------*/
#ifndef USE_LIBINPUT #ifndef USE_LIBINPUT
# define USE_LIBINPUT 0 # define USE_LIBINPUT 0
#endif #endif
#if USE_LIBINPUT #ifndef USE_BSD_LIBINPUT
# define USE_BSD_LIBINPUT 0
#endif
#if USE_LIBINPUT || USE_BSD_LIBINPUT
/*If only a single device of the same type is connected, you can also auto detect it, e.g.:
*#define LIBINPUT_NAME libinput_find_dev(LIBINPUT_CAPABILITY_TOUCH, false)*/
# define LIBINPUT_NAME "/dev/input/event0" /*You can use the "evtest" Linux tool to get the list of devices and test them*/ # define LIBINPUT_NAME "/dev/input/event0" /*You can use the "evtest" Linux tool to get the list of devices and test them*/
#endif /*USE_LIBINPUT*/
#endif /*USE_LIBINPUT || USE_BSD_LIBINPUT*/
/*------------------------------------------------- /*-------------------------------------------------
* Mouse or touchpad as evdev interface (for Linux based systems) * Mouse or touchpad as evdev interface (for Linux based systems)
@ -407,11 +465,29 @@
# endif /*EVDEV_CALIBRATE*/ # endif /*EVDEV_CALIBRATE*/
#endif /*USE_EVDEV*/ #endif /*USE_EVDEV*/
/*-------------------------------------------------
* Full keyboard support for evdev and libinput interface
*------------------------------------------------*/
# ifndef USE_XKB
# define USE_XKB 0
# endif
#if USE_LIBINPUT || USE_BSD_LIBINPUT || USE_EVDEV || USE_BSD_EVDEV
# if USE_XKB
# define XKB_KEY_MAP { .rules = NULL, \
.model = "pc101", \
.layout = "us", \
.variant = NULL, \
.options = NULL } /*"setxkbmap -query" can help find the right values for your keyboard*/
# endif /*USE_XKB*/
#endif /*USE_LIBINPUT || USE_BSD_LIBINPUT || USE_EVDEV || USE_BSD_EVDEV*/
/*------------------------------- /*-------------------------------
* Keyboard of a PC (using SDL) * Keyboard of a PC (using SDL)
*------------------------------*/ *------------------------------*/
/*DEPRECATED: Use the SDL driver instead. */
#ifndef USE_KEYBOARD #ifndef USE_KEYBOARD
# define USE_KEYBOARD 1 # define USE_KEYBOARD 0
#endif #endif
#if USE_KEYBOARD #if USE_KEYBOARD

2
lvgl

@ -1 +1 @@
Subproject commit c597d257984e2cd3a1c883dc97a26d4512b5e60a Subproject commit fd21ed0eb82bacb1e482180ab0aaed6a667f000d

View File

@ -14,11 +14,12 @@
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "lvgl/lvgl.h" #include "lvgl/lvgl.h"
#include "lvgl/examples/lv_examples.h" #include "lvgl/examples/lv_examples.h"
#include "lv_examples/lv_demo.h" #include "lvgl/demos/lv_demos.h"
#include "lv_drivers/display/monitor.h" #include "lv_drivers/sdl/sdl.h"
#include "lv_drivers/indev/mouse.h" // #include "lv_drivers/display/monitor.h"
#include "lv_drivers/indev/keyboard.h" // #include "lv_drivers/indev/mouse.h"
#include "lv_drivers/indev/mousewheel.h" // #include "lv_drivers/indev/keyboard.h"
// #include "lv_drivers/indev/mousewheel.h"
/********************* /*********************
* DEFINES * DEFINES
@ -122,7 +123,7 @@ int main(int argc, char **argv)
static void hal_init(void) static void hal_init(void)
{ {
/* Use the 'monitor' driver which creates window on PC's monitor to simulate a display*/ /* Use the 'monitor' driver which creates window on PC's monitor to simulate a display*/
monitor_init(); sdl_init();
/* Tick init. /* Tick init.
* You have to call 'lv_tick_inc()' in periodically to inform LittelvGL about * You have to call 'lv_tick_inc()' in periodically to inform LittelvGL about
* how much time were elapsed Create an SDL thread to do this*/ * how much time were elapsed Create an SDL thread to do this*/
@ -138,7 +139,7 @@ static void hal_init(void)
static lv_disp_drv_t disp_drv; static lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv); /*Basic initialization*/ lv_disp_drv_init(&disp_drv); /*Basic initialization*/
disp_drv.draw_buf = &disp_buf1; disp_drv.draw_buf = &disp_buf1;
disp_drv.flush_cb = monitor_flush; disp_drv.flush_cb = sdl_display_flush;
disp_drv.hor_res = MONITOR_HOR_RES; disp_drv.hor_res = MONITOR_HOR_RES;
disp_drv.ver_res = MONITOR_VER_RES; disp_drv.ver_res = MONITOR_VER_RES;
disp_drv.antialiasing = 1; disp_drv.antialiasing = 1;
@ -153,27 +154,27 @@ static void hal_init(void)
/* Add the mouse as input device /* Add the mouse as input device
* Use the 'mouse' driver which reads the PC's mouse*/ * Use the 'mouse' driver which reads the PC's mouse*/
mouse_init(); // mouse_init();
static lv_indev_drv_t indev_drv_1; static lv_indev_drv_t indev_drv_1;
lv_indev_drv_init(&indev_drv_1); /*Basic initialization*/ lv_indev_drv_init(&indev_drv_1); /*Basic initialization*/
indev_drv_1.type = LV_INDEV_TYPE_POINTER; indev_drv_1.type = LV_INDEV_TYPE_POINTER;
/*This function will be called periodically (by the library) to get the mouse position and state*/ /*This function will be called periodically (by the library) to get the mouse position and state*/
indev_drv_1.read_cb = mouse_read; indev_drv_1.read_cb = sdl_mouse_read;
lv_indev_t *mouse_indev = lv_indev_drv_register(&indev_drv_1); lv_indev_t *mouse_indev = lv_indev_drv_register(&indev_drv_1);
keyboard_init(); // keyboard_init();
static lv_indev_drv_t indev_drv_2; static lv_indev_drv_t indev_drv_2;
lv_indev_drv_init(&indev_drv_2); /*Basic initialization*/ lv_indev_drv_init(&indev_drv_2); /*Basic initialization*/
indev_drv_2.type = LV_INDEV_TYPE_KEYPAD; indev_drv_2.type = LV_INDEV_TYPE_KEYPAD;
indev_drv_2.read_cb = keyboard_read; indev_drv_2.read_cb = sdl_keyboard_read;
lv_indev_t *kb_indev = lv_indev_drv_register(&indev_drv_2); lv_indev_t *kb_indev = lv_indev_drv_register(&indev_drv_2);
lv_indev_set_group(kb_indev, g); lv_indev_set_group(kb_indev, g);
mousewheel_init(); // mousewheel_init();
static lv_indev_drv_t indev_drv_3; static lv_indev_drv_t indev_drv_3;
lv_indev_drv_init(&indev_drv_3); /*Basic initialization*/ lv_indev_drv_init(&indev_drv_3); /*Basic initialization*/
indev_drv_3.type = LV_INDEV_TYPE_ENCODER; indev_drv_3.type = LV_INDEV_TYPE_ENCODER;
indev_drv_3.read_cb = mousewheel_read; indev_drv_3.read_cb = sdl_mousewheel_read;
lv_indev_t * enc_indev = lv_indev_drv_register(&indev_drv_3); lv_indev_t * enc_indev = lv_indev_drv_register(&indev_drv_3);
lv_indev_set_group(enc_indev, g); lv_indev_set_group(enc_indev, g);