diff --git a/lv_conf.h b/lv_conf.h index f918f14..9e5513f 100644 --- a/lv_conf.h +++ b/lv_conf.h @@ -14,7 +14,7 @@ /*clang-format off*/ #include - +#include "lv_demo_conf.h" /*==================== COLOR SETTINGS diff --git a/lv_drivers b/lv_drivers index f14e316..8cdabe8 160000 --- a/lv_drivers +++ b/lv_drivers @@ -1 +1 @@ -Subproject commit f14e31612409fc9216892cb58eb9d851667f8a11 +Subproject commit 8cdabe8d42bf798d5a31e75cbd5a2cd816c29e5c diff --git a/lv_drv_conf.h b/lv_drv_conf.h index fb7c8c6..304793f 100644 --- a/lv_drv_conf.h +++ b/lv_drv_conf.h @@ -1,12 +1,13 @@ /** * @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 */ +/* clang-format off */ #if 1 /*Set it to "1" to enable the content*/ #ifndef LV_DRV_CONF_H @@ -79,16 +80,53 @@ * 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: Visual Studio: */ +# define SDL_INCLUDE_PATH + +/*Open two windows to test multi display support*/ +# define SDL_DUAL_DISPLAY 0 +#endif + /*------------------- * Monitor of PC *-------------------*/ + +/*DEPRECATED: Use the SDL driver instead. */ #ifndef USE_MONITOR -# define USE_MONITOR 1 +# define USE_MONITOR 0 #endif #if USE_MONITOR -# define MONITOR_HOR_RES 800 -# define MONITOR_VER_RES 600 +# define MONITOR_HOR_RES 480 +# define MONITOR_VER_RES 320 /* Scale window by this factor (useful when simulating small screens) */ # define MONITOR_ZOOM 1 @@ -143,9 +181,18 @@ #endif #if USE_WAYLAND -# define WAYLAND_HOR_RES 480 -# define WAYLAND_VER_RES 320 -# define WAYLAND_SURF_TITLE "LVGL" +/* Support for client-side decorations */ +# ifndef LV_WAYLAND_CLIENT_SIDE_DECORATIONS +# 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 /*---------------- @@ -276,7 +323,8 @@ #endif #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 /*----------------------------------------- @@ -287,7 +335,8 @@ #endif #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 /*----------------------------------------- @@ -352,8 +401,9 @@ /*--------------------------------------- * Mouse or touchpad on PC (using SDL) *-------------------------------------*/ +/*DEPRECATED: Use the SDL driver instead. */ #ifndef USE_MOUSE -# define USE_MOUSE 1 +# define USE_MOUSE 0 #endif #if USE_MOUSE @@ -363,8 +413,9 @@ /*------------------------------------------- * Mousewheel as encoder on PC (using SDL) *------------------------------------------*/ +/*DEPRECATED: Use the SDL driver instead. */ #ifndef USE_MOUSEWHEEL -# define USE_MOUSEWHEEL 1 +# define USE_MOUSEWHEEL 0 #endif #if USE_MOUSEWHEEL @@ -372,15 +423,22 @@ #endif /*------------------------------------------------- - * Touchscreen as libinput interface (for Linux based systems) + * Touchscreen, mouse/touchpad or keyboard as libinput interface (for Linux based systems) *------------------------------------------------*/ #ifndef USE_LIBINPUT # define USE_LIBINPUT 0 #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*/ -#endif /*USE_LIBINPUT*/ + +#endif /*USE_LIBINPUT || USE_BSD_LIBINPUT*/ /*------------------------------------------------- * Mouse or touchpad as evdev interface (for Linux based systems) @@ -407,11 +465,29 @@ # endif /*EVDEV_CALIBRATE*/ #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) *------------------------------*/ +/*DEPRECATED: Use the SDL driver instead. */ #ifndef USE_KEYBOARD -# define USE_KEYBOARD 1 +# define USE_KEYBOARD 0 #endif #if USE_KEYBOARD diff --git a/lvgl b/lvgl index c597d25..fd21ed0 160000 --- a/lvgl +++ b/lvgl @@ -1 +1 @@ -Subproject commit c597d257984e2cd3a1c883dc97a26d4512b5e60a +Subproject commit fd21ed0eb82bacb1e482180ab0aaed6a667f000d diff --git a/main/src/main.c b/main/src/main.c index 7c9fe1a..9c57787 100644 --- a/main/src/main.c +++ b/main/src/main.c @@ -14,11 +14,12 @@ #include #include "lvgl/lvgl.h" #include "lvgl/examples/lv_examples.h" -#include "lv_examples/lv_demo.h" -#include "lv_drivers/display/monitor.h" -#include "lv_drivers/indev/mouse.h" -#include "lv_drivers/indev/keyboard.h" -#include "lv_drivers/indev/mousewheel.h" +#include "lvgl/demos/lv_demos.h" +#include "lv_drivers/sdl/sdl.h" +// #include "lv_drivers/display/monitor.h" +// #include "lv_drivers/indev/mouse.h" +// #include "lv_drivers/indev/keyboard.h" +// #include "lv_drivers/indev/mousewheel.h" /********************* * DEFINES @@ -122,7 +123,7 @@ int main(int argc, char **argv) static void hal_init(void) { /* Use the 'monitor' driver which creates window on PC's monitor to simulate a display*/ - monitor_init(); + sdl_init(); /* Tick init. * 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*/ @@ -138,7 +139,7 @@ static void hal_init(void) static lv_disp_drv_t disp_drv; lv_disp_drv_init(&disp_drv); /*Basic initialization*/ 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.ver_res = MONITOR_VER_RES; disp_drv.antialiasing = 1; @@ -153,27 +154,27 @@ static void hal_init(void) /* Add the mouse as input device * Use the 'mouse' driver which reads the PC's mouse*/ - mouse_init(); + // mouse_init(); static lv_indev_drv_t indev_drv_1; lv_indev_drv_init(&indev_drv_1); /*Basic initialization*/ indev_drv_1.type = LV_INDEV_TYPE_POINTER; /*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); - keyboard_init(); + // keyboard_init(); static lv_indev_drv_t indev_drv_2; lv_indev_drv_init(&indev_drv_2); /*Basic initialization*/ 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_set_group(kb_indev, g); - mousewheel_init(); + // mousewheel_init(); static lv_indev_drv_t indev_drv_3; lv_indev_drv_init(&indev_drv_3); /*Basic initialization*/ 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_set_group(enc_indev, g);